aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/i386/fw_cfg.c1
-rw-r--r--hw/i386/intel_iommu.c2
-rw-r--r--hw/i386/kvm/i8254.c1
-rw-r--r--hw/i386/kvm/ioapic.c1
-rw-r--r--hw/i386/pc_piix.c1
-rw-r--r--hw/i386/pc_q35.c2
-rw-r--r--hw/i386/x86.c11
7 files changed, 11 insertions, 8 deletions
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index 72a42f3c66..7362daa45a 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -24,6 +24,7 @@
#include "kvm/kvm_i386.h"
#include "qapi/error.h"
#include CONFIG_DEVICES
+#include "target/i386/cpu.h"
struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 3ca71df369..c9961ef752 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -4053,7 +4053,7 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp)
error_setg(errp, "eim=on requires accel=kvm,kernel-irqchip=split");
return false;
}
- if (!kvm_enable_x2apic()) {
+ if (kvm_enabled() && !kvm_enable_x2apic()) {
error_setg(errp, "eim=on requires support on the KVM side"
"(X2APIC_API, first shipped in v4.7)");
return false;
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index 6a7383d877..a649b2b7ca 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -34,6 +34,7 @@
#include "hw/timer/i8254_internal.h"
#include "hw/qdev-properties-system.h"
#include "sysemu/kvm.h"
+#include "target/i386/kvm/kvm_i386.h"
#include "qom/object.h"
#define KVM_PIT_REINJECT_BIT 0
diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c
index cd5ea5d60b..409d0c8c76 100644
--- a/hw/i386/kvm/ioapic.c
+++ b/hw/i386/kvm/ioapic.c
@@ -16,6 +16,7 @@
#include "hw/intc/ioapic_internal.h"
#include "hw/intc/kvm_irqcount.h"
#include "sysemu/kvm.h"
+#include "kvm/kvm_i386.h"
/* PC Utility function */
void kvm_pc_setup_irq_routing(bool pci_enabled)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5cbad6ad84..8321f36f97 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -69,6 +69,7 @@
#include "hw/mem/nvdimm.h"
#include "hw/i386/acpi-build.h"
#include "kvm/kvm-cpu.h"
+#include "target/i386/cpu.h"
#define MAX_IDE_BUS 2
#define XEN_IOAPIC_NUM_PIRQS 128ULL
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 0bd68690f5..2dd1158b70 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -34,6 +34,7 @@
#include "hw/loader.h"
#include "hw/i2c/smbus_eeprom.h"
#include "hw/rtc/mc146818rtc.h"
+#include "sysemu/tcg.h"
#include "sysemu/kvm.h"
#include "hw/i386/kvm/clock.h"
#include "hw/pci-host/q35.h"
@@ -57,6 +58,7 @@
#include "hw/hyperv/vmbus-bridge.h"
#include "hw/mem/nvdimm.h"
#include "hw/i386/acpi-build.h"
+#include "target/i386/cpu.h"
/* ICH9 AHCI has 6 ports */
#define MAX_SATA_PORTS 6
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index a88a126123..f034df8bf6 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -129,13 +129,10 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version)
ms->smp.max_cpus - 1) + 1;
/*
- * Can we support APIC ID 255 or higher?
- *
- * Under Xen: yes.
- * With userspace emulated lapic: no
- * With KVM's in-kernel lapic: only if X2APIC API is enabled.
+ * Can we support APIC ID 255 or higher? With KVM, that requires
+ * both in-kernel lapic and X2APIC userspace API.
*/
- if (x86ms->apic_id_limit > 255 && !xen_enabled() &&
+ if (x86ms->apic_id_limit > 255 && kvm_enabled() &&
(!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
error_report("current -smp configuration requires kernel "
"irqchip and X2APIC API support.");
@@ -424,7 +421,7 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
cpu->thread_id = topo_ids.smt_id;
if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) &&
- !kvm_hv_vpindex_settable()) {
+ kvm_enabled() && !kvm_hv_vpindex_settable()) {
error_setg(errp, "kernel doesn't allow setting HyperV VP_INDEX");
return;
}