Skip to content

Commit 5a23e5c

Browse files
committed
KVM: arm64: Advertise selected DebugVer in DBGDIDR.Version
Much like we do for other fields, extract the Debug architecture version from the ID register to populate the corresponding field in DBGDIDR. Rewrite the existing sysreg field extractors to use SYS_FIELD_GET() for consistency. Suggested-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 8b6958d commit 5a23e5c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

arch/arm64/kvm/sys_regs.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,12 +2447,13 @@ static bool trap_dbgdidr(struct kvm_vcpu *vcpu,
24472447
} else {
24482448
u64 dfr = IDREG(vcpu->kvm, SYS_ID_AA64DFR0_EL1);
24492449
u64 pfr = IDREG(vcpu->kvm, SYS_ID_AA64PFR0_EL1);
2450-
u32 el3 = !!cpuid_feature_extract_unsigned_field(pfr, ID_AA64PFR0_EL1_EL3_SHIFT);
2450+
u32 el3 = !!SYS_FIELD_GET(ID_AA64PFR0_EL1, EL3, pfr);
24512451

2452-
p->regval = ((((dfr >> ID_AA64DFR0_EL1_WRPs_SHIFT) & 0xf) << 28) |
2453-
(((dfr >> ID_AA64DFR0_EL1_BRPs_SHIFT) & 0xf) << 24) |
2454-
(((dfr >> ID_AA64DFR0_EL1_CTX_CMPs_SHIFT) & 0xf) << 20)
2455-
| (6 << 16) | (1 << 15) | (el3 << 14) | (el3 << 12));
2452+
p->regval = ((SYS_FIELD_GET(ID_AA64DFR0_EL1, WRPs, dfr) << 28) |
2453+
(SYS_FIELD_GET(ID_AA64DFR0_EL1, BRPs, dfr) << 24) |
2454+
(SYS_FIELD_GET(ID_AA64DFR0_EL1, CTX_CMPs, dfr) << 20) |
2455+
(SYS_FIELD_GET(ID_AA64DFR0_EL1, DebugVer, dfr) << 16) |
2456+
(1 << 15) | (el3 << 14) | (el3 << 12));
24562457
return true;
24572458
}
24582459
}

0 commit comments

Comments
 (0)