OSDN Git Service

arm64: cpufeature: Force HWCAP to be based on the sysreg visible to user-space
authorJames Morse <james.morse@arm.com>
Fri, 9 Sep 2022 16:59:36 +0000 (17:59 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 16 Sep 2022 14:16:34 +0000 (15:16 +0100)
commit237405ebef580a7352a52129b2465c117145eafa
tree230ce084281a4d3c964cbb2e0675ff88be865582
parentb90cb1053190353cc30f0fef0ef1f378ccc063c5
arm64: cpufeature: Force HWCAP to be based on the sysreg visible to user-space

arm64 advertises hardware features to user-space via HWCAPs, and by
emulating access to the CPUs id registers. The cpufeature code has a
sanitised system-wide view of an id register, and a sanitised user-space
view of an id register, where some features use their 'safe' value
instead of the hardware value.

It is currently possible for a HWCAP to be advertised where the user-space
view of the id register does not show the feature as supported.
Erratum workaround need to remove both the HWCAP, and the feature from
the user-space view of the id register. This involves duplicating the
code, and spreading it over cpufeature.c and cpu_errata.c.

Make the HWCAP code use the user-space view of id registers. This ensures
the values never diverge, and allows erratum workaround to remove HWCAP
by modifying the user-space view of the id register.

Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20220909165938.3931307-2-james.morse@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/cpufeature.c