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.

Cc: David Hildenbrand <da...@redhat.com>
Reported-by: Michael Tokarev <m...@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
 hw/virtio/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index aa63ff7fd41..7c554d230d8 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -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
-- 
2.46.0


Reply via email to