qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API
@ 2012-08-20  8:55 Jan Kiszka
  2012-08-21  2:40 ` Alex Williamson
  2012-09-09 14:01 ` Avi Kivity
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Kiszka @ 2012-08-20  8:55 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti
  Cc: Paolo Bonzini, Alex Williamson, qemu-devel, kvm

No need to expose the fd-based interface, everyone will already be fine
with the more handy EventNotifier variant. Rename the latter to clarify
that we are still talking about irqfds here.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Alex, please update your vfio patch accordingly.

 hw/virtio-pci.c |    4 ++--
 kvm-all.c       |   18 ++++--------------
 kvm-stub.c      |   14 ++------------
 kvm.h           |    6 ++----
 4 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 5e6e09e..40ea7df 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -515,7 +515,7 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
     }
     irqfd->users++;
 
-    ret = kvm_irqchip_add_irq_notifier(kvm_state, n, irqfd->virq);
+    ret = kvm_irqchip_add_irqfd_notifier(kvm_state, n, irqfd->virq);
     if (ret < 0) {
         if (--irqfd->users == 0) {
             kvm_irqchip_release_virq(kvm_state, irqfd->virq);
@@ -536,7 +536,7 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy,
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
     int ret;
 
-    ret = kvm_irqchip_remove_irq_notifier(kvm_state, n, irqfd->virq);
+    ret = kvm_irqchip_remove_irqfd_notifier(kvm_state, n, irqfd->virq);
     assert(ret == 0);
 
     if (--irqfd->users == 0) {
diff --git a/kvm-all.c b/kvm-all.c
index 34b02c1..fb02354 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1162,24 +1162,14 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int virq, bool assign)
 }
 #endif /* !KVM_CAP_IRQ_ROUTING */
 
-int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq)
+int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
 {
-    return kvm_irqchip_assign_irqfd(s, fd, virq, true);
+    return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, true);
 }
 
-int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq)
+int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
 {
-    return kvm_irqchip_add_irqfd(s, event_notifier_get_fd(n), virq);
-}
-
-int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq)
-{
-    return kvm_irqchip_assign_irqfd(s, fd, virq, false);
-}
-
-int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq)
-{
-    return kvm_irqchip_remove_irqfd(s, event_notifier_get_fd(n), virq);
+    return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, false);
 }
 
 static int kvm_irqchip_create(KVMState *s)
diff --git a/kvm-stub.c b/kvm-stub.c
index 94c9ea1..3c52eb5 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -141,22 +141,12 @@ void kvm_irqchip_release_virq(KVMState *s, int virq)
 {
 }
 
-int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq)
+int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
 {
     return -ENOSYS;
 }
 
-int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq)
-{
-    return -ENOSYS;
-}
-
-int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq)
-{
-    return -ENOSYS;
-}
-
-int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq)
+int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
 {
     return -ENOSYS;
 }
diff --git a/kvm.h b/kvm.h
index 5b8f588..37d1f81 100644
--- a/kvm.h
+++ b/kvm.h
@@ -272,8 +272,6 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
 int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg);
 void kvm_irqchip_release_virq(KVMState *s, int virq);
 
-int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq);
-int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq);
-int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq);
-int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq);
+int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
+int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
 #endif
-- 
1.7.3.4

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

