From: "Jan Beulich" Subject: Re: [v6][PATCH 2/2] xen:vtd: missing RMRR mapping while share EPT Date: Fri, 19 Sep 2014 07:26:01 +0100 Message-ID: <541BE899020000780003668C@mail.emea.novell.com> References: <1406684186-12788-1-git-send-email-tiejun.chen@intel.com> <1406684186-12788-2-git-send-email-tiejun.chen@intel.com> <541ABD800200007800036113@mail.emea.novell.com> <541B84C1.4000403@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <541B84C1.4000403@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tiejun Chen Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 19.09.14 at 03:20, wrote: > On 2014/9/18 17:09, Jan Beulich wrote: >>>>> On 30.07.14 at 03:36, wrote: >>> --- a/xen/drivers/passthrough/vtd/iommu.c >>> +++ b/xen/drivers/passthrough/vtd/iommu.c >>> @@ -1867,8 +1867,14 @@ static int rmrr_identity_mapping(struct domain *d, >>> >>> while ( base_pfn < end_pfn ) >>> { >>> - if ( intel_iommu_map_page(d, base_pfn, base_pfn, >>> - IOMMUF_readable|IOMMUF_writable) ) >>> + if ( iommu_use_hap_pt(d) ) >>> + { >>> + ASSERT(!iommu_passthrough || !is_hardware_domain(d)); >>> + if ( set_identity_p2m_entry(d, base_pfn) ) >>> + return -1; >>> + } >>> + else if ( intel_iommu_map_page(d, base_pfn, base_pfn, >>> + IOMMUF_readable|IOMMUF_writable) ) >>> return -1; >>> base_pfn++; >>> } >> >> So I gave this a try on the one box I have which exposes RMRRs >> (since those are for USB devices I also used your patch to drop >> the USB special casing as done in your later patch series, and I >> further had to fiddle with vtd_ept_page_compatible() in order to >> get page table sharing to actually work on that box [I'll send the >> resulting patch later]) - with the result that passing through an >> affected USB controller (as expected) doesn't work anymore. Which > > With or without these two patches, USB always can be passed through in > my platform. Note I'm using ubuntu as a Guest OS. > >> raises the question why the two patches alone would work at all. >> Could you please share information on the address ranges specified >> by the RMRR(s) in your case? I simply wonder whether things just > > (XEN) [VT-D]dmar.c:807: found ACPI_DMAR_RMRR: > (XEN) [VT-D]dmar.c:383: endpoint: 0000:00:14.0 > (XEN) [VT-D]dmar.c:676: RMRR region: base_addr ab805000 end_address > ab818fff > (XEN) [VT-D]dmar.c:807: found ACPI_DMAR_RMRR: > (XEN) [VT-D]dmar.c:383: endpoint: 0000:00:02.0 > (XEN) [VT-D]dmar.c:676: RMRR region: base_addr ad000000 end_address > af7fffff So how does passing through either of these work for a guest with 4Gb or more of memory assigned with just the original 2 patches (and with shared page tables)? There ought to be a collision detected when trying to do the identity mapping. Jan