linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge
@ 2022-01-31 16:02 Marc Zyngier
  2022-01-31 16:04 ` Ard Biesheuvel
  2022-02-16 16:11 ` Will Deacon
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Zyngier @ 2022-01-31 16:02 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel
  Cc: Andre Przywara, Alexandru Elisei, kernel-team, Pierre Gondois,
	Ard Biesheuvel, Sami Mujawar, Will Deacon

It appears that the way INTx is emulated is "slightly" out of spec
in kvmtool. We happily inject an edge interrupt, even if the spec
mandates a level.

This doesn't change much for either the guest or userspace (only
KVM will have a bit more work tracking the EOI), but at least
this is correct.

Reported-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 pci.c        | 2 +-
 virtio/pci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pci.c b/pci.c
index e5930331..a769ae27 100644
--- a/pci.c
+++ b/pci.c
@@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
 	pci_hdr->irq_line	= irq__alloc_line();
 
 	if (!pci_hdr->irq_type)
-		pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
+		pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
 
 	return pci_hdr->irq_line;
 }
diff --git a/virtio/pci.c b/virtio/pci.c
index 41085291..2777d1c8 100644
--- a/virtio/pci.c
+++ b/virtio/pci.c
@@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
 			kvm__irq_trigger(kvm, vpci->gsis[vq]);
 	} else {
 		vpci->isr = VIRTIO_IRQ_HIGH;
-		kvm__irq_trigger(kvm, vpci->legacy_irq_line);
+		kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
 	}
 	return 0;
 }
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge
  2022-01-31 16:02 [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge Marc Zyngier
@ 2022-01-31 16:04 ` Ard Biesheuvel
  2022-02-01  8:21   ` Pierre Gondois
  2022-02-01  8:41   ` Pierre Gondois
  2022-02-16 16:11 ` Will Deacon
  1 sibling, 2 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2022-01-31 16:04 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: kvmarm, Linux ARM, Andre Przywara, Alexandru Elisei,
	Android Kernel Team, Pierre Gondois, Sami Mujawar, Will Deacon

On Mon, 31 Jan 2022 at 17:03, Marc Zyngier <maz@kernel.org> wrote:
>
> It appears that the way INTx is emulated is "slightly" out of spec
> in kvmtool. We happily inject an edge interrupt, even if the spec
> mandates a level.
>
> This doesn't change much for either the guest or userspace (only
> KVM will have a bit more work tracking the EOI), but at least
> this is correct.
>
> Reported-by: Pierre Gondois <pierre.gondois@arm.com>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Will Deacon <will@kernel.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  pci.c        | 2 +-
>  virtio/pci.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pci.c b/pci.c
> index e5930331..a769ae27 100644
> --- a/pci.c
> +++ b/pci.c
> @@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
>         pci_hdr->irq_line       = irq__alloc_line();
>
>         if (!pci_hdr->irq_type)
> -               pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
> +               pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
>
>         return pci_hdr->irq_line;
>  }
> diff --git a/virtio/pci.c b/virtio/pci.c
> index 41085291..2777d1c8 100644
> --- a/virtio/pci.c
> +++ b/virtio/pci.c
> @@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
>                         kvm__irq_trigger(kvm, vpci->gsis[vq]);
>         } else {
>                 vpci->isr = VIRTIO_IRQ_HIGH;
> -               kvm__irq_trigger(kvm, vpci->legacy_irq_line);
> +               kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
>         }
>         return 0;
>  }
> --
> 2.34.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge
  2022-01-31 16:04 ` Ard Biesheuvel
@ 2022-02-01  8:21   ` Pierre Gondois
  2022-02-01  8:41   ` Pierre Gondois
  1 sibling, 0 replies; 5+ messages in thread
From: Pierre Gondois @ 2022-02-01  8:21 UTC (permalink / raw)
  To: Ard Biesheuvel, Marc Zyngier
  Cc: kvmarm, Linux ARM, Andre Przywara, Alexandru Elisei,
	Android Kernel Team, Sami Mujawar, Will Deacon



On 1/31/22 5:04 PM, Ard Biesheuvel wrote:
> On Mon, 31 Jan 2022 at 17:03, Marc Zyngier <maz@kernel.org> wrote:
>>
>> It appears that the way INTx is emulated is "slightly" out of spec
>> in kvmtool. We happily inject an edge interrupt, even if the spec
>> mandates a level.
>>
>> This doesn't change much for either the guest or userspace (only
>> KVM will have a bit more work tracking the EOI), but at least
>> this is correct.
>>
>> Reported-by: Pierre Gondois <pierre.gondois@arm.com>
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> Cc: Ard Biesheuvel <ardb@kernel.org>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Will Deacon <will@kernel.org>
> 
> Acked-by: Ard Biesheuvel <ardb@kernel.org>

Hi,
Just to confirm, I tried it and it was working well,
Regards,
Pierre

> 
>> ---
>>   pci.c        | 2 +-
>>   virtio/pci.c | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/pci.c b/pci.c
>> index e5930331..a769ae27 100644
>> --- a/pci.c
>> +++ b/pci.c
>> @@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
>>          pci_hdr->irq_line       = irq__alloc_line();
>>
>>          if (!pci_hdr->irq_type)
>> -               pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
>> +               pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
>>
>>          return pci_hdr->irq_line;
>>   }
>> diff --git a/virtio/pci.c b/virtio/pci.c
>> index 41085291..2777d1c8 100644
>> --- a/virtio/pci.c
>> +++ b/virtio/pci.c
>> @@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
>>                          kvm__irq_trigger(kvm, vpci->gsis[vq]);
>>          } else {
>>                  vpci->isr = VIRTIO_IRQ_HIGH;
>> -               kvm__irq_trigger(kvm, vpci->legacy_irq_line);
>> +               kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
>>          }
>>          return 0;
>>   }
>> --
>> 2.34.1
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge
  2022-01-31 16:04 ` Ard Biesheuvel
  2022-02-01  8:21   ` Pierre Gondois
@ 2022-02-01  8:41   ` Pierre Gondois
  1 sibling, 0 replies; 5+ messages in thread
