Skip to content

Commit 78c4446

Browse files
shaoqinhMarc Zyngier
authored andcommitted
KVM: arm64: Allow userspace to change ID_AA64PFR1_EL1
Allow userspace to change the guest-visible value of the register with different way of handling: - Since the RAS and MPAM is not writable in the ID_AA64PFR0_EL1 register, RAS_frac and MPAM_frac are also not writable in the ID_AA64PFR1_EL1 register. - The MTE is controlled by a separate UAPI (KVM_CAP_ARM_MTE) with an internal flag (KVM_ARCH_FLAG_MTE_ENABLED). So it's not writable. - For those fields which KVM doesn't know how to handle, they are not exposed to the guest (being disabled in the register read accessor), those fields value will always be 0. Those fields don't have a known behavior now, so don't advertise them to the userspace. Thus still not writable. Those fields include SME, RNDR_trap, NMI, GCS, THE, DF2, PFAR, MTE_frac, MTEX. - The BT, SSBS, CSV2_frac don't introduce any new registers which KVM doesn't know how to handle, they can be written without ill effect. So let them writable. Besides, we don't do the crosscheck in KVM about the CSV2_frac even if it depends on the value of CSV2, it should be made sure by the VMM instead of KVM. Signed-off-by: Shaoqin Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent e8d1649 commit 78c4446

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,19 @@ static const struct sys_reg_desc sys_reg_descs[] = {
23702370
ID_AA64PFR0_EL1_GIC |
23712371
ID_AA64PFR0_EL1_AdvSIMD |
23722372
ID_AA64PFR0_EL1_FP), },
2373-
ID_SANITISED(ID_AA64PFR1_EL1),
2373+
ID_WRITABLE(ID_AA64PFR1_EL1, ~(ID_AA64PFR1_EL1_PFAR |
2374+
ID_AA64PFR1_EL1_DF2 |
2375+
ID_AA64PFR1_EL1_MTEX |
2376+
ID_AA64PFR1_EL1_THE |
2377+
ID_AA64PFR1_EL1_GCS |
2378+
ID_AA64PFR1_EL1_MTE_frac |
2379+
ID_AA64PFR1_EL1_NMI |
2380+
ID_AA64PFR1_EL1_RNDR_trap |
2381+
ID_AA64PFR1_EL1_SME |
2382+
ID_AA64PFR1_EL1_RES0 |
2383+
ID_AA64PFR1_EL1_MPAM_frac |
2384+
ID_AA64PFR1_EL1_RAS_frac |
2385+
ID_AA64PFR1_EL1_MTE)),
23742386
ID_UNALLOCATED(4,2),
23752387
ID_UNALLOCATED(4,3),
23762388
ID_WRITABLE(ID_AA64ZFR0_EL1, ~ID_AA64ZFR0_EL1_RES0),

0 commit comments

Comments
 (0)