• Tyrel Datwyler's avatar
    powerpc/pseries: Fix drc-info mappings of logical cpus to drc-index · 775fa495
    Tyrel Datwyler authored
    There are a couple subtle errors in the mapping between cpu-ids and a
    cpus associated drc-index when using the new ibm,drc-info property.
    
    The first is that while drc-info may have been a supported firmware
    feature at boot it is possible we have migrated to a CEC with older
    firmware that doesn't support the ibm,drc-info property. In that case
    the device tree would have been updated after migration to remove the
    ibm,drc-info property and replace it with the older style ibm,drc-*
    properties for types, indexes, names, and power-domains. PAPR even
    goes as far as dictating that if we advertise support for drc-info
    that we are capable of supporting either property type at runtime.
    
    The second is that the first value of the ibm,drc-info property is
    the int encoded count of drc-info entries. As such "value" returned
    by of_prop_next_u32() is pointing at that count, and not the first
    element of the first drc-info entry as is expected by the
    of_read_drc_info_cell() helper.
    
    Fix the first by ignoring DRC-INFO firmware feature and instead
    testing directly for ibm,drc-info, and then falling back to the
    old style ibm,drc-indexes in the case it doesn't exit.
    
    Fix the second by incrementing value to the next element prior to
    parsing drc-info entries.
    Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/1573449697-5448-3-git-send-email-tyreld@linux.ibm.com
    775fa495
pseries_energy.c 8.3 KB