Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [PATCH v2] vfio/cdx: Fix missing detach_ioas op
@ 2026-12-01 17:25 Ian Rogers
  2026-12-02  6:34 ` Agarwal, Nikhil
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ian Rogers @ 2026-12-01 17:25 UTC (permalink / raw)
  To: Alex Williamson, Nipun Gupta, Nikhil Agarwal
  Cc: Jason Gunthorpe, Kevin Tian, Yi Liu, Nathan Chancellor, kvm, llvm,
	linux-kernel, Ian Rogers

vfio_cdx_ops sets bind_iommufd, unbind_iommufd, and attach_ioas to the
vfio_iommufd_physical_* helpers, but omits detach_ioas. When
CONFIG_IOMMUFD is enabled, __vfio_register_dev() checks
!device->ops->detach_ioas and fails registration with WARN_ON() and
-EINVAL during vfio_cdx_probe() -> vfio_register_group_dev().

Commit 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical
VFIO devices") added detach_ioas across the other physical VFIO drivers
while omitting vfio_cdx_ops.

Add the missing vfio_iommufd_physical_detach_ioas callback, found with
Clang's require_explicit_initialization attribute.

Fixes: 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical VFIO devices")
Signed-off-by: Ian Rogers <irogers@google.com>
---
Changes in v2:
- Fix the Fixes tag to 9048c7341c4d ("vfio-iommufd: Add detach_ioas
  support for physical VFIO devices") and update the failure description
  to reflect __vfio_register_dev() failing probe with WARN_ON() and
  -EINVAL under CONFIG_IOMMUFD=y (spotted by Sashiko).
- Link to v1: https://lore.kernel.org/r/20261130225358.97751-1-irogers@google.com

Note: Found using Clang's require_explicit_initialization attribute;
an AI coding assistant helped audit call sites, verify Fixes commits,
and draft the changelog.

 drivers/vfio/cdx/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/vfio/cdx/main.c b/drivers/vfio/cdx/main.c
index 28dc8c825600..8aca3538293d 100644
--- a/drivers/vfio/cdx/main.c
+++ b/drivers/vfio/cdx/main.c
@@ -308,6 +308,7 @@ static const struct vfio_device_ops vfio_cdx_ops = {
 	.bind_iommufd	= vfio_iommufd_physical_bind,
 	.unbind_iommufd	= vfio_iommufd_physical_unbind,
 	.attach_ioas	= vfio_iommufd_physical_attach_ioas,
+	.detach_ioas	= vfio_iommufd_physical_detach_ioas,
 };
 
 static int vfio_cdx_probe(struct cdx_device *cdx_dev)

base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] vfio/cdx: Fix missing detach_ioas op
  2026-12-01 17:25 [PATCH v2] vfio/cdx: Fix missing detach_ioas op Ian Rogers
@ 2026-12-02  6:34 ` Agarwal, Nikhil
  2026-12-03  8:00 ` Tian, Kevin
  2026-12-04 23:16 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Agarwal, Nikhil @ 2026-12-02  6:34 UTC (permalink / raw)
  To: Ian Rogers, Alex Williamson, Gupta, Nipun
  Cc: Jason Gunthorpe, Kevin Tian, Yi Liu, Nathan Chancellor,
	kvm@vger.kernel.org, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org


> -----Original Message-----
> From: Ian Rogers <irogers@google.com>
> Sent: Tuesday, December 1, 2026 10:56 PM
> To: Alex Williamson <alex@shazbot.org>; Gupta, Nipun <Nipun.Gupta@amd.com>;
> Agarwal, Nikhil <nikhil.agarwal@amd.com>
> Cc: Jason Gunthorpe <jgg@nvidia.com>; Kevin Tian <kevin.tian@intel.com>; Yi Liu
> <yi.l.liu@intel.com>; Nathan Chancellor <nathan@kernel.org>; kvm@vger.kernel.org;
> llvm@lists.linux.dev; linux-kernel@vger.kernel.org; Ian Rogers
> <irogers@google.com>
> Subject: [PATCH v2] vfio/cdx: Fix missing detach_ioas op
> 
> vfio_cdx_ops sets bind_iommufd, unbind_iommufd, and attach_ioas to the
> vfio_iommufd_physical_* helpers, but omits detach_ioas. When CONFIG_IOMMUFD
> is enabled, __vfio_register_dev() checks !device->ops->detach_ioas and fails
> registration with WARN_ON() and -EINVAL during vfio_cdx_probe() ->
> vfio_register_group_dev().
> 
> Commit 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical VFIO
> devices") added detach_ioas across the other physical VFIO drivers while omitting
> vfio_cdx_ops.
> 
> Add the missing vfio_iommufd_physical_detach_ioas callback, found with Clang's
> require_explicit_initialization attribute.
> 
> Fixes: 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical VFIO
> devices")
> Signed-off-by: Ian Rogers <irogers@google.com>


Acked-by: Nikhil Agarwal <Nikhil.agarwal@amd.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2] vfio/cdx: Fix missing detach_ioas op
  2026-12-01 17:25 [PATCH v2] vfio/cdx: Fix missing detach_ioas op Ian Rogers
  2026-12-02  6:34 ` Agarwal, Nikhil
