* [PATCH] KVM: Split up MSI-X assigned device IRQ handler
@ 2011-09-12 16:57 Jan Kiszka
2011-09-13 6:40 ` Tian, Kevin
2011-09-14 10:59 ` Marcelo Tosatti
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2011-09-12 16:57 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm
The threaded IRQ handler for MSI-X has almost nothing in common with the
INTx/MSI handler. Move its code into a dedicated handler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
virt/kvm/assigned-dev.c | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 84ead54..7debe8c 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -58,8 +58,6 @@ static int find_index_from_host_irq(struct kvm_assigned_dev_kernel
static irqreturn_t kvm_assigned_dev_thread(int irq, void *dev_id)
{
struct kvm_assigned_dev_kernel *assigned_dev = dev_id;
- u32 vector;
- int index;
if (assigned_dev->irq_requested_type & KVM_DEV_IRQ_HOST_INTX) {
spin_lock(&assigned_dev->intx_lock);
@@ -68,20 +66,28 @@ static irqreturn_t kvm_assigned_dev_thread(int irq, void *dev_id)
spin_unlock(&assigned_dev->intx_lock);
}
- if (assigned_dev->irq_requested_type & KVM_DEV_IRQ_HOST_MSIX) {
- index = find_index_from_host_irq(assigned_dev, irq);
- if (index >= 0) {
- vector = assigned_dev->
- guest_msix_entries[index].vector;
- kvm_set_irq(assigned_dev->kvm,
- assigned_dev->irq_source_id, vector, 1);
- }
- } else
+ kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id,
+ assigned_dev->guest_irq, 1);
+
+ return IRQ_HANDLED;
+}
+
+#ifdef __KVM_HAVE_MSIX
+static irqreturn_t kvm_assigned_dev_thread_msix(int irq, void *dev_id)
+{
+ struct kvm_assigned_dev_kernel *assigned_dev = dev_id;
+ int index = find_index_from_host_irq(assigned_dev, irq);
+ u32 vector;
+
+ if (index >= 0) {
+ vector = assigned_dev->guest_msix_entries[index].vector;
kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id,
- assigned_dev->guest_irq, 1);
+ vector, 1);
+ }
return IRQ_HANDLED;
}
+#endif
/* Ack the irq line for an assigned device */
static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian)
@@ -279,7 +285,7 @@ static int assigned_device_enable_host_msix(struct kvm *kvm,
for (i = 0; i < dev->entries_nr; i++) {
r = request_threaded_irq(dev->host_msix_entries[i].vector,
- NULL, kvm_assigned_dev_thread,
+ NULL, kvm_assigned_dev_thread_msix,
0, dev->irq_name, dev);
if (r)
goto err;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] KVM: Split up MSI-X assigned device IRQ handler
2011-09-12 16:57 [PATCH] KVM: Split up MSI-X assigned device IRQ handler Jan Kiszka
@ 2011-09-13 6:40 ` Tian, Kevin
2011-09-13 7:29 ` Jan Kiszka
2011-09-14 10:59 ` Marcelo Tosatti
1 sibling, 1 reply; 5+ messages in thread
From: Tian, Kevin @ 2011-09-13 6:40 UTC (permalink / raw)
To: Jan Kiszka, Avi Kivity, Marcelo Tosatti; +Cc: kvm
> From: Jan Kiszka
> Sent: Tuesday, September 13, 2011 12:58 AM
>
> The threaded IRQ handler for MSI-X has almost nothing in common with the
> INTx/MSI handler. Move its code into a dedicated handler.
if it's desired to further go down this cleanup path, there's also no need to
register ack notifier for MSI-X type device since all the logic there is simply
a nop:
static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian)
{
struct kvm_assigned_dev_kernel *dev;
if (kian->gsi == -1)
return;
dev = container_of(kian, struct kvm_assigned_dev_kernel,
ack_notifier);
kvm_set_irq(dev->kvm, dev->irq_source_id, dev->guest_irq, 0);
/* The guest irq may be shared so this ack may be
* from another device.
*/
spin_lock(&dev->intx_lock);
if (dev->host_irq_disabled) {
enable_irq(dev->host_irq);
dev->host_irq_disabled = false;
}
spin_unlock(&dev->intx_lock);
}
Thanks
Kevin
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> virt/kvm/assigned-dev.c | 32 +++++++++++++++++++-------------
> 1 files changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
> index 84ead54..7debe8c 100644
> --- a/virt/kvm/assigned-dev.c
> +++ b/virt/kvm/assigned-dev.c
> @@ -58,8 +58,6 @@ static int find_index_from_host_irq(struct
> kvm_assigned_dev_kernel
> static irqreturn_t kvm_assigned_dev_thread(int irq, void *dev_id)
> {
> struct kvm_assigned_dev_kernel *assigned_dev = dev_id;
> - u32 vector;
> - int index;
>
> if (assigned_dev->irq_requested_type & KVM_DEV_IRQ_HOST_INTX) {
> spin_lock(&assigned_dev->intx_lock);
> @@ -68,20 +66,28 @@ static irqreturn_t kvm_assigned_dev_thread(int irq,
> void *dev_id)
> spin_unlock(&assigned_dev->intx_lock);
> }
>
> - if (assigned_dev->irq_requested_type & KVM_DEV_IRQ_HOST_MSIX) {
> - index = find_index_from_host_irq(assigned_dev, irq);
> - if (index >= 0) {
> - vector = assigned_dev->
> - guest_msix_entries[index].vector;
> - kvm_set_irq(assigned_dev->kvm,
> - assigned_dev->irq_source_id, vector, 1);
> - }
> - } else
> + kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id,
> + assigned_dev->guest_irq, 1);
> +
> + return IRQ_HANDLED;
> +}
> +
> +#ifdef __KVM_HAVE_MSIX
> +static irqreturn_t kvm_assigned_dev_thread_msix(int irq, void *dev_id)
> +{
> + struct kvm_assigned_dev_kernel *assigned_dev = dev_id;
> + int index = find_index_from_host_irq(assigned_dev, irq);
> + u32 vector;
> +
> + if (index >= 0) {
> + vector = assigned_dev->guest_msix_entries[index].vector;
> kvm_set_irq(assigned_dev->kvm, assigned_dev->irq_source_id,
> - assigned_dev->guest_irq, 1);
> + vector, 1);
> + }
>
> return IRQ_HANDLED;
> }
> +#endif
>
> /* Ack the irq line for an assigned device */
> static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian)
> @@ -279,7 +285,7 @@ static int assigned_device_enable_host_msix(struct
> kvm *kvm,
>
> for (i = 0; i < dev->entries_nr; i++) {
> r = request_threaded_irq(dev->host_msix_entries[i].vector,
> - NULL, kvm_assigned_dev_thread,
> + NULL, kvm_assigned_dev_thread_msix,
> 0, dev->irq_name, dev);
> if (r)
> goto err;
> --
> 1.7.3.4
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: Split up MSI-X assigned device IRQ handler
2011-09-13 6:40 ` Tian, Kevin
@ 2011-09-13 7:29 ` Jan Kiszka
2011-09-13 7:39 ` Tian, Kevin
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2011-09-13 7:29 UTC (permalink / raw)
To: Tian, Kevin; +Cc: Avi Kivity, Marcelo Tosatti, kvm
On 2011-09-13 08:40, Tian, Kevin wrote:
>> From: Jan Kiszka
>> Sent: Tuesday, September 13, 2011 12:58 AM
>>
>> The threaded IRQ handler for MSI-X has almost nothing in common with the
>> INTx/MSI handler. Move its code into a dedicated handler.
>
> if it's desired to further go down this cleanup path, there's also no need to
> register ack notifier for MSI-X type device since all the logic there is simply
> a nop:
You mean http://thread.gmane.org/gmane.comp.emulators.kvm.devel/79075? :)
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] KVM: Split up MSI-X assigned device IRQ handler
2011-09-13 7:29 ` Jan Kiszka
@ 2011-09-13 7:39 ` Tian, Kevin
0 siblings, 0 replies; 5+ messages in thread
From: Tian, Kevin @ 2011-09-13 7:39 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm
> From: Jan Kiszka [mailto:jan.kiszka@siemens.com]
> Sent: Tuesday, September 13, 2011 3:30 PM
>
> On 2011-09-13 08:40, Tian, Kevin wrote:
> >> From: Jan Kiszka
> >> Sent: Tuesday, September 13, 2011 12:58 AM
> >>
> >> The threaded IRQ handler for MSI-X has almost nothing in common with the
> >> INTx/MSI handler. Move its code into a dedicated handler.
> >
> > if it's desired to further go down this cleanup path, there's also no need to
> > register ack notifier for MSI-X type device since all the logic there is simply
> > a nop:
>
> You mean
> http://thread.gmane.org/gmane.comp.emulators.kvm.devel/79075? :)
>
yes, and sorry that I didn't catch that thread. :-)
Thanks
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: Split up MSI-X assigned device IRQ handler
2011-09-12 16:57 [PATCH] KVM: Split up MSI-X assigned device IRQ handler Jan Kiszka
2011-09-13 6:40 ` Tian, Kevin
@ 2011-09-14 10:59 ` Marcelo Tosatti
1 sibling, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2011-09-14 10:59 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm
On Mon, Sep 12, 2011 at 06:57:56PM +0200, Jan Kiszka wrote:
> The threaded IRQ handler for MSI-X has almost nothing in common with the
> INTx/MSI handler. Move its code into a dedicated handler.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> virt/kvm/assigned-dev.c | 32 +++++++++++++++++++-------------
> 1 files changed, 19 insertions(+), 13 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-09-14 11:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-12 16:57 [PATCH] KVM: Split up MSI-X assigned device IRQ handler Jan Kiszka
2011-09-13 6:40 ` Tian, Kevin
2011-09-13 7:29 ` Jan Kiszka
2011-09-13 7:39 ` Tian, Kevin
2011-09-14 10:59 ` Marcelo Tosatti
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.