Skip to contentSkip to conversation

Xen fixes and enhancements

GIT PULL Stefano Stabellini 1 participant 4 messages Jun 25, 2013

lore
Share & tools
lore
#0 lore raw

The following changes since commit baf8673ca802cb3ea2cdbe94813441d23bde223b:

Merge remote-tracking branch 'stefanha/block' into staging (2013-06-24 14:33:17 -0500)

are available in the git repository at:

git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen-20130625

Paul Durrant (2):
Allow use of pc machine type (accel=xen) for Xen HVM domains. Move hardcoded initialization of xen-platform device.

Stefano Stabellini (1):

      Revert "xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)"
 hw/i386/pc_piix.c    |   24 +++++++++++++++---------
 include/hw/i386/pc.h |    3 ---
 xen-all.c            |   12 ++++++------
 xen-stub.c           |    5 +++++
 4 files changed, 26 insertions(+), 18 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/3] Revert "xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)"

This reverts commit 9f24a8030a70ea4954b5b8c48f606012f086f65f.

The start of the PCI hole is actually set to 0xf0000000 by hvmloader. In order to retain ABI compatibility with Xen we leave the start of the PCI hole at 0xf0000000 in QEMU (for Xen) too.

---
 hw/i386/pc_piix.c    |    6 +++---
 include/hw/i386/pc.h |    3 ---
 xen-all.c            |   12 ++++++------
 3 files changed, 9 insertions(+), 12 deletions(-)
hw/i386/pc_piix.c +3 -3
index 7972443..523baac 100644
@@ -102,9 +102,9 @@ static void pc_init1(MemoryRegion *system_memory,
         kvmclock_create();
     }
 
-    if (ram_size >= QEMU_BELOW_4G_RAM_END ) {
-        above_4g_mem_size = ram_size - QEMU_BELOW_4G_RAM_END;
-        below_4g_mem_size = QEMU_BELOW_4G_RAM_END;
+    if (ram_size >= 0xe0000000 ) {
+        above_4g_mem_size = ram_size - 0xe0000000;
+        below_4g_mem_size = 0xe0000000;
     } else {
         above_4g_mem_size = 0;
         below_4g_mem_size = ram_size;
include/hw/i386/pc.h +0 -3
index 7f04967..a417402 100644
@@ -79,9 +79,6 @@ extern int fd_bootchk;
 void pc_register_ferr_irq(qemu_irq irq);
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
-#define QEMU_BELOW_4G_RAM_END       0xe0000000
-#define QEMU_BELOW_4G_MMIO_LENGTH   ((1ULL << 32) - QEMU_BELOW_4G_RAM_END)
-
 void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge);
 void pc_hot_add_cpu(const int64_t id, Error **errp);
 void pc_acpi_init(const char *default_dsdt);
xen-all.c +6 -6
index 9b57350..dcb57a0 100644
@@ -161,18 +161,18 @@ static void xen_ram_init(ram_addr_t ram_size)
     ram_addr_t block_len;
 
     block_len = ram_size;
-    if (ram_size >= QEMU_BELOW_4G_RAM_END) {
+    if (ram_size >= HVM_BELOW_4G_RAM_END) {
         /* Xen does not allocate the memory continuously, and keep a hole at
-         * QEMU_BELOW_4G_RAM_END of QEMU_BELOW_4G_MMIO_LENGTH
+         * HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH
          */
-        block_len += QEMU_BELOW_4G_MMIO_LENGTH;
+        block_len += HVM_BELOW_4G_MMIO_LENGTH;
     }
     memory_region_init_ram(&ram_memory, "xen.ram", block_len);
     vmstate_register_ram_global(&ram_memory);
 
-    if (ram_size >= QEMU_BELOW_4G_RAM_END) {
-        above_4g_mem_size = ram_size - QEMU_BELOW_4G_RAM_END;
-        below_4g_mem_size = QEMU_BELOW_4G_RAM_END;
+    if (ram_size >= HVM_BELOW_4G_RAM_END) {
+        above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
+        below_4g_mem_size = HVM_BELOW_4G_RAM_END;
     } else {
         below_4g_mem_size = ram_size;
     }
Signature · 1 line
1.7.2.5
#2 lore raw

[Qemu-devel] [PULL 2/3] Allow use of pc machine type (accel=xen) for Xen HVM domains.

In reply to Stefano Stabellini

From: Paul Durrant <[email protected]>

Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The initialization code for this machine type can easily be pulled into the generic pc initialization code and guarded with a test for whether the xen accelerator options is specified, which is more consistent with the way other accelerators are used.

---
 hw/i386/pc_piix.c |    8 +++++---
 xen-stub.c        |    5 +++++
 2 files changed, 10 insertions(+), 3 deletions(-)
hw/i386/pc_piix.c +5 -3
index 523baac..2782e1d 100644
@@ -91,6 +91,11 @@ static void pc_init1(MemoryRegion *system_memory,
     DeviceState *icc_bridge;
     FWCfgState *fw_cfg = NULL;
 
+    if (xen_enabled() && xen_hvm_init() != 0) {
+        fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
+        exit(1);
+    }
+
     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
     object_property_add_child(qdev_get_machine(), "icc-bridge",
                               OBJECT(icc_bridge), NULL);
@@ -320,9 +325,6 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 {
-    if (xen_hvm_init() != 0) {
-        hw_error("xen hardware virtual machine initialisation failed");
-    }
     pc_init_pci(args);
 }
 #endif
xen-stub.c +5 -0
index 6f0516a..47c8e73 100644
@@ -63,3 +63,8 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 void xen_modified_memory(ram_addr_t start, ram_addr_t length)
 {
 }
+
+int xen_hvm_init(void)
+{
+    return 0;
+}
Signature · 1 line
1.7.2.5
#3 lore raw

[Qemu-devel] [PULL 3/3] Move hardcoded initialization of xen-platform device.

In reply to Stefano Stabellini

From: Paul Durrant <[email protected]>

Creation of the xen-platform device is currently hardcoded into machine type pc's initialization code, guarded by a test for the whether the xen accelerator is enabled. This patch moves the creation of xen-platform into the initialization code of the xenfv machine type. This maintains backwards compatibility for that machine type but allows more flexibility if another machine type is used with Xen HVM domains.

---
 hw/i386/pc_piix.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
hw/i386/pc_piix.c +7 -3
index 2782e1d..fa59a0c 100644
@@ -179,9 +179,6 @@ static void pc_init1(MemoryRegion *system_memory,
     pc_register_ferr_irq(gsi[13]);
 
     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
-    if (xen_enabled()) {
-        pci_create_simple(pci_bus, -1, "xen-platform");
-    }
 
     /* init basic PC hardware */
     pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
@@ -325,7 +322,14 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 {
+    PCIBus *bus;
+
     pc_init_pci(args);
+
+    bus = pci_find_root_bus(0);
+    if (bus != NULL) {
+        pci_create_simple(bus, -1, "xen-platform");
+    }
 }
 #endif
 
Signature · 1 line
1.7.2.5