Pull ACPI fixes from Rafael Wysocki: "These fix two recent issues in the ACPI memory mappings management code and tighten up error handling in the ACPI driver for AMD SoCs (APD). Specifics: - Avoid redundant rounding to the page size in acpi_os_map_iomem() to address a recently introduced issue with the EFI memory map permission check on ARM64 (Ard Biesheuvel). - Fix acpi_release_memory() to wait until the memory mappings released by it have been really unmapped (Rafael Wysocki). - Make the ACPI driver for AMD SoCs (APD) check the return value of acpi_dev_get_property() to avoid failures in the cases when the device property under inspection is missing (Furquan Shaikh)" * tag 'acpi-5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: OSL: Prevent acpi_release_memory() from returning too early ACPI: ioremap: avoid redundant rounding to OS page size ACPI: SoC: APD: Check return value of acpi_dev_get_property()
Unified · Split
| @@ -99,8 +99,8 @@ static int fch_misc_setup(struct apd_private_data *pdata) · 98 unmodified lines | |||
| 99 | if (ret < 0) | 99 | if (ret < 0) |
| 100 | return -ENOENT; | 100 | return -ENOENT; |
| 101 | 101 | ||
| 102 | acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj); | 102 | if (!acpi_dev_get_property(adev, "is-rv", ACPI_TYPE_INTEGER, &obj)) |
| 103 | clk_data->is_rv = obj->integer.value; | 103 | clk_data->is_rv = obj->integer.value; |
| 104 | 104 | ||
| 105 | list_for_each_entry(rentry, &resource_list, node) { | 105 | list_for_each_entry(rentry, &resource_list, node) { |
| 106 | clk_data->base = devm_ioremap(&adev->dev, rentry->res->start, | 106 | clk_data->base = devm_ioremap(&adev->dev, rentry->res->start, |
| @@ -350,7 +350,7 @@ void __iomem __ref · 349 unmodified lines | |||
| 350 | 350 | ||
| 351 | pg_off = round_down(phys, PAGE_SIZE); | 351 | pg_off = round_down(phys, PAGE_SIZE); |
| 352 | pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; | 352 | pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; |
| 353 | virt = acpi_map(pg_off, pg_sz); | 353 | virt = acpi_map(phys, size); |
| 354 | if (!virt) { | 354 | if (!virt) { |
| 355 | mutex_unlock(&acpi_ioremap_lock); | 355 | mutex_unlock(&acpi_ioremap_lock); |
| 356 | kfree(map); | 356 | kfree(map); |
| @@ -358,7 +358,7 @@ void __iomem __ref · 1 unmodified line | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | INIT_LIST_HEAD(&map->list); | 360 | INIT_LIST_HEAD(&map->list); |
| 361 | map->virt = virt; | 361 | map->virt = (void __iomem __force *)((unsigned long)virt & PAGE_MASK); |
| 362 | map->phys = pg_off; | 362 | map->phys = pg_off; |
| 363 | map->size = pg_sz; | 363 | map->size = pg_sz; |
| 364 | map->track.refcount = 1; | 364 | map->track.refcount = 1; |
| @@ -1575,11 +1575,26 @@ static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level, · 1210 unmodified lines | |||
| 1575 | acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, | 1575 | acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, |
| 1576 | u32 level) | 1576 | u32 level) |
| 1577 | { | 1577 | { |
| 1578 | acpi_status status; | ||
| 1579 | |||
| 1578 | if (!(res->flags & IORESOURCE_MEM)) | 1580 | if (!(res->flags & IORESOURCE_MEM)) |
| 1579 | return AE_TYPE; | 1581 | return AE_TYPE; |
| 1580 | 1582 | ||
| 1581 | return acpi_walk_namespace(ACPI_TYPE_REGION, handle, level, | 1583 | status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level, |
| 1582 | acpi_deactivate_mem_region, NULL, res, NULL); | 1584 | acpi_deactivate_mem_region, NULL, |
| 1585 | res, NULL); | ||
| 1586 | if (ACPI_FAILURE(status)) | ||
| 1587 | return status; | ||
| 1588 | |||
| 1589 | /* | ||
| 1590 | * Wait for all of the mappings queued up for removal by | ||
| 1591 | * acpi_deactivate_mem_region() to actually go away. | ||
| 1592 | */ | ||
| 1593 | synchronize_rcu(); | ||
| 1594 | rcu_barrier(); | ||
| 1595 | flush_scheduled_work(); | ||
| 1596 | |||
| 1597 | return AE_OK; | ||
| 1583 | } | 1598 | } |
| 1584 | EXPORT_SYMBOL_GPL(acpi_release_memory); | 1599 | EXPORT_SYMBOL_GPL(acpi_release_memory); |
| 1585 | 1600 | ||