qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] target/ppc: Prohibit target specific KVM prototypes on user emulation
@ 2023-09-12 11:30 Philippe Mathieu-Daudé
  2023-09-12 11:30 ` [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-12 11:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Michael Tokarev, Greg Kurz,
	Philippe Mathieu-Daudé

Implement Kevin's suggestion to remove KVM declarations
for user emulation builds, so if KVM prototype are used
we directly get a compile failure.

Philippe Mathieu-Daudé (4):
  sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets
  target/ppc: Restrict KVM objects to system emulation
  hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM
  target/ppc: Prohibit target specific KVM prototypes on user emulation

 include/sysemu/kvm.h   |  1 -
 target/ppc/kvm_ppc.h   |  6 ++++++
 hw/ppc/e500.c          |  4 ++++
 target/ppc/kvm-stub.c  | 19 -------------------
 target/ppc/kvm.c       |  4 ++--
 target/ppc/meson.build |  2 +-
 6 files changed, 13 insertions(+), 23 deletions(-)
 delete mode 100644 target/ppc/kvm-stub.c

-- 
2.41.0



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets
  2023-09-12 11:30 [PATCH 0/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
@ 2023-09-12 11:30 ` Philippe Mathieu-Daudé
  2023-09-12 12:32   ` Michael Tokarev
  2023-09-12 11:30 ` [PATCH 2/4] target/ppc: Restrict KVM objects to system emulation Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-12 11:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Michael Tokarev, Greg Kurz,
	Philippe Mathieu-Daudé

kvm_get_radix_page_info() is only defined for ppc targets (in
target/ppc/kvm.c). The declaration is not useful in other targets.
Rename using the 'kvmppc_' prefix following other declarations
from target/ppc/kvm_ppc.h.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/sysemu/kvm.h | 1 -
 target/ppc/kvm_ppc.h | 2 ++
 target/ppc/kvm.c     | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index ee9025f8e9..3bcd8f45be 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -551,7 +551,6 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source);
  * Returns: 0 on success, or a negative errno on failure.
  */
 int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target);
-struct ppc_radix_page_info *kvm_get_radix_page_info(void);
 int kvm_get_max_memslots(void);
 
 /* Notify resamplefd for EOI of specific interrupts. */
diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index 6a4dd9c560..440e93f923 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -89,6 +89,8 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);
 
 int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);
 
+struct ppc_radix_page_info *kvmppc_get_radix_page_info(void);
+
 #define kvmppc_eieio() \
     do {                                          \
         if (kvm_enabled()) {                          \
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 51112bd367..a58708cdfc 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -268,7 +268,7 @@ static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp)
                      "KVM failed to provide the MMU features it supports");
 }
 
-struct ppc_radix_page_info *kvm_get_radix_page_info(void)
+struct ppc_radix_page_info *kvmppc_get_radix_page_info(void)
 {
     KVMState *s = KVM_STATE(current_accel());
     struct ppc_radix_page_info *radix_page_info;
@@ -2372,7 +2372,7 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
     }
 
 #if defined(TARGET_PPC64)
