Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vduse: bump version number

Finalize the series by advertising VDUSE API v1 support to userspace.

Now that all required infrastructure for v1 (ASIDs, VQ groups,
update_iotlb_v2) is in place, VDUSE devices can opt in to the new
features.

Assume API version 0 if the VDUSE instance does not call
VDUSE_GET_API_VERSION to maintain compatibility.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260119143306.1818855-13-eperezma@redhat.com>

authored by

Eugenio Pérez and committed by
Michael S. Tsirkin
12e0043d 079212f6

+15 -2
+15 -2
drivers/vdpa/vdpa_user/vduse_dev.c
··· 52 52 53 53 #define IRQ_UNBOUND -1 54 54 55 + /* 56 + * VDUSE instance have not asked the vduse API version, so assume 0. 57 + * 58 + * Old devices may not ask for the device version and assume it is 0. Keep 59 + * this value for these. From the moment the VDUSE instance ask for the 60 + * version, convert to the latests supported one and continue regular flow 61 + */ 62 + #define VDUSE_API_VERSION_NOT_ASKED U64_MAX 63 + 55 64 struct vduse_virtqueue { 56 65 u16 index; 57 66 u16 num_max; ··· 2162 2153 mutex_lock(&vduse_lock); 2163 2154 switch (cmd) { 2164 2155 case VDUSE_GET_API_VERSION: 2156 + if (control->api_version == VDUSE_API_VERSION_NOT_ASKED) 2157 + control->api_version = VDUSE_API_VERSION_1; 2165 2158 ret = put_user(control->api_version, (u64 __user *)argp); 2166 2159 break; 2167 2160 case VDUSE_SET_API_VERSION: { ··· 2174 2163 break; 2175 2164 2176 2165 ret = -EINVAL; 2177 - if (api_version > VDUSE_API_VERSION) 2166 + if (api_version > VDUSE_API_VERSION_1) 2178 2167 break; 2179 2168 2180 2169 ret = 0; ··· 2191 2180 break; 2192 2181 2193 2182 ret = -EINVAL; 2183 + if (control->api_version == VDUSE_API_VERSION_NOT_ASKED) 2184 + control->api_version = VDUSE_API_VERSION; 2194 2185 if (!vduse_validate_config(&config, control->api_version)) 2195 2186 break; 2196 2187 ··· 2243 2230 if (!control) 2244 2231 return -ENOMEM; 2245 2232 2246 - control->api_version = VDUSE_API_VERSION; 2233 + control->api_version = VDUSE_API_VERSION_NOT_ASKED; 2247 2234 file->private_data = control; 2248 2235 2249 2236 return 0;