From: Pierre Gondois @ 2022-02-01  8:41 UTC (permalink / raw)
  To: Ard Biesheuvel, Marc Zyngier
  Cc: kvmarm, Linux ARM, Andre Przywara, Alexandru Elisei,
	Android Kernel Team, Sami Mujawar, Will Deacon



On 1/31/22 5:04 PM, Ard Biesheuvel wrote:
> On Mon, 31 Jan 2022 at 17:03, Marc Zyngier <maz@kernel.org> wrote:
>>
>> It appears that the way INTx is emulated is "slightly" out of spec
>> in kvmtool. We happily inject an edge interrupt, even if the spec
>> mandates a level.
>>
>> This doesn't change much for either the guest or userspace (only
>> KVM will have a bit more work tracking the EOI), but at least
>> this is correct.
>>
>> Reported-by: Pierre Gondois <pierre.gondois@arm.com>
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> Cc: Ard Biesheuvel <ardb@kernel.org>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Cc: Will Deacon <will@kernel.org>
> 
> Acked-by: Ard Biesheuvel <ardb@kernel.org>

Hi,
Just to confirm, I tried the patch and everything is working for me,
Regards,
Pierre

> 
>> ---
>>   pci.c        | 2 +-
>>   virtio/pci.c | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/pci.c b/pci.c
>> index e5930331..a769ae27 100644
>> --- a/pci.c
>> +++ b/pci.c
>> @@ -61,7 +61,7 @@ int pci__assign_irq(struct pci_device_header *pci_hdr)
>>          pci_hdr->irq_line       = irq__alloc_line();
>>
>>          if (!pci_hdr->irq_type)
>> -               pci_hdr->irq_type = IRQ_TYPE_EDGE_RISING;
>> +               pci_hdr->irq_type = IRQ_TYPE_LEVEL_HIGH;
>>
>>          return pci_hdr->irq_line;
>>   }
>> diff --git a/virtio/pci.c b/virtio/pci.c
>> index 41085291..2777d1c8 100644
>> --- a/virtio/pci.c
>> +++ b/virtio/pci.c
>> @@ -413,7 +413,7 @@ int virtio_pci__signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq)
>>                          kvm__irq_trigger(kvm, vpci->gsis[vq]);
>>          } else {
>>                  vpci->isr = VIRTIO_IRQ_HIGH;
>> -               kvm__irq_trigger(kvm, vpci->legacy_irq_line);
>> +               kvm__irq_line(kvm, vpci->legacy_irq_line, VIRTIO_IRQ_HIGH);
>>          }
>>          return 0;
>>   }
>> --
>> 2.34.1
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge
  2022-01-31 16:02 [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge Marc Zyngier
  2022-01-31 16:04 ` Ard Biesheuvel
@ 2022-02-16 16:11 ` Will Deacon
  1 sibling, 0 replies; 5+ messages in thread
From: Will Deacon @ 2022-02-16 16:11 UTC (permalink / raw)
  To: Marc Zyngier, linux-arm-kernel, kvmarm
  Cc: catalin.marinas, kernel-team, Will Deacon, Andre Przywara,
	Sami Mujawar, Pierre Gondois

On Mon, 31 Jan 2022 16:02:42 +0000, Marc Zyngier wrote:
> It appears that the way INTx is emulated is "slightly" out of spec
> in kvmtool. We happily inject an edge interrupt, even if the spec
> mandates a level.
> 
> This doesn't change much for either the guest or userspace (only
> KVM will have a bit more work tracking the EOI), but at least
> this is correct.
> 
> [...]

Applied to kvmtool (master), thanks!

[1/1] virtio/pci: Signal INTx interrupts as level instead of edge
      https://git.kernel.org/will/kvmtool/c/2108c86d0623

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-02-16 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-31 16:02 [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge Marc Zyngier
2022-01-31 16:04 ` Ard Biesheuvel
2022-02-01  8:21   ` Pierre Gondois
2022-02-01  8:41   ` Pierre Gondois
2022-02-16 16:11 ` Will Deacon

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