Skip to content

[26.04_linux-nvidia-bos] vfio/cxl: include <linux/bitfield.h> for FIELD_GET - #544

Closed
JiandiAnNVIDIA wants to merge 1 commit into
NVIDIA:26.04_linux-nvidia-bosfrom
JiandiAnNVIDIA:cxl-reset-v9-x86-build-fix
Closed

[26.04_linux-nvidia-bos] vfio/cxl: include <linux/bitfield.h> for FIELD_GET#544
JiandiAnNVIDIA wants to merge 1 commit into
NVIDIA:26.04_linux-nvidia-bosfrom
JiandiAnNVIDIA:cxl-reset-v9-x86-build-fix

Conversation

@JiandiAnNVIDIA

@JiandiAnNVIDIA JiandiAnNVIDIA commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Fixes an amd64 build break in the merged CXL VFIO Type-2 passthrough v2 series:
drivers/vfio/pci/cxl/vfio_cxl_core.c uses FIELD_GET() without including
<linux/bitfield.h>. Adds the missing include.

The failure

On amd64 (resolute:linux-nvidia-bos), the build fails with:

drivers/vfio/pci/cxl/vfio_cxl_core.c:267:14: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]

Root cause

vfio_cxl_core.c calls FIELD_GET() (to decode the CXL DVSEC capability
register) but never includes <linux/bitfield.h>, where that macro is defined.
It compiled only because of an architecture-dependent transitive include:

  • On arm64, <linux/bitfield.h> is pulled in indirectly via
    linux/slab.h -> linux/cache.h -> arch/arm64/include/asm/cache.h -> asm/cputype.h -> asm/sysreg.h, and arm64's asm/sysreg.h includes
    <linux/bitfield.h>.
  • On amd64 that arm64-only header chain does not exist, so FIELD_GET
    is undefined and the build fails.

The nvidia-bos kernel is built for both amd64 and arm64
(CONFIG_VFIO_CXL_CORE=y on both), so the file must not rely on any one
architecture's transitive include graph.

Fix

Add #include <linux/bitfield.h> directly to vfio_cxl_core.c
(include-what-you-use), making the file architecture-independent.

Scope

  • This is only needed for the v2 posting of the CXL VFIO Type-2 passthrough
    series (commit 3570209d539a). v3 and later of that upstream series
    already include <linux/bitfield.h> in this file directly, so the change
    becomes redundant and drops out naturally once the tree moves to v3+.

Fixes: 3570209 ("NVIDIA: VR: SAUCE: vfio/cxl: Virtualize CXL DVSEC config writes")

LP: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia-bos/+bug/2163376

vfio_cxl_core.c uses FIELD_GET() to decode the CXL DVSEC capability
register but does not include <linux/bitfield.h>. It has only compiled
because on arm64 the macro is pulled in transitively: linux/slab.h ->
linux/cache.h -> arch/arm64/include/asm/cache.h -> asm/cputype.h ->
asm/sysreg.h, and arm64's asm/sysreg.h includes <linux/bitfield.h>.

The nvidia-bos kernel is also built for amd64, where that arm64-only
header chain does not exist. There FIELD_GET is undefined and the build
fails with "implicit declaration of function 'FIELD_GET'".

Include <linux/bitfield.h> directly so the file no longer relies on any
architecture's transitive include graph.

This fix is only needed for commit 3570209 ("NVIDIA: VR: SAUCE:
vfio/cxl: Virtualize CXL DVSEC config writes"), which is derived from
the v2 posting of the CXL VFIO Type-2 passthrough series. Version 3 and
later of that upstream series already include <linux/bitfield.h> in this
file directly, so once the tree moves to v3+ this change becomes
redundant and drops out naturally.

Fixes: 3570209 ("NVIDIA: VR: SAUCE: vfio/cxl: Virtualize CXL DVSEC config writes")
Signed-off-by: Jiandi An <jan@nvidia.com>
@nirmoy nirmoy added the help wanted Extra attention is needed label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ✅ All checks passed

Details
Checking 1 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 44a2c0cc2bf4 │ [SAUCE] vfio/cxl: include <linux/bitfield.h> for field_get       │ N/A        │ N/A     │ jan                       │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint: all checks passed.

@nirmoy

nirmoy commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

BaseOS Kernel Review

Summary

No issues found across the reviewed commits.

Findings: no problems found

Latest watcher review: open review

Generated test plan: open test plan

Kernel deb build: successful (download debs, 4 files)

Head: 44a2c0cc2bf4

This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher publishes a newer review.

@nirmoy

nirmoy commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Acked-by: Nirmoy Das <nirmoyd@nvidia.com>

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Acked-by: Jamie Nguyen <jamien@nvidia.com>

@nirmoy nirmoy added has_2_acks and removed help wanted Extra attention is needed has_1_ack labels Aug 13, 2026
@clsotog

clsotog commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Acked-by: Carol L Soto <csoto@nvidia.com>

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants