* [PATCH 01/13] hw/i386/pc: Include missing 'sysemu/tcg.h' header
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-09 23:29 ` Richard Henderson
2023-09-04 12:43 ` [PATCH 02/13] hw/i386/pc: Include missing 'cpu.h' header Philippe Mathieu-Daudé
` (11 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Marcel Apfelbaum, Eduardo Habkost
Since commit 6f529b7534 ("target/i386: move FERR handling
to target/i386") pc_q35_init() calls tcg_enabled() which
is declared in "sysemu/tcg.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc_q35.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 37c4814bed..43413dd1ac 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/kvm/clock.h"
#include "hw/pci-host/q35.h"
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/13] hw/i386/pc: Include missing 'cpu.h' header
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 01/13] hw/i386/pc: Include missing 'sysemu/tcg.h' header Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-09 23:31 ` Richard Henderson
2023-09-04 12:43 ` [PATCH 03/13] hw/i386/fw_cfg: " Philippe Mathieu-Daudé
` (10 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Marcel Apfelbaum, Eduardo Habkost
Both pc_piix.c and pc_q35.c files use CPU_VERSION_LEGACY
which is defined in "target/i386/cpu.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc_piix.c | 1 +
hw/i386/pc_q35.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ce1ac95274..f0df12f6fa 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 43413dd1ac..8ecc78c822 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -58,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
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/13] hw/i386/fw_cfg: Include missing 'cpu.h' header
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 01/13] hw/i386/pc: Include missing 'sysemu/tcg.h' header Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 02/13] hw/i386/pc: Include missing 'cpu.h' header Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-09 23:31 ` Richard Henderson
2023-09-04 12:43 ` [PATCH 04/13] target/i386/helper: Restrict KVM declarations to system emulation Philippe Mathieu-Daudé
` (9 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Marcel Apfelbaum, Eduardo Habkost
fw_cfg_build_feature_control() uses CPUID_EXT_VMX which is
defined in "target/i386/cpu.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/fw_cfg.c | 1 +
1 file changed, 1 insertion(+)
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};
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 03/13] hw/i386/fw_cfg: Include missing 'cpu.h' header
2023-09-04 12:43 ` [PATCH 03/13] hw/i386/fw_cfg: " Philippe Mathieu-Daudé
@ 2023-09-09 23:31 ` Richard Henderson
0 siblings, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2023-09-09 23:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Marcelo Tosatti, Michael S. Tsirkin, kvm,
Marcel Apfelbaum, Eduardo Habkost
On 9/4/23 05:43, Philippe Mathieu-Daudé wrote:
> fw_cfg_build_feature_control() uses CPUID_EXT_VMX which is
> defined in "target/i386/cpu.h".
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/i386/fw_cfg.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 04/13] target/i386/helper: Restrict KVM declarations to system emulation
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 03/13] hw/i386/fw_cfg: " Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-09 23:31 ` Richard Henderson
2023-09-04 12:43 ` [PATCH 05/13] target/i386/cpu-sysemu: Inline kvm_apic_in_kernel() Philippe Mathieu-Daudé
` (8 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé
User emulation doesn't need any KVM declarations.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/helper.c b/target/i386/helper.c
index 89aa696c6d..2070dd0dda 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -22,10 +22,10 @@
#include "cpu.h"
#include "exec/exec-all.h"
#include "sysemu/runstate.h"
-#include "kvm/kvm_i386.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/hw_accel.h"
#include "monitor/monitor.h"
+#include "kvm/kvm_i386.h"
#endif
#include "qemu/log.h"
#ifdef CONFIG_TCG
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/13] target/i386/cpu-sysemu: Inline kvm_apic_in_kernel()
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 04/13] target/i386/helper: Restrict KVM declarations to system emulation Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-09 23:32 ` Richard Henderson
2023-09-04 12:43 ` [PATCH 06/13] target/i386: Remove unused KVM stubs Philippe Mathieu-Daudé
` (7 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé
In order to have cpu-sysemu.c become accelerator-agnostic,
inline kvm_apic_in_kernel() -- which is a simple wrapper
to kvm_irqchip_in_kernel() -- and use the generic "sysemu/kvm.h"
header.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/kvm/kvm_i386.h | 2 --
target/i386/cpu-sysemu.c | 4 ++--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index e24753abfe..470627b750 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -13,8 +13,6 @@
#include "sysemu/kvm.h"
-#define kvm_apic_in_kernel() (kvm_irqchip_in_kernel())
-
#ifdef CONFIG_KVM
#define kvm_pit_in_kernel() \
diff --git a/target/i386/cpu-sysemu.c b/target/i386/cpu-sysemu.c
index 28115edf44..2375e48178 100644
--- a/target/i386/cpu-sysemu.c
+++ b/target/i386/cpu-sysemu.c
@@ -19,9 +19,9 @@
#include "qemu/osdep.h"
#include "cpu.h"
+#include "sysemu/kvm.h"
#include "sysemu/xen.h"
#include "sysemu/whpx.h"
-#include "kvm/kvm_i386.h"
#include "qapi/error.h"
#include "qapi/qapi-visit-run-state.h"
#include "qapi/qmp/qdict.h"
@@ -253,7 +253,7 @@ APICCommonClass *apic_get_class(Error **errp)
/* TODO: in-kernel irqchip for hvf */
if (kvm_enabled()) {
- if (!kvm_apic_in_kernel()) {
+ if (!kvm_irqchip_in_kernel()) {
error_setg(errp, "KVM does not support userspace APIC");
return NULL;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 05/13] target/i386/cpu-sysemu: Inline kvm_apic_in_kernel()
2023-09-04 12:43 ` [PATCH 05/13] target/i386/cpu-sysemu: Inline kvm_apic_in_kernel() Philippe Mathieu-Daudé
@ 2023-09-09 23:32 ` Richard Henderson
0 siblings, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2023-09-09 23:32 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Marcelo Tosatti, Michael S. Tsirkin, kvm
On 9/4/23 05:43, Philippe Mathieu-Daudé wrote:
> In order to have cpu-sysemu.c become accelerator-agnostic,
> inline kvm_apic_in_kernel() -- which is a simple wrapper
> to kvm_irqchip_in_kernel() -- and use the generic "sysemu/kvm.h"
> header.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/i386/kvm/kvm_i386.h | 2 --
> target/i386/cpu-sysemu.c | 4 ++--
> 2 files changed, 2 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 06/13] target/i386: Remove unused KVM stubs
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 05/13] target/i386/cpu-sysemu: Inline kvm_apic_in_kernel() Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic() Philippe Mathieu-Daudé
` (6 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Daniel Henrique Barboza
All these functions:
- kvm_arch_get_supported_cpuid()
- kvm_has_smm(()
- kvm_hyperv_expand_features()
- kvm_set_max_apic_id()
are called after checking for kvm_enabled(), which is
false when KVM is not built. Since the compiler elides
these functions, their stubs are not used and can be
removed.
Inspired-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/kvm/kvm-stub.c | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/target/i386/kvm/kvm-stub.c b/target/i386/kvm/kvm-stub.c
index e052f1c7b0..f985d9a1d3 100644
--- a/target/i386/kvm/kvm-stub.c
+++ b/target/i386/kvm/kvm-stub.c
@@ -10,42 +10,16 @@
*
*/
#include "qemu/osdep.h"
-#include "cpu.h"
#include "kvm_i386.h"
#ifndef __OPTIMIZE__
-bool kvm_has_smm(void)
-{
- return 1;
-}
-
bool kvm_enable_x2apic(void)
{
return false;
}
-
-/* This function is only called inside conditionals which we
- * rely on the compiler to optimize out when CONFIG_KVM is not
- * defined.
- */
-uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
- uint32_t index, int reg)
-{
- abort();
-}
#endif
bool kvm_hv_vpindex_settable(void)
{
return false;
}
-
-bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp)
-{
- abort();
-}
-
-void kvm_set_max_apic_id(uint32_t max_apic_id)
-{
- return;
-}
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic()
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 06/13] target/i386: Remove unused KVM stubs Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 13:40 ` Paolo Bonzini
2023-09-04 12:43 ` [PATCH 08/13] target/i386: Allow elision of kvm_hv_vpindex_settable() Philippe Mathieu-Daudé
` (5 subsequent siblings)
12 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Daniel Henrique Barboza, Peter Xu, Jason Wang, Eduardo Habkost,
Marcel Apfelbaum
Call kvm_enabled() before kvm_enable_x2apic() to
let the compiler elide its call.
Suggested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/intel_iommu.c | 2 +-
hw/i386/x86.c | 2 +-
target/i386/kvm/kvm-stub.c | 7 -------
3 files changed, 2 insertions(+), 9 deletions(-)
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/x86.c b/hw/i386/x86.c
index a88a126123..d2920af792 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -136,7 +136,7 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version)
* With KVM's in-kernel lapic: only if X2APIC API is enabled.
*/
if (x86ms->apic_id_limit > 255 && !xen_enabled() &&
- (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
+ kvm_enabled() && (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
error_report("current -smp configuration requires kernel "
"irqchip and X2APIC API support.");
exit(EXIT_FAILURE);
diff --git a/target/i386/kvm/kvm-stub.c b/target/i386/kvm/kvm-stub.c
index f985d9a1d3..62cccebee4 100644
--- a/target/i386/kvm/kvm-stub.c
+++ b/target/i386/kvm/kvm-stub.c
@@ -12,13 +12,6 @@
#include "qemu/osdep.h"
#include "kvm_i386.h"
-#ifndef __OPTIMIZE__
-bool kvm_enable_x2apic(void)
-{
- return false;
-}
-#endif
-
bool kvm_hv_vpindex_settable(void)
{
return false;
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic()
2023-09-04 12:43 ` [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic() Philippe Mathieu-Daudé
@ 2023-09-04 13:40 ` Paolo Bonzini
2023-09-04 13:43 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 21+ messages in thread
From: Paolo Bonzini @ 2023-09-04 13:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Richard Henderson, Marcelo Tosatti, Michael S. Tsirkin, kvm,
Daniel Henrique Barboza, Peter Xu, Jason Wang, Eduardo Habkost,
Marcel Apfelbaum
On 9/4/23 14:43, Philippe Mathieu-Daudé wrote:
> Call kvm_enabled() before kvm_enable_x2apic() to
> let the compiler elide its call.
>
> Suggested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/i386/intel_iommu.c | 2 +-
> hw/i386/x86.c | 2 +-
> target/i386/kvm/kvm-stub.c | 7 -------
> 3 files changed, 2 insertions(+), 9 deletions(-)
>
> 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/x86.c b/hw/i386/x86.c
> index a88a126123..d2920af792 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -136,7 +136,7 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version)
> * With KVM's in-kernel lapic: only if X2APIC API is enabled.
> */
> if (x86ms->apic_id_limit > 255 && !xen_enabled() &&
> - (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
> + kvm_enabled() && (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
This "!xen && kvm" expression can be simplified.
I am queuing the series with this squashed in:
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index d2920af792d..3e86cf3060f 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -129,14 +129,11 @@ 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() &&
- kvm_enabled() && (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
+ 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.");
exit(EXIT_FAILURE);
Paolo
> error_report("current -smp configuration requires kernel "
> "irqchip and X2APIC API support.");
> exit(EXIT_FAILURE);
> diff --git a/target/i386/kvm/kvm-stub.c b/target/i386/kvm/kvm-stub.c
> index f985d9a1d3..62cccebee4 100644
> --- a/target/i386/kvm/kvm-stub.c
> +++ b/target/i386/kvm/kvm-stub.c
> @@ -12,13 +12,6 @@
> #include "qemu/osdep.h"
> #include "kvm_i386.h"
>
> -#ifndef __OPTIMIZE__
> -bool kvm_enable_x2apic(void)
> -{
> - return false;
> -}
> -#endif
> -
> bool kvm_hv_vpindex_settable(void)
> {
> return false;
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic()
2023-09-04 13:40 ` Paolo Bonzini
@ 2023-09-04 13:43 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 13:43 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
Cc: Richard Henderson, Marcelo Tosatti, Michael S. Tsirkin, kvm,
Daniel Henrique Barboza, Peter Xu, Jason Wang, Eduardo Habkost,
Marcel Apfelbaum
On 4/9/23 15:40, Paolo Bonzini wrote:
> On 9/4/23 14:43, Philippe Mathieu-Daudé wrote:
>> Call kvm_enabled() before kvm_enable_x2apic() to
>> let the compiler elide its call.
>>
>> Suggested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/i386/intel_iommu.c | 2 +-
>> hw/i386/x86.c | 2 +-
>> target/i386/kvm/kvm-stub.c | 7 -------
>> 3 files changed, 2 insertions(+), 9 deletions(-)
>> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
>> index a88a126123..d2920af792 100644
>> --- a/hw/i386/x86.c
>> +++ b/hw/i386/x86.c
>> @@ -136,7 +136,7 @@ void x86_cpus_init(X86MachineState *x86ms, int
>> default_cpu_version)
>> * With KVM's in-kernel lapic: only if X2APIC API is enabled.
>> */
>> if (x86ms->apic_id_limit > 255 && !xen_enabled() &&
>> - (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
>> + kvm_enabled() && (!kvm_irqchip_in_kernel() ||
>> !kvm_enable_x2apic())) {
>
> This "!xen && kvm" expression can be simplified.
>
> I am queuing the series with this squashed in:
>
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index d2920af792d..3e86cf3060f 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -129,14 +129,11 @@ 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() &&
> - kvm_enabled() && (!kvm_irqchip_in_kernel() ||
> !kvm_enable_x2apic())) {
> + 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.");
> exit(EXIT_FAILURE);
>
> Paolo
Thank you!
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 08/13] target/i386: Allow elision of kvm_hv_vpindex_settable()
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic() Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 09/13] target/i386: Restrict declarations specific to CONFIG_KVM Philippe Mathieu-Daudé
` (4 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Daniel Henrique Barboza, Marcel Apfelbaum, Eduardo Habkost
Call kvm_enabled() before kvm_hv_vpindex_settable()
to let the compiler elide its call.
kvm-stub.c is now empty, remove it.
Suggested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/x86.c | 2 +-
target/i386/kvm/kvm-stub.c | 18 ------------------
target/i386/kvm/meson.build | 2 --
3 files changed, 1 insertion(+), 21 deletions(-)
delete mode 100644 target/i386/kvm/kvm-stub.c
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index d2920af792..ecf16ef402 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -424,7 +424,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;
}
diff --git a/target/i386/kvm/kvm-stub.c b/target/i386/kvm/kvm-stub.c
deleted file mode 100644
index 62cccebee4..0000000000
--- a/target/i386/kvm/kvm-stub.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * QEMU KVM x86 specific function stubs
- *
- * Copyright Linaro Limited 2012
- *
- * Author: Peter Maydell <peter.maydell@linaro.org>
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- *
- */
-#include "qemu/osdep.h"
-#include "kvm_i386.h"
-
-bool kvm_hv_vpindex_settable(void)
-{
- return false;
-}
diff --git a/target/i386/kvm/meson.build b/target/i386/kvm/meson.build
index 40fbde96ca..5d9174bbb5 100644
--- a/target/i386/kvm/meson.build
+++ b/target/i386/kvm/meson.build
@@ -1,5 +1,3 @@
-i386_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
-
i386_softmmu_kvm_ss = ss.source_set()
i386_softmmu_kvm_ss.add(files(
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/13] target/i386: Restrict declarations specific to CONFIG_KVM
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 08/13] target/i386: Allow elision of kvm_hv_vpindex_settable() Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 10/13] sysemu/kvm: Restrict kvm_arch_get_supported_cpuid/msr() to x86 targets Philippe Mathieu-Daudé
` (3 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé
Keep the function accessed by target/i386/ and hw/i386/
exposed, restrict the ones accessed by target/i386/kvm/.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/kvm/kvm_i386.h | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index 470627b750..ff309bad25 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -31,30 +31,35 @@
#endif /* CONFIG_KVM */
bool kvm_has_smm(void);
-bool kvm_has_adjust_clock(void);
-bool kvm_has_adjust_clock_stable(void);
-bool kvm_has_exception_payload(void);
-void kvm_synchronize_all_tsc(void);
+bool kvm_enable_x2apic(void);
+bool kvm_hv_vpindex_settable(void);
+
+bool kvm_enable_sgx_provisioning(KVMState *s);
+bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp);
+
void kvm_arch_reset_vcpu(X86CPU *cs);
void kvm_arch_after_reset_vcpu(X86CPU *cpu);
void kvm_arch_do_init_vcpu(X86CPU *cs);
+void kvm_set_max_apic_id(uint32_t max_apic_id);
+void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask);
+
+#ifdef CONFIG_KVM
+
+bool kvm_has_adjust_clock(void);
+bool kvm_has_adjust_clock_stable(void);
+bool kvm_has_exception_payload(void);
+void kvm_synchronize_all_tsc(void);
+
void kvm_put_apicbase(X86CPU *cpu, uint64_t value);
-bool kvm_enable_x2apic(void);
bool kvm_has_x2apic_api(void);
bool kvm_has_waitpkg(void);
-bool kvm_hv_vpindex_settable(void);
-bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp);
-
uint64_t kvm_swizzle_msi_ext_dest_id(uint64_t address);
void kvm_update_msi_routes_all(void *private, bool global,
uint32_t index, uint32_t mask);
-bool kvm_enable_sgx_provisioning(KVMState *s);
-void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask);
-
typedef bool QEMURDMSRHandler(X86CPU *cpu, uint32_t msr, uint64_t *val);
typedef bool QEMUWRMSRHandler(X86CPU *cpu, uint32_t msr, uint64_t val);
typedef struct kvm_msr_handlers {
@@ -66,6 +71,6 @@ typedef struct kvm_msr_handlers {
bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
QEMUWRMSRHandler *wrmsr);
-void kvm_set_max_apic_id(uint32_t max_apic_id);
+#endif /* CONFIG_KVM */
#endif
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/13] sysemu/kvm: Restrict kvm_arch_get_supported_cpuid/msr() to x86 targets
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 09/13] target/i386: Restrict declarations specific to CONFIG_KVM Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 11/13] sysemu/kvm: Restrict kvm_get_apic_state() " Philippe Mathieu-Daudé
` (2 subsequent siblings)
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé
kvm_arch_get_supported_cpuid() / kvm_arch_get_supported_msr_feature()
are only defined for x86 targets (in target/i386/kvm/kvm.c). Their
declarations are pointless on other targets.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/sysemu/kvm.h | 5 -----
target/i386/kvm/kvm_i386.h | 3 +++
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index ebdca41052..a578961a5e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -464,11 +464,6 @@ int kvm_vm_check_extension(KVMState *s, unsigned int extension);
kvm_vcpu_ioctl(cpu, KVM_ENABLE_CAP, &cap); \
})
-uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
- uint32_t index, int reg);
-uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index);
-
-
void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len);
int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index ff309bad25..b78e2feb49 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -40,6 +40,9 @@ bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp);
void kvm_arch_reset_vcpu(X86CPU *cs);
void kvm_arch_after_reset_vcpu(X86CPU *cpu);
void kvm_arch_do_init_vcpu(X86CPU *cs);
+uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
+ uint32_t index, int reg);
+uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index);
void kvm_set_max_apic_id(uint32_t max_apic_id);
void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask);
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/13] sysemu/kvm: Restrict kvm_get_apic_state() to x86 targets
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 10/13] sysemu/kvm: Restrict kvm_arch_get_supported_cpuid/msr() to x86 targets Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 12/13] sysemu/kvm: Restrict kvm_has_pit_state2() " Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 13/13] sysemu/kvm: Restrict kvm_pc_setup_irq_routing() " Philippe Mathieu-Daudé
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé
kvm_get_apic_state() is only defined for x86 targets (in
hw/i386/kvm/apic.c). Its declaration is pointless on all
other targets.
Since we include "linux-headers/asm-x86/kvm.h", no need
to forward-declare 'struct kvm_lapic_state'.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/sysemu/kvm.h | 3 ---
target/i386/kvm/kvm_i386.h | 1 +
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index a578961a5e..4326b53f90 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -188,7 +188,6 @@ extern bool kvm_msi_use_devid;
#endif /* CONFIG_KVM_IS_POSSIBLE */
struct kvm_run;
-struct kvm_lapic_state;
struct kvm_irq_routing_entry;
typedef struct KVMCapabilityInfo {
@@ -407,8 +406,6 @@ void kvm_irqchip_add_change_notifier(Notifier *n);
void kvm_irqchip_remove_change_notifier(Notifier *n);
void kvm_irqchip_change_notify(void);
-void kvm_get_apic_state(DeviceState *d, struct kvm_lapic_state *kapic);
-
struct kvm_guest_debug;
struct kvm_debug_exit_arch;
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index b78e2feb49..d4a1239c68 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -54,6 +54,7 @@ bool kvm_has_adjust_clock_stable(void);
bool kvm_has_exception_payload(void);
void kvm_synchronize_all_tsc(void);
+void kvm_get_apic_state(DeviceState *d, struct kvm_lapic_state *kapic);
void kvm_put_apicbase(X86CPU *cpu, uint64_t value);
bool kvm_has_x2apic_api(void);
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/13] sysemu/kvm: Restrict kvm_has_pit_state2() to x86 targets
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 11/13] sysemu/kvm: Restrict kvm_get_apic_state() " Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
2023-09-04 12:43 ` [PATCH 13/13] sysemu/kvm: Restrict kvm_pc_setup_irq_routing() " Philippe Mathieu-Daudé
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Marcel Apfelbaum, Eduardo Habkost
kvm_has_pit_state2() is only defined for x86 targets (in
target/i386/kvm/kvm.c). Its declaration is pointless on
all other targets. Have it return a boolean.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/sysemu/kvm.h | 1 -
target/i386/kvm/kvm_i386.h | 1 +
hw/i386/kvm/i8254.c | 1 +
target/i386/kvm/kvm.c | 4 ++--
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 4326b53f90..147967422f 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -221,7 +221,6 @@ int kvm_has_vcpu_events(void);
int kvm_has_robust_singlestep(void);
int kvm_has_debugregs(void);
int kvm_max_nested_state_length(void);
-int kvm_has_pit_state2(void);
int kvm_has_many_ioeventfds(void);
int kvm_has_gsi_routing(void);
int kvm_has_intx_set_mask(void);
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index d4a1239c68..76e8f952e5 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -33,6 +33,7 @@
bool kvm_has_smm(void);
bool kvm_enable_x2apic(void);
bool kvm_hv_vpindex_settable(void);
+bool kvm_has_pit_state2(void);
bool kvm_enable_sgx_provisioning(KVMState *s);
bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp);
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/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 639a242ad8..e5cd7cc806 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -154,9 +154,9 @@ static KVMMSRHandlers msr_handlers[KVM_MSR_FILTER_MAX_RANGES];
static RateLimit bus_lock_ratelimit_ctrl;
static int kvm_get_one_msr(X86CPU *cpu, int index, uint64_t *value);
-int kvm_has_pit_state2(void)
+bool kvm_has_pit_state2(void)
{
- return has_pit_state2;
+ return !!has_pit_state2;
}
bool kvm_has_smm(void)
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 13/13] sysemu/kvm: Restrict kvm_pc_setup_irq_routing() to x86 targets
2023-09-04 12:43 [PATCH 00/13] target/i386: Cleanups around KVM declarations Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2023-09-04 12:43 ` [PATCH 12/13] sysemu/kvm: Restrict kvm_has_pit_state2() " Philippe Mathieu-Daudé
@ 2023-09-04 12:43 ` Philippe Mathieu-Daudé
12 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-04 12:43 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Marcelo Tosatti,
Michael S. Tsirkin, kvm, Philippe Mathieu-Daudé,
Marcel Apfelbaum, Eduardo Habkost
kvm_pc_setup_irq_routing() is only defined for x86 targets (in
hw/i386/kvm/apic.c). Its declaration is pointless on all
other targets.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/sysemu/kvm.h | 1 -
target/i386/kvm/kvm_i386.h | 2 ++
hw/i386/kvm/ioapic.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 147967422f..ee9025f8e9 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -514,7 +514,6 @@ int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n,
int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n,
qemu_irq irq);
void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi);
-void kvm_pc_setup_irq_routing(bool pci_enabled);
void kvm_init_irq_routing(KVMState *s);
bool kvm_kernel_irqchip_allowed(void);
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index 76e8f952e5..55d4e68c34 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -78,4 +78,6 @@ bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr,
#endif /* CONFIG_KVM */
+void kvm_pc_setup_irq_routing(bool pci_enabled);
+
#endif
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)
--
2.41.0
^ permalink raw reply related [flat|nested] 21+ messages in thread