linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC 00/10] KVM: arm64: Enable fine grained undefined for MDSELR_EL1
@ 2024-06-20  6:57 Anshuman Khandual
  2024-06-20  6:57 ` [RFC 01/10] arm64/sysreg: Update ID_AA64MMFR0_EL1 register Anshuman Khandual
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Anshuman Khandual @ 2024-06-20  6:57 UTC (permalink / raw)
  To: linux-arm-kernel, maz
  Cc: Anshuman Khandual, Oliver Upton, James Morse, Suzuki K Poulose,
	Catalin Marinas, Will Deacon, Mark Brown, kvmarm, linux-kernel

MDSELR_EL1 register access is essential while enabling latest HW breakpoint
via the arch feature FEAT_DebugV8P9. During our previous discussion on this
[1], it was also observed that MDSELR_EL1 access needs to be managed across
various KVM host-guest code paths via the new fine grained trap based UNDEF
mechanism. Besides MDSELR_EL1 access is managed via FEAT_FGT2 based fine
grained registers.

This series has been carved out from the original breakpoint series just to
enable MSELR_EL1 access via fine grained trap control.

All the initial sysreg updates or additions are required while configuring
HDFGRTR2_EL2 and HDFGWTR2_EL2 registers in the last two patches.

This series has been very lightly tested - boots with KVM without warnings
or errors. I am not entirely sure how these fine grained bits would behave
in various paths. The idea is to get the series into discussion, learn and
change as required. All reviews, feedbacks and pointers really appreciated.

Questions and Challenges:

- TRBIDR_EL1.MPAM needs to be probed for setting HDFGRTR2_EL2_nTRBMPAM_EL1
  but kvm_has_feat() does not operate a non-ID register which causes build
  warnings. The same problem exists for probing PMSIDR_EL1.FDS which is
  needed for setting HDFGRTR2_EL2_nPMSDSFR_EL1 as well. Currently both the
  bits mentioned earlier are set, assuming the features are not present in
  nested virtualization. Do we need some new helpers to probe these non-ID
  registers as well ?

- At present both HDFGRTR2_EL2 and HDFGWTR2_EL2 based accesses are enabled
  (MDSELR_E1 was dependent on them) but then there are some more FEAT_FGT2
  registers such HFGRTR2_EL2, HFGWTR2_EL2 and HFGITR2_EL2. Should those be
  handled in this series as well ?

- Probably an entry is needed for SYS_MDSELR_EL1 in encoding_to_fgt[] table
  inside the file arch/arm64/kvm/emulate-nested.c, but while trying to test
  features for all individual bits in HDFGRTR2_EL2, it seemed a lot of new
  register definitions from various features need to be added as well, thus
  expanding the scope further. Should all required new system registers be
  added for completeness ?

[1] https://lore.kernel.org/all/20240405080008.1225223-1-anshuman.khandual@arm.com/

Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: James Morse <james.morse@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: kvmarm@lists.linux.dev
Cc: linux-kernel@vger.kernel.org

Anshuman Khandual (10):
  arm64/sysreg: Update ID_AA64MMFR0_EL1 register
  arm64/sysreg: Update ID_AA64DFR0_EL1 register
  arm64/sysreg: Add register fields for ID_AA64DFR2_EL1
  arm64/sysreg: Add register fields for HDFGRTR2_EL2
  arm64/sysreg: Add register fields for HDFGWTR2_EL2
  arm64/sysreg: Add register fields for MDSELR_EL1
  arm64/sysreg: Add register fields for PMSID_EL1
  arm64/sysreg: Add register fields for TRBIDR_EL1
  KVM: arm64: nv: Enable HDFGRTR2_EL2 & HDFGWTR2_EL2 access from virtual EL2
  KVM: arm64: nv: Add new HDFGRTR2_GROUP & HDFGRTR2_GROUP based FGU handling

 arch/arm64/include/asm/kvm_arm.h        |   8 ++
 arch/arm64/include/asm/kvm_host.h       |   5 ++
 arch/arm64/include/asm/vncr_mapping.h   |   2 +
 arch/arm64/kvm/emulate-nested.c         |  14 +++
 arch/arm64/kvm/hyp/include/hyp/switch.h |  10 +++
 arch/arm64/kvm/nested.c                 |  36 ++++++++
 arch/arm64/kvm/sys_regs.c               |  47 ++++++++++
 arch/arm64/tools/sysreg                 | 115 ++++++++++++++++++++++--
 8 files changed, 232 insertions(+), 5 deletions(-)

-- 
2.25.1



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

end of thread, other threads:[~2024-08-13  7:17 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20  6:57 [RFC 00/10] KVM: arm64: Enable fine grained undefined for MDSELR_EL1 Anshuman Khandual
2024-06-20  6:57 ` [RFC 01/10] arm64/sysreg: Update ID_AA64MMFR0_EL1 register Anshuman Khandual
2024-06-20  6:57 ` [RFC 02/10] arm64/sysreg: Update ID_AA64DFR0_EL1 register Anshuman Khandual
2024-06-20  6:58 ` [RFC 03/10] arm64/sysreg: Add register fields for ID_AA64DFR2_EL1 Anshuman Khandual
2024-06-20  6:58 ` [RFC 04/10] arm64/sysreg: Add register fields for HDFGRTR2_EL2 Anshuman Khandual
2024-06-20  6:58 ` [RFC 05/10] arm64/sysreg: Add register fields for HDFGWTR2_EL2 Anshuman Khandual
2024-06-20  6:58 ` [RFC 06/10] arm64/sysreg: Add register fields for MDSELR_EL1 Anshuman Khandual
2024-06-20  6:58 ` [RFC 07/10] arm64/sysreg: Add register fields for PMSID_EL1 Anshuman Khandual
2024-06-20  6:58 ` [RFC 08/10] arm64/sysreg: Add register fields for TRBIDR_EL1 Anshuman Khandual
2024-06-20  6:58 ` [RFC 09/10] KVM: arm64: nv: Enable HDFGRTR2_EL2 & HDFGWTR2_EL2 access from virtual EL2 Anshuman Khandual
2024-06-20  6:58 ` [RFC 10/10] KVM: arm64: nv: Add new HDFGRTR2_GROUP & HDFGRTR2_GROUP based FGU handling Anshuman Khandual
2024-06-20 11:06   ` Marc Zyngier
2024-06-21  7:56     ` Anshuman Khandual
2024-06-21 11:24       ` Marc Zyngier
2024-06-25  9:03         ` Anshuman Khandual
2024-06-25 13:58           ` Marc Zyngier
2024-08-01 10:46             ` Anshuman Khandual
2024-08-01 16:03               ` Marc Zyngier
2024-08-02  9:25                 ` Anshuman Khandual
2024-08-02 10:59                   ` Marc Zyngier
2024-08-03 10:38                     ` Anshuman Khandual
2024-08-04 11:05                       ` Marc Zyngier
2024-08-13  6:53                         ` Anshuman Khandual
2024-08-13  7:16                           ` 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).