Skip to content

NVIDIA: SAUCE: target/arm: Add sysfs detection for KVM CCA capability#12

Closed
ianm-nv wants to merge 1 commit intoNVIDIA:nvidia_unstable-10.1from
ianm-nv:nvidia_unstable-10.1+cca/dev
Closed

NVIDIA: SAUCE: target/arm: Add sysfs detection for KVM CCA capability#12
ianm-nv wants to merge 1 commit intoNVIDIA:nvidia_unstable-10.1from
ianm-nv:nvidia_unstable-10.1+cca/dev

Conversation

@ianm-nv
Copy link
Collaborator

@ianm-nv ianm-nv commented Feb 9, 2026

Add runtime detection of the KVM CCA capability number by reading from the kernel's sysfs module parameter. This allows QEMU to automatically discover the correct capability number without needing version-specific hardcoded values that may become stale.

The ARM CCA host patches underwent a naming change from RME to RMI in v11:

  • v10 (Linux 6.17): KVM_CAP_ARM_RME, sysfs param kvm_cap_arm_rme
  • v11 (Linux 6.18+): KVM_CAP_ARM_RMI, sysfs param kvm_cap_arm_rmi

Detection order:

  1. Try v11 sysfs path (/sys/module/kvm/parameters/kvm_cap_arm_rmi)
  2. Try v10 sysfs path (/sys/module/kvm/parameters/kvm_cap_arm_rme)
  3. Fall back to uname detection for 6.16 dev kernel (capability == 243)
  4. Use compile-time KVM_CAP_ARM_RME as last resort

This allows the same QEMU binary to work with linux-nvidia-6.16 (dev), linux-nvidia-6.17 (v10 host patches), and linux-nvidia-6.18+ (v11 host patches).

Here is a ref to the kernel patch that enables the sysfs capability.

I've tested this with the following kernels:
6.16-pset
6.17-nvidia-devel
6.17-nvidia
6.18-nvidia

Add runtime detection of the KVM CCA capability number by reading from
the kernel's sysfs module parameter. This allows QEMU to automatically
discover the correct capability number without needing version-specific
hardcoded values that may become stale.

The ARM CCA host patches underwent a naming change from RME to RMI in v11:
  - v10 (Linux 6.17): KVM_CAP_ARM_RME, sysfs param kvm_cap_arm_rme
  - v11 (Linux 6.18+): KVM_CAP_ARM_RMI, sysfs param kvm_cap_arm_rmi

Detection order:
  1. Try v11 sysfs path (/sys/module/kvm/parameters/kvm_cap_arm_rmi)
  2. Try v10 sysfs path (/sys/module/kvm/parameters/kvm_cap_arm_rme)
  3. Fall back to uname detection for 6.16 dev kernel (capability == 243)
  4. Use compile-time KVM_CAP_ARM_RME as last resort

This allows the same QEMU binary to work with linux-nvidia-6.16 (dev),
linux-nvidia-6.17 (v10 host patches), and linux-nvidia-6.18+ (v11 host
patches).

Signed-off-by: Ian May <ianm@nvidia.com>
Copy link
Collaborator

@nvmochs nvmochs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Acked-by: Matthew R. Ochs <mochs@nvidia.com>

Copy link
Collaborator

@NathanChenNVIDIA NathanChenNVIDIA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Acked-by: Nathan Chen nathanc@nvidia.com

@nvmochs
Copy link
Collaborator

nvmochs commented Feb 10, 2026

Merged, closing PR.

@nvmochs nvmochs closed this Feb 10, 2026
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.

3 participants