Skip to contentSkip to conversation

virtio-vga: fix virtio-vga bar ordering

PATCH In review Anthoine Bourgeois 3 participants 6 messages Apr 22, 2020 – Apr 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 virtio-vga: fix virtio-vga bar ordering

With virtio-vga, pci bar are reordered. Bar #2 is used for compatibility with stdvga. By default, bar #2 is used by virtio modern io bar. This bar is the last one introduce in the virtio pci bar layout and it's crushed by the virtio-vga reordering. So virtio-vga and modern-pio-notify are incompatible because virtio-vga failed to initialize with this option.

This fix sets the modern io bar to the bar #5 to avoid conflict.

---
 hw/display/virtio-vga.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-vga.c +1 -0
index 2b4c2aa126..95757a6619 100644
@@ -114,6 +114,7 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
      */
     vpci_dev->modern_mem_bar_idx = 2;
     vpci_dev->msix_bar_idx = 4;
+    vpci_dev->modern_io_bar_idx = 5;
 
     if (!(vpci_dev->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)) {
         /*
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/2 virtio-pci: update virtio pci bar layout documentation

The modern io bar was never documented.

---
 hw/virtio/virtio-pci.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio-pci.c +1 -0
index 4cb784389c..d028c17c24 100644
@@ -1705,6 +1705,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
      *
      *   region 0   --  virtio legacy io bar
      *   region 1   --  msi-x bar
+     *   region 2   --  virtio modern io bar (off by default)
      *   region 4+5 --  virtio modern memory (64bit) bar
      *
      */
Signature · 1 line
2.20.1
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] virtio-pci: update virtio pci bar layout documentation

Quoted 12 lines · Anthoine Bourgeois

The modern io bar was never documented.

---
 hw/virtio/virtio-pci.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/virtio-pci.c +0 -0
index 4cb784389c..d028c17c24 100644

hw/virtio/virtio-pci.c static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) · line 1709

Quoted 5 lines
hw/virtio/virtio-pci.c +1 -0
@@ -1705,6 +1705,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
      *
      *   region 0   --  virtio legacy io bar
      *   region 1   --  msi-x bar
+     *   region 2   --  virtio modern io bar (off by default)
      *   region 4+5 --  virtio modern memory (64bit) bar
Quoted 5 lines
hw/virtio/virtio-pci.c +0 -0
      *
      */
Signature · 1 line
2.20.1
Reviewed-by on v2 1/2
#3 lore raw
In reply to Anthoine Bourgeois
Quoted 10 lines · Anthoine Bourgeois

With virtio-vga, pci bar are reordered. Bar #2 is used for compatibility with stdvga. By default, bar #2 is used by virtio modern io bar. This bar is the last one introduce in the virtio pci bar layout and it's crushed by the virtio-vga reordering. So virtio-vga and modern-pio-notify are incompatible because virtio-vga failed to initialize with this option.

This fix sets the modern io bar to the bar #5 to avoid conflict.

Quoted 19 lines
---
 hw/display/virtio-vga.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-vga.c +1 -0
index 2b4c2aa126..95757a6619 100644
@@ -114,6 +114,7 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
      */
     vpci_dev->modern_mem_bar_idx = 2;
     vpci_dev->msix_bar_idx = 4;
+    vpci_dev->modern_io_bar_idx = 5;
 
     if (!(vpci_dev->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)) {
         /*
Signature · 1 line
2.20.1
#4 lore raw
In reply to Anthoine Bourgeois
Quoted 10 lines · Anthoine Bourgeois

With virtio-vga, pci bar are reordered. Bar #2 is used for compatibility with stdvga. By default, bar #2 is used by virtio modern io bar. This bar is the last one introduce in the virtio pci bar layout and it's crushed by the virtio-vga reordering. So virtio-vga and modern-pio-notify are incompatible because virtio-vga failed to initialize with this option.

This fix sets the modern io bar to the bar #5 to avoid conflict.

Gerd, would you say it's required for 5.0?

Quoted 18 lines
---
 hw/display/virtio-vga.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-vga.c +1 -0
index 2b4c2aa126..95757a6619 100644
@@ -114,6 +114,7 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
      */
     vpci_dev->modern_mem_bar_idx = 2;
     vpci_dev->msix_bar_idx = 4;
+    vpci_dev->modern_io_bar_idx = 5;
 
     if (!(vpci_dev->flags & VIRTIO_PCI_FLAG_PAGE_PER_VQ)) {
         /*
Signature · 1 line
2.20.1
#5 lore raw
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Anthoine Bourgeois

With virtio-vga, pci bar are reordered. Bar #2 is used for compatibility with stdvga. By default, bar #2 is used by virtio modern io bar. This bar is the last one introduce in the virtio pci bar layout and it's crushed by the virtio-vga reordering. So virtio-vga and modern-pio-notify are incompatible because virtio-vga failed to initialize with this option.

Quoted 5 lines
Quoted 3 lines

This fix sets the modern io bar to the bar #5 to avoid conflict.

Gerd, would you say it's required for 5.0?

Given that modern-pio-notify is off by default I wouldn't classify this as release blocker, i.e. I wouldn't delay the release for that.

We are at -rc4 (last rc) already, so I'd tend to say no. Maybe if we need -rc5 for other reasons.

cheers,
Gerd