diff options
author | Jan Beulich <jbeulich@suse.com> | 2013-08-21 08:38:40 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-08-21 08:38:40 +0200 |
commit | 2ee9cbf9d8eaeff6e21222905d22dbd58dc5fe29 (patch) | |
tree | 96e44ca0ebe370db2a35f526a20469ab1397c6f9 /xen/drivers | |
parent | 54a46bce768033b1c36e25eace15f7abde972389 (diff) | |
download | xen-2ee9cbf9d8eaeff6e21222905d22dbd58dc5fe29.tar.gz xen-2ee9cbf9d8eaeff6e21222905d22dbd58dc5fe29.tar.bz2 xen-2ee9cbf9d8eaeff6e21222905d22dbd58dc5fe29.zip |
ACPI: fix acpi_os_map_memory()
It using map_domain_page() was entirely wrong. Use __acpi_map_table()
instead for the time being, with locking added as the mappings it
produces get replaced with subsequent invocations. Using locking in
this way is acceptable here since the only two runtime callers are
acpi_os_{read,write}_memory(), which don't leave mappings pending upon
returning to their callers.
Also fix __acpi_map_table()'s first parameter's type - while benign for
unstable, backports to pre-4.3 trees will need this.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/drivers')
-rw-r--r-- | xen/drivers/acpi/osl.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 1b60be621c..4cba3c06cb 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -83,14 +83,20 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) } } -void __iomem *__init +static DEFINE_SPINLOCK(map_lock); + +void __iomem * acpi_os_map_memory(acpi_physical_address phys, acpi_size size) { - return __acpi_map_table((unsigned long)phys, size); + if (system_state >= SYS_STATE_active) + spin_lock(&map_lock); + return __acpi_map_table(phys, size); } -void __init acpi_os_unmap_memory(void __iomem * virt, acpi_size size) +void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) { + if (system_state >= SYS_STATE_active) + spin_unlock(&map_lock); } acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) @@ -133,9 +139,8 @@ acpi_status acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) { u32 dummy; - void __iomem *virt_addr; + void __iomem *virt_addr = acpi_os_map_memory(phys_addr, width >> 3); - virt_addr = map_domain_page(phys_addr>>PAGE_SHIFT); if (!value) value = &dummy; @@ -153,7 +158,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) BUG(); } - unmap_domain_page(virt_addr); + acpi_os_unmap_memory(virt_addr, width >> 3); return AE_OK; } @@ -161,9 +166,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) acpi_status acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) { - void __iomem *virt_addr; - - virt_addr = map_domain_page(phys_addr>>PAGE_SHIFT); + void __iomem *virt_addr = acpi_os_map_memory(phys_addr, width >> 3); switch (width) { case 8: @@ -179,7 +182,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) BUG(); } - unmap_domain_page(virt_addr); + acpi_os_unmap_memory(virt_addr, width >> 3); return AE_OK; } |