From mboxrd@z Thu Jan 1 00:00:00 1970 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 D77473F99FE for ; Tue, 7 Jul 2026 12:25:23 +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=1783427125; cv=none; b=i3Yk/5ctvvbvAFkYIzwHb6k3OOBsws9riYqa7Odv/0qzOiSGkwhtKKT0NXj4Xkz4sQQC75h1FR3jR2whjdKs+NQCGm2xUg3LCBedy8EEUn/8TJJ+ShDJvN4HI88rOeKrvY56SRy/MYcKYNYUgSRUl4acvQeFhcBCr1UVTPmhGu8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783427125; c=relaxed/simple; bh=xGVue4prjPuwHSp+TWmfPc48xwD98WKLWJkN3Qn/My8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QlUtNRYL1QN43N07CAGiJLA1ADio7dP0q6zjkhcfKqfEBJzL5u/6R/UqAyqToDlx8mecVQNzZDW9BXjzR8t7hRxUGCKyN5UT8RrfyH+zhAmUM56Td1nYbnNBjyE9cVRJaAK8ULGzGeXLcA4Lw1x9FCX3Z0r1ZylGomzjQ/Djsqc= 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=jQuJr3vs; 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="jQuJr3vs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783427122; 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=FjL2+mrQcUXOo48bEv7APPovoqwGDFXoAN5/mmpKnAg=; b=jQuJr3vsmq2xZQoB+3NTwbyGPsRGZr5DWvJClJzsMDLmt4V97JpKH2nTgdZNAZTZQu9hOp qHz2ROY+ZJUj/nz2u4gXvWFdLZdUM9fmAaIoI+c021hkl+p5g3lhDMtYcECe2EyzxEs2cZ aUNlI8iEDnJ0snfh+ryuSqlpnqux1rs= 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-685-kVmRnhC1OwayDaQWb3UUoQ-1; Tue, 07 Jul 2026 08:25:17 -0400 X-MC-Unique: kVmRnhC1OwayDaQWb3UUoQ-1 X-Mimecast-MFC-AGG-ID: kVmRnhC1OwayDaQWb3UUoQ_1783427116 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E3CD195411F; Tue, 7 Jul 2026 12:25:16 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.48.55]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 71DAC18005B5; Tue, 7 Jul 2026 12:25:12 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: "Michael S . Tsirkin" Cc: =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Laurent Vivier , Yongji Xie , linux-kernel@vger.kernel.org, Stefano Garzarella , Jason Wang , Xuan Zhuo , virtualization@lists.linux.dev, Maxime Coquelin Subject: [PATCH v4 2/4] vduse: add VDUSE_GET_FEATURES ioctl Date: Tue, 7 Jul 2026 14:25:00 +0200 Message-ID: <20260707122502.239022-3-eperezma@redhat.com> In-Reply-To: <20260707122502.239022-1-eperezma@redhat.com> References: <20260707122502.239022-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: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Add an ioctl to allow VDUSE instances to query the available features supported by the kernel module. Signed-off-by: Eugenio Pérez --- v4: * Store the features in VDUSE control instead of vduse device config. v3: * Remove check for API_VERSION < 2 * Add comment about struct vduse_dev_config:vduse_features is only valid if VDUSE_GET_FEATURES success. v2: * return -EINVAL if ioctl called with version < 2, so userland visible reply is kept (Jason). --- drivers/vdpa/vdpa_user/vduse_dev.c | 7 +++++++ include/uapi/linux/vduse.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index 2af5cb5e1ec6..e1930e38df7a 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -52,6 +52,9 @@ #define IRQ_UNBOUND -1 +/* Supported VDUSE features */ +static const uint64_t vduse_features; + /* * VDUSE instance have not asked the vduse API version, so assume 0. * @@ -2343,6 +2346,10 @@ static long vduse_ioctl(struct file *file, unsigned int cmd, ret = vduse_destroy_dev(name); break; } + case VDUSE_GET_FEATURES: + ret = put_user(vduse_features, (u64 __user *)argp); + break; + default: ret = -EINVAL; break; diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h index 361eea511c21..89aa3b448c0a 100644 --- a/include/uapi/linux/vduse.h +++ b/include/uapi/linux/vduse.h @@ -63,6 +63,9 @@ struct vduse_dev_config { */ #define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX]) +/* Get the VDUSE supported features */ +#define VDUSE_GET_FEATURES _IOR(VDUSE_BASE, 0x04, __u64) + /* The ioctls for VDUSE device (/dev/vduse/$NAME) */ /** -- 2.55.0