virtio: kconfig: memory devices are PCI only
PATCH 1/1 virtio: kconfig: memory devices are PCI only
Virtio memory devices rely on PCI BARs to expose the contents of memory. Because of this they cannot be used with virtio-mmio or virtio-ccw. In fact the code that is common to virtio-mem and virtio-pmem, which is in hw/virtio/virtio-md-pci.c, is only included if CONFIG_VIRTIO_PCI is set. Reproduce the same condition in the Kconfig file.
Without this patch it is possible to create a configuration with CONFIG_VIRTIO_PCI=n and CONFIG_VIRTIO_MEM=y, but that causes a compilation failure.
--- hw/virtio/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/virtio/Kconfig +3 -2
@@ -37,6 +37,7 @@ config VIRTIO_CRYPTO config VIRTIO_MD bool + depends on VIRTIO_PCI select MEM_DEVICE config VIRTIO_PMEM_SUPPORTED
@@ -45,7 +46,7 @@ config VIRTIO_PMEM_SUPPORTED config VIRTIO_PMEM bool default y - depends on VIRTIO + depends on VIRTIO_PCI depends on VIRTIO_PMEM_SUPPORTED select VIRTIO_MD
@@ -55,7 +56,7 @@ config VIRTIO_MEM_SUPPORTED config VIRTIO_MEM bool default y - depends on VIRTIO + depends on VIRTIO_PCI depends on LINUX depends on VIRTIO_MEM_SUPPORTED select VIRTIO_MD
Signature · 1 line
2.46.0
Quoted 2 lines · Paolo Bonzini
Virtio memory devices rely on PCI BARs to expose the contents of memory. Because of this they cannot be used with virtio-mmio or virtio-ccw. In fact
Guess what I am working on at this very the moment ;)
Quoted 7 lines
the code that is common to virtio-mem and virtio-pmem, which is in
hw/virtio/virtio-md-pci.c, is only included ifCONFIG_VIRTIO_PCIis set. Reproduce the same condition in theKconfigfile.Without this patch it is possible to create a configuration with
CONFIG_VIRTIO_PCI=nandCONFIG_VIRTIO_MEM=y, but that causes a compilation failure.
Right.
Quoted 21 lines
Cc David Hildenbrand <[email protected]>Reported-by Michael Tokarev <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- hw/virtio/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/virtio/Kconfig +1
-0@@ -37,6 +37,7 @@ config VIRTIO_CRYPTO config VIRTIO_MD bool + depends on VIRTIO_PCI select MEM_DEVICE config VIRTIO_PMEM_SUPPORTED
hw/virtio/Kconfig config VIRTIO_PMEM_SUPPORTED · line 49
Quoted 5 lines
hw/virtio/Kconfig +1
-1@@ -45,7 +46,7 @@ config VIRTIO_PMEM_SUPPORTED config VIRTIO_PMEM bool default y - depends on VIRTIO + depends on VIRTIO_PCI
depends on VIRTIO_MD ?
hw/virtio/Kconfig config VIRTIO_MEM_SUPPORTED · line 59
Quoted 9 lines
hw/virtio/Kconfig +1
-1depends on VIRTIO_PMEM_SUPPORTED select VIRTIO_MD@@ -55,7 +56,7 @@ config VIRTIO_MEM_SUPPORTED config VIRTIO_MEM bool default y - depends on VIRTIO + depends on VIRTIO_PCI
Same here.
With CCW support, I can unlock VIRTIO_MD and VIRTIO_MEM_SUPPORTED and it should fly.
Signature · 3 lines
Cheers, David / dhildenb
Quoted 18 lines
Quoted 18 lines
Cc David Hildenbrand <[email protected]>Reported-by Michael Tokarev <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- hw/virtio/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/virtio/Kconfig +1
-0@@ -37,6 +37,7 @@ config VIRTIO_CRYPTO config VIRTIO_MD bool + depends on VIRTIO_PCI select MEM_DEVICE
Quoted 9 lines
hw/virtio/Kconfig config VIRTIO_PMEM_SUPPORTED · line 49
Quoted 7 lines
hw/virtio/Kconfig +1
-1config VIRTIO_PMEM_SUPPORTED@@ -45,7 +46,7 @@ config VIRTIO_PMEM_SUPPORTED config VIRTIO_PMEM bool default y - depends on VIRTIO + depends on VIRTIO_PCIdepends on
VIRTIO_MD?
(of course, removing the "select VIRTIO_MD")
Signature · 3 lines
Cheers, David / dhildenb
Quoted 5 lines · David Hildenbrand
Quoted 2 lines · Paolo Bonzini
Virtio memory devices rely on PCI BARs to expose the contents of memory. Because of this they cannot be used with virtio-mmio or virtio-ccw. In fact
Guess what I am working on at this very the moment ;)
Ok, then hardcoding VIRTIO_PCI is not nice.
Quoted 8 lines
Review config VIRTIO_PMEM_SUPPORTED · line 49
Quoted 6 lines
(quoted diff) +1
-1@@ -45,7 +46,7 @@ config VIRTIO_PMEM_SUPPORTED config VIRTIO_PMEM bool default y - depends on VIRTIO + depends on VIRTIO_PCIdepends on
VIRTIO_MD?
No, because VIRTIO_MD is "default n" (and anyway you don't want to enable it by hand in the --without-default-devices case).
But something like this could be a good alternative if you plan to support virtio-ccw as well:
hw/virtio/Kconfig +9 -0
@@ -16,6 +16,7 @@ config VIRTIO_PCI default y if PCI_DEVICES depends on PCI select VIRTIO + select VIRTIO_MD_SUPPORTED config VIRTIO_MMIO bool
@@ -35,8 +36,14 @@ config VIRTIO_CRYPTO default y depends on VIRTIO +# not all virtio transports support memory devices; if none does, +# no need to include the code +config VIRTIO_MD_SUPPORTED + bool + config VIRTIO_MD bool + depends on VIRTIO_MD_SUPPORTED select MEM_DEVICE config VIRTIO_PMEM_SUPPORTED
@@ -46,6 +51,7 @@ config VIRTIO_PMEM bool default y depends on VIRTIO + depends on VIRTIO_MD_SUPPORTED depends on VIRTIO_PMEM_SUPPORTED select VIRTIO_MD
@@ -57,6 +63,7 @@ config VIRTIO_MEM default y depends on VIRTIO depends on LINUX + depends on VIRTIO_MD_SUPPORTED depends on VIRTIO_MEM_SUPPORTED select VIRTIO_MD
and then you just need to select VIRTIO_MD_SUPPORTED from VIRTIO_CCW. In the case of PCI there is some board support code as well, which is why VIRTIO_{MEM,PMEM}_SUPPORTED is selected from "config PC", but perhaps in the s390 code you can select those three from VIRTIO_CCW as well.
If this looks good I'll send it as v2.
Thanks,
Paolo
Quoted 18 lines · Paolo Bonzini
Quoted 5 lines · David Hildenbrand
Quoted 2 lines · Paolo Bonzini
Virtio memory devices rely on PCI BARs to expose the contents of memory. Because of this they cannot be used with virtio-mmio or virtio-ccw. In fact
Guess what I am working on at this very the moment ;)
Ok, then hardcoding
VIRTIO_PCIis not nice.Quoted 8 lines
Review config VIRTIO_PMEM_SUPPORTED · line 49
Quoted 6 lines
(quoted diff) +1
-1@@ -45,7 +46,7 @@ config VIRTIO_PMEM_SUPPORTED config VIRTIO_PMEM bool default y - depends on VIRTIO + depends on VIRTIO_PCIdepends on
VIRTIO_MD?
Quoted 2 lines
No, because
VIRTIO_MDis "default n" (and anyway you don't want to enable it by hand in the --without-default-devices case).
Right, that's what I originally tried to achieve.
Quoted 48 lines
But something like this could be a good alternative if you plan to support virtio-ccw as well:
hw/virtio/Kconfig +9
-0@@ -16,6 +16,7 @@ config VIRTIO_PCI default y if PCI_DEVICES depends on PCI select VIRTIO + select VIRTIO_MD_SUPPORTED config VIRTIO_MMIO bool@@ -35,8 +36,14 @@ config VIRTIO_CRYPTO default y depends on VIRTIO +# not all virtio transports support memory devices; if none does, +# no need to include the code +config VIRTIO_MD_SUPPORTED + bool + config VIRTIO_MD bool + depends on VIRTIO_MD_SUPPORTED select MEM_DEVICE config VIRTIO_PMEM_SUPPORTED@@ -46,6 +51,7 @@ config VIRTIO_PMEM bool default y depends on VIRTIO + depends on VIRTIO_MD_SUPPORTED depends on VIRTIO_PMEM_SUPPORTED select VIRTIO_MD@@ -57,6 +63,7 @@ config VIRTIO_MEM default y depends on VIRTIO depends on LINUX + depends on VIRTIO_MD_SUPPORTED depends on VIRTIO_MEM_SUPPORTED select VIRTIO_MD
Quoted 1 line
and then you just need to select
VIRTIO_MD_SUPPORTEDfromVIRTIO_CCW.
Sounds good.
Quoted 4 lines
In the case of PCI there is some board support code as well, which is why VIRTIO_{MEM,PMEM}_SUPPORTED is selected from "config PC", but perhaps in the s390 code you can select those three from
VIRTIO_CCWas well.
Yes, only VIRTIO_MEM_SUPPORTED for now.
Quoted 2 lines
If this looks good I'll send it as v2.
Thanks!
Signature · 3 lines
Cheers, David / dhildenb