Skip to contentSkip to conversation

Fixups for ACPI initrd table override

PATCH In review Thomas Renninger 5 participants 9 messages Feb 22, 2013 – Feb 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

These are rather minor fixups for code correctness. Except the dependency for X86 which avoids build errors on IA64.

Sooner or later this X86 dependency (max_low_pfn_mapped) should vanish from ACPI code, but for now just get the build failure quickly fixed with an easy patch (the Kconfig one).

#1 lore raw

PATCH 1/2 ACPI: Cleanup acpi_initrd_override declaration and remove ifdefs

Move the acpi_initrd_override() declaration out of CONFIG_ACPI area so that acpi_initrd_override is also defined if CONFIG_ACPI is not defined.

Move the acpi_initrd_override() call into reserve_initrd() inside the CONFIG_BLK_DEV_INITRD block.

Now ifdefs around the call in setup.c can be removed.

Cleanup only, no functional change.

Signed-off-by Thomas Renninger <Thomas Renninger" [email protected]>
---
 arch/x86/kernel/setup.c |    6 ++----
 include/linux/acpi.h    |   16 ++++++++--------
 2 files changed, 10 insertions(+), 12 deletions(-)
arch/x86/kernel/setup.c +2 -4
index 915f5ef..5b85b65 100644
@@ -410,6 +410,8 @@ static void __init reserve_initrd(void)
 	relocate_initrd();
 
 	memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
+
+	acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
 }
 #else
 static void __init early_reserve_initrd(void)
@@ -1088,10 +1090,6 @@ void __init setup_arch(char **cmdline_p)
 
 	reserve_initrd();
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD)
-	acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
-#endif
-
 	reserve_crashkernel();
 
 	vsmp_init();
include/linux/acpi.h +8 -8
index bcbdd74..d95d36a 100644
@@ -79,14 +79,6 @@ typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table);
 typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header,
 				      const unsigned long end);
 
-#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
-void acpi_initrd_override(void *data, size_t size);
-#else
-static inline void acpi_initrd_override(void *data, size_t size)
-{
-}
-#endif
-
 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 void __acpi_unmap_table(char *map, unsigned long size);
 int early_acpi_boot_init(void);
@@ -588,4 +580,12 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
 })
 #endif
 
+#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
+void acpi_initrd_override(void *data, size_t size);
+#else
+static inline void acpi_initrd_override(void *data, size_t size)
+{
+}
+#endif
+
 #endif	/*_LINUX_ACPI_H*/
Signature · 1 line
1.7.6.1
#2 lore raw

PATCH 2/2 ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86

In reply to Thomas Renninger

Reflect this dependency in Kconfig.

Shorten the config description as suggested by Borislav Petkov.

Finding a suitable memory area to store the modified table(s) has been taken over from arch/x86/kernel/setup.c and makes use of max_low_pfn_mapped:
memblock_find_in_range(0, max_low_pfn_mapped,...)
This one is X86 specific. It may not be hard to extend this functionality for other ACPI aware architectures if there is need for.

For now make this feature only available for X86 to avoid build failures on IA64, compare with:
https://bugzilla.kernel.org/show_bug.cgi?id=54091

Signed-off-by Thomas Renninger <Thomas Renninger" [email protected]>
---
 drivers/acpi/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/Kconfig +2 -1
index 1a4ed64..c692404 100644
@@ -266,7 +266,8 @@ config ACPI_CUSTOM_DSDT
 	default ACPI_CUSTOM_DSDT_FILE != ""
 
 config ACPI_INITRD_TABLE_OVERRIDE
-	bool "ACPI tables can be passed via uncompressed cpio in initrd"
+	bool "ACPI tables override via initrd"
+	depends on BLK_DEV_INITRD && X86
 	default n
 	help
 	  This option provides functionality to override arbitrary ACPI tables
Signature · 1 line
1.7.6.1
#3 lore raw

Re: [PATCH 2/2] ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86

Quoted 10 lines · Thomas Renninger

Reflect this dependency in Kconfig.

Shorten the config description as suggested by Borislav Petkov.

Finding a suitable memory area to store the modified table(s) has been taken over from arch/x86/kernel/setup.c and makes use of max_low_pfn_mapped:
memblock_find_in_range(0, max_low_pfn_mapped,...)
This one is X86 specific. It may not be hard to extend this functionality for other ACPI aware architectures if there is need for.

Quoted 7 lines

For now make this feature only available for X86 to avoid build failures on IA64, compare with:
https://bugzilla.kernel.org/show_bug.cgi?id=54091

Signed-off-by Thomas Renninger <Thomas Renninger" [email protected]>

