ACPI: Re-factor and remove ./drivers/acpi/atomicio.[ch]
cover ACPI: Re-factor and remove ./drivers/acpi/atomicio.[ch]
I recently submitted a patch series that re-factored some existing work that Huang Ying introduced adding support for accessing ACPI generic registers, backed by Memory Mapped I/O (MMIO), while within interrupt context:
Original series: http://marc.info/?l=linux-acpi&m=128769263327206&w=2
Follow on series: http://marc.info/?l=linux-kernel&m=132070825520957&w=2
An underlying goal has been to re-factor ./drivers/acpi/atomicio.c into ./drivers/acpi/osl.c, providing equivalent functionality but in a more generalized manner, to allow usage in non-specific (i.e. APEI) contexts and remove atomicio.c.
In the most recent follow on series, there ended up being additions to atomicio.c that coincided with the attempt to remove it and as such, the series final removal patch could not be taken without first pulling the additions into osl.c. The fact that the follow on series conversion patch - commit 700130b41f4 - was taken has inadvertently created regressions with respect to the recent atomicio.c additions due to the conversion patch effectively making atomicio.c obsolete.
The additions were commit 04c25997c97 "ACPI, Add 64bit read/write support to atomicio on i386" and commit 76da3fb3575 "ACPI, Add RAM mapping support to ACPI atomic IO support".
This patch series addresses both of these issues, bringing in the additional functionality into the re-factored files (apei-base.c and osl.c) and then again, reintroduces the patch to remove ./drivers/acpi/atomicio.[ch].
---
Myron Stowe (3):
ACPI: Remove ./drivers/acpi/atomicio.[ch]
ACPI, APEI: Add RAM mapping support to ACPI ACPI, APEI: Add 64-bit read/write support for APEI on i386
drivers/acpi/Makefile | 1 drivers/acpi/apei/apei-base.c | 35 --- drivers/acpi/atomicio.c | 422 ----------------------------------------- drivers/acpi/osl.c | 152 +++++++++++++++ include/acpi/acpiosxf.h | 4 include/acpi/atomicio.h | 10 - 6 files changed, 158 insertions(+), 466 deletions(-) delete mode 100644 drivers/acpi/atomicio.c delete mode 100644 include/acpi/atomicio.h
PATCH 1/3 ACPI, APEI: Add 64-bit read/write support for APEI on i386
From: Myron Stowe <[email protected]>
Base ACPI (CA) currently does not support atomic 64-bit reads and writes (acpi_read() and acpi_write() split 64-bit loads/stores into two 32-bit transfers) yet APEI expects 64-bit transfer capability, even when running on 32-bit systems.
This patch implements 64-bit read and write routines for APEI usage.
This patch re-factors similar functionality introduced in commit 04c25997c97, bringing it into the ACPI subsystem in preparation for removing ./drivers/acpi/atomicio.[ch]. In the implementation I have replicated acpi_os_read_memory() and acpi_os_write_memory(), creating 64-bit versions for APEI to utilize, as opposed to something more elegant. My thinking is that we should attempt to see if we can get ACPI's CA/OSL changed so that the existing acpi_read() and acpi_write() interfaces are natively 64-bit capable and then subsequently remove the replication.
---
drivers/acpi/apei/apei-base.c | 35 +----------- drivers/acpi/osl.c | 116 +++++++++++++++++++++++++++++++++++++++++ include/acpi/acpiosxf.h | 4 + 3 files changed, 124 insertions(+), 31 deletions(-)
drivers/acpi/apei/apei-base.c +4 -31
@@ -596,33 +596,19 @@ int apei_read(u64 *val, struct acpi_generic_address *reg) {int rc;u64 address; -u32 tmp, width = reg->bit_width;acpi_status status; rc =apei_check_gar (reg, &address);if (rc)return rc; -if (width ==64 ) - width =32 ;/* Break into two 32-bit transfers */ - *val =0 ;switch (reg->space_id) {case ACPI_ADR_SPACE_SYSTEM_MEMORY : - status =acpi_os_read_memory ((acpi_physical_address ) - address, &tmp, width); + status =acpi_os_read_memory64 ((acpi_physical_address ) + address, val, reg->bit_width);if (ACPI_FAILURE (status))return -EIO ; - *val = tmp; - -if (reg->bit_width ==64 ) { -/* Read the top 32 bits */ - status =acpi_os_read_memory ((acpi_physical_address) - (address +4 ), &tmp,32 ); -if (ACPI_FAILURE (status)) -return -EIO ; - *val |= ((u64 )tmp <<32 ); - }break ;case ACPI_ADR_SPACE_SYSTEM_IO : status =acpi_os_read_port (address, (u32 *)val, reg->bit_width);
@@ -642,31 +628,18 @@ int apei_write(u64 val, struct acpi_generic_address *reg) {int rc;u64 address; -u32 width = reg->bit_width;acpi_status status; rc =apei_check_gar (reg, &address);if (rc)return rc; -if (width ==64 ) - width =32 ;/* Break into two 32-bit transfers */ -switch (reg->space_id) {case ACPI_ADR_SPACE_SYSTEM_MEMORY : - status =acpi_os_write_memory ((acpi_physical_address ) - address,ACPI_LODWORD (val), - width); + status =acpi_os_write_memory64 ((acpi_physical_address ) + address, val, reg->bit_width);if (ACPI_FAILURE (status))return -EIO ; - -if (reg->bit_width ==64 ) { - status =acpi_os_write_memory ((acpi_physical_address) - (address +4 ), -ACPI_HIDWORD (val),32 ); -if (ACPI_FAILURE (status)) -return -EIO ; - }break ;case ACPI_ADR_SPACE_SYSTEM_IO : status =acpi_os_write_port (address, val, reg->bit_width);
drivers/acpi/osl.c +116 -0
128 lines not on this page · raw message
include/acpi/acpiosxf.h +4 -0
@@ -218,9 +218,13 @@ acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);*/ acpi_status acpi_os_read_memory (acpi_physical_address address,u32 * value,u32 width); +acpi_status +acpi_os_read_memory64 (acpi_physical_address address,u64 *value,u32 width);acpi_status acpi_os_write_memory (acpi_physical_address address,u32 value,u32 width); +acpi_status +acpi_os_write_memory64 (acpi_physical_address address,u64 value,u32 width);/* * Platform and hardware-independent PCI configuration space access
PATCH 2/3 ACPI, APEI: Add RAM mapping support to ACPI
In reply to Myron StoweFrom: Myron Stowe <[email protected]>
This patch adds support for RAM to ACPI's mapping capabilities in order to support APEI error injection (EINJ) actions.
This patch re-factors similar functionality introduced in commit 76da3fb3575, bringing it into osl.c in preparation for removing ./drivers/acpi/atomicio.[ch].
---
drivers/acpi/osl.c | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-)
drivers/acpi/osl.c +34 -2
@@ -31,6 +31,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h> +#include <linux/highmem.h> #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/kmod.h>
@@ -321,6 +322,37 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; } +#ifndef CONFIG_IA64 +#define should_use_kmap (pfn) page_is_ram(pfn) +#else +/* ioremap will take care of cache attributes */ +#define should_use_kmap (pfn) 0 +#endif + +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (should_use_kmap (pfn)) { +if (pg_sz >PAGE_SIZE ) +return NULL ; +return (void __iomem __force *)kmap (pfn_to_page (pfn)); + }else +return acpi_os_ioremap (pg_off, pg_sz); +} + +static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (page_is_ram (pfn)) +kunmap (pfn_to_page (pfn)); +else +iounmap (vaddr); +} + void __iomem *__init_refokacpi_os_map_memory (acpi_physical_address phys,acpi_size size) {
@@ -353,7 +385,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 =acpi_os_ioremap (pg_off, pg_sz); + virt =acpi_map (pg_off, pg_sz);if (!virt) {mutex_unlock (&acpi_ioremap_lock);kfree (map);
@@ -384,7 +416,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) {if (!map->refcount) {synchronize_rcu (); -iounmap (map->virt); +acpi_unmap (map->phys, map->virt);kfree (map); } }
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
Quoted 39 lines · Myron Stowe
From: Myron Stowe <[email protected]>
This patch adds support for RAM to ACPI's mapping capabilities in order to support APEI error injection (EINJ) actions.
This patch re-factors similar functionality introduced in commit
76da3fb3575, bringing it intoosl.cin preparation for removing ./drivers/acpi/atomicio.[ch].Signed-off-by Myron Stowe <[email protected]>---
drivers/acpi/osl.c | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)drivers/acpi/osl.c +9
-0@@ -31,6 +31,7 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h> +#include <linux/highmem.h> #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/kmod.h>@@ -321,6 +322,37 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; } +#ifndef CONFIG_IA64 +#define should_use_kmap (pfn) page_is_ram(pfn) +#else +/* ioremap will take care of cache attributes */ +#define should_use_kmap (pfn) 0 +#endif + +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz)
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 342
Quoted 10 lines
drivers/acpi/osl.c +10
-0+{ + unsigned long pfn; + + pfn = pg_off >> PAGE_SHIFT; + if (should_use_kmap(pfn)) { + if (pg_sz > PAGE_SIZE) + return NULL; + return (void __iomem __force *)kmap(pfn_to_page(pfn)); + } else + return acpi_os_ioremap(pg_off, pg_sz);
This implies that ioremap() works differently on ia64 than on x86. Apparently one can ioremap() RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fix ioremap() on ia64 so it works the same as on x86?
I looked at the ia64 ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from 76da3fb3575?
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 353
Quoted 11 lines
drivers/acpi/osl.c +11
-0+} + +static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr) +{ + unsigned long pfn; + + pfn = pg_off >> PAGE_SHIFT; + if (page_is_ram(pfn)) + kunmap(pfn_to_page(pfn)); + else + iounmap(vaddr);
I hope we can resolve the ioremap() question so we don't need this patch at all. But if we do need this, I don't like the asymmetry here -- on x86 RAM, I think we use ioremap() and kunmap(), which seems wrong. We should be able to use ioremap() and iounmap().
Quoted 16 lines
drivers/acpi/osl.c +2
-0+} +void
__iomem*__init_refokacpi_os_map_memory(acpi_physical_address phys, acpi_size size){drivers/acpi/osl.c +1
-1@@ -353,7 +385,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 = acpi_os_ioremap(pg_off, pg_sz); + virt = acpi_map(pg_off, pg_sz); if (!virt) { mutex_unlock(&acpi_ioremap_lock); kfree(map);
drivers/acpi/osl.c static void acpi_os_map_cleanup(struct acpi_ioremap *map) · line 422
Quoted 8 lines
drivers/acpi/osl.c +1
-1@@ -384,7 +416,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) { if (!map->refcount) { synchronize_rcu(); - iounmap(map->virt); + acpi_unmap(map->phys, map->virt); kfree(map); } }
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
+cc Tony, linux-ia64
Quoted 100 lines · Bjorn Helgaas
Quoted 39 lines · Myron Stowe
From: Myron Stowe <[email protected]>
This patch adds support for RAM to ACPI's mapping capabilities in order to support APEI error injection (EINJ) actions.
This patch re-factors similar functionality introduced in commit
76da3fb3575, bringing it intoosl.cin preparation for removing ./drivers/acpi/atomicio.[ch].Signed-off-by Myron Stowe <[email protected]>---
drivers/acpi/osl.c | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)drivers/acpi/osl.c +9
-0@@ -31,6 +31,7 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h> +#include <linux/highmem.h> #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/kmod.h>@@ -321,6 +322,37 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; } +#ifndef CONFIG_IA64 +#define should_use_kmap (pfn) page_is_ram(pfn) +#else +/* ioremap will take care of cache attributes */ +#define should_use_kmap (pfn) 0 +#endif + +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz)drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 342
Quoted 10 lines
drivers/acpi/osl.c +10
-0+{ + unsigned long pfn; + + pfn = pg_off >> PAGE_SHIFT; + if (should_use_kmap(pfn)) { + if (pg_sz > PAGE_SIZE) + return NULL; + return (void __iomem __force *)kmap(pfn_to_page(pfn)); + } else + return acpi_os_ioremap(pg_off, pg_sz);This implies that
ioremap()works differently on ia64 than on x86. Apparently one canioremap()RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fixioremap()on ia64 so it works the same as on x86?I looked at the ia64
ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from76da3fb3575?drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 353
Quoted 11 lines
drivers/acpi/osl.c +11
-0+} + +static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr) +{ + unsigned long pfn; + + pfn = pg_off >> PAGE_SHIFT; + if (page_is_ram(pfn)) + kunmap(pfn_to_page(pfn)); + else + iounmap(vaddr);I hope we can resolve the
ioremap()question so we don't need this patch at all. But if we do need this, I don't like the asymmetry here -- on x86 RAM, I think we useioremap()andkunmap(), which seems wrong. We should be able to useioremap()andiounmap().Quoted 24 lines
drivers/acpi/osl.c +2
-0+} +void
__iomem*__init_refokacpi_os_map_memory(acpi_physical_address phys, acpi_size size){drivers/acpi/osl.c +2
-2@@ -353,7 +385,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 = acpi_os_ioremap(pg_off, pg_sz); + virt = acpi_map(pg_off, pg_sz); if (!virt) { mutex_unlock(&acpi_ioremap_lock); kfree(map);@@ -384,7 +416,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) { if (!map->refcount) { synchronize_rcu(); - iounmap(map->virt); + acpi_unmap(map->phys, map->virt); kfree(map); } }
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
In reply to Bjorn HelgaasQuoted 59 lines · Bjorn Helgaas
Quoted 39 lines · Myron Stowe
From: Myron Stowe <[email protected]>
This patch adds support for RAM to ACPI's mapping capabilities in order to support APEI error injection (EINJ) actions.
This patch re-factors similar functionality introduced in commit
76da3fb3575, bringing it intoosl.cin preparation for removing ./drivers/acpi/atomicio.[ch].Signed-off-by Myron Stowe <[email protected]>---
drivers/acpi/osl.c | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-)drivers/acpi/osl.c +9
-0@@ -31,6 +31,7 @@#include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h> +#include <linux/highmem.h> #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/kmod.h> @@ -321,6 +322,37 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; } +#ifndef CONFIG_IA64 +#define should_use_kmap (pfn) page_is_ram(pfn) +#else +/* ioremap will take care of cache attributes */ +#define should_use_kmap (pfn) 0 +#endif + +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz)drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 342
Quoted 10 lines
drivers/acpi/osl.c +10
-0+{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (should_use_kmap (pfn)) { +if (pg_sz >PAGE_SIZE ) +return NULL ; +return (void __iomem __force *)kmap (pfn_to_page (pfn)); + }else +return acpi_os_ioremap (pg_off, pg_sz);This implies that
ioremap()works differently on ia64 than on x86. Apparently one canioremap()RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fixioremap()on ia64 so it works the same as on x86?I looked at the ia64
ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from76da3fb3575?
Quoted 16 lines
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 353
Quoted 11 lines
drivers/acpi/osl.c +11
-0+} + +static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (page_is_ram (pfn)) +kunmap (pfn_to_page (pfn)); +else +iounmap (vaddr);I hope we can resolve the
ioremap()question so we don't need this patch at all. But if we do need this, I don't like the asymmetry here -- on x86 RAM, I think we useioremap()andkunmap(), which seems wrong. We should be able to useioremap()andiounmap().
Huang:
There seems to be a lot of people wondering about this - could you respond please.
Myron
Quoted 25 lines
Quoted 25 lines
drivers/acpi/osl.c +4
-2+} + void __iomem *__init_refokacpi_os_map_memory (acpi_physical_address phys,acpi_size size) {@@ -353,7 +385,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 =acpi_os_ioremap (pg_off, pg_sz); + virt =acpi_map (pg_off, pg_sz);if (!virt) {mutex_unlock (&acpi_ioremap_lock);kfree (map);@@ -384,7 +416,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) {if (!map->refcount) {synchronize_rcu (); -iounmap (map->virt); +acpi_unmap (map->phys, map->virt);kfree (map); } }
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
In reply to Bjorn HelgaasHi, Bjorn,
Sorry for late. Just return from Chinese new year holiday.
On Sat, 2012-01-21 at 08:04 -0700, Bjorn Helgaas wrote:
[snip]
Quoted 9 lines
Quoted 9 lines
drivers/acpi/osl.c +9
-0+ +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (should_use_kmap (pfn)) { +if (pg_sz >PAGE_SIZE ) +return NULL ;
Quoted 8 lines
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 342
Quoted 3 lines
drivers/acpi/osl.c +3
-0+return (void __iomem __force *)kmap (pfn_to_page (pfn)); + }else +return acpi_os_ioremap (pg_off, pg_sz);This implies that
ioremap()works differently on ia64 than on x86. Apparently one canioremap()RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fixioremap()on ia64 so it works the same as on x86?
If my understanding were correct, ioremap can not work for RAM on x86. So we need to use kmap for RAM. And on IA64, ioremap works for RAM and will take care of cache attributes while kmap will not. So ioremap is used on IA64, while kmap is used on x86.
Quoted 19 lines
I looked at the ia64
ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from76da3fb3575?drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 353
Quoted 11 lines
drivers/acpi/osl.c +11
-0+} + +static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (page_is_ram (pfn)) +kunmap (pfn_to_page (pfn)); +else +iounmap (vaddr);I hope we can resolve the
ioremap()question so we don't need this patch at all. But if we do need this, I don't like the asymmetry here -- on x86 RAM, I think we useioremap()andkunmap(), which seems wrong. We should be able to useioremap()andiounmap().
Yes. The asymmetry here is not good. We should use should_use_kmap()
instead of page_is_ram directly here.
Best Regards,
Huang Ying
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
Quoted 24 lines · Huang Ying
Hi, Bjorn,
Sorry for late. Just return from Chinese new year holiday.
On Sat, 2012-01-21 at 08:04 -0700, Bjorn Helgaas wrote:
[snip]Quoted 9 lines
Quoted 9 lines
drivers/acpi/osl.c +9
-0+ +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +{ + unsigned long pfn; + + pfn = pg_off >> PAGE_SHIFT; + if (should_use_kmap(pfn)) { + if (pg_sz > PAGE_SIZE) + return NULL;Quoted 8 lines
Quoted 3 lines
+ return (void
__iomem__force*)kmap(pfn_to_page(pfn));
+ } else
+ returnacpi_os_ioremap(pg_off, pg_sz);This implies that
ioremap()works differently on ia64 than on x86. Apparently one canioremap()RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fixioremap()on ia64 so it works the same as on x86?
Quoted 4 lines
If my understanding were correct, ioremap can not work for RAM on x86. So we need to use kmap for RAM. And on IA64, ioremap works for RAM and will take care of cache attributes while kmap will not. So ioremap is used on IA64, while kmap is used on x86.
My point is that the *user* of ioremap() shouldn't need to care what architecture we're on. For example, maybe the ioremap() implementation could be changed so that it uses kmap() internally when necessary.
Quoted 2 lines
Quoted 2 lines
I looked at the ia64
ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from76da3fb3575?
This question is still open. Do you remember anything about it?
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
Quoted 30 lines · Bjorn Helgaas
Quoted 24 lines · Huang Ying
Hi, Bjorn,
Sorry for late. Just return from Chinese new year holiday.
On Sat, 2012-01-21 at 08:04 -0700, Bjorn Helgaas wrote:
[snip]Quoted 9 lines
Quoted 9 lines
drivers/acpi/osl.c +9
-0+ +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (should_use_kmap (pfn)) { +if (pg_sz >PAGE_SIZE ) +return NULL ;Quoted 8 lines
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 342
Quoted 3 lines
drivers/acpi/osl.c +3
-0+return (void __iomem __force *)kmap (pfn_to_page (pfn)); + }else +return acpi_os_ioremap (pg_off, pg_sz);This implies that
ioremap()works differently on ia64 than on x86. Apparently one canioremap()RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fixioremap()on ia64 so it works the same as on x86?Quoted 4 lines
If my understanding were correct, ioremap can not work for RAM on x86. So we need to use kmap for RAM. And on IA64, ioremap works for RAM and will take care of cache attributes while kmap will not. So ioremap is used on IA64, while kmap is used on x86.
Quoted 4 lines
My point is that the *user* of
ioremap()shouldn't need to care what architecture we're on. For example, maybe theioremap()implementation could be changed so that it useskmap()internally when necessary.
I think that is about the semantics of ioremap().
Hi, Ingo,
Can you describe why normal RAM is not allowed to be mapped by ioremap()?
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
I looked at the ia64
ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from76da3fb3575?This question is still open. Do you remember anything about it?
Copy from Tony's mail,
This (Ying: use kmap insted of ioremap to map RAM) might be a problem on ia64 - it is s/w responsibility to make sure that we don't map the same underlying physical address using different cache attributes - e.g. we must not map memory both cacheable and uncacheable at the same time. Accessing such a mis-attributed page will result in a machine check.
So I'd worry that if the memory in question was being used as uncacheable, this code might result in a cached access, which would crash the machine.
Best Regards,
Huang Ying
Re: [PATCH 2/3] ACPI, APEI: Add RAM mapping support to ACPI
In reply to Bjorn HelgaasHi,
Quoted 35 lines · Bjorn Helgaas
Quoted 24 lines · Huang Ying
Hi, Bjorn,
Sorry for late. Just return from Chinese new year holiday.
On Sat, 2012-01-21 at 08:04 -0700, Bjorn Helgaas wrote:
[snip]Quoted 9 lines
Quoted 9 lines
drivers/acpi/osl.c +9
-0+ +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +{ +unsigned long pfn; + + pfn = pg_off >>PAGE_SHIFT ; +if (should_use_kmap (pfn)) { +if (pg_sz >PAGE_SIZE ) +return NULL ;Quoted 8 lines
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size) · line 342
Quoted 3 lines
drivers/acpi/osl.c +3
-0+return (void __iomem __force *)kmap (pfn_to_page (pfn)); + }else +return acpi_os_ioremap (pg_off, pg_sz);This implies that
ioremap()works differently on ia64 than on x86. Apparently one canioremap()RAM on x86, but not on ia64. Why is this different? Shouldn't we instead fixioremap()on ia64 so it works the same as on x86?Quoted 4 lines
If my understanding were correct, ioremap can not work for RAM on x86. So we need to use kmap for RAM. And on IA64, ioremap works for RAM and will take care of cache attributes while kmap will not. So ioremap is used on IA64, while kmap is used on x86.
My point is that the *user* of
ioremap()shouldn't need to care what architecture we're on. For example, maybe theioremap()implementation could be changed so that it useskmap()internally when necessary.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
I looked at the ia64
ioremap(), and I can't see the reason it fails for RAM. Huang, do you remember the details from76da3fb3575?This question is still open. Do you remember anything about it?
Another question about kmap on IA64. If my understanding were correct, kmap() is just page_address() on IA64. So it is just uses the identity map instead of creating a new map. Will there be any problem with it compared with ioremap()?
Best Regards,
Huang Ying
PATCH 3/3 ACPI: Remove ./drivers/acpi/atomicio.[ch]
In reply to Myron StoweFrom: Myron Stowe <[email protected]>
With the conversion of atomicio's routines in place (see commits 6f68c91c55e and 700130b41f4), atomicio.[ch] can be removed, replacing the APEI specific pre-mapping capabilities with the more generalized versions that drivers/acpi/osl.c provides.
---
drivers/acpi/Makefile | 1 drivers/acpi/atomicio.c | 422 ----------------------------------------------- include/acpi/atomicio.h | 10 - 3 files changed, 0 insertions(+), 433 deletions(-) delete mode 100644 drivers/acpi/atomicio.c delete mode 100644 include/acpi/atomicio.h
drivers/acpi/Makefile +0 -1
@@ -19,7 +19,6 @@ obj-y += acpi.o \ # All the builtin files are in the "acpi." module_param namespace. acpi-y += osl.o utils.o reboot.o -acpi-y += atomicio.o acpi-y += nvs.o # sleep related files
drivers/acpi/atomicio.c deleted +0 -422
422 lines not on this page · raw message
include/acpi/atomicio.h deleted +0 -10
@@ -1,10 +0,0 @@ -#ifndef ACPI_ATOMIC_IO_H -#define ACPI_ATOMIC_IO_H - -int acpi_pre_map_gar (struct acpi_generic_address *reg); -int acpi_post_unmap_gar (struct acpi_generic_address *reg); - -int acpi_atomic_read (u64 *val,struct acpi_generic_address *reg); -int acpi_atomic_write (u64 val,struct acpi_generic_address *reg); - -#endif
Quoted 24 lines · Myron Stowe
I recently submitted a patch series that re-factored some existing work that Huang Ying introduced adding support for accessing ACPI generic registers, backed by Memory Mapped I/O (MMIO), while within interrupt context:
Original series: http://marc.info/?l=linux-acpi&m=128769263327206&w=2
Follow on series: http://marc.info/?l=linux-kernel&m=132070825520957&w=2An underlying goal has been to re-factor
./drivers/acpi/atomicio.cinto./drivers/acpi/osl.c, providing equivalent functionality but in a more generalized manner, to allow usage in non-specific (i.e. APEI) contexts and removeatomicio.c.In the most recent follow on series, there ended up being additions to
atomicio.cthat coincided with the attempt to remove it and as such, the series final removal patch could not be taken without first pulling the additions intoosl.c. The fact that the follow on series conversion patch - commit700130b41f4- was taken has inadvertently created regressions with respect to the recentatomicio.cadditions due to the conversion patch effectively makingatomicio.cobsolete.The additions were commit
04c25997c97"ACPI, Add 64bit read/write support to atomicio on i386" and commit76da3fb3575"ACPI, Add RAM mapping support to ACPI atomic IO support".
Quoted 8 lines
This patch series addresses both of these issues, bringing in the additional functionality into the re-factored files (
apei-base.candosl.c) and then again, reintroduces the patch to remove ./drivers/acpi/atomicio.[ch].
---Myron Stowe (3):
ACPI: Remove ./drivers/acpi/atomicio.[ch]
It appears there is no one uses atomicio.[ch] now. So I think it is safe to push this into 3.3.
Quoted 2 lines
ACPI, APEI: Add RAM mapping support to ACPI ACPI, APEI: Add 64-bit read/write support for APEI on i386
These two patches are just fixes. So I think we should push these two patches into 3.3.
Len, Do you agree?
Best Regards,
Huang Ying