kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: add finalized cap helper
@ 2020-02-10 12:27 Mark Rutland
  2020-02-10 12:27 ` [PATCH 1/2] arm64: cpufeature: add cpus_have_final_cap() Mark Rutland
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mark Rutland @ 2020-02-10 12:27 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: catalin.marinas, maz, will, kvmarm

Across arm64 we use cpus_have_const_cap() to check for a capability
without a runtime check. Prior to capabilities being finalized
cpus_have_const_cap() falls back to a runtime check of the cpu_hwcaps
array. In some cases we know that code is never invoked prior to the
capabilities being finalized, and the fallback code is redundant (and
unsound if ever executed in hyp context).

So that we can avoid the redundant code and detect when the caps are
unexpectedly checked too early, this series adds a new
cpus_have_final_cap() helper, and migrates the KVM hyp code over to it.

I'm hoping to use this as part of the entry.S -> entry-common.c
conversion, and there are other places in arm64 that could potentially
use this today.

Thanks,
Mark.

Mark Rutland (2):
  arm64: cpufeature: add cpus_have_final_cap()
  arm64: kvm: hyp: use cpus_have_final_cap()

 arch/arm64/include/asm/cpufeature.h | 47 +++++++++++++++++++++++++++++++++----
 arch/arm64/kvm/hyp/switch.c         | 14 +++++------
 arch/arm64/kvm/hyp/sysreg-sr.c      |  8 +++----
 arch/arm64/kvm/hyp/tlb.c            |  8 +++----
 4 files changed, 57 insertions(+), 20 deletions(-)

-- 
2.11.0

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-17 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 12:27 [PATCH 0/2] arm64: add finalized cap helper Mark Rutland
2020-02-10 12:27 ` [PATCH 1/2] arm64: cpufeature: add cpus_have_final_cap() Mark Rutland
2020-02-10 16:37   ` Suzuki Kuruppassery Poulose
2020-02-10 17:37     ` Mark Rutland
2020-02-10 12:27 ` [PATCH 2/2] arm64: kvm: hyp: use cpus_have_final_cap() Mark Rutland
2020-02-17 14:48 ` [PATCH 0/2] arm64: add finalized cap helper Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).