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

Philippe Mathieu-Daudé posted 14 patches 8 months, 1 week ago
There is a newer version of this series
[PATCH 08/14] system/kvm: Expose kvm_irqchip_[add, remove]_change_notifier()
Posted by Philippe Mathieu-Daudé 8 months, 1 week ago
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)
 {
-- 
2.47.1


Re: [PATCH 08/14] system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier()
Posted by Richard Henderson 8 months, 1 week ago
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~

Re: [PATCH 08/14] system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier()
Posted by Philippe Mathieu-Daudé 8 months, 1 week ago
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.


Re: [PATCH 08/14] system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier()
Posted by Pierrick Bouvier 8 months, 1 week ago
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>