[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v3][PATCH 1/1] xen:vtd: missing RMRR mapping while share EPT



On 2014/7/25 16:07, Jan Beulich wrote:
On 25.07.14 at 08:47, <tiejun.chen@xxxxxxxxx> wrote:
  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;
           }

I think you'd be better off using P2M functions here, even more so
considering that you're in an iommu_use_hap_pt() guarded code
section.

Are you pointing p2m->get_entry?

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.