This is a cleaned up version of patches posted earlier by Al Stone.
I have split them into patches with attempt to make only one change per patch.
Graeme
Fix the early_memremap flags so unaligned access works.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- arch/arm/include/asm/io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 426a13a..b0f3334 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -415,7 +415,7 @@ extern void early_ioremap_reset(void); extern void __iomem *early_remap(resource_size_t phys_addr, unsigned long size, u32 prot); #define early_ioremap(x, y) early_remap(x, y, L_PTE_MT_DEV_NONSHARED) -#define early_memremap(x, y) early_remap(x, y, L_PTE_MT_UNCACHED) +#define early_memremap(x, y) early_remap(x, y, L_PTE_MT_WRITEALLOC)
extern void early_iounmap(void __iomem *addr, unsigned long size);
Because this should work on all memory sizes it should be a phys_addr_t address and not an unsigned ling which limits to 32bit.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- drivers/acpi/plat/arm/boot.c | 2 +- include/linux/acpi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index c298871..80792dc 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -107,7 +107,7 @@ static unsigned int gsi_to_irq(unsigned int gsi) * BOZO: is it reasonable to just reserve the memory space? Or are there * other restrictions needed? Or does it need copying to some other place? */ -char *__init __acpi_map_table(unsigned long phys, unsigned long size) +char *__init __acpi_map_table(phys_addr_t phys, unsigned long size) { if (!phys || !size) return NULL; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 77e81fc..6324f8b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -88,7 +88,7 @@ static inline void acpi_initrd_override(void *data, size_t size) } #endif
-char * __acpi_map_table (unsigned long phys_addr, unsigned long size); +char *__acpi_map_table(phys_addr_t phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void); int acpi_boot_init (void);
early_ioremap is a better interface for accessing this information than phys_to_virt as it works with highmem and other exotic types.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- arch/arm/kernel/setup.c | 16 +++++++--------- drivers/acpi/Kconfig | 1 + drivers/acpi/plat/arm/boot.c | 12 ++---------- 3 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index b372798..c3ed159 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -888,8 +888,9 @@ void __init setup_arch(char **cmdline_p) sanity_check_meminfo(); arm_memblock_init(&meminfo, mdesc);
- paging_init(mdesc); - request_standard_resources(mdesc); +#ifdef CONFIG_ACPI + arm_acpi_reserve_memory(); +#endif
#ifdef CONFIG_ACPI /* @@ -897,10 +898,11 @@ void __init setup_arch(char **cmdline_p) */ acpi_boot_table_init(); early_acpi_boot_init(); + acpi_boot_init(); #endif -#ifdef CONFIG_ACPI - arm_acpi_reserve_memory(); -#endif + + paging_init(mdesc); + request_standard_resources(mdesc);
if (mdesc->restart) arm_pm_restart = mdesc->restart; @@ -941,10 +943,6 @@ void __init setup_arch(char **cmdline_p)
if (mdesc->init_early) mdesc->init_early(); - -#ifdef CONFIG_ACPI - acpi_boot_init(); -#endif }
#ifdef CONFIG_HAVE_PROC_CPU diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b6f87a8..70813fe 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -4,6 +4,7 @@
config ACPI_ARM bool + select EARLY_IOREMAP
menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support" diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index 80792dc..4fcdd9f 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -103,17 +103,12 @@ static unsigned int gsi_to_irq(unsigned int gsi) return irq; }
-/* - * BOZO: is it reasonable to just reserve the memory space? Or are there - * other restrictions needed? Or does it need copying to some other place? - */ char *__init __acpi_map_table(phys_addr_t phys, unsigned long size) { if (!phys || !size) return NULL;
- /* we're already in memory so we cannot io_remap the entry */ - return phys_to_virt(phys); + return early_memremap(phys, size); }
void __init __acpi_unmap_table(char *map, unsigned long size) @@ -121,10 +116,7 @@ void __init __acpi_unmap_table(char *map, unsigned long size) if (!map || !size) return;
- /* we're already in memory so we cannot io_remap the entry; - * since we're not io_remap'ing, unmap'ing is especially - * pointless - */ + early_iounmap(map, size); return; }
W dniu 25.09.2013 16:44, Graeme Gregory pisze:
early_ioremap is a better interface for accessing this information than phys_to_virt as it works with highmem and other exotic types.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org
arch/arm/kernel/setup.c | 16 +++++++--------- drivers/acpi/Kconfig | 1 + drivers/acpi/plat/arm/boot.c | 12 ++---------- 3 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index b372798..c3ed159 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -888,8 +888,9 @@ void __init setup_arch(char **cmdline_p) sanity_check_meminfo(); arm_memblock_init(&meminfo, mdesc);
- paging_init(mdesc);
- request_standard_resources(mdesc);
+#ifdef CONFIG_ACPI
- arm_acpi_reserve_memory();
+#endif
#ifdef CONFIG_ACPI /* @@ -897,10 +898,11 @@ void __init setup_arch(char **cmdline_p) */ acpi_boot_table_init(); early_acpi_boot_init();
- acpi_boot_init(); #endif
-#ifdef CONFIG_ACPI
- arm_acpi_reserve_memory();
-#endif
paging_init(mdesc);
request_standard_resources(mdesc);
if (mdesc->restart) arm_pm_restart = mdesc->restart;
@@ -941,10 +943,6 @@ void __init setup_arch(char **cmdline_p)
if (mdesc->init_early) mdesc->init_early();
-#ifdef CONFIG_ACPI
- acpi_boot_init();
-#endif }
#ifdef CONFIG_HAVE_PROC_CPU diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b6f87a8..70813fe 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -4,6 +4,7 @@
config ACPI_ARM bool
select EARLY_IOREMAP
menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support"
diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index 80792dc..4fcdd9f 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -103,17 +103,12 @@ static unsigned int gsi_to_irq(unsigned int gsi) return irq; }
-/*
- BOZO: is it reasonable to just reserve the memory space? Or are there
- other restrictions needed? Or does it need copying to some other place?
*/ char *__init __acpi_map_table(phys_addr_t phys, unsigned long size) { if (!phys || !size) return NULL;
/* we're already in memory so we cannot io_remap the entry */
return phys_to_virt(phys);
- return early_memremap(phys, size);
This will break ARM64 kernel building. Early mapping is supported for ARM so far.
}
void __init __acpi_unmap_table(char *map, unsigned long size) @@ -121,10 +116,7 @@ void __init __acpi_unmap_table(char *map, unsigned long size) if (!map || !size) return;
- /* we're already in memory so we cannot io_remap the entry;
* since we're not io_remap'ing, unmap'ing is especially
* pointless
*/
- early_iounmap(map, size); return; }
On 10/02/2013 04:23 AM, Tomasz Nowicki wrote:
W dniu 25.09.2013 16:44, Graeme Gregory pisze:
early_ioremap is a better interface for accessing this information than phys_to_virt as it works with highmem and other exotic types.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org
arch/arm/kernel/setup.c | 16 +++++++--------- drivers/acpi/Kconfig | 1 + drivers/acpi/plat/arm/boot.c | 12 ++---------- 3 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index b372798..c3ed159 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -888,8 +888,9 @@ void __init setup_arch(char **cmdline_p) sanity_check_meminfo(); arm_memblock_init(&meminfo, mdesc);
- paging_init(mdesc);
- request_standard_resources(mdesc);
+#ifdef CONFIG_ACPI
- arm_acpi_reserve_memory();
+#endif
#ifdef CONFIG_ACPI /* @@ -897,10 +898,11 @@ void __init setup_arch(char **cmdline_p) */ acpi_boot_table_init(); early_acpi_boot_init();
- acpi_boot_init(); #endif
-#ifdef CONFIG_ACPI
- arm_acpi_reserve_memory();
-#endif
paging_init(mdesc);
request_standard_resources(mdesc);
if (mdesc->restart) arm_pm_restart = mdesc->restart;
@@ -941,10 +943,6 @@ void __init setup_arch(char **cmdline_p)
if (mdesc->init_early) mdesc->init_early();
-#ifdef CONFIG_ACPI
- acpi_boot_init();
-#endif }
#ifdef CONFIG_HAVE_PROC_CPU diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b6f87a8..70813fe 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -4,6 +4,7 @@
config ACPI_ARM bool
select EARLY_IOREMAP
menuconfig ACPI bool "ACPI (Advanced Configuration and Power Interface) Support"
diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index 80792dc..4fcdd9f 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -103,17 +103,12 @@ static unsigned int gsi_to_irq(unsigned int gsi) return irq; }
-/*
- BOZO: is it reasonable to just reserve the memory space? Or are
there
- other restrictions needed? Or does it need copying to some other
place?
*/ char *__init __acpi_map_table(phys_addr_t phys, unsigned long size) { if (!phys || !size) return NULL;
/* we're already in memory so we cannot io_remap the entry */
return phys_to_virt(phys);
- return early_memremap(phys, size);
This will break ARM64 kernel building. Early mapping is supported for ARM so far.
Aha. Correct. I'll take a look at this today. It may have to be #ifdef'd :(.
}
void __init __acpi_unmap_table(char *map, unsigned long size) @@ -121,10 +116,7 @@ void __init __acpi_unmap_table(char *map, unsigned long size) if (!map || !size) return;
- /* we're already in memory so we cannot io_remap the entry;
* since we're not io_remap'ing, unmap'ing is especially
* pointless
*/
- early_iounmap(map, size); return; }
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
On Wed, 2013-10-02 at 08:13 -0600, Al Stone wrote:
- /* we're already in memory so we cannot io_remap the entry */
- return phys_to_virt(phys);
- return early_memremap(phys, size);
This will break ARM64 kernel building. Early mapping is supported for ARM so far.
Aha. Correct. I'll take a look at this today. It may have to be #ifdef'd :(.
I have an early_ioremap patch for arm64.
https://github.com/mosalter/linux.git
commit 3e1831284bc71e2f05ad9f598acf2903d8e1d552 Author: Mark Salter msalter@redhat.com Date: Tue Sep 24 23:16:24 2013 -0400
arm64: add early_ioremap support
I'm working on rebasing those patches now so they can be pulled into the leg kernel tree.
--Mark
On 10/03/2013 08:03 AM, Mark Salter wrote:
On Wed, 2013-10-02 at 08:13 -0600, Al Stone wrote:
- /* we're already in memory so we cannot io_remap the entry */
- return phys_to_virt(phys);
- return early_memremap(phys, size);
This will break ARM64 kernel building. Early mapping is supported for ARM so far.
Aha. Correct. I'll take a look at this today. It may have to be #ifdef'd :(.
I have an early_ioremap patch for arm64.
https://github.com/mosalter/linux.git
commit 3e1831284bc71e2f05ad9f598acf2903d8e1d552 Author: Mark Salter msalter@redhat.com Date: Tue Sep 24 23:16:24 2013 -0400
arm64: add early_ioremap support
I'm working on rebasing those patches now so they can be pulled into the leg kernel tree.
--Mark
Just an FYI: if I use the patch above (or as attached) against either our acpi development tree or the leg-kernel tree, and make sure that NLS is enabled, this compiles just fine. Further, I can boot with the resulting kernel using either the Foundation or FAST model; there's still a hang somewhere I haven't tracked down yet, but I suspect once we get everything merged, we'll be in pretty good shape.
Where I got excited was I could see all the ACPI tables getting recognized by the startup code :)...
Thanks, Tomasz.
And thanks, Mark, for the patch.
Now with the base changes to the arm memory mapping it is safe to convert to using ioremap to map in the tables.
Signed-off-by: Al Stone al.stone@linaro.org Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- drivers/acpi/osl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 962fcb7..72f1f4e 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -390,11 +390,11 @@ 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 +#if defined(CONFIG_IA64) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) /* ioremap will take care of cache attributes */ #define should_use_kmap(pfn) 0 +#else +#define should_use_kmap(pfn) page_is_ram(pfn) #endif
static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
In acpi_find_arm_root_pointer there was an indentation error so fix it.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- drivers/acpi/osl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 72f1f4e..34beeba 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -294,7 +294,7 @@ void acpi_find_arm_root_pointer(acpi_physical_address *pa) (u64)rp->xsdt_physical_address); pr_debug(" x_checksum: 0x%02x\n", rp->extended_checksum);
- *pa = (acpi_physical_address)(virt_to_phys(rp)); + *pa = (acpi_physical_address)(virt_to_phys(rp)); } else { pr_err("ACPI missing rsdp info\n"); *pa = (acpi_physical_address)NULL;
On 09/25/2013 08:44 AM, Graeme Gregory wrote:
This is a cleaned up version of patches posted earlier by Al Stone.
I have split them into patches with attempt to make only one change per patch.
Graeme
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
I like it. Sorry the earlier ones were messy; I let myself get into a hurry and rushed the work.
These do what they should, so let's get them applied so we can start making the switch to having these as the official LEG kernel tree...
On 2013-9-25 23:43, Al Stone wrote:
On 09/25/2013 08:44 AM, Graeme Gregory wrote:
This is a cleaned up version of patches posted earlier by Al Stone.
I have split them into patches with attempt to make only one change per patch.
Graeme
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
I like it. Sorry the earlier ones were messy; I let myself get into a hurry and rushed the work.
These do what they should, so let's get them applied so we can start making the switch to having these as the official LEG kernel tree...
Great news! I think UEFI run-time service and ACPI are both working now.