|
|
Log in / Subscribe / Register

KVM: arm64: emulation for CTR_EL0

From:  Sebastian Ott <sebott-AT-redhat.com>
To:  linux-arm-kernel-AT-lists.infradead.org, kvmarm-AT-lists.linux.dev, linux-kernel-AT-vger.kernel.org
Subject:  [PATCH 0/4] KVM: arm64: emulation for CTR_EL0
Date:  Fri, 05 Apr 2024 14:01:04 +0200
Message-ID:  <20240405120108.11844-1-sebott@redhat.com>
Cc:  Marc Zyngier <maz-AT-kernel.org>, Oliver Upton <oliver.upton-AT-linux.dev>, James Morse <james.morse-AT-arm.com>, Suzuki K Poulose <suzuki.poulose-AT-arm.com>, Catalin Marinas <catalin.marinas-AT-arm.com>, Will Deacon <will-AT-kernel.org>
Archive-link:  Article

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.

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

I've send this out as an RFC before [0]. What I've changed here
based on feedback I've got from Marc was:
 * store the emulated value per VM and not per VCPU
 * allow to change more values than just the DIC bit
 * only trap guest access to that reg when needed
 * make sure to not present the guest with an inconsistent register set

Patch 2 adds a ctr_el0 member to struct kvm_arch - would it be preferred
to add it into kvm->arch.id_regs[] (this would mean to increase that
array 4x)?

Patch 3 resets CLIDR_EL1 after a write to CTR_EL0 potentially changing
the value for CLIDR_EL1 - would that be ok for userspace?

Thanks,
Sebastian

[0]: https://lore.kernel.org/all/20240318111636.10613-1-sebott...


Sebastian Ott (4):
  KVM: arm64: change return value in arm64_check_features()
  KVM: arm64: maintain per VM value for CTR_EL0
  KVM: arm64: add emulation for CTR_EL0 register
  KVM: arm64: show writable masks for feature registers

 arch/arm64/include/asm/kvm_host.h |   1 +
 arch/arm64/kvm/sys_regs.c         | 131 ++++++++++++++++++++----------
 2 files changed, 89 insertions(+), 43 deletions(-)

-- 
2.42.0




Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds