* [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk
@ 2025-03-10 23:58 Vasilis Liaskovitis
2025-03-11 14:31 ` Alex Williamson
2025-03-11 15:45 ` Cédric Le Goater
0 siblings, 2 replies; 3+ messages in thread
From: Vasilis Liaskovitis @ 2025-03-10 23:58 UTC (permalink / raw)
To: qemu-devel; +Cc: alex.williamson, clg, Vasilis Liaskovitis
The ATI BAR4 quirk is targeting an ioport BAR. Older devices may
have a BAR4 which is not an ioport, causing a segfault here. Test
the BAR type to skip these devices.
Similar to
"8f419c5b: vfio/pci-quirks: Exclude non-ioport BAR from NVIDIA quirk"
Untested, as I don't have the card to test.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2856
Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
---
hw/vfio/pci-quirks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index c53591fe2b..15598bbaf4 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -403,7 +403,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr)
/* This windows doesn't seem to be used except by legacy VGA code */
if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||
- !vdev->vga || nr != 4) {
+ !vdev->vga || nr != 4 || !vdev->bars[4].ioport) {
return;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk
2025-03-10 23:58 [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk Vasilis Liaskovitis
@ 2025-03-11 14:31 ` Alex Williamson
2025-03-11 15:45 ` Cédric Le Goater
1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2025-03-11 14:31 UTC (permalink / raw)
To: Vasilis Liaskovitis; +Cc: qemu-devel, clg
On Tue, 11 Mar 2025 00:58:33 +0100
Vasilis Liaskovitis <vliaskovitis@suse.com> wrote:
> The ATI BAR4 quirk is targeting an ioport BAR. Older devices may
> have a BAR4 which is not an ioport, causing a segfault here. Test
> the BAR type to skip these devices.
>
> Similar to
> "8f419c5b: vfio/pci-quirks: Exclude non-ioport BAR from NVIDIA quirk"
>
> Untested, as I don't have the card to test.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2856
> Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
> ---
> hw/vfio/pci-quirks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
> index c53591fe2b..15598bbaf4 100644
> --- a/hw/vfio/pci-quirks.c
> +++ b/hw/vfio/pci-quirks.c
> @@ -403,7 +403,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr)
>
> /* This windows doesn't seem to be used except by legacy VGA code */
> if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||
> - !vdev->vga || nr != 4) {
> + !vdev->vga || nr != 4 || !vdev->bars[4].ioport) {
> return;
> }
>
We should probably predicate calls to vfio_bar_quirk_setup() on
VFIOBAR.size to avoid such segfaults, but agree this likely fixes the
reported issue as well.
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk
2025-03-10 23:58 [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk Vasilis Liaskovitis
2025-03-11 14:31 ` Alex Williamson
@ 2025-03-11 15:45 ` Cédric Le Goater
1 sibling, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2025-03-11 15:45 UTC (permalink / raw)
To: Vasilis Liaskovitis, qemu-devel; +Cc: alex.williamson
On 3/11/25 00:58, Vasilis Liaskovitis wrote:
> The ATI BAR4 quirk is targeting an ioport BAR. Older devices may
> have a BAR4 which is not an ioport, causing a segfault here. Test
> the BAR type to skip these devices.
>
> Similar to
> "8f419c5b: vfio/pci-quirks: Exclude non-ioport BAR from NVIDIA quirk"
>
> Untested, as I don't have the card to test.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2856
> Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
> ---
> hw/vfio/pci-quirks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
> index c53591fe2b..15598bbaf4 100644
> --- a/hw/vfio/pci-quirks.c
> +++ b/hw/vfio/pci-quirks.c
> @@ -403,7 +403,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr)
>
> /* This windows doesn't seem to be used except by legacy VGA code */
> if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||
> - !vdev->vga || nr != 4) {
> + !vdev->vga || nr != 4 || !vdev->bars[4].ioport) {
> return;
> }
>
Applied to vfio-next.
Thanks,
C.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-11 15:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 23:58 [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk Vasilis Liaskovitis
2025-03-11 14:31 ` Alex Williamson
2025-03-11 15:45 ` Cédric Le Goater
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).