qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/3] Xen conditionals
@ 2011-10-28 19:38 John Baboval
  2011-11-07 16:43 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: John Baboval @ 2011-10-28 19:38 UTC (permalink / raw)
  To: qemu-devel

Don't perform RTC or APIC setup when running in xen mode.

Signed-off-by: John V. Baboval <john.baboval@virtualcomputer.com>
---
  hw/pc.c      |   56 
+++++++++++++++++++++++++++++---------------------------
  hw/pc_piix.c |    2 +-
  2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index eb4c2d8..e571d38 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -40,6 +40,7 @@
  #include "sysbus.h"
  #include "sysemu.h"
  #include "blockdev.h"
+#include "xen.h"
  #include "ui/qemu-spice.h"
  #include "memory.h"
  #include "exec-memory.h"
@@ -340,35 +341,36 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t 
above_4g_mem_size,
      static pc_cmos_init_late_arg arg;
       /* various important CMOS locations needed by PC/Bochs bios */
-
-    /* memory size */
-    val = 640; /* base memory in K */
-    rtc_set_memory(s, 0x15, val);
-    rtc_set_memory(s, 0x16, val >> 8);
-
-    val = (ram_size / 1024) - 1024;
-    if (val > 65535)
-        val = 65535;
-    rtc_set_memory(s, 0x17, val);
-    rtc_set_memory(s, 0x18, val >> 8);
-    rtc_set_memory(s, 0x30, val);
-    rtc_set_memory(s, 0x31, val >> 8);
-
-    if (above_4g_mem_size) {
-        rtc_set_memory(s, 0x5b, (unsigned int)above_4g_mem_size >> 16);
-        rtc_set_memory(s, 0x5c, (unsigned int)above_4g_mem_size >> 24);
-        rtc_set_memory(s, 0x5d, (uint64_t)above_4g_mem_size >> 32);
+    if (!xen_enabled()) {
+	    /* memory size */
+	    val = 640; /* base memory in K */
+	    rtc_set_memory(s, 0x15, val);
+	    rtc_set_memory(s, 0x16, val >> 8);
+
+	    val = (ram_size / 1024) - 1024;
+	    if (val > 65535)
+		    val = 65535;
+	    rtc_set_memory(s, 0x17, val);
+	    rtc_set_memory(s, 0x18, val >> 8);
+	    rtc_set_memory(s, 0x30, val);
+	    rtc_set_memory(s, 0x31, val >> 8);
+
+	    if (above_4g_mem_size) {
+		    rtc_set_memory(s, 0x5b, (unsigned int)above_4g_mem_size >> 16);
+		    rtc_set_memory(s, 0x5c, (unsigned int)above_4g_mem_size >> 24);
+		    rtc_set_memory(s, 0x5d, (uint64_t)above_4g_mem_size >> 32);
+	    }
+
+	    if (ram_size > (16 * 1024 * 1024))
+		    val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536);
+	    else
+		    val = 0;
+	    if (val > 65535)
+		    val = 65535;
+	    rtc_set_memory(s, 0x34, val);
+	    rtc_set_memory(s, 0x35, val >> 8);
      }
  -    if (ram_size > (16 * 1024 * 1024))
-        val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536);
-    else
-        val = 0;
-    if (val > 65535)
-        val = 65535;
-    rtc_set_memory(s, 0x34, val);
-    rtc_set_memory(s, 0x35, val >> 8);
-
      /* set the number of CPU */
      rtc_set_memory(s, 0x5f, smp_cpus - 1);
  diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 8c7f2b7..f91658c 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -162,7 +162,7 @@ static void pc_init1(MemoryRegion *system_memory,
      for (i = 0; i < ISA_NUM_IRQS; i++) {
          gsi_state->i8259_irq[i] = i8259[i];
      }
-    if (pci_enabled) {
+    if (pci_enabled && !xen_enabled()) {
          ioapic_init(gsi_state);
      }
  -- 1.7.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] Xen conditionals
  2011-10-28 19:38 [Qemu-devel] [PATCH 2/3] Xen conditionals John Baboval
@ 2011-11-07 16:43 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2011-11-07 16:43 UTC (permalink / raw)
  To: John Baboval; +Cc: qemu-devel@nongnu.org

On Fri, 28 Oct 2011, John Baboval wrote:
> Don't perform RTC or APIC setup when running in xen mode.

Both are actually emulated in Xen so registering the two devices in Qemu
is harmless because they are never going to receive any events from the
hypervisor.
Thus I would rather keep the difference with the non-xen case smaller
and avoid introducing more if (xen_enabled()).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-07 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 19:38 [Qemu-devel] [PATCH 2/3] Xen conditionals John Baboval
2011-11-07 16:43 ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).