• Mark Rutland's avatar
    arm64: Fixup user features at boot time · 7f632d33
    Mark Rutland authored
    For ARM64_WORKAROUND_2658417, we use a cpu_enable() callback to hide the
    ID_AA64ISAR1_EL1.BF16 ID register field. This is a little awkward as
    CPUs may attempt to apply the workaround concurrently, requiring that we
    protect the bulk of the callback with a raw_spinlock, and requiring some
    pointless work every time a CPU is subsequently hotplugged in.
    
    This patch makes this a little simpler by handling the masking once at
    boot time. A new user_feature_fixup() function is called at the start of
    setup_user_features() to mask the feature, matching the style of
    elf_hwcap_fixup(). The ARM64_WORKAROUND_2658417 cpucap is added to
    cpucap_is_possible() so that code can be elided entirely when this is
    not possible.
    
    Note that the ARM64_WORKAROUND_2658417 capability is matched with
    ERRATA_MIDR_RANGE(), which implicitly gives the capability a
    ARM64_CPUCAP_LOCAL_CPU_ERRATUM type, which forbids the late onlining of
    a CPU with the erratum if the erratum was not present at boot time.
    Therefore this patch doesn't change the behaviour for late onlining.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Cc: James Morse <james.morse@arm.com>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    7f632d33
cpufeature.c 119 KB