From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH RFC 28/35] arm: acpi map acpi tables in dom0 Date: Thu, 05 Feb 2015 04:29:25 +0000 Message-ID: <54D2F1A5.3000904@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> <1423058539-26403-29-git-send-email-parth.dixit@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1423058539-26403-29-git-send-email-parth.dixit@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: parth.dixit@linaro.org, xen-devel@lists.xen.org Cc: christoffer.dall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, ian.campbell@citrix.com, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org Hi Parth, On 04/02/2015 14:02, parth.dixit@linaro.org wrote: > From: Parth Dixit > > map acpi tables described in uefi table to dom0 address space > > Signed-off-by: Parth Dixit > --- > 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 > #include > +#include > > /* > * 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