diff mbox series

[RFC,01/15] accel/kvm: Add more stubs

Message ID 20210517115525.1088693-2-f4bug@amsat.org
State New
Headers show
Series softmmu: Make various objects target agnostic | expand

Commit Message

Philippe Mathieu-Daudé May 17, 2021, 11:55 a.m. UTC
To be able to make softmmu/cpus.c not target-specific, we need to
add two more KVM stubs, to avoid:

  /usr/bin/ld: libcommon.fa.p/softmmu_cpus.c.o: in function `cpu_thread_is_idle':
  softmmu/cpus.c:85: undefined reference to `kvm_halt_in_kernel_allowed'
  /usr/bin/ld: libcommon.fa.p/softmmu_cpus.c.o: in function `cpu_check_are_resettable':
  include/sysemu/hw_accel.h:28: undefined reference to `kvm_cpu_check_are_resettable'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 accel/stubs/kvm-stub.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Richard Henderson May 26, 2021, 6:35 p.m. UTC | #1
On 5/17/21 4:55 AM, Philippe Mathieu-Daudé wrote:
> To be able to make softmmu/cpus.c not target-specific, we need to
> add two more KVM stubs, to avoid:
> 
>    /usr/bin/ld: libcommon.fa.p/softmmu_cpus.c.o: in function `cpu_thread_is_idle':
>    softmmu/cpus.c:85: undefined reference to `kvm_halt_in_kernel_allowed'
>    /usr/bin/ld: libcommon.fa.p/softmmu_cpus.c.o: in function `cpu_check_are_resettable':
>    include/sysemu/hw_accel.h:28: undefined reference to `kvm_cpu_check_are_resettable'
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   accel/stubs/kvm-stub.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
> index 5b1d00a2224..6bda6c8c925 100644
> --- a/accel/stubs/kvm-stub.c
> +++ b/accel/stubs/kvm-stub.c
> @@ -20,6 +20,7 @@
>   KVMState *kvm_state;
>   bool kvm_kernel_irqchip;
>   bool kvm_async_interrupts_allowed;
> +bool kvm_halt_in_kernel_allowed;
>   bool kvm_eventfds_allowed;
>   bool kvm_irqfds_allowed;
>   bool kvm_resamplefds_allowed;
> @@ -147,4 +148,10 @@ bool kvm_arm_supports_user_irq(void)
>   {
>       return false;
>   }
> +
> +bool kvm_cpu_check_are_resettable(void)
> +{
> +    g_assert_not_reached();
> +}
> +

It should be easy to turn cpus_are_resettable into an AccelOpsClass hook.

It's less obvious how to do that for cpu_thread_is_idle, but it's clear with 
the kvm and whpx checks that something is required.


r~
diff mbox series

Patch

diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 5b1d00a2224..6bda6c8c925 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -20,6 +20,7 @@ 
 KVMState *kvm_state;
 bool kvm_kernel_irqchip;
 bool kvm_async_interrupts_allowed;
+bool kvm_halt_in_kernel_allowed;
 bool kvm_eventfds_allowed;
 bool kvm_irqfds_allowed;
 bool kvm_resamplefds_allowed;
@@ -147,4 +148,10 @@  bool kvm_arm_supports_user_irq(void)
 {
     return false;
 }
+
+bool kvm_cpu_check_are_resettable(void)
+{
+    g_assert_not_reached();
+}
+
 #endif