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

[Xen-changelog] [xen-unstable] hvmloader: Reserve FE700000-FE800000 in physical memory map for guest use.


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 26 Oct 2012 01:55:14 +0000
  • Delivery-date: Fri, 26 Oct 2012 01:55:23 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1351148836 25200
# Node ID 79185dcdf55806f4d559c9cc1ef6a7953a21c30a
# Parent  b6a870378ec2c31f4bdebb8170ccc9c39763e152
hvmloader: Reserve FE700000-FE800000 in physical memory map for guest use.

Xen platform promises never to use this physical address region, and
will always mark it as reserved in the physical memory map presented
to the OS (preventing its use by generic OS services such as BAR
remapping).

Linux will use this region for mapping the shared-info page.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r b6a870378ec2 -r 79185dcdf558 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Thu Oct 25 16:04:54 2012 +0100
+++ b/tools/firmware/hvmloader/config.h Thu Oct 25 00:07:16 2012 -0700
@@ -67,7 +67,17 @@ extern unsigned long pci_mem_start, pci_
 #define RESERVED_MEMBASE              0xFC000000
 /* NB. ACPI_INFO_PHYSICAL_ADDRESS *MUST* match definition in acpi/dsdt.asl! */
 #define ACPI_INFO_PHYSICAL_ADDRESS    0xFC000000
-#define RESERVED_MEMORY_DYNAMIC       0xFC001000
+#define RESERVED_MEMORY_DYNAMIC_START 0xFC001000
+#define RESERVED_MEMORY_DYNAMIC_END   0xFE000000
+/*
+ * GUEST_RESERVED: Physical address space reserved for guest use.
+ * This is not dynamically advertised to guests, so this range must *never*
+ * be used for any purpose by us, in future. It must always be marked as
+ * reserved in the memory map (e.g., E820_RESERVED) so that mechanisms such
+ * as PCI BAR remapping do not allocate from this region.
+ */
+#define GUEST_RESERVED_START          0xFE700000
+#define GUEST_RESERVED_END            0xFE800000
 
 extern unsigned long scratch_start;
 
diff -r b6a870378ec2 -r 79185dcdf558 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Thu Oct 25 16:04:54 2012 +0100
+++ b/tools/firmware/hvmloader/util.c   Thu Oct 25 00:07:16 2012 -0700
@@ -416,13 +416,14 @@ void mem_hole_populate_ram(xen_pfn_t mfn
     }
 }
 
-static uint32_t reserve = RESERVED_MEMORY_DYNAMIC - 1;
+static uint32_t alloc_up = RESERVED_MEMORY_DYNAMIC_START - 1;
+static uint32_t alloc_down = RESERVED_MEMORY_DYNAMIC_END;
 
 xen_pfn_t mem_hole_alloc(uint32_t nr_mfns)
 {
-    hvm_info->reserved_mem_pgstart -= nr_mfns;
-    BUG_ON(hvm_info->reserved_mem_pgstart <= (reserve >> PAGE_SHIFT));
-    return hvm_info->reserved_mem_pgstart;
+    alloc_down -= nr_mfns << PAGE_SHIFT;
+    BUG_ON(alloc_up >= alloc_down);
+    return alloc_down >> PAGE_SHIFT;
 }
 
 void *mem_alloc(uint32_t size, uint32_t align)
@@ -433,18 +434,18 @@ void *mem_alloc(uint32_t size, uint32_t 
     if ( align < 16 )
         align = 16;
 
-    s = (reserve + align) & ~(align - 1);
+    s = (alloc_up + align) & ~(align - 1);
     e = s + size - 1;
 
-    BUG_ON((e < s) || (e >> PAGE_SHIFT) >= hvm_info->reserved_mem_pgstart);
+    BUG_ON((e < s) || (e >= alloc_down));
 
-    while ( (reserve >> PAGE_SHIFT) != (e >> PAGE_SHIFT) )
+    while ( (alloc_up >> PAGE_SHIFT) != (e >> PAGE_SHIFT) )
     {
-        reserve += PAGE_SIZE;
-        mem_hole_populate_ram(reserve >> PAGE_SHIFT, 1);
+        alloc_up += PAGE_SIZE;
+        mem_hole_populate_ram(alloc_up >> PAGE_SHIFT, 1);
     }
 
-    reserve = e;
+    alloc_up = e;
 
     return (void *)(unsigned long)s;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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