From: "Jan Beulich" Subject: [PATCH 2/4] x86/EPT: refine direct MMIO checking when determining EMT Date: Wed, 23 Apr 2014 09:40:26 +0100 Message-ID: <5357989A020000780000B2E6@nat28.tlf.novell.com> References: <53579447020000780000B2A9@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part7A48736A.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcsjI-0003zA-RE for xen-devel@lists.xenproject.org; Wed, 23 Apr 2014 08:40:33 +0000 In-Reply-To: <53579447020000780000B2A9@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser , Kevin Tian , Eddie Dong , Jun Nakajima , Tim Deegan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part7A48736A.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline With need_iommu() only ever true when iommu_enabled is also true, and with the former getting set when a PCI device gets added to a guest, the checks can be consolidated. The range set check are left in place just in case raw MMIO or I/O port ranges get passed to a guest. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -810,10 +810,9 @@ int epte_get_entry_emt(struct domain *d, return -1; } =20 - if ( !iommu_enabled || - (rangeset_is_empty(d->iomem_caps) && - rangeset_is_empty(d->arch.ioport_caps) && - !has_arch_pdevs(d)) ) + if ( !need_iommu(d) && + rangeset_is_empty(d->iomem_caps) && + rangeset_is_empty(d->arch.ioport_caps) ) { ASSERT(!direct_mmio || !((mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >> --=__Part7A48736A.1__= Content-Type: text/plain; name="EPT-EMT-IOMMU-dependency.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="EPT-EMT-IOMMU-dependency.patch" x86/EPT: refine direct MMIO checking when determining EMT=0A=0AWith = need_iommu() only ever true when iommu_enabled is also true, and=0Awith = the former getting set when a PCI device gets added to a guest,=0Athe = checks can be consolidated. The range set check are left in place=0Ajust = in case raw MMIO or I/O port ranges get passed to a guest.=0A=0ASigned-off-= by: Jan Beulich =0A=0A--- a/xen/arch/x86/hvm/mtrr.c=0A++= + b/xen/arch/x86/hvm/mtrr.c=0A@@ -810,10 +810,9 @@ int epte_get_entry_emt(s= truct domain *d,=0A return -1;=0A }=0A =0A- if ( !iommu_enab= led ||=0A- (rangeset_is_empty(d->iomem_caps) &&=0A- = rangeset_is_empty(d->arch.ioport_caps) &&=0A- !has_arch_pdevs(d)) = )=0A+ if ( !need_iommu(d) &&=0A+ rangeset_is_empty(d->iomem_caps= ) &&=0A+ rangeset_is_empty(d->arch.ioport_caps) )=0A {=0A = ASSERT(!direct_mmio ||=0A !((mfn_x(mfn) ^ d->arch.hvm_dom= ain.vmx.apic_access_mfn) >>=0A --=__Part7A48736A.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part7A48736A.1__=--