• Chris Packham's avatar
    powerpc/setup_64: Set cache-line-size based on cache-block-size · 94c0b013
    Chris Packham authored
    If {i,d}-cache-block-size is set and {i,d}-cache-line-size is not, use
    the block-size value for both. Per the devicetree spec cache-line-size
    is only needed if it differs from the block size.
    
    Originally the code would fallback from block size to line size. An
    error message was printed if both properties were missing.
    
    Later the code was refactored to use clearer names and logic but it
    inadvertently made line size a required property, meaning on systems
    without a line size property we fall back to the default from the
    cputable.
    
    On powernv (OPAL) platforms, since the introduction of device tree CPU
    features (5a61ef74 ("powerpc/64s: Support new device tree binding
    for discovering CPU features")), that has led to the wrong value being
    used, as the fallback value is incorrect for Power8/Power9 CPUs.
    
    The incorrect values flow through to the VDSO and also to the sysconf
    values, SC_LEVEL1_ICACHE_LINESIZE etc.
    
    Fixes: bd067f83 ("powerpc/64: Fix naming of cache block vs. cache line")
    Cc: stable@vger.kernel.org # v4.11+
    Signed-off-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
    Reported-by: default avatarQian Cai <cai@lca.pw>
    [mpe: Add even more detail to change log]
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200416221908.7886-1-chris.packham@alliedtelesis.co.nz
    94c0b013
setup_64.c 25.4 KB