Skip to content

Commit ffe68b2

Browse files
shaoqinhMarc Zyngier
authored andcommitted
KVM: arm64: Disable fields that KVM doesn't know how to handle in ID_AA64PFR1_EL1
For some of the fields in the ID_AA64PFR1_EL1 register, KVM doesn't know how to handle them right now. So explicitly disable them in the register accessor, then those fields value will be masked to 0 even if on the hardware the field value is 1. This is safe because from a UAPI point of view that read_sanitised_ftr_reg() doesn't yet return a nonzero value for any of those fields. This will benifit the migration if the host and VM have different values when restoring a VM. Those fields include RNDR_trap, NMI, MTE_frac, GCS, THE, MTEX, DF2, PFAR. Signed-off-by: Shaoqin Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 980c41f commit ffe68b2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,14 @@ static u64 __kvm_read_sanitised_id_reg(const struct kvm_vcpu *vcpu,
15381538
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_MTE);
15391539

15401540
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_SME);
1541+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_RNDR_trap);
1542+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_NMI);
1543+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_MTE_frac);
1544+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_GCS);
1545+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_THE);
1546+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_MTEX);
1547+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_DF2);
1548+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_PFAR);
15411549
break;
15421550
case SYS_ID_AA64ISAR1_EL1:
15431551
if (!vcpu_has_ptrauth(vcpu))

0 commit comments

Comments
 (0)