From nobody Sat Apr 11 21:30:05 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1772645955; cv=none; d=zohomail.com; s=zohoarc; b=UrDh8ZXFhIbPKvgiyZW5oIfKiZdaoYbqCkjs2LECgDmc+xoSqf3yoGXqM/f5c+nByW09rnbfKi89axYAK1UtU+S2+nhMiRJVenKDiDUFvrg8RDjdkdufJeH5NWP7qcE8lYoSj8LFdBu5siRO62P7v7zjxOCmmRZE00SIF3Z6Swc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772645955; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fSJ5ui4x1BlJ6ycbzdkZJue4RL9krliFd6wFaDG74dI=; b=DdQQLX/J86j9NGJzf4N0TyQdovyM3Neyu/Gbj50jBBK6i5WxC3HTJgpXeIX5BjCYKYQQAyP0Kzm4OfMvtSu7lmWL4vbAAKQPmplTtNdC0FTfkW82IZc4DdsIAMJRvC27eHAGJ57l1Aa1niY/KAP3nNARL2p3cX5iPIrNm1TZCfg= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772645955775325.53031172474414; Wed, 4 Mar 2026 09:39:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxqBf-0007Js-9K; Wed, 04 Mar 2026 12:39:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxqBe-0007Jj-1l for qemu-devel@nongnu.org; Wed, 04 Mar 2026 12:39:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxqBc-0005Bl-N5 for qemu-devel@nongnu.org; Wed, 04 Mar 2026 12:39:05 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-pgMbb0-0NUqX88Uhi7vpbQ-1; Wed, 04 Mar 2026 12:39:02 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BE1A71956080 for ; Wed, 4 Mar 2026 17:39:01 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.224.212]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 76BF418001FE; Wed, 4 Mar 2026 17:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772645943; 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; bh=fSJ5ui4x1BlJ6ycbzdkZJue4RL9krliFd6wFaDG74dI=; b=guc/YXPuGU+EvAe5xYCHRQcTiczFsJL9/3TrcuefC6FgePam6txsfzUTyLcWmJ2s90lLtg 9tEq4kO0rwC/J0vcbWUooNno1uq45DyFPqG21OBElPZ8PzQUu/RKzNtLLC4vpm5VD2ed4K U/fHePb+vljhhpP20Ew29I9dkMAY9fU= X-MC-Unique: pgMbb0-0NUqX88Uhi7vpbQ-1 X-Mimecast-MFC-AGG-ID: pgMbb0-0NUqX88Uhi7vpbQ_1772645941 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Jason Wang , Maxime Coquelin , Laurent Vivier , "Michael S. Tsirkin" Subject: [PATCH] net/vhost-vdpa: enable vqs before DRIVER_OK if no cvq Date: Wed, 4 Mar 2026 18:38:57 +0100 Message-ID: <20260304173857.2705296-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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: 33 X-Spam_score: 3.3 X-Spam_bar: +++ X-Spam_report: (3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.703, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.386, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1772645957092158500 VDUSE do not forward the enable message to the userland device at the moment, leaving the dataplane disabled. As there is no functional difference if the device have no CVQ, enable them before DRIVER_OK in that case. For devices with a control vq, keep the enabling of the dataplane after CVQ so QEMU can restore the device configuration. Signed-off-by: Eugenio P=C3=A9rez Fixes: 6c4825476a43 ("vdpa: move vhost_vdpa_set_vring_ready to the caller") Acked-by: Jason Wang --- net/vhost-vdpa.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3df6091274e5..ee7eb1a4db28 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -397,6 +397,7 @@ static int vhost_vdpa_net_data_start(NetClientState *nc) { VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); struct vhost_vdpa *v =3D &s->vhost_vdpa; + bool has_cvq =3D v->dev->vq_index_end % 2; =20 assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VDPA); =20 @@ -406,6 +407,15 @@ static int vhost_vdpa_net_data_start(NetClientState *n= c) v->shadow_vqs_enabled =3D false; } =20 + if (!has_cvq) { + for (int i =3D 0; i < v->dev->nvqs; ++i) { + int ret =3D vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index= ); + if (ret < 0) { + return ret; + } + } + } + if (v->index =3D=3D 0) { v->shared->shadow_data =3D v->shadow_vqs_enabled; vhost_vdpa_net_data_start_first(s); @@ -415,25 +425,6 @@ static int vhost_vdpa_net_data_start(NetClientState *n= c) return 0; } =20 -static int vhost_vdpa_net_data_load(NetClientState *nc) -{ - VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); - struct vhost_vdpa *v =3D &s->vhost_vdpa; - bool has_cvq =3D v->dev->vq_index_end % 2; - - if (has_cvq) { - return 0; - } - - for (int i =3D 0; i < v->dev->nvqs; ++i) { - int ret =3D vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index); - if (ret < 0) { - return ret; - } - } - return 0; -} - static void vhost_vdpa_net_client_stop(NetClientState *nc) { VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); @@ -450,7 +441,6 @@ static NetClientInfo net_vhost_vdpa_info =3D { .size =3D sizeof(VhostVDPAState), .receive =3D vhost_vdpa_receive, .start =3D vhost_vdpa_net_data_start, - .load =3D vhost_vdpa_net_data_load, .stop =3D vhost_vdpa_net_client_stop, .cleanup =3D vhost_vdpa_cleanup, .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, --=20 2.53.0