thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
7f1c5b
From e01563a8de9a45937ffd8d4c1d74a6890ffb6eb6 Mon Sep 17 00:00:00 2001
7f1c5b
From: Cindy Lu <lulu@redhat.com>
7f1c5b
Date: Thu, 22 Dec 2022 15:04:46 +0800
7f1c5b
Subject: [PATCH 05/31] vhost-vdpa: add support for config interrupt
7f1c5b
MIME-Version: 1.0
7f1c5b
Content-Type: text/plain; charset=UTF-8
7f1c5b
Content-Transfer-Encoding: 8bit
7f1c5b
7f1c5b
RH-Author: Cindy Lu <lulu@redhat.com>
7f1c5b
RH-MergeRequest: 132: vhost-vdpa: support config interrupt in vhost-vdpa
7f1c5b
RH-Bugzilla: 1905805
7f1c5b
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
7f1c5b
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
7f1c5b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7f1c5b
RH-Commit: [5/10] 49bfd214a503f8e199ff93f4bbfcbd4c4f2405b5 (lulu6/qemu-kvm3)
7f1c5b
7f1c5b
https://bugzilla.redhat.com/show_bug.cgi?id=1905805
7f1c5b
Add new call back function in vhost-vdpa, The function
7f1c5b
vhost_set_config_call can set the event fd to kernel.
7f1c5b
This function will be called in the vhost_dev_start
7f1c5b
and vhost_dev_stop
7f1c5b
7f1c5b
Signed-off-by: Cindy Lu <lulu@redhat.com>
7f1c5b
Message-Id: <20221222070451.936503-6-lulu@redhat.com>
7f1c5b
Acked-by: Jason Wang <jasowang@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 259f3acc1c675dd77ebbdb28a483f5d0220bdbf6)
7f1c5b
Signed-off-by: Cindy Lu <lulu@redhat.com>
7f1c5b
---
7f1c5b
 hw/virtio/trace-events | 1 +
7f1c5b
 hw/virtio/vhost-vdpa.c | 8 ++++++++
7f1c5b
 2 files changed, 9 insertions(+)
7f1c5b
7f1c5b
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
7f1c5b
index 14fc5b9bb2..46f2faf04e 100644
7f1c5b
--- a/hw/virtio/trace-events
7f1c5b
+++ b/hw/virtio/trace-events
7f1c5b
@@ -62,6 +62,7 @@ vhost_vdpa_get_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRI
7f1c5b
 vhost_vdpa_set_owner(void *dev) "dev: %p"
7f1c5b
 vhost_vdpa_vq_get_addr(void *dev, void *vq, uint64_t desc_user_addr, uint64_t avail_user_addr, uint64_t used_user_addr) "dev: %p vq: %p desc_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64
7f1c5b
 vhost_vdpa_get_iova_range(void *dev, uint64_t first, uint64_t last) "dev: %p first: 0x%"PRIx64" last: 0x%"PRIx64
7f1c5b
+vhost_vdpa_set_config_call(void *dev, int fd)"dev: %p fd: %d"
7f1c5b
 
7f1c5b
 # virtio.c
7f1c5b
 virtqueue_alloc_element(void *elem, size_t sz, unsigned in_num, unsigned out_num) "elem %p size %zd in_num %u out_num %u"
7f1c5b
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
7f1c5b
index 7468e44b87..c5be2645b0 100644
7f1c5b
--- a/hw/virtio/vhost-vdpa.c
7f1c5b
+++ b/hw/virtio/vhost-vdpa.c
7f1c5b
@@ -754,6 +754,13 @@ static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev)
7f1c5b
     return 0;
7f1c5b
 }
7f1c5b
 
7f1c5b
+static int vhost_vdpa_set_config_call(struct vhost_dev *dev,
7f1c5b
+                                       int fd)
7f1c5b
+{
7f1c5b
+    trace_vhost_vdpa_set_config_call(dev, fd);
7f1c5b
+    return vhost_vdpa_call(dev, VHOST_VDPA_SET_CONFIG_CALL, &fd;;
7f1c5b
+}
7f1c5b
+
7f1c5b
 static void vhost_vdpa_dump_config(struct vhost_dev *dev, const uint8_t *config,
7f1c5b
                                    uint32_t config_len)
7f1c5b
 {
7f1c5b
@@ -1310,4 +1317,5 @@ const VhostOps vdpa_ops = {
7f1c5b
         .vhost_get_device_id = vhost_vdpa_get_device_id,
7f1c5b
         .vhost_vq_get_addr = vhost_vdpa_vq_get_addr,
7f1c5b
         .vhost_force_iommu = vhost_vdpa_force_iommu,
7f1c5b
+        .vhost_set_config_call = vhost_vdpa_set_config_call,
7f1c5b
 };
7f1c5b
-- 
7f1c5b
2.31.1
7f1c5b