[PATCH kvmtool 1/1] riscv: pci: Add --force-pci option for riscv VMs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding force-pci option to allow forcing virtio
devices to use pci as the default transport.

Signed-off-by: Rajnesh Kanwal <rkanwal@xxxxxxxxxxxx>
---
 riscv/include/kvm/kvm-arch.h        | 6 ++++--
 riscv/include/kvm/kvm-config-arch.h | 7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/riscv/include/kvm/kvm-arch.h b/riscv/include/kvm/kvm-arch.h
index 1e130f5..2cf41c5 100644
--- a/riscv/include/kvm/kvm-arch.h
+++ b/riscv/include/kvm/kvm-arch.h
@@ -46,8 +46,10 @@
 
 #define KVM_VM_TYPE		0
 
-#define VIRTIO_DEFAULT_TRANS(kvm) \
-	((kvm)->cfg.virtio_legacy ? VIRTIO_MMIO_LEGACY : VIRTIO_MMIO)
+#define VIRTIO_DEFAULT_TRANS(kvm)					\
+	((kvm)->cfg.arch.virtio_trans_pci ?				\
+	 ((kvm)->cfg.virtio_legacy ? VIRTIO_PCI_LEGACY : VIRTIO_PCI) :	\
+	 ((kvm)->cfg.virtio_legacy ? VIRTIO_MMIO_LEGACY : VIRTIO_MMIO))
 
 #define VIRTIO_RING_ENDIAN	VIRTIO_ENDIAN_LE
 
diff --git a/riscv/include/kvm/kvm-config-arch.h b/riscv/include/kvm/kvm-config-arch.h
index 188125c..901a5e0 100644
--- a/riscv/include/kvm/kvm-config-arch.h
+++ b/riscv/include/kvm/kvm-config-arch.h
@@ -6,6 +6,7 @@
 struct kvm_config_arch {
 	const char	*dump_dtb_filename;
 	bool		ext_disabled[KVM_RISCV_ISA_EXT_MAX];
+	bool		virtio_trans_pci;
 };
 
 #define OPT_ARCH_RUN(pfx, cfg)						\
@@ -26,6 +27,10 @@ struct kvm_config_arch {
 		    "Disable Zicbom Extension"),			\
 	OPT_BOOLEAN('\0', "disable-zihintpause",			\
 		    &(cfg)->ext_disabled[KVM_RISCV_ISA_EXT_ZIHINTPAUSE],\
-		    "Disable Zihintpause Extension"),
+		    "Disable Zihintpause Extension"),			\
+	OPT_BOOLEAN('\0', "force-pci",					\
+			&(cfg)->virtio_trans_pci,			\
+		    "Force virtio devices to use PCI as their "		\
+		    "default transport"),
 
 #endif /* KVM__KVM_CONFIG_ARCH_H */
-- 
2.25.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux