linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH 0/4] KVM: arm64: emulation for CTR_EL0
@ 2024-03-18 11:16 Sebastian Ott
  2024-03-18 11:16 ` [PATCH 1/4] KVM: arm64: add emulation for CTR_EL0 register Sebastian Ott
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Sebastian Ott @ 2024-03-18 11:16 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Marc Zyngier, Oliver Upton

Hej folks,

I'm looking into supporting migration between 2 Ampere Altra (Max)
machines (using Neoverse-N1). They are almost identical regarding
their feature id register state except for CTR_EL0.DIC which is set
on one machine but not the other.

For a complete picture it's worth noting that the machine with
CTR_EL0.DIC = 1 also suffers from erratum 1542419 meaning for
userspace we trap the access and fake DIC=0. A KVM guest still sees
the original host value for that register (I assume that this is
intentional so that a guest OS can apply its own workaround to the
erratum).

Anyway, CTR_EL0 is currently marked as invariant and migrating a VM
between those 2 machines using qemu fails.

With the patches below guest access to CTR_EL0 is emulated and
CTR_EL0.DIC can be disabled using KVM_SET_ONE_REG. I'm sending this
as an RFC since I likely missed something obvious and there's still
stuff that needs improving - e.g. I didn't look into FGT. The last
patch adds a tool to dump the KVM register state together with the
writable masks - not sure if that's helpful to others but I've used
this to compare the register state between different machines
(abusing kvm selftests for this is probably not the best idea - I
just wanted to use the neat helpers they provide).

Thanks,
Sebastian

Sebastian Ott (4):
  KVM: arm64: add emulation for CTR_EL0 register
  KVM: arm64: ensure guest access to CTR_EL0 is trapped
  KVM: arm64: show writable masks for feature registers
  KVM: selftests: aarch64: add tool to dump registers

 arch/arm64/include/asm/kvm_emulate.h          |  7 +-
 arch/arm64/kvm/sys_regs.c                     | 63 ++++++++++------
 tools/testing/selftests/kvm/Makefile          |  1 +
 .../testing/selftests/kvm/aarch64/dump_regs.c | 72 +++++++++++++++++++
 4 files changed, 114 insertions(+), 29 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/dump_regs.c

-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-03-19  9:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 11:16 [RFC] [PATCH 0/4] KVM: arm64: emulation for CTR_EL0 Sebastian Ott
2024-03-18 11:16 ` [PATCH 1/4] KVM: arm64: add emulation for CTR_EL0 register Sebastian Ott
2024-03-18 11:45   ` Marc Zyngier
2024-03-18 11:16 ` [PATCH 2/4] KVM: arm64: ensure guest access to CTR_EL0 is trapped Sebastian Ott
2024-03-18 11:47   ` Marc Zyngier
2024-03-18 11:16 ` [PATCH 3/4] KVM: arm64: show writable masks for feature registers Sebastian Ott
2024-03-18 12:03   ` Marc Zyngier
2024-03-18 18:20     ` Sebastian Ott
2024-03-19  9:50       ` Marc Zyngier
2024-03-18 18:22     ` Sebastian Ott
2024-03-18 11:16 ` [PATCH 4/4] KVM: selftests: aarch64: add tool to dump registers Sebastian Ott
2024-03-18 15:24 ` [RFC] [PATCH 0/4] KVM: arm64: emulation for CTR_EL0 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).