[26.04_linux-nvidia-bos] vfio/cxl: include <linux/bitfield.h> for FIELD_GET - #544
Closed
JiandiAnNVIDIA wants to merge 1 commit into
Closed
Conversation
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>
Contributor
PR Validation ReportPatchscan ✅ No Missing FixesAll cherry-picked commits checked — no missing upstream fixes found. PR Lint ✅ All checks passedDetailsChecking 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. |
Collaborator
BaseOS Kernel ReviewSummaryNo 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: This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher publishes a newer review. |
Collaborator
|
|
Collaborator
|
|
Collaborator
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an amd64 build break in the merged CXL VFIO Type-2 passthrough v2 series:
drivers/vfio/pci/cxl/vfio_cxl_core.cusesFIELD_GET()without including<linux/bitfield.h>. Adds the missing include.The failure
On amd64 (
resolute:linux-nvidia-bos), the build fails with:Root cause
vfio_cxl_core.ccallsFIELD_GET()(to decode the CXL DVSEC capabilityregister) but never includes
<linux/bitfield.h>, where that macro is defined.It compiled only because of an architecture-dependent transitive include:
<linux/bitfield.h>is pulled in indirectly vialinux/slab.h -> linux/cache.h -> arch/arm64/include/asm/cache.h -> asm/cputype.h -> asm/sysreg.h, and arm64'sasm/sysreg.hincludes<linux/bitfield.h>.FIELD_GETis undefined and the build fails.
The nvidia-bos kernel is built for both amd64 and arm64
(
CONFIG_VFIO_CXL_CORE=yon both), so the file must not rely on any onearchitecture's transitive include graph.
Fix
Add
#include <linux/bitfield.h>directly tovfio_cxl_core.c(include-what-you-use), making the file architecture-independent.
Scope
series (commit
3570209d539a). v3 and later of that upstream seriesalready include
<linux/bitfield.h>in this file directly, so the changebecomes 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