From: sashiko-bot@kernel.org
To: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v8 08/15] iommufd: Add a vDEVICE operation ioctl framework
Date: Wed, 04 Nov 2026 16:54:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-197698@kernel.org> (raw)
In-Reply-To: <20261104161632.3547423-9-aneesh.kumar@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iommufd: iommufd_vdevice_op_ioctl() returns -EINVAL for non-zero reserved field
--
commit 02d0f32280b8147168fe9f8c2300f3939bdda343
Author: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
iommufd: Add a vDEVICE operation ioctl framework
This commit introduces the IOMMU_VDEVICE_OP ioctl and its dispatcher
iommufd_vdevice_op_ioctl() to execute operations on a vDEVICE object using
request and response buffers. It adds a supported_ops bitmask to struct
iommufd_vdevice and returns -EOPNOTSUPP by default when no operations are
defined.
> diff --git a/drivers/iommu/iommufd/viommu.c b/drivers/iommu/iommufd/viommu.c
> index 0dbd382eeb981..cdbb597f35888 100644
> --- a/drivers/iommu/iommufd/viommu.c
> +++ b/drivers/iommu/iommufd/viommu.c
[ ... ]
> @@ -121,6 +125,38 @@ int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd)
> return rc;
> }
>
> +int iommufd_vdevice_op_ioctl(struct iommufd_ucmd *ucmd)
> +{
> + struct iommu_vdevice_op *cmd = ucmd->cmd;
> + struct iommufd_object *obj;
> + struct iommufd_vdevice *vdev;
> + int ret;
> +
> + if (cmd->reserved)
> + return -EINVAL;
[Severity: Medium]
Should iommufd_vdevice_op_ioctl() return -EOPNOTSUPP instead of -EINVAL when
cmd->reserved is non-zero?
The general ioctl format documentation in include/uapi/linux/iommufd.h
specifies that -EOPNOTSUPP is returned when a known field has a value the
kernel does not understand or support, whereas -EINVAL indicates a field is
not correct:
include/uapi/linux/iommufd.h:
* - EOPNOTSUPP: The IOCTL number is supported, and the structure is
* understood, however a known field has a value the kernel does not
* understand or support.
* - EINVAL: Everything about the IOCTL was understood, but a field is not
* correct.
All other ioctl handlers across drivers/iommu/iommufd/ return -EOPNOTSUPP when
a reserved field is non-zero so userspace can detect whether a future kernel
extension repurposing that field is supported.
Additionally, in include/uapi/linux/iommufd.h, struct iommu_vdevice_op names
this member reserved:
struct iommu_vdevice_op {
...
__u32 reserved;
...
};
Should this member be named __reserved to match the other UAPI structures in
include/uapi/linux/iommufd.h?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104161632.3547423-1-aneesh.kumar@kernel.org?part=8
next prev parent reply other threads:[~2026-11-04 16:54 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 16:16 [PATCH v8 00/15] iommufd: TSM-backed virtual IOMMUs for confidential guests Aneesh Kumar K.V (Arm)
2026-11-04 16:16 ` [PATCH v8 01/15] PCI/TSM: Move core code into its own directory Aneesh Kumar K.V (Arm)
2026-11-04 16:23 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 02/15] virt: coco: tsm: Remove the device from lookup before PCI teardown Aneesh Kumar K.V (Arm)
2026-11-04 16:27 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 03/15] virt: coco: tsm: Complete PCI registration before publishing the device Aneesh Kumar K.V (Arm)
2026-11-04 16:32 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 04/15] virt: coco: tsm: Require PCI operations when registering a TSM Aneesh Kumar K.V (Arm)
2026-11-04 16:36 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 05/15] iommufd/device: Associate KVM file pointer with iommufd_device Aneesh Kumar K.V (Arm)
2026-11-04 16:40 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 06/15] iommufd/device: Hold a KVM file reference for the device lifetime Aneesh Kumar K.V (Arm)
2026-11-04 16:43 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 07/15] iommufd/viommu: Keep a reference to the KVM file Aneesh Kumar K.V (Arm)
2026-11-04 16:35 ` Jacob Pan
2026-11-04 16:46 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 08/15] iommufd: Add a vDEVICE operation ioctl framework Aneesh Kumar K.V (Arm)
2026-11-04 16:54 ` sashiko-bot [this message]
2026-11-04 16:16 ` [PATCH v8 09/15] PCI/TSM: Remove the legacy guest request interface Aneesh Kumar K.V (Arm)
2026-11-04 16:56 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 10/15] PCI/TSM: Add vIOMMU-bound device contexts Aneesh Kumar K.V (Arm)
2026-11-04 17:07 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 11/15] iommufd/viommu: Select vIOMMU operations before allocation Aneesh Kumar K.V (Arm)
2026-11-04 17:14 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 12/15] iommufd/viommu: Allow PCI TSM backends to provide vIOMMU operations Aneesh Kumar K.V (Arm)
2026-11-04 17:19 ` sashiko-bot
2026-11-04 23:23 ` Jacob Pan
2026-11-04 16:16 ` [PATCH v8 13/15] iommufd/viommu: Allow vIOMMUs without a parent HWPT Aneesh Kumar K.V (Arm)
2026-11-04 17:25 ` sashiko-bot
2026-11-04 19:03 ` Nicolin Chen
2026-11-04 19:31 ` Jason Gunthorpe
2026-11-04 16:16 ` [PATCH v8 14/15] PCI/TSM: Wait for device contexts before removing a DSM Aneesh Kumar K.V (Arm)
2026-11-04 17:41 ` sashiko-bot
2026-11-04 16:16 ` [PATCH v8 15/15] PCI/TSM: Wait for users during unregister Aneesh Kumar K.V (Arm)
2026-11-04 18:00 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-197698@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aneesh.kumar@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox