From patchwork Wed Mar 11 11:23:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 45625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC6DF214BF for ; Wed, 11 Mar 2015 11:25:40 +0000 (UTC) Received: by wivz2 with SMTP id z2sf6647530wiv.1 for ; Wed, 11 Mar 2015 04:25:40 -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 :mime-version:content-length:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=v75zxZbAF1Oz+t+Sp8w4aS6jNnswz/dCG3Qlsct101I=; b=FuepWvvkTHS+7ifkTf+tlOVJRfHiYyrwcgVNLg5Nxiry4GgJQpy4iIdI4EzegGYcqM 05aaeHFdcoLER7QGtTO6wX1HBv96OWaesa8QgW263fr5K22/k6pc+oSyMlyK1IFILCmK n97hY/CdfDwYsoApGGlMeQLVNKeEjc0apaybktilx/NldxGMajoKxpGY86afIfRtHqVF Y6jxbCSazsWW1TcsSq5/4VX49iByj0psRyfBOlQeZbXrILsuJ5eEBd61gRSwMU4lBrp1 hFTqeANe2J2ITEPyQ12YHxKm1FTyfRRfomDpTj+52NeWv3dU2sVEjdnzrEs5XjeUdZ8W 2Wug== X-Gm-Message-State: ALoCoQmpy2XErwW2KQ/FcVN29ys/1P8R3K/GdgwCbdOgOiGyI+RfoiabJlkf1W0jNgGyvJZv3osn X-Received: by 10.194.161.194 with SMTP id xu2mr5405220wjb.1.1426073140153; Wed, 11 Mar 2015 04:25:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.2 with SMTP id ky2ls144107lab.107.gmail; Wed, 11 Mar 2015 04:25:39 -0700 (PDT) X-Received: by 10.112.12.196 with SMTP id a4mr34459741lbc.8.1426073139887; Wed, 11 Mar 2015 04:25:39 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id t4si2150552lbp.105.2015.03.11.04.25.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Mar 2015 04:25:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbvn10 with SMTP id n10so8047849lbv.11 for ; Wed, 11 Mar 2015 04:25:39 -0700 (PDT) X-Received: by 10.112.204.197 with SMTP id la5mr33942978lbc.29.1426073139439; Wed, 11 Mar 2015 04:25:39 -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.112.35.133 with SMTP id h5csp2710315lbj; Wed, 11 Mar 2015 04:25:38 -0700 (PDT) X-Received: by 10.55.22.30 with SMTP id g30mr37224096qkh.54.1426073138153; Wed, 11 Mar 2015 04:25:38 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id h98si3129173qkh.64.2015.03.11.04.25.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Mar 2015 04:25:38 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1YVek4-0004JA-7y; Wed, 11 Mar 2015 11:24:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YVek2-0004HQ-1m for xen-devel@lists.xenproject.org; Wed, 11 Mar 2015 11:23:58 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id DE/23-13627-DC520055; Wed, 11 Mar 2015 11:23:57 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-11.tower-31.messagelabs.com!1426073034!11015029!1 X-Originating-IP: [209.85.212.169] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30953 invoked from network); 11 Mar 2015 11:23:54 -0000 Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by server-11.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 11 Mar 2015 11:23:54 -0000 Received: by wiwh11 with SMTP id h11so10753614wiw.5 for ; Wed, 11 Mar 2015 04:23:54 -0700 (PDT) X-Received: by 10.194.2.43 with SMTP id 11mr77278917wjr.104.1426073034295; Wed, 11 Mar 2015 04:23:54 -0700 (PDT) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id cj9sm4968411wjc.42.2015.03.11.04.23.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Mar 2015 04:23:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 11 Mar 2015 11:23:15 +0000 Message-Id: <1426072995-1076-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Kevin Tian , ian.campbell@citrix.com, Julien Grall , tim@xen.org, Jan Beulich , Aravind Gopalakrishnan , Suravee Suthikulpanit , Yang Zhang , stefano.stabellini@citrix.com, =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [Xen-devel] [PATCH] xen/passthrough: share_p2m: fix build failure 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: , 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) 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: The commit 7978429 "iommu: fix usage of shared EPT/IOMMU page tables on PVH guests" breaks the hypervisor compilation on ARM. This is because the macro hap_enabled is not defined on ARM. On x86, the P2M can only be shared when hap is enabled and the user didn't deny it (via the command line). Those checks are done by iommu_use_hap_pt(). On ARM, the macro iommu_use_hap_pt() is also defined. So move the if ( iommu_use_hap_pt(d) ) from the IOMMU drivers up to iommu_share_p2m_table. Signed-off-by: Julien Grall Cc: Suravee Suthikulpanit Cc: Aravind Gopalakrishnan Cc: Jan Beulich Cc: Yang Zhang Cc: Kevin Tian Cc: Roger Pau Monné --- xen/drivers/passthrough/amd/iommu_map.c | 3 --- xen/drivers/passthrough/iommu.c | 3 +-- xen/drivers/passthrough/vtd/iommu.c | 3 --- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index 31dc05d..495ff5c 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -785,9 +785,6 @@ void amd_iommu_share_p2m(struct domain *d) struct page_info *p2m_table; mfn_t pgd_mfn; - if ( !iommu_use_hap_pt(d) ) - return; - pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d))); p2m_table = mfn_to_page(mfn_x(pgd_mfn)); diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 7fcbbb1..92ea26f 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -332,8 +332,7 @@ void iommu_share_p2m_table(struct domain* d) { const struct iommu_ops *ops = iommu_get_ops(); - ASSERT( hap_enabled(d) ); - if ( iommu_enabled ) + if ( iommu_enabled && iommu_use_hap_pt(d) ) ops->share_p2m(d); } diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 48676c5..891b9e3 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1789,9 +1789,6 @@ static void iommu_set_pgd(struct domain *d) struct hvm_iommu *hd = domain_hvm_iommu(d); mfn_t pgd_mfn; - if ( !iommu_use_hap_pt(d) ) - return; - pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d))); hd->arch.pgd_maddr = pagetable_get_paddr(pagetable_from_mfn(pgd_mfn)); }