From patchwork Tue Nov 17 09:40:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7635221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87DD0BF90C for ; Tue, 17 Nov 2015 10:23:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D641204E0 for ; Tue, 17 Nov 2015 10:23:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF06D201C0 for ; Tue, 17 Nov 2015 10:23:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZydMS-0006Vp-3Y; Tue, 17 Nov 2015 10:19:40 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyctH-00042Q-2O for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:49:37 +0000 Received: by wmvv187 with SMTP id v187so218004576wmv.1 for ; Tue, 17 Nov 2015 01:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gTHWlsBMQb7L77wM40SnuoGOpu1Y4qSe43F5NslAT4M=; b=wRPN7xRPTm11JfzjoohG5AQeUbSIAywakuXmBhBpbMYO6ZjHKkifYH75mt+kBL/5aX tG23TjFqOmvkX90iAb2czS6xo+0lhSrzjfEmT/NbqHXI46yDrGty4kn0rF+hq87frvp/ l84piMgtQa+3eRK+vwFg3jPMRB1gqNPVHNEG19Hiygx1MnLwUanvOihFXIx32W6sS9iF dlMD4jpgNA0jw/DXbsjMnqPoElRly62VR0pz5mRIOoRXL3hqZYDza+YvMTqoSacfD6wc kOVJ9XmH0He3RQ3x6aBmIBCvZXdsFroRdPTxFrPGbmOTwRz2uXV5bVXk06nsBn1JyhF7 xVJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gTHWlsBMQb7L77wM40SnuoGOpu1Y4qSe43F5NslAT4M=; b=k8Bo4zehJHdmv9PUCpES19KBN69M92VEIIM3aX3h6xKs08DgzQJO85doeJ54kf23bs JPM9fExuFk5PNPw7jCpr1QzLWXqhvNlyPeDpK27fuYqxo3CRFYnIhgjOV2oqmOzi7nFd 8QA2Ica4/a/0o5yMQRaRacn+dY/kAKuWf8RzaMmOcUgne+MyclKsB74WHqyHeLDiPRGK BhYtnPZcLx0ltIBaHUNUmGozlKD7BdF7hKhHDvpTkuSXXwrf/BzOOoF96kiSenMdP1mi ccOuaz8QBouD9r9ahXOzsZWAgeAPrKMvOSDihlbUfk9dpm4CDJgBEsk/Lr/OywiKblJN bMsg== X-Gm-Message-State: ALoCoQlPQ43ETWaenuoF8d/1/iLygPk1W4FWT5ynZeUvEKPnJOB0ba3jX7cw/4bEjqpJv6epMHLe X-Received: by 10.28.217.18 with SMTP id q18mr1550551wmg.10.1447753749690; Tue, 17 Nov 2015 01:49:09 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id wh10sm13265904wjb.45.2015.11.17.01.49.07 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:49:09 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Subject: [PATCH v3 56/62] arm/acpi: Deny MMIO access of UART Date: Tue, 17 Nov 2015 17:40:55 +0800 Message-Id: <1447753261-7552-57-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014931_916367_BA66763B X-CRM114-Status: GOOD ( 11.22 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shannon Zhao Firstly it permits full MMIO capabilities for Dom0. Then deny MMIO access of UART device. Signed-off-by: Shannon Zhao --- xen/arch/arm/domain_build.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 6945f89..9532807 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1360,6 +1360,32 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) #define XEN_HYPERVISOR_ID 0x000058656E564D4D /* "XenVMM" */ #define ACPI_DOM0_FDT_MIN_SIZE 4096 +static int acpi_iomem_deny_access(struct domain *d) +{ + acpi_status status; + struct acpi_table_spcr *spcr=NULL; + unsigned long gfn; + int rc; + + /* Firstly permit full MMIO capabilities. */ + rc = iomem_permit_access(d, 0UL, ~0UL); + if (rc) + return rc; + + status = acpi_get_table(ACPI_SIG_SPCR, 0, + (struct acpi_table_header **)&spcr); + + if ( ACPI_FAILURE(status) ) + { + printk("Failed to get SPCR table\n"); + return -EINVAL; + } + + gfn = spcr->serial_port.address >> PAGE_SHIFT; + /* Deny MMIO access for UART */ + return iomem_deny_access(d, gfn, gfn + 1); +} + static int acpi_route_spi(struct domain *d) { int i, res; @@ -1930,6 +1956,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_iomem_deny_access(d); + if ( rc != 0 ) + return rc; + return 0; } #else