From patchwork Sun Feb 23 22:16:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 25144 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4E80D20143 for ; Sun, 23 Feb 2014 22:18:06 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf8442730yho.1 for ; Sun, 23 Feb 2014 14:18:06 -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:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=DlOSobRZypPwCnSpZH/b/oFXA+bOvXeJY0ElYs22Ap0=; b=MCVzPIEL8DnWRKXYU3yZlhMqKGBKD+ageirrS6EFAdIBHa4GBQKWcywieugeNai8m2 yiq65rbOEwbn76UXap88NxybEVQQxNVblnZolUIxO6YmAjAnWTkU3A7bD+Fh5EdbbcJI 1+a6/OoDAHc1XYT0c1GyPqZRwJQc7GLwufe3VafgcFiOOIgHcPspKVwi+odgBnhMtkL2 u95imEclBktrpWZJY5SzJNZ6NzMc3z95az5T2D2HsZkhwO2gT/e1PEAmpGfrG2b9p0cH Izco4ArVi5miDwJXHsOzBVXAxXjP5uX+OxCwUMuaaadqMJgSyo/QZ/suEIq8qiqDtVmY bNqw== X-Gm-Message-State: ALoCoQk0M8qnWmrQOPFLmjs6KG0P/mMXAbVk2g8nE30wiidB7dS6xtTGcyJn1X0VYjsR39s1g5SW X-Received: by 10.236.118.38 with SMTP id k26mr9084190yhh.35.1393193886038; Sun, 23 Feb 2014 14:18:06 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.196 with SMTP id m62ls1835492qge.11.gmail; Sun, 23 Feb 2014 14:18:05 -0800 (PST) X-Received: by 10.52.90.1 with SMTP id bs1mr9027212vdb.56.1393193885934; Sun, 23 Feb 2014 14:18:05 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id ug9si5299889vcb.107.2014.02.23.14.18.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Feb 2014 14:18:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id le5so5100375vcb.30 for ; Sun, 23 Feb 2014 14:18:05 -0800 (PST) X-Received: by 10.52.61.168 with SMTP id q8mr8931553vdr.40.1393193885850; Sun, 23 Feb 2014 14:18:05 -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.220.174.196 with SMTP id u4csp20466vcz; Sun, 23 Feb 2014 14:18:05 -0800 (PST) X-Received: by 10.140.108.138 with SMTP id j10mr10847794qgf.7.1393193885363; Sun, 23 Feb 2014 14:18:05 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id i33si8881588qgf.30.2014.02.23.14.18.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 23 Feb 2014 14:18:05 -0800 (PST) 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 1WHhLs-0006qg-21; Sun, 23 Feb 2014 22:16:48 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WHhLr-0006pp-68 for xen-devel@lists.xenproject.org; Sun, 23 Feb 2014 22:16:47 +0000 Received: from [193.109.254.147:53375] by server-6.bemta-14.messagelabs.com id FF/E0-03396-E437A035; Sun, 23 Feb 2014 22:16:46 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1393193805!6238783!1 X-Originating-IP: [74.125.83.48] X-SpamReason: No, hits=0.0 required=7.0 tests=SUBJECT_RANDOMQ X-StarScan-Received: X-StarScan-Version: 6.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6816 invoked from network); 23 Feb 2014 22:16:45 -0000 Received: from mail-ee0-f48.google.com (HELO mail-ee0-f48.google.com) (74.125.83.48) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Feb 2014 22:16:45 -0000 Received: by mail-ee0-f48.google.com with SMTP id t10so2718846eei.35 for ; Sun, 23 Feb 2014 14:16:45 -0800 (PST) X-Received: by 10.15.23.194 with SMTP id h42mr20856788eeu.32.1393193805189; Sun, 23 Feb 2014 14:16:45 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id g1sm55994749eet.6.2014.02.23.14.16.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Feb 2014 14:16:44 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Sun, 23 Feb 2014 22:16:23 +0000 Message-Id: <1393193792-20008-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1393193792-20008-1-git-send-email-julien.grall@linaro.org> References: <1393193792-20008-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, Xiantao Zhang Subject: [Xen-devel] [PATCH v2 06/15] xen/passthrough: rework dom0_pvh_reqs to use it also on ARM 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: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: DOM0 on ARM will have the same requirements as DOM0 PVH when iommu is enabled. Both PVH and ARM guest has paging mode translate enabled, so Xen can use it to know if it needs to check the requirements. Rename the function and remove "pvh" word in the panic message. Signed-off-by: Julien Grall Acked-by: Jan Beulich Cc: Xiantao Zhang --- Changes in v2: - IOMMU can be disabled on ARM if the platform doesn't have IOMMU. --- xen/drivers/passthrough/iommu.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 19b0e23..b534893 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -130,13 +130,17 @@ int iommu_domain_init(struct domain *d) return hd->platform_ops->init(d); } -static __init void check_dom0_pvh_reqs(struct domain *d) +static __init void check_dom0_reqs(struct domain *d) { - if ( !iommu_enabled ) + if ( !paging_mode_translate(d) ) + return; + + if ( is_pvh_domain(d) && !iommu_enabled ) panic("Presently, iommu must be enabled for pvh dom0\n"); if ( iommu_passthrough ) - panic("For pvh dom0, dom0-passthrough must not be enabled\n"); + panic("Dom0 uses translate paging mode, dom0-passthrough must not be " + "enabled\n"); iommu_dom0_strict = 1; } @@ -145,8 +149,7 @@ void __init iommu_dom0_init(struct domain *d) { struct hvm_iommu *hd = domain_hvm_iommu(d); - if ( is_pvh_domain(d) ) - check_dom0_pvh_reqs(d); + check_dom0_reqs(d); if ( !iommu_enabled ) return;