From patchwork Tue Aug 6 21:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 11079637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 112191395 for ; Tue, 6 Aug 2019 21:51:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 024AF28698 for ; Tue, 6 Aug 2019 21:51:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA71E2883F; Tue, 6 Aug 2019 21:51:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8DA8428698 for ; Tue, 6 Aug 2019 21:51:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hv7Kl-0000oN-6Y; Tue, 06 Aug 2019 21:49:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hv7Kj-0000mp-Le for xen-devel@lists.xenproject.org; Tue, 06 Aug 2019 21:49:29 +0000 X-Inumbo-ID: 10e667e6-b894-11e9-a110-bf1bed7548b1 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 10e667e6-b894-11e9-a110-bf1bed7548b1; Tue, 06 Aug 2019 21:49:29 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C292218A6; Tue, 6 Aug 2019 21:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565128168; bh=sZgajqit8qqVgB1Vr0FiUXVVgAwfUQFWMQOw4YHUJkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fBOk+VirK5qYMkxIB1lK6i9Lqq37Fgw+nVRJAjCNDRWqlYWR+IwCrwHeMUWRdForR +GmP1oh/K1p9PttXqpaYNkpZ9oses9My9sqy9TJnSFk2ZUcJUxWK9Dykcn/EZBQ129 OWDsmVnO/JZ54Q2EFqBd4UtmMVtHWAeWPVM3FQfM= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 6 Aug 2019 14:49:24 -0700 Message-Id: <20190806214925.7534-6-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v4 6/7] xen/arm: don't iomem_permit_access for reserved-memory regions X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , julien.grall@arm.com, sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Don't allow reserved-memory regions to be remapped into any guests, until reserved-memory regions are properly supported in Xen. For now, do not call iomem_permit_access for them. Signed-off-by: Stefano Stabellini --- Changes in v4: - compare the parent name with reserved-memory - use dt_node_cmp Changes in v3: - new patch --- xen/arch/arm/domain_build.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4c8404155a..267e0549e2 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1153,17 +1153,25 @@ static int __init map_range_to_domain(const struct dt_device_node *dev, struct map_range_data *mr_data = data; struct domain *d = mr_data->d; bool need_mapping = !dt_device_for_passthrough(dev); + const struct dt_device_node *parent = dt_get_parent(dev); int res; - res = iomem_permit_access(d, paddr_to_pfn(addr), - paddr_to_pfn(PAGE_ALIGN(addr + len - 1))); - if ( res ) + /* + * Don't give iomem permissions for reserved-memory ranges until + * reserved-memory support is complete. + */ + if ( dt_node_cmp(dt_node_name(parent), "reserved-memory") == 0 ) { - 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 + len) - 1); - return res; + res = iomem_permit_access(d, paddr_to_pfn(addr), + paddr_to_pfn(PAGE_ALIGN(addr + len - 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 + len) - 1); + return res; + } } if ( need_mapping )