-    pcc->radix_page_info = kvm_get_radix_page_info();
+    pcc->radix_page_info = kvmppc_get_radix_page_info();
 
     if ((pcc->pvr & 0xffffff00) == CPU_POWERPC_POWER9_DD1) {
         /*
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] target/ppc: Restrict KVM objects to system emulation
  2023-09-12 11:30 [PATCH 0/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
  2023-09-12 11:30 ` [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets Philippe Mathieu-Daudé
@ 2023-09-12 11:30 ` Philippe Mathieu-Daudé
  2023-09-12 13:03   ` Michael Tokarev
  2023-09-12 11:30 ` [PATCH 3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM Philippe Mathieu-Daudé
  2023-09-12 11:30 ` [PATCH 4/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-12 11:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Michael Tokarev, Greg Kurz,
	Philippe Mathieu-Daudé

kvm-stub.c only defines kvm_openpic_connect_vcpu(),
which is clearly not used by user emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/meson.build b/target/ppc/meson.build
index 4c2635039e..bf1c9319fa 100644
--- a/target/ppc/meson.build
+++ b/target/ppc/meson.build
@@ -30,7 +30,6 @@ gen = [
 ]
 ppc_ss.add(when: 'CONFIG_TCG', if_true: gen)
 
-ppc_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
 ppc_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user_only_helper.c'))
 
 ppc_system_ss = ss.source_set()
@@ -46,6 +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: 'TARGET_PPC64', if_true: files(
   'compat.c',
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM
  2023-09-12 11:30 [PATCH 0/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
  2023-09-12 11:30 ` [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets Philippe Mathieu-Daudé
  2023-09-12 11:30 ` [PATCH 2/4] target/ppc: Restrict KVM objects to system emulation Philippe Mathieu-Daudé
@ 2023-09-12 11:30 ` Philippe Mathieu-Daudé
  2023-09-12 12:43   ` Michael Tokarev
  2023-09-12 11:30 ` [PATCH 4/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-12 11:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Michael Tokarev, Greg Kurz,
	Philippe Mathieu-Daudé

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

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',
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] target/ppc: Prohibit target specific KVM prototypes on user emulation
  2023-09-12 11:30 [PATCH 0/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2023-09-12 11:30 ` [PATCH 3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM Philippe Mathieu-Daudé
@ 2023-09-12 11:30 ` Philippe Mathieu-Daudé
  2023-09-13  9:14   ` Daniel Henrique Barboza
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-12 11:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Michael Tokarev, Greg Kurz,
	Philippe Mathieu-Daudé

None of these target-specific prototypes should be used
by user emulation. Remove their declaration there, so we
get a compile failure if ever used (instead of having to
deal with linker and its possible optimizations, such
dead code removal).

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/ppc/kvm_ppc.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index 440e93f923..ffda8054b2 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -13,6 +13,10 @@
 #include "exec/hwaddr.h"
 #include "cpu.h"
 
+#ifdef CONFIG_USER_ONLY
+#error Cannot include kvm_ppc.h from user emulation
+#endif
+
 #ifdef CONFIG_KVM
 
 uint32_t kvmppc_get_tbfreq(void);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets
  2023-09-12 11:30 ` [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets Philippe Mathieu-Daudé
@ 2023-09-12 12:32   ` Michael Tokarev
  2023-09-12 12:44     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Tokarev @ 2023-09-12 12:32 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Greg Kurz

12.09.2023 14:30, Philippe Mathieu-Daudé:
> kvm_get_radix_page_info() is only defined for ppc targets (in
> target/ppc/kvm.c). The declaration is not useful in other targets.
> Rename using the 'kvmppc_' prefix following other declarations
> from target/ppc/kvm_ppc.h.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/sysemu/kvm.h | 1 -
>   target/ppc/kvm_ppc.h | 2 ++
>   target/ppc/kvm.c     | 4 ++--
>   3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index ee9025f8e9..3bcd8f45be 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -551,7 +551,6 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source);
>    * Returns: 0 on success, or a negative errno on failure.
>    */
>   int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target);
> -struct ppc_radix_page_info *kvm_get_radix_page_info(void);
>   int kvm_get_max_memslots(void);
>   
>   /* Notify resamplefd for EOI of specific interrupts. */
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index 6a4dd9c560..440e93f923 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -89,6 +89,8 @@ void kvmppc_set_reg_tb_offset(PowerPCCPU *cpu, int64_t tb_offset);
>   
>   int kvm_handle_nmi(PowerPCCPU *cpu, struct kvm_run *run);
>   
> +struct ppc_radix_page_info *kvmppc_get_radix_page_info(void);
> +
>   #define kvmppc_eieio() \
>       do {                                          \
>           if (kvm_enabled()) {                          \
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 51112bd367..a58708cdfc 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -268,7 +268,7 @@ static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp)
>                        "KVM failed to provide the MMU features it supports");
>   }
>   
> -struct ppc_radix_page_info *kvm_get_radix_page_info(void)
> +struct ppc_radix_page_info *kvmppc_get_radix_page_info(void)
>   {
>       KVMState *s = KVM_STATE(current_accel());
>       struct ppc_radix_page_info *radix_page_info;
> @@ -2372,7 +2372,7 @@ static void kvmppc_host_cpu_class_init(ObjectClass *oc, void *data)
>       }
>   
>   #if defined(TARGET_PPC64)
> -    pcc->radix_page_info = kvm_get_radix_page_info();
> +    pcc->radix_page_info = kvmppc_get_radix_page_info();
>   
>       if ((pcc->pvr & 0xffffff00) == CPU_POWERPC_POWER9_DD1) {
>           /*

I wonder, if it's defined and used in target/ppc/kvm.c only,
why it needs to be in an .h file to begin with, instead of being static?

/mjt


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM
  2023-09-12 11:30 ` [PATCH 3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM Philippe Mathieu-Daudé
@ 2023-09-12 12:43   ` Michael Tokarev
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Tokarev @ 2023-09-12 12:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Greg Kurz

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets
  2023-09-12 12:32   ` Michael Tokarev
@ 2023-09-12 12:44     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-12 12:44 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Greg Kurz

On 12/9/23 14:32, Michael Tokarev wrote:
> 12.09.2023 14:30, Philippe Mathieu-Daudé:
>> kvm_get_radix_page_info() is only defined for ppc targets (in
>> target/ppc/kvm.c). The declaration is not useful in other targets.
>> Rename using the 'kvmppc_' prefix following other declarations
>> from target/ppc/kvm_ppc.h.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/sysemu/kvm.h | 1 -
>>   target/ppc/kvm_ppc.h | 2 ++
>>   target/ppc/kvm.c     | 4 ++--
>>   3 files changed, 4 insertions(+), 3 deletions(-)


> I wonder, if it's defined and used in target/ppc/kvm.c only,
> why it needs to be in an .h file to begin with, instead of being static?

Good point, I didn't noticed.
It is this way since it's introduction in commit c64abd1f9c
("spapr: Add ibm,processor-radix-AP-encodings to the device tree").

I'll respin after waiting for more review, thanks!

Phil.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] target/ppc: Restrict KVM objects to system emulation
  2023-09-12 11:30 ` [PATCH 2/4] target/ppc: Restrict KVM objects to system emulation Philippe Mathieu-Daudé
@ 2023-09-12 13:03   ` Michael Tokarev
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Tokarev @ 2023-09-12 13:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, Daniel Henrique Barboza,
	qemu-ppc, Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf,
	David Gibson, Cédric Le Goater, Greg Kurz

12.09.2023 14:30, Philippe Mathieu-Daudé:
> kvm-stub.c only defines kvm_openpic_connect_vcpu(),
> which is clearly not used by user emulation.

Yes, kvm-stub only defines this function.  But you also move kvm.c
from ppc_ss to ppc_system_ss, and the commit message does not say
a word about this.  Hopefully there's no usage of symbols in kvm.c
in other configurations (or else it wont link).

I think commit message might be just a bit more verbose.  Right now
it is misleading/confusing, which is worse than no commit message
at all :)

For the changes,

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

I even tried to build some targets (ppc user and system on x86)
with this change, but I can't say I verified every configuration.

/mjt

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>


> ---
>   target/ppc/meson.build | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/ppc/meson.build b/target/ppc/meson.build
> index 4c2635039e..bf1c9319fa 100644
> --- a/target/ppc/meson.build
> +++ b/target/ppc/meson.build
> @@ -30,7 +30,6 @@ gen = [
>   ]
>   ppc_ss.add(when: 'CONFIG_TCG', if_true: gen)
>   
> -ppc_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
>   ppc_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user_only_helper.c'))
>   
>   ppc_system_ss = ss.source_set()
> @@ -46,6 +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: 'TARGET_PPC64', if_true: files(
>     'compat.c',



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] target/ppc: Prohibit target specific KVM prototypes on user emulation
  2023-09-12 11:30 ` [PATCH 4/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
@ 2023-09-13  9:14   ` Daniel Henrique Barboza
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Henrique Barboza @ 2023-09-13  9:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Nicholas Piggin, Daniel Henrique Barboza, qemu-ppc,
	Richard Henderson, kvm, Paolo Bonzini, Kevin Wolf, David Gibson,
	Cédric Le Goater, Michael Tokarev, Greg Kurz



On 9/12/23 08:30, Philippe Mathieu-Daudé wrote:
> None of these target-specific prototypes should be used
> by user emulation. Remove their declaration there, so we
> get a compile failure if ever used (instead of having to
> deal with linker and its possible optimizations, such
> dead code removal).
> 
> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   target/ppc/kvm_ppc.h | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
> index 440e93f923..ffda8054b2 100644
> --- a/target/ppc/kvm_ppc.h
> +++ b/target/ppc/kvm_ppc.h
> @@ -13,6 +13,10 @@
>   #include "exec/hwaddr.h"
>   #include "cpu.h"
>   
> +#ifdef CONFIG_USER_ONLY
> +#error Cannot include kvm_ppc.h from user emulation
> +#endif
> +
>   #ifdef CONFIG_KVM
>   
>   uint32_t kvmppc_get_tbfreq(void);


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-13  9:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12 11:30 [PATCH 0/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
2023-09-12 11:30 ` [PATCH 1/4] sysemu/kvm: Restrict kvmppc_get_radix_page_info() to ppc targets Philippe Mathieu-Daudé
2023-09-12 12:32   ` Michael Tokarev
2023-09-12 12:44     ` Philippe Mathieu-Daudé
2023-09-12 11:30 ` [PATCH 2/4] target/ppc: Restrict KVM objects to system emulation Philippe Mathieu-Daudé
2023-09-12 13:03   ` Michael Tokarev
2023-09-12 11:30 ` [PATCH 3/4] hw/ppc/e500: Restrict ppce500_init_mpic_kvm() to KVM Philippe Mathieu-Daudé
2023-09-12 12:43   ` Michael Tokarev
2023-09-12 11:30 ` [PATCH 4/4] target/ppc: Prohibit target specific KVM prototypes on user emulation Philippe Mathieu-Daudé
2023-09-13  9:14   ` Daniel Henrique Barboza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).