|
|
7f1c5b |
From 6282a83619f274ca45a52d61577c10a05a0714dc Mon Sep 17 00:00:00 2001
|
|
|
7f1c5b |
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
|
7f1c5b |
Date: Thu, 15 Dec 2022 12:31:43 +0100
|
|
|
7f1c5b |
Subject: [PATCH 11/14] vdpa: add shadow_data to vhost_vdpa
|
|
|
7f1c5b |
MIME-Version: 1.0
|
|
|
7f1c5b |
Content-Type: text/plain; charset=UTF-8
|
|
|
7f1c5b |
Content-Transfer-Encoding: 8bit
|
|
|
7f1c5b |
|
|
|
7f1c5b |
RH-Author: Eugenio Pérez <eperezma@redhat.com>
|
|
|
7f1c5b |
RH-MergeRequest: 136: vDPA ASID support in Qemu
|
|
|
7f1c5b |
RH-Bugzilla: 2104412
|
|
|
7f1c5b |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7f1c5b |
RH-Commit: [11/13] 9d317add1318b555ba06e19e4c67849069e047b9 (eperezmartin/qemu-kvm)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
The memory listener that thells the device how to convert GPA to qemu's
|
|
|
7f1c5b |
va is registered against CVQ vhost_vdpa. memory listener translations
|
|
|
7f1c5b |
are always ASID 0, CVQ ones are ASID 1 if supported.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Let's tell the listener if it needs to register them on iova tree or
|
|
|
7f1c5b |
not.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
|
|
7f1c5b |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
7f1c5b |
Message-Id: <20221215113144.322011-12-eperezma@redhat.com>
|
|
|
7f1c5b |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7f1c5b |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7f1c5b |
(cherry picked from commit 6188d78a19894ac8f2bf9484d48a5235a529d3b7)
|
|
|
7f1c5b |
---
|
|
|
7f1c5b |
hw/virtio/vhost-vdpa.c | 6 +++---
|
|
|
7f1c5b |
include/hw/virtio/vhost-vdpa.h | 2 ++
|
|
|
7f1c5b |
net/vhost-vdpa.c | 1 +
|
|
|
7f1c5b |
3 files changed, 6 insertions(+), 3 deletions(-)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
|
|
|
7f1c5b |
index 0ecf2bbaa0..dc3498e995 100644
|
|
|
7f1c5b |
--- a/hw/virtio/vhost-vdpa.c
|
|
|
7f1c5b |
+++ b/hw/virtio/vhost-vdpa.c
|
|
|
7f1c5b |
@@ -224,7 +224,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,
|
|
|
7f1c5b |
vaddr, section->readonly);
|
|
|
7f1c5b |
|
|
|
7f1c5b |
llsize = int128_sub(llend, int128_make64(iova));
|
|
|
7f1c5b |
- if (v->shadow_vqs_enabled) {
|
|
|
7f1c5b |
+ if (v->shadow_data) {
|
|
|
7f1c5b |
int r;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
mem_region.translated_addr = (hwaddr)(uintptr_t)vaddr,
|
|
|
7f1c5b |
@@ -251,7 +251,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,
|
|
|
7f1c5b |
return;
|
|
|
7f1c5b |
|
|
|
7f1c5b |
fail_map:
|
|
|
7f1c5b |
- if (v->shadow_vqs_enabled) {
|
|
|
7f1c5b |
+ if (v->shadow_data) {
|
|
|
7f1c5b |
vhost_iova_tree_remove(v->iova_tree, mem_region);
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
@@ -296,7 +296,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
|
|
|
7f1c5b |
|
|
|
7f1c5b |
llsize = int128_sub(llend, int128_make64(iova));
|
|
|
7f1c5b |
|
|
|
7f1c5b |
- if (v->shadow_vqs_enabled) {
|
|
|
7f1c5b |
+ if (v->shadow_data) {
|
|
|
7f1c5b |
const DMAMap *result;
|
|
|
7f1c5b |
const void *vaddr = memory_region_get_ram_ptr(section->mr) +
|
|
|
7f1c5b |
section->offset_within_region +
|
|
|
7f1c5b |
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
|
|
|
7f1c5b |
index e57dfa1fd1..45b969a311 100644
|
|
|
7f1c5b |
--- a/include/hw/virtio/vhost-vdpa.h
|
|
|
7f1c5b |
+++ b/include/hw/virtio/vhost-vdpa.h
|
|
|
7f1c5b |
@@ -40,6 +40,8 @@ typedef struct vhost_vdpa {
|
|
|
7f1c5b |
struct vhost_vdpa_iova_range iova_range;
|
|
|
7f1c5b |
uint64_t acked_features;
|
|
|
7f1c5b |
bool shadow_vqs_enabled;
|
|
|
7f1c5b |
+ /* Vdpa must send shadow addresses as IOTLB key for data queues, not GPA */
|
|
|
7f1c5b |
+ bool shadow_data;
|
|
|
7f1c5b |
/* IOVA mapping used by the Shadow Virtqueue */
|
|
|
7f1c5b |
VhostIOVATree *iova_tree;
|
|
|
7f1c5b |
GPtrArray *shadow_vqs;
|
|
|
7f1c5b |
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
|
|
|
7f1c5b |
index 1757f1d028..eea7a0df12 100644
|
|
|
7f1c5b |
--- a/net/vhost-vdpa.c
|
|
|
7f1c5b |
+++ b/net/vhost-vdpa.c
|
|
|
7f1c5b |
@@ -581,6 +581,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
|
|
|
7f1c5b |
s->always_svq = svq;
|
|
|
7f1c5b |
s->vhost_vdpa.shadow_vqs_enabled = svq;
|
|
|
7f1c5b |
s->vhost_vdpa.iova_range = iova_range;
|
|
|
7f1c5b |
+ s->vhost_vdpa.shadow_data = svq;
|
|
|
7f1c5b |
s->vhost_vdpa.iova_tree = iova_tree;
|
|
|
7f1c5b |
if (!is_datapath) {
|
|
|
7f1c5b |
s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(),
|
|
|
7f1c5b |
--
|
|
|
7f1c5b |
2.31.1
|
|
|
7f1c5b |
|