diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-11-08 10:53:41 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-11-08 10:53:41 +0100 |
commit | 89238ef7797023f318f82f4f9dddef59c435b8bd (patch) | |
tree | a219e1cb6429f1b481021edd009e0af5de2e833c /xen/arch/x86/acpi | |
parent | 21a80b2bf97a76d0932b45a35af918b3409e77c1 (diff) | |
download | xen-89238ef7797023f318f82f4f9dddef59c435b8bd.tar.gz xen-89238ef7797023f318f82f4f9dddef59c435b8bd.tar.bz2 xen-89238ef7797023f318f82f4f9dddef59c435b8bd.zip |
x86/ACPI: invalidate BGRT if necessary
Since the image pointed to may live in boot services memory (which we
add to the global memory pool long before ACPI tables get looked at),
we should prevent Dom0 from trying to retrieve the image data in that
case.
The alternatives would be to
- not add boot services memory to the global pool at all, or
- defer adding boot services memory until Dom0 indicates it is safe to
do so, or
- find and parse the BGRT table in xen/arch/x86/efi/boot.c, and avoid
adding that specific region to the E820 table.
None of these are really attractive, and as Xen commonly prints to the
video console anyway (without trying to avoid any regions on the
screen), the invalidation would need to be done conditionally anyway.
(xen/include/acpi/actbl3.h is a verbatim copy from Linux 3.7-rc4)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/acpi')
-rw-r--r-- | xen/arch/x86/acpi/boot.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c index 3c691440a9..24bc2ad13b 100644 --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -28,6 +28,7 @@ #include <xen/init.h> #include <xen/acpi.h> #include <xen/irq.h> +#include <xen/mm.h> #include <xen/dmi.h> #include <asm/fixmap.h> #include <asm/page.h> @@ -286,6 +287,27 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table) #define acpi_parse_hpet NULL #endif +static int __init acpi_invalidate_bgrt(struct acpi_table_header *table) +{ + struct acpi_table_bgrt *bgrt_tbl = + container_of(table, struct acpi_table_bgrt, header); + + if (table->length < sizeof(*bgrt_tbl)) + return -1; + + if (bgrt_tbl->version == 1 && bgrt_tbl->image_address + && !page_is_ram_type(PFN_DOWN(bgrt_tbl->image_address), + RAM_TYPE_CONVENTIONAL)) + return 0; + + printk(KERN_INFO PREFIX "BGRT: invalidating v%d image at %#"PRIx64"\n", + bgrt_tbl->version, bgrt_tbl->image_address); + bgrt_tbl->image_address = 0; + bgrt_tbl->status &= ~1; + + return 0; +} + #ifdef CONFIG_ACPI_SLEEP #define acpi_fadt_copy_address(dst, src, len) do { \ if (fadt->header.revision >= FADT2_REVISION_ID) \ @@ -653,5 +675,7 @@ int __init acpi_boot_init(void) erst_init(); + acpi_table_parse(ACPI_SIG_BGRT, acpi_invalidate_bgrt); + return 0; } |