diff mbox series

[3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM

Message ID 20230912113027.63941-4-philmd@linaro.org
State Superseded
Headers show
Series target/ppc: Prohibit target specific KVM prototypes on user emulation | expand

Commit Message

Philippe Mathieu-Daudé Sept. 12, 2023, 11:30 a.m. UTC
Inline and guard the single call to kvm_openpic_connect_vcpu()
allows to remove kvm-stub.c. While it seems some code churn,
it allows forbidding user emulation to include "kvm_ppc.h" in
the next commit.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/e500.c          |  4 ++++
 target/ppc/kvm-stub.c  | 19 -------------------
 target/ppc/meson.build |  2 +-
 3 files changed, 5 insertions(+), 20 deletions(-)
 delete mode 100644 target/ppc/kvm-stub.c

Comments

Michael Tokarev Sept. 12, 2023, 12:43 p.m. UTC | #1
12.09.2023 14:30, Philippe Mathieu-Daudé wrote:
> Inline and guard the single call to kvm_openpic_connect_vcpu()
> allows to remove kvm-stub.c. While it seems some code churn,
> it allows forbidding user emulation to include "kvm_ppc.h" in
> the next commit.

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

FWIW, if you reorder this and previous patches, you'll have one
less file to move in target/ppc/meson.build. Not that it matters though.

/mjt
diff mbox series

Patch

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index d5b6820d1d..d0e199fb2c 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -834,6 +834,7 @@  static DeviceState *ppce500_init_mpic_qemu(PPCE500MachineState *pms,
 static DeviceState *ppce500_init_mpic_kvm(const PPCE500MachineClass *pmc,
                                           IrqLines *irqs, Error **errp)
 {
+#ifdef CONFIG_KVM
     DeviceState *dev;
     CPUState *cs;
 
@@ -854,6 +855,9 @@  static DeviceState *ppce500_init_mpic_kvm(const PPCE500MachineClass *pmc,
     }
 
     return dev;
+#else
+    g_assert_not_reached();
+#endif
 }
 
 static DeviceState *ppce500_init_mpic(PPCE500MachineState *pms,
diff --git a/target/ppc/kvm-stub.c b/target/ppc/kvm-stub.c
deleted file mode 100644
index b98e1d404f..0000000000
--- a/target/ppc/kvm-stub.c
+++ /dev/null
@@ -1,19 +0,0 @@ 
-/*
- * QEMU KVM PPC specific function stubs
- *
- * Copyright Freescale Inc. 2013
- *
- * Author: Alexander Graf <agraf@suse.de>
- *
- * 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 "cpu.h"
-#include "hw/ppc/openpic_kvm.h"
-
-int kvm_openpic_connect_vcpu(DeviceState *d, CPUState *cs)
-{
-    return -EINVAL;
-}
diff --git a/target/ppc/meson.build b/target/ppc/meson.build
index bf1c9319fa..44462f95cd 100644
--- a/target/ppc/meson.build
+++ b/target/ppc/meson.build
@@ -45,7 +45,7 @@  ppc_system_ss.add(when: 'CONFIG_TCG', if_true: files(
 ), if_false: files(
   'tcg-stub.c',
 ))
-ppc_system_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
+ppc_system_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
 
 ppc_system_ss.add(when: 'TARGET_PPC64', if_true: files(
   'compat.c',