diff mbox series

[08/13] target/i386: Allow elision of kvm_hv_vpindex_settable()

Message ID 20230904124325.79040-9-philmd@linaro.org
State New
Headers show
Series target/i386: Cleanups around KVM declarations | expand

Commit Message

Philippe Mathieu-Daudé Sept. 4, 2023, 12:43 p.m. UTC
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 mbox series

Patch

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(