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

Re: [Libvir] Re: PATCH 2/2: Reporting of ACPI/APIC features for HVM Xen



Updated patch, incorporating feedback.

Besides formatting, changes how apic is reported - and that's not
pretty. As danpb found out, in cset 12423:ebed72718263 in xen-unstable,
setting the apic was removed from tools/libxc/xc_hvm_build.c. 

In a surprising turn of events, cset 12569:9d6bc06919e0 claims to
reintroduce apic toggling (with a default of 1/on) by writing it into an
hvm_info_table in tools/python/xen/lowlevel/xc/xc.c - I haven't figured
out why the apic can't be toggled in rawhide, though.

For now, the code uses the hypervisor version to determine what apic
capability to report - most likely not the right thing to do, better
suggestions much appreciated.

David

Index: libvirt/src/xen_internal.c
===================================================================
--- libvirt.orig/src/xen_internal.c	2007-07-27 15:57:43.000000000 -0700
+++ libvirt/src/xen_internal.c	2007-07-27 16:00:53.000000000 -0700
@@ -2050,6 +2050,9 @@
     virBufferPtr xml;
     char *xml_str;
 
+    int hv_major = hv_version >> 16;
+    int hv_minor = hv_version & 0xFFFF;
+
     memset(guest_archs, 0, sizeof(guest_archs));
 
     /* /proc/cpuinfo: flags: Intel calls HVM "vmx", AMD calls it "svm".
@@ -2247,6 +2250,20 @@
       <ia64_be/>\n", -1);
             if (r == -1) goto vir_buffer_failed;
         }
+        if (guest_archs[i].hvm) {
+            r = virBufferAdd (xml, "\
+      <acpi default='on' toggle='yes'/>\n", -1);
+            if (r == -1) goto vir_buffer_failed;
+            // In Xen 3.1.0, APIC is always on and can't be toggled
+            if (hv_major >= 3 && hv_minor > 0) {
+                r = virBufferAdd (xml, "\
+      <apic default='off' toggle='no'/>\n", -1);
+            } else {
+                r = virBufferAdd (xml, "\
+      <apic default='on' toggle='yes'/>\n", -1);
+            }
+            if (r == -1) goto vir_buffer_failed;
+        }
         r = virBufferAdd (xml,
                           "\
     </features>\n\
Index: libvirt/tests/xencapsdata/xen-i686-pae-hvm.xml
===================================================================
--- libvirt.orig/tests/xencapsdata/xen-i686-pae-hvm.xml	2007-07-27 15:57:43.000000000 -0700
+++ libvirt/tests/xencapsdata/xen-i686-pae-hvm.xml	2007-07-27 15:57:48.000000000 -0700
@@ -32,6 +32,8 @@
     <features>
       <pae/>
       <nonpae/>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='yes'/>
     </features>
   </guest>
 </capabilities>
Index: libvirt/tests/xencapsdata/xen-x86_64-hvm.xml
===================================================================
--- libvirt.orig/tests/xencapsdata/xen-x86_64-hvm.xml	2007-07-27 15:57:43.000000000 -0700
+++ libvirt/tests/xencapsdata/xen-x86_64-hvm.xml	2007-07-27 15:57:48.000000000 -0700
@@ -31,6 +31,8 @@
     <features>
       <pae/>
       <nonpae/>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='yes'/>
     </features>
   </guest>
 
@@ -45,6 +47,8 @@
       <loader>/usr/lib/xen/boot/hvmloader</loader>
     </arch>
     <features>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='yes'/>
     </features>
   </guest>
 </capabilities>
Index: libvirt/tests/xencapsdata/xen-ia64-hvm.xml
===================================================================
--- libvirt.orig/tests/xencapsdata/xen-ia64-hvm.xml	2007-07-27 15:57:43.000000000 -0700
+++ libvirt/tests/xencapsdata/xen-ia64-hvm.xml	2007-07-27 15:57:48.000000000 -0700
@@ -28,6 +28,8 @@
       <loader>/usr/lib/xen/boot/hvmloader</loader>
     </arch>
     <features>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='yes'/>
     </features>
   </guest>
 </capabilities>
Index: libvirt/tests/xencapsdata/xen-ia64-be-hvm.xml
===================================================================
--- libvirt.orig/tests/xencapsdata/xen-ia64-be-hvm.xml	2007-07-27 15:57:43.000000000 -0700
+++ libvirt/tests/xencapsdata/xen-ia64-be-hvm.xml	2007-07-27 15:57:48.000000000 -0700
@@ -30,6 +30,8 @@
     </arch>
     <features>
       <ia64_be/>
+      <acpi default='on' toggle='yes'/>
+      <apic default='on' toggle='yes'/>
     </features>
   </guest>
 </capabilities>

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