what is that?

you need to fix your scripts.

Quoted 9 lines
---
 drivers/acpi/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/Kconfig +0 -0
index 1a4ed64..c692404 100644

drivers/acpi/Kconfig config ACPI_CUSTOM_DSDT · line 273

Quoted 9 lines
drivers/acpi/Kconfig +2 -1
@@ -266,7 +266,8 @@ config ACPI_CUSTOM_DSDT
        default ACPI_CUSTOM_DSDT_FILE != ""
 
 config ACPI_INITRD_TABLE_OVERRIDE
-       bool "ACPI tables can be passed via uncompressed cpio in initrd"
+       bool "ACPI tables override via initrd"
+       depends on BLK_DEV_INITRD && X86
        default n
        help
          This option provides functionality to override arbitrary ACPI tables

Can replace max_low_pfn_mapped with max_low_pfn instead ? like to see if you can put acpi tables above 4G for x86_64.

if it does not work, you can use min(max_low_pfn<<PAGE_SHIFT, 0xffffffffUL) instead.

Yinghai

#4 lore raw

Re: [PATCH 2/2] ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86

Quoted 7 lines · Yinghai Lu

Can replace max_low_pfn_mapped with max_low_pfn instead ? like to see if you can put acpi tables above 4G for x86_64.

if it does not work, you can use min(max_low_pfn<<PAGE_SHIFT, 0xffffffffUL) instead.

This is part of why we really need to get rid of these stupid variables one and for all. The only exception should perhaps be to mark the HIGHMEM crossover point on HIGHMEM systems.

-hpa

#5 lore raw

Re: [PATCH 2/2] ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86

Quoted 5 lines · H. Peter Anvin
Quoted 4 lines · Yinghai Lu

Can replace max_low_pfn_mapped with max_low_pfn instead ? like to see if you can put acpi tables above 4G for x86_64.

Quoted 7 lines
Quoted 3 lines

if it does not work, you can use min(max_low_pfn<<PAGE_SHIFT, 0xffffffffUL) instead.

This is part of why we really need to get rid of these stupid variables one and for all. The only exception should perhaps be to mark the HIGHMEM crossover point on HIGHMEM systems.

yes, we can drop max_low_pfn_mapped at least.

I should drop that in for-x86-mm2 time point, but saw ThomasR is using that, so i dropped that patch to make the merge easy.

Now after Thomas change to max_low_pfn, we can drop max_low_pfn_mapped.

Yinghai

#6 lore raw

[tip:x86/urgent] ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86

In reply to Thomas Renninger
ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86
Commit-ID:  565d956a7e191e95d81f515196951715f2616e6b
Gitweb:     http://git.kernel.org/tip/565d956a7e191e95d81f515196951715f2616e6b
Author:     Thomas Renninger <[email protected]>
AuthorDate: Fri, 22 Feb 2013 14:12:22 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Mon, 25 Feb 2013 10:47:09 -0800

ACPI: Overriding ACPI tables via initrd only works with an initrd and on X86

Reflect this dependency in Kconfig, to prevent build failures.

Shorten the config description as suggested by Borislav Petkov.

Finding a suitable memory area to store the modified table(s) has been taken over from arch/x86/kernel/setup.c and makes use of max_low_pfn_mapped:
memblock_find_in_range(0, max_low_pfn_mapped,...)
This one is X86 specific. It may not be hard to extend this functionality for other ACPI aware architectures if there is need for.

For now make this feature only available for X86 to avoid build failures on IA64, compare with:
https://bugzilla.kernel.org/show_bug.cgi?id=54091

---
 drivers/acpi/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/Kconfig +2 -1
index 38c5078..f5ae996 100644
@@ -268,7 +268,8 @@ config ACPI_CUSTOM_DSDT
 	default ACPI_CUSTOM_DSDT_FILE != ""
 
 config ACPI_INITRD_TABLE_OVERRIDE
-	bool "ACPI tables can be passed via uncompressed cpio in initrd"
+	bool "ACPI tables override via initrd"
+	depends on BLK_DEV_INITRD && X86
 	default n
 	help
 	  This option provides functionality to override arbitrary ACPI tables
#8 lore raw
In reply to Thomas Renninger
Quoted 7 lines · Thomas Renninger

These are rather minor fixups for code correctness. Except the dependency for X86 which avoids build errors on IA64.

Sooner or later this X86 dependency (max_low_pfn_mapped) should vanish from ACPI code, but for now just get the build failure quickly fixed with an easy patch (the Kconfig one).

Please send the cleanup one again after the merge window is over.

The build error is an urgent fix; I will take that now.

-hpa