From patchwork Wed Feb 4 14:02:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44362 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 F27E52029F for ; Wed, 4 Feb 2015 14:06:56 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf1495983lbv.1 for ; Wed, 04 Feb 2015 06:06:56 -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=w7fyFsbkvqSDM/+VzYPFF2i4n0/4PfuAYdxFiwaXsWY=; b=Y9jMJ2b5c8hNWGwo/pxX5WdQPSbN08V1ZfJon3RRhj7VfSs7koqCuwRo/qglqxWVAE d1T/r+CxdjytXM7ZIjMqUujcKUb13Cwk7evGD/WwwZTfrGDST6YN0AWORarDI8nf4OdN SExxIyjczluIQnCZRsUGtYAbF1iq0wz5qAw9odVzc61VbSSOIVnEGt0cTqhM2Ur0Bd5K 2pWJD2KtBS5BOsn+7WD3sGvzBfpHtYKrNvtpajs7dz3fJQGNad53UMfpdfloFydsI1Qr 8lM6CMf/9w7edx7lGMddTj+LdQNnea50HquqwCkebL/9SOKTwRmmNAJX25JZCIvjth9l nq5A== X-Gm-Message-State: ALoCoQl0nSC4M53ICa3cbQPfDHhgwLGWmLZH8cTZZjyLQStfyDgxnX8OwC6LhAz8oSHAst3OgK2u X-Received: by 10.112.154.233 with SMTP id vr9mr3987214lbb.9.1423058815935; Wed, 04 Feb 2015 06:06:55 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.224.129 with SMTP id rc1ls37951lac.48.gmail; Wed, 04 Feb 2015 06:06:55 -0800 (PST) X-Received: by 10.152.203.137 with SMTP id kq9mr30532437lac.51.1423058815795; Wed, 04 Feb 2015 06:06:55 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ai4si1468777lbc.10.2015.02.04.06.06.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:06:55 -0800 (PST) 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 mail-la0-f49.google.com with SMTP id gf13so1704634lab.8 for ; Wed, 04 Feb 2015 06:06:55 -0800 (PST) X-Received: by 10.112.122.52 with SMTP id lp20mr3290481lbb.98.1423058815693; Wed, 04 Feb 2015 06:06:55 -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 h5csp508019lbj; Wed, 4 Feb 2015 06:06:54 -0800 (PST) X-Received: by 10.236.8.6 with SMTP id 6mr12289727yhq.112.1423058811246; Wed, 04 Feb 2015 06:06:51 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id u47si2176377qge.5.2015.02.04.06.06.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:06:51 -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 1YJ0al-0000Mg-Ux; Wed, 04 Feb 2015 14:06:07 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0ag-0000I7-F0 for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:06:02 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 27/C9-03000-94722D45; Wed, 04 Feb 2015 14:06:01 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-5.tower-21.messagelabs.com!1423058760!12452137!1 X-Originating-IP: [209.85.220.43] 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 3863 invoked from network); 4 Feb 2015 14:06:01 -0000 Received: from mail-pa0-f43.google.com (HELO mail-pa0-f43.google.com) (209.85.220.43) by server-5.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:06:01 -0000 Received: by mail-pa0-f43.google.com with SMTP id eu11so3063626pac.2 for ; Wed, 04 Feb 2015 06:05:59 -0800 (PST) X-Received: by 10.68.78.4 with SMTP id x4mr12880656pbw.74.1423058759725; Wed, 04 Feb 2015 06:05:59 -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.05.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:05:58 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:32:11 +0530 Message-Id: <1423058539-26403-28-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 27/35] arm: acpi map mmio regions to 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: From: Parth Dixit map mmio regions described in uefi tables to dom0 address space Signed-off-by: Parth Dixit --- xen/arch/arm/domain_build.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d781c63..49eb52a 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1235,6 +1235,56 @@ static int make_chosen_node(const struct domain *d, const struct kernel_info *ki return res; } +static int acpi_map_mmio(struct domain *d) +{ + int i,res; + u64 addr,size; + + for( i = 0; i < acpi_mmio.nr_banks; i++ ) + { + addr = acpi_mmio.bank[i].start; + size = acpi_mmio.bank[i].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 res; + } + + 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 res; + } + + } + + return 0; +} + +static int map_acpi_regions(struct domain *d) +{ + int res; + + res = acpi_map_mmio(d); + if ( res ) + return res; + + return 0; +} + /* * Prepare a minimal DTB for DOM0 which contains * bootargs, memory information, @@ -1264,6 +1314,10 @@ static int prepare_dtb_acpi(struct domain *d, struct kernel_info *kinfo) if ( ret < 0 ) goto err; + ret = map_acpi_regions(d); + if ( ret < 0 ) + goto err; + ret = fdt_begin_node(kinfo->fdt, "/"); if ( ret < 0 ) goto err;