virtio-iommu-pci: Advertise the device as modern-only
v2 cover virtio-iommu-pci: Advertise the device as modern-only
Since commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on"), we are forced to use disable-legacy=on when instantiating the virtio-iommu-pci device. This also revealed that the unrealize() function is likely to call g_tree_destroy() on NULL gtrees, which triggers assertions.
Best Regards
Eric
History:
v1 -> v2:
- Fix patch #1 commit message typos
- Add Connie's R-b on both patches
Eric Auger (2):
virtio-iommu: Check gtrees are non null before destroying them
virtio-iommu-pci: force virtio version 1
hw/virtio/virtio-iommu-pci.c | 2 +- hw/virtio/virtio-iommu.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
2.21.3
PATCH v2 2/2 virtio-iommu-pci: force virtio version 1
Commit 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=on' on virtio-iommu-pci:
qemu-system-aarch64: -device virtio-iommu-pci: device is modern-only, use disable-legacy=on
virtio-iommu was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'.
This patch forces virtio version 1 and removes the 'transitional_name' property removing the need to specify 'disable-legacy=on' on virtio-iommu-pci device.
---
v1 -> v2:
- Added Connie's R-b
--- hw/virtio/virtio-iommu-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-iommu-pci.c +1 -1
@@ -68,6 +68,7 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)object_property_set_link (OBJECT (dev),"primary-bus" ,OBJECT (pci_get_bus (&vpci_dev->pci_dev)), &error_abort); +virtio_pci_force_virtio_1 (vpci_dev);qdev_realize (vdev,BUS (&vpci_dev->bus), errp); }
@@ -97,7 +98,6 @@ static void virtio_iommu_pci_instance_init(Object *obj)static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .base_name =TYPE_VIRTIO_IOMMU_PCI , .generic_name ="virtio-iommu-pci" , - .transitional_name ="virtio-iommu-pci-transitional" , .non_transitional_name ="virtio-iommu-pci-non-transitional" , .instance_size =sizeof (VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init,
Signature · 1 line
2.21.3
PATCH v2 1/2 virtio-iommu: Check gtrees are non null before destroying them
In reply to Eric AugerIf realize fails, domains and endpoints trees may be NULL. On unrealize(), this produces assertions:
"GLib: g_tree_destroy: assertion 'tree != NULL' failed"
Check that the trees are non NULL before destroying them.
---
v1 -> v2:
- fix the commit message
- Added Connie's R-b
--- hw/virtio/virtio-iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/virtio/virtio-iommu.c +6 -2
@@ -801,8 +801,12 @@ static void virtio_iommu_device_unrealize(DeviceState *dev)VirtIOIOMMU *s =VIRTIO_IOMMU (dev);g_hash_table_destroy (s->as_by_busptr); -g_tree_destroy (s->domains); -g_tree_destroy (s->endpoints); +if (s->domains) { +g_tree_destroy (s->domains); + } +if (s->endpoints) { +g_tree_destroy (s->endpoints); + }virtio_delete_queue (s->req_vq);virtio_delete_queue (s->event_vq);
Signature · 1 line
2.21.3
Re: [PATCH v2 2/2] virtio-iommu-pci: force virtio version 1
In reply to Eric AugerQuoted 7 lines · On Tue, 8 Sep 2020 21:33:09 +0200 Eric Auger <[email protected]> wrote:
Commit
9b3a35ec82("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=on' on virtio-iommu-pci:qemu-system-aarch64: -device virtio-iommu-pci: device is modern-only, use disable-legacy=on
Quoted 6 lines
virtio-iommu was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'.
This patch forces virtio version 1 and removes the '
transitional_name' property removing the need to specify 'disable-legacy=on' on virtio-iommu-pci device.
Not sure whether this patch has been queued already, and how much we care about migration compatibility for virtio-iommu, but would it make sense to force modern on 5.1+ compat machines only? (see
https://lore.kernel.org/qemu-devel/[email protected]/)
Quoted 32 lines
Signed-off-by Eric Auger <[email protected]>Reviewed-by Cornelia Huck <[email protected]>---
v1 -> v2:
- Added Connie's R-b--- hw/virtio/virtio-iommu-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/virtio/virtio-iommu-pci.c +1
-1@@ -68,6 +68,7 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)object_property_set_link (OBJECT (dev),"primary-bus" ,OBJECT (pci_get_bus (&vpci_dev->pci_dev)), &error_abort); +virtio_pci_force_virtio_1 (vpci_dev);qdev_realize (vdev,BUS (&vpci_dev->bus), errp); }@@ -97,7 +98,6 @@ static void virtio_iommu_pci_instance_init(Object *obj)static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .base_name =TYPE_VIRTIO_IOMMU_PCI , .generic_name ="virtio-iommu-pci" , - .transitional_name ="virtio-iommu-pci-transitional" , .non_transitional_name ="virtio-iommu-pci-non-transitional" , .instance_size =sizeof (VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init,
Re: [PATCH v2 2/2] virtio-iommu-pci: force virtio version 1
Hi Connie,
Quoted 13 lines · Cornelia Huck
Quoted 10 lines · On Tue, 8 Sep 2020 21:33:09 +0200 Eric Auger <[email protected]> wrote:
Commit
9b3a35ec82("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=on' on virtio-iommu-pci:qemu-system-aarch64: -device virtio-iommu-pci: device is modern-only, use disable-legacy=on
virtio-iommu was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'.
Quoted 8 lines
Quoted 3 lines
This patch forces virtio version 1 and removes the '
transitional_name' property removing the need to specify 'disable-legacy=on' on virtio-iommu-pci device.Not sure whether this patch has been queued already, and how much we care about migration compatibility for virtio-iommu, but would it make sense to force modern on 5.1+ compat machines only? (see
https://lore.kernel.org/qemu-devel/[email protected]/)
I don't think it was pulled yet.
Quoted 3 lines
Quoted 3 lines
The virtio-iommu-pci device only is usable on ARM in dt mode so I don't think it has production users at the moment.
Thanks
Eric
Quoted 32 lines
Quoted 30 lines
Signed-off-by Eric Auger <[email protected]>Reviewed-by Cornelia Huck <[email protected]>---
v1 -> v2:
- Added Connie's R-b--- hw/virtio/virtio-iommu-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/virtio/virtio-iommu-pci.c +1
-1@@ -68,6 +68,7 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)object_property_set_link (OBJECT (dev),"primary-bus" ,OBJECT (pci_get_bus (&vpci_dev->pci_dev)), &error_abort); +virtio_pci_force_virtio_1 (vpci_dev);qdev_realize (vdev,BUS (&vpci_dev->bus), errp); }@@ -97,7 +98,6 @@ static void virtio_iommu_pci_instance_init(Object *obj)static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .base_name =TYPE_VIRTIO_IOMMU_PCI , .generic_name ="virtio-iommu-pci" , - .transitional_name ="virtio-iommu-pci-transitional" , .non_transitional_name ="virtio-iommu-pci-non-transitional" , .instance_size =sizeof (VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init,
Re: [PATCH v2 2/2] virtio-iommu-pci: force virtio version 1
Quoted 25 lines · On Fri, 18 Sep 2020 12:24:02 +0200 Auger Eric <[email protected]> wrote:
Hi Connie,
Quoted 13 lines · Cornelia Huck
Quoted 10 lines · On Tue, 8 Sep 2020 21:33:09 +0200 Eric Auger <[email protected]> wrote:
Commit
9b3a35ec82("virtio: verify that legacy support is not accidentally on") added a safety check that requires to set 'disable-legacy=on' on virtio-iommu-pci:qemu-system-aarch64: -device virtio-iommu-pci: device is modern-only, use disable-legacy=on
virtio-iommu was introduced after the release of VIRTIO 1.0 specifications, so it should be 'modern-only'.
Quoted 8 lines
Quoted 3 lines
This patch forces virtio version 1 and removes the '
transitional_name' property removing the need to specify 'disable-legacy=on' on virtio-iommu-pci device.Not sure whether this patch has been queued already, and how much we care about migration compatibility for virtio-iommu, but would it make sense to force modern on 5.1+ compat machines only? (see
https://lore.kernel.org/qemu-devel/[email protected]/)
Quoted 7 lines
I don't think it was pulled yet.
Quoted 3 lines
Quoted 3 lines
The virtio-iommu-pci device only is usable on ARM in dt mode so I don't think it has production users at the moment.
OK, then we can keep this patch here, I guess.