virtio-ccw: allow to disable legacy virtio
Subsystems (4)
Cornelia Huck
maintainercover virtio-ccw: allow to disable legacy virtio
Unlike virtio-pci, virtio-ccw is currently always a transitional driver (i.e. it always includes support for legacy devices.) The differences between legacy and virtio-1+ virtio-ccw devices are not that big (the most interesting things are in common virtio code anyway.)
It might be beneficial to make support for legacy virtio generally configurable, in case we want to remove it completely in a future where we all have flying cars. As a prereq, we need to make it configurable for virtio-ccw.
Patch 1 introduces a parameter; now that I look at it, it's probably not that useful (not even for testing), so I'm inclined to drop it again.
Patch 2 adds a new config symbol for generic legacy virtio support, which currently does not do anything but being selected by the legacy options for virtio-pci and virtio-ccw. A virtio-ccw driver without legacy support will require a revision of 1 or higher to be supported by the device.
A virtio-ccw driver with legacy turned off works well for me with transitional devices and fails onlining gracefully for legacy devices (max_revision=0 in QEMU).
(I also have some code that allows to make devices non-transitional in QEMU, but I haven't yet found time to polish the patches.)
Cornelia Huck (2):
virtio/s390: add parameter for minimum revision
virtio/s390: make legacy support configurable
arch/s390/Kconfig | 11 ++ drivers/s390/virtio/Makefile | 1 + drivers/s390/virtio/virtio_ccw.c | 179 ++++++++---------------- drivers/s390/virtio/virtio_ccw_common.h | 113 +++++++++++++++ drivers/s390/virtio/virtio_ccw_legacy.c | 138 ++++++++++++++++++ drivers/virtio/Kconfig | 8 ++ 6 files changed, 330 insertions(+), 120 deletions(-) create mode 100644 drivers/s390/virtio/virtio_ccw_common.h create mode 100644 drivers/s390/virtio/virtio_ccw_legacy.c
base-commit: cf6acb8bdb1d829b85a4daa2944bf9e71c93f4b9
Signature · 6 lines
2.26.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Cornelia Huck
maintainerRFC PATCH 1/2 virtio/s390: add parameter for minimum revision
We use transport revisions in virtio-ccw for introducing new commands etc.; revision 1 denotes operating according to the standard. Legacy devices do not understand the command to set a revision; for those, we presume to operate at revision 0.
Add a parameter min_revision to be able to actively restrict use of old transport revisions. In particular, setting a minimum revision of 1 makes our driver act as a non-transitional driver.
With the default min_revision of 0, we continue to act as a transitional driver.
--- drivers/s390/virtio/virtio_ccw.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/s390/virtio/virtio_ccw.c +19 -2
@@ -34,6 +34,16 @@#include <asm/isc.h> #include <asm/airq.h> +/* +* Provide a knob to turn off support for older revisions. This is useful +* if we want to act as a non-transitional virtio device driver: requiring +* a minimum revision of 1 turns off support for legacy devices. +*/ +static int min_revision; + +module_param (min_revision, int,0444 ); +MODULE_PARM_DESC (min_revision,"minimum transport revision to accept" ); +/* * virtio related functions */
@@ -1271,7 +1281,10 @@ static int virtio_ccw_set_transport_rev(struct virtio_ccw_device *vcdev)else vcdev->revision--; } - }while (ret == -EOPNOTSUPP ); + }while (vcdev->revision >= min_revision && ret == -EOPNOTSUPP ); + +if (ret == -EOPNOTSUPP && vcdev->revision < min_revision) + ret = -EINVAL ;ccw_device_dma_free (vcdev->cdev, ccw,sizeof (*ccw));ccw_device_dma_free (vcdev->cdev, rev,sizeof (*rev));
@@ -1315,8 +1328,12 @@ static int virtio_ccw_online(struct ccw_device *cdev) vcdev->vdev.id.device = cdev->id.cu_model; ret =virtio_ccw_set_transport_rev (vcdev); -if (ret) +if (ret) { +dev_warn (&cdev->dev, +"Could not set a supported transport revision: %d\n" , + ret); goto out_free; + } ret =register_virtio_device (&vcdev->vdev);if (ret) {
Signature · 6 lines
2.26.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Cornelia Huck
maintainerRFC PATCH 2/2 virtio/s390: make legacy support configurable
In reply to Cornelia HuckWe may want to remove legacy virtio support in the future. In order to prepare virtio-ccw for that, add an option to disable legacy support there. This means raising the minimum transport revision to 1.
--- arch/s390/Kconfig | 11 ++ drivers/s390/virtio/Makefile | 1 + drivers/s390/virtio/virtio_ccw.c | 160 ++++++------------------ drivers/s390/virtio/virtio_ccw_common.h | 113 +++++++++++++++++ drivers/s390/virtio/virtio_ccw_legacy.c | 138 ++++++++++++++++++++ drivers/virtio/Kconfig | 8 ++ 6 files changed, 312 insertions(+), 119 deletions(-) create mode 100644 drivers/s390/virtio/virtio_ccw_common.h create mode 100644 drivers/s390/virtio/virtio_ccw_legacy.c
arch/s390/Kconfig +11 -0
@@ -941,6 +941,17 @@ config S390_GUEST Select this option if you want to run the kernel as a guest under the KVM hypervisor. +config VIRTIO_CCW_LEGACY + def_bool y + prompt "Support for legacy virtio-ccw devices" + depends on S390_GUEST + select VIRTIO_LEGACY + help + Enabling this option adds support for virtio-ccw paravirtual device + drivers with legacy support, i.e. it enables transitional a + transitional virtio-ccw driver. + + If unsure, say Y. endmenu menu "Selftests"
drivers/s390/virtio/Makefile +1 -0
@@ -4,3 +4,4 @@ # Copyright IBM Corp. 2008 obj-$(CONFIG_S390_GUEST) += virtio_ccw.o +obj-$(CONFIG_VIRTIO_CCW_LEGACY) += virtio_ccw_legacy.o
drivers/s390/virtio/virtio_ccw.c +41 -119
303 lines not on this page · raw message
drivers/s390/virtio/virtio_ccw_common.h new file +113 -0
113 lines not on this page · raw message
drivers/s390/virtio/virtio_ccw_legacy.c new file +138 -0
138 lines not on this page · raw message
drivers/virtio/Kconfig +8 -0
@@ -18,6 +18,13 @@ menuconfig VIRTIO_MENU if VIRTIO_MENU +config VIRTIO_LEGACY + def_bool y + help + This option selects base support for legacy virtio devices prior + to the virtio standard, such as those in the Virtio PCI Card + 0.9.X Draft and older. + config VIRTIO_PCI tristate "PCI driver for virtio devices" depends on PCI
@@ -34,6 +41,7 @@ config VIRTIO_PCI_LEGACY bool "Support for legacy virtio draft 0.9.X and older devices" default y depends on VIRTIO_PCI + select VIRTIO_LEGACY help Virtio PCI Card 0.9.X Draft (circa 2014) and older device support.
Signature · 6 lines
2.26.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Cornelia Huck
maintainerOn Thu, 4 Mar 2021 14:27:13 +0100
Cornelia Huck <[email protected]> wrote:
Just found this old series sitting there... does anyone have an opinion on the general approach?
Quoted 44 lines
Unlike virtio-pci, virtio-ccw is currently always a transitional driver (i.e. it always includes support for legacy devices.) The differences between legacy and virtio-1+ virtio-ccw devices are not that big (the most interesting things are in common virtio code anyway.)
It might be beneficial to make support for legacy virtio generally configurable, in case we want to remove it completely in a future where we all have flying cars. As a prereq, we need to make it configurable for virtio-ccw.
Patch 1 introduces a parameter; now that I look at it, it's probably not that useful (not even for testing), so I'm inclined to drop it again.
Patch 2 adds a new config symbol for generic legacy virtio support, which currently does not do anything but being selected by the legacy options for virtio-pci and virtio-ccw. A virtio-ccw driver without legacy support will require a revision of 1 or higher to be supported by the device.
A virtio-ccw driver with legacy turned off works well for me with transitional devices and fails onlining gracefully for legacy devices (max_revision=0 in QEMU).
(I also have some code that allows to make devices non-transitional in QEMU, but I haven't yet found time to polish the patches.)
Cornelia Huck (2):
virtio/s390: add parameter for minimum revision
virtio/s390: make legacy support configurablearch/s390/Kconfig | 11 ++ drivers/s390/virtio/Makefile | 1 + drivers/s390/virtio/virtio_ccw.c | 179 ++++++++---------------- drivers/s390/virtio/virtio_ccw_common.h | 113 +++++++++++++++ drivers/s390/virtio/virtio_ccw_legacy.c | 138 ++++++++++++++++++ drivers/virtio/Kconfig | 8 ++ 6 files changed, 330 insertions(+), 120 deletions(-) create mode 100644 drivers/s390/virtio/virtio_ccw_common.h create mode 100644 drivers/s390/virtio/virtio_ccw_legacy.cbase-commit:
cf6acb8bdb1d829b85a4daa2944bf9e71c93f4b9