From patchwork Fri Feb 7 17:43:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 24306 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 64A862096A for ; Fri, 7 Feb 2014 17:43:38 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf9104268yho.5 for ; Fri, 07 Feb 2014 09:43:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=03GaTqwqAUDX5bqJ+1QCUxpYAArQ35zKzDBtptwQs2Y=; b=JcS46XbgExqLbPV0hsfe2GdMOa+wys+KY2aVWYlmcpbeQkCWQyq6mJrRT1226J851D f1sDdH0viKhgAcSZ7M53BeQMC3yWrvxjRZ43/CGoBg0DEB/05JIhFz20v7JDcXnMP+ws /cZdm5kjJfNjU3TRqfyR7MAMlbej+J8K+Ct8QkFsinBKaYecj5U4LBtVjDAoLwFOUiNg WnAK3zor8+uLz8+qJfPHGBlnb6l4rJ/w/DKnb78yLIn76EWqPvsFhcDSS5SqLqZMlnsU HnFgKX/ciJuZnDCy7AWSYGBDKYma/PPKMQ7RuuFkahlzSuFrZS4j+F1geHHiUlDgJT3u sNIQ== X-Gm-Message-State: ALoCoQk4jBtnBhB8k4GU3nSjkNwR1AVU70AZsVrPNfPErLoIDtUBguYvCAVrOQaeYldxNVJRzJuA X-Received: by 10.236.209.134 with SMTP id s6mr5162741yho.40.1391795017455; Fri, 07 Feb 2014 09:43:37 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.101 with SMTP id y92ls1096390qgy.92.gmail; Fri, 07 Feb 2014 09:43:37 -0800 (PST) X-Received: by 10.58.54.15 with SMTP id f15mr11300859vep.5.1391795017307; Fri, 07 Feb 2014 09:43:37 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id e5si1539158vcf.146.2014.02.07.09.43.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 09:43:37 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.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.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so3009513veb.16 for ; Fri, 07 Feb 2014 09:43:37 -0800 (PST) X-Received: by 10.58.252.8 with SMTP id zo8mr31673vec.55.1391795017244; Fri, 07 Feb 2014 09:43:37 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp123599vcz; Fri, 7 Feb 2014 09:43:36 -0800 (PST) X-Received: by 10.14.174.193 with SMTP id x41mr5622231eel.87.1391795014001; Fri, 07 Feb 2014 09:43:34 -0800 (PST) Received: from mail-ee0-f46.google.com (mail-ee0-f46.google.com [74.125.83.46]) by mx.google.com with ESMTPS id x3si9497474eea.244.2014.02.07.09.43.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 09:43:33 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.46 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.46; Received: by mail-ee0-f46.google.com with SMTP id c13so1686866eek.33 for ; Fri, 07 Feb 2014 09:43:33 -0800 (PST) X-Received: by 10.14.29.6 with SMTP id h6mr5738816eea.84.1391795013454; Fri, 07 Feb 2014 09:43:33 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id 8sm18849063eef.1.2014.02.07.09.43.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Feb 2014 09:43:32 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, Julien Grall , Xiantao Zhang , Jan Beulich Subject: [RFC for-4.5 07/12] xen/passthrough: iommu: Don't need to map dom0 page when the PT is shared Date: Fri, 7 Feb 2014 17:43:06 +0000 Message-Id: <1391794991-5919-8-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391794991-5919-1-git-send-email-julien.grall@linaro.org> References: <1391794991-5919-1-git-send-email-julien.grall@linaro.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.128.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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently iommu_init_dom0 is browsing the page list and call map_page callback on each page. On both AMD and VTD drivers, the function will directly return if the page table is shared with the processor. So Xen can safely avoid to run through the page list. Signed-off-by: Julien Grall Cc: Xiantao Zhang Cc: Jan Beulich Acked-by: Ian Campbell --- xen/drivers/passthrough/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 26a5d91..0a26956 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -157,7 +157,7 @@ void __init iommu_dom0_init(struct domain *d) register_keyhandler('o', &iommu_p2m_table); d->need_iommu = !!iommu_dom0_strict; - if ( need_iommu(d) ) + if ( need_iommu(d) && !iommu_use_hap_pt(d) ) { struct page_info *page; unsigned int i = 0;