From: "Jan Beulich" Subject: Re: [PATCH 1/1] xen:vtd: missing RMRR mapping while share EPT Date: Thu, 24 Jul 2014 11:11:21 +0100 Message-ID: <53D0F7E90200007800025713@mail.emea.novell.com> References: <1406108103-11981-1-git-send-email-tiejun.chen@intel.com> <53CFF40A020000780002539F@mail.emea.novell.com> <53D06011.5080106@intel.com> <53D0C0590200007800025556@mail.emea.novell.com> <53D0AEFA.7080303@intel.com> <53D0D5BE0200007800025643@mail.emea.novell.com> <53D0C393.5080000@intel.com> <53D0F0F902000078000256D4@mail.emea.novell.com> <53D0D832.1040302@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53D0D832.1040302@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 24.07.14 at 11:56, wrote: > On 2014/7/24 17:41, Jan Beulich wrote: >>>>> On 24.07.14 at 10:28, wrote: >>> On 2014/7/24 15:45, Jan Beulich wrote: >>>>>>> On 24.07.14 at 09:00, wrote: >>>>> On 2014/7/24 14:14, Jan Beulich wrote: >>>>>>>>> On 24.07.14 at 03:23, wrote: >>>>>>> @@ -1867,7 +1869,21 @@ static int rmrr_identity_mapping(struct domain *d, >>>>>>> >>>>>>> while ( base_pfn < end_pfn ) >>>>>>> { >>>>>>> - if ( intel_iommu_map_page(d, base_pfn, base_pfn, >>>>>>> + if ( iommu_use_hap_pt(d) ) >>>>>> >>>>>> Don't you, btw, need to extend this condition by >>>>>> && (!iommu_passthrough || !is_hardware_domain(d))? >>>>> >>>>> Why do we need these checks here? >>>> >>>> At least for documentation purposes: It would be wrong to try to >>>> establish these mappings. I reckon iommu_use_hap_pt() implies the >>>> combined other condition, so an ASSERT() would presumably be fine >>>> as well (and get even closer to the intended documentation purpose). >>>> >>> >>> I think if() should be reasonable here. Because >>> >>> intel_iommu_map_page() >>> { >>> ... >>> /* do nothing if dom0 and iommu supports pass thru */ >>> if ( iommu_passthrough && is_hardware_domain(d) ) >>> return 0; >>> >>> We just do nothing to return simply. But if ASSERT will cause abort. >> >> Then tell me the scenario where iommu_use_hap_pt(d) is true and >> both iommu_passthrough and is_hardware_domain(d) are true too. > > Then HVM? If we will ever see a HVM Dom0 it'll clearly also require !iommu_passthrough, just like PVH does - this mode is solely for PV. > Anyway I did a test like this, > > if (iommu_use_hap_pt(d)) > { > ASSERT (iommu_passthrough && is_hardware_domain(d)); > > Then Xen really reboot. Of course, because you inverted the condition. You want ASSERT(!iommu_passthrough || !is_hardware_domain(d)); i.e. what I had previously suggested to add with && to the original condition. Jan