[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230419222350.3604274-9-atishp@rivosinc.com>
Date: Wed, 19 Apr 2023 15:23:48 -0700
From: Atish Patra <atishp@...osinc.com>
To: linux-kernel@...r.kernel.org
Cc: Rajnesh Kanwal <rkanwal@...osinc.com>,
Alexandre Ghiti <alex@...ti.fr>,
Andrew Jones <ajones@...tanamicro.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Anup Patel <anup@...infault.org>,
Atish Patra <atishp@...shpatra.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Sean Christopherson <seanjc@...gle.com>,
linux-coco@...ts.linux.dev, Dylan Reid <dylan@...osinc.com>,
abrestic@...osinc.com, Samuel Ortiz <sameo@...osinc.com>,
Jiri Slaby <jirislaby@...nel.org>,
kvm-riscv@...ts.infradead.org, kvm@...r.kernel.org,
linux-mm@...ck.org, linux-riscv@...ts.infradead.org,
Palmer Dabbelt <palmer@...belt.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Uladzislau Rezki <urezki@...il.com>
Subject: [RFC kvmtool 08/10] riscv: virtio: Enforce VIRTIO_F_ACCESS_PLATFORM feature flag.
From: Rajnesh Kanwal <rkanwal@...osinc.com>
VIRTIO_F_ACCESS_PLATFORM feature tells the guest that device will
be using DMA for transfers. This forces the guest to use DMA API
to allow the host to successfully access guest memory as needed.
This is needed for CoVE VMs.
Signed-off-by: Rajnesh Kanwal <rkanwal@...osinc.com>
---
riscv/kvm.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/riscv/kvm.c b/riscv/kvm.c
index e728790..aebb6bd 100644
--- a/riscv/kvm.c
+++ b/riscv/kvm.c
@@ -7,6 +7,7 @@
#include <linux/kernel.h>
#include <linux/kvm.h>
#include <linux/sizes.h>
+#include <linux/virtio_config.h>
struct kvm_ext kvm_req_ext[] = {
{ DEFINE_KVM_EXT(KVM_CAP_ONE_REG) },
@@ -224,5 +225,14 @@ int kvm__arch_setup_firmware(struct kvm *kvm)
u64 kvm__arch_get_virtio_host_features(struct kvm *kvm)
{
- return 0;
+ u64 features = 0;
+
+ /* CoVE VMs mandate VIRTIO_F_ACCESS_PLATFORM feature to force use of
+ * SWIOTLB bounce buffers through DMA API. Without this device probe
+ * will fail for CoVE VMs.
+ */
+ if (kvm->cfg.arch.cove_vm)
+ features |= (1ULL << VIRTIO_F_ACCESS_PLATFORM);
+
+ return features;
}
--
2.25.1
Powered by blists - more mailing lists