From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [v3][PATCH 1/1] xen:vtd: missing RMRR mapping while share EPT Date: Fri, 25 Jul 2014 14:47:26 +0800 Message-ID: <53D1FD7E.9070204@intel.com> References: <1406199618-21574-1-git-send-email-tiejun.chen@intel.com> <20140724111143.GF1817@deinos.phlegethon.org> <53D0ED1B.80107@intel.com> <20140724113528.GD1821@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140724113528.GD1821@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: yang.z.zhang@intel.com, kevin.tian@intel.com, JBeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org > So I think it would be prudent to at least try to detect a clash here > and return an error. Could we check if this pte already present like this? @@ -1870,6 +1872,16 @@ static int rmrr_identity_mapping(struct domain *d, if ( iommu_use_hap_pt(d) ) { ASSERT(!iommu_passthrough || !is_hardware_domain(d)); + /* get last level pte */ + pg_maddr = addr_to_dma_page_maddr(d, ((paddr_t)gfn << PAGE_SHIFT_4K), 0); + page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); + pte = page + address_level_offset(addr, 1); + if ( dma_pte_present(*pte) ) + { + printk(XENLOG_ERR VTDPREFIX + "Overlapping RMRRs at %"PRIx64".\n", (paddr_t)base_gfn); + return -1; + } if ( set_mmio_p2m_entry(d, base_pfn, _mfn(base_pfn)) ) return -1; } Thanks Tiejun