* Re: [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API
  2012-08-20  8:55 [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API Jan Kiszka
@ 2012-08-21  2:40 ` Alex Williamson
  2012-09-09 14:01 ` Avi Kivity
  1 sibling, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2012-08-21  2:40 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Paolo Bonzini, Marcelo Tosatti, Avi Kivity, kvm, qemu-devel

On Mon, 2012-08-20 at 10:55 +0200, Jan Kiszka wrote:
> No need to expose the fd-based interface, everyone will already be fine
> with the more handy EventNotifier variant. Rename the latter to clarify
> that we are still talking about irqfds here.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Alex, please update your vfio patch accordingly.

Sure, thanks for the heads up.

Acked-by: Alex Williamson <alex.williamson@redhat.com>

> 
>  hw/virtio-pci.c |    4 ++--
>  kvm-all.c       |   18 ++++--------------
>  kvm-stub.c      |   14 ++------------
>  kvm.h           |    6 ++----
>  4 files changed, 10 insertions(+), 32 deletions(-)
> 
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 5e6e09e..40ea7df 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -515,7 +515,7 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
>      }
>      irqfd->users++;
>  
> -    ret = kvm_irqchip_add_irq_notifier(kvm_state, n, irqfd->virq);
> +    ret = kvm_irqchip_add_irqfd_notifier(kvm_state, n, irqfd->virq);
>      if (ret < 0) {
>          if (--irqfd->users == 0) {
>              kvm_irqchip_release_virq(kvm_state, irqfd->virq);
> @@ -536,7 +536,7 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy,
>      VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
>      int ret;
>  
> -    ret = kvm_irqchip_remove_irq_notifier(kvm_state, n, irqfd->virq);
> +    ret = kvm_irqchip_remove_irqfd_notifier(kvm_state, n, irqfd->virq);
>      assert(ret == 0);
>  
>      if (--irqfd->users == 0) {
> diff --git a/kvm-all.c b/kvm-all.c
> index 34b02c1..fb02354 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1162,24 +1162,14 @@ static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int virq, bool assign)
>  }
>  #endif /* !KVM_CAP_IRQ_ROUTING */
>  
> -int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq)
> +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
>  {
> -    return kvm_irqchip_assign_irqfd(s, fd, virq, true);
> +    return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, true);
>  }
>  
> -int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq)
> +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
>  {
> -    return kvm_irqchip_add_irqfd(s, event_notifier_get_fd(n), virq);
> -}
> -
> -int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq)
> -{
> -    return kvm_irqchip_assign_irqfd(s, fd, virq, false);
> -}
> -
> -int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq)
> -{
> -    return kvm_irqchip_remove_irqfd(s, event_notifier_get_fd(n), virq);
> +    return kvm_irqchip_assign_irqfd(s, event_notifier_get_fd(n), virq, false);
>  }
>  
>  static int kvm_irqchip_create(KVMState *s)
> diff --git a/kvm-stub.c b/kvm-stub.c
> index 94c9ea1..3c52eb5 100644
> --- a/kvm-stub.c
> +++ b/kvm-stub.c
> @@ -141,22 +141,12 @@ void kvm_irqchip_release_virq(KVMState *s, int virq)
>  {
>  }
>  
> -int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq)
> +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
>  {
>      return -ENOSYS;
>  }
>  
> -int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq)
> -{
> -    return -ENOSYS;
> -}
> -
> -int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq)
> -{
> -    return -ENOSYS;
> -}
> -
> -int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq)
> +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq)
>  {
>      return -ENOSYS;
>  }
> diff --git a/kvm.h b/kvm.h
> index 5b8f588..37d1f81 100644
> --- a/kvm.h
> +++ b/kvm.h
> @@ -272,8 +272,6 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
>  int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg);
>  void kvm_irqchip_release_virq(KVMState *s, int virq);
>  
> -int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq);
> -int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq);
> -int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq);
> -int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq);
> +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
> +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
>  #endif

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

* Re: [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API
  2012-08-20  8:55 [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API Jan Kiszka
  2012-08-21  2:40 ` Alex Williamson
@ 2012-09-09 14:01 ` Avi Kivity
  2012-09-10  9:27   ` Jan Kiszka
  1 sibling, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2012-09-09 14:01 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: Paolo Bonzini, Alex Williamson, Marcelo Tosatti, qemu-devel, kvm

On 08/20/2012 11:55 AM, Jan Kiszka wrote:
> No need to expose the fd-based interface, everyone will already be fine
> with the more handy EventNotifier variant. Rename the latter to clarify
> that we are still talking about irqfds here.

Thanks, applied.

>  
> -int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq);
> -int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq);
> -int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq);
> -int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq);
> +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
> +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
>  #endif

Those names aren't particularly satisfying.  add_irqfd_notifier implies
you want to be notified about irqfd events, but that's not what the
function does.  Not sure what a good name would be.


-- 
error compiling committee.c: too many arguments to function

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

* Re: [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API
  2012-09-09 14:01 ` Avi Kivity
@ 2012-09-10  9:27   ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2012-09-10  9:27 UTC (permalink / raw)
  To: Avi Kivity
  Cc: Paolo Bonzini, Alex Williamson, Marcelo Tosatti, qemu-devel, kvm

On 2012-09-09 16:01, Avi Kivity wrote:
> On 08/20/2012 11:55 AM, Jan Kiszka wrote:
>> No need to expose the fd-based interface, everyone will already be fine
>> with the more handy EventNotifier variant. Rename the latter to clarify
>> that we are still talking about irqfds here.
> 
> Thanks, applied.
> 
>>  
>> -int kvm_irqchip_add_irqfd(KVMState *s, int fd, int virq);
>> -int kvm_irqchip_remove_irqfd(KVMState *s, int fd, int virq);
>> -int kvm_irqchip_add_irq_notifier(KVMState *s, EventNotifier *n, int virq);
>> -int kvm_irqchip_remove_irq_notifier(KVMState *s, EventNotifier *n, int virq);
>> +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
>> +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
>>  #endif
> 
> Those names aren't particularly satisfying.  add_irqfd_notifier implies
> you want to be notified about irqfd events, but that's not what the
> function does.  Not sure what a good name would be.

Now that there are no more variants, we could also drop the "notifier"
from the name again. Better?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2012-09-10  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20  8:55 [Qemu-devel] [PATCH uq/master] kvm: Clean up irqfd API Jan Kiszka
2012-08-21  2:40 ` Alex Williamson
2012-09-09 14:01 ` Avi Kivity
2012-09-10  9:27   ` Jan Kiszka

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).