From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658488753; cv=none; d=zohomail.com; s=zohoarc; b=Jcd0b2hE/yWdmLrxQ6ZLXSRygNYtPHL8vt0KAkl1ZhdT/xQh48+scLVksL/rd53BfRmzkIzxaSrm5Zlf3kF/6JkfgDFZp6XzYIFfDIhJaNnBqKvx5cCGg2ZcHJqhYyA8XH7/0sSxOH3snnsg+4/psmNpLrCIdJdXZfsOQZLpjkg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658488753; 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:References:Sender:Subject:To; bh=ZJjoWNgiO9pSxFfxgEXPumFynQaR4e570fIWsLS9YCg=; b=M49L/IDlPaQPAZTlxOmzh3namWWIa69Hil6Kn4Un5Cs0cCdbo5FDe1De0wwD4k3lbNyYDYesaqCeWA3PhpcrsJMrt4eoAMyeKz7+9jVPz+9L9RI3Dw5fxi4pAcRYIrHTFwbvvOn3ArGWVMwQFiS+GsqebDwU/bHJ2uOPrluGGAA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658488753058659.9464486279595; Fri, 22 Jul 2022 04:19:13 -0700 (PDT) Received: from localhost ([::1]:36246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqga-0000hr-2e for importer@patchew.org; Fri, 22 Jul 2022 07:19:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqah-0002z7-3G for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqaf-0006wX-Ea for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:06 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-kQFNHFqjOoa33kWdy4fu1g-1; Fri, 22 Jul 2022 07:12:59 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0439F3C01C0C; Fri, 22 Jul 2022 11:12:59 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F2D240E80E0; Fri, 22 Jul 2022 11:12:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZJjoWNgiO9pSxFfxgEXPumFynQaR4e570fIWsLS9YCg=; b=UHlC5pynCCE4qmo6rimVSo8tpelh0X9Q66cxw16/Gbx/o840pE0/396YJ75B0SMs705ZGB G6K7806YlGCwVVw2e+iMxri4KxPog9UthsaCqD8c35u9oIlgBKCGJ1hbBfyyPo4QsIK+Ji w3I1Ft1V8D98Z9D9GHTkZi80Uu0sgS4= X-MC-Unique: kQFNHFqjOoa33kWdy4fu1g-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 1/7] vhost: stop transfer elem ownership in vhost_handle_guest_kick Date: Fri, 22 Jul 2022 13:12:39 +0200 Message-Id: <20220722111245.3403062-2-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658488755171100001 It was easier to allow vhost_svq_add to handle the memory. Now that we will allow qemu to add elements to a SVQ without the guest's knowledge, it's better to handle it in the caller. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-shadow-virtqueue.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-vi= rtqueue.c index e4956728dd..ffd2b2c972 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -233,9 +233,6 @@ static void vhost_svq_kick(VhostShadowVirtqueue *svq) /** * Add an element to a SVQ. * - * The caller must check that there is enough slots for the new element. It - * takes ownership of the element: In case of failure not ENOSPC, it is fr= ee. - * * Return -EINVAL if element is invalid, -ENOSPC if dev queue is full */ int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg, @@ -252,7 +249,6 @@ int vhost_svq_add(VhostShadowVirtqueue *svq, const stru= ct iovec *out_sg, =20 ok =3D vhost_svq_add_split(svq, out_sg, out_num, in_sg, in_num, &qemu_= head); if (unlikely(!ok)) { - g_free(elem); return -EINVAL; } =20 @@ -293,7 +289,7 @@ static void vhost_handle_guest_kick(VhostShadowVirtqueu= e *svq) virtio_queue_set_notification(svq->vq, false); =20 while (true) { - VirtQueueElement *elem; + g_autofree VirtQueueElement *elem; int r; =20 if (svq->next_guest_avail_elem) { @@ -324,12 +320,14 @@ static void vhost_handle_guest_kick(VhostShadowVirtqu= eue *svq) * queue the current guest descriptor and ignore kicks * until some elements are used. */ - svq->next_guest_avail_elem =3D elem; + svq->next_guest_avail_elem =3D g_steal_pointer(&elem); } =20 /* VQ is full or broken, just return and ignore kicks */ return; } + /* elem belongs to SVQ or external caller now */ + elem =3D NULL; } =20 virtio_queue_set_notification(svq->vq, true); --=20 2.31.1 From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658488951; cv=none; d=zohomail.com; s=zohoarc; b=YXJUr7pKjwF2vfoT1WgZ6CSWeOcD02CaXedEKIgnQ+g6PTdkK45aWg1g5VB6XnM9obJ+JvYg4wtlub+xpFvmj30Qp9sl7rXotTQF64jqTAaDuonSiN0dw0uKI2g+B8K9D9F0l2pwOLXGJfiqYgvX2q4n06OD6A7QuEXeYZnLJso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658488951; 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:References:Sender:Subject:To; bh=1ONMuE+w6Q+NyNNeCgRomXaXD5/OUtQp8jNG9YgsBS8=; b=oJ570iqbDEv7CcAY+HR+eyftUXrSbLal7B33AtrCCxitDFuU+ZyjemTY9rGMtWe56shTtPR42omvJv5pAPn1+dla0vNTscrY6wFTVnfKXTM0Yt3Qy1wRJYjr4hTgnVZ6vCQiO0yXy43xDG53azHK4jxdAK4V+gOw+XqMP99S0cI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658488951679655.210033659458; Fri, 22 Jul 2022 04:22:31 -0700 (PDT) Received: from localhost ([::1]:38976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqjm-0002cf-Dv for importer@patchew.org; Fri, 22 Jul 2022 07:22:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqaj-00034i-Fe for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37180) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqah-0006wt-Ml for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:09 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-UM1-heRQMryFZ6ZE7VRAfw-1; Fri, 22 Jul 2022 07:13:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54A8F1C05AE1; Fri, 22 Jul 2022 11:13:02 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4742840E80E1; Fri, 22 Jul 2022 11:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1ONMuE+w6Q+NyNNeCgRomXaXD5/OUtQp8jNG9YgsBS8=; b=fyys+sHCi9ekB0uDDrZkU8qAgeL1HeMxIqTMXsIbmf4i969Ec6RP1T6WcUCm+OaPQwLBZc 0vyE7JniIAo06eh7y5ZuUTcr4b+Qkh/qjdadVIYog3MQ601HzCU95IJombffdFxHn0bsKJ MVAxklJ3FAi1q4tuImy5Y6HBPffP0Ik= X-MC-Unique: UM1-heRQMryFZ6ZE7VRAfw-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 2/7] vdpa: Extract vhost_vdpa_net_cvq_add from vhost_vdpa_net_handle_ctrl_avail Date: Fri, 22 Jul 2022 13:12:40 +0200 Message-Id: <20220722111245.3403062-3-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658488952414100001 So we can reuse to inject state messages. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 74 ++++++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 6abad276a6..1b82ac2e07 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -334,6 +334,46 @@ static bool vhost_vdpa_net_cvq_map_elem(VhostVDPAState= *s, return true; } =20 +static virtio_net_ctrl_ack vhost_vdpa_net_cvq_add(VhostShadowVirtqueue *sv= q, + const struct iovec *dev_buf= fers) +{ + /* in buffer used for device model */ + virtio_net_ctrl_ack status; + size_t dev_written; + int r; + + /* + * Add a fake non-NULL VirtQueueElement since we'll remove before SVQ + * event loop can get it. + */ + r =3D vhost_svq_add(svq, &dev_buffers[0], 1, &dev_buffers[1], 1, (void= *)1); + if (unlikely(r !=3D 0)) { + if (unlikely(r =3D=3D -ENOSPC)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: No space on device queue\n= ", + __func__); + } + return VIRTIO_NET_ERR; + } + + /* + * We can poll here since we've had BQL from the time we sent the + * descriptor. Also, we need to take the answer before SVQ pulls by it= self, + * when BQL is released + */ + dev_written =3D vhost_svq_poll(svq); + if (unlikely(dev_written < sizeof(status))) { + error_report("Insufficient written data (%zu)", dev_written); + return VIRTIO_NET_ERR; + } + + memcpy(&status, dev_buffers[1].iov_base, sizeof(status)); + if (status !=3D VIRTIO_NET_OK) { + return VIRTIO_NET_ERR; + } + + return VIRTIO_NET_OK; +} + /** * Do not forward commands not supported by SVQ. Otherwise, the device cou= ld * accept it and qemu would not know how to update the device model. @@ -380,19 +420,18 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShad= owVirtqueue *svq, void *opaque) { VhostVDPAState *s =3D opaque; - size_t in_len, dev_written; + size_t in_len; virtio_net_ctrl_ack status =3D VIRTIO_NET_ERR; /* out and in buffers sent to the device */ struct iovec dev_buffers[2] =3D { { .iov_base =3D s->cvq_cmd_out_buffer }, { .iov_base =3D s->cvq_cmd_in_buffer }, }; - /* in buffer used for device model */ + /* in buffer seen by virtio-net device model */ const struct iovec in =3D { .iov_base =3D &status, .iov_len =3D sizeof(status), }; - int r =3D -EINVAL; bool ok; =20 ok =3D vhost_vdpa_net_cvq_map_elem(s, elem, dev_buffers); @@ -405,35 +444,16 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShad= owVirtqueue *svq, goto out; } =20 - r =3D vhost_svq_add(svq, &dev_buffers[0], 1, &dev_buffers[1], 1, elem); - if (unlikely(r !=3D 0)) { - if (unlikely(r =3D=3D -ENOSPC)) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: No space on device queue\n= ", - __func__); - } - goto out; - } - - /* - * We can poll here since we've had BQL from the time we sent the - * descriptor. Also, we need to take the answer before SVQ pulls by it= self, - * when BQL is released - */ - dev_written =3D vhost_svq_poll(svq); - if (unlikely(dev_written < sizeof(status))) { - error_report("Insufficient written data (%zu)", dev_written); - goto out; - } - - memcpy(&status, dev_buffers[1].iov_base, sizeof(status)); + status =3D vhost_vdpa_net_cvq_add(svq, dev_buffers); if (status !=3D VIRTIO_NET_OK) { goto out; } =20 status =3D VIRTIO_NET_ERR; - virtio_net_handle_ctrl_iov(svq->vdev, &in, 1, dev_buffers, 1); - if (status !=3D VIRTIO_NET_OK) { + in_len =3D virtio_net_handle_ctrl_iov(svq->vdev, &in, 1, dev_buffers, = 1); + if (in_len !=3D sizeof(status) || status !=3D VIRTIO_NET_OK) { error_report("Bad CVQ processing in model"); + return VIRTIO_NET_ERR; } =20 out: @@ -450,7 +470,7 @@ out: if (dev_buffers[1].iov_base) { vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, dev_buffers[1].iov_base); } - return r; + return status =3D=3D VIRTIO_NET_OK ? 0 : 1; } =20 static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops =3D { --=20 2.31.1 From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658488689; cv=none; d=zohomail.com; s=zohoarc; b=XCHpkIDyREfIxDXSBQZWCJTlX4i9pPW9Qw9zz0yIHd5nk5aN2ZnaOX97ls9A48GViIvjzAA+6xR8/0opyX179Sd1tmrtv9zipzrsA2Q3d1wue57lh/t36S4ZXj03G/cr6u5o9ciWsIV0JYS/LzLy75FNV6xz4DypTmrxcMeB/20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658488689; 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:References:Sender:Subject:To; bh=7+LUG03BDYPp5kNAJLMAJQOFe/AQNqvHDhHyOWlVtyY=; b=ZqxuVDOqahP1ZTX1QHNp47aDJdYpQTXgYhBZJ5U0PSOOR03AhA/daLyumhJbJEp+GZhCqlDnxqudp+j5ZN07CiIy1Qmx7QXg+a4h9VwPZ5QtmS0LdMIW5+zCW4GA/l26BSpL/kwwSh2mF+jLrc04E6fntgSlxb7j3QgCQyNKIg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658488689393421.1346668118978; Fri, 22 Jul 2022 04:18:09 -0700 (PDT) Received: from localhost ([::1]:34814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqfY-00085u-6l for importer@patchew.org; Fri, 22 Jul 2022 07:18:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqaj-00034P-As for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqah-0006wu-Mu for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-120-6a9IMuumOOmQjl-ZtuPMwQ-1; Fri, 22 Jul 2022 07:13:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 637EE101AA69; Fri, 22 Jul 2022 11:13:05 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94C8E40D2962; Fri, 22 Jul 2022 11:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7+LUG03BDYPp5kNAJLMAJQOFe/AQNqvHDhHyOWlVtyY=; b=cv5iLo/pPo6duDJFGSQlfKTFU9WgYK/i92ZFQPDzSMUN52ruDbYvgdqTw41i47k8DcjOfh PSQYZvJvu4WA0E01Hoex/Uu0nSOLK+d54Ia+wfYISis3NHqJN6Q6S7VxxAn6BFj6Yap+fE HbVYEF4fs7CRxiHDnqMSQzrTR1XmoME= X-MC-Unique: 6a9IMuumOOmQjl-ZtuPMwQ-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 3/7] vdpa: Make vhost_vdpa_net_cvq_map_elem accept any out sg Date: Fri, 22 Jul 2022 13:12:41 +0200 Message-Id: <20220722111245.3403062-4-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658488690950100001 So its generic enough to accept any out sg buffer and we can inject NIC state messages. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 1b82ac2e07..bbe1830824 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -302,35 +302,36 @@ dma_map_err: } =20 /** - * Copy the guest element into a dedicated buffer suitable to be sent to N= IC + * Maps out sg and in buffer into dedicated buffers suitable to be sent to= NIC * - * @iov: [0] is the out buffer, [1] is the in one + * @dev_iov: [0] is the out buffer, [1] is the in one */ -static bool vhost_vdpa_net_cvq_map_elem(VhostVDPAState *s, - VirtQueueElement *elem, - struct iovec *iov) +static bool vhost_vdpa_net_cvq_map_sg(VhostVDPAState *s, + const struct iovec *out, size_t out_= num, + struct iovec *dev_iov) { size_t in_copied; bool ok; =20 - iov[0].iov_base =3D s->cvq_cmd_out_buffer; - ok =3D vhost_vdpa_cvq_map_buf(&s->vhost_vdpa, elem->out_sg, elem->out_= num, - vhost_vdpa_net_cvq_cmd_len(), iov[0].iov_b= ase, - &iov[0].iov_len, false); + dev_iov[0].iov_base =3D s->cvq_cmd_out_buffer; + ok =3D vhost_vdpa_cvq_map_buf(&s->vhost_vdpa, out, out_num, + vhost_vdpa_net_cvq_cmd_len(), + dev_iov[0].iov_base, &dev_iov[0].iov_len, + false); if (unlikely(!ok)) { return false; } =20 - iov[1].iov_base =3D s->cvq_cmd_in_buffer; + dev_iov[1].iov_base =3D s->cvq_cmd_in_buffer; ok =3D vhost_vdpa_cvq_map_buf(&s->vhost_vdpa, NULL, 0, - sizeof(virtio_net_ctrl_ack), iov[1].iov_ba= se, - &in_copied, true); + sizeof(virtio_net_ctrl_ack), + dev_iov[1].iov_base, &in_copied, true); if (unlikely(!ok)) { vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->cvq_cmd_out_buffer); return false; } =20 - iov[1].iov_len =3D sizeof(virtio_net_ctrl_ack); + dev_iov[1].iov_len =3D sizeof(virtio_net_ctrl_ack); return true; } =20 @@ -434,7 +435,7 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadow= Virtqueue *svq, }; bool ok; =20 - ok =3D vhost_vdpa_net_cvq_map_elem(s, elem, dev_buffers); + ok =3D vhost_vdpa_net_cvq_map_sg(s, elem->out_sg, elem->out_num, dev_b= uffers); if (unlikely(!ok)) { goto out; } --=20 2.31.1 From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658489132; cv=none; d=zohomail.com; s=zohoarc; b=BpZkxyDiSGIUvUDitLjqUTmWeJMmcXyM6wUhdSlMcVnQ2yIY1I79NF2C+7e4ClcrftxDVWkjhgTm6czyB2VnxgiBs+3E2KlxD75fSzQcZQLF6ob1cEg4HKCWyoAHpewPhHOj+9pOR6L2ckstwhhDP4SXWgX7ZsjgIb81dVeh6To= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658489132; 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:References:Sender:Subject:To; bh=HmfZTBtu31uLg6djxBfEgCKUx5K7bRKNxH5Q40BBmnY=; b=CaX9Y70Z8Gu9pGQqagKg/51lns+G2XbccmsBiNcD48N+O3MIY3w27KFUVdHSZvZhmQ6XK4lpktK0mT+LucEcGxKQx7SNJIZEwo6SWMYqSAbh+JM95xb3QDbyqneQSRktBHfR80S3n6NAqqgxovXrrf5FASCObvhvMd1bFxAEWN0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658489132857433.2100677858507; Fri, 22 Jul 2022 04:25:32 -0700 (PDT) Received: from localhost ([::1]:43218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqmh-0005bq-MQ for importer@patchew.org; Fri, 22 Jul 2022 07:25:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqav-0003Hj-JL for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqat-0006y8-H7 for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-CGCZdXVRNjCQJaOQfuhiew-1; Fri, 22 Jul 2022 07:13:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95EEB811E76; Fri, 22 Jul 2022 11:13:08 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7D4C40E80E0; Fri, 22 Jul 2022 11:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HmfZTBtu31uLg6djxBfEgCKUx5K7bRKNxH5Q40BBmnY=; b=S58zRGCvmRd1FuGN9JcWaSnVi3NPw5v0P3cjUDALixc8xuY9jsiM7KKiGVOmTXo/jl/6CQ QLrOAbYoEQ/j6P1reJHTe25LqwW4gtDI06Va4pUEJM6p1rvoeIFebHtKHnvH8gdGvhftUR +o5upIMjTIf+wRsns7saFTdFWbY4OK8= X-MC-Unique: CGCZdXVRNjCQJaOQfuhiew-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 4/7] vdpa: add NetClientState->start() callback Date: Fri, 22 Jul 2022 13:12:42 +0200 Message-Id: <20220722111245.3403062-5-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658489134113100001 It allows per-net client operations right after device's successful start. Vhost-vdpa net will use it to add the CVQ buffers to restore the device status. Signed-off-by: Eugenio P=C3=A9rez --- include/net/net.h | 2 ++ hw/net/vhost_net.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 523136c7ac..ad9e80083a 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -44,6 +44,7 @@ typedef struct NICConf { =20 typedef void (NetPoll)(NetClientState *, bool enable); typedef bool (NetCanReceive)(NetClientState *); +typedef int (NetStart)(NetClientState *); typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t); typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, in= t); typedef void (NetCleanup) (NetClientState *); @@ -71,6 +72,7 @@ typedef struct NetClientInfo { NetReceive *receive_raw; NetReceiveIOV *receive_iov; NetCanReceive *can_receive; + NetStart *start; NetCleanup *cleanup; LinkStatusChanged *link_status_changed; QueryRxFilter *query_rx_filter; diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index ccac5b7a64..ddd9ee0441 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -274,6 +274,13 @@ static int vhost_net_start_one(struct vhost_net *net, } } } + + if (net->nc->info->start) { + r =3D net->nc->info->start(net->nc); + if (r < 0) { + goto fail; + } + } return 0; fail: file.fd =3D -1; --=20 2.31.1 From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658488567; cv=none; d=zohomail.com; s=zohoarc; b=kMvcQRJRQvy215l06SxZBMGP1/9z4lLsaqxspclTyEL2rEk8dpW5SjVt0386Mf1GpP7SZEXyjvSRpvkwXqyJyii5ygQfB5OzwoJbxgVGevGyPm9QC+Q9KWLPE0FScHb5u7+6HPxSkHqPtvRjecwByR3Jzvs0O4CpQYQiGq0nMgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658488567; 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:References:Sender:Subject:To; bh=VxuW+X/Od1Fr6DWVKb5qNHhwDSUp3L+B89P7cUb/Uy0=; b=SzX10Dojc+49iwNcpNm0kiPfcqC3ptTqfQ6/Tu/MriJ05Mgrn1Wgk6YlWJOWwvtOwQkhMOEGcgKOEkNKaHMcCTjZiMsRy20bHXyABVsTNZADpLSkGQihRx0namWXKVvDVqBMxhHr5JAQ+WVjsUACEsGyalbhdu3Kd9Ernl+rWlg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658488567261503.4827303172257; Fri, 22 Jul 2022 04:16:07 -0700 (PDT) Received: from localhost ([::1]:59746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqda-0005fr-5v for importer@patchew.org; Fri, 22 Jul 2022 07:16:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqb1-0003Ju-Pk for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqay-0006zC-Jn for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:25 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-7ZnGLahtOHyFaPp8wzY6qg-1; Fri, 22 Jul 2022 07:13:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB803101A588; Fri, 22 Jul 2022 11:13:11 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id D625F40E80E0; Fri, 22 Jul 2022 11:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VxuW+X/Od1Fr6DWVKb5qNHhwDSUp3L+B89P7cUb/Uy0=; b=OSIxgy0NrlUjjiSg0u0sn4UGUtiK+1T/bSDpvHhUi+GWD1O5iP7HXL8JnwiVzIl0cYPhsu 0G4Z6bck229P33abkJliccNPpAs0qLsrsMCTv5UgeG7Sob8OVpYxxRpBHxbDIo3Ywog+Iq 2xh8QZ1IFd8xVJBKV562P8XejNDg2+s= X-MC-Unique: 7ZnGLahtOHyFaPp8wzY6qg-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 5/7] vdpa: Reorder net_vhost_vdpa_info Date: Fri, 22 Jul 2022 13:12:43 +0200 Message-Id: <20220722111245.3403062-6-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658488567640100002 Since we're going to use a new info callback to restore NIC status, we need that callback to be able to send and receive CVQ commands. Reorder so all needed functions are available for it. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index bbe1830824..61516b1432 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -211,16 +211,6 @@ static ssize_t vhost_vdpa_receive(NetClientState *nc, = const uint8_t *buf, return 0; } =20 -static NetClientInfo net_vhost_vdpa_info =3D { - .type =3D NET_CLIENT_DRIVER_VHOST_VDPA, - .size =3D sizeof(VhostVDPAState), - .receive =3D vhost_vdpa_receive, - .cleanup =3D vhost_vdpa_cleanup, - .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, - .has_ufo =3D vhost_vdpa_has_ufo, - .check_peer_type =3D vhost_vdpa_check_peer_type, -}; - static void vhost_vdpa_cvq_unmap_buf(struct vhost_vdpa *v, void *addr) { VhostIOVATree *tree =3D v->iova_tree; @@ -375,6 +365,16 @@ static virtio_net_ctrl_ack vhost_vdpa_net_cvq_add(Vhos= tShadowVirtqueue *svq, return VIRTIO_NET_OK; } =20 +static NetClientInfo net_vhost_vdpa_info =3D { + .type =3D NET_CLIENT_DRIVER_VHOST_VDPA, + .size =3D sizeof(VhostVDPAState), + .receive =3D vhost_vdpa_receive, + .cleanup =3D vhost_vdpa_cleanup, + .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, + .has_ufo =3D vhost_vdpa_has_ufo, + .check_peer_type =3D vhost_vdpa_check_peer_type, +}; + /** * Do not forward commands not supported by SVQ. Otherwise, the device cou= ld * accept it and qemu would not know how to update the device model. --=20 2.31.1 From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658489029; cv=none; d=zohomail.com; s=zohoarc; b=Dv1Pg4Clxj1KBM5ke2Am/T9R3JoTjZCUORxXX2YEJoW5aYrWbhjPIPMbcPckfk6pvDCb+HN+QEKoFgk5mo8WDjM7/t0n6Ejf4U94y8qY5BA2NS4ISZBychh2kB7pUHKEMq/ZvKldEboAHUkDm/KbghANEb8ukmx5xUIRDOyt86E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658489029; 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:References:Sender:Subject:To; bh=RqEtGNLuWYOLrpWaZiEoXzn80W3wnyaAEh7QNoTyeIs=; b=NsXqAoMyRnSnSyByzb/SfMVNzyc1tbq/H1csQQx8GeHTHIXDp5OnTOVlfHQbviCiVmVEsU05YsU1fQwuq3R5AIKJBC30JWk8i28+SSqin/kWMVyykHVA+PsBGUgZC+2UPmkn0VVRAtJfTDetFtZ9R5dfrBiSDCTMVG3jY++M0Ik= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658489029461952.4630067657475; Fri, 22 Jul 2022 04:23:49 -0700 (PDT) Received: from localhost ([::1]:40480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqkz-0003ly-A6 for importer@patchew.org; Fri, 22 Jul 2022 07:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqaw-0003Hv-VG for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqat-0006yC-SS for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:21 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-1-HeYN8Z68MAyU6y97XslZSw-1; Fri, 22 Jul 2022 07:13:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8DD92813D22; Fri, 22 Jul 2022 11:13:14 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBC4440D2962; Fri, 22 Jul 2022 11:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RqEtGNLuWYOLrpWaZiEoXzn80W3wnyaAEh7QNoTyeIs=; b=L2kocJNfayc2GSFG3DoKXnr+jK4A+8XRqnLvep01fPm3o8fp3k1PkYWB5GlMaiN6gv7azs Ml2ZuikT6urBsBdLakv5aBjFtNrUlXanbVWaMxReBWkr6jEw7RleZj0O/DpdHh13BGmjEI Fe4za8fqk2y1sWBspDQoF2VsjGwEySk= X-MC-Unique: HeYN8Z68MAyU6y97XslZSw-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 6/7] vdpa: Add virtio-net mac address via CVQ at start Date: Fri, 22 Jul 2022 13:12:44 +0200 Message-Id: <20220722111245.3403062-7-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658489030704100001 This is needed so the destination vdpa device see the same state a the guest set in the source. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 61516b1432..3e15a42c35 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -365,10 +365,71 @@ static virtio_net_ctrl_ack vhost_vdpa_net_cvq_add(Vho= stShadowVirtqueue *svq, return VIRTIO_NET_OK; } =20 +static int vhost_vdpa_net_start(NetClientState *nc) +{ + VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); + struct vhost_vdpa *v =3D &s->vhost_vdpa; + VirtIONet *n; + uint64_t features; + VhostShadowVirtqueue *svq; + + assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VDPA); + + if (!v->shadow_vqs_enabled) { + return 0; + } + + if (v->dev->nvqs !=3D 1 && + v->dev->vq_index + v->dev->nvqs !=3D v->dev->vq_index_end) { + /* Only interested in CVQ */ + return 0; + } + + n =3D VIRTIO_NET(v->dev->vdev); + features =3D v->dev->vdev->host_features; + svq =3D g_ptr_array_index(v->shadow_vqs, 0); + if (features & BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR)) { + const struct virtio_net_ctrl_hdr ctrl =3D { + .class =3D VIRTIO_NET_CTRL_MAC, + .cmd =3D VIRTIO_NET_CTRL_MAC_ADDR_SET, + }; + uint8_t mac[6]; + const struct iovec out[] =3D { + { + .iov_base =3D (void *)&ctrl, + .iov_len =3D sizeof(ctrl), + },{ + .iov_base =3D mac, + .iov_len =3D sizeof(mac), + }, + }; + struct iovec dev_buffers[2] =3D { + { .iov_base =3D s->cvq_cmd_out_buffer }, + { .iov_base =3D s->cvq_cmd_in_buffer }, + }; + bool ok; + virtio_net_ctrl_ack state; + + ok =3D vhost_vdpa_net_cvq_map_sg(s, out, ARRAY_SIZE(out), dev_buff= ers); + if (unlikely(!ok)) { + return -1; + } + + memcpy(mac, n->mac, sizeof(mac)); + state =3D vhost_vdpa_net_cvq_add(svq, dev_buffers); + vhost_vdpa_cvq_unmap_buf(v, dev_buffers[0].iov_base); + vhost_vdpa_cvq_unmap_buf(v, dev_buffers[1].iov_base); + return state =3D=3D VIRTIO_NET_OK ? 0 : 1; + } + + return 0; +} + static NetClientInfo net_vhost_vdpa_info =3D { .type =3D NET_CLIENT_DRIVER_VHOST_VDPA, .size =3D sizeof(VhostVDPAState), .receive =3D vhost_vdpa_receive, + .start =3D vhost_vdpa_net_start, .cleanup =3D vhost_vdpa_cleanup, .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, .has_ufo =3D vhost_vdpa_has_ufo, --=20 2.31.1 From nobody Sat May 18 15:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1658489176; cv=none; d=zohomail.com; s=zohoarc; b=gejO86P11Pz5H+CIE91udyiUuh5X2/zny99qqwtJ0lU10YAQuj0APiHy2/fesuqaPMBZ8grVXftVfE+dMaJesWWZEBJFH0a30Kv08mwngknyaSlrPTUZoWsZtTQ9ZpblnJ40KaRXqkXqxEhLaAb3QHoBb7Tedxxk52RFMLbT75A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658489176; 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:References:Sender:Subject:To; bh=HOmpxm6oqdk7RUGL1IEZnq38DAo9lbqWvGS7gtDA59c=; b=Jprw18UzslFh/KnYLcgb42VB5Orau6Nl8i/MHxlI+cyRZcfKbIj1TPGSLTq86HHYCwBlrYYgefuaGJJEOBqrm40CuMHP8eQwCCDywxvzilS8CRZn1fWv9b5qZwwyVNrG4GBw5sDT9dvSdqK5iYa65QAZrYbZnpYAEp7/m9sk1HE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1658489176264721.9038619104923; Fri, 22 Jul 2022 04:26:16 -0700 (PDT) Received: from localhost ([::1]:44700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEqnP-0006dM-50 for importer@patchew.org; Fri, 22 Jul 2022 07:26:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqay-0003It-Es for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEqax-0006yt-0M for qemu-devel@nongnu.org; Fri, 22 Jul 2022 07:13:24 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-491-vLWVurXqPbeyuV3wXypMRA-1; Fri, 22 Jul 2022 07:13:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9D052813D3E; Fri, 22 Jul 2022 11:13:17 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.194.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0597F40D2962; Fri, 22 Jul 2022 11:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658488402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HOmpxm6oqdk7RUGL1IEZnq38DAo9lbqWvGS7gtDA59c=; b=Wguff0Z9kcoguq5mZ4VVONVINpm+UAXMi8GYsbxVuwCk/hN/yihNL7xJpgbCXNlCr5RqBK PRg2rxEPDmP4pyRoeawx4euQXVOI4peMeO+9Sjq/VB1Cjwdf+mj9UKLG4R5fIstVlCepXw dDRauLGJu49DvPpGFLibWLBp6XgN3XM= X-MC-Unique: vLWVurXqPbeyuV3wXypMRA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Parav Pandit , Zhu Lingshan , Paolo Bonzini , Markus Armbruster , Laurent Vivier , Harpreet Singh Anand , Gautam Dawar , Eli Cohen , Eric Blake , "Gonglei (Arei)" , Cornelia Huck , Stefano Garzarella , Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , Cindy Lu , Liuxiangdong Subject: [PATCH v4 7/7] vdpa: Delete CVQ migration blocker Date: Fri, 22 Jul 2022 13:12:45 +0200 Message-Id: <20220722111245.3403062-8-eperezma@redhat.com> In-Reply-To: <20220722111245.3403062-1-eperezma@redhat.com> References: <20220722111245.3403062-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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=170.10.129.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658489176804100001 We can restore the device state in the destination via CVQ now. Remove the migration blocker. Signed-off-by: Eugenio P=C3=A9rez --- include/hw/virtio/vhost-vdpa.h | 1 - hw/virtio/vhost-vdpa.c | 14 -------------- net/vhost-vdpa.c | 2 -- 3 files changed, 17 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index d10a89303e..1111d85643 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -35,7 +35,6 @@ typedef struct vhost_vdpa { bool shadow_vqs_enabled; /* IOVA mapping used by the Shadow Virtqueue */ VhostIOVATree *iova_tree; - Error *migration_blocker; GPtrArray *shadow_vqs; const VhostShadowVirtqueueOps *shadow_vq_ops; void *shadow_vq_ops_opaque; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 3ff9ce3501..9a2daef7e3 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1023,13 +1023,6 @@ static bool vhost_vdpa_svqs_start(struct vhost_dev *= dev) return true; } =20 - if (v->migration_blocker) { - int r =3D migrate_add_blocker(v->migration_blocker, &err); - if (unlikely(r < 0)) { - return false; - } - } - for (i =3D 0; i < v->shadow_vqs->len; ++i) { VirtQueue *vq =3D virtio_get_queue(dev->vdev, dev->vq_index + i); VhostShadowVirtqueue *svq =3D g_ptr_array_index(v->shadow_vqs, i); @@ -1072,10 +1065,6 @@ err: vhost_svq_stop(svq); } =20 - if (v->migration_blocker) { - migrate_del_blocker(v->migration_blocker); - } - return false; } =20 @@ -1095,9 +1084,6 @@ static bool vhost_vdpa_svqs_stop(struct vhost_dev *de= v) } } =20 - if (v->migration_blocker) { - migrate_del_blocker(v->migration_blocker); - } return true; } =20 diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3e15a42c35..75143ded8b 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -577,8 +577,6 @@ static NetClientState *net_vhost_vdpa_init(NetClientSta= te *peer, =20 s->vhost_vdpa.shadow_vq_ops =3D &vhost_vdpa_net_svq_ops; s->vhost_vdpa.shadow_vq_ops_opaque =3D s; - error_setg(&s->vhost_vdpa.migration_blocker, - "Migration disabled: vhost-vdpa uses CVQ."); } ret =3D vhost_vdpa_add(nc, (void *)&s->vhost_vdpa, queue_pair_index, n= vqs); if (ret) { --=20 2.31.1