diff mbox series

[08/14] system/kvm: Expose kvm_irqchip_[add, remove]_change_notifier()

Message ID 20250307180337.14811-9-philmd@linaro.org
State New
Headers show
Series hw/vfio: Build various objects once | expand

Commit Message

Philippe Mathieu-Daudé March 7, 2025, 6:03 p.m. UTC
Currently kvm_irqchip_add_irqfd_notifier() and
kvm_irqchip_remove_irqfd_notifier() are only declared on
target specific code. There is not particular reason to,
as their prototypes don't use anything target related.

Move their declaration with common prototypes, and
implement their stub.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/system/kvm.h   |  8 ++++----
 accel/stubs/kvm-stub.c | 12 ++++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

Comments

Pierrick Bouvier March 7, 2025, 7:17 p.m. UTC | #1
On 3/7/25 10:03, Philippe Mathieu-Daudé wrote:
> Currently kvm_irqchip_add_irqfd_notifier() and
> kvm_irqchip_remove_irqfd_notifier() are only declared on
> target specific code. There is not particular reason to,
> as their prototypes don't use anything target related.
> 
> Move their declaration with common prototypes, and
> implement their stub.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/system/kvm.h   |  8 ++++----
>   accel/stubs/kvm-stub.c | 12 ++++++++++++
>   2 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/include/system/kvm.h b/include/system/kvm.h
> index ab17c09a551..75673fb794e 100644
> --- a/include/system/kvm.h
> +++ b/include/system/kvm.h
> @@ -412,10 +412,6 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg);
>   
>   void kvm_irqchip_add_irq_route(KVMState *s, int gsi, int irqchip, int pin);
>   
> -void kvm_irqchip_add_change_notifier(Notifier *n);
> -void kvm_irqchip_remove_change_notifier(Notifier *n);
> -void kvm_irqchip_change_notify(void);
> -
>   struct kvm_guest_debug;
>   struct kvm_debug_exit_arch;
>   
> @@ -517,6 +513,10 @@ void kvm_irqchip_release_virq(KVMState *s, int virq);
>   void kvm_add_routing_entry(KVMState *s,
>                              struct kvm_irq_routing_entry *entry);
>   
> +void kvm_irqchip_add_change_notifier(Notifier *n);
> +void kvm_irqchip_remove_change_notifier(Notifier *n);
> +void kvm_irqchip_change_notify(void);
> +
>   int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
>                                          EventNotifier *rn, int virq);
>   int kvm_irqchip_remove_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
> diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
> index ecfd7636f5f..a305b33d84d 100644
> --- a/accel/stubs/kvm-stub.c
> +++ b/accel/stubs/kvm-stub.c
> @@ -83,6 +83,18 @@ void kvm_irqchip_change_notify(void)
>   {
>   }
>   
> +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n,
> +                                   EventNotifier *rn, qemu_irq irq)
> +{
> +    return -ENOSYS;
> +}
> +
> +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n,
> +                                      qemu_irq irq)
> +{
> +    return -ENOSYS;
> +}
> +
>   int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
>                                          EventNotifier *rn, int virq)
>   {

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Richard Henderson March 7, 2025, 8:09 p.m. UTC | #2
On 3/7/25 10:03, Philippe Mathieu-Daudé wrote:
> Currently kvm_irqchip_add_irqfd_notifier() and
> kvm_irqchip_remove_irqfd_notifier() are only declared on
> target specific code. There is not particular reason to,
> as their prototypes don't use anything target related.
> 
> Move their declaration with common prototypes, and
> implement their stub.

The description is not accurate, because the new stubs are
*not* for the functions whose declaration you move.

This feels like two different changes.


r~
Philippe Mathieu-Daudé March 8, 2025, 10:18 p.m. UTC | #3
On 7/3/25 21:09, Richard Henderson wrote:
> On 3/7/25 10:03, Philippe Mathieu-Daudé wrote:
>> Currently kvm_irqchip_add_irqfd_notifier() and
>> kvm_irqchip_remove_irqfd_notifier() are only declared on
>> target specific code. There is not particular reason to,
>> as their prototypes don't use anything target related.
>>
>> Move their declaration with common prototypes, and
>> implement their stub.
> 
> The description is not accurate, because the new stubs are
> *not* for the functions whose declaration you move.
> 
> This feels like two different changes.

Oops. I don't remember why I added the stubs, they are used
in vfio-ap but I can't reproduce a build failure. I'll just
remove them.
diff mbox series

Patch

diff --git a/include/system/kvm.h b/include/system/kvm.h
index ab17c09a551..75673fb794e 100644
--- a/include/system/kvm.h
+++ b/include/system/kvm.h
@@ -412,10 +412,6 @@  int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg);
 
 void kvm_irqchip_add_irq_route(KVMState *s, int gsi, int irqchip, int pin);
 
-void kvm_irqchip_add_change_notifier(Notifier *n);
-void kvm_irqchip_remove_change_notifier(Notifier *n);
-void kvm_irqchip_change_notify(void);
-
 struct kvm_guest_debug;
 struct kvm_debug_exit_arch;
 
@@ -517,6 +513,10 @@  void kvm_irqchip_release_virq(KVMState *s, int virq);
 void kvm_add_routing_entry(KVMState *s,
                            struct kvm_irq_routing_entry *entry);
 
+void kvm_irqchip_add_change_notifier(Notifier *n);
+void kvm_irqchip_remove_change_notifier(Notifier *n);
+void kvm_irqchip_change_notify(void);
+
 int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
                                        EventNotifier *rn, int virq);
 int kvm_irqchip_remove_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index ecfd7636f5f..a305b33d84d 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -83,6 +83,18 @@  void kvm_irqchip_change_notify(void)
 {
 }
 
+int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n,
+                                   EventNotifier *rn, qemu_irq irq)
+{
+    return -ENOSYS;
+}
+
+int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n,
+                                      qemu_irq irq)
+{
+    return -ENOSYS;
+}
+
 int kvm_irqchip_add_irqfd_notifier_gsi(KVMState *s, EventNotifier *n,
                                        EventNotifier *rn, int virq)
 {