soc: qcom: icc-bwmon: Set default thresholds dynamically
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Wed, 14 Jun 2023 13:39:59 +0000 (15:39 +0200)
committerBjorn Andersson <andersson@kernel.org>
Mon, 10 Jul 2023 03:53:59 +0000 (20:53 -0700)
commit0276f69f13e23b828a149d765d5712e214182ee7
tree025a4523918f92d630385a18009b2fc6b70a7eff
parent06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
soc: qcom: icc-bwmon: Set default thresholds dynamically

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: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230610-topic-bwmon_opp-v2-1-0d25c1ce7dca@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/icc-bwmon.c