Skip to content

Commit 851354c

Browse files
Andre-ARMctmarinas
authored andcommitted
clocksource/drivers/arm_arch_timer: limit XGene-1 workaround
The AppliedMicro XGene-1 CPU has an erratum where the timer condition would only consider TVAL, not CVAL. We currently apply a workaround when seeing the PartNum field of MIDR_EL1 being 0x000, under the assumption that this would match only the XGene-1 CPU model. However even the Ampere eMAG (aka XGene-3) uses that same part number, and only differs in the "Variant" and "Revision" fields: XGene-1's MIDR is 0x500f0000, our eMAG reports 0x503f0002. Experiments show the latter doesn't show the faulty behaviour. Increase the specificity of the check to only consider partnum 0x000 and variant 0x00, to exclude the Ampere eMAG. Fixes: 012f188 ("clocksource/drivers/arm_arch_timer: Work around broken CVAL implementations") Reported-by: Ross Burton <[email protected]> Signed-off-by: Andre Przywara <[email protected]> Acked-by: Marc Zyngier <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 0899a62 commit 851354c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

arch/arm64/include/asm/cputype.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
#define ARM_CPU_PART_NEOVERSE_N2 0xD49
8686
#define ARM_CPU_PART_CORTEX_A78C 0xD4B
8787

88-
#define APM_CPU_PART_POTENZA 0x000
88+
#define APM_CPU_PART_XGENE 0x000
89+
#define APM_CPU_VAR_POTENZA 0x00
8990

9091
#define CAVIUM_CPU_PART_THUNDERX 0x0A1
9192
#define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2

arch/arm64/kvm/guest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ u32 __attribute_const__ kvm_target_cpu(void)
874874
break;
875875
case ARM_CPU_IMP_APM:
876876
switch (part_number) {
877-
case APM_CPU_PART_POTENZA:
877+
case APM_CPU_PART_XGENE:
878878
return KVM_ARM_TARGET_XGENE_POTENZA;
879879
}
880880
break;

drivers/clocksource/arm_arch_timer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,9 @@ static u64 __arch_timer_check_delta(void)
836836
* Note that TVAL is signed, thus has only 31 of its
837837
* 32 bits to express magnitude.
838838
*/
839-
MIDR_ALL_VERSIONS(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
840-
APM_CPU_PART_POTENZA)),
839+
MIDR_REV_RANGE(MIDR_CPU_MODEL(ARM_CPU_IMP_APM,
840+
APM_CPU_PART_XGENE),
841+
APM_CPU_VAR_POTENZA, 0x0, 0xf),
841842
{},
842843
};
843844

0 commit comments

Comments
 (0)