Skip to content

arm64: kvm: avoid referencing cpu_hwcaps from hyp

Mark Rutland kvmarm linux-arm-kernel 2 versions – Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 7 repliesApplied
  2. v13 patches 0 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3arm64: kvm: factor out is_{vhe,nvhe}_hyp_code()arch/arm64/include/asm/virt.h+16 -51 reply
2/3arm64: cpufeature: reorder cpus_have_{const, final}_cap()arch/arm64/include/asm/cpufeature.h+8 -83 replies
3/3arm64: cpufeature: upgrade hyp caps to finalarch/arm64/include/asm/cpufeature.h arch/arm64/include/asm/virt.h arch/arm64/kernel/image-vars.h+24 -151 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchWill Deacon
1/3A-b
2/3A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHv2 0/3] arm64: kvm: avoid referencing cpu_hwcaps from hyp

In a few places we use cpus_have_const_cap() in hyp code, usually because this is hidden within a helper that's also used in regular kernel context. As cpus_have_const_cap() generates code to read the cpu_hwcaps array before capabilities are finalized, this means we generate some potentially-unsound references to regular kernel VAs, but this these are redundant as capabilities are finalized before we initialize the kvm hyp code.

This series gets rid of the redundant code by automatically upgrading cpust_have_const_cap() to cpus_have_final_cap() when used in hyp code. This allows us to avoid creating an NVHE alias for the cpu_hwcaps array, so we can catch if we accidentally introduce an runtime reference to this (e.g. via cpus_have_cap()).

Since v1 [1]:
* Trivial rebase to v5.10-rc1

[1] https://lore.kernel.org/r/[email protected]

Mark Rutland (3):
arm64: kvm: factor out is_{vhe,nvhe}_hyp_code()
arm64: cpufeature: reorder cpus_have_{const,final}_cap()
arm64: cpufeature: upgrade hyp caps to final

 arch/arm64/include/asm/cpufeature.h | 40 ++++++++++++++++++++++++++++---------
 arch/arm64/include/asm/virt.h       |  9 ++++-----
 arch/arm64/kernel/image-vars.h      |  1 -
 3 files changed, 35 insertions(+), 15 deletions(-)
Signature · 6 lines
2.11.0

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm