From nobody Fri May 3 19:16:07 2024 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=1641344484; cv=none; d=zohomail.com; s=zohoarc; b=Ntv5DXqBxhKmG/rPVELctmR+MlAy9d8Nv+PkpK04xw0ur58ElJ7vsF6+fcS/4/SWLx7xzE5uHmWTuIZKoM4TN+WPNL9vPc37SPoB6E5SYBAfDhYcNQ1nn0luQSGnof6mMSog6uwVhiTCB8aRQTf/jL9rFcPvCle4t2Tk4nzkN9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641344484; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=me4BCzFE2ZpznbJXyt56mBqWFJHDL04Vjt+XEKW1DZk=; b=c05Vd9lnuWCXchGrSNCiWGCxoYTKeNVAJujGgn04XAC7j3vv5abCpIXbOaGt1UgS19almRICflsUR2PXvXYbqTMDU3LqHRft6As8ZAf4MQFZAAxlSgmAs9Dnm+yXIYVCILoEZdB5XnYxXlkCDmlVmn5FxrMXtdoFCbOpHvJ0XKs= 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 1641344484254596.5059834956941; Tue, 4 Jan 2022 17:01:24 -0800 (PST) Received: from localhost ([::1]:54596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4ug7-0002JI-3h for importer@patchew.org; Tue, 04 Jan 2022 20:01:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue3-0007s6-Nm for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3439) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4udz-0007uv-Ox for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JTB1g48yczccGF; Wed, 5 Jan 2022 08:58:31 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:05 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:04 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 01/10] virtio: get class_id and pci device id by the virtio id Date: Wed, 5 Jan 2022 08:58:51 +0800 Message-ID: <20220105005900.860-2-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=longpeng2@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641344486286100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the deivce which is specificed by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 93 ++++++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.h | 4 ++ 2 files changed, 97 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 750aa47ec1..843085c4ea 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -19,6 +19,7 @@ =20 #include "exec/memop.h" #include "standard-headers/linux/virtio_pci.h" +#include "standard-headers/linux/virtio_ids.h" #include "hw/boards.h" #include "hw/virtio/virtio.h" #include "migration/qemu-file-types.h" @@ -213,6 +214,95 @@ static int virtio_pci_load_queue(DeviceState *d, int n= , QEMUFile *f) return 0; } =20 +typedef struct VirtIOPCIIDInfo { + uint16_t vdev_id; /* virtio id */ + uint16_t pdev_id; /* pci device id */ + uint16_t class_id; +} VirtIOPCIIDInfo; + +static const VirtIOPCIIDInfo virtio_pci_id_info[] =3D { + { + .vdev_id =3D VIRTIO_ID_NET, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_NET, + .class_id =3D PCI_CLASS_NETWORK_ETHERNET, + }, + { + .vdev_id =3D VIRTIO_ID_BLOCK, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_BLOCK, + .class_id =3D PCI_CLASS_STORAGE_SCSI, + }, + { + .vdev_id =3D VIRTIO_ID_CONSOLE, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_CONSOLE, + .class_id =3D PCI_CLASS_COMMUNICATION_OTHER, + }, + { + .vdev_id =3D VIRTIO_ID_SCSI, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_SCSI, + .class_id =3D PCI_CLASS_STORAGE_SCSI, + }, + { + .vdev_id =3D VIRTIO_ID_9P, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_9P, + .class_id =3D PCI_BASE_CLASS_NETWORK, + }, + { + .vdev_id =3D VIRTIO_ID_VSOCK, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_VSOCK, + .class_id =3D PCI_CLASS_COMMUNICATION_OTHER, + }, + { + .vdev_id =3D VIRTIO_ID_IOMMU, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_IOMMU, + .class_id =3D PCI_CLASS_OTHERS, + }, + { + .vdev_id =3D VIRTIO_ID_MEM, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_MEM, + .class_id =3D PCI_CLASS_OTHERS, + }, + { + .vdev_id =3D VIRTIO_ID_PMEM, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_PMEM, + .class_id =3D PCI_CLASS_OTHERS, + }, + { + .vdev_id =3D VIRTIO_ID_RNG, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_RNG, + .class_id =3D PCI_CLASS_OTHERS, + }, + { + .vdev_id =3D VIRTIO_ID_BALLOON, + .pdev_id =3D PCI_DEVICE_ID_VIRTIO_BALLOON, + .class_id =3D PCI_CLASS_OTHERS, + }, +}; + +static VirtIOPCIIDInfo virtio_pci_get_id_info(uint16_t vdev_id) +{ + VirtIOPCIIDInfo info =3D {}; + int i; + + for (i =3D 0; i < ARRAY_SIZE(virtio_pci_id_info); i++) { + if (virtio_pci_id_info[i].vdev_id =3D=3D vdev_id) { + info =3D virtio_pci_id_info[i]; + break; + } + } + + return info; +} + +uint16_t virtio_pci_get_pci_devid(uint16_t device_id) +{ + return virtio_pci_get_id_info(device_id).pdev_id; +} + +uint16_t virtio_pci_get_class_id(uint16_t device_id) +{ + return virtio_pci_get_id_info(device_id).class_id; +} + static bool virtio_pci_ioeventfd_enabled(DeviceState *d) { VirtIOPCIProxy *proxy =3D to_virtio_pci_proxy(d); @@ -1674,6 +1764,9 @@ static void virtio_pci_device_plugged(DeviceState *d,= Error **errp) * is set to PCI_SUBVENDOR_ID_REDHAT_QUMRANET by default. */ pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus= )); + if (proxy->pdev_id) { + pci_config_set_device_id(config, proxy->pdev_id); + } } else { /* pure virtio-1.0 */ pci_set_word(config + PCI_VENDOR_ID, diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 2446dcd9ae..06aa59436e 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -146,6 +146,7 @@ struct VirtIOPCIProxy { bool disable_modern; bool ignore_backend_features; OnOffAuto disable_legacy; + uint16_t pdev_id; uint32_t class_code; uint32_t nvectors; uint32_t dfselect; @@ -158,6 +159,9 @@ struct VirtIOPCIProxy { VirtioBusState bus; }; =20 +uint16_t virtio_pci_get_pci_devid(uint16_t device_id); +uint16_t virtio_pci_get_class_id(uint16_t device_id); + static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy) { return !proxy->disable_modern; --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641344481; cv=none; d=zohomail.com; s=zohoarc; b=HL71LUMev6PbAa3IO2cgrGFUoHQstFMMU2bx8oDX0QnloU6jAdfydvHyZpGAonDn6oCrMaTm+ymJLtlNSV71MwgWGhtfDO8V3WgjGWczvROI7tj3248IhEWICWbNufZ5U17OoRv4RQOpSD/ogjLh0M1aPa/tvLs0i2if9KVuG38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641344481; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=pHA1XVPXkw7ih4qoJbNyTM5zXcjztKk1y3YRBX2SFak=; b=cAvrFuGwnj9Jj9coWiJia+PZbfI31hY/evxjqcC4Tb4kU5Ns2mOWtMPvL1+O+dXO5G4O9NuKIn9ZPxgK4NyRuhvhsVot8H9vkGRZhdeUkO5cSFSr4rD6crSn/PcDgE0L/VVptCG/EjEH0sTuGSdWOaQE+7k4YpuLz6GPwXhw6zk= 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 1641344481672510.363614753211; Tue, 4 Jan 2022 17:01:21 -0800 (PST) Received: from localhost ([::1]:54498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4ug4-0002FX-CX for importer@patchew.org; Tue, 04 Jan 2022 20:01:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue2-0007rQ-9s for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:14 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:4154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4udz-0007uy-Ov for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:13 -0500 Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JTB1763Y5z9s4d; Wed, 5 Jan 2022 08:58:03 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:05 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:05 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 02/10] vhost: add 3 commands for vhost-vdpa Date: Wed, 5 Jan 2022 08:58:52 +0800 Message-ID: <20220105005900.860-3-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.188; envelope-from=longpeng2@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641344483989100003 Content-Type: text/plain; charset="utf-8" From: Longpeng To support generic vdpa deivce, we need add the following ioctls: - GET_VECTORS_NUM: the count of vectors that supported - GET_CONFIG_SIZE: the size of the virtio config space - GET_VQS_NUM: the count of virtqueues that exported Signed-off-by: Longpeng --- linux-headers/linux/vhost.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index c998860d7b..c5edd75d15 100644 --- a/linux-headers/linux/vhost.h +++ b/linux-headers/linux/vhost.h @@ -150,4 +150,14 @@ /* Get the valid iova range */ #define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \ struct vhost_vdpa_iova_range) + +/* Get the number of vectors */ +#define VHOST_VDPA_GET_VECTORS_NUM _IOR(VHOST_VIRTIO, 0x79, int) + +/* Get the virtio config size */ +#define VHOST_VDPA_GET_CONFIG_SIZE _IOR(VHOST_VIRTIO, 0x80, int) + +/* Get the number of virtqueues */ +#define VHOST_VDPA_GET_VQS_NUM _IOR(VHOST_VIRTIO, 0x81, int) + #endif --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641344954; cv=none; d=zohomail.com; s=zohoarc; b=U6/DRT5zNr5BUzqvHS2W7Hvo97fzxOimmjhVF1k4kPzVhNFYENST7NU/vN+mgjsNiZALtxk8zjBDwdSKCxiBbt9hdqFXNVBCqEVr0sZ6ow2aleqh5NTBA6SXuybqN+Sr5xIphBN67mVOdoEirw5hOhvAJd54UlezGmAJTE2/at8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641344954; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cTxU7g0LzEexg9PsENbrZqMX5kTIQZO6gazZv1dA5Lc=; b=dcG5vpCwdG8KYJ/ljIoDo+6CYro7Q3cW0FbrcmH/eEOblIcXs8d2T9Wmv/8fV+T8sUBHQSE/0NZ3G7fYOezRWrMSHpmH/GgjzyAYcbpR5mENpPRZ0bvJ64Fi297cvpn7taN1HP8GSHlzTS3JRoSP/tDqxTLEf2kqCM+CQE32W9I= 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 1641344954006626.1349856430622; Tue, 4 Jan 2022 17:09:14 -0800 (PST) Received: from localhost ([::1]:40116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4une-0003V5-37 for importer@patchew.org; Tue, 04 Jan 2022 20:09:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue3-0007s5-MZ for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4udz-0007v6-Ov for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JTB1h58JGzccNP; Wed, 5 Jan 2022 08:58:32 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:06 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:05 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 03/10] vdpa: add the infrastructure of vdpa-dev Date: Wed, 5 Jan 2022 08:58:53 +0800 Message-ID: <20220105005900.860-4-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=longpeng2@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641344956951100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Add the infrastructure of vdpa-dev (the generic vDPA device), we can add a generic vDPA device as follow: -device vhost-vdpa-device-pci,vdpa-dev=3D/dev/vhost-vdpa-X Signed-off-by: Longpeng --- hw/virtio/Kconfig | 5 ++++ hw/virtio/meson.build | 2 ++ hw/virtio/vdpa-dev-pci.c | 51 ++++++++++++++++++++++++++++++++++++ hw/virtio/vdpa-dev.c | 41 +++++++++++++++++++++++++++++ include/hw/virtio/vdpa-dev.h | 16 +++++++++++ 5 files changed, 115 insertions(+) create mode 100644 hw/virtio/vdpa-dev-pci.c create mode 100644 hw/virtio/vdpa-dev.c create mode 100644 include/hw/virtio/vdpa-dev.h diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig index c144d42f9b..2723283382 100644 --- a/hw/virtio/Kconfig +++ b/hw/virtio/Kconfig @@ -68,3 +68,8 @@ config VHOST_USER_RNG bool default y depends on VIRTIO && VHOST_USER + +config VHOST_VDPA_DEV + bool + default y if VIRTIO_PCI + depends on VIRTIO && VHOST_VDPA && LINUX diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 521f7d64a8..8e8943e20b 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -29,6 +29,7 @@ virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: fil= es('vhost-user-i2c.c')) virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_tru= e: files('vhost-user-i2c-pci.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rn= g.c')) virtio_ss.add(when: ['CONFIG_VHOST_USER_RNG', 'CONFIG_VIRTIO_PCI'], if_tru= e: files('vhost-user-rng-pci.c')) +virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) =20 virtio_pci_ss =3D ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-= pci.c')) @@ -49,6 +50,7 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: = files('virtio-serial-pc virtio_pci_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem-= pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iomm= u-pci.c')) virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pc= i.c')) +virtio_pci_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev-= pci.c')) =20 virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss) =20 diff --git a/hw/virtio/vdpa-dev-pci.c b/hw/virtio/vdpa-dev-pci.c new file mode 100644 index 0000000000..a5a7b528a9 --- /dev/null +++ b/hw/virtio/vdpa-dev-pci.c @@ -0,0 +1,51 @@ +#include "qemu/osdep.h" +#include +#include +#include "hw/virtio/virtio.h" +#include "hw/virtio/vdpa-dev.h" +#include "hw/pci/pci.h" +#include "hw/qdev-properties.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "qemu/module.h" +#include "virtio-pci.h" +#include "qom/object.h" + + +typedef struct VhostVdpaDevicePCI VhostVdpaDevicePCI; + +#define TYPE_VHOST_VDPA_DEVICE_PCI "vhost-vdpa-device-pci-base" +DECLARE_INSTANCE_CHECKER(VhostVdpaDevicePCI, VHOST_VDPA_DEVICE_PCI, + TYPE_VHOST_VDPA_DEVICE_PCI) + +struct VhostVdpaDevicePCI { + VirtIOPCIProxy parent_obj; + VhostVdpaDevice vdev; +}; + +static void vhost_vdpa_device_pci_instance_init(Object *obj) +{ + return; +} + +static void vhost_vdpa_device_pci_class_init(ObjectClass *klass, void *dat= a) +{ + return; +} + +static const VirtioPCIDeviceTypeInfo vhost_vdpa_device_pci_info =3D { + .base_name =3D TYPE_VHOST_VDPA_DEVICE_PCI, + .generic_name =3D "vhost-vdpa-device-pci", + .transitional_name =3D "vhost-vdpa-device-pci-transitional", + .non_transitional_name =3D "vhost-vdpa-device-pci-non-transitional", + .instance_size =3D sizeof(VhostVdpaDevicePCI), + .instance_init =3D vhost_vdpa_device_pci_instance_init, + .class_init =3D vhost_vdpa_device_pci_class_init, +}; + +static void vhost_vdpa_device_pci_register(void) +{ + virtio_pci_types_register(&vhost_vdpa_device_pci_info); +} + +type_init(vhost_vdpa_device_pci_register); diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c new file mode 100644 index 0000000000..f4f92b90b0 --- /dev/null +++ b/hw/virtio/vdpa-dev.c @@ -0,0 +1,41 @@ +#include "qemu/osdep.h" +#include +#include +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "qemu/cutils.h" +#include "hw/qdev-core.h" +#include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-bus.h" +#include "hw/virtio/virtio-access.h" +#include "hw/virtio/vdpa-dev.h" +#include "sysemu/sysemu.h" +#include "sysemu/runstate.h" + +static void vhost_vdpa_device_class_init(ObjectClass *klass, void *data) +{ + return; +} + +static void vhost_vdpa_device_instance_init(Object *obj) +{ + return; +} + +static const TypeInfo vhost_vdpa_device_info =3D { + .name =3D TYPE_VHOST_VDPA_DEVICE, + .parent =3D TYPE_VIRTIO_DEVICE, + .instance_size =3D sizeof(VhostVdpaDevice), + .class_init =3D vhost_vdpa_device_class_init, + .instance_init =3D vhost_vdpa_device_instance_init, +}; + +static void register_vhost_vdpa_device_type(void) +{ + type_register_static(&vhost_vdpa_device_info); +} + +type_init(register_vhost_vdpa_device_type); diff --git a/include/hw/virtio/vdpa-dev.h b/include/hw/virtio/vdpa-dev.h new file mode 100644 index 0000000000..dd94bd74a2 --- /dev/null +++ b/include/hw/virtio/vdpa-dev.h @@ -0,0 +1,16 @@ +#ifndef _VHOST_VDPA_DEVICE_H +#define _VHOST_VDPA_DEVICE_H + +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-vdpa.h" +#include "qom/object.h" + + +#define TYPE_VHOST_VDPA_DEVICE "vhost-vdpa-device" +OBJECT_DECLARE_SIMPLE_TYPE(VhostVdpaDevice, VHOST_VDPA_DEVICE) + +struct VhostVdpaDevice { + VirtIODevice parent_obj; +}; + +#endif --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641344756; cv=none; d=zohomail.com; s=zohoarc; b=d6iJ7CUM19KYxCy/792f4eGYrUoeTW+przCRFHJB3kEiWkXPKlVItxJPfA+vuM25HY7djJwh5iyfA0Rghcrk78wIOBhBMyAXocS+yUPrWLC0pTIzirZ5XEKOPSPjK/jr6YcXKR1RMR6JZFRC+PoKyrbhe+HnFoFr4uf9NACr9Xk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641344756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=qUHSimy535TYQtZIRlydBSYHNKMSv7axIg0KszcfQcE=; b=Me+qnle6VkCWs6wghBqpO6eevVqi09IGESwFmZXjXcg7q8qr4pK3pInEnGscCMM8LwWEjGITz6cMqehR71sgkwaXHzJUCF8iqeLEXyhneIrsSXPUBAUObY62vOE5R2dDJIJCJbSpIPfLIxgnL3RQlKXi+gatACi6kP3m+sdN6Eo= 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 1641344756236975.2599405867796; Tue, 4 Jan 2022 17:05:56 -0800 (PST) Received: from localhost ([::1]:34210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4ukU-0007gg-J9 for importer@patchew.org; Tue, 04 Jan 2022 20:05:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue3-0007rw-JC for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:4155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue0-0007vB-0H for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JTB190WSGz9s4h; Wed, 5 Jan 2022 08:58:05 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:06 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:06 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 04/10] vdpa-dev: implement the instance_init/class_init interface Date: Wed, 5 Jan 2022 08:58:54 +0800 Message-ID: <20220105005900.860-5-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.188; envelope-from=longpeng2@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641344758478100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .instance_init and the .class_init interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev-pci.c | 80 +++++++++++++++++++++++++++++++++++- hw/virtio/vdpa-dev.c | 68 +++++++++++++++++++++++++++++- include/hw/virtio/vdpa-dev.h | 2 + 3 files changed, 146 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vdpa-dev-pci.c b/hw/virtio/vdpa-dev-pci.c index a5a7b528a9..0af54a26d4 100644 --- a/hw/virtio/vdpa-dev-pci.c +++ b/hw/virtio/vdpa-dev-pci.c @@ -23,14 +23,90 @@ struct VhostVdpaDevicePCI { VhostVdpaDevice vdev; }; =20 +static uint32_t +vdpa_dev_pci_get_info(const char *name, uint64_t cmd, Error **errp) +{ + int device_fd; + uint32_t val; + int ret; + + device_fd =3D qemu_open(name, O_RDWR, errp); + if (device_fd =3D=3D -1) { + return (uint32_t)-1; + } + + ret =3D ioctl(device_fd, cmd, &val); + if (ret < 0) { + error_setg(errp, "vhost-vdpa-device-pci: cmd 0x%lx failed: %s", + cmd, strerror(errno)); + goto out; + } + +out: + close(device_fd); + return val; +} + +static inline uint32_t +vdpa_dev_pci_get_devid(VhostVdpaDevicePCI *dev, Error **errp) +{ + return vdpa_dev_pci_get_info(dev->vdev.vdpa_dev, + VHOST_VDPA_GET_DEVICE_ID, errp); +} + +static inline uint32_t +vdpa_dev_pci_get_vectors_num(VhostVdpaDevicePCI *dev, Error **errp) +{ + return vdpa_dev_pci_get_info(dev->vdev.vdpa_dev, + VHOST_VDPA_GET_VECTORS_NUM, errp); +} + static void vhost_vdpa_device_pci_instance_init(Object *obj) { - return; + VhostVdpaDevicePCI *dev =3D VHOST_VDPA_DEVICE_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_VDPA_DEVICE); + object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev), + "bootindex"); +} + +static Property vhost_vdpa_device_pci_properties[] =3D { + DEFINE_PROP_END_OF_LIST(), +}; + +static void +vhost_vdpa_device_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + VhostVdpaDevicePCI *dev =3D VHOST_VDPA_DEVICE_PCI(vpci_dev); + DeviceState *vdev =3D DEVICE(&dev->vdev); + uint32_t devid; + uint32_t vectors; + + devid =3D vdpa_dev_pci_get_devid(dev, errp); + if (*errp) { + return; + } + + vectors =3D vdpa_dev_pci_get_vectors_num(dev, errp); + if (*errp) { + return; + } + + vpci_dev->class_code =3D virtio_pci_get_class_id(devid); + vpci_dev->pdev_id =3D virtio_pci_get_pci_devid(devid); + vpci_dev->nvectors =3D vectors; + qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } =20 static void vhost_vdpa_device_pci_class_init(ObjectClass *klass, void *dat= a) { - return; + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioPCIClass *k =3D VIRTIO_PCI_CLASS(klass); + + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + device_class_set_props(dc, vhost_vdpa_device_pci_properties); + k->realize =3D vhost_vdpa_device_pci_realize; } =20 static const VirtioPCIDeviceTypeInfo vhost_vdpa_device_pci_info =3D { diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index f4f92b90b0..790117fb3b 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -15,16 +15,80 @@ #include "sysemu/sysemu.h" #include "sysemu/runstate.h" =20 -static void vhost_vdpa_device_class_init(ObjectClass *klass, void *data) +static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp) { return; } =20 -static void vhost_vdpa_device_instance_init(Object *obj) +static void vhost_vdpa_device_unrealize(DeviceState *dev) +{ + return; +} + +static void +vhost_vdpa_device_get_config(VirtIODevice *vdev, uint8_t *config) +{ + return; +} + +static void +vhost_vdpa_device_set_config(VirtIODevice *vdev, const uint8_t *config) { return; } =20 +static uint64_t vhost_vdpa_device_get_features(VirtIODevice *vdev, + uint64_t features, + Error **errp) +{ + return (uint64_t)-1; +} + +static void vhost_vdpa_device_set_status(VirtIODevice *vdev, uint8_t statu= s) +{ + return; +} + +static Property vhost_vdpa_device_properties[] =3D { + DEFINE_PROP_STRING("vdpa-dev", VhostVdpaDevice, vdpa_dev), + DEFINE_PROP_END_OF_LIST(), +}; + +static const VMStateDescription vmstate_vhost_vdpa_device =3D { + .name =3D "vhost-vdpa-device", + .minimum_version_id =3D 1, + .version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_VIRTIO_DEVICE, + VMSTATE_END_OF_LIST() + }, +}; + +static void vhost_vdpa_device_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + + device_class_set_props(dc, vhost_vdpa_device_properties); + dc->desc =3D "VDPA-based generic PCI device assignment"; + dc->vmsd =3D &vmstate_vhost_vdpa_device; + set_bit(DEVICE_CATEGORY_MISC, dc->categories); + vdc->realize =3D vhost_vdpa_device_realize; + vdc->unrealize =3D vhost_vdpa_device_unrealize; + vdc->get_config =3D vhost_vdpa_device_get_config; + 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; +} + +static void vhost_vdpa_device_instance_init(Object *obj) +{ + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(obj); + + device_add_bootindex_property(obj, &s->bootindex, "bootindex", + NULL, DEVICE(obj)); +} + static const TypeInfo vhost_vdpa_device_info =3D { .name =3D TYPE_VHOST_VDPA_DEVICE, .parent =3D TYPE_VIRTIO_DEVICE, diff --git a/include/hw/virtio/vdpa-dev.h b/include/hw/virtio/vdpa-dev.h index dd94bd74a2..7a0e6bdcf8 100644 --- a/include/hw/virtio/vdpa-dev.h +++ b/include/hw/virtio/vdpa-dev.h @@ -11,6 +11,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(VhostVdpaDevice, VHOST_VDPA_DE= VICE) =20 struct VhostVdpaDevice { VirtIODevice parent_obj; + char *vdpa_dev; + int32_t bootindex; }; =20 #endif --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641344735; cv=none; d=zohomail.com; s=zohoarc; b=TXgF0s8Oi1wHCxeXenI1aRb1GbSoTkB7IxULEWWk0dQjPGurPocFWxakqZHCSzb0z3j/tZRv96ALdFRvXuPSWGvD+CaqFbzQIhxAlR6XKZ8fc5wBq1zMsIOKEwPUbAsdDDcmL/6SkBdO2PXUbZfM5WqB4MlrgM4lkU++f8Jsx3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641344735; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=jKVh17Btwuf8vXbUYDb4kc/Ozp9FunVPRkR4gOn69RQ=; b=gwxp4r3mm96f7jekkoJmOcwkGD6WbmsNcNtHSPzChrAqvZbo7T6zWYv17T7sIzZ4doyLdeorlkoDApybx+aQrJIbKoIQKY+zOqMkkCMmG9meWhOIfIecqiliSdDDwuEsqr4IFL0Hgyv2wThIXvIDg4BqWPzHZgaVqRL1uxzeC0c= 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 164134473532313.770692150176501; Tue, 4 Jan 2022 17:05:35 -0800 (PST) Received: from localhost ([::1]:33628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4uk9-0007JJ-5t for importer@patchew.org; Tue, 04 Jan 2022 20:05:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue3-0007sB-OC for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:5086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue0-0007vH-69 for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:15 -0500 Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JTB194pzLz9s42; Wed, 5 Jan 2022 08:58:05 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:07 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:06 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 05/10] vdpa-dev: implement the realize interface Date: Wed, 5 Jan 2022 08:58:55 +0800 Message-ID: <20220105005900.860-6-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.188; envelope-from=longpeng2@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641344736476100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .realize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 114 +++++++++++++++++++++++++++++++++++ include/hw/virtio/vdpa-dev.h | 8 +++ 2 files changed, 122 insertions(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 790117fb3b..2d534d837a 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -15,9 +15,122 @@ #include "sysemu/sysemu.h" #include "sysemu/runstate.h" =20 +static void +vhost_vdpa_device_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ + /* Nothing to do */ +} + +static int vdpa_dev_get_info_by_fd(int fd, uint64_t cmd, Error **errp) +{ + int val; + + if (ioctl(fd, cmd, &val) < 0) { + error_setg(errp, "vhost-vdpa-device: cmd 0x%lx failed: %s", + cmd, strerror(errno)); + return -1; + } + + return val; +} + +static inline int vdpa_dev_get_queue_size(int fd, Error **errp) +{ + return vdpa_dev_get_info_by_fd(fd, VHOST_VDPA_GET_VRING_NUM, errp); +} + +static inline int vdpa_dev_get_vqs_num(int fd, Error **errp) +{ + return vdpa_dev_get_info_by_fd(fd, VHOST_VDPA_GET_VQS_NUM, errp); +} + +static inline int vdpa_dev_get_config_size(int fd, Error **errp) +{ + return vdpa_dev_get_info_by_fd(fd, VHOST_VDPA_GET_CONFIG_SIZE, errp); +} + static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp) { + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + uint32_t device_id; + int max_queue_size; + int fd; + int i, ret; + + fd =3D qemu_open(s->vdpa_dev, O_RDWR, errp); + if (fd =3D=3D -1) { + return; + } + s->vdpa.device_fd =3D fd; + + max_queue_size =3D vdpa_dev_get_queue_size(fd, errp); + if (*errp) { + goto out; + } + + if (s->queue_size > max_queue_size) { + error_setg(errp, "vhost-vdpa-device: invalid queue_size: %d (max:%= d)", + s->queue_size, max_queue_size); + goto out; + } else if (!s->queue_size) { + s->queue_size =3D max_queue_size; + } + + ret =3D vdpa_dev_get_vqs_num(fd, errp); + if (*errp) { + goto out; + } + + s->dev.nvqs =3D ret; + s->dev.vqs =3D g_new0(struct vhost_virtqueue, s->dev.nvqs); + s->dev.vq_index =3D 0; + s->dev.vq_index_end =3D s->dev.nvqs; + s->dev.backend_features =3D 0; + s->started =3D false; + + ret =3D vhost_dev_init(&s->dev, &s->vdpa, VHOST_BACKEND_TYPE_VDPA, 0, = NULL); + if (ret < 0) { + error_setg(errp, "vhost-vdpa-device: vhost initialization failed: = %s", + strerror(-ret)); + goto out; + } + + ret =3D s->dev.vhost_ops->vhost_get_device_id(&s->dev, &device_id); + if (ret < 0) { + error_setg(errp, "vhost-vdpa-device: vhost get device id failed: %= s", + strerror(-ret)); + goto vhost_cleanup; + } + + s->config_size =3D vdpa_dev_get_config_size(fd, errp); + if (*errp) { + goto vhost_cleanup; + } + + s->config =3D g_malloc0(s->config_size); + + ret =3D vhost_dev_get_config(&s->dev, s->config, s->config_size, NULL); + if (ret < 0) { + error_setg(errp, "vhost-vdpa-device: get config failed"); + goto config_err; + } + + virtio_init(vdev, "vhost-vdpa", device_id, s->config_size); + + s->virtqs =3D g_new0(VirtQueue *, s->dev.nvqs); + for (i =3D 0; i < s->dev.nvqs; i++) { + s->virtqs[i] =3D virtio_add_queue(vdev, s->queue_size, + vhost_vdpa_device_dummy_handle_out= put); + } + return; +config_err: + g_free(s->config); +vhost_cleanup: + vhost_dev_cleanup(&s->dev); +out: + close(fd); } =20 static void vhost_vdpa_device_unrealize(DeviceState *dev) @@ -51,6 +164,7 @@ static void vhost_vdpa_device_set_status(VirtIODevice *v= dev, uint8_t status) =20 static Property vhost_vdpa_device_properties[] =3D { DEFINE_PROP_STRING("vdpa-dev", VhostVdpaDevice, vdpa_dev), + DEFINE_PROP_UINT16("queue-size", VhostVdpaDevice, queue_size, 0), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/virtio/vdpa-dev.h b/include/hw/virtio/vdpa-dev.h index 7a0e6bdcf8..49f8145d61 100644 --- a/include/hw/virtio/vdpa-dev.h +++ b/include/hw/virtio/vdpa-dev.h @@ -13,6 +13,14 @@ struct VhostVdpaDevice { VirtIODevice parent_obj; char *vdpa_dev; int32_t bootindex; + struct vhost_dev dev; + struct vhost_vdpa vdpa; + VirtQueue **virtqs; + uint8_t *config; + int config_size; + uint32_t num_queues; + uint16_t queue_size; + bool started; }; =20 #endif --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641345076; cv=none; d=zohomail.com; s=zohoarc; b=Mo7r4Da6h2nPyRGwy75HF7CfafQFabsHz5b/llE/CNr54o+CbFTpRN2c8cpXdxxu3zApnrphlmO3s58PCWGwxchSCTD360one2FhjOlUSuSWq54ZoeSVcPhHuDW0fgo/69rx/9hQ9HRZNdaamuD9dkOzu87i4y2c5Y0ji+BeF6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641345076; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=JSHEr5dzROrXsc+8h6uW3NGg2x2v8qOi0njqrlDdQME=; b=lQ7lQ3PI6fRLhqLcMSxa0nAYOL0iwH4E2Ek4G/GI6/JKiW+tKG4I5X3ziLjWh5tFd9T1I7JBZXS8Rm6rEFalyaz1ICavjsgulcDgkHxzfV3zHu/w274QPmEFTTHjpA5qiGWaaSndZqwLRQ+zmyyqTUuNJwUW5oZcd0WIGE0FHPk= 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 1641345076711203.1894691296826; Tue, 4 Jan 2022 17:11:16 -0800 (PST) Received: from localhost ([::1]:44046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4upf-0006NH-Gq for importer@patchew.org; Tue, 04 Jan 2022 20:11:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue5-0007tO-3H for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:17 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue2-0007vN-0a for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:16 -0500 Received: from dggpeml500025.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JTB1k3q2czcbpl; Wed, 5 Jan 2022 08:58:34 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500025.china.huawei.com (7.185.36.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:08 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:07 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 06/10] vdpa-dev: implement the unrealize interface Date: Wed, 5 Jan 2022 08:58:56 +0800 Message-ID: <20220105005900.860-7-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=longpeng2@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641345078716100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .unrealize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 2d534d837a..4e4dd3d201 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -133,9 +133,29 @@ out: close(fd); } =20 +static void vhost_vdpa_vdev_unrealize(VhostVdpaDevice *s) +{ + VirtIODevice *vdev =3D VIRTIO_DEVICE(s); + int i; + + for (i =3D 0; i < s->num_queues; i++) { + virtio_delete_queue(s->virtqs[i]); + } + g_free(s->virtqs); + virtio_cleanup(vdev); + + g_free(s->config); +} + static void vhost_vdpa_device_unrealize(DeviceState *dev) { - return; + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + + virtio_set_status(vdev, 0); + vhost_dev_cleanup(&s->dev); + vhost_vdpa_vdev_unrealize(s); + close(s->vdpa.device_fd); } =20 static void --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641344944; cv=none; d=zohomail.com; s=zohoarc; b=ZdOLuZ7h69fb6yXlS9410hrDpgKfxke6s4xYi83IVBt/q3X6lXKiqYdtkaWFom2xxnz10WkdppKaH5uZuC3ddDX87kiyRMwNkBpHW4Q3cd7EoGUgKekZYFL1IbkNczQmcpVA9ijuwAtwk22/T0G2kILLal8EB69xudxf0ERoysw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641344944; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=NmJzZs9rGJyxNv3b+52vzrx2btQF2cBuLqiVFQHx1TE=; b=cX2ocEbTEWWidGViBEVMX4z3B+dwNLIONti8zmHr3a3lm2tA0/kyDs8XjagfJPwicPoMvjmY1mQ1VC+wthmaGJsX4dyTL6xCY523cwxseqVVrJSHsLHqU5NaOJxUkrPkFAgAbDbkFO9jO997fJ2FqCr6i5nijlpZQeIBFY2ymjA= 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 1641344944670407.868193444378; Tue, 4 Jan 2022 17:09:04 -0800 (PST) Received: from localhost ([::1]:39820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4unX-0003JA-BG for importer@patchew.org; Tue, 04 Jan 2022 20:09:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue5-0007tL-2a for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:17 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:5087) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue1-0007vR-Cw for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:16 -0500 Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JTB1B624rz9s3T; Wed, 5 Jan 2022 08:58:06 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:08 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:08 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 07/10] vdpa-dev: implement the get_config/set_config interface Date: Wed, 5 Jan 2022 08:58:57 +0800 Message-ID: <20220105005900.860-8-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.188; envelope-from=longpeng2@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641344946584100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .get_config and .set_config interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 4e4dd3d201..4f97a7521b 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -161,13 +161,23 @@ static void vhost_vdpa_device_unrealize(DeviceState *= dev) static void vhost_vdpa_device_get_config(VirtIODevice *vdev, uint8_t *config) { - return; + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + + memcpy(config, s->config, s->config_size); } =20 static void vhost_vdpa_device_set_config(VirtIODevice *vdev, const uint8_t *config) { - return; + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + int ret; + + ret =3D vhost_dev_set_config(&s->dev, s->config, 0, s->config_size, + VHOST_SET_CONFIG_TYPE_MASTER); + if (ret) { + error_report("set device config space failed"); + return; + } } =20 static uint64_t vhost_vdpa_device_get_features(VirtIODevice *vdev, --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641345423; cv=none; d=zohomail.com; s=zohoarc; b=eQ7RIhdgamwgG8es79ZFNr+4WSeJKPuVO0xqkZ6JfYub4vmm1o6vSxZkqauOQaKCd/3ZZ7CS4Sx+IyEQozLbxrSfqEsF+QHGYbao+25urDcBYIrDa+Ykgby26j2/bvooNJJzCEtc77IeNzvd33BeRIcfYUieiwSi2yxLm2/34aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641345423; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=2VNgN/xTZObMU/c1Tx5OfV7DCPbq8EV3U4ABE78Pqgc=; b=brbT9TYjIlnu407K1KS+AxHS3YW6zPUTz6fX3kuXIv3geCXB//VM7zaBiBahTlc4BfoSwtoorTJkuvbWYnOCZ9YDtSRQcJ71iM+VQIfz9B9wBg4TQ9Lj4+sn6ApnlDbBqMskS/pZg/NPyF6iCJGjZ1ceTyoF/qYRqyeYF83Yavg= 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 1641345423628878.7551398069089; Tue, 4 Jan 2022 17:17:03 -0800 (PST) Received: from localhost ([::1]:49762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4uvG-00028j-0n for importer@patchew.org; Tue, 04 Jan 2022 20:17:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue5-0007uV-HD for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:17 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue2-0007vZ-1w for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:17 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JT9yQ3H2xzWcDb; Wed, 5 Jan 2022 08:55:42 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:09 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:08 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 08/10] vdpa-dev: implement the get_features interface Date: Wed, 5 Jan 2022 08:58:58 +0800 Message-ID: <20220105005900.860-9-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.187; envelope-from=longpeng2@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641345424356100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .get_features interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 4f97a7521b..32b3117c4b 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -184,7 +184,14 @@ static uint64_t vhost_vdpa_device_get_features(VirtIOD= evice *vdev, uint64_t features, Error **errp) { - return (uint64_t)-1; + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + uint64_t backend_features =3D s->dev.features; + + if (!virtio_has_feature(features, VIRTIO_F_IOMMU_PLATFORM)) { + virtio_clear_feature(&backend_features, VIRTIO_F_IOMMU_PLATFORM); + } + + return backend_features; } =20 static void vhost_vdpa_device_set_status(VirtIODevice *vdev, uint8_t statu= s) --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641345260; cv=none; d=zohomail.com; s=zohoarc; b=TsTB/dnZ+Zg3osmbV2INZN2cOhRWQl7lCnY5k/dsr6o2ImWxqqqq4bghV/qth/3grRaffuEPdlahlPWH97NQcU8YY3ySnAd+63mX/2mJ6m9goOm4LO1a8788fOqULhVmdbCHuBYFnzVH3uA8c7X2UDUj+ReeKtFjM7TcUDELF7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641345260; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rOt1wLBV6H5XaPagmwK+I5dh0QeC8iTPOAB+fOMU9Vs=; b=O4y+OypSo87zTCQvLpqhn2EmXQak0NT4AXPn8KQoVVEtJXyxVaSlDvj8ikYJ8caIqDaFdhvEtmhScJWt4fTZOrLex07/RbE2440k6bh2nO4BPTOa7IWr/9XDo1EQOQOshv1jbMzt17n1cNHRqanVa+FrM2ggI8tkok8V1skc6Zg= 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 1641345259947618.2066372072045; Tue, 4 Jan 2022 17:14:19 -0800 (PST) Received: from localhost ([::1]:47578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4usc-0000Qw-R6 for importer@patchew.org; Tue, 04 Jan 2022 20:14:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue5-0007tX-6n for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:17 -0500 Received: from szxga08-in.huawei.com ([45.249.212.255]:3258) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue0-0007vb-Ql for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:16 -0500 Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4JT9yR2QYrz1DKCP; Wed, 5 Jan 2022 08:55:43 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:09 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:09 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 09/10] vdpa-dev: implement the set_status interface Date: Wed, 5 Jan 2022 08:58:59 +0800 Message-ID: <20220105005900.860-10-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.255; envelope-from=longpeng2@huawei.com; helo=szxga08-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641345262246100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .set_status interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 100 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 32b3117c4b..64649bfb5a 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -194,9 +194,107 @@ static uint64_t vhost_vdpa_device_get_features(VirtIO= Device *vdev, return backend_features; } =20 +static int vhost_vdpa_device_start(VirtIODevice *vdev, Error **errp) +{ + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); + int i, ret; + + if (!k->set_guest_notifiers) { + error_setg(errp, "binding does not support guest notifiers"); + return -ENOSYS; + } + + ret =3D vhost_dev_enable_notifiers(&s->dev, vdev); + if (ret < 0) { + error_setg_errno(errp, -ret, "Error enabling host notifiers"); + return ret; + } + + ret =3D k->set_guest_notifiers(qbus->parent, s->dev.nvqs, true); + if (ret < 0) { + error_setg_errno(errp, -ret, "Error binding guest notifier"); + goto err_host_notifiers; + } + + s->dev.acked_features =3D vdev->guest_features; + + ret =3D vhost_dev_start(&s->dev, vdev); + if (ret < 0) { + error_setg_errno(errp, -ret, "Error starting vhost"); + goto err_guest_notifiers; + } + s->started =3D true; + + /* + * guest_notifier_mask/pending not used yet, so just unmask + * everything here. virtio-pci will do the right thing by + * enabling/disabling irqfd. + */ + for (i =3D 0; i < s->dev.nvqs; i++) { + vhost_virtqueue_mask(&s->dev, vdev, i, false); + } + + return ret; + +err_guest_notifiers: + k->set_guest_notifiers(qbus->parent, s->dev.nvqs, false); +err_host_notifiers: + vhost_dev_disable_notifiers(&s->dev, vdev); + return ret; +} + +static void vhost_vdpa_device_stop(VirtIODevice *vdev) +{ + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k =3D VIRTIO_BUS_GET_CLASS(qbus); + int ret; + + if (!s->started) { + return; + } + s->started =3D false; + + if (!k->set_guest_notifiers) { + return; + } + + vhost_dev_stop(&s->dev, vdev); + + ret =3D k->set_guest_notifiers(qbus->parent, s->dev.nvqs, false); + if (ret < 0) { + error_report("vhost guest notifier cleanup failed: %d", ret); + return; + } + + vhost_dev_disable_notifiers(&s->dev, vdev); +} + static void vhost_vdpa_device_set_status(VirtIODevice *vdev, uint8_t statu= s) { - return; + VhostVdpaDevice *s =3D VHOST_VDPA_DEVICE(vdev); + bool should_start =3D virtio_device_started(vdev, status); + Error *local_err =3D NULL; + int ret; + + if (!vdev->vm_running) { + should_start =3D false; + } + + if (s->started =3D=3D should_start) { + return; + } + + if (should_start) { + ret =3D vhost_vdpa_device_start(vdev, &local_err); + if (ret < 0) { + error_reportf_err(local_err, "vhost-vdpa-device: start failed:= "); + } + } else { + vhost_vdpa_device_stop(vdev); + } } =20 static Property vhost_vdpa_device_properties[] =3D { --=20 2.23.0 From nobody Fri May 3 19:16:07 2024 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=1641345083; cv=none; d=zohomail.com; s=zohoarc; b=kik07Gx1Hll6xhGwckVmmKzKFBJOdvgKAKUa7efyxPttrmKcjk/QrSOOuhTXlWF10FGjPSmPwArgx0ZuQqSHJUXAohYDiTfSTRkTjo7tn6+6101ixucZab4eLMCd7rsVosJYKgMmcz8JWYzV0Ghz3kh2PrXMETRWkm3vVzlnNL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641345083; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=tYIE7Z2LXtk5ssIxx9XHCXdGXjGldY2WGt8/wm2bTJ8=; b=V3lpkA15p2q5QZXfjZoyx8foos1LGD0PxKIcytJORZoip22/53+EktPl6bYHg9N7IQKIJ4p1SBbVUSE310RsbVW4zZxKghuz5PyBFxJhok76kjK7dgW49mo8keNAGqHIBwm3FVTBaVP6To1enBCkZwNhmcBbnwf7Y8Es6YoMVio= 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 164134508300435.41789860239953; Tue, 4 Jan 2022 17:11:23 -0800 (PST) Received: from localhost ([::1]:44488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4upl-0006gu-Vm for importer@patchew.org; Tue, 04 Jan 2022 20:11:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue5-0007tQ-44 for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:17 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:3067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4ue2-0007vj-0m for qemu-devel@nongnu.org; Tue, 04 Jan 2022 19:59:16 -0500 Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JTB1m3gcfzbjll; Wed, 5 Jan 2022 08:58:36 +0800 (CST) Received: from dggpeml100016.china.huawei.com (7.185.36.216) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:10 +0800 Received: from DESKTOP-27KDQMV.china.huawei.com (10.174.148.223) by dggpeml100016.china.huawei.com (7.185.36.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 5 Jan 2022 08:59:09 +0800 To: , , , CC: , , , , , , Longpeng Subject: [RFC 10/10] vdpa-dev: mark the device as unmigratable Date: Wed, 5 Jan 2022 08:59:00 +0800 Message-ID: <20220105005900.860-11-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220105005900.860-1-longpeng2@huawei.com> References: <20220105005900.860-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml100016.china.huawei.com (7.185.36.216) X-CFilter-Loop: Reflected 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=45.249.212.188; envelope-from=longpeng2@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: "Longpeng(Mike)" From: "Longpeng(Mike)" via X-ZM-MESSAGEID: 1641345085197100003 Content-Type: text/plain; charset="utf-8" From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index 64649bfb5a..0644aace22 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -305,6 +305,7 @@ static Property vhost_vdpa_device_properties[] =3D { =20 static const VMStateDescription vmstate_vhost_vdpa_device =3D { .name =3D "vhost-vdpa-device", + .unmigratable =3D 1, .minimum_version_id =3D 1, .version_id =3D 1, .fields =3D (VMStateField[]) { --=20 2.23.0