From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716521; cv=none; d=zohomail.com; s=zohoarc; b=ElqclgxGjp9w8bU6dKIKxkk5WfVAs5dU7huW6v3GVrka6CUHxgi+DIqZJxL19w+CmAtPkd7KRckXf8Kk1qfbUHiXq28Kg05jD4dd63ithS7aG16cwHuC4QxgWF4waWUyP4mP5xLkfcxd/KZUWY4WIrexjXM6ycoNefGQE24nsxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716521; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AFJKds80zAM8tJhj7L+RUZobVEy2LlbiGfFbnCHLRXw=; b=nFxInK4WE4Wccb2xg4WnKi/LdPeooWmiK5vEfhvb5HLpkrauYd89LDWHpKH5Xx9/MyMslTT/S7H2h/0AJIRZiqYirIcKkn8V65XwdvDBSV4Ytxnml5sZI13BcoAQGEf3gXejMA7VMWX6RJn+tJ9pfL98KGzZ8/MkAWvqWpwDs8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716521897639.5132877629532; Mon, 20 Apr 2026 13:22:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv6t-00061P-0G; Mon, 20 Apr 2026 16:20:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6r-00060W-Gg for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6n-0006NO-LQ for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id CD690C01A6; Mon, 20 Apr 2026 23:20:37 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-y7QnYXff; Mon, 20 Apr 2026 23:20:36 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716437; bh=AFJKds80zAM8tJhj7L+RUZobVEy2LlbiGfFbnCHLRXw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=Ff3wbagOoq9zhEXu6+sWUshFUM+6GIfX1WyMwmnGdWE2xDnD0mXMMR+Z4v+YIQgdc bsM/C5AmdckZWVVO1j2FJWqSuxxDDVCRMQJbxQuXWOu7N8H3VBqTWaun7sFMbHLnXr OXbFSa32XpW37h5VpgYI1mnnw/Q0QbVZyuxHqF2c= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 01/10] vhost: move IOTLB functions from vhost-backend.c to vhost.c Date: Mon, 20 Apr 2026 23:20:22 +0300 Message-ID: <20260420202032.714884-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716523116154100 Content-Type: text/plain; charset="utf-8" Move and rename vhost_backend_update_device_iotlb(), vhost_backend_invalidate_device_iotlb(), and vhost_backend_handle_iotlb_msg() from vhost-backend.c to vhost.c. vhost-backend.c is actually about vhost-kernel backend. But these functions are shared with vhost-user, so let's move them into generic place. Moreover, two of three functions becomes static as they are used only in vhost.c. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost-backend.c | 82 +---------------------------- hw/virtio/vhost-user.c | 2 +- hw/virtio/vhost.c | 85 +++++++++++++++++++++++++++++-- include/hw/virtio/vhost-backend.h | 11 ---- include/hw/virtio/vhost.h | 2 + 5 files changed, 86 insertions(+), 96 deletions(-) diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index 4367db0d951..fea88afc39a 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -298,7 +298,7 @@ static void vhost_kernel_iotlb_read(void *opaque) break; } =20 - vhost_backend_handle_iotlb_msg(dev, &msg.iotlb); + vhost_handle_iotlb_msg(dev, &msg.iotlb); } } else { struct vhost_msg msg; @@ -313,7 +313,7 @@ static void vhost_kernel_iotlb_read(void *opaque) break; } =20 - vhost_backend_handle_iotlb_msg(dev, &msg.iotlb); + vhost_handle_iotlb_msg(dev, &msg.iotlb); } } } @@ -392,81 +392,3 @@ const VhostOps kernel_ops =3D { .vhost_send_device_iotlb_msg =3D vhost_kernel_send_device_iotlb_ms= g, }; #endif - -int vhost_backend_update_device_iotlb(struct vhost_dev *dev, - uint64_t iova, uint64_t uaddr, - uint64_t len, - IOMMUAccessFlags perm) -{ - struct vhost_iotlb_msg imsg; - - imsg.iova =3D iova; - imsg.uaddr =3D uaddr; - imsg.size =3D len; - imsg.type =3D VHOST_IOTLB_UPDATE; - - switch (perm) { - case IOMMU_RO: - imsg.perm =3D VHOST_ACCESS_RO; - break; - case IOMMU_WO: - imsg.perm =3D VHOST_ACCESS_WO; - break; - case IOMMU_RW: - imsg.perm =3D VHOST_ACCESS_RW; - break; - default: - return -EINVAL; - } - - if (dev->vhost_ops && dev->vhost_ops->vhost_send_device_iotlb_msg) - return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg); - - return -ENODEV; -} - -int vhost_backend_invalidate_device_iotlb(struct vhost_dev *dev, - uint64_t iova, uint64_t l= en) -{ - struct vhost_iotlb_msg imsg; - - imsg.iova =3D iova; - imsg.size =3D len; - imsg.type =3D VHOST_IOTLB_INVALIDATE; - - if (dev->vhost_ops && dev->vhost_ops->vhost_send_device_iotlb_msg) - return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg); - - return -ENODEV; -} - -int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev, - struct vhost_iotlb_msg *imsg) -{ - int ret =3D 0; - - if (unlikely(!dev->vdev)) { - error_report("Unexpected IOTLB message when virtio device is stopp= ed"); - return -EINVAL; - } - - switch (imsg->type) { - case VHOST_IOTLB_MISS: - ret =3D vhost_device_iotlb_miss(dev, imsg->iova, - imsg->perm !=3D VHOST_ACCESS_RO); - break; - case VHOST_IOTLB_ACCESS_FAIL: - /* FIXME: report device iotlb error */ - error_report("Access failure IOTLB message type not supported"); - ret =3D -ENOTSUP; - break; - case VHOST_IOTLB_UPDATE: - case VHOST_IOTLB_INVALIDATE: - default: - error_report("Unexpected IOTLB message type"); - ret =3D -EINVAL; - break; - } - - return ret; -} diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 4fb136b7b37..6978d8ee947 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1901,7 +1901,7 @@ static gboolean backend_read(QIOChannel *ioc, GIOCond= ition condition, =20 switch (hdr.request) { case VHOST_USER_BACKEND_IOTLB_MSG: - ret =3D vhost_backend_handle_iotlb_msg(dev, &payload.iotlb); + ret =3D vhost_handle_iotlb_msg(dev, &payload.iotlb); break; case VHOST_USER_BACKEND_CONFIG_CHANGE_MSG: ret =3D vhost_user_backend_handle_config_change(dev); diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index c610007e812..4d42f8bda41 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -916,14 +916,92 @@ static void vhost_region_addnop(MemoryListener *liste= ner, vhost_region_add_section(dev, section); } =20 +static int vhost_update_device_iotlb(struct vhost_dev *dev, + uint64_t iova, uint64_t uaddr, + uint64_t len, + IOMMUAccessFlags perm) +{ + struct vhost_iotlb_msg imsg; + + imsg.iova =3D iova; + imsg.uaddr =3D uaddr; + imsg.size =3D len; + imsg.type =3D VHOST_IOTLB_UPDATE; + + switch (perm) { + case IOMMU_RO: + imsg.perm =3D VHOST_ACCESS_RO; + break; + case IOMMU_WO: + imsg.perm =3D VHOST_ACCESS_WO; + break; + case IOMMU_RW: + imsg.perm =3D VHOST_ACCESS_RW; + break; + default: + return -EINVAL; + } + + if (dev->vhost_ops && dev->vhost_ops->vhost_send_device_iotlb_msg) { + return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg); + } + + return -ENODEV; +} + +static int vhost_invalidate_device_iotlb(struct vhost_dev *dev, + uint64_t iova, uint64_t len) +{ + struct vhost_iotlb_msg imsg; + + imsg.iova =3D iova; + imsg.size =3D len; + imsg.type =3D VHOST_IOTLB_INVALIDATE; + + if (dev->vhost_ops && dev->vhost_ops->vhost_send_device_iotlb_msg) { + return dev->vhost_ops->vhost_send_device_iotlb_msg(dev, &imsg); + } + + return -ENODEV; +} + +int vhost_handle_iotlb_msg(struct vhost_dev *dev, struct vhost_iotlb_msg *= imsg) +{ + int ret =3D 0; + + if (unlikely(!dev->vdev)) { + error_report("Unexpected IOTLB message when virtio device is stopp= ed"); + return -EINVAL; + } + + switch (imsg->type) { + case VHOST_IOTLB_MISS: + ret =3D vhost_device_iotlb_miss(dev, imsg->iova, + imsg->perm !=3D VHOST_ACCESS_RO); + break; + case VHOST_IOTLB_ACCESS_FAIL: + /* FIXME: report device iotlb error */ + error_report("Access failure IOTLB message type not supported"); + ret =3D -ENOTSUP; + break; + case VHOST_IOTLB_UPDATE: + case VHOST_IOTLB_INVALIDATE: + default: + error_report("Unexpected IOTLB message type"); + ret =3D -EINVAL; + break; + } + + return ret; +} + static void vhost_iommu_unmap_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotl= b) { struct vhost_iommu *iommu =3D container_of(n, struct vhost_iommu, n); struct vhost_dev *hdev =3D iommu->hdev; hwaddr iova =3D iotlb->iova + iommu->iommu_offset; =20 - if (vhost_backend_invalidate_device_iotlb(hdev, iova, - iotlb->addr_mask + 1)) { + if (vhost_invalidate_device_iotlb(hdev, iova, iotlb->addr_mask + 1)) { error_report("Fail to invalidate device iotlb"); } } @@ -1304,8 +1382,7 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, ui= nt64_t iova, int write) len =3D MIN(iotlb.addr_mask + 1, len); iova =3D iova & ~iotlb.addr_mask; =20 - ret =3D vhost_backend_update_device_iotlb(dev, iova, uaddr, - len, iotlb.perm); + ret =3D vhost_update_device_iotlb(dev, iova, uaddr, len, iotlb.per= m); if (ret) { trace_vhost_iotlb_miss(dev, 4); error_report("Fail to update device iotlb"); diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index ff94fa17342..57497e197aa 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -222,17 +222,6 @@ typedef struct VhostOps { vhost_check_device_state_op vhost_check_device_state; } VhostOps; =20 -int vhost_backend_update_device_iotlb(struct vhost_dev *dev, - uint64_t iova, uint64_t uaddr, - uint64_t len, - IOMMUAccessFlags perm); - -int vhost_backend_invalidate_device_iotlb(struct vhost_dev *dev, - uint64_t iova, uint64_t l= en); - -int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev, - struct vhost_iotlb_msg *imsg); - int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd); =20 int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uui= d, diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 54862f9b445..b292e9f0fed 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -403,6 +403,8 @@ int vhost_dev_set_inflight(struct vhost_dev *dev, int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size, struct vhost_inflight *inflight); bool vhost_dev_has_iommu(struct vhost_dev *dev); +int vhost_handle_iotlb_msg(struct vhost_dev *dev, struct vhost_iotlb_msg *= imsg); + =20 static inline bool vhost_dev_has_feature(struct vhost_dev *dev, uint64_t feature) --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716507; cv=none; d=zohomail.com; s=zohoarc; b=HFZ1+XPWY5DDMdsJveLLW8FBsCtevD+ZgWRQQxR7hZXCeE2hPF70tCEfAnpO2diETZ8zQSDkkW0CCFASdsrRn0Aa4QLcLLtwsQW26sGAWoBtCzcUSpqzH8OkSiO864D8lD6kcPfJqI0gu/7ePFwZNXCMa1ux1ZeO2vXMXgBpEgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716507; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Lzt97Sdzbosd8ah6Nzek9EVLzTq2J3EisHziWG/rcKI=; b=lYuw2BSFmLqWeqcY95RiUGUWljX9CWRLSGEXpAIASkjQRdhO097yPizpQrfvCyQjOOQ1gvVmuT4tfcMk8GYGCuKTl0RBu1odPkgoYp7Tu3aydh/vzI6rGp6SQju8h8/Ve3DPcyffh+9V1VotCBlUyfpOeO3WAzXmJM/ULh2ADR8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716507275431.29405235491697; Mon, 20 Apr 2026 13:21:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv74-00064i-P7; Mon, 20 Apr 2026 16:20:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6r-000609-AS for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6n-0006Na-QK for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 3C000805E6; Mon, 20 Apr 2026 23:20:39 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-ogOWU9hW; Mon, 20 Apr 2026 23:20:38 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716438; bh=Lzt97Sdzbosd8ah6Nzek9EVLzTq2J3EisHziWG/rcKI=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=XR+dSqgGpUIrYdsHOhKA3LfQuQZcKSVFH8+ImEDL0EiVXTLY/vuyTyMC/KVrRHyIw dufSZaQOwfQiv7ajQsQp5+o0GSUtR9KsVX8+4ZTBXpgL7HAgaU94iS7z7HsRvNPg/t o3Dt8FL6Wk7tFPsLjyHzRcOsXiq0QW1IfMDVwpJY= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 02/10] vhost: use consistent naming for backend handlers Date: Mon, 20 Apr 2026 23:20:23 +0300 Message-ID: <20260420202032.714884-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716510554154100 Content-Type: text/plain; charset="utf-8" Most of handlers start from simply .vhost_, except for these four, starting from .vhost_backend_. Let's rename them to be consistent. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost-backend.c | 6 +++--- hw/virtio/vhost-user.c | 8 ++++---- hw/virtio/vhost-vdpa.c | 6 +++--- hw/virtio/vhost.c | 14 +++++++------- include/hw/virtio/vhost-backend.h | 17 ++++++++--------- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index fea88afc39a..caeadd069b0 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -358,9 +358,9 @@ static void vhost_kernel_set_iotlb_callback(struct vhos= t_dev *dev, =20 const VhostOps kernel_ops =3D { .backend_type =3D VHOST_BACKEND_TYPE_KERNEL, - .vhost_backend_init =3D vhost_kernel_init, - .vhost_backend_cleanup =3D vhost_kernel_cleanup, - .vhost_backend_memslots_limit =3D vhost_kernel_memslots_limit, + .vhost_init =3D vhost_kernel_init, + .vhost_cleanup =3D vhost_kernel_cleanup, + .vhost_memslots_limit =3D vhost_kernel_memslots_limit, .vhost_net_set_backend =3D vhost_kernel_net_set_backend, .vhost_scsi_set_endpoint =3D vhost_kernel_scsi_set_endpoint, .vhost_scsi_clear_endpoint =3D vhost_kernel_scsi_clear_endpoint, diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 6978d8ee947..78ffb25d6b1 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -3115,10 +3115,10 @@ void vhost_user_qmp_status(struct vhost_dev *dev, V= irtioStatus *status) =20 const VhostOps user_ops =3D { .backend_type =3D VHOST_BACKEND_TYPE_USER, - .vhost_backend_init =3D vhost_user_backend_init, - .vhost_backend_cleanup =3D vhost_user_backend_cleanup, - .vhost_backend_memslots_limit =3D vhost_user_memslots_limit, - .vhost_backend_no_private_memslots =3D vhost_user_no_private_memsl= ots, + .vhost_init =3D vhost_user_backend_init, + .vhost_cleanup =3D vhost_user_backend_cleanup, + .vhost_memslots_limit =3D vhost_user_memslots_limit, + .vhost_no_private_memslots =3D vhost_user_no_private_memslots, .vhost_set_log_base =3D vhost_user_set_log_base, .vhost_set_mem_table =3D vhost_user_set_mem_table, .vhost_set_vring_addr =3D vhost_user_set_vring_addr, diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 9c7634e2439..93474624898 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1590,8 +1590,8 @@ static bool vhost_vdpa_force_iommu(struct vhost_dev = *dev) =20 const VhostOps vdpa_ops =3D { .backend_type =3D VHOST_BACKEND_TYPE_VDPA, - .vhost_backend_init =3D vhost_vdpa_init, - .vhost_backend_cleanup =3D vhost_vdpa_cleanup, + .vhost_init =3D vhost_vdpa_init, + .vhost_cleanup =3D vhost_vdpa_cleanup, .vhost_set_log_base =3D vhost_vdpa_set_log_base, .vhost_set_vring_addr =3D vhost_vdpa_set_vring_addr, .vhost_set_vring_num =3D vhost_vdpa_set_vring_num, @@ -1602,7 +1602,7 @@ const VhostOps vdpa_ops =3D { .vhost_get_features =3D vhost_vdpa_get_features, .vhost_set_owner =3D vhost_vdpa_set_owner, .vhost_set_vring_endian =3D NULL, - .vhost_backend_memslots_limit =3D vhost_vdpa_memslots_limit, + .vhost_memslots_limit =3D vhost_vdpa_memslots_limit, .vhost_set_mem_table =3D vhost_vdpa_set_mem_table, .vhost_set_features =3D vhost_vdpa_set_features, .vhost_reset_device =3D vhost_vdpa_reset_device, diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 4d42f8bda41..ffd7d404cc7 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -58,7 +58,7 @@ unsigned int vhost_get_max_memslots(void) struct vhost_dev *hdev; =20 QLIST_FOREACH(hdev, &vhost_devices, entry) { - max =3D MIN(max, hdev->vhost_ops->vhost_backend_memslots_limit(hde= v)); + max =3D MIN(max, hdev->vhost_ops->vhost_memslots_limit(hdev)); } return max; } @@ -69,7 +69,7 @@ unsigned int vhost_get_free_memslots(void) struct vhost_dev *hdev; =20 QLIST_FOREACH(hdev, &vhost_devices, entry) { - unsigned int r =3D hdev->vhost_ops->vhost_backend_memslots_limit(h= dev); + unsigned int r =3D hdev->vhost_ops->vhost_memslots_limit(hdev); unsigned int cur_free =3D r - hdev->mem->nregions; =20 if (unlikely(r < hdev->mem->nregions)) { @@ -664,8 +664,8 @@ static bool vhost_section(struct vhost_dev *dev, Memory= RegionSection *section) */ if ((memory_region_get_fd(section->mr) < 0 || !qemu_ram_is_shared(section->mr->ram_block)) && - dev->vhost_ops->vhost_backend_no_private_memslots && - dev->vhost_ops->vhost_backend_no_private_memslots(dev)) { + dev->vhost_ops->vhost_no_private_memslots && + dev->vhost_ops->vhost_no_private_memslots(dev)) { trace_vhost_reject_section(mr->name, 2); return false; } @@ -1674,7 +1674,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, r =3D vhost_set_backend_type(hdev, backend_type); assert(r >=3D 0); =20 - r =3D hdev->vhost_ops->vhost_backend_init(hdev, opaque, errp); + r =3D hdev->vhost_ops->vhost_init(hdev, opaque, errp); if (r < 0) { goto fail; } @@ -1691,7 +1691,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, goto fail; } =20 - limit =3D hdev->vhost_ops->vhost_backend_memslots_limit(hdev); + limit =3D hdev->vhost_ops->vhost_memslots_limit(hdev); if (limit < MEMORY_DEVICES_SAFE_MAX_MEMSLOTS && memory_devices_memslot_auto_decision_active()) { error_setg(errp, "some memory device (like virtio-mem)" @@ -1809,7 +1809,7 @@ void vhost_dev_cleanup(struct vhost_dev *hdev) g_free(hdev->mem); g_free(hdev->mem_sections); if (hdev->vhost_ops) { - hdev->vhost_ops->vhost_backend_cleanup(hdev); + hdev->vhost_ops->vhost_cleanup(hdev); } assert(!hdev->log); =20 diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index 57497e197aa..aab6bf3ef7e 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -51,10 +51,9 @@ struct vhost_scsi_target; struct vhost_iotlb_msg; struct vhost_virtqueue; =20 -typedef int (*vhost_backend_init)(struct vhost_dev *dev, void *opaque, - Error **errp); -typedef int (*vhost_backend_cleanup)(struct vhost_dev *dev); -typedef int (*vhost_backend_memslots_limit)(struct vhost_dev *dev); +typedef int (*vhost_init)(struct vhost_dev *dev, void *opaque, Error **err= p); +typedef int (*vhost_cleanup)(struct vhost_dev *dev); +typedef int (*vhost_memslots_limit)(struct vhost_dev *dev); =20 typedef int (*vhost_net_set_backend_op)(struct vhost_dev *dev, struct vhost_vring_file *file); @@ -131,7 +130,7 @@ typedef int (*vhost_crypto_create_session_op)(struct vh= ost_dev *dev, typedef int (*vhost_crypto_close_session_op)(struct vhost_dev *dev, uint64_t session_id); =20 -typedef bool (*vhost_backend_no_private_memslots_op)(struct vhost_dev *dev= ); +typedef bool (*vhost_no_private_memslots_op)(struct vhost_dev *dev); =20 typedef int (*vhost_get_inflight_fd_op)(struct vhost_dev *dev, uint16_t queue_size, @@ -166,10 +165,10 @@ typedef int (*vhost_check_device_state_op)(struct vho= st_dev *dev, Error **errp); =20 typedef struct VhostOps { VhostBackendType backend_type; - vhost_backend_init vhost_backend_init; - vhost_backend_cleanup vhost_backend_cleanup; - vhost_backend_memslots_limit vhost_backend_memslots_limit; - vhost_backend_no_private_memslots_op vhost_backend_no_private_memslots; + vhost_init vhost_init; + vhost_cleanup vhost_cleanup; + vhost_memslots_limit vhost_memslots_limit; + vhost_no_private_memslots_op vhost_no_private_memslots; vhost_net_set_backend_op vhost_net_set_backend; vhost_net_set_mtu_op vhost_net_set_mtu; vhost_scsi_set_endpoint_op vhost_scsi_set_endpoint; --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716493; cv=none; d=zohomail.com; s=zohoarc; b=YxcLKuJPUlR5FAnF5WH3GlfCSYwSZc4icRIg1UaFLB4rQsMkdChByMohiKnhyJkgZ9YL/J9b0SOJusX/qUJyyirObTbg6Jfc3bOiPcEPn/tkPzZWq9dO3GFlu85DVCINkvJd9Nlh2iID1olo9vQFU6f7GvfQEcoJHW/85DhtFwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716493; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AdsEQBGwBfFwazXQMva35ewY0KaErdEqggC3bArJp8o=; b=dOg52h8AenTwEU77gvF+qxYI/LTwUhlWzH2w+oyC0CbWuOTTCQ43M41zA5g9DtKtrqHC10U4QeWJ4L9Pb5MbAEB1BjO3Xb59mA6NjHCzofomqjGWkBwa+retAEyENN5ks3U7ZJxeLQmS+F518KihuGAORNnsgx7QGAcavPGPHYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716492929621.6563329322686; Mon, 20 Apr 2026 13:21:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv6s-00061K-Uw; Mon, 20 Apr 2026 16:20:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6r-000605-6A for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6n-0006OB-Pz for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:44 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 76E14C01B9; Mon, 20 Apr 2026 23:20:40 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-PLmp6qr4; Mon, 20 Apr 2026 23:20:39 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716439; bh=AdsEQBGwBfFwazXQMva35ewY0KaErdEqggC3bArJp8o=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=FwiB+2VcqbqwsvBO23y46V8eCv8rUBrbKp6AXXnOvKpC+Ha5gUJiLL1tqJZkbib6f W/Xuy3p4yJ/h8WuDQ6KUh9+e9pdPFQ/RXs+ZiY5ECja/6SLNrPbJMQQAPFxMzgo1Ro g2DuDpXcvkIoTS1MBUdjMKaC8fxHRYABfEyVs8/M= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 03/10] vhost: rename vhost-backend.c to vhost-kernel.c Date: Mon, 20 Apr 2026 23:20:24 +0300 Message-ID: <20260420202032.714884-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716497116158500 Content-Type: text/plain; charset="utf-8" This file is totally about vhost-kernel implementation, not generic code. Let's finally give it corresponding name. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/meson.build | 2 +- hw/virtio/{vhost-backend.c =3D> vhost-kernel.c} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename hw/virtio/{vhost-backend.c =3D> vhost-kernel.c} (99%) diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index adc3a4f748a..fbc1b1ad121 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -14,7 +14,7 @@ system_virtio_ss.add(files('virtio-qmp.c')) =20 if have_vhost system_virtio_ss.add(files('vhost.c')) - system_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) + system_virtio_ss.add(files('vhost-kernel.c', 'vhost-iova-tree.c')) if have_vhost_user system_virtio_ss.add(files('vhost-user.c')) system_virtio_ss.add(files('vhost-user-base.c')) diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-kernel.c similarity index 99% rename from hw/virtio/vhost-backend.c rename to hw/virtio/vhost-kernel.c index caeadd069b0..3390b48c6f1 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-kernel.c @@ -1,5 +1,5 @@ /* - * vhost-backend + * vhost-kernel * * Copyright (c) 2013 Virtual Open Systems Sarl. * --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716491; cv=none; d=zohomail.com; s=zohoarc; b=ir2AfyeYc26n3WIpBiSQTIVO2yvPp2ISwcLFbOdlZFtLmyyRqBr13XdxB1o1MlALLzTpPaonpamJJsmRYb9THcfXGq6sOLaVH4kGHvFCKyUBMtAYNid2ITCzGpZX8wuvoKntuyXiKO1PrgK5cp9NRW9q0poMQcMg8ia3c8g0Tg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716491; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0FTFK55cw3rK/QycYXfqJNoLrOAw3LbH2p8qWtc8CYM=; b=m7p9OZa7O37JRkMUD26PSGk1KhH93uJX4ZG89D/pBF3RS+ghJ1imhsCTx6BS56L1XruQVcJbN0NdG81MeEqSOyKFDXLQCeS5njyH8JWFX4Z68lMgokhOb52E16i07ccp5XRl8ko9pEcfZOowGiqS1Kw6gsN0OIS4bp6GHk050AE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716491233429.1314215543795; Mon, 20 Apr 2026 13:21:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv6y-000621-3o; Mon, 20 Apr 2026 16:20:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6r-00060f-Sw for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6q-0006OT-0B for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id A9BC6C01BB; Mon, 20 Apr 2026 23:20:41 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-fKAZa2TE; Mon, 20 Apr 2026 23:20:40 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716441; bh=0FTFK55cw3rK/QycYXfqJNoLrOAw3LbH2p8qWtc8CYM=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=G0JUjw7kqvMLw1o3CkAOdS12dnn7vMF+lUP2ln/cNBJ7UAhXA5M5N9AzLwHOPrx/q PKfYEUrkRgp+wEs0FSA2BPmjjcutILQF2IeAZkt+8jtjbpJnUGad8PW8Kqb0oFg96Q MHCjPO0E7zXfqCga2/Zi+4AB+N4lh1N/5vhmEHFY= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 04/10] vhost: replace .vhost_vq_get_addr() with .vhost_phys_vring_addr() Date: Mon, 20 Apr 2026 23:20:25 +0300 Message-ID: <20260420202032.714884-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716495671154100 Content-Type: text/plain; charset="utf-8" Make a simper handler to consolidate the logic in one place. That helps further changes. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost-vdpa.c | 13 +++---------- hw/virtio/vhost.c | 12 ++++++------ include/hw/virtio/vhost-backend.h | 6 ++---- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 93474624898..9e1aa4860a8 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1571,16 +1571,9 @@ static int vhost_vdpa_set_owner(struct vhost_dev *de= v) return 0; } =20 -static int vhost_vdpa_vq_get_addr(struct vhost_dev *dev, - struct vhost_vring_addr *addr, struct vhost_virtqueue = *vq) +static bool vhost_vdpa_phys_vring_addr(struct vhost_dev *dev) { - assert(dev->vhost_ops->backend_type =3D=3D VHOST_BACKEND_TYPE_VDPA); - addr->desc_user_addr =3D (uint64_t)(unsigned long)vq->desc_phys; - addr->avail_user_addr =3D (uint64_t)(unsigned long)vq->avail_phys; - addr->used_user_addr =3D (uint64_t)(unsigned long)vq->used_phys; - trace_vhost_vdpa_vq_get_addr(dev, vq, addr->desc_user_addr, - addr->avail_user_addr, addr->used_user_ad= dr); - return 0; + return true; } =20 static bool vhost_vdpa_force_iommu(struct vhost_dev *dev) @@ -1617,7 +1610,7 @@ const VhostOps vdpa_ops =3D { .vhost_send_device_iotlb_msg =3D NULL, .vhost_dev_start =3D vhost_vdpa_dev_start, .vhost_get_device_id =3D vhost_vdpa_get_device_id, - .vhost_vq_get_addr =3D vhost_vdpa_vq_get_addr, + .vhost_phys_vring_addr =3D vhost_vdpa_phys_vring_addr, .vhost_force_iommu =3D vhost_vdpa_force_iommu, .vhost_set_config_call =3D vhost_vdpa_set_config_call, .vhost_reset_status =3D vhost_vdpa_reset_status, diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index ffd7d404cc7..564a5d46982 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1093,16 +1093,16 @@ static int vhost_virtqueue_set_addr(struct vhost_de= v *dev, struct vhost_virtqueue *vq, unsigned idx, bool enable_log) { + bool phys =3D dev->vhost_ops->vhost_phys_vring_addr && + dev->vhost_ops->vhost_phys_vring_addr(dev); struct vhost_vring_addr addr; int r; memset(&addr, 0, sizeof(struct vhost_vring_addr)); =20 - if (dev->vhost_ops->vhost_vq_get_addr) { - r =3D dev->vhost_ops->vhost_vq_get_addr(dev, &addr, vq); - if (r < 0) { - VHOST_OPS_DEBUG(r, "vhost_vq_get_addr failed"); - return r; - } + if (phys) { + addr.desc_user_addr =3D (uint64_t)(unsigned long)vq->desc_phys; + addr.avail_user_addr =3D (uint64_t)(unsigned long)vq->avail_phys; + addr.used_user_addr =3D (uint64_t)(unsigned long)vq->used_phys; } else { addr.desc_user_addr =3D (uint64_t)(unsigned long)vq->desc; addr.avail_user_addr =3D (uint64_t)(unsigned long)vq->avail; diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index aab6bf3ef7e..7cc3bb54418 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -141,9 +141,7 @@ typedef int (*vhost_set_inflight_fd_op)(struct vhost_de= v *dev, =20 typedef int (*vhost_dev_start_op)(struct vhost_dev *dev, bool started); =20 -typedef int (*vhost_vq_get_addr_op)(struct vhost_dev *dev, - struct vhost_vring_addr *addr, - struct vhost_virtqueue *vq); +typedef bool (*vhost_phys_vring_addr_op)(struct vhost_dev *dev); =20 typedef int (*vhost_get_device_id_op)(struct vhost_dev *dev, uint32_t *dev= _id); =20 @@ -211,7 +209,7 @@ typedef struct VhostOps { vhost_get_inflight_fd_op vhost_get_inflight_fd; vhost_set_inflight_fd_op vhost_set_inflight_fd; vhost_dev_start_op vhost_dev_start; - vhost_vq_get_addr_op vhost_vq_get_addr; + vhost_phys_vring_addr_op vhost_phys_vring_addr; vhost_get_device_id_op vhost_get_device_id; vhost_force_iommu_op vhost_force_iommu; vhost_set_config_call_op vhost_set_config_call; --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716519; cv=none; d=zohomail.com; s=zohoarc; b=OjwMgbysYpDV7A8KIikCrsBg/r+RXPSRCW0mFQxzissvF1TW9yRrvma5ozVdYZ+pKHgclTXZxRtoVL8HwuJNXLRIBxmck0j9FWV0ENneHdYvgEEaUCTttX2Twxr1HjB41Z192sRdw9aYclGsF+n3bTLaaXIc3nIniiEsHLBi8jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716519; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=y2itUKXedtugRUfBxJQ6CsdLWnW9+GVj1qpys57wb6k=; b=TLhmGoQHMX+LyNQS++b1U6L+GdNjmyp1xN4Dg5oVEubE7JDd8vACHwwoWMbAqwWfQoBHxCcmqXDFTxASe4XcaOMwVRudWBIy/wzzFvLMAboR5lFFZBxI/4Od39LflqaMD1CepKQm5O3yMQUomp+m1TrFCOC1rsOkE9OT6sJsaZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716519708581.0926909483176; Mon, 20 Apr 2026 13:21:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv6t-00061R-Pv; Mon, 20 Apr 2026 16:20:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6s-00060j-5j for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:46 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6q-0006OZ-88 for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:45 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id DBB5BC01BD; Mon, 20 Apr 2026 23:20:42 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-ya10Q2Iq; Mon, 20 Apr 2026 23:20:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716442; bh=y2itUKXedtugRUfBxJQ6CsdLWnW9+GVj1qpys57wb6k=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=Oc+aBoJ63sLLiQUKAjJJdZAcgnb6fR2XC6HLtO96gLmkhjHQnscGeC8ErAFutSs75 lLlr+m/a4wi74hinEdeisEaHj/VilGix1AblPnxvtK/1P7KOEHNubqejjbBA0jVCCV dbDX1GBNb6vOt8zS2FdDgL3QP+KNJ//rrwk5UrKg= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 05/10] vhost: simplify vhost_memory_map() and vhost_memory_unmap() Date: Mon, 20 Apr 2026 23:20:26 +0300 Message-ID: <20260420202032.714884-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716520398158500 Content-Type: text/plain; charset="utf-8" Make these functions simple wrappers around address_space_map() and address_space_unmap(). Move IOMMU handling logic one layer up to the callers. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 564a5d46982..cc083572f40 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -456,21 +456,17 @@ static inline void vhost_dev_log_resize(struct vhost_= dev *dev, uint64_t size) static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, hwaddr len, bool is_write) { - if (!vhost_dev_has_iommu(dev)) { - hwaddr mapped_len =3D len; - void *res =3D address_space_map(dev->vdev->dma_as, addr, &mapped_l= en, - is_write, MEMTXATTRS_UNSPECIFIED); - if (!res) { - return NULL; - } - if (len !=3D mapped_len) { - address_space_unmap(dev->vdev->dma_as, res, mapped_len, 0, 0); - return NULL; - } - return res; - } else { - return (void *)(uintptr_t)addr; + hwaddr mapped_len =3D len; + void *res =3D address_space_map(dev->vdev->dma_as, addr, &mapped_len, + is_write, MEMTXATTRS_UNSPECIFIED); + if (!res) { + return NULL; + } + if (len !=3D mapped_len) { + address_space_unmap(dev->vdev->dma_as, res, mapped_len, 0, 0); + return NULL; } + return res; } =20 static void vhost_memory_unmap(struct vhost_dev *dev, void **buffer, @@ -481,17 +477,18 @@ static void vhost_memory_unmap(struct vhost_dev *dev,= void **buffer, return; } =20 - if (!vhost_dev_has_iommu(dev)) { - address_space_unmap(dev->vdev->dma_as, *buffer, len, is_write, - access_len); - } - + address_space_unmap(dev->vdev->dma_as, *buffer, len, is_write, + access_len); *buffer =3D NULL; } =20 static void vhost_vrings_unmap(struct vhost_dev *dev, struct vhost_virtqueue *vq, bool touched) { + if (vhost_dev_has_iommu(dev)) { + return; + } + vhost_memory_unmap(dev, &vq->used, vq->used_size, touched, touched ? vq->used_size : 0); vhost_memory_unmap(dev, &vq->avail, vq->avail_size, 0, @@ -519,6 +516,14 @@ static int vhost_vrings_map(struct vhost_dev *dev, /* Queue might not be ready for start */ return 0; } + + if (vhost_dev_has_iommu(dev)) { + vq->desc =3D (void *)(uintptr_t)vq->desc_phys; + vq->avail =3D (void *)(uintptr_t)vq->avail_phys; + vq->used =3D (void *)(uintptr_t)vq->used_phys; + return 1; + } + vq->desc =3D vhost_memory_map(dev, vq->desc_phys, vq->desc_size, false= ); if (!vq->desc) { goto fail; --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716513; cv=none; d=zohomail.com; s=zohoarc; b=blOHsBlSrJX4kCBuFNG0FWQYgvnYXc89Gy6ePsBVA4JVNK95MmvdiOag8FVfDi4F2jfG0Rwf/lA5oRktMYhYk6fE4ANnJVUFb/wvuCSYSHRwx/SW3KadSXOSZnFXTWQf1bx8AKsIZyImRbCUu4AjfddVxSoJyxHxu+U5Eqsn1AE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716513; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lPTm4lB1KMVIObdOQC42DUGkZOA7pP1fBuHvzYw7yJ8=; b=AynE5/KpCdDZz8OjaTNw9d01ZFPtGiTNvbSH9ZjzwhlvGsm5QmGKdWy6Qby4ELWoabCsvyM/68a/U/LQq3t6UrP3lx6TKp8anUM2CqsFrzKl4OXS+dh4kuvkluUGYHQP1a6Xa/b53GuyEx9KDQCb2okSSt3lyhhRloSrMc4ETek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716513742308.1278340712629; Mon, 20 Apr 2026 13:21:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv74-00064D-1W; Mon, 20 Apr 2026 16:20:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6u-00061q-DA for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:48 -0400 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6s-0006PC-M6 for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:48 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 506098065E; Mon, 20 Apr 2026 23:20:44 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-5C25wX48; Mon, 20 Apr 2026 23:20:43 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716443; bh=lPTm4lB1KMVIObdOQC42DUGkZOA7pP1fBuHvzYw7yJ8=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=ZHKU8b3MH1jNXp3ZXrAr4+jEjHK1A3nlyzK8ihyzGZEull7QfnjMwwnm5MSagvABZ 8ZB3khvjBsXK+kvNaQPTEX9eMM/oQ+lYC71ql7+/RPyOIyljrGFxL9e+UUchCcqj6Q Kum86iGkIlN0Xv+MXZKFbXG3Gs5Z0TTi9/hvYmds= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru, Eric Blake , Markus Armbruster Subject: [PATCH v2 06/10] qapi: remove user addresses from x-query-virtio-vhost-queue-status Date: Mon, 20 Apr 2026 23:20:27 +0300 Message-ID: <20260420202032.714884-7-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716514742154100 Content-Type: text/plain; charset="utf-8" Semantics of these (actually, internal) fields is not simple, they may contain either virtual or physical addresses. We are going to change this to simplify the logic. Keeping this logic only for unstable info command seems too much. Changing semantics of info fields doesn't seem to make real sense too. So, let's just drop them. We can dot it, as command is experimental. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/virtio-hmp-cmds.c | 3 --- hw/virtio/virtio-qmp.c | 3 --- qapi/virtio.json | 15 --------------- 3 files changed, 21 deletions(-) diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c index 4bf9a3109d4..a91bb7dbeda 100644 --- a/hw/virtio/virtio-hmp-cmds.c +++ b/hw/virtio/virtio-hmp-cmds.c @@ -203,15 +203,12 @@ void hmp_vhost_queue_status(Monitor *mon, const QDict= *qdict) monitor_printf(mon, " call: %"PRId64"\n", s->call); monitor_printf(mon, " VRing:\n"); monitor_printf(mon, " num: %"PRId64"\n", s->num); - monitor_printf(mon, " desc: 0x%016"PRIx64"\n", s->desc); monitor_printf(mon, " desc_phys: 0x%016"PRIx64"\n", s->desc_phys); monitor_printf(mon, " desc_size: %"PRId32"\n", s->desc_size); - monitor_printf(mon, " avail: 0x%016"PRIx64"\n", s->avail); monitor_printf(mon, " avail_phys: 0x%016"PRIx64"\n", s->avail_phys); monitor_printf(mon, " avail_size: %"PRId32"\n", s->avail_size); - monitor_printf(mon, " used: 0x%016"PRIx64"\n", s->used); monitor_printf(mon, " used_phys: 0x%016"PRIx64"\n", s->used_phys); monitor_printf(mon, " used_size: %"PRId32"\n", s->used_size); diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c index 51e3a42c4c4..ae9be0a00f4 100644 --- a/hw/virtio/virtio-qmp.c +++ b/hw/virtio/virtio-qmp.c @@ -794,9 +794,6 @@ VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_st= atus(const char *path, status->name =3D g_strdup(vdev->name); status->kick =3D hdev->vqs[queue].kick; status->call =3D hdev->vqs[queue].call; - status->desc =3D (uintptr_t)hdev->vqs[queue].desc; - status->avail =3D (uintptr_t)hdev->vqs[queue].avail; - status->used =3D (uintptr_t)hdev->vqs[queue].used; status->num =3D hdev->vqs[queue].num; status->desc_phys =3D hdev->vqs[queue].desc_phys; status->desc_size =3D hdev->vqs[queue].desc_size; diff --git a/qapi/virtio.json b/qapi/virtio.json index 671f1ad793c..1fc4e38a44d 100644 --- a/qapi/virtio.json +++ b/qapi/virtio.json @@ -650,12 +650,6 @@ # # @call: vhost_virtqueue call # -# @desc: vhost_virtqueue desc -# -# @avail: vhost_virtqueue avail -# -# @used: vhost_virtqueue used -# # @num: vhost_virtqueue num # # @desc-phys: vhost_virtqueue desc_phys (descriptor area physical @@ -678,9 +672,6 @@ 'data': { 'name': 'str', 'kick': 'int', 'call': 'int', - 'desc': 'uint64', - 'avail': 'uint64', - 'used': 'uint64', 'num': 'int', 'desc-phys': 'uint64', 'desc-size': 'uint32', @@ -720,12 +711,9 @@ # "avail-size": 2054, # "desc-size": 16384, # "used-size": 8198, -# "desc": 140141447430144, # "num": 1024, # "call": 0, -# "avail": 140141447446528, # "desc-phys": 5216108544, -# "used": 140141447448640, # "kick": 0 # } # } @@ -744,12 +732,9 @@ # "avail-size": 262, # "desc-size": 2048, # "used-size": 1030, -# "desc": 140141413580800, # "num": 128, # "call": 0, -# "avail": 140141413582848, # "desc-phys": 5182259200, -# "used": 140141413583168, # "kick": 0 # } # } --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716530; cv=none; d=zohomail.com; s=zohoarc; b=RB0D5VQK8UkKWIxVIVQxSW7KIJEOopif1zfEefl7SR+Mm4ihU6zL0m30kMoT9346qTiypfyvf+iTvBS8w+CMxVrF6YAQKbGEJ2nulLuLa7lEEvp7OVfcZD6nekpGrcazJGMIt3d8iZi/fp0Uzs1g/lwG4IFDtbeXpBjdUP1SNOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716530; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=64+skN4vnGayFidRB2LVJGvoXm0N9ZAGQLAilmne80Y=; b=jtuTYnRVLQWIRUC9vVvpxJMaw+HOxp4bRZ3Ql6C6yBddgebippSA2DY8FMYi3XAHLy+zoCre5WADhUxZ1lqxfxavCTtT88QOGblayx4MUB28rX2qH9SNZxo8VIblTARRR8xe7vDA5d1tatijYbnrJkjBPBWzoAF7q38zd06bOX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716529531838.5276757170406; Mon, 20 Apr 2026 13:22:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv76-00065R-FA; Mon, 20 Apr 2026 16:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6v-00061w-TG for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:50 -0400 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6u-0006Pi-5m for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:49 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 87DA980675; Mon, 20 Apr 2026 23:20:45 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-YFD9iBMD; Mon, 20 Apr 2026 23:20:44 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716444; bh=64+skN4vnGayFidRB2LVJGvoXm0N9ZAGQLAilmne80Y=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=x03BX+IAOhDhlQ++TT8lr+NhEVnfIfj04nWHQGTcI63Fqk+rDeOCknytXLRI9e5fD ly0N4gt5MM+nbTZZRAN4/HuTJ/x5liAK42jBPG4lY5t/ixO1IB1uHNKFLYFVwQInI9 gX6YXFgG2LjpqmYkkKPgJFPFr67D3ojMfP9CKy7I= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 07/10] vhost: stop reusing vq->desc (and friends) to store physical address Date: Mon, 20 Apr 2026 23:20:28 +0300 Message-ID: <20260420202032.714884-8-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716532149158500 Content-Type: text/plain; charset="utf-8" Remove the hack of storing physical addresses in vq->desc/avail/used pointers when IOMMU is present. Instead, handle this case directly in vhost_virtqueue_set_addr() by checking for IOMMU presence. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index cc083572f40..6bb6b07e190 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -518,9 +518,6 @@ static int vhost_vrings_map(struct vhost_dev *dev, } =20 if (vhost_dev_has_iommu(dev)) { - vq->desc =3D (void *)(uintptr_t)vq->desc_phys; - vq->avail =3D (void *)(uintptr_t)vq->avail_phys; - vq->used =3D (void *)(uintptr_t)vq->used_phys; return 1; } =20 @@ -1104,7 +1101,7 @@ static int vhost_virtqueue_set_addr(struct vhost_dev = *dev, int r; memset(&addr, 0, sizeof(struct vhost_vring_addr)); =20 - if (phys) { + if (phys || vhost_dev_has_iommu(dev)) { addr.desc_user_addr =3D (uint64_t)(unsigned long)vq->desc_phys; addr.avail_user_addr =3D (uint64_t)(unsigned long)vq->avail_phys; addr.used_user_addr =3D (uint64_t)(unsigned long)vq->used_phys; --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716506; cv=none; d=zohomail.com; s=zohoarc; b=lbT81R7xHdvniMukSDv+ktuLdLvmkzZGnIf3HO14MkFSsRfZ9S/lFmC71qpJoRhTrRMLvlKaH0/Bfj5oklVxLlQbvHFiAu95UDSrvoiEIAnAl9eVeEUqpJbbUy3do+/lNsQSqyRzpDj/e1HzQb2lhBoyw9vSzFwAQMA5mNvd8V4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716506; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/0L3rgqe+s3MH2/dJRD+Myije+YjKlYqIVRA1C65utQ=; b=Oi3APGXfK0qScheRmIringj46NTbxtsNWSwoEkgn2DpWWjtNRn4/jJnsJRrHsOzqM/YHXrPaVNeNIlqnzRGG+/+CN+u3T+jUDybaCXGTs+sV+Z1CGlcucxo7TGrPdL4VGKFZYma9i0cc1GsopzTqCkIncz3kRhLFHujCI2ZsNDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177671650636434.82554294006502; Mon, 20 Apr 2026 13:21:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv78-00066o-QC; Mon, 20 Apr 2026 16:21:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6w-00062y-VD for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:52 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6v-0006Pv-1E for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:50 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id B1048C01A6; Mon, 20 Apr 2026 23:20:46 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-UmE5yTsu; Mon, 20 Apr 2026 23:20:46 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716446; bh=/0L3rgqe+s3MH2/dJRD+Myije+YjKlYqIVRA1C65utQ=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=eBhZhPcWSfBfmDH3JGg3qfqyy0TCMFxJSrckjfxxglpEWalMn/OgrxeEPLFzBVmJj MgJS19jNUR5ctnRr+/W3RZNX++RHYt/abbWfulnrkwrEY2CtRAYb+xhmxUEEIAVLD3 B9edHPMOr4ddTD38E3hWjdmNMSSHsjaqLxBnw9MU= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 08/10] vhost: rename vring pointer fields to reflect user addresses Date: Mon, 20 Apr 2026 23:20:29 +0300 Message-ID: <20260420202032.714884-9-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716508823154100 Content-Type: text/plain; charset="utf-8" Rename vq->desc/avail/used to vq->desc_user/avail_user/used_user to clearly indicate these fields contain user space addresses, not physical addresses. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost.c | 37 +++++++++++++++++++------------------ include/hw/virtio/vhost.h | 6 +++--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 6bb6b07e190..e3d452a7637 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -489,11 +489,11 @@ static void vhost_vrings_unmap(struct vhost_dev *dev, return; } =20 - vhost_memory_unmap(dev, &vq->used, vq->used_size, touched, + vhost_memory_unmap(dev, &vq->used_user, vq->used_size, touched, touched ? vq->used_size : 0); - vhost_memory_unmap(dev, &vq->avail, vq->avail_size, 0, + vhost_memory_unmap(dev, &vq->avail_user, vq->avail_size, 0, touched ? vq->avail_size : 0); - vhost_memory_unmap(dev, &vq->desc, vq->desc_size, 0, + vhost_memory_unmap(dev, &vq->desc_user, vq->desc_size, 0, touched ? vq->desc_size : 0); } =20 @@ -504,13 +504,13 @@ static int vhost_vrings_map(struct vhost_dev *dev, { vq->desc_size =3D virtio_queue_get_desc_size(vdev, idx); vq->desc_phys =3D virtio_queue_get_desc_addr(vdev, idx); - vq->desc =3D NULL; + vq->desc_user =3D NULL; vq->avail_size =3D virtio_queue_get_avail_size(vdev, idx); vq->avail_phys =3D virtio_queue_get_avail_addr(vdev, idx); - vq->avail =3D NULL; + vq->avail_user =3D NULL; vq->used_size =3D virtio_queue_get_used_size(vdev, idx); vq->used_phys =3D virtio_queue_get_used_addr(vdev, idx); - vq->used =3D NULL; + vq->used_user =3D NULL; =20 if (vq->desc_phys =3D=3D 0) { /* Queue might not be ready for start */ @@ -521,16 +521,17 @@ static int vhost_vrings_map(struct vhost_dev *dev, return 1; } =20 - vq->desc =3D vhost_memory_map(dev, vq->desc_phys, vq->desc_size, false= ); - if (!vq->desc) { + vq->desc_user =3D vhost_memory_map(dev, vq->desc_phys, vq->desc_size, = false); + if (!vq->desc_user) { goto fail; } - vq->avail =3D vhost_memory_map(dev, vq->avail_phys, vq->avail_size, fa= lse); - if (!vq->avail) { + vq->avail_user =3D vhost_memory_map(dev, vq->avail_phys, vq->avail_siz= e, + false); + if (!vq->avail_user) { goto fail; } - vq->used =3D vhost_memory_map(dev, vq->used_phys, vq->used_size, true); - if (!vq->used) { + vq->used_user =3D vhost_memory_map(dev, vq->used_phys, vq->used_size, = true); + if (!vq->used_user) { goto fail; } =20 @@ -594,7 +595,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev = *dev, =20 j =3D 0; r =3D vhost_verify_ring_part_mapping( - vq->desc, vq->desc_phys, vq->desc_size, + vq->desc_user, vq->desc_phys, vq->desc_size, reg_hva, reg_gpa, reg_size); if (r) { break; @@ -602,7 +603,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev = *dev, =20 j++; r =3D vhost_verify_ring_part_mapping( - vq->avail, vq->avail_phys, vq->avail_size, + vq->avail_user, vq->avail_phys, vq->avail_size, reg_hva, reg_gpa, reg_size); if (r) { break; @@ -610,7 +611,7 @@ static int vhost_verify_ring_mappings(struct vhost_dev = *dev, =20 j++; r =3D vhost_verify_ring_part_mapping( - vq->used, vq->used_phys, vq->used_size, + vq->used_user, vq->used_phys, vq->used_size, reg_hva, reg_gpa, reg_size); if (r) { break; @@ -1106,9 +1107,9 @@ static int vhost_virtqueue_set_addr(struct vhost_dev = *dev, addr.avail_user_addr =3D (uint64_t)(unsigned long)vq->avail_phys; addr.used_user_addr =3D (uint64_t)(unsigned long)vq->used_phys; } else { - addr.desc_user_addr =3D (uint64_t)(unsigned long)vq->desc; - addr.avail_user_addr =3D (uint64_t)(unsigned long)vq->avail; - addr.used_user_addr =3D (uint64_t)(unsigned long)vq->used; + addr.desc_user_addr =3D (uint64_t)(unsigned long)vq->desc_user; + addr.avail_user_addr =3D (uint64_t)(unsigned long)vq->avail_user; + addr.used_user_addr =3D (uint64_t)(unsigned long)vq->used_user; } addr.index =3D idx; addr.log_guest_addr =3D vq->used_phys; diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index b292e9f0fed..684bafcaadd 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -24,9 +24,9 @@ struct vhost_inflight { struct vhost_virtqueue { int kick; int call; - void *desc; - void *avail; - void *used; + void *desc_user; + void *avail_user; + void *used_user; int num; unsigned long long desc_phys; unsigned desc_size; --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716505; cv=none; d=zohomail.com; s=zohoarc; b=AhKUfM3Znk2B6IXthUV5abpvTi+Jo8XTKZtue3fChpFuFsaHZN/NGZZlkZxSwAdegBwsLzh6i3cCGvF2HU7pEvRkqV348pLqfXRrPltxTRxUa37QFYOJIpNFhfhzuAmxpXXBEz984OEozR/8Tqkammx0Ic2a0KAydqKpcA3I7co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716505; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+5Ir8ta7fWrDRTJr8RmvUcBm5Hy7vJgrEXmOl04iJcw=; b=RJYnxzAu7YH9PpN8RUfsvlpB0Vya3yygBSd4ZKALiw0rlQ5zYGzQVZCX541ERNiulLTuDBXHd7CfqGI0fNG+pA4iFIqKO7lfG9OczzUyez3OSajykscpQLi5nPcdspxjQ21YniC5X/Oo4M9yLqjx4ZXCEtGoN58v4pk8NuNsqgc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716504506582.8339503126615; Mon, 20 Apr 2026 13:21:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv79-000677-6S; Mon, 20 Apr 2026 16:21:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6x-00062z-2X for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:52 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6v-0006Q1-6T for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:50 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id E76ED8077E; Mon, 20 Apr 2026 23:20:47 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-NWPniVVL; Mon, 20 Apr 2026 23:20:47 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716447; bh=+5Ir8ta7fWrDRTJr8RmvUcBm5Hy7vJgrEXmOl04iJcw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=wYgb7lTbQMlJGhPPBEUDaCsNtVz3EQ35yUx4YNaIwqst7ePNhLabhqMubXQcReOX8 zevmt00+J7kfLqAiIqreiSNTgj6md0HqHCqYdOy4s3CgH7CXTIiH99W8ToVk4afTfu R5woBc2y6zg333ADJNPmJkDPkAL44FAeEJV7Z2ww= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH v2 09/10] vhost: add .vhost_phys_iotlb_msg() handler Date: Mon, 20 Apr 2026 23:20:30 +0300 Message-ID: <20260420202032.714884-10-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716508466158500 Content-Type: text/plain; charset="utf-8" Allow backends to chose, which addr to put into vhost_iotlb_msg: user or physical. To be used in further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/virtio/vhost.c | 11 ++++++++--- include/hw/virtio/vhost-backend.h | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index e3d452a7637..af41841b529 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -920,14 +920,18 @@ static void vhost_region_addnop(MemoryListener *liste= ner, } =20 static int vhost_update_device_iotlb(struct vhost_dev *dev, - uint64_t iova, uint64_t uaddr, + uint64_t iova, + uint64_t paddr, + uint64_t uaddr, uint64_t len, IOMMUAccessFlags perm) { + bool phys =3D dev->vhost_ops->vhost_phys_iotlb_msg && + dev->vhost_ops->vhost_phys_iotlb_msg(dev); struct vhost_iotlb_msg imsg; =20 imsg.iova =3D iova; - imsg.uaddr =3D uaddr; + imsg.uaddr =3D phys ? paddr : uaddr; imsg.size =3D len; imsg.type =3D VHOST_IOTLB_UPDATE; =20 @@ -1385,7 +1389,8 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, ui= nt64_t iova, int write) len =3D MIN(iotlb.addr_mask + 1, len); iova =3D iova & ~iotlb.addr_mask; =20 - ret =3D vhost_update_device_iotlb(dev, iova, uaddr, len, iotlb.per= m); + ret =3D vhost_update_device_iotlb(dev, iova, iotlb.translated_addr= , uaddr, + len, iotlb.perm); if (ret) { trace_vhost_iotlb_miss(dev, 4); error_report("Fail to update device iotlb"); diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index 7cc3bb54418..00881a0bd44 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -143,6 +143,8 @@ typedef int (*vhost_dev_start_op)(struct vhost_dev *dev= , bool started); =20 typedef bool (*vhost_phys_vring_addr_op)(struct vhost_dev *dev); =20 +typedef bool (*vhost_phys_iotlb_msg_op)(struct vhost_dev *dev); + typedef int (*vhost_get_device_id_op)(struct vhost_dev *dev, uint32_t *dev= _id); =20 typedef bool (*vhost_force_iommu_op)(struct vhost_dev *dev); @@ -210,6 +212,7 @@ typedef struct VhostOps { vhost_set_inflight_fd_op vhost_set_inflight_fd; vhost_dev_start_op vhost_dev_start; vhost_phys_vring_addr_op vhost_phys_vring_addr; + vhost_phys_iotlb_msg_op vhost_phys_iotlb_msg; vhost_get_device_id_op vhost_get_device_id; vhost_force_iommu_op vhost_force_iommu; vhost_set_config_call_op vhost_set_config_call; --=20 2.52.0 From nobody Tue Apr 21 14:38:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1776716523; cv=none; d=zohomail.com; s=zohoarc; b=DSnjz2oHtjVq9GrI9aiy82YQod+eRonHKaun5BvtbpWSRfIZWrEzhMqUEIBpvXpPlmYxL4q2jYSFTxUi9pwQAxsuyy6jwf6pxMVE6909PBLMevRzm3wh060KVkFffoRVNMzxqA2yKRqWhMmHWHQMUr9hJCPdkFYFOkq/xV96xmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776716523; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=koxXe7SjW7IxzgK2obLjAe99mFTGm2Jl9M9elMSN1Fk=; b=ipqfOwF3YTrvv6+XhaWYsQ3hvD01t76cSDXLgO9Vx1fEwdsL9rZEz9fcg8ruAUTTbQNbeTP5BHs+HHpN4iTqJsxojyUCnR4+M8jk6xJvwdYoAyaxN65rDMwfzVNXRsu+SJBGkY1lFCY5SGYfxuchajRJ+q0pYnLkbVcVyksEmdI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776716523405244.25769854591977; Mon, 20 Apr 2026 13:22:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wEv76-00065a-Jy; Mon, 20 Apr 2026 16:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv72-000646-NJ for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:57 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wEv6y-0006QH-Ox for qemu-devel@nongnu.org; Mon, 20 Apr 2026 16:20:56 -0400 Received: from mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c00c:0:640:e0de:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 93BEBC01B9; Mon, 20 Apr 2026 23:20:49 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:54b::1:34]) by mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net (smtpcorp) with ESMTPSA id XKYwe10MOSw0-XUxjBteE; Mon, 20 Apr 2026 23:20:48 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1776716448; bh=koxXe7SjW7IxzgK2obLjAe99mFTGm2Jl9M9elMSN1Fk=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=p3eith/KkV7jaGDkzSaBBcSBbmsMwPtU5zcsQn6WNRZPi2oD2zD6GT4oxfS+anxLW nziD0ySP8gWLITLGiprGVbNSO3/oIOkgGgtWNJ7ddK5wgvB/OwgzWujWumFRr8yzut QI3hplKdqSDpbE6zTy7yPy7kzwjsTCbpIW2Aqk1M= Authentication-Results: mail-nwsmtp-smtp-corp-main-80.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: mst@redhat.com Cc: sgarzare@redhat.com, qemu-devel@nongnu.org, vsementsov@yandex-team.ru, d-tatianin@yandex-team.ru, Pierrick Bouvier Subject: [PATCH v2 10/10] vhost-user: add VHOST_USER_PROTOCOL_F_GPA_ADDRESSES Date: Mon, 20 Apr 2026 23:20:31 +0300 Message-ID: <20260420202032.714884-11-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260420202032.714884-1-vsementsov@yandex-team.ru> References: <20260420202032.714884-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1776716526997158500 Content-Type: text/plain; charset="utf-8" Unlike the kernel, vhost-user backend knows nothing about QEMU's userspace addresses. We can pass GPA instead and nothing changes. Generally, vhost-user servers need these addresses only to calculate offsets inside memory regions. Still, some servers (QEMU's internal is one example) may do checks for passed addresses to be "userspace addresses", for example check for non-zero. That's why we need additional negotiation for the feature. The benefit: this opens the doors for further implementation of local migration (live-update) with passing open vhost-related FDs through UNIX domain socket. This way the connection with backend is kept live and untouched. Without this change, we would have to communicate with backend to inform it about UVA address changes, but it's better to simply use more stable GPA numbers, which don't change after migration. Additionally, the current implementation exposes QEMU's process address space by passing UVA, which breaks ASLR. New protocol feature avoids that. Note, that we do nothing with backend messages and replies. Frontends have to work with backends userspace addresses anyway, because they come from userfaultfd. Signed-off-by: Vladimir Sementsov-Ogievskiy --- docs/interop/vhost-user.rst | 21 +++++++++++++++++---- hw/virtio/vhost-user.c | 22 +++++++++++++++++----- include/hw/virtio/vhost-user.h | 1 + 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 137c9f3669d..8dcb030c530 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -164,8 +164,16 @@ A vring address description =20 :log: a 64-bit guest address for logging =20 -Note that a ring address is an IOVA if ``VIRTIO_F_IOMMU_PLATFORM`` has -been negotiated. Otherwise it is a user address. +.. Note:: + When ``VIRTIO_F_IOMMU_PLATFORM`` is negotiated, ring addresses are IOVA= s. + + Otherwise, when ``VHOST_USER_PROTOCOL_F_GPA_ADDRESSES`` is negotiated, = the + ring addresses are guest physical addresses for frontend messages. That + does not apply to backend replies. + + Finally, when neither ``VIRTIO_F_IOMMU_PLATFORM`` nor + ``VHOST_USER_PROTOCOL_F_GPA_ADDRESSES`` features are negotiated, ring + addresses are user virtual addresses. =20 .. _memory_region_description: =20 @@ -180,7 +188,9 @@ Memory region description =20 :size: a 64-bit size =20 -:user address: a 64-bit user address +:user address: a 64-bit user address. When ``VHOST_USER_PROTOCOL_F_GPA_ADD= RESSES`` + is negotiated, this field contain guest physical address instead and must + duplicate ``guest address`` field. =20 :mmap offset: a 64-bit offset where region starts in the mapped memory =20 @@ -252,7 +262,9 @@ An IOTLB message =20 :size: a 64-bit size =20 -:user address: a 64-bit user address +:user address: a 64-bit user address. When ``VHOST_USER_PROTOCOL_F_GPA_ADD= RESSES`` + is negotiated, this field contain guest physical address instead, except= for + ``VHOST_USER_BACKEND_IOTLB_MSG``, where it's user address anyway. =20 :permissions flags: an 8-bit value: - 0: No access @@ -1063,6 +1075,7 @@ Protocol features #define VHOST_USER_PROTOCOL_F_SHARED_OBJECT 18 #define VHOST_USER_PROTOCOL_F_DEVICE_STATE 19 #define VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT 20 + #define VHOST_USER_PROTOCOL_F_GPA_ADDRESSES 21 =20 Front-end message types ----------------------- diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 78ffb25d6b1..15042c0f3c2 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -563,12 +563,22 @@ static MemoryRegion *vhost_user_get_mr_data(uint64_t = addr, ram_addr_t *offset, return mr; } =20 -static void vhost_user_fill_msg_region(VhostUserMemoryRegion *dst, +static bool vhost_user_gpa_addresses(struct vhost_dev *dev) +{ + return vhost_user_has_protocol_feature( + dev, VHOST_USER_PROTOCOL_F_GPA_ADDRESSES); +} + +static void vhost_user_fill_msg_region(struct vhost_dev *dev, + VhostUserMemoryRegion *dst, struct vhost_memory_region *src, uint64_t mmap_offset) { + bool use_phys =3D vhost_user_gpa_addresses(dev); + assert(src !=3D NULL && dst !=3D NULL); - dst->userspace_addr =3D src->userspace_addr; + + dst->userspace_addr =3D use_phys ? src->guest_phys_addr : src->userspa= ce_addr; dst->memory_size =3D src->memory_size; dst->guest_phys_addr =3D src->guest_phys_addr; dst->mmap_offset =3D mmap_offset; @@ -606,7 +616,7 @@ static int vhost_user_fill_set_mem_table_msg(struct vho= st_user *u, error_report("Failed preparing vhost-user memory table msg= "); return -ENOBUFS; } - vhost_user_fill_msg_region(®ion_buffer, reg, offset); + vhost_user_fill_msg_region(dev, ®ion_buffer, reg, offset); msg->payload.memory.regions[*fd_num] =3D region_buffer; fds[(*fd_num)++] =3D fd; } else if (track_ramblocks) { @@ -752,7 +762,7 @@ static int send_remove_regions(struct vhost_dev *dev, =20 if (fd > 0) { msg->hdr.request =3D VHOST_USER_REM_MEM_REG; - vhost_user_fill_msg_region(®ion_buffer, shadow_reg, 0); + vhost_user_fill_msg_region(dev, ®ion_buffer, shadow_reg, 0); msg->payload.mem_reg.region =3D region_buffer; =20 ret =3D vhost_user_write(dev, msg, NULL, 0); @@ -813,7 +823,7 @@ static int send_add_regions(struct vhost_dev *dev, u->region_rb[reg_idx] =3D mr->ram_block; } msg->hdr.request =3D VHOST_USER_ADD_MEM_REG; - vhost_user_fill_msg_region(®ion_buffer, reg, offset); + vhost_user_fill_msg_region(dev, ®ion_buffer, reg, offset); msg->payload.mem_reg.region =3D region_buffer; =20 ret =3D vhost_user_write(dev, msg, &fd, 1); @@ -3151,4 +3161,6 @@ const VhostOps user_ops =3D { .vhost_supports_device_state =3D vhost_user_supports_device_state, .vhost_set_device_state_fd =3D vhost_user_set_device_state_fd, .vhost_check_device_state =3D vhost_user_check_device_state, + .vhost_phys_vring_addr =3D vhost_user_gpa_addresses, + .vhost_phys_iotlb_msg =3D vhost_user_gpa_addresses, }; diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index 0e576fc5386..5ab70dab7e4 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -34,6 +34,7 @@ enum VhostUserProtocolFeature { VHOST_USER_PROTOCOL_F_SHARED_OBJECT =3D 18, VHOST_USER_PROTOCOL_F_DEVICE_STATE =3D 19, VHOST_USER_PROTOCOL_F_GET_VRING_BASE_INFLIGHT =3D 20, + VHOST_USER_PROTOCOL_F_GPA_ADDRESSES =3D 21, VHOST_USER_PROTOCOL_F_MAX }; =20 --=20 2.52.0