From patchwork Sun May 17 20:04:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48651 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E107421411 for ; Sun, 17 May 2015 20:07:00 +0000 (UTC) Received: by wgyu3 with SMTP id u3sf23646223wgy.3 for ; Sun, 17 May 2015 13:07:00 -0700 (PDT) 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=8wEeujYlMSBsgPljtYPlLh7MJOmuMqlIh+MUuYpgHMY=; b=F98zO6fFUzBKMUZTbvps3shiTtpLYxZh+G1iQDH7W5WItaDw0tEeHF0vbKlsxuuvcl +rnOHog9W3CFgTXa5uDRN6sJmB8maZejWQIK+J5XN2j8yvp8H2BUsqA9L6owFGbGmD26 9+i7gQ5l7UtbCfT4TwMnoaWjEq51o1cwnrtUvT3W0aiad2qgv936JOKfX6lm+OKskpal FcxXvdgidRZtJxDL1EtyOtPacOodFSJYlBAKl7/1i4rB3pJyUw5FHGeCbpkx/d7XlTw9 FCQMTFEyMq2Z6EiMpgPlBsSKtQOY9WnjGJU8UOzhwuH1hu3T+SOqqd1jJe1r1TahR0sO DKcQ== X-Gm-Message-State: ALoCoQmcNOu0AOxD0go1Q78ywyuL1KnpvcaN8KDje5dq1VPYQ74Z4c7gCTsDeHbS2ndQrHYQHXLH X-Received: by 10.180.73.137 with SMTP id l9mr7265995wiv.5.1431893220203; Sun, 17 May 2015 13:07:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.99 with SMTP id c3ls638544laf.96.gmail; Sun, 17 May 2015 13:07:00 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr7079051lae.19.1431893220039; Sun, 17 May 2015 13:07:00 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id xu7si5320273lbb.139.2015.05.17.13.06.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagv1 with SMTP id v1so191328785lag.3 for ; Sun, 17 May 2015 13:06:59 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr14576508lak.29.1431893219613; Sun, 17 May 2015 13:06:59 -0700 (PDT) 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.108.230 with SMTP id hn6csp3508105lbb; Sun, 17 May 2015 13:06:58 -0700 (PDT) X-Received: by 10.55.51.141 with SMTP id z135mr41443549qkz.84.1431893217951; Sun, 17 May 2015 13:06:57 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id y137si8279480qky.77.2015.05.17.13.06.57 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:06:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) 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 1Yu4pe-0003lu-Us; Sun, 17 May 2015 20:06:42 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4pc-0003hb-I8 for xen-devel@lists.xen.org; Sun, 17 May 2015 20:06:40 +0000 Received: from [193.109.254.147] by server-3.bemta-14.messagelabs.com id 92/50-03032-FC4F8555; Sun, 17 May 2015 20:06:39 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-15.tower-27.messagelabs.com!1431893195!18256913!1 X-Originating-IP: [209.85.220.49] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15964 invoked from network); 17 May 2015 20:06:36 -0000 Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by server-15.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:06:36 -0000 Received: by pacwv17 with SMTP id wv17so119785558pac.2 for ; Sun, 17 May 2015 13:06:35 -0700 (PDT) X-Received: by 10.70.96.194 with SMTP id du2mr38525755pdb.108.1431893195220; Sun, 17 May 2015 13:06:35 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.06.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:06:34 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:34:00 +0530 Message-Id: <1431893048-5214-34-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> Cc: keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 33/41] arm : acpi prepare acpi tables for 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.215.49 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: Map acpi tables described in uefi table to DOM0 address space Signed-off-by: Parth Dixit --- xen/arch/arm/domain_build.c | 59 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index f2ca525..90bdd01 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1225,6 +1225,50 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, return res; } #ifdef CONFIG_ACPI +static int prepare_acpi(struct domain *d, struct kernel_info *kinfo, struct membank tbl_add[]) +{ + unsigned long res; + u64 addr, size; + int i = 0; + + addr = acpi_os_get_root_pointer(); + if( !addr ) + return -ENODEV; + + size = sizeof(struct acpi_table_rsdp); + + res = map_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_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; +} + static int estimate_acpi_size(struct domain *d,struct kernel_info *kinfo, struct membank tbl_add[]) { int size = 0; @@ -1429,6 +1473,10 @@ static int create_acpi_dtb(struct domain *d, struct kernel_info *kinfo, struct m { return -EINVAL; } +static int prepare_acpi(struct domain *d, struct kernel_info *kinfo, struct membank tbl_add[]) +{ + return -EINVAL; +} #endif static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) { @@ -1647,10 +1695,19 @@ int construct_dom0(struct domain *d) * as the initrd & fdt in RAM, so call it first. */ kernel_load(&kinfo); + + if ( !acpi_disabled ) + { + rc = prepare_acpi(d, &kinfo, tbl_add); + if ( rc < 0 ) + return rc; + } + /* initrd_load will fix up the fdt, so call it before dtb_load */ initrd_load(&kinfo); /* Allocate the event channel IRQ and fix up the device tree */ - evtchn_fixup(d, &kinfo); + if( acpi_disabled ) + evtchn_fixup(d, &kinfo); dtb_load(&kinfo); /* Now that we are done restore the original p2m and current. */