Skip to content

fix(passthrough): honor selectors and custom VFIO IDs - #675

Draft
johnahull wants to merge 1 commit into
ROCm:mainfrom
johnahull:fix/passthrough-vfio-validation
Draft

johnahull wants to merge 1 commit into
ROCm:mainfrom
johnahull:fix/passthrough-vfio-validation

Conversation

@johnahull

@johnahull johnahull commented Oct 27, 2026 •

Copy link
Copy Markdown

Problem

The operator supports PF/VF passthrough through a node-scoped DeviceConfig and VFIO device IDs. Two generic correctness and safety gaps make those configurations unsafe or incomplete:

  1. An enabled passthrough DeviceConfig without a selector is not sufficiently scoped to the intended nodes.
  2. When users provide spec.driver.vfioConfig.deviceIDs, the bind/unbind command uses those IDs but the VF-detection init container still scans only the built-in defaults. A custom VF configuration can therefore wait indefinitely for a device that the detection command does not look for.
  3. Device IDs are inserted into privileged shell commands. Without quoting, a malformed or unexpected value can change the generated command instead of remaining a literal PCI-ID pattern.

What this changes

  • Require spec.selector for enabled vf-passthrough and pf-passthrough configurations. The validation treats an omitted driver.enable as enabled, matching the CRD default.
  • Centralize VFIO device-ID selection for worker pod generation.
  • Use configured VFIO IDs consistently in both:
    • the host-driver bind/unbind command; and
    • the VF-detection init container.
  • Shell-quote configured and default IDs before inserting them into the generated bind/unbind and detection commands.
  • Preserve the existing default-ID behavior when no custom IDs are configured.
  • Add unit tests covering selector validation, custom-ID propagation into both command paths, and shell metacharacter handling.

Compatibility

This PR is independent of GIM artifact resolution. It applies only to PF/VF passthrough configurations; container-driver behavior is unchanged. The AMD MI3xx default VF IDs and GIM artifact mapping are kept in PR #674. The unrelated -e fix remains in PR #673.

Testing

  • GOTOOLCHAIN=auto go test ./api/... ./cmd/... ./internal/... ./tools/build/copyright
  • GOTOOLCHAIN=auto go vet ./api/... ./cmd/... ./internal/... ./tools/build/copyright
  • git diff --check

The tests verify that configured VFIO IDs appear safely in both the binding command and detection command, and that enabled PF/VF passthrough rejects an empty selector.

Out of scope

@johnahull
johnahull force-pushed the fix/passthrough-vfio-validation branch from aad4024 to c9e99f5 Compare October 27, 2026 16:23

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant