ACPI: Introduce acpi_os_ioremap()
Commit ca9b600be3
("ACPI / PM: Make suspend_nvs_save() use
acpi_os_map_memory()") attempted to prevent the code in osl.c and nvs.c
from using different ioremap() variants by making the latter use
acpi_os_map_memory() for mapping the NVS pages. However, that also
requires acpi_os_unmap_memory() to be used for unmapping them, which
causes synchronize_rcu() to be executed many times in a row
unnecessarily and introduces substantial delays during resume on some
systems.
Instead of using acpi_os_map_memory() for mapping the NVS pages in nvs.c
introduce acpi_os_ioremap() calling ioremap_cache() and make the code in
both osl.c and nvs.c use it.
Reported-by: Jeff Chua <jeff.chua.linux@gmail.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
8d99641f6c
commit
2d6d9fd3a5
@@ -38,6 +38,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/nmi.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/acpi_io.h>
|
||||
#include <linux/efi.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/list.h>
|
||||
@@ -302,9 +303,10 @@ void __iomem *__init_refok
|
||||
acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
|
||||
{
|
||||
struct acpi_ioremap *map, *tmp_map;
|
||||
unsigned long flags, pg_sz;
|
||||
unsigned long flags;
|
||||
void __iomem *virt;
|
||||
phys_addr_t pg_off;
|
||||
acpi_physical_address pg_off;
|
||||
acpi_size pg_sz;
|
||||
|
||||
if (phys > ULONG_MAX) {
|
||||
printk(KERN_ERR PREFIX "Cannot map memory that high\n");
|
||||
@@ -320,7 +322,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
|
||||
|
||||
pg_off = round_down(phys, PAGE_SIZE);
|
||||
pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
|
||||
virt = ioremap_cache(pg_off, pg_sz);
|
||||
virt = acpi_os_ioremap(pg_off, pg_sz);
|
||||
if (!virt) {
|
||||
kfree(map);
|
||||
return NULL;
|
||||
@@ -642,7 +644,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
|
||||
virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
|
||||
rcu_read_unlock();
|
||||
if (!virt_addr) {
|
||||
virt_addr = ioremap_cache(phys_addr, size);
|
||||
virt_addr = acpi_os_ioremap(phys_addr, size);
|
||||
unmap = 1;
|
||||
}
|
||||
if (!value)
|
||||
@@ -678,7 +680,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
|
||||
virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
|
||||
rcu_read_unlock();
|
||||
if (!virt_addr) {
|
||||
virt_addr = ioremap_cache(phys_addr, size);
|
||||
virt_addr = acpi_os_ioremap(phys_addr, size);
|
||||
unmap = 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user