From nobody Sat May 4 01:55:47 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=1642427360; cv=none; d=zohomail.com; s=zohoarc; b=LSk/79BkLMKZ1PzL8U/7nRT2uENxC2CPIm1wwS7rluz7yyQthGblPhkpDkzOnKoWAwYhxVnnnmu44KQM/Vo8HidE/GleeZ9WoHZJT6SMDSQ3pN/1uRQgXCyDD+U+QuNyal6HX7yNrW0El0bUa9U6ONEfkxnUubC1wH9VBlSrWWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642427360; 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=Bw/MzjxSMwlaDuaD7N3y3KHve8KrPAFQAz6Es7cJNlo=; b=KVuJBiMxzogWizrorQTYCbHYvGxjUUgCoqU40HKj+u2Z+W5GR0hlQ1PRSsvH6T9L0RrQj2YpRf63gDm384Nj+Olb8jQV8Vbr1errrG8RtWEWh99UOfuAKnKiLFCzG+IvnhiIB/sjYV4GaYspyBoPHhtdVdxmRjt2+wBMVEjCTYY= 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 1642427360944609.0040152716615; Mon, 17 Jan 2022 05:49:20 -0800 (PST) Received: from localhost ([::1]:37952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9SNq-0006WE-58 for importer@patchew.org; Mon, 17 Jan 2022 08:49:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMP-0005vD-1v for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:48 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMK-00022x-8m for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:43 -0500 Received: from dggpeml500025.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs1P0bqtzZfD6; Mon, 17 Jan 2022 20:39:53 +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; Mon, 17 Jan 2022 20:43:36 +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; Mon, 17 Jan 2022 20:43:35 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 01/10] virtio: get class_id and pci device id by the virtio id Date: Mon, 17 Jan 2022 20:43:22 +0800 Message-ID: <20220117124331.1642-2-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642427363336100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified 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 | 77 ++++++++++++++++++++++++++++++++++++++++++ hw/virtio/virtio-pci.h | 5 +++ 2 files changed, 82 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 750aa47ec1..373e26d7c3 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,79 @@ static int virtio_pci_load_queue(DeviceState *d, int n= , QEMUFile *f) return 0; } =20 +typedef struct VirtIOPCIIDInfo { + /* virtio id */ + uint16_t vdev_id; + /* pci device id for the transitional device */ + uint16_t trans_devid; + uint16_t class_id; +} VirtIOPCIIDInfo; + +#define VIRTIO_TRANS_DEV_ID_INFO(name, class) \ + { \ + .vdev_id =3D VIRTIO_ID_##name, \ + .trans_devid =3D PCI_DEVICE_ID_VIRTIO_##name, \ + .class_id =3D class, \ + } + +#define VIRTIO_MODERN_DEV_ID_NFO(name, class) \ + { \ + .vdev_id =3D VIRTIO_ID_##name, \ + .class_id =3D class, \ + } + +static const VirtIOPCIIDInfo virtio_pci_id_info[] =3D { + /* Non-transitional devices */ + VIRTIO_MODERN_DEV_ID_NFO(CRYPTO, PCI_CLASS_OTHERS), + VIRTIO_MODERN_DEV_ID_NFO(FS, PCI_CLASS_STORAGE_OTHER), + /* Transitional devices */ + VIRTIO_TRANS_DEV_ID_INFO(NET, PCI_CLASS_NETWORK_ETHERNET), + VIRTIO_TRANS_DEV_ID_INFO(BLOCK, PCI_CLASS_STORAGE_SCSI), + VIRTIO_TRANS_DEV_ID_INFO(CONSOLE, PCI_CLASS_COMMUNICATION_OTHER), + VIRTIO_TRANS_DEV_ID_INFO(SCSI, PCI_CLASS_STORAGE_SCSI), + VIRTIO_TRANS_DEV_ID_INFO(9P, PCI_BASE_CLASS_NETWORK), + VIRTIO_TRANS_DEV_ID_INFO(BALLOON, PCI_CLASS_OTHERS), + VIRTIO_TRANS_DEV_ID_INFO(RNG, PCI_CLASS_OTHERS), +}; + +static const VirtIOPCIIDInfo *virtio_pci_get_id_info(uint16_t vdev_id) +{ + const VirtIOPCIIDInfo *info =3D NULL; + 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; + } + } + + if (!info) { + /* The device id is invalid or not added to the id_info yet. */ + error_report("Invalid virtio device(id %u)", vdev_id); + abort(); + } + + return info; +} + +/* + * Get the Transitional Device ID for the specific device, return + * zero if the device is non-transitional. + */ +uint16_t virtio_pci_get_trans_devid(uint16_t device_id) +{ + return virtio_pci_get_id_info(device_id)->trans_devid; +} + +/* + * Get the Class ID for the specific device. + */ +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 +1748,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->trans_devid) { + pci_config_set_device_id(config, proxy->trans_devid); + } } 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..f08665cd1b 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -146,6 +146,8 @@ struct VirtIOPCIProxy { bool disable_modern; bool ignore_backend_features; OnOffAuto disable_legacy; + /* Transitional device id */ + uint16_t trans_devid; uint32_t class_code; uint32_t nvectors; uint32_t dfselect; @@ -158,6 +160,9 @@ struct VirtIOPCIProxy { VirtioBusState bus; }; =20 +uint16_t virtio_pci_get_trans_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 Sat May 4 01:55:47 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=1642424924; cv=none; d=zohomail.com; s=zohoarc; b=nnKLgVN+gmDRQXKF10kjc0Yrqt3zjoUcXeW7ojR3VmuRdSUIKumiNgVkiANUWhK83P65k2VsMPOMMSUViokgwbQu9qy13z4/HCdy5+0wSSipn3jBfaB5Ymf7jdaJ++BViopOWuJKuYUa2CKBrh1l/SKzEcasD9aVKwvBnUlxopQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642424924; 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=NbYuSiDfCFwsqSLs+BnrR6rwMIZefkdZpy14ASHolbk=; b=LyjQRzB+wQVbT+NEjnu5axeFfwGgdBHI1YrYMW0OcDIOzmPCcVPz7U4M9NcbNHZCjjA2ovaGS/WdIC4ugiLA9J8hcaJ1Zw6vRpHKpsgPL4RcOGjdU3nSScTFdVkWhwMSVx5M7uyTdIPOOwpCntk2UDTuA125rb2KSVWgwpwdQZ8= 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 1642424924742873.6002170315141; Mon, 17 Jan 2022 05:08:44 -0800 (PST) Received: from localhost ([::1]:48766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9RkZ-00069W-JV for importer@patchew.org; Mon, 17 Jan 2022 08:08:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMM-0005v2-1P for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:43 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMJ-00022z-Vx for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:41 -0500 Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs1P4Bh9zZf8c; Mon, 17 Jan 2022 20:39:53 +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; Mon, 17 Jan 2022 20:43:36 +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; Mon, 17 Jan 2022 20:43:36 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 02/10] update linux headers Date: Mon, 17 Jan 2022 20:43:23 +0800 Message-ID: <20220117124331.1642-3-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642424927351100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Update linux headers to 5.xxx(kernel part is not merged yet) To support generic vdpa deivce, we need add the following ioctls: - VHOST_VDPA_GET_CONFIG_SIZE: get the configuration size. - VHOST_VDPA_GET_VQS_NUM: get the count of supported virtqueues. Signed-off-by: Longpeng --- linux-headers/linux/vhost.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h index c998860d7b..5d99e7c242 100644 --- a/linux-headers/linux/vhost.h +++ b/linux-headers/linux/vhost.h @@ -150,4 +150,11 @@ /* Get the valid iova range */ #define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \ struct vhost_vdpa_iova_range) + +/* Get the config size */ +#define VHOST_VDPA_GET_CONFIG_SIZE _IOR(VHOST_VIRTIO, 0x79, __u32) + +/* Get the count of all virtqueues */ +#define VHOST_VDPA_GET_VQS_COUNT _IOR(VHOST_VIRTIO, 0x80, __u32) + #endif --=20 2.23.0 From nobody Sat May 4 01:55:47 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=1642425155; cv=none; d=zohomail.com; s=zohoarc; b=jkOrl2iYA3CZe8ytbycXmrpZ43Q+fHIZZo6+w7pCfRoTs86V59W5uZoyeOneMoOhMdZJC24LOClZ0ldjhrsTAAI0V4tm2bYA34THqTyg4fhBv9+GGO3ws9uqCL/svTa9tD0NSRHMZKQtrpe2ivvJP9fyvxlBjE1kPKzjMMZPBy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642425155; 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=jCki0IZsmoK54ypGuGnKezQ75LNElt2a6JEnI/GGCS8OXimRKRUpJSoajfZ3TlGOQVJIs6au91xEWeqeikl3ZubmnCIOlwI/xA/EELHHpPQ2HMSCq3fhT7roLzknk8TYpp7xTnqowqrG0svzijEEUka3gO5uLDgoAoAk2+qHP34= 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 1642425155734720.1170381715054; Mon, 17 Jan 2022 05:12:35 -0800 (PST) Received: from localhost ([::1]:51988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9RoI-0000Vb-Lh for importer@patchew.org; Mon, 17 Jan 2022 08:12:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMQ-0005wD-Io for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:48 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3457) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMK-000230-9F for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:44 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs4s6rR3zccb1; Mon, 17 Jan 2022 20:42:53 +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; Mon, 17 Jan 2022 20:43:37 +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; Mon, 17 Jan 2022 20:43:36 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 03/10] vdpa: add the infrastructure of vdpa-dev Date: Mon, 17 Jan 2022 20:43:24 +0800 Message-ID: <20220117124331.1642-4-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642425157978100001 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 Sat May 4 01:55:47 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=1642425504; cv=none; d=zohomail.com; s=zohoarc; b=DbhFmz3TD5aDZSUuQgoyx/zbVMJ/sZdKStJUPI9SwiOX6/9arLRozG/aAOsi5pr2P4X/Fxzc+r/AB/QRVQLa8pDtGUfTP9kO/neA61hqtoLUyQWmySXs0W1UcuTGFa0/1C15DS/OFg04k0rIdsWKQK0dpP/hEyfYIj3017QnL8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642425504; 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=XzxIuo0PH6PEIFbEwQ7vpxwwpaqcqs2YKJDOSypZWVw=; b=nd1msZ8JIYLsYymd9z7Q/cHmJRzQ+jisAFB3RYM4byep/rHuYjMKNJTWxX4JhKCefEQ/5N8Xwv10pQKvCcHAqRg0cxQy6GaN9V+quA5dDVA+OwLVIWH/QNRA9X1D1CB4oREIb5eivRDUm6WwJcCHIXBqtFC3TR0Fzy3p2lQ2j70= 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 16424255040671012.1451611772196; Mon, 17 Jan 2022 05:18:24 -0800 (PST) Received: from localhost ([::1]:57376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9Rtv-0004ND-12 for importer@patchew.org; Mon, 17 Jan 2022 08:18:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMO-0005vB-06 for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:44 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:3081) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMK-000235-9N for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:43 -0500 Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Jcs4t0z2Nzbjxv; Mon, 17 Jan 2022 20:42:54 +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; Mon, 17 Jan 2022 20:43:37 +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; Mon, 17 Jan 2022 20:43:37 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 04/10] vdpa-dev: implement the instance_init/class_init interface Date: Mon, 17 Jan 2022 20:43:25 +0800 Message-ID: <20220117124331.1642-5-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642425505207100001 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 | 52 ++++++++++++++++++++++- hw/virtio/vdpa-dev.c | 81 +++++++++++++++++++++++++++++++++++- include/hw/virtio/vdpa-dev.h | 5 +++ 3 files changed, 134 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vdpa-dev-pci.c b/hw/virtio/vdpa-dev-pci.c index a5a7b528a9..257538dbdd 100644 --- a/hw/virtio/vdpa-dev-pci.c +++ b/hw/virtio/vdpa-dev-pci.c @@ -25,12 +25,60 @@ struct VhostVdpaDevicePCI { =20 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 vdev_id; + uint32_t num_queues; + int fd; + + fd =3D qemu_open(dev->vdev.vdpa_dev, O_RDWR, errp); + if (*errp) { + return; + } + + vdev_id =3D vhost_vdpa_device_get_u32(fd, VHOST_VDPA_GET_DEVICE_ID, er= rp); + if (*errp) { + qemu_close(fd); + return; + } + + num_queues =3D vhost_vdpa_device_get_u32(fd, VHOST_VDPA_GET_VQS_NUM, e= rrp); + if (*errp) { + qemu_close(fd); + return; + } + + dev->vdev.vdpa_dev_fd =3D fd; + vpci_dev->class_code =3D virtio_pci_get_class_id(vdev_id); + vpci_dev->trans_devid =3D virtio_pci_get_trans_devid(vdev_id); + /* one for config interrupt, one per vq */ + vpci_dev->nvectors =3D num_queues + 1; + 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..b103768f33 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -15,16 +15,93 @@ #include "sysemu/sysemu.h" #include "sysemu/runstate.h" =20 -static void vhost_vdpa_device_class_init(ObjectClass *klass, void *data) +uint32_t vhost_vdpa_device_get_u32(int fd, unsigned long int cmd, Error **= errp) +{ + uint32_t val =3D (uint32_t)-1; + + if (ioctl(fd, cmd, &val) < 0) { + error_setg(errp, "vhost-vdpa-device: cmd 0x%lx failed: %s", + cmd, strerror(errno)); + } + + return val; +} + +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; +} + +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; } =20 +static Property vhost_vdpa_device_properties[] =3D { + DEFINE_PROP_STRING("vdpa-dev", VhostVdpaDevice, vdpa_dev), + DEFINE_PROP_INT32("vdpa-dev-fd", VhostVdpaDevice, vdpa_dev_fd, -1), + 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 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..e7ad349113 100644 --- a/include/hw/virtio/vdpa-dev.h +++ b/include/hw/virtio/vdpa-dev.h @@ -11,6 +11,11 @@ OBJECT_DECLARE_SIMPLE_TYPE(VhostVdpaDevice, VHOST_VDPA_D= EVICE) =20 struct VhostVdpaDevice { VirtIODevice parent_obj; + char *vdpa_dev; + int vdpa_dev_fd; + int32_t bootindex; }; =20 +uint32_t vhost_vdpa_device_get_u32(int fd, unsigned long int cmd, Error **= errp); + #endif --=20 2.23.0 From nobody Sat May 4 01:55:47 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=1642426797; cv=none; d=zohomail.com; s=zohoarc; b=g2Grg0ASXCjp/aW+jnLfiIQM7nKpMbmbh/q2xpII7B5LoztLDI6ItwrZ7OcVCc7SaezCDaqIHVfJpBeHJA9pisy3dbsYduuYQ1KbUpIXPdcgL1+8iO8Nl33QND6o5xLvQI7YcXXpiIAYPbf9xLbIyjmfS1ayQun2SfnBhSliFoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642426797; 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=w+esg8H5T6ll0zSyEqB2yatXujj1s57KuDI8XhALkOc=; b=hVr0/mXuHS6kl2VD2G3pLaPlFtTqkjMjPRkNJqW7VKLrhTrf5bmPFeeQpSJP8I5f8eqE+sDxA/1Gca+/rTvW531KWV7nIM/8iLPCdZ7LEp8LHsnsUv8Di0FY7xloH+m+MAFa5pvLSjfT7ONI3Nt7UVNK6nARHgfCchwkrMiG/yE= 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 1642426797381329.35609972462555; Mon, 17 Jan 2022 05:39:57 -0800 (PST) Received: from localhost ([::1]:54470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9SEm-0006TA-20 for importer@patchew.org; Mon, 17 Jan 2022 08:39:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMa-00063s-Bb for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:56 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:4179) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMU-00024b-I8 for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:56 -0500 Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Jcs2g1P2Vz8wPX; Mon, 17 Jan 2022 20:40:59 +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; Mon, 17 Jan 2022 20:43:38 +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; Mon, 17 Jan 2022 20:43:37 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 05/10] vdpa-dev: implement the realize interface Date: Mon, 17 Jan 2022 20:43:26 +0800 Message-ID: <20220117124331.1642-6-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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.189; envelope-from=longpeng2@huawei.com; helo=szxga03-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642426798869100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .realize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 101 +++++++++++++++++++++++++++++++++++ include/hw/virtio/vdpa-dev.h | 8 +++ 2 files changed, 109 insertions(+) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index b103768f33..bd28cf7a15 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -27,9 +27,109 @@ uint32_t vhost_vdpa_device_get_u32(int fd, unsigned lon= g int cmd, Error **errp) return val; } =20 +static void +vhost_vdpa_device_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ + /* Nothing to do */ +} + 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 vdev_id, max_queue_size; + struct vhost_virtqueue *vqs; + int i, ret; + + if (s->vdpa_dev_fd =3D=3D -1) { + s->vdpa_dev_fd =3D qemu_open(s->vdpa_dev, O_RDWR, errp); + if (*errp) { + return; + } + } + s->vdpa.device_fd =3D s->vdpa_dev_fd; + + max_queue_size =3D vhost_vdpa_device_get_u32(s->vdpa_dev_fd, + VHOST_VDPA_GET_VRING_NUM, e= rrp); + 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; + } + + s->num_queues =3D vhost_vdpa_device_get_u32(s->vdpa_dev_fd, + VHOST_VDPA_GET_VQS_NUM, errp= ); + if (*errp) { + goto out; + } + + if (!s->num_queues || s->num_queues > VIRTIO_QUEUE_MAX) { + error_setg(errp, "invalid number of virtqueues: %u (max:%u)", + s->num_queues, VIRTIO_QUEUE_MAX); + goto out; + } + + s->dev.nvqs =3D s->num_queues; + vqs =3D g_new0(struct vhost_virtqueue, s->dev.nvqs); + s->dev.vqs =3D vqs; + 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 free_vqs; + } + + vdev_id =3D vhost_vdpa_device_get_u32(s->vdpa_dev_fd, + VHOST_VDPA_GET_DEVICE_ID, errp); + if (ret < 0) { + error_setg(errp, "vhost-vdpa-device: vhost get device id failed: %= s", + strerror(-ret)); + goto vhost_cleanup; + } + + s->config_size =3D vhost_vdpa_device_get_u32(s->vdpa_dev_fd, + VHOST_VDPA_GET_CONFIG_SIZE,= 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 free_config; + } + + virtio_init(vdev, "vhost-vdpa", vdev_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; + +free_config: + g_free(s->config); +vhost_cleanup: + vhost_dev_cleanup(&s->dev); +free_vqs: + g_free(vqs); +out: + qemu_close(s->vdpa_dev_fd); + s->vdpa_dev_fd =3D -1; } =20 static void vhost_vdpa_device_unrealize(DeviceState *dev) @@ -64,6 +164,7 @@ static void vhost_vdpa_device_set_status(VirtIODevice *v= dev, uint8_t status) static Property vhost_vdpa_device_properties[] =3D { DEFINE_PROP_STRING("vdpa-dev", VhostVdpaDevice, vdpa_dev), DEFINE_PROP_INT32("vdpa-dev-fd", VhostVdpaDevice, vdpa_dev_fd, -1), + 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 e7ad349113..e0482035cf 100644 --- a/include/hw/virtio/vdpa-dev.h +++ b/include/hw/virtio/vdpa-dev.h @@ -14,6 +14,14 @@ struct VhostVdpaDevice { char *vdpa_dev; int vdpa_dev_fd; 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 uint32_t vhost_vdpa_device_get_u32(int fd, unsigned long int cmd, Error **= errp); --=20 2.23.0 From nobody Sat May 4 01:55:47 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=1642425384; cv=none; d=zohomail.com; s=zohoarc; b=J/3YK3J/4BjSmODGoEd1HjIYaCc22dL63EwR8GaqOXIdVlRRs4qor663x6o0CLOjjwvoxhsvAWRITdPPmi/y8n8GU4FS8I8ixm+zTZrcUkPIPqs/2yGCgcL45ft36miKdkgCUDVbiWGW9OG2dDGNWI1CSsmVx8qf8EnvAW5Su/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642425384; 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=PzDv864jv50bx6kJf3NA9ve0dQ/zBCabF9s9LcJMeiY=; b=Xtafh4dYIeSQzIU8PbEHX339vp0sO9uNOKd20JFRhkARd7pc05TLdFa9cCtqMeIvjOqpUjd3PsH5yDH/GqAH6sKoMQtnJHs3byXK62Y4u8h0lYykiA/3DYm4CEcHq7dBkuBKYe55bauEelLAePXjTdah2RRcvZqEagideNBlhw0= 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 1642425384712990.1485532007976; Mon, 17 Jan 2022 05:16:24 -0800 (PST) Received: from localhost ([::1]:55380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9Rry-0002uS-RG for importer@patchew.org; Mon, 17 Jan 2022 08:16:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMO-0005vA-Vw for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:48 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RML-000239-2f for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:43 -0500 Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs1R4RKlzZfB7; Mon, 17 Jan 2022 20:39:55 +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; Mon, 17 Jan 2022 20:43:38 +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; Mon, 17 Jan 2022 20:43:38 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 06/10] vdpa-dev: implement the unrealize interface Date: Mon, 17 Jan 2022 20:43:27 +0800 Message-ID: <20220117124331.1642-7-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642425387035100001 Content-Type: text/plain; charset="utf-8" From: Longpeng Implements the .unrealize interface. Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index bd28cf7a15..e5691d02bb 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -132,9 +132,31 @@ out: s->vdpa_dev_fd =3D -1; } =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_vdpa_vdev_unrealize(s); + g_free(s->dev.vqs); + vhost_dev_cleanup(&s->dev); + qemu_close(s->vdpa_dev_fd); + s->vdpa_dev_fd =3D -1; } =20 static void --=20 2.23.0 From nobody Sat May 4 01:55:47 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=1642425908; cv=none; d=zohomail.com; s=zohoarc; b=GhvNUiKhjOKSA7XRYXIZF2E7eq6CFQyoCQpfRfRWR7G+FGfN31yH/b+SJdyCZQHNK8xRfd3zwrHv3LlqdDJYEwaPDdmn+8oy0+Q7x8Rz3BdR4nX84OCcWkfxzZ/FKax9eoLWPo0rkiiYFU0gB8ig+u2tLnyjXVJ/hl1KNHYTljk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642425908; 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=wznYBsIAtASdsHbqRGMkfUTvUXKewf60FedcKNHPI5s=; b=gykY5CRW/X3xzXo5tPmgqXY91nbFp8P6XntaQ7ibnWuFOy4dPGA/JJUYO40rFMCDXJp9l7Mj7Esh0AXeExvTof+ZIn3xyR3rvfyqW0giBVt0vzkE9i11fB8yMIe5ONpRGi7ia47qdI0UGQ8h0yaBe2j5ec8xRpJNjuPhw/FR2+c= 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 1642425908970500.93631305428755; Mon, 17 Jan 2022 05:25:08 -0800 (PST) Received: from localhost ([::1]:37670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9S0R-0002AY-Fo for importer@patchew.org; Mon, 17 Jan 2022 08:25:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMO-0005vC-0T for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:44 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3531) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RML-00023J-W2 for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:43 -0500 Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs1S1BNwzZfCR; Mon, 17 Jan 2022 20:39:56 +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; Mon, 17 Jan 2022 20:43:39 +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; Mon, 17 Jan 2022 20:43:38 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 07/10] vdpa-dev: implement the get_config/set_config interface Date: Mon, 17 Jan 2022 20:43:28 +0800 Message-ID: <20220117124331.1642-8-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642425909857100001 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 e5691d02bb..cef0a58012 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -162,13 +162,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 Sat May 4 01:55:47 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=1642426196; cv=none; d=zohomail.com; s=zohoarc; b=ZtyCnda3ptbxlujECI3LJOE9ypYnaJ8yHo7bw3qAn5dyMGSK9ZOaunH0TrVwHqiw2iCJ8D/hyGkOHT4pp164AollSxDxxZ4DFiNg7+ekyZsZvXBwaUD0mgJTFc4RAvM0rT+UICu1Lxm7MZ/4kRf7pvRZgoNJGkbeWcJL19hRLO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642426196; 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=g959Jv7kHIRerqA1B7Zw+KiSuuSGm8HXkpo5bchjc0Y=; b=akH9Cszv4y1AzE0qYeeIJ+qbF88GMFvxRwgdpmQBH0HEyQ5gCkR7fQmQR6zDd+J7gvcK4uV0k9MwXO8yujPe/7k3AiCehbn7RxfvX+lFAB0tQeaywWeqlKmTeQjTIcLgijESEo9MjSqbG7T7kJCGZ4nqokdOBr4+lEpanC2vfsQ= 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 1642426196310393.978230799852; Mon, 17 Jan 2022 05:29:56 -0800 (PST) Received: from localhost ([::1]:45792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9S54-00089J-PV for importer@patchew.org; Mon, 17 Jan 2022 08:29:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMT-0005wV-Qu for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:51 -0500 Received: from szxga08-in.huawei.com ([45.249.212.255]:3270) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMQ-00023T-9i for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:48 -0500 Received: from dggpeml500025.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Jcs1S6MmJz1FCY4; Mon, 17 Jan 2022 20:39:56 +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; Mon, 17 Jan 2022 20:43:39 +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; Mon, 17 Jan 2022 20:43:39 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 08/10] vdpa-dev: implement the get_features interface Date: Mon, 17 Jan 2022 20:43:29 +0800 Message-ID: <20220117124331.1642-9-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642426197402100001 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 cef0a58012..7bf07fef9b 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -185,7 +185,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 Sat May 4 01:55:47 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=1642427900; cv=none; d=zohomail.com; s=zohoarc; b=DsXs9TJRKwaj3vUyFbZD8NxxsFVGseb32YSk3Quy9BxTrs0WpglAAMTPLjg/iuPTH1hgYrjQg9oqps9VmX+RIFWjHuWtHUC4l6qIR+oBEsY7HX5QK6s/qjp5xI7VcGr4mkWj94dcrsyzWGMERcJDHdAZKsvlWB5Mea5IMk27dno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642427900; 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=ARmMVCg7Iitj1d2qhex7krCem2gQ4GvrT0WAKgt1Gm8=; b=SagZlaLhi6kNcL75/PF6T83IWizdM0JsMes9DzBFp4XTHsheg6THtEphHu2PEVMwBD7uT57uw0F5i7Tbvbj9iIqMSMFEZyKGml9IiMSzqqAHvETgcqwrrkLF+MbykYY8FIUQkjIhW35hLmEiJXBKyFTNC5zPOj5Nt0HgGTzHZy8= 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 1642427900133965.0676041403582; Mon, 17 Jan 2022 05:58:20 -0800 (PST) Received: from localhost ([::1]:47436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9SWY-0003lM-LJ for importer@patchew.org; Mon, 17 Jan 2022 08:58:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMQ-0005wC-Ip for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:48 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMM-00023P-Fw for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:45 -0500 Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs1T1Tm2zZfCp; Mon, 17 Jan 2022 20:39:57 +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; Mon, 17 Jan 2022 20:43:40 +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; Mon, 17 Jan 2022 20:43:39 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 09/10] vdpa-dev: implement the set_status interface Date: Mon, 17 Jan 2022 20:43:30 +0800 Message-ID: <20220117124331.1642-10-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642427901166100001 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 7bf07fef9b..99722c88a1 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -195,9 +195,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 Sat May 4 01:55:47 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=1642425744; cv=none; d=zohomail.com; s=zohoarc; b=FvKKk07tXNvXsdtaBSTUHhWD/8Qk3g84xpTPXW4c7z5fuJVJEwCRp62YHkVBuUPB9oBnCaMOcodxcF39AeheKEjWIycYjbXgMo/Ao6da3nqop+PdSjSjXx7hLRMtCmui569f+bwyC69Lr+00e+tLr1VEj1wy3Lf89PKzC4x1oQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642425744; 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=tBffxKq0rkCZY05zM6ugF8wWNfIUSUjJVGdwnuwSzKI=; b=MpmFkZRZwuVVu6rw3FqyhW7n/DQIKHE7FNLFoKHmRTCg11xQ6cMa17GYpoweds7GpvzOELsF3658OJiwjWfSS21lFcIRlVSItnfFbrLUmiIQXEUxS74IYLk8bTKfZ/V5l3W2bGLMBRM5B74RebyENYaao4QLP+T1Cv5KQIJeIuY= 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 1642425744165119.40841274481272; Mon, 17 Jan 2022 05:22:24 -0800 (PST) Received: from localhost ([::1]:60436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9Rxn-0006bU-4P for importer@patchew.org; Mon, 17 Jan 2022 08:22:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMR-0005wF-MC for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:49 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:3458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9RMO-00023R-Mf for qemu-devel@nongnu.org; Mon, 17 Jan 2022 07:43:47 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jcs4x403yzccZq; Mon, 17 Jan 2022 20:42:57 +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; Mon, 17 Jan 2022 20:43:40 +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; Mon, 17 Jan 2022 20:43:40 +0800 To: , , CC: , , , , , Longpeng Subject: [PATCH v2 10/10] vdpa-dev: mark the device as unmigratable Date: Mon, 17 Jan 2022 20:43:31 +0800 Message-ID: <20220117124331.1642-11-longpeng2@huawei.com> X-Mailer: git-send-email 2.25.0.windows.1 In-Reply-To: <20220117124331.1642-1-longpeng2@huawei.com> References: <20220117124331.1642-1-longpeng2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, 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=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: 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: 1642425746026100001 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 99722c88a1..65511243f9 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -307,6 +307,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