From patchwork Tue Mar 11 15:49:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 26029 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7EC4220068 for ; Tue, 11 Mar 2014 15:50:46 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id if11sf1667568vcb.0 for ; Tue, 11 Mar 2014 08:50:46 -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:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=Hzib5BKpQGcbjLs2Kn5lZZS8iBL230qKaUrrYqzMgN8=; b=Ww8A6fokzrTuWwmfXy4ZTfGGEbbzTmgzPP54zZjB4dEU3eE1syyHnPzQHRHTLwHTxg w2qCA1dK5PcTbWlaSKNy2YdFp/gShbQIR4GgicQseJu4SRV42C2xcWlzS1qn7kByjMeh 1k0nMPZl5q13FgotdGignrKhlLpEM2+14kKNOu571oEDX2h48Z2tK6WOmmVV/0n3XnUX tO8UqFYwiteK/Ot8t1r1ImwWE4VmSOrXo1VApFn1WKw35V8QD7aSTCa4KyR94krkJbX5 DIUq7MUjsP+aoGtQFHlaPuvR5MhYmYSR7lOcojwbKprjMqtaQpTBQc+O7SENFRcVapfL 7tnA== X-Gm-Message-State: ALoCoQnHIh92CXXzDB0qFcSQ1kW6mVOCZnPipocYRoYrTQquEPWvQ19cT0d3hAZm+BSwXPFW/0BE X-Received: by 10.236.181.74 with SMTP id k50mr1413783yhm.46.1394553046287; Tue, 11 Mar 2014 08:50:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.246 with SMTP id j109ls2504657qgf.13.gmail; Tue, 11 Mar 2014 08:50:46 -0700 (PDT) X-Received: by 10.52.142.10 with SMTP id rs10mr27219595vdb.3.1394553046147; Tue, 11 Mar 2014 08:50:46 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id sl9si5892159veb.21.2014.03.11.08.50.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Mar 2014 08:50:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 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.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so6789933vcb.34 for ; Tue, 11 Mar 2014 08:50:46 -0700 (PDT) X-Received: by 10.52.107.35 with SMTP id gz3mr27184752vdb.8.1394553046065; Tue, 11 Mar 2014 08:50:46 -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.220.78.9 with SMTP id i9csp214979vck; Tue, 11 Mar 2014 08:50:45 -0700 (PDT) X-Received: by 10.220.196.82 with SMTP id ef18mr33502vcb.78.1394553045108; Tue, 11 Mar 2014 08:50:45 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id tr5si6540061vdc.143.2014.03.11.08.50.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Mar 2014 08:50:45 -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 1WNOwg-0006qe-76; Tue, 11 Mar 2014 15:50:22 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WNOwf-0006of-8A for xen-devel@lists.xenproject.org; Tue, 11 Mar 2014 15:50:21 +0000 Received: from [193.109.254.147:64835] by server-15.bemta-14.messagelabs.com id C3/5A-10839-CB03F135; Tue, 11 Mar 2014 15:50:20 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-15.tower-27.messagelabs.com!1394553019!933109!1 X-Originating-IP: [74.125.82.47] X-SpamReason: No, hits=0.0 required=7.0 tests=SUBJECT_RANDOMQ X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9984 invoked from network); 11 Mar 2014 15:50:19 -0000 Received: from mail-wg0-f47.google.com (HELO mail-wg0-f47.google.com) (74.125.82.47) by server-15.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 11 Mar 2014 15:50:19 -0000 Received: by mail-wg0-f47.google.com with SMTP id x12so10170615wgg.18 for ; Tue, 11 Mar 2014 08:50:19 -0700 (PDT) X-Received: by 10.194.109.68 with SMTP id hq4mr37776638wjb.12.1394553019401; Tue, 11 Mar 2014 08:50:19 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id bm8sm62454537wjc.12.2014.03.11.08.50.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Mar 2014 08:50:17 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 11 Mar 2014 15:49:51 +0000 Message-Id: <1394552999-14171-6-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1394552999-14171-1-git-send-email-julien.grall@linaro.org> References: <1394552999-14171-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 v3 05/13] 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.175 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 c70165a..3c63f87 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;