All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci/msix: Fix msix pba read vector poll end calculation
@ 2024-12-12 12:04 Nicholas Piggin
  2024-12-12 12:08 ` Philippe Mathieu-Daudé
  2025-01-17  6:26 ` Michael Tokarev
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2024-12-12 12:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Nicholas Piggin, Michael S. Tsirkin, Marcel Apfelbaum

The end vector calculation has a bug that results in polling fewer
than required vectors when reading at a non-zero offset in PBA memory.

Fixes: bbef882cc193 ("msi: add API to get notified about pending bit poll")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
Taking closer look at my msix pba mmio write patch, it looks like there
might be a bug in the calculation from the code I copied? I haven't
looked into how to test these poll notifiers though.

Thanks,
Nick

 hw/pci/msix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 487e49834ee..cc6e79ec678 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -250,7 +250,7 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
     PCIDevice *dev = opaque;
     if (dev->msix_vector_poll_notifier) {
         unsigned vector_start = addr * 8;
-        unsigned vector_end = MIN(addr + size * 8, dev->msix_entries_nr);
+        unsigned vector_end = MIN((addr + size) * 8, dev->msix_entries_nr);
         dev->msix_vector_poll_notifier(dev, vector_start, vector_end);
     }
 
-- 
2.45.2



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

* Re: [PATCH] pci/msix: Fix msix pba read vector poll end calculation
  2024-12-12 12:04 [PATCH] pci/msix: Fix msix pba read vector poll end calculation Nicholas Piggin
@ 2024-12-12 12:08 ` Philippe Mathieu-Daudé
  2025-01-17  6:26 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-12-12 12:08 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel; +Cc: Michael S. Tsirkin, Marcel Apfelbaum

On 12/12/24 13:04, Nicholas Piggin wrote:
> The end vector calculation has a bug that results in polling fewer
> than required vectors when reading at a non-zero offset in PBA memory.
> 
> Fixes: bbef882cc193 ("msi: add API to get notified about pending bit poll")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> Taking closer look at my msix pba mmio write patch, it looks like there
> might be a bug in the calculation from the code I copied? I haven't
> looked into how to test these poll notifiers though.
> 
> Thanks,
> Nick
> 
>   hw/pci/msix.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH] pci/msix: Fix msix pba read vector poll end calculation
  2024-12-12 12:04 [PATCH] pci/msix: Fix msix pba read vector poll end calculation Nicholas Piggin
  2024-12-12 12:08 ` Philippe Mathieu-Daudé
@ 2025-01-17  6:26 ` Michael Tokarev
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2025-01-17  6:26 UTC (permalink / raw)
  To: Nicholas Piggin, qemu-devel
  Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-stable

12.12.2024 15:04, Nicholas Piggin wrote:
> The end vector calculation has a bug that results in polling fewer
> than required vectors when reading at a non-zero offset in PBA memory.
> 
> Fixes: bbef882cc193 ("msi: add API to get notified about pending bit poll")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

This smells like a qemu-stable material?
Though given the bug age, maybe not?

Thanks,

/mjt

> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> index 487e49834ee..cc6e79ec678 100644
> --- a/hw/pci/msix.c
> +++ b/hw/pci/msix.c
> @@ -250,7 +250,7 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
>       PCIDevice *dev = opaque;
>       if (dev->msix_vector_poll_notifier) {
>           unsigned vector_start = addr * 8;
> -        unsigned vector_end = MIN(addr + size * 8, dev->msix_entries_nr);
> +        unsigned vector_end = MIN((addr + size) * 8, dev->msix_entries_nr);
>           dev->msix_vector_poll_notifier(dev, vector_start, vector_end);
>       }
>   



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

end of thread, other threads:[~2025-01-17  6:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 12:04 [PATCH] pci/msix: Fix msix pba read vector poll end calculation Nicholas Piggin
2024-12-12 12:08 ` Philippe Mathieu-Daudé
2025-01-17  6:26 ` Michael Tokarev

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.