@ 2026-12-03  8:00 ` Tian, Kevin
  2026-12-04 23:16 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Tian, Kevin @ 2026-12-03  8:00 UTC (permalink / raw)
  To: Rogers, Ian, Alex Williamson, Nipun Gupta, Nikhil Agarwal
  Cc: Jason Gunthorpe, Liu, Yi L, Nathan Chancellor,
	kvm@vger.kernel.org, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org, Rogers, Ian

> From: Ian Rogers <irogers@google.com>
> Sent: Wednesday, December 2, 2026 1:26 AM
> 
> vfio_cdx_ops sets bind_iommufd, unbind_iommufd, and attach_ioas to the
> vfio_iommufd_physical_* helpers, but omits detach_ioas. When
> CONFIG_IOMMUFD is enabled, __vfio_register_dev() checks
> !device->ops->detach_ioas and fails registration with WARN_ON() and
> -EINVAL during vfio_cdx_probe() -> vfio_register_group_dev().
> 
> Commit 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical
> VFIO devices") added detach_ioas across the other physical VFIO drivers
> while omitting vfio_cdx_ops.
> 
> Add the missing vfio_iommufd_physical_detach_ioas callback, found with
> Clang's require_explicit_initialization attribute.
> 
> Fixes: 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical
> VFIO devices")
> Signed-off-by: Ian Rogers <irogers@google.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] vfio/cdx: Fix missing detach_ioas op
  2026-12-01 17:25 [PATCH v2] vfio/cdx: Fix missing detach_ioas op Ian Rogers
  2026-12-02  6:34 ` Agarwal, Nikhil
  2026-12-03  8:00 ` Tian, Kevin
@ 2026-12-04 23:16 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2026-12-04 23:16 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Nipun Gupta, Nikhil Agarwal, Jason Gunthorpe, Kevin Tian, Yi Liu,
	Nathan Chancellor, kvm, llvm, linux-kernel, alex

On Tue,  1 Dec 2026 09:25:54 -0800
Ian Rogers <irogers@google.com> wrote:

> vfio_cdx_ops sets bind_iommufd, unbind_iommufd, and attach_ioas to the
> vfio_iommufd_physical_* helpers, but omits detach_ioas. When
> CONFIG_IOMMUFD is enabled, __vfio_register_dev() checks
> !device->ops->detach_ioas and fails registration with WARN_ON() and
> -EINVAL during vfio_cdx_probe() -> vfio_register_group_dev().
> 
> Commit 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical
> VFIO devices") added detach_ioas across the other physical VFIO drivers
> while omitting vfio_cdx_ops.
> 
> Add the missing vfio_iommufd_physical_detach_ioas callback, found with
> Clang's require_explicit_initialization attribute.
> 
> Fixes: 9048c7341c4d ("vfio-iommufd: Add detach_ioas support for physical VFIO devices")
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> Changes in v2:
> - Fix the Fixes tag to 9048c7341c4d ("vfio-iommufd: Add detach_ioas
>   support for physical VFIO devices") and update the failure description
>   to reflect __vfio_register_dev() failing probe with WARN_ON() and
>   -EINVAL under CONFIG_IOMMUFD=y (spotted by Sashiko).
> - Link to v1: https://lore.kernel.org/r/20261130225358.97751-1-irogers@google.com
> 
> Note: Found using Clang's require_explicit_initialization attribute;
> an AI coding assistant helped audit call sites, verify Fixes commits,
> and draft the changelog.
> 
>  drivers/vfio/cdx/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/vfio/cdx/main.c b/drivers/vfio/cdx/main.c
> index 28dc8c825600..8aca3538293d 100644
> --- a/drivers/vfio/cdx/main.c
> +++ b/drivers/vfio/cdx/main.c
> @@ -308,6 +308,7 @@ static const struct vfio_device_ops vfio_cdx_ops = {
>  	.bind_iommufd	= vfio_iommufd_physical_bind,
>  	.unbind_iommufd	= vfio_iommufd_physical_unbind,
>  	.attach_ioas	= vfio_iommufd_physical_attach_ioas,
> +	.detach_ioas	= vfio_iommufd_physical_detach_ioas,
>  };
>  
>  static int vfio_cdx_probe(struct cdx_device *cdx_dev)
> 
> base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244

Applied to vfio next branch for v7.5.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-04 23:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 17:25 [PATCH v2] vfio/cdx: Fix missing detach_ioas op Ian Rogers
2026-12-02  6:34 ` Agarwal, Nikhil
2026-12-03  8:00 ` Tian, Kevin
2026-12-04 23:16 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox