• Suzuki K Poulose's avatar
    arm64: capabilities: Add flags to handle the conflicts on late CPU · 5b4747c5
    Suzuki K Poulose authored
    When a CPU is brought up, it is checked against the caps that are
    known to be enabled on the system (via verify_local_cpu_capabilities()).
    Based on the state of the capability on the CPU vs. that of System we
    could have the following combinations of conflict.
    
    	x-----------------------------x
    	| Type  | System   | Late CPU |
    	|-----------------------------|
    	|  a    |   y      |    n     |
    	|-----------------------------|
    	|  b    |   n      |    y     |
    	x-----------------------------x
    
    Case (a) is not permitted for caps which are system features, which the
    system expects all the CPUs to have (e.g VHE). While (a) is ignored for
    all errata work arounds. However, there could be exceptions to the plain
    filtering approach. e.g, KPTI is an optional feature for a late CPU as
    long as the system already enables it.
    
    Case (b) is not permitted for errata work arounds that cannot be activated
    after the kernel has finished booting.And we ignore (b) for features. Here,
    yet again, KPTI is an exception, where if a late CPU needs KPTI we are too
    late to enable it (because we change the allocation of ASIDs etc).
    
    Add two different flags to indicate how the conflict should be handled.
    
     ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU - CPUs may have the capability
     ARM64_CPUCAP_OPTIONAL_FOR_LATE_CPU - CPUs may not have the cappability.
    
    Now that we have the flags to describe the behavior of the errata and
    the features, as we treat them, define types for ERRATUM and FEATURE.
    
    Cc: Will Deacon <will.deacon@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Reviewed-by: default avatarDave Martin <dave.martin@arm.com>
    Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    5b4747c5
cpu_errata.c 12 KB