Re: [PATCH v5 2/9] mshv: Add declarations and definitions for VFIO-MSHV bridge device

[email protected] Fri, 31 Jul 2026 22:42:42 +0000
Newsgroups org.kernel.vger.linux-hyperv,org.kernel.vger.linux-pci
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:
- [Medium] The `MSHV_CREATE_DEVICE` ioctl command definition is completely =
missing from the UAPI header.
--

--- Patch [2]: [PATCH v5 2/9] mshv: Add declarations and definitions for VF=
IO-MSHV bridge device ---
commit e1e53f07045678558c5d600cce2f941f492fd69b
Author: Mukesh R <[email protected]>

mshv: Add declarations and definitions for VFIO-MSHV bridge device

Add data structs needed by the subsequent patch that introduces a new
module to implement VFIO-MSHV pseudo device.

> diff --git a/include/uapi/linux/mshv.h b/include/uapi/linux/mshv.h
> index 32ff92b6342b2..be6fe3ee87078 100644
> --- a/include/uapi/linux/mshv.h
> +++ b/include/uapi/linux/mshv.h
> @@ -404,4 +404,34 @@ struct mshv_sint_mask {

[ ... ]

> +/* Device passhthru */
> +#define MSHV_CREATE_DEVICE_TEST		1
> +
> +enum {
> +	MSHV_DEV_TYPE_VFIO,
> +	MSHV_DEV_TYPE_MAX,
> +};
> +
> +struct mshv_create_device {
> +	__u32	type;	     /* in: MSHV_DEV_TYPE_xxx */
> +	__u32	fd;	     /* out: device handle */
> +	__u32	flags;	     /* in: MSHV_CREATE_DEVICE_xxx */
> +};
> +
> +#define MSHV_DEV_VFIO_FILE      1
> +#define MSHV_DEV_VFIO_FILE_ADD	1
> +#define MSHV_DEV_VFIO_FILE_DEL	2
> +
> +struct mshv_device_attr {
> +	__u32	flags;		/* no flags currently defined */
> +	__u32	group;		/* device-defined */
> +	__u64	attr;		/* group-defined */
> +	__u64	addr;		/* userspace address of attr data */
> +};
> +
> +/* Device fds created with MSHV_CREATE_DEVICE */
> +#define MSHV_SET_DEVICE_ATTR	_IOW(MSHV_IOCTL, 0x00, struct mshv_device_a=
ttr)
> +#define MSHV_HAS_DEVICE_ATTR	_IOW(MSHV_IOCTL, 0x01, struct mshv_device_a=
ttr)

[Severity: Medium]
Is the definition for the MSHV_CREATE_DEVICE ioctl missing here?

The comment right above mentions device fds created with MSHV_CREATE_DEVICE,
and the patch adds struct mshv_create_device, but the actual ioctl macro
is never defined. Would this prevent userspace from compiling against the
header to use the device passthrough feature?

> +
>  #endif

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260731223427.2554=
[email protected]?part=3D2