Hi Parth,
On 04/02/2015 14:02, parth.di...@linaro.org wrote:
From: Parth Dixit <parth.di...@linaro.org>
map acpi tables described in uefi table to dom0 address space
Signed-off-by: Parth Dixit <parth.di...@linaro.org>
---
xen/arch/arm/arm64/acpi/arm-core.c | 43 ++++++++++++++++++++++++++++++++++++++
xen/arch/arm/domain_build.c | 4 ++++
xen/include/asm-arm/acpi.h | 1 +
3 files changed, 48 insertions(+)
diff --git a/xen/arch/arm/arm64/acpi/arm-core.c
b/xen/arch/arm/arm64/acpi/arm-core.c
index cc11fce..6707e4c 100644
--- a/xen/arch/arm/arm64/acpi/arm-core.c
+++ b/xen/arch/arm/arm64/acpi/arm-core.c
@@ -31,6 +31,7 @@
#include <asm/cputype.h>
#include <asm/acpi.h>
+#include <asm/p2m.h>
/*
* We never plan to use RSDT on arm/arm64 as its deprecated in spec but this
@@ -241,6 +242,48 @@ static int __init acpi_parse_fadt(struct acpi_table_header
*table)
return 0;
}
+int acpi_map_tables(struct domain *d)
This should be __init
+{
+ int i,res;
+ u64 addr, size;
+
+ /* map rsdp table */
+ addr = acpi_os_get_root_pointer();
+ size = sizeof(struct acpi_table_rsdp);
+
+ res = map_ram_regions(d,
+ paddr_to_pfn(addr & PAGE_MASK),
+ DIV_ROUND_UP(size, PAGE_SIZE),
+ paddr_to_pfn(addr & PAGE_MASK));
It's not related to this patch. As ACPI may reside in RAM, this mean
that the ACPI region should be marked as reserved to avoid Xen
allocating the memory for a guest.
Did you take care of it?
+ if ( res )
+ {
+ printk(XENLOG_ERR "Unable to map 0x%"PRIx64
+ " - 0x%"PRIx64" in domain \n",
+ addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
+ return res;
+ }
+
+ for( i = 0; i < acpi_gbl_root_table_list.count; i++ )
+ {
+ addr = acpi_gbl_root_table_list.tables[i].address;
+ size = acpi_gbl_root_table_list.tables[i].length;
+
+ res = map_ram_regions(d,
+ paddr_to_pfn(addr & PAGE_MASK),
+ DIV_ROUND_UP(size, PAGE_SIZE),
+ paddr_to_pfn(addr & PAGE_MASK));
+ if ( res )
+ {
+ printk(XENLOG_ERR "Unable to map 0x%"PRIx64
+ " - 0x%"PRIx64" in domain \n",
+ addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
+ return res;
+ }
+ }
+
+ return 0;
+}
+
/*
* acpi_boot_table_init() called from setup_arch(), always.
* 1. find RSDP and get its address, and then find XSDT
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 49eb52a..a504064 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1278,6 +1278,10 @@ static int map_acpi_regions(struct domain *d)
{
int res;
+ res = acpi_map_tables(d);
+ if ( res )
+ return res;
+
res = acpi_map_mmio(d);
if ( res )
return res;
diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h
index 01ce28d..4f52cd6 100644
--- a/xen/include/asm-arm/acpi.h
+++ b/xen/include/asm-arm/acpi.h
@@ -108,5 +108,6 @@ static inline void acpi_disable_pci(void)
#define MAX_GIC_CPU_INTERFACE 65535
#define MAX_GIC_DISTRIBUTOR 1 /* should be the same as
MAX_GIC_NR */
extern int __init acpi_gic_init(void);
+int acpi_map_tables(struct domain *d);
#endif /*_ASM_ARM_ACPI_H*/
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel