From patchwork Sun May 17 20:03:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48665 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C3E1121411 for ; Sun, 17 May 2015 20:08:09 +0000 (UTC) Received: by wizk4 with SMTP id k4sf15354529wiz.2 for ; Sun, 17 May 2015 13:08:09 -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=VzVPly98ZakiNmbwssk7hLupBhzfsP95APp8s+sgW3w=; b=PlgSdgn50yEtaY34E6u0kIjY/DUG7OV+iI6k7ZSVZlMY+FWMI9FO5ITidF3c8uLWzQ /5UAXoB2/SWpE1i6ACd1vvN+z8TjwWWNksngbwSdcjB5MTZe6bUz54h8LEtTDZ6AuDAm /0I9q/fbD6wCixPaKGCUnviBWph1k7nd42Ac33oYd7lQm13pTU9icUUkwBFkiLhp49BD k+lux84Rgs0eOcJUSBDW5ChuCISaU1G3kAYW3WVPJ3Lp10elwqLBE+qBZ6EVFDdTULvr m3Z5HvxDnfXzYtmImxOHMlvl1pW/ODWeOz/RSFyuV6FxKU/eJFEZTTT86d++G2TtJYse a3wA== X-Gm-Message-State: ALoCoQlf1XsYVSf6lxD/wG7qXGXqY/znzRYUvS3xyZb/ViRXngBdeJhfw2ReySrOt5y0jOCj/4fK X-Received: by 10.152.88.73 with SMTP id be9mr15269579lab.2.1431893289057; Sun, 17 May 2015 13:08:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.68 with SMTP id be4ls73830lab.47.gmail; Sun, 17 May 2015 13:08:08 -0700 (PDT) X-Received: by 10.112.159.9 with SMTP id wy9mr14418342lbb.120.1431893288916; Sun, 17 May 2015 13:08:08 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id wz10si5322086lbb.138.2015.05.17.13.08.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagv1 with SMTP id v1so191348411lag.3 for ; Sun, 17 May 2015 13:08:08 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr14677799lah.76.1431893288821; Sun, 17 May 2015 13:08:08 -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 hn6csp3508603lbb; Sun, 17 May 2015 13:08:07 -0700 (PDT) X-Received: by 10.53.5.170 with SMTP id cn10mr18365445vdd.76.1431893287368; Sun, 17 May 2015 13:08:07 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ai6si3533571vdc.52.2015.05.17.13.08.06 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:08:07 -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 1Yu4pX-0003a9-Sf; Sun, 17 May 2015 20:06:35 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4pW-0003Xk-W9 for xen-devel@lists.xen.org; Sun, 17 May 2015 20:06:35 +0000 Received: from [193.109.254.147] by server-2.bemta-14.messagelabs.com id 04/20-03031-AC4F8555; Sun, 17 May 2015 20:06:34 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-6.tower-27.messagelabs.com!1431893191!18238189!1 X-Originating-IP: [209.85.192.181] 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 28823 invoked from network); 17 May 2015 20:06:32 -0000 Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by server-6.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:06:32 -0000 Received: by pdbnk13 with SMTP id nk13so21907465pdb.1 for ; Sun, 17 May 2015 13:06:31 -0700 (PDT) X-Received: by 10.66.147.228 with SMTP id tn4mr38801377pab.117.1431893191427; Sun, 17 May 2015 13:06:31 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.06.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:06:30 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:33:59 +0530 Message-Id: <1431893048-5214-33-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 32/41] arm : acpi dynamically map mmio regions 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.50 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: In ACPI mmio regions are described in DSDT which requires AML interpreter. Defer the mapping of mmio until DSDT is parsed in DOM0 and map mmio's dynamically at the time of request. Signed-off-by: Parth Dixit --- xen/arch/arm/traps.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 47d6cef..6b8d247 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include "vtimer.h" #include #include +#include /* The base of the stack must always be double-word aligned, which means * that both the kernel half of struct cpu_user_regs (which is pushed in @@ -2336,6 +2338,47 @@ bad_insn_abort: inject_iabt_exception(regs, gva, hsr.len); } +#ifdef CONFIG_ACPI +static int map_mmio_dsdt(struct cpu_user_regs *regs, + mmio_info_t *info) +{ + int res; + u64 addr,size; + struct domain* d = current->domain; + + if ( !is_hardware_domain(d) ) + return 0; + + addr = info->gpa; + size = PAGE_SIZE; + + res = iomem_permit_access(d, paddr_to_pfn(addr & PAGE_MASK), + paddr_to_pfn(PAGE_ALIGN(addr + size - 1))); + if ( res ) + { + printk(XENLOG_ERR "Unable to permit to dom%d access to" + " 0x%"PRIx64" - 0x%"PRIx64"\n", + d->domain_id, + addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1); + return 0; + } + res = map_mmio_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 %d\n", + addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1, + d->domain_id); + return 0; + } + + return 1; +} +#endif + static void do_trap_data_abort_guest(struct cpu_user_regs *regs, const union hsr hsr) { @@ -2411,7 +2454,13 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, advance_pc(regs, hsr); return; } - +#ifdef CONFIG_ACPI + if( !acpi_disabled ) + { + if( map_mmio_dsdt(regs, &info) ) + return; + } +#endif bad_data_abort: inject_dabt_exception(regs, info.gva, hsr.len); }