From patchwork Wed Feb 4 14:02:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44364 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9528A2029F for ; Wed, 4 Feb 2015 14:07:05 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf1496559lbv.1 for ; Wed, 04 Feb 2015 06:07:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=D6CwEsHBe8CwlBoRxD8u4USx3cXgYE78tUiyuMznoZ4=; b=O01cMUxkij6GWUU8Ff6zGiiqp2B5IZy21o0GvRjVFGmhV7oBoW9XSszSBDyMilU7V4 iYa9qauGmSZOChIHuQDCD4t6dzxkIQpMeX1jS/PnxY+bMajxlBlXlehQN9RASIbiMqKQ aPvWQ81cqXA8hVYdjMdxzia3HhDc8iqH3DUxpULS1I5OxEj8wl/F2BO1t31z39banvFe nKXkmumPlTQY+IOltmYOkku8XaAvgxWraLm9RBCDp5MGuubOr6bsL//3uY+uNVUNYcHi jWlgGiGzFZNHJA/hyNAo7LkOu79AsVEBvqSHsXhpG5T6wOnXPBiU916GR06wRtSDcG2x qr2A== X-Gm-Message-State: ALoCoQlptpUOnS9b9crhAjEIvvpddRGOpJm/Vb9kORMwfVh5a+1B+fIQ46kyJS/4X6JEoptPsgCQ X-Received: by 10.180.94.134 with SMTP id dc6mr2751735wib.2.1423058824586; Wed, 04 Feb 2015 06:07:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.162 with SMTP id f2ls40681lam.5.gmail; Wed, 04 Feb 2015 06:07:04 -0800 (PST) X-Received: by 10.152.5.193 with SMTP id u1mr15486406lau.96.1423058824351; Wed, 04 Feb 2015 06:07:04 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id an6si1377768lbc.129.2015.02.04.06.07.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:07:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id l4so1615876lbv.13 for ; Wed, 04 Feb 2015 06:07:04 -0800 (PST) X-Received: by 10.112.181.41 with SMTP id dt9mr30086678lbc.56.1423058824265; Wed, 04 Feb 2015 06:07:04 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp508139lbj; Wed, 4 Feb 2015 06:07:03 -0800 (PST) X-Received: by 10.220.131.10 with SMTP id v10mr16602512vcs.43.1423058818864; Wed, 04 Feb 2015 06:06:58 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id q10si715131vcj.77.2015.02.04.06.06.58 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:06:58 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0ap-0000R5-Dy; Wed, 04 Feb 2015 14:06:11 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0an-0000Oe-Pb for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:06:10 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 4A/0A-03000-15722D45; Wed, 04 Feb 2015 14:06:09 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-15.tower-21.messagelabs.com!1423058767!12458035!1 X-Originating-IP: [209.85.192.175] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24640 invoked from network); 4 Feb 2015 14:06:08 -0000 Received: from mail-pd0-f175.google.com (HELO mail-pd0-f175.google.com) (209.85.192.175) by server-15.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:06:08 -0000 Received: by pdjy10 with SMTP id y10so884923pdj.7 for ; Wed, 04 Feb 2015 06:06:07 -0800 (PST) X-Received: by 10.70.65.39 with SMTP id u7mr46988204pds.79.1423058766887; Wed, 04 Feb 2015 06:06:06 -0800 (PST) Received: from parthd-ubunutu.qualcomm.com ([202.46.23.62]) by mx.google.com with ESMTPSA id kg12sm2161881pbb.44.2015.02.04.06.06.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:06:06 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:32:12 +0530 Message-Id: <1423058539-26403-29-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> Cc: ian.campbell@citrix.com, julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, Parth Dixit , christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH RFC 28/35] arm: acpi map acpi tables in dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: parth.dixit@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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) +{ + 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)); + 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*/