From patchwork Tue Apr 22 13:14:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 28803 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6BEB8203AC for ; Tue, 22 Apr 2014 13:16:15 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf27904064yha.7 for ; Tue, 22 Apr 2014 06:16:15 -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=x3XljB7lLzv5WeFT0h2djbEqp+tXPwYo+eVn/3efw04=; b=jhJjTVdGAxmSGOnQKWZT8Mzg1wsKlq6fMZVlhtGGRBfy03OWf8MKTwoKBMxWAiDEC/ b/PeELkq1VCBOme3H6LyCgWc85xXTuJDmOla0kjylsxeyDt0FuzWfM8m8xQAyf+1WGFp glFh1ZQO4sNXK0uN/u/G34X+9RrjyT/roG4/reoGsk/xusPl7/tDd/BrYJVcu3yUk7JL c1mKixdvw+mPGBpay8t3U33BFxvUtXdcD/eNqwN3zDjkE3KgH3yQIIz5zvLn8jms89p3 NO8jWSY4ftDg5Sgd7FItth1eGU+gACTCvir/iX2yTi0kH+D+nEYqKpuHD56ybXnYrxde bB2w== X-Gm-Message-State: ALoCoQm/FCQmXEjOsPkSc2jBGineOHX/kR7qpTzkp/7HWjIeNInVvbGL/lPXZ4jQLYa2AJ55aaOk X-Received: by 10.52.146.45 with SMTP id sz13mr17353103vdb.6.1398172575160; Tue, 22 Apr 2014 06:16:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.164 with SMTP id r33ls89214qgr.2.gmail; Tue, 22 Apr 2014 06:16:15 -0700 (PDT) X-Received: by 10.220.176.68 with SMTP id bd4mr23134vcb.70.1398172575062; Tue, 22 Apr 2014 06:16:15 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sc7si6877552vdc.67.2014.04.22.06.16.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:16:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 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.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so2503770vcb.39 for ; Tue, 22 Apr 2014 06:16:15 -0700 (PDT) X-Received: by 10.52.126.107 with SMTP id mx11mr480615vdb.41.1398172574968; Tue, 22 Apr 2014 06:16:14 -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.221.72 with SMTP id ib8csp23843vcb; Tue, 22 Apr 2014 06:16:14 -0700 (PDT) X-Received: by 10.52.144.42 with SMTP id sj10mr30014955vdb.19.1398172574640; Tue, 22 Apr 2014 06:16:14 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id jl10si6894734veb.69.2014.04.22.06.16.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:16:14 -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 1WcaXT-000644-LY; Tue, 22 Apr 2014 13:15:07 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaXQ-00060D-Ek for xen-devel@lists.xenproject.org; Tue, 22 Apr 2014 13:15:04 +0000 Received: from [85.158.137.68:49238] by server-17.bemta-3.messagelabs.com id BC/1F-22741-75B66535; Tue, 22 Apr 2014 13:15:03 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1398172502!3201258!1 X-Originating-IP: [74.125.83.52] 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 1571 invoked from network); 22 Apr 2014 13:15:02 -0000 Received: from mail-ee0-f52.google.com (HELO mail-ee0-f52.google.com) (74.125.83.52) by server-8.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2014 13:15:02 -0000 Received: by mail-ee0-f52.google.com with SMTP id e49so4603359eek.39 for ; Tue, 22 Apr 2014 06:15:02 -0700 (PDT) X-Received: by 10.14.203.199 with SMTP id f47mr10377442eeo.75.1398172502545; Tue, 22 Apr 2014 06:15:02 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id 45sm112969867eeh.9.2014.04.22.06.15.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 06:15:01 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 Apr 2014 14:14:25 +0100 Message-Id: <1398172475-27873-12-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> References: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> Cc: ian.campbell@citrix.com, Julien Grall , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich , Xiantao Zhang Subject: [Xen-devel] [PATCH v4 11/21] xen/passthrough: rework hwdom_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.180 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: Hardware domain on ARM will have the same requirements as hwdom 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 Acked-by: Ian Campbell --- Changes in v4: - Rebase on the latest staging (hwdom series was pushed) - Remove is_phv_domain bits ... and update the next patch (should be #7) to create in new function arch_iommu_check_dom0_reqs. - Update printed message to be more readable Changes in v2: - IOMMU can be disabled on ARM if the platform doesn't have IOMMU. --- xen/drivers/passthrough/iommu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 96a79ce..ccb354d 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 void __hwdom_init check_hwdom_pvh_reqs(struct domain *d) +static void __hwdom_init check_hwdom_reqs(struct domain *d) { + if ( !paging_mode_translate(d) ) + return; + if ( !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 paging translated mode, dom0-passthrough must not be " + "enabled\n"); iommu_dom0_strict = 1; } @@ -145,8 +149,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) { struct hvm_iommu *hd = domain_hvm_iommu(d); - if ( is_pvh_domain(d) ) - check_hwdom_pvh_reqs(d); + check_hwdom_reqs(d); if ( !iommu_enabled ) return;