From nobody Sat Feb 7 14:16:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8634C350A25 for ; Wed, 28 Jan 2026 12:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604340; cv=none; b=AaBDzUsZEMPoMuaO/Wzle/+/+x6leDona7WiUfXUI4U/KcZ8gtHQtHQ1cMf6JG+RqYNMrUHIAdGQnUiPPulw4qfBNuD1uBWQeZAhfVLL1KBpI7pl1ogIIZ22nO74GfUF/7g1C+yEZCikkQA/H++fQ9tzb54duyVJJygwoOTzbAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604340; c=relaxed/simple; bh=vOqUO0cPzeG6aQUwYOb8NotITcNEuffs9cCb4v4Ei+s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=briowaJFa7dCIs76URn1Pzg86d8W67x1p3BnrdrfMAuKWwEqJuV4X5w2rirIYMHhWuP08dtchI7Wnu2RcNI8QOJSHiWE3BeAji9EoYpi27FlFClLMRpEWy2YBENZIskLBl3bdmsNjOjGTSiQ/MC1AKl6h/9k9iMFIOk2w6OvsEE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GJBVi6Cu; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GJBVi6Cu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769604337; 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=OzVBQh8ynOpx3vM+BHN969HxbH33+A4edKnI99b4pMw=; b=GJBVi6Cu2Ae/wuY3UbX/AAewhMK7mouohTQ94/iGMtDa8ye26O1fbjiOpDWlbjJNH0iJSn 9oDv61Y75ty+FJktE4G1iTvDtdU5eq8MjnQrvUojlt30CviDR6N/8dvbZndJ46O2BFrHQv ixUSFsKWlFV1iOjDoGGytq1nKeOzigQ= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-30EKy1cQNlmA7Wz3xrjvCQ-1; Wed, 28 Jan 2026 07:45:36 -0500 X-MC-Unique: 30EKy1cQNlmA7Wz3xrjvCQ-1 X-Mimecast-MFC-AGG-ID: 30EKy1cQNlmA7Wz3xrjvCQ_1769604335 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4FAFC180035D; Wed, 28 Jan 2026 12:45:35 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.239]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7FAA130001A2; Wed, 28 Jan 2026 12:45:31 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: Jason Wang , Xuan Zhuo , Cindy Lu , Laurent Vivier , Stefano Garzarella , linux-kernel@vger.kernel.org, Maxime Coquelin , Yongji Xie , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev Subject: [PATCH 1/6] vduse: ensure vq->ready access is smp safe Date: Wed, 28 Jan 2026 13:45:19 +0100 Message-ID: <20260128124524.875271-2-eperezma@redhat.com> In-Reply-To: <20260128124524.875271-1-eperezma@redhat.com> References: <20260128124524.875271-1-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.4 The vduse_vdpa_set_vq_ready can be called in the lifetime of the device well after initial setup, and the device can read it afterwards. Ensure that reads and writes to vq->ready are SMP safe so that the caller can trust that virtqueue kicks and calls behave as expected immediately after the operation returns. Signed-off-by: Eugenio P=C3=A9rez --- drivers/vdpa/vdpa_user/vduse_dev.c | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index 73d1d517dc6c..a4963aaf9332 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -460,6 +460,24 @@ static __poll_t vduse_dev_poll(struct file *file, poll= _table *wait) return mask; } =20 +static bool vduse_vq_get_ready(const struct vduse_virtqueue *vq) +{ + /* + * Paired with vduse_vq_set_ready smp_store, as the driver may modify + * it while the VDUSE instance is reading it. + */ + return smp_load_acquire(&vq->ready); +} + +static void vduse_vq_set_ready(struct vduse_virtqueue *vq, bool ready) +{ + /* + * Paired with vduse_vq_get_ready smp_load, as the driver may modify + * it while the VDUSE instance is reading it. + */ + smp_store_release(&vq->ready, ready); +} + static void vduse_dev_reset(struct vduse_dev *dev) { int i; @@ -486,7 +504,7 @@ static void vduse_dev_reset(struct vduse_dev *dev) for (i =3D 0; i < dev->vq_num; i++) { struct vduse_virtqueue *vq =3D dev->vqs[i]; =20 - vq->ready =3D false; + vduse_vq_set_ready(vq, false); vq->desc_addr =3D 0; vq->driver_addr =3D 0; vq->device_addr =3D 0; @@ -529,7 +547,7 @@ static int vduse_vdpa_set_vq_address(struct vdpa_device= *vdpa, u16 idx, static void vduse_vq_kick(struct vduse_virtqueue *vq) { spin_lock(&vq->kick_lock); - if (!vq->ready) + if (!vduse_vq_get_ready(vq)) goto unlock; =20 if (vq->kickfd) @@ -598,7 +616,7 @@ static void vduse_vdpa_set_vq_ready(struct vdpa_device = *vdpa, struct vduse_dev *dev =3D vdpa_to_vduse(vdpa); struct vduse_virtqueue *vq =3D dev->vqs[idx]; =20 - vq->ready =3D ready; + vduse_vq_set_ready(vq, ready); } =20 static bool vduse_vdpa_get_vq_ready(struct vdpa_device *vdpa, u16 idx) @@ -606,7 +624,7 @@ static bool vduse_vdpa_get_vq_ready(struct vdpa_device = *vdpa, u16 idx) struct vduse_dev *dev =3D vdpa_to_vduse(vdpa); struct vduse_virtqueue *vq =3D dev->vqs[idx]; =20 - return vq->ready; + return vduse_vq_get_ready(vq); } =20 static int vduse_vdpa_set_vq_state(struct vdpa_device *vdpa, u16 idx, @@ -1097,7 +1115,7 @@ static int vduse_kickfd_setup(struct vduse_dev *dev, if (vq->kickfd) eventfd_ctx_put(vq->kickfd); vq->kickfd =3D ctx; - if (vq->ready && vq->kicked && vq->kickfd) { + if (vduse_vq_get_ready(vq) && vq->kicked && vq->kickfd) { eventfd_signal(vq->kickfd); vq->kicked =3D false; } @@ -1133,7 +1151,7 @@ static void vduse_vq_irq_inject(struct work_struct *w= ork) struct vduse_virtqueue, inject); =20 spin_lock_bh(&vq->irq_lock); - if (vq->ready && vq->cb.callback) + if (vduse_vq_get_ready(vq) && vq->cb.callback) vq->cb.callback(vq->cb.private); spin_unlock_bh(&vq->irq_lock); } @@ -1146,7 +1164,7 @@ static bool vduse_vq_signal_irqfd(struct vduse_virtqu= eue *vq) return false; =20 spin_lock_irq(&vq->irq_lock); - if (vq->ready && vq->cb.trigger) { + if (vduse_vq_get_ready(vq) && vq->cb.trigger) { eventfd_signal(vq->cb.trigger); signal =3D true; } @@ -1500,7 +1518,7 @@ static long vduse_dev_ioctl(struct file *file, unsign= ed int cmd, vq_info.split.avail_index =3D vq->state.split.avail_index; =20 - vq_info.ready =3D vq->ready; + vq_info.ready =3D vduse_vq_get_ready(vq); =20 ret =3D -EFAULT; if (copy_to_user(argp, &vq_info, sizeof(vq_info))) --=20 2.52.0 From nobody Sat Feb 7 14:16:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4196032BF43 for ; Wed, 28 Jan 2026 12:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604346; cv=none; b=SmuoxhYGFRQBvtsk+I41arFDivjBChKtXGzmMtPnvn9pc5rJ9LwW7szxCxpVdFZVJA7krfvhfqMbaAQFbEyM1UDdQKhobSbMniQ4kXiF4Jbpu9lkb4AHLhBSxuIVtQacZyJJrpLC37MBw8bQhNUBhp9LYPz+uih6pKMmIUMRgM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604346; c=relaxed/simple; bh=EfCQmhYSIDHocEJRMzpUejK2Cok2tj0jxu49geXWjfA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uY+R9WeQhLBeQrM+0YMSCEkXJSPeyBIcyhqnzLUWnRoEnl/pTlTrTwD/VY6/1wz0TWNVL+x/ULWdLIwhOUk2SYrn2PjrLwtHcbOgk7KsSTdToaHjkFetR3A3sW5j0FCf0HpgtxxB4TUZgVrSOyyZgNNH2V7gBtENC2UjvdIhhms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SmmMdlSc; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SmmMdlSc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769604344; 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=KubtyHhITHWdcwOjvGJzBrvZM5flQAY+/c3XSEbmS+U=; b=SmmMdlSczfGz9/iW57OU7rEuj+geI1M07ZZoHXqnd6M+K+mG5VIZvYpGgH7kqrJV8vZMCa GPtdreW6lPZZ7O7N8y0qg0TCJaSvf/pUHaPKA+Htcq8odeOYFl6GskcPzJjjupCnFVthlQ fkWpbesZmAjQlcwJMEq5NGpvigrUwHE= 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-94-uZsdqd5ONySuTRqibEfNLg-1; Wed, 28 Jan 2026 07:45:41 -0500 X-MC-Unique: uZsdqd5ONySuTRqibEfNLg-1 X-Mimecast-MFC-AGG-ID: uZsdqd5ONySuTRqibEfNLg_1769604340 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 A00D819775A7; Wed, 28 Jan 2026 12:45:39 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.239]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CA92C30001A2; Wed, 28 Jan 2026 12:45:35 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: Jason Wang , Xuan Zhuo , Cindy Lu , Laurent Vivier , Stefano Garzarella , linux-kernel@vger.kernel.org, Maxime Coquelin , Yongji Xie , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev Subject: [PATCH 2/6] vduse: store control device pointer Date: Wed, 28 Jan 2026 13:45:20 +0100 Message-ID: <20260128124524.875271-3-eperezma@redhat.com> In-Reply-To: <20260128124524.875271-1-eperezma@redhat.com> References: <20260128124524.875271-1-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.4 This helps log the errors in next patches. The alternative is to perform a linear search for it with class_find_device_by_devt(class, devt), as device_destroy do for cleaning. Signed-off-by: Eugenio P=C3=A9rez --- drivers/vdpa/vdpa_user/vduse_dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index a4963aaf9332..551ccde0b856 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -164,6 +164,7 @@ static DEFINE_IDR(vduse_idr); =20 static dev_t vduse_major; static struct cdev vduse_ctrl_cdev; +static const struct device *vduse_ctrl_dev; static struct cdev vduse_cdev; static struct workqueue_struct *vduse_irq_wq; static struct workqueue_struct *vduse_irq_bound_wq; @@ -2426,7 +2427,6 @@ static void vduse_mgmtdev_exit(void) static int vduse_init(void) { int ret; - struct device *dev; =20 ret =3D class_register(&vduse_class); if (ret) @@ -2443,9 +2443,9 @@ static int vduse_init(void) if (ret) goto err_ctrl_cdev; =20 - dev =3D device_create(&vduse_class, NULL, vduse_major, NULL, "control"); - if (IS_ERR(dev)) { - ret =3D PTR_ERR(dev); + vduse_ctrl_dev =3D device_create(&vduse_class, NULL, vduse_major, NULL, "= control"); + if (IS_ERR(vduse_ctrl_dev)) { + ret =3D PTR_ERR(vduse_ctrl_dev); goto err_device; } =20 --=20 2.52.0 From nobody Sat Feb 7 14:16:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9285933D51D for ; Wed, 28 Jan 2026 12:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604350; cv=none; b=RKwrZCvsrqfRRME/y+8hzEEH3dNe57zMv5WzgUNrro2V26iqp1o31RjeBJxXCYWd2hGxL2dKXfHoa2k4y1ML3hK+uiZXKk3wO0HlUvmGUf9CiyHiY8d09fap1ny7HpE+fxn89LstoFx0QyFnDD/rqlrBn+jeW+EWCzriYbjMkAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604350; c=relaxed/simple; bh=xJ0hpPC1Mj/MA/To2N3dZPAJOkgDLAVTKEvIX/nQUtY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bP2QTsXKZ5PkXj2e+A70SCc09foySwVLjkBAGoHPNxmP+XN/ry8kTA3v3wbctLGnrXV7Hgcs1RLnmTE3JVJTLcrL4uRBVrFRaExzB6XN/Dx9+QVvCEKRwiwQySousUyXcFh+tTbJTXYM8bYEZBtNBdiIdypIrgDTcW81FZEfRyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=E5nGjLFU; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E5nGjLFU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769604348; 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=tR0t8gQb2jQmayWHiX0aSSeiUmtsNw1fKY557776eB0=; b=E5nGjLFUFOUaOewzCSjwh8fc9OUwqIeJKn3Gp3bATo9ttG9HQZRJcc0j2CCFy4fZjtpxLF rsTqbYWai6A+KgHOt39X4sK03DKs4okkqLyHZ8GV4PDLz6jksyl2zEDsREUx5osDGYyLjE yhAvVNX+sopklkNgwe52P8sYjiLnGn8= Received: from mx-prod-mc-03.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-161-iD9D9ld0OyytF6kyLMpXSA-1; Wed, 28 Jan 2026 07:45:45 -0500 X-MC-Unique: iD9D9ld0OyytF6kyLMpXSA-1 X-Mimecast-MFC-AGG-ID: iD9D9ld0OyytF6kyLMpXSA_1769604344 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 67A691955D93; Wed, 28 Jan 2026 12:45:44 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.239]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 26FFA30002D8; Wed, 28 Jan 2026 12:45:39 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: Jason Wang , Xuan Zhuo , Cindy Lu , Laurent Vivier , Stefano Garzarella , linux-kernel@vger.kernel.org, Maxime Coquelin , Yongji Xie , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev Subject: [PATCH 3/6] vduse: Add API v2 definition Date: Wed, 28 Jan 2026 13:45:21 +0100 Message-ID: <20260128124524.875271-4-eperezma@redhat.com> In-Reply-To: <20260128124524.875271-1-eperezma@redhat.com> References: <20260128124524.875271-1-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.4 Introduce the definition for VDUSE API V2. This version serves as a gateway for feature negotiation. The kernel uses this version to determine if the userspace device supports feature flags. Devices that do not explicitly negotiate API V2 will be blocked from querying available VDUSE features, ensuring backward compatibility. The next patches implement the new feature incrementally, only enabling the VDUSE device to set the V2 API version by the end of the series. Signed-off-by: Eugenio P=C3=A9rez --- include/uapi/linux/vduse.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h index 68b4287f9fac..dea89ed281a7 100644 --- a/include/uapi/linux/vduse.h +++ b/include/uapi/linux/vduse.h @@ -14,6 +14,10 @@ =20 #define VDUSE_API_VERSION_1 1 =20 +/* Features support */ + +#define VDUSE_API_VERSION_2 2 + /* * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION). * This is used for future extension. --=20 2.52.0 From nobody Sat Feb 7 14:16:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D861B350A25 for ; Wed, 28 Jan 2026 12:45:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604353; cv=none; b=tz4+endslfj3i8KpMwTC55kc7XZHtF1pwWSfQxv2pccLl8m4awT3GpNWjt82pivT/hyCmVwk/DYz41RGpPrLF5tKaGDrWmV4QeuLD4rPqP8N8TIZDM8/RlE7JnjTO39elhT75/MtvKnJHxOexdFnz7DVg9v+68baM6cSCdvxfDw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604353; c=relaxed/simple; bh=C8DivxRRg8E3jNAOaDJgWJW4bb7VflNyrM3SCd6jm4g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ka/czyqdjLVFoV42oRkqoWD1Vhyigr/rqRYSJaUNzgi/1+giuy0dwJq3z70dXanbWdwm4x+yvhG2sEhY6Yjt4N3InL1PDNiipdpPJYBllgByVgwNivXBsZtaybd16u8D4ne2Bv0FnVmuivtRLWTpPTG8nY0RM6OKMdPCXz9XuhA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Pf//CxJb; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Pf//CxJb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769604350; 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=7IBjYw3BhrBWMRTseZ9M3Gp4FTwThD/kWjxbEDJtfBo=; b=Pf//CxJboaNjm6UCIGjMQcrHD734qzAcX+o5zwwpOuUkYZ9Tzrxqcbt8gqDLuEfByaxtrn jL/0a3RSZorb5TaMJ/GiFoPfYICWNGIUAXpK52JQTCJ9AVdsraFw/vBdt7+nMFhCXt7Rpv Zh3fSRapHgFqi0DKPKFZK+FGXS6fZ+4= Received: from mx-prod-mc-01.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-538-Wq0W4mVnOPSbWsxFuYq6cQ-1; Wed, 28 Jan 2026 07:45:49 -0500 X-MC-Unique: Wq0W4mVnOPSbWsxFuYq6cQ-1 X-Mimecast-MFC-AGG-ID: Wq0W4mVnOPSbWsxFuYq6cQ_1769604348 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AF6B81944B0C; Wed, 28 Jan 2026 12:45:48 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.239]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1AE6530001A2; Wed, 28 Jan 2026 12:45:44 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: Jason Wang , Xuan Zhuo , Cindy Lu , Laurent Vivier , Stefano Garzarella , linux-kernel@vger.kernel.org, Maxime Coquelin , Yongji Xie , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev Subject: [PATCH 4/6] vduse: add VDUSE_GET_FEATURES ioctl Date: Wed, 28 Jan 2026 13:45:22 +0100 Message-ID: <20260128124524.875271-5-eperezma@redhat.com> In-Reply-To: <20260128124524.875271-1-eperezma@redhat.com> References: <20260128124524.875271-1-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.4 Add an ioctl to allow VDUSE instances to query the available features supported by the kernel module. Signed-off-by: Eugenio P=C3=A9rez --- A simple u64 bitmap is used for feature flags. While a flexible array could support indefinite expansion, 64 bits is sufficient for the foreseeable future and simplifies the implementation. Also, dev_dbg is used for logging rather than dev_err as these can be triggered from userspace. --- drivers/vdpa/vdpa_user/vduse_dev.c | 28 ++++++++++++++++++++++++++++ include/uapi/linux/vduse.h | 7 ++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index 551ccde0b856..e7da69c2ad71 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -52,6 +52,9 @@ =20 #define IRQ_UNBOUND -1 =20 +/* Supported VDUSE features */ +static const uint64_t vduse_features; + /* * VDUSE instance have not asked the vduse API version, so assume 0. * @@ -1977,6 +1980,19 @@ static bool vduse_validate_config(struct vduse_dev_c= onfig *config, sizeof(config->reserved))) return false; =20 + if (api_version < VDUSE_API_VERSION_2) { + if (config->vduse_features) { + dev_dbg(vduse_ctrl_dev, + "config->vduse_features with version %llu", + api_version); + return false; + } + } else { + if (config->vduse_features & ~vduse_features) + return false; + } + + if (api_version < VDUSE_API_VERSION_1 && (config->ngroups || config->nas)) return false; @@ -2237,6 +2253,18 @@ static long vduse_ioctl(struct file *file, unsigned = int cmd, ret =3D vduse_destroy_dev(name); break; } + case VDUSE_GET_FEATURES: + if (control->api_version < VDUSE_API_VERSION_2) { + dev_dbg(vduse_ctrl_dev, + "VDUSE_GET_FEATURES ioctl with version %llu", + control->api_version); + ret =3D -ENOIOCTLCMD; + break; + } + + ret =3D put_user(vduse_features, (u64 __user *)argp); + break; + default: ret =3D -EINVAL; break; diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h index dea89ed281a7..1f68e556cbf2 100644 --- a/include/uapi/linux/vduse.h +++ b/include/uapi/linux/vduse.h @@ -37,6 +37,7 @@ * @vq_align: the allocation alignment of virtqueue's metadata * @ngroups: number of vq groups that VDUSE device declares * @nas: number of address spaces that VDUSE device declares + * @vduse_features: VDUSE features * @reserved: for future use, needs to be initialized to zero * @config_size: the size of the configuration space * @config: the buffer of the configuration space @@ -53,7 +54,8 @@ struct vduse_dev_config { __u32 vq_align; __u32 ngroups; /* if VDUSE_API_VERSION >=3D 1 */ __u32 nas; /* if VDUSE_API_VERSION >=3D 1 */ - __u32 reserved[11]; + __u64 vduse_features; + __u32 reserved[9]; __u32 config_size; __u8 config[]; }; @@ -67,6 +69,9 @@ struct vduse_dev_config { */ #define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX]) =20 +/* Get the VDUSE supported features */ +#define VDUSE_GET_FEATURES _IOR(VDUSE_BASE, 0x04, __u64) + /* The ioctls for VDUSE device (/dev/vduse/$NAME) */ =20 /** --=20 2.52.0 From nobody Sat Feb 7 14:16:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 249642F5A2D for ; Wed, 28 Jan 2026 12:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604358; cv=none; b=JcUwpY4zD17zphS5AmffkD4vJJxfHuQjQaB4ozyIgo60FfCg1G/vF/olVmZzdzo3R8ICQ0EY5lMag8xS2X1+7hmc2lKuOUE68MPV+LdozPg/wg2KQUOjsqJrDPECeLT0eVkqaIyb9EXAHAbyvjC0YZrlGctYv/RWXfwzZSqh33k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604358; c=relaxed/simple; bh=ZSBZDLG6/HePANcFQxRld3Pamu8fkUNGQbeHZjZre+s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FIKC4wV71AH3R4Me974IPrLFnIdWhZ3HJe6pQsHgcfyFUibCe+95LaeuxgL/MSKtFBsLKtF4ZD5VsdokyXBvFUb18OeCGgkubxtS5MJ+d8QODXLqdPLiCJcgj84uNqOKh83b50/s2MJpJm8SxqJkqCzeziFQ5ZV7a4EuSOxnoCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ABXjtqQ1; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ABXjtqQ1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769604356; 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=zMuDVwbLpNOKJnmsQp3y2Bk7yNL03EP1tUH4/lkzTgo=; b=ABXjtqQ1PMgx1SOm5wbKA1KxV4Yds5jjzABUixlF1xto0hD5zyNR+iGzIEL5582aX3RcfW 6QWSiRpPczBckp+Q8hfwmTvwhib/04IL4W5uhLwxhVyegydCllg40tUcOD9uN8/JbLGG7m k6W0Oi5D/285Ip4dZ6eSz+95sjZa8tY= Received: from mx-prod-mc-03.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-417-v7hLI8FFMtWl5naXsRTKxQ-1; Wed, 28 Jan 2026 07:45:54 -0500 X-MC-Unique: v7hLI8FFMtWl5naXsRTKxQ-1 X-Mimecast-MFC-AGG-ID: v7hLI8FFMtWl5naXsRTKxQ_1769604353 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CC56E1955D84; Wed, 28 Jan 2026 12:45:52 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.239]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3679230001A2; Wed, 28 Jan 2026 12:45:48 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: Jason Wang , Xuan Zhuo , Cindy Lu , Laurent Vivier , Stefano Garzarella , linux-kernel@vger.kernel.org, Maxime Coquelin , Yongji Xie , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev Subject: [PATCH 5/6] vduse: add F_QUEUE_READY feature Date: Wed, 28 Jan 2026 13:45:23 +0100 Message-ID: <20260128124524.875271-6-eperezma@redhat.com> In-Reply-To: <20260128124524.875271-1-eperezma@redhat.com> References: <20260128124524.875271-1-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.4 Add the VDUSE_F_QUEUE_READY feature flag. This allows the kernel module to explicitly signal userspace when a specific virtqueue has been enabled. In scenarios like Live Migration of VirtIO net devices, the dataplane starts after the control virtqueue allowing QEMU to apply configuration in the destination device. Signed-off-by: Eugenio P=C3=A9rez --- drivers/vdpa/vdpa_user/vduse_dev.c | 28 +++++++++++++++++++++++++++- include/uapi/linux/vduse.h | 19 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index e7da69c2ad71..1d93b540db4d 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -9,6 +9,7 @@ */ =20 #include "linux/virtio_net.h" +#include #include #include #include @@ -53,7 +54,7 @@ #define IRQ_UNBOUND -1 =20 /* Supported VDUSE features */ -static const uint64_t vduse_features; +static const uint64_t vduse_features =3D BIT_U64(VDUSE_F_QUEUE_READY); =20 /* * VDUSE instance have not asked the vduse API version, so assume 0. @@ -120,6 +121,7 @@ struct vduse_dev { char *name; struct mutex lock; spinlock_t msg_lock; + u64 vduse_features; u64 msg_unique; u32 msg_timeout; wait_queue_head_t waitq; @@ -619,7 +621,30 @@ static void vduse_vdpa_set_vq_ready(struct vdpa_device= *vdpa, { struct vduse_dev *dev =3D vdpa_to_vduse(vdpa); struct vduse_virtqueue *vq =3D dev->vqs[idx]; + struct vduse_dev_msg msg =3D { 0 }; + int r; + + if (!(dev->vduse_features & BIT_U64(VDUSE_F_QUEUE_READY))) + goto out; + + msg.req.type =3D VDUSE_SET_VQ_READY; + msg.req.vq_ready.num =3D idx; + msg.req.vq_ready.ready =3D !!ready; + + r =3D vduse_dev_msg_sync(dev, &msg); =20 + if (r < 0) { + dev_dbg(&vdpa->dev, "device refuses to set vq %u ready %u", + idx, ready); + + /* We can't do better than break the device in this case */ + spin_lock(&dev->msg_lock); + vduse_dev_broken(dev); + spin_unlock(&dev->msg_lock); + return; + } + +out: vduse_vq_set_ready(vq, ready); } =20 @@ -2121,6 +2146,7 @@ static int vduse_create_dev(struct vduse_dev_config *= config, dev->device_features =3D config->features; dev->device_id =3D config->device_id; dev->vendor_id =3D config->vendor_id; + dev->vduse_features =3D config->vduse_features; =20 dev->nas =3D (dev->api_version < VDUSE_API_VERSION_1) ? 1 : config->nas; dev->as =3D kcalloc(dev->nas, sizeof(dev->as[0]), GFP_KERNEL); diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h index 1f68e556cbf2..1e27395692ea 100644 --- a/include/uapi/linux/vduse.h +++ b/include/uapi/linux/vduse.h @@ -18,6 +18,9 @@ =20 #define VDUSE_API_VERSION_2 2 =20 +/* The VDUSE instance expects a request for vq ready */ +#define VDUSE_F_QUEUE_READY 0 + /* * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION). * This is used for future extension. @@ -330,6 +333,7 @@ enum vduse_req_type { VDUSE_SET_STATUS, VDUSE_UPDATE_IOTLB, VDUSE_SET_VQ_GROUP_ASID, + VDUSE_SET_VQ_READY, }; =20 /** @@ -376,6 +380,15 @@ struct vduse_iova_range_v2 { __u32 asid; }; =20 +/** + * struct vduse_vq_ready - Virtqueue ready request message + * @num: Virtqueue number + */ +struct vduse_vq_ready { + __u32 num; + __u32 ready; +}; + /** * struct vduse_dev_request - control request * @type: request type @@ -386,6 +399,7 @@ struct vduse_iova_range_v2 { * @iova: IOVA range for updating * @iova_v2: IOVA range for updating if API_VERSION >=3D 1 * @vq_group_asid: ASID of a virtqueue group + * @vq_ready: Virtqueue ready request * @padding: padding * * Structure used by read(2) on /dev/vduse/$NAME. @@ -403,6 +417,11 @@ struct vduse_dev_request { */ struct vduse_iova_range_v2 iova_v2; struct vduse_vq_group_asid vq_group_asid; + /* + * Following members but padding exist only if vduse api + * version >=3D 2 + */ + struct vduse_vq_ready vq_ready; __u32 padding[32]; }; }; --=20 2.52.0 From nobody Sat Feb 7 14:16:34 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FE3A32BF43 for ; Wed, 28 Jan 2026 12:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604363; cv=none; b=Eo9zXhWiwH9hPoWhEUOwRi48KFo9LtL2u59yUA7s35T0rWf8Y+r+KDUVV8z8smnlzdkUGPvi7FnwWFoACyFykrzST4q8aLRRfyvDD54EE3AnrhS6VOzSSe8rQ726zZYBbK9C3qcDOpfRKZRNd09p7Zz9xONK0yQXz6HQSkhU8Mg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769604363; c=relaxed/simple; bh=rub1jVoIla+gOSyGrYmCCuTdBFAqXc9tj6gyirSe1XQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PrA++J9VlQB4REpf+L/zhw/EbrtmjxmxkzokLmIZuLmrS8zosHDAI43lSBOwdx6BTQa7v9rofA/p4yaMnu28HIUyj0ajEmClyCK7zO4pVp1J644+4WoGiOv70NWTz1+d0wSC7qVpF4JKBBbsu/BjO8wkiSU9N7OMJNsOBLvqL84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hyrdS9pg; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hyrdS9pg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769604361; 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=pvdT8XuPcB3wpI0L5PIioOQPTtnMa6o56elsZfgVm+M=; b=hyrdS9pgXGUQ3Zlq3vafC+0QT0lmGOkzMZV0D9ura+bbFZBUHvC7NgViOGKFQ2vwaO4Uk7 8BHZxX9X/C63BumF/X+CSvOYawi3S+j0cAH9SnaPA4kIgFTViH/AwXXIPPyq+rwOnT6s87 vqMH0UVVCKQS8qlpDQ9AAEuymSeuL+Q= Received: from mx-prod-mc-01.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-522-aJhCInkiOHK0YgBr3qsG5A-1; Wed, 28 Jan 2026 07:45:57 -0500 X-MC-Unique: aJhCInkiOHK0YgBr3qsG5A-1 X-Mimecast-MFC-AGG-ID: aJhCInkiOHK0YgBr3qsG5A_1769604356 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BD277194510A; Wed, 28 Jan 2026 12:45:56 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.32.239]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5280C30001A2; Wed, 28 Jan 2026 12:45:53 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: Jason Wang , Xuan Zhuo , Cindy Lu , Laurent Vivier , Stefano Garzarella , linux-kernel@vger.kernel.org, Maxime Coquelin , Yongji Xie , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , virtualization@lists.linux.dev Subject: [PATCH 6/6] vduse: advertise API V2 support Date: Wed, 28 Jan 2026 13:45:24 +0100 Message-ID: <20260128124524.875271-7-eperezma@redhat.com> In-Reply-To: <20260128124524.875271-1-eperezma@redhat.com> References: <20260128124524.875271-1-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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.4 Advertise VDUSE API V2 support to userspace. With the necessary infrastructure and feature flags in place, VDUSE devices can now opt-in to the new API and utilize the VDUSE_F_QUEUE_READY feature. Signed-off-by: Eugenio P=C3=A9rez --- drivers/vdpa/vdpa_user/vduse_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index 1d93b540db4d..7b5cae065f8b 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -2224,7 +2224,7 @@ static long vduse_ioctl(struct file *file, unsigned i= nt cmd, switch (cmd) { case VDUSE_GET_API_VERSION: if (control->api_version =3D=3D VDUSE_API_VERSION_NOT_ASKED) - control->api_version =3D VDUSE_API_VERSION_1; + control->api_version =3D VDUSE_API_VERSION_2; ret =3D put_user(control->api_version, (u64 __user *)argp); break; case VDUSE_SET_API_VERSION: { @@ -2235,7 +2235,7 @@ static long vduse_ioctl(struct file *file, unsigned i= nt cmd, break; =20 ret =3D -EINVAL; - if (api_version > VDUSE_API_VERSION_1) + if (api_version > VDUSE_API_VERSION_2) break; =20 ret =3D 0; --=20 2.52.0