mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-26 03:21:50 -06:00
hw/i386: Remove unuseful kvmclock_create() stub
We shouldn't call kvmclock_create() when KVM is not available or disabled: - check for kvm_enabled() before calling it - assert KVM is enabled once called Since the call is elided when KVM is not available, we can remove the stub (it is never compiled). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230620083228.88796-2-philmd@linaro.org>
This commit is contained in:
parent
f8324611c1
commit
b797c98de4
5 changed files with 10 additions and 14 deletions
|
@ -332,8 +332,10 @@ void kvmclock_create(bool create_always)
|
||||||
{
|
{
|
||||||
X86CPU *cpu = X86_CPU(first_cpu);
|
X86CPU *cpu = X86_CPU(first_cpu);
|
||||||
|
|
||||||
if (!kvm_enabled() || !kvm_has_adjust_clock())
|
assert(kvm_enabled());
|
||||||
|
if (!kvm_has_adjust_clock()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (create_always ||
|
if (create_always ||
|
||||||
cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
|
cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
|
||||||
|
|
|
@ -180,7 +180,9 @@ static void microvm_devices_init(MicrovmMachineState *mms)
|
||||||
x86ms->ioapic2 = ioapic_init_secondary(gsi_state);
|
x86ms->ioapic2 = ioapic_init_secondary(gsi_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kvm_enabled()) {
|
||||||
kvmclock_create(true);
|
kvmclock_create(true);
|
||||||
|
}
|
||||||
|
|
||||||
mms->virtio_irq_base = 5;
|
mms->virtio_irq_base = 5;
|
||||||
mms->virtio_num_transports = 8;
|
mms->virtio_num_transports = 8;
|
||||||
|
|
|
@ -192,7 +192,7 @@ static void pc_init1(MachineState *machine,
|
||||||
pc_machine_init_sgx_epc(pcms);
|
pc_machine_init_sgx_epc(pcms);
|
||||||
x86_cpus_init(x86ms, pcmc->default_cpu_version);
|
x86_cpus_init(x86ms, pcmc->default_cpu_version);
|
||||||
|
|
||||||
if (pcmc->kvmclock_enabled) {
|
if (kvm_enabled() && pcmc->kvmclock_enabled) {
|
||||||
kvmclock_create(pcmc->kvmclock_create_always);
|
kvmclock_create(pcmc->kvmclock_create_always);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,9 @@ static void pc_q35_init(MachineState *machine)
|
||||||
pc_machine_init_sgx_epc(pcms);
|
pc_machine_init_sgx_epc(pcms);
|
||||||
x86_cpus_init(x86ms, pcmc->default_cpu_version);
|
x86_cpus_init(x86ms, pcmc->default_cpu_version);
|
||||||
|
|
||||||
|
if (kvm_enabled()) {
|
||||||
kvmclock_create(pcmc->kvmclock_create_always);
|
kvmclock_create(pcmc->kvmclock_create_always);
|
||||||
|
}
|
||||||
|
|
||||||
/* pci enabled */
|
/* pci enabled */
|
||||||
if (pcmc->pci_enabled) {
|
if (pcmc->pci_enabled) {
|
||||||
|
|
|
@ -13,16 +13,6 @@
|
||||||
#ifndef HW_KVM_CLOCK_H
|
#ifndef HW_KVM_CLOCK_H
|
||||||
#define HW_KVM_CLOCK_H
|
#define HW_KVM_CLOCK_H
|
||||||
|
|
||||||
#ifdef CONFIG_KVM
|
|
||||||
|
|
||||||
void kvmclock_create(bool create_always);
|
void kvmclock_create(bool create_always);
|
||||||
|
|
||||||
#else /* CONFIG_KVM */
|
|
||||||
|
|
||||||
static inline void kvmclock_create(bool create_always)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !CONFIG_KVM */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue