target/i386: Cleanups around KVM declarations
Subsystems (2)
cover target/i386: Cleanups around KVM declarations
Hi,
Mostly trivial cleanups.
We want to have QEMU core code accel-agnostic. (In particular, removing the KVM specific fields from CPUState).
This serie contains the x86 specific patches before starting with the generic KVM code.
FWIW, I couldn't test the 'HVF only' configuration since I don't have access to such host.
Regards,
Phil.
Philippe Mathieu-Daudé (13):
hw/i386/pc: Include missing 'sysemu/tcg.h' header hw/i386/pc: Include missing 'cpu.h' header
hw/i386/fw_cfg: Include missing 'cpu.h' header target/i386/helper: Restrict KVM declarations to system emulation target/i386/cpu-sysemu: Inline kvm_apic_in_kernel() target/i386: Remove unused KVM stubs
target/i386: Allow elision of kvm_enable_x2apic() target/i386: Allow elision of kvm_hv_vpindex_settable() target/i386: Restrict declarations specific to CONFIG_KVM sysemu/kvm: Restrict kvm_arch_get_supported_cpuid/msr() to x86 targets sysemu/kvm: Restrict kvm_get_apic_state() to x86 targets sysemu/kvm: Restrict kvm_has_pit_state2() to x86 targets sysemu/kvm: Restrict kvm_pc_setup_irq_routing() to x86 targets
include/sysemu/kvm.h | 10 -------- target/i386/kvm/kvm_i386.h | 36 ++++++++++++++++---------- hw/i386/fw_cfg.c | 1 + hw/i386/intel_iommu.c | 2 +- hw/i386/kvm/i8254.c | 1 + hw/i386/kvm/ioapic.c | 1 + hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 2 ++ hw/i386/x86.c | 4 +-- target/i386/cpu-sysemu.c | 4 +-- target/i386/helper.c | 2 +- target/i386/kvm/kvm-stub.c | 51 ------------------------------------- target/i386/kvm/kvm.c | 4 +-- target/i386/kvm/meson.build | 2 -- 14 files changed, 37 insertions(+), 84 deletions(-) delete mode 100644 target/i386/kvm/kvm-stub.c
Signature · 1 line
2.41.0
PATCH 1/13 hw/i386/pc: Include missing 'sysemu/tcg.h' header
Since commit 6f529b7534 ("target/i386: move FERR handling to target/i386") pc_q35_init() calls tcg_enabled() which is declared in "sysemu/tcg.h".
--- hw/i386/pc_q35.c | 1 + 1 file changed, 1 insertion(+)
hw/i386/pc_q35.c +1 -0
@@ -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"
Signature · 1 line
2.41.0
Re: [PATCH 01/13] hw/i386/pc: Include missing 'sysemu/tcg.h' header
Quoted 8 lines · Philippe Mathieu-Daudé
Since commit
6f529b7534("target/i386: move FERR handling to target/i386")pc_q35_init()callstcg_enabled()which is declared in "sysemu/tcg.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/i386/pc_q35.c | 1 + 1 file changed, 1 insertion(+)
r~
PATCH 2/13 hw/i386/pc: Include missing 'cpu.h' header
In reply to Philippe Mathieu-DaudéBoth pc_piix.c and pc_q35.c files use CPU_VERSION_LEGACY which is defined in "target/i386/cpu.h".
--- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + 2 files changed, 2 insertions(+)
hw/i386/pc_piix.c +1 -0
@@ -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
hw/i386/pc_q35.c +1 -0
@@ -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
Signature · 1 line
2.41.0
Re: [PATCH 02/13] hw/i386/pc: Include missing 'cpu.h' header
Quoted 8 lines · Philippe Mathieu-Daudé
Both
pc_piix.candpc_q35.cfiles useCPU_VERSION_LEGACYwhich is defined in "target/i386/cpu.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + 2 files changed, 2 insertions(+)
r~
PATCH 3/13 hw/i386/fw_cfg: Include missing 'cpu.h' header
In reply to Philippe Mathieu-Daudéfw_cfg_build_feature_control() uses CPUID_EXT_VMX which is defined in "target/i386/cpu.h".
--- hw/i386/fw_cfg.c | 1 + 1 file changed, 1 insertion(+)
hw/i386/fw_cfg.c +1 -0
@@ -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 };
Signature · 1 line
2.41.0
Re: [PATCH 03/13] hw/i386/fw_cfg: Include missing 'cpu.h' header
Quoted 7 lines · Philippe Mathieu-Daudé
fw_cfg_build_feature_control()usesCPUID_EXT_VMXwhich is defined in "target/i386/cpu.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/i386/fw_cfg.c | 1 + 1 file changed, 1 insertion(+)
r~
PATCH 4/13 target/i386/helper: Restrict KVM declarations to system emulation
In reply to Philippe Mathieu-DaudéUser emulation doesn't need any KVM declarations.
--- target/i386/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/helper.c +1 -1
@@ -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
Signature · 1 line
2.41.0
Re: [PATCH 04/13] target/i386/helper: Restrict KVM declarations to system emulation
Quoted 6 lines · Philippe Mathieu-Daudé
User emulation doesn't need any KVM declarations.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/i386/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 5/13 target/i386/cpu-sysemu: Inline kvm_apic_in_kernel()
In reply to 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.
--- target/i386/kvm/kvm_i386.h | 2 -- target/i386/cpu-sysemu.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
target/i386/kvm/kvm_i386.h +0 -2
@@ -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 () \
target/i386/cpu-sysemu.c +2 -2
@@ -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 ; }
Signature · 1 line
2.41.0
Re: [PATCH 05/13] target/i386/cpu-sysemu: Inline kvm_apic_in_kernel()
Quoted 10 lines · Philippe Mathieu-Daudé
In order to have
cpu-sysemu.cbecome accelerator-agnostic, inlinekvm_apic_in_kernel()-- which is a simple wrapper tokvm_irqchip_in_kernel()-- and use the generic "sysemu/kvm.h" header.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/i386/kvm/kvm_i386.h | 2 -- target/i386/cpu-sysemu.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
r~
PATCH 6/13 target/i386: Remove unused KVM stubs
In reply to Philippe Mathieu-Daudé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.
--- target/i386/kvm/kvm-stub.c | 26 -------------------------- 1 file changed, 26 deletions(-)
target/i386/kvm/kvm-stub.c +0 -26
@@ -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 ; -}
Signature · 1 line
2.41.0
PATCH 7/13 target/i386: Allow elision of kvm_enable_x2apic()
In reply to Philippe Mathieu-DaudéCall kvm_enabled() before kvm_enable_x2apic() to
let the compiler elide its call.
--- 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(-)
hw/i386/intel_iommu.c +1 -1
@@ -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;
hw/i386/x86.c +1 -1
@@ -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 );
target/i386/kvm/kvm-stub.c +0 -7
@@ -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;
Signature · 1 line
2.41.0
Paolo Bonzini
maintainerRe: [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic()
Quoted 29 lines · Philippe Mathieu-Daudé
Call
kvm_enabled()beforekvm_enable_x2apic()to
let the compiler elide its call.Suggested-by Daniel Henrique Barboza <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- 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(-)hw/i386/intel_iommu.c +1
-1@@ -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;hw/i386/x86.c +0
-0
hw/i386/x86.c void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version) · line 139
Quoted 5 lines
hw/i386/x86.c +1
-1@@ -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:
hw/i386/x86.c +4 -7
@@ -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
Quoted 21 lines
hw/i386/x86.c +0
-0error_report ("current -smp configuration requires kernel " "irqchip and X2APIC API support." );exit (EXIT_FAILURE );target/i386/kvm/kvm-stub.c +0
-7@@ -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;
Re: [PATCH 07/13] target/i386: Allow elision of kvm_enable_x2apic()
Quoted 57 lines · Paolo Bonzini
Quoted 20 lines · Philippe Mathieu-Daudé
Call
kvm_enabled()beforekvm_enable_x2apic()to
let the compiler elide its call.Suggested-by Daniel Henrique Barboza <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
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(-)hw/i386/x86.c +0
-0@@ -136,7 +136,7 @@ void x86_cpus_init(X86MachineState *x86ms, intdefault_cpu_version) * With KVM's in-kernel lapic: only if X2APIC API is enabled. */ Quoted 4 lines
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:
hw/i386/x86.c +4
-8@@ -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);
Quoted 1 line
Paolo
Thank you!
PATCH 8/13 target/i386: Allow elision of kvm_hv_vpindex_settable()
In reply to Philippe Mathieu-DaudéCall kvm_enabled() before kvm_hv_vpindex_settable() to let the compiler elide its call.
kvm-stub.c is now empty, remove it.
--- 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
hw/i386/x86.c +1 -1
@@ -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 ; }
target/i386/kvm/kvm-stub.c deleted +0 -18
@@ -1,18 +0,0 @@ -/* -* QEMU KVM x86 specific function stubs -* -* Copyright Linaro Limited 2012 -* -* Author: Peter Maydell <[email protected]> -* -* 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; -}
target/i386/kvm/meson.build +0 -2
@@ -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(
Signature · 1 line
2.41.0
PATCH 9/13 target/i386: Restrict declarations specific to CONFIG_KVM
In reply to Philippe Mathieu-DaudéKeep the function accessed by target/i386/ and hw/i386/ exposed, restrict the ones accessed by target/i386/kvm/.
--- target/i386/kvm/kvm_i386.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
target/i386/kvm/kvm_i386.h +17 -12
@@ -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
Signature · 1 line
2.41.0
PATCH 10/13 sysemu/kvm: Restrict kvm_arch_get_supported_cpuid/msr() to x86 targets
In reply to 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.
--- include/sysemu/kvm.h | 5 ----- target/i386/kvm/kvm_i386.h | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-)
include/sysemu/kvm.h +0 -5
@@ -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,
target/i386/kvm/kvm_i386.h +3 -0
@@ -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);
Signature · 1 line
2.41.0
PATCH 11/13 sysemu/kvm: Restrict kvm_get_apic_state() to x86 targets
In reply to 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'.
--- include/sysemu/kvm.h | 3 --- target/i386/kvm/kvm_i386.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-)
include/sysemu/kvm.h +0 -3
@@ -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 ;
target/i386/kvm/kvm_i386.h +1 -0
@@ -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 );
Signature · 1 line
2.41.0
PATCH 12/13 sysemu/kvm: Restrict kvm_has_pit_state2() to x86 targets
In reply to Philippe Mathieu-Daudé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.
--- 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(-)
include/sysemu/kvm.h +0 -1
@@ -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 );
target/i386/kvm/kvm_i386.h +1 -0
@@ -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);
hw/i386/kvm/i8254.c +1 -0
@@ -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
target/i386/kvm/kvm.c +2 -2
@@ -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 )
Signature · 1 line
2.41.0
PATCH 13/13 sysemu/kvm: Restrict kvm_pc_setup_irq_routing() to x86 targets
In reply to Philippe Mathieu-Daudé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.
--- 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(-)
include/sysemu/kvm.h +0 -1
@@ -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 );
target/i386/kvm/kvm_i386.h +2 -0
@@ -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
hw/i386/kvm/ioapic.c +1 -0
@@ -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)
Signature · 1 line
2.41.0