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

Re: [Xen-devel] HVM support for e820_host (Was: Bug: Limitation of <=2GB RAM in domU persists with 4.3.0)



I have this at the point where it actually builds.
Otherwise completely untested (will do that later today).

Attached are:

1) libxl patch
Modified from the original patch to _not_ implicitly enable
e820_host when PCI devices are passed.

2) Mukesh's hypervisor e820 patch from here:
http://lists.xen.org/archives/html/xen-devel/2013-05/msg01603.html
Modified slightly to attempt to address Jan's comment on the same
thread, and to adjust the diff line pointers to match against
4.3.0 release code.

3) A patch based on Konrad's earlier in this thread, with
a few additions and changes to make it all compile.

Some peer review would be most welcome - this is my first
venture into Xen code, so please do assume that I have
no idea what I'm doing at the moment. :)

I added yet another E820MAX #define, this time to
tools/firmware/hvmloader/e820.h

If there is a better place to #include that via from
e820.c, please point me in the right direction.

Gordan

On Wed, 04 Sep 2013 12:01:09 +0100, Gordan Bobic <gordan@xxxxxxxxxx> wrote:
On Tue, 3 Sep 2013 17:08:33 -0400, Konrad Rzeszutek Wilk
<konrad.wilk@xxxxxxxxxx> wrote:

Oh, and something like this probably should do it - not compile tested
in any way:

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 1fcaed0..7b38890 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3146,6 +3146,7 @@ static long hvm_memory_op(int cmd,
XEN_GUEST_HANDLE_PARAM(void) arg)
     case XENMEM_machine_memory_map:
     case XENMEM_machphys_mapping:
         return -ENOSYS;
+    case XENMEM_memory_map:
     case XENMEM_decrease_reservation:
         rc = do_memory_op(cmd, arg);
current->domain->arch.hvm_domain.qemu_mapcache_invalidate = 1;

This seems to work better. :)

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3142,10 +3142,10 @@ static long hvm_memory_op(int cmd,
XEN_GUEST_HANDLE_PARAM(void) arg)

     switch ( cmd & MEMOP_CMD_MASK )
     {
-    case XENMEM_memory_map:
     case XENMEM_machine_memory_map:
     case XENMEM_machphys_mapping:
         return -ENOSYS;
+    case XENMEM_memory_map:
     case XENMEM_decrease_reservation:
         rc = do_memory_op(cmd, arg);
current->domain->arch.hvm_domain.qemu_mapcache_invalidate = 1;


diff --git a/tools/firmware/hvmloader/e820.c
b/tools/firmware/hvmloader/e820.c
index 2e05e93..86fb20a 100644
--- a/tools/firmware/hvmloader/e820.c
+++ b/tools/firmware/hvmloader/e820.c
@@ -68,16 +68,42 @@ void dump_e820_table(struct e820entry *e820,
unsigned int nr)
     }
 }

+static const char *e820_names(int type)
+{
+    switch (type) {
+        case E820_RAM: return "RAM";
+        case E820_RESERVED: return "Reserved";
+        case E820_ACPI: return "ACPI";
+        case E820_NVS: return "ACPI NVS";
+        case E820_UNUSABLE: return "Unusable";
+        default: break;
+    }
+    return "Unknown";
+}

To make this work I also added:

--- tools/firmware/hvmloader/e820.h.orig 2013-09-04 10:55:38.317275183 +0100 +++ tools/firmware/hvmloader/e820.h 2013-09-04 10:56:14.374595809 +0100
@@ -8,6 +8,7 @@
 #define E820_RESERVED     2
 #define E820_ACPI         3
 #define E820_NVS          4
+#define E820_UNUSBLE      5

 struct e820entry {
     uint64_t addr;

It that OK?

/* Create an E820 table based on memory parameters provided in hvm_info. */
 int build_e820_table(struct e820entry *e820,
                      unsigned int lowmem_reserved_base,
                      unsigned int bios_image_base)
 {
     unsigned int nr = 0;
+    struct xen_memory_map op;
+    struct e820entry map[E820MAX];
+    int rc;

     if ( !lowmem_reserved_base )
             lowmem_reserved_base = 0xA0000;

+    set_xen_guest_handle(op.buffer, map);
+
+    rc = hypercall_memory_op ( XENMEM_memory_op, &op);

Where is XENMEM_memory_op defined?
Should that be XENMEM_memory_map? Or maybe XENMEM_populate_physmap?

Gordan

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

Attachment: xen-hvm-libxl-e820_host.patch
Description: Text Data

Attachment: xen-hvm-hypervisor-e820_host.patch
Description: Text Data

Attachment: xen-hvm-loader-e820_host.patch
Description: Text Data

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