aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/acpi-build.c12
-rw-r--r--hw/i386/kvm/clock.c7
-rw-r--r--hw/i386/microvm.c2
-rw-r--r--hw/i386/pc.c1
-rw-r--r--hw/i386/pc_piix.c16
-rw-r--r--hw/i386/pc_q35.c19
-rw-r--r--hw/i386/xen/xen-hvm.c3
7 files changed, 31 insertions, 29 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 8d14e46..45ad2f9 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -990,7 +990,6 @@ static Aml *build_vmbus_device_aml(VMBusBridge *vmbus_bridge)
static void build_isa_devices_aml(Aml *table)
{
- VMBusBridge *vmbus_bridge = vmbus_bridge_find();
bool ambiguous;
Object *obj = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous);
Aml *scope;
@@ -1001,10 +1000,6 @@ static void build_isa_devices_aml(Aml *table)
build_acpi_ipmi_devices(scope, BUS(obj), "\\_SB.PCI0.ISA");
isa_build_aml(ISA_BUS(obj), scope);
- if (vmbus_bridge) {
- aml_append(scope, build_vmbus_device_aml(vmbus_bridge));
- }
-
aml_append(table, scope);
}
@@ -1500,6 +1495,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
PCIBus *bus = NULL;
TPMIf *tpm = tpm_find();
int i;
+ VMBusBridge *vmbus_bridge = vmbus_bridge_find();
dsdt = init_aml_allocator();
@@ -1569,6 +1565,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
}
}
+ if (vmbus_bridge) {
+ sb_scope = aml_scope("_SB");
+ aml_append(sb_scope, build_vmbus_device_aml(vmbus_bridge));
+ aml_append(dsdt, sb_scope);
+ }
+
if (pcmc->legacy_cpu_hotplug) {
build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
} else {
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 7b296ae..24fe509 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -329,11 +329,14 @@ static const TypeInfo kvmclock_info = {
};
/* Note: Must be called after VCPU initialization. */
-void kvmclock_create(void)
+void kvmclock_create(bool create_always)
{
X86CPU *cpu = X86_CPU(first_cpu);
- if (kvm_enabled() &&
+ if (!kvm_enabled() || !kvm_has_adjust_clock())
+ return;
+
+ if (create_always ||
cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
(1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 60d3272..aedcae3 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -125,7 +125,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
ioapic_init_gsi(gsi_state, "machine");
- kvmclock_create();
+ kvmclock_create(true);
mms->virtio_irq_base = x86_machine_is_acpi_enabled(x86ms) ? 16 : 5;
for (i = 0; i < VIRTIO_NUM_TRANSPORTS; i++) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2c6194e..e87be5d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1657,6 +1657,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
pcmc->acpi_data_size = 0x20000 + 0x8000;
pcmc->linuxboot_dma_enabled = true;
pcmc->pvh_enabled = true;
+ pcmc->kvmclock_create_always = true;
assert(!mc->get_hotplug_handler);
mc->get_hotplug_handler = pc_get_hotplug_handler;
mc->hotplug_allowed = pc_hotplug_allowed;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 2d8413a..3c2ae06 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -46,7 +46,7 @@
#include "hw/sysbus.h"
#include "sysemu/arch_init.h"
#include "hw/i2c/smbus_eeprom.h"
-#include "hw/xen/xen.h"
+#include "hw/xen/xen-x86.h"
#include "exec/memory.h"
#include "exec/address-spaces.h"
#include "hw/acpi/acpi.h"
@@ -117,8 +117,8 @@ static void pc_init1(MachineState *machine,
* so legacy non-PAE guests can get as much memory as possible in
* the 32bit address space below 4G.
*
- * - Note that Xen has its own ram setp code in xen_ram_init(),
- * called via xen_hvm_init().
+ * - Note that Xen has its own ram setup code in xen_ram_init(),
+ * called via xen_hvm_init_pc().
*
* Examples:
* qemu -M pc-1.7 -m 4G (old default) -> 3584M low, 512M high
@@ -127,7 +127,7 @@ static void pc_init1(MachineState *machine,
* qemu -M pc,max-ram-below-4g=4G -m 3968M -> 3968M low (=4G-128M)
*/
if (xen_enabled()) {
- xen_hvm_init(pcms, &ram_memory);
+ xen_hvm_init_pc(pcms, &ram_memory);
} else {
if (!pcms->max_ram_below_4g) {
pcms->max_ram_below_4g = 0xe0000000; /* default: 3.5G */
@@ -158,8 +158,8 @@ static void pc_init1(MachineState *machine,
x86_cpus_init(x86ms, pcmc->default_cpu_version);
- if (kvm_enabled() && pcmc->kvmclock_enabled) {
- kvmclock_create();
+ if (pcmc->kvmclock_enabled) {
+ kvmclock_create(pcmc->kvmclock_create_always);
}
if (pcmc->pci_enabled) {
@@ -440,11 +440,14 @@ DEFINE_I440FX_MACHINE(v5_2, "pc-i440fx-5.2", NULL,
static void pc_i440fx_5_1_machine_options(MachineClass *m)
{
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+
pc_i440fx_5_2_machine_options(m);
m->alias = NULL;
m->is_default = false;
compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
+ pcmc->kvmclock_create_always = false;
}
DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL,
@@ -565,7 +568,6 @@ static void pc_i440fx_2_9_machine_options(MachineClass *m)
pc_i440fx_2_10_machine_options(m);
compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
- m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
}
DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index e1c415f..a3f4959 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -34,9 +34,7 @@
#include "sysemu/arch_init.h"
#include "hw/i2c/smbus_eeprom.h"
#include "hw/rtc/mc146818rtc.h"
-#include "hw/xen/xen.h"
#include "sysemu/kvm.h"
-#include "sysemu/xen.h"
#include "hw/kvm/clock.h"
#include "hw/pci-host/q35.h"
#include "hw/qdev-properties.h"
@@ -179,13 +177,9 @@ static void pc_q35_init(MachineState *machine)
x86ms->below_4g_mem_size = machine->ram_size;
}
- if (xen_enabled()) {
- xen_hvm_init(pcms, &ram_memory);
- }
-
x86_cpus_init(x86ms, pcmc->default_cpu_version);
- kvmclock_create();
+ kvmclock_create(pcmc->kvmclock_create_always);
/* pci enabled */
if (pcmc->pci_enabled) {
@@ -208,10 +202,7 @@ static void pc_q35_init(MachineState *machine)
}
/* allocate ram and load rom/bios */
- if (!xen_enabled()) {
- pc_memory_init(pcms, get_system_memory(),
- rom_memory, &ram_memory);
- }
+ pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory);
/* create pci host bus */
q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE));
@@ -271,7 +262,7 @@ static void pc_q35_init(MachineState *machine)
assert(pcms->vmport != ON_OFF_AUTO__MAX);
if (pcms->vmport == ON_OFF_AUTO_AUTO) {
- pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
+ pcms->vmport = ON_OFF_AUTO_ON;
}
/* init basic PC hardware */
@@ -366,10 +357,13 @@ DEFINE_Q35_MACHINE(v5_2, "pc-q35-5.2", NULL,
static void pc_q35_5_1_machine_options(MachineClass *m)
{
+ PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+
pc_q35_5_2_machine_options(m);
m->alias = NULL;
compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
+ pcmc->kvmclock_create_always = false;
}
DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL,
@@ -494,7 +488,6 @@ static void pc_q35_2_10_machine_options(MachineClass *m)
pc_q35_2_11_machine_options(m);
compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len);
compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len);
- m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
m->auto_enable_numa_with_memhp = false;
}
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index a39a648..f3ababf 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -22,6 +22,7 @@
#include "hw/xen/xen_common.h"
#include "hw/xen/xen-legacy-backend.h"
#include "hw/xen/xen-bus.h"
+#include "hw/xen/xen-x86.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-misc.h"
#include "qemu/error-report.h"
@@ -1395,7 +1396,7 @@ static int xen_map_ioreq_server(XenIOState *state)
return 0;
}
-void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
{
MachineState *ms = MACHINE(pcms);
unsigned int max_cpus = ms->smp.max_cpus;