From 49fa9881b2358e390e9e9466ddde74e995927efa Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 3 Jun 2013 15:38:48 +0000 Subject: xen: simplify xen_enabled No need for preprocessor conditionals in xen_enabled: xen_allowed is always defined. Signed-off-by: Stefano Stabellini CC: qemu-stable@nongnu.org --- include/hw/xen/xen.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 7451c5a0bf..b42b0fdb48 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -25,11 +25,7 @@ extern bool xen_allowed; static inline bool xen_enabled(void) { -#if defined(CONFIG_XEN_BACKEND) && defined(CONFIG_XEN) return xen_allowed; -#else - return 0; -#endif } int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); -- cgit v1.2.1 From a7d4207d378069a5bb3175a131e8fdedd39ef97d Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 3 Jun 2013 15:38:43 +0000 Subject: main_loop: do not set nonblocking if xen_enabled() Signed-off-by: Stefano Stabellini CC: qemu-stable@nongnu.org --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 510d2c2ce4..47ab45d37a 100644 --- a/vl.c +++ b/vl.c @@ -2022,7 +2022,7 @@ static void main_loop(void) int64_t ti; #endif do { - nonblocking = !kvm_enabled() && last_io > 0; + nonblocking = !kvm_enabled() && !xen_enabled() && last_io > 0; #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif -- cgit v1.2.1 From 58ee9b0ae05d81c74d6869a25ce4263fc22ed809 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 3 Jun 2013 15:38:31 +0000 Subject: xen_machine_pv: do not create a dummy CPU in machine->init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a regression introduced by: commit 62fc403f11523169eb4264de31279745f48e3ecc Author: Igor Mammedov Date: Mon Apr 29 18:54:13 2013 +0200 target-i386: Attach ICC bus to CPU on its creation X86CPU should have parent bus so it could provide bus for child APIC. The commit makes it mandatory to pass a valid ICC bus to cpu_x86_create, but cpu_x86_init just passes NULL to it. xen_machine_pv uses cpu_x86_init, therefore it has been broken. This patch fixes the problem by removing the dummy CPU creation altogether from xen_init_pv, relying on the fact that QEMU can now cope with a machine without an emulated CPU. Signed-off-by: Stefano Stabellini Reviewed-by: Andreas Färber CC: imammedo@redhat.com CC: qemu-stable@nongnu.org --- hw/i386/xen_machine_pv.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/hw/i386/xen_machine_pv.c b/hw/i386/xen_machine_pv.c index f829a52232..9f2e2918f0 100644 --- a/hw/i386/xen_machine_pv.c +++ b/hw/i386/xen_machine_pv.c @@ -23,7 +23,6 @@ */ #include "hw/hw.h" -#include "hw/i386/pc.h" #include "hw/boards.h" #include "hw/xen/xen_backend.h" #include "xen_domainbuild.h" @@ -31,27 +30,12 @@ static void xen_init_pv(QEMUMachineInitArgs *args) { - const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; - X86CPU *cpu; - CPUState *cs; DriveInfo *dinfo; int i; - /* Initialize a dummy CPU */ - if (cpu_model == NULL) { -#ifdef TARGET_X86_64 - cpu_model = "qemu64"; -#else - cpu_model = "qemu32"; -#endif - } - cpu = cpu_x86_init(cpu_model); - cs = CPU(cpu); - cs->halted = 1; - /* Initialize backend core & drivers */ if (xen_be_init() != 0) { fprintf(stderr, "%s: xen backend core setup failed\n", __FUNCTION__); -- cgit v1.2.1 From 9f24a8030a70ea4954b5b8c48f606012f086f65f Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 3 Jun 2013 15:37:45 +0000 Subject: xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional) We are currently setting the PCI hole to start at HVM_BELOW_4G_RAM_END, that is 0xf0000000. Start the PCI hole at 0xe0000000 instead, that is the same value used by pc_init1 and qemu-xen-traditional. Signed-off-by: Stefano Stabellini CC: qemu-stable@nongnu.org --- hw/i386/pc_piix.c | 6 +++--- include/hw/i386/pc.h | 3 +++ xen-all.c | 12 ++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 43ab4807ae..06416ce74f 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 >= 0xe0000000 ) { - above_4g_mem_size = ram_size - 0xe0000000; - below_4g_mem_size = 0xe0000000; + 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; } 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 663426cee8..626442b116 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -77,6 +77,9 @@ 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 539a1549a5..5ca0c26c63 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 >= HVM_BELOW_4G_RAM_END) { + if (ram_size >= QEMU_BELOW_4G_RAM_END) { /* Xen does not allocate the memory continuously, and keep a hole at - * HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH + * QEMU_BELOW_4G_RAM_END of QEMU_BELOW_4G_MMIO_LENGTH */ - block_len += HVM_BELOW_4G_MMIO_LENGTH; + block_len += QEMU_BELOW_4G_MMIO_LENGTH; } memory_region_init_ram(&ram_memory, "xen.ram", block_len); vmstate_register_ram_global(&ram_memory); - 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; + 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; } else { below_4g_mem_size = ram_size; } -- cgit v1.2.1 From 95222d0945ac8e7fea2adf2fc927634ff3ea1389 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Thu, 30 May 2013 16:52:44 +0000 Subject: xen: remove xen_vcpu_init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need for xen_vcpu_init anymore: - the RTC emulator doesn't have any periodic timers continuously running even in absence of guest interactions anymore; - qemu_dummy_start_vcpu takes care of disabling TCG for us, so we don't need to do it manually here. Signed-off-by: Stefano Stabellini Reviewed-by: Andreas Färber --- hw/i386/pc_piix.c | 1 - include/hw/xen/xen.h | 1 - xen-all.c | 23 ----------------------- 3 files changed, 25 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 06416ce74f..742544e734 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -324,7 +324,6 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args) hw_error("xen hardware virtual machine initialisation failed"); } pc_init_pci_no_kvmclock(args); - xen_vcpu_init(); } #endif diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index b42b0fdb48..6d42dd1bd1 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -38,7 +38,6 @@ qemu_irq *xen_interrupt_controller_init(void); int xen_init(void); int xen_hvm_init(void); -void xen_vcpu_init(void); void xenstore_store_pv_console_info(int i, struct CharDriverState *chr); #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY) diff --git a/xen-all.c b/xen-all.c index 5ca0c26c63..bc105f1627 100644 --- a/xen-all.c +++ b/xen-all.c @@ -574,29 +574,6 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp) } } -/* VCPU Operations, MMIO, IO ring ... */ - -static void xen_reset_vcpu(void *opaque) -{ - CPUState *cpu = opaque; - - cpu->halted = 1; -} - -void xen_vcpu_init(void) -{ - if (first_cpu != NULL) { - CPUState *cpu = ENV_GET_CPU(first_cpu); - - qemu_register_reset(xen_reset_vcpu, cpu); - xen_reset_vcpu(cpu); - } - /* if rtc_clock is left to default (host_clock), disable it */ - if (rtc_clock == host_clock) { - qemu_clock_enable(rtc_clock, false); - } -} - /* get the ioreq packets from share mem */ static ioreq_t *cpu_get_ioreq_from_shared_memory(XenIOState *state, int vcpu) { -- cgit v1.2.1 From 9cdf79d068f52f7de347cb45cfd8903519410e4d Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Mon, 27 May 2013 16:46:01 +0000 Subject: xen: use pc_init_pci instead of pc_init_pci_no_kvmclock Call kvmclock_create only if kvmclock_enabled. Use pc_init_pci on Xen rather than pc_init_pci_no_kvmclock. Signed-off-by: Stefano Stabellini --- hw/i386/pc_piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 742544e734..2653502c08 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -98,7 +98,7 @@ static void pc_init1(MemoryRegion *system_memory, pc_cpus_init(cpu_model, icc_bridge); pc_acpi_init("acpi-dsdt.aml"); - if (kvmclock_enabled) { + if (kvm_enabled() && kvmclock_enabled) { kvmclock_create(); } @@ -323,7 +323,7 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args) if (xen_hvm_init() != 0) { hw_error("xen hardware virtual machine initialisation failed"); } - pc_init_pci_no_kvmclock(args); + pc_init_pci(args); } #endif -- cgit v1.2.1