From nobody Sun Sep 28 15:57:39 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1758885077; cv=none; d=zohomail.com; s=zohoarc; b=GXCQ1LTnTwd+qtwh8UjJah4eE3bHNQmbeT+j7CmlxNmDffeWRF9uYLx3o/g57H2KdN6BMSFmSWmULJTZhZTN0ByZetXZYbbNQUyluKUq3K+/+6TKUUkGkZqKMTGCfKrGUo0cUP/nKL8qFYnFMINlzaYs0rLTH0w5befRfYXSDW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758885077; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=xfdTkAdpunn6XaL/hD8OBvLghSmG7GgPAm+MIDbrcNU=; b=EIXU1XSE/eOmT2yFcoWw9vZ+mI91kX8nNdux7c37QmZpPlQiw6nMo3PBbRnZUFtboAL8y1TPuqWW2ALrmRG4TEXmXYQMVH1RXZ6pyE8H5YQ051eIQUGjgVqJqAqZ4Y2bZj7hs5kC6n90T8ft0u/FBZXY2qdMr1zBuo1EhG/Xgdc= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758885077647311.71864626240176; Fri, 26 Sep 2025 04:11:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v26K3-0004OU-72; Fri, 26 Sep 2025 07:09:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v26K1-0004NW-Cu for qemu-devel@nongnu.org; Fri, 26 Sep 2025 07:09:05 -0400 Received: from mx24.baidu.com ([111.206.215.185] helo=baidu.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v26Jq-0000qc-H4 for qemu-devel@nongnu.org; Fri, 26 Sep 2025 07:09:04 -0400 To: qemu-devel CC: "Michael S . Tsirkin" , Stefano Garzarella , Jonah Palmer , Miao Kezhan , Li Zhaoxin Subject: [PATCH v2] vdpa-dev: add get_vhost() callback for vhost-vdpa device Date: Fri, 26 Sep 2025 19:08:17 +0800 Message-ID: <2778f817cb6740a15ecb37927804a67288b062d1.1758860411.git.lizhaoxin04@baidu.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.127.73.8] X-ClientProxiedBy: bjkjy-exc6.internal.baidu.com (172.31.50.50) To bjhj-exc18.internal.baidu.com (172.31.4.16) X-FEAS-Client-IP: 172.31.4.16 X-FE-Policy-ID: 52:10:53:SYSTEM 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=lists.gnu.org; Received-SPF: pass client-ip=111.206.215.185; envelope-from=lizhaoxin04@baidu.com; helo=baidu.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, FORGED_SPF_HELO=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Li Zhaoxin From: Li Zhaoxin via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1758885078653116600 Content-Type: text/plain; charset="utf-8" Commit c255488d67 "virtio: add vhost support for virtio devices" added the get_vhost() function, but it did not include vhost-vdpa devices. So when I use the vdpa device and query the status of the vdpa device with the x-query-virtio-status qmp command, since vdpa does not implement vhost_get, it will cause qemu to crash. Therefore, in order to obtain the status of the virtio device under vhost-v= dpa, we need to add a vhost_get implement for the vdpa device. Co-developed-by: Miao Kezhan Signed-off-by: Miao Kezhan Signed-off-by: Li Zhaoxin --- hw/virtio/vdpa-dev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index d1da40afc8..4a7b970976 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -338,6 +338,12 @@ static int vhost_vdpa_device_set_status(VirtIODevice *= vdev, uint8_t status) return 0; } =20 +static struct vhost_dev *vhost_vdpa_device_get_vhost(VirtIODevice *vdev) +{ + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + return &s->dev; +} + static const Property vhost_vdpa_device_properties[] =3D { DEFINE_PROP_STRING("vhostdev", VhostVdpaDevice, vhostdev), DEFINE_PROP_UINT16("queue-size", VhostVdpaDevice, queue_size, 0), @@ -369,6 +375,7 @@ static void vhost_vdpa_device_class_init(ObjectClass *k= lass, const void *data) vdc->set_config =3D vhost_vdpa_device_set_config; vdc->get_features =3D vhost_vdpa_device_get_features; vdc->set_status =3D vhost_vdpa_device_set_status; + vdc->get_vhost =3D vhost_vdpa_device_get_vhost; } =20 static void vhost_vdpa_device_instance_init(Object *obj) --=20 2.34.1