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

Re: [Xen-devel] [v6][PATCH 3/7] tools/libxc: check if mmio BAR is out of reserved device memory maps



On 2014/9/11 5:37, Tian, Kevin wrote:
From: Chen, Tiejun
Sent: Tuesday, September 09, 2014 10:50 PM

We need to avoid allocating MMIO BAR conflicting to all reserved device
memory range.

besides checking MMIO BAR confliction, you also need check guest memory
confliction with reserved device memory ranges.

Kexin,

In patch #6, hvmloader: check to reserved device memory maps in e820, we'll lookup the entire e820 table to check if RMRR is overlapping with all recorded ranges in e820, so I think that already cover this case, right?



Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx>

diff --git a/tools/libxc/xc_hvm_build_x86.c b/tools/libxc/xc_hvm_build_x86.c
index c81a25b..299e33a 100644
--- a/tools/libxc/xc_hvm_build_x86.c
+++ b/tools/libxc/xc_hvm_build_x86.c
@@ -239,6 +239,73 @@ static int check_mmio_hole(uint64_t start, uint64_t
memsize,
          return 1;
  }

+/*
+ * Check whether there exists mmio overplap with the reserved device
+ * memory map
+ */
+static int check_rdm_overlap(xc_interface *xch, uint64_t mmio_start,
+                             uint64_t mmio_size)
+{
+    struct xen_mem_reserved_device_memory *map = NULL;

If there are multiple callers of this call, better to move the structure out of
this function to avoid multiple calls.

Good point.

+/* Record reserved device memory. */
+static struct xen_mem_reserved_device_memory *xmrdm = NULL;
+



+    uint64_t rdm_start = 0, rdm_end = 0;
+    unsigned int i = 0;
+    int rc = 0;
+    /* Assume we have one entry if not enough we'll expand.*/
+    uint32_t nr_entries = 1;

[snip]

      }

+    rc = check_rdm_overlap(xch, mmio_start, mmio_start);

mmio_start -> mmio_size.

Fixed and thanks a lot.

Thanks
Tiejun


+    if ( rc < 0 )
+        goto error_out;
+
      for ( i = 0; i < nr_pages; i++ )
          page_array[i] = i;
      for ( i = mmio_start >> PAGE_SHIFT; i < nr_pages; i++ )
--
1.9.1



_______________________________________________
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®.