• Konrad Dybcio's avatar
    soc: qcom: icc-bwmon: Set default thresholds dynamically · 0276f69f
    Konrad Dybcio authored
    
    
    Currently we use predefined initial threshold values. This works, but
    does not really scale well with more and more SoCs gaining bwmon support,
    as the necessary kickoff values may differ between platforms due to memory
    type and/or controller setup.
    All of the data we need for that is already provided in the device tree,
    anyway.
    
    Change the thresholds to:
    * low = 0 (as we've been doing up until now)
    * med = high = BW_MIN
    
    Throughput going below the med threshold nudges bwmon into signaling
    that we should slow down (e.g. if we inherited too high bandwidth
    from the bootloader).
    
    Throughput going above the high threshold nudges bwmon into signaling
    that we should speed up so as not to choke the bus traffic due to
    insufficient transfer rates.
    
    F_MIN is a perfect initial value for both of these cases - if we go
    above it (and there's a 99.99% chance it'll happen at boot time), we
    should definitely make the memory go faster, whereas if we go below it,
    we should slow down, no matter what performance state we were at before
    (it's only possible for them to be >= FMIN).
    
    This only changes the values programmed at probe time, as high and med
    thresholds are updated at interrupt, also based on the OPP table from DT.
    Signed-off-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
    Reviewed-by: default avatarBjorn Andersson <andersson@kernel.org>
    Link: https://lore.kernel.org/r/20230610-topic-bwmon_opp-v2-1-0d25c1ce7dca@linaro.org
    
    Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
    0276f69f
icc-bwmon.c 28.6 KB