From fc744bb10cde3ba7b9ecbaf9e723e99d3b7fa25c Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 25 Jun 2013 11:43:04 +0000 Subject: 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. Signed-off-by: Stefano Stabellini --- hw/i386/pc_piix.c | 6 +++--- include/hw/i386/pc.h | 3 --- xen-all.c | 12 ++++++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7972443..523baac 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -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; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 7f04967..a417402 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -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); diff --git a/xen-all.c b/xen-all.c index 9b57350..dcb57a0 100644 --- a/xen-all.c +++ b/xen-all.c @@ -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; } -- cgit v1.1 From a97d6fe6fbb97630d77253d20bdce78f76d01850 Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Tue, 25 Jun 2013 11:46:37 +0000 Subject: Allow use of pc machine type (accel=xen) for Xen HVM domains. 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. Signed-off-by: Paul Durrant Signed-off-by: Stefano Stabellini --- hw/i386/pc_piix.c | 8 +++++--- xen-stub.c | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 523baac..2782e1d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -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 diff --git a/xen-stub.c b/xen-stub.c index 6f0516a..47c8e73 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -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; +} -- cgit v1.1 From 39ae4972390f78f8891a355545c56d20a9fb7770 Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Tue, 25 Jun 2013 11:46:44 +0000 Subject: Move hardcoded initialization of xen-platform device. 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. Signed-off-by: Paul Durrant Signed-off-by: Stefano Stabellini --- hw/i386/pc_piix.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2782e1d..fa59a0c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -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 -- cgit v1.1