aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/interconnect/qcom (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-09-20Merge branch 'icc-ignore-return-val' into icc-nextGeorgi Djakov5-5/+15
Today remove callbacks of platform devices return an int. This is unfortunate because the device core ignores the return value and so the platform code only emits a warning (and still removes the device). The longterm quest is to make these remove callbacks return void instead. This series is a preparation for that, with the goal to make the remove callbacks obviously always return 0. This way when the prototype of these functions is changed to return void, the change is straight forward and easy to review. Link: https://lore.kernel.org/r/20220718121409.171773-1-u.kleine-koenig@pengutronix.de Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-09-20interconnect: qcom: Kconfig: Make INTERCONNECT_QCOM tristateHuang Yiwei2-1/+4
Make INTERCONNECT_QCOM tristate so that icc-common.c can be compiled as a module. Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com> Reviewed-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20220914064122.16222-1-quic_hyiwei@quicinc.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-08-16interconnect: sm8450: Ignore return value of icc_provider_del() in .remove()Uwe Kleine-König1-1/+3
icc_provider_del() already emits an error message on failure. In this case letting .remove() return the corresponding error code results in another error message and the device is removed anyhow. (See platform_remove().) So ignore the return value of icc_provider_del() and return 0 unconditionally. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220718121409.171773-7-u.kleine-koenig@pengutronix.de Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-08-16interconnect: osm-l3: Ignore return value of icc_provider_del() in .remove()Uwe Kleine-König1-1/+3
icc_provider_del() already emits an error message on failure. In this case letting .remove() return the corresponding error code results in another error message and the device is removed anyhow. (See platform_remove().) So ignore the return value of icc_provider_del() and return 0 unconditionally. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220718121409.171773-6-u.kleine-koenig@pengutronix.de Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-08-16interconnect: msm8974: Ignore return value of icc_provider_del() in .remove()Uwe Kleine-König1-1/+3
icc_provider_del() already emits an error message on failure. In this case letting .remove() return the corresponding error code results in another error message and the device is removed anyhow. (See platform_remove().) So ignore the return value of icc_provider_del() and return 0 unconditionally. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220718121409.171773-5-u.kleine-koenig@pengutronix.de Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-08-16interconnect: icc-rpmh: Ignore return value of icc_provider_del() in .remove()Uwe Kleine-König1-1/+3
icc_provider_del() already emits an error message on failure. In this case letting .remove() return the corresponding error code results in another error message and the device is removed anyhow. (See platform_remove().) So ignore the return value of icc_provider_del() and return 0 unconditionally. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220718121409.171773-4-u.kleine-koenig@pengutronix.de Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-08-16interconnect: icc-rpm: Ignore return value of icc_provider_del() in .remove()Uwe Kleine-König1-1/+3
icc_provider_del() already emits an error message on failure. In this case letting .remove() return the corresponding error code results in another error message and the device is removed anyhow. (See platform_remove().) So ignore the return value of icc_provider_del() and return 0 unconditionally. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220718121409.171773-3-u.kleine-koenig@pengutronix.de Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-15Merge branch 'icc-rpm' into icc-nextGeorgi Djakov8-52/+200
This patch set is to support bucket in icc-rpm driver, so it implements the similar mechanism in the icc-rpmh driver. It uses interconnect path tag to indicate the bandwidth voting is for which buckets, and there have three kinds of buckets: AWC, WAKE and SLEEP, finally the wake and sleep bucket values are used to set the corresponding clock (active and sleep clocks). So far, we keep the AWC bucket but doesn't really use it. Link: https://lore.kernel.org/r/20220712015929.2789881-1-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-12interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket valuesLeo Yan1-14/+61
This commit uses buckets for support bandwidth and clock rates. It introduces a new function qcom_icc_bus_aggregate() to calculate the aggregate average and peak bandwidths for every bucket, and also it calculates the maximum value of aggregated average bandwidth across all buckets. The maximum aggregated average is used to calculate the final bandwidth requests. And we can set the clock rate per bucket, we use SLEEP bucket as default bucket if a platform doesn't enable the interconnect path tags in DT binding; otherwise, we use WAKE bucket to set active clock and use SLEEP bucket for other clocks. So far we don't use AMC bucket. Signed-off-by: Leo Yan <leo.yan@linaro.org> Link: https://lore.kernel.org/r/20220712015929.2789881-6-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-12interconnect: qcom: icc-rpm: Support multiple bucketsLeo Yan2-1/+56
The current interconnect rpm driver uses a single aggregate bandwidth to calculate the clock rates for both active and sleep clocks; therefore, it has no chance to separate bandwidth requests for these two kinds of clocks. This patch studies the implementation from interconnect rpmh driver to support multiple buckets. The rpmh driver provides three buckets for AMC, WAKE, and SLEEP; this driver only needs to use WAKE and SLEEP buckets, but we keep the same way with rpmh driver, this can allow us to reuse the DT binding and avoid to define duplicated data structures. This patch introduces two callbacks: qcom_icc_pre_bw_aggregate() is used to clean up bucket values before aggregate bandwidth requests, and qcom_icc_bw_aggregate() is to aggregate bandwidth for buckets. Signed-off-by: Leo Yan <leo.yan@linaro.org> Link: https://lore.kernel.org/r/20220712015929.2789881-5-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-12interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended()Leo Yan1-1/+2
This commit changes to use callback qcom_icc_xlate_extended(). This is a preparation for population path tags from the interconnect DT binding, it doesn't introduce functionality change for the existed DT binding without path tags. Signed-off-by: Leo Yan <leo.yan@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20220712015929.2789881-4-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-12interconnect: qcom: Move qcom_icc_xlate_extended() to a common fileLeo Yan6-26/+52
since there have conflict between two headers icc-rpmh.h and icc-rpm.h, the function qcom_icc_xlate_extended() is declared in icc-rpmh.h thus it cannot be used by icc-rpm driver. Move the function to a new common file icc-common.c so that allow it to be called by multiple drivers. Signed-off-by: Leo Yan <leo.yan@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20220712015929.2789881-3-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-07interconnect: icc-rpm: Set destination bandwidth as well as source bandwidthBryan O'Donoghue1-11/+30
Make it possible to set destination as well as source bandwidth. If the *dst pointer is non-NULL. Right now it appears that we never make the destination bw allocation call, which is inconsistent with the downstream way of doing this. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Link: https://lore.kernel.org/r/20220707093823.1691870-1-bryan.odonoghue@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-05Merge branch 'icc-sm6350' into icc-nextGeorgi Djakov5-0/+647
This series adds interconnect support for the various NoCs found on sm6350. A more special modification is allowing child NoC devices, like done for rpm-based qcm2290 which was already merged, but now for rpmh-based interconnect. See also downstream dts: https://android.googlesource.com/kernel/msm-extra/devicetree/+/refs/tags/android-11.0.0_r0.81/qcom/lagoon-bus.dtsi Link: https://lore.kernel.org/r/20220525144404.200390-1-luca.weiss@fairphone.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-07-05interconnect: qcom: msm8939: Use icc_sync_stateLeo Yan1-0/+1
It's fashion to use the icc_sync_state callback to notify the framework when all consumers are probed, so that the bandwidth request doesn't need to stay on maximum value. Do the same thing for msm8939 driver. Signed-off-by: Leo Yan <leo.yan@linaro.org> Link: https://lore.kernel.org/r/20220416012634.479617-1-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-06-20interconnect: qcom: Add SM6350 driver supportLuca Weiss4-0/+643
Add a driver that handles the different NoCs found on SM6350, generated from the downstream dtb. We're exluding ALC, IP0 and all _display nodes. ALC will not be voted from the kernel[1] and IP0 is handled by the clk-rpmh driver[2]. [1] https://lore.kernel.org/linux-arm-msm/1e79c73f22c8891dc9f868babd940fca@codeaurora.org/ [2] https://lore.kernel.org/linux-arm-msm/20220412220033.1273607-1-swboyd@chromium.org/ Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> Link: https://lore.kernel.org/r/20220525144404.200390-5-luca.weiss@fairphone.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-06-20interconnect: qcom: icc-rpmh: Support child NoC device probeLuca Weiss1-0/+4
As per e39bf2972c6e ("interconnect: icc-rpm: Support child NoC device probe") also update the rpmh interconnect driver to support probing NoCs that are modelled as child devices of a different NoC. As the driver doesn't yet use the 'reg' property, no change is done for that. Downstream DT reference: https://android.googlesource.com/kernel/msm-extra/devicetree/+/refs/tags/android-11.0.0_r0.56/qcom/lagoon-bus.dtsi Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> Link: https://lore.kernel.org/r/20220525144404.200390-2-luca.weiss@fairphone.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18Merge branch 'icc-rpm' into icc-nextGeorgi Djakov2-7/+11
This patch set is to address two clock rate setting issues. The first patch is to fix a potential cached clock rate mismatching issue, the issue can lead to the clock rate is missed to be set. Note, since this potential issue requires specific time window and certain condition (consumers need to request the same bandwidth) to produce, the patch is based on analysis but not a real trace log. The second patch is an extension to cache clock rates for active and sleep clocks separately, with this change it gives us possibility to set active and sleep clock with different clock rates. * icc-rpm interconnect: qcom: icc-rpm: Fix for cached clock rate interconnect: qcom: icc-rpm: Cache every clock rate Link: https://lore.kernel.org/r/20220416031029.693211-1-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18Merge branch 'icc-sc8180x' into icc-nextGeorgi Djakov2-270/+1588
This contains a few fixes for the sc8180x interconnect provider driver to make it functional. * icc-sc8180x dt-bindings: interconnect: Add SC8180X QUP0 virt provider interconnect: qcom: sc8180x: Modernize sc8180x probe interconnect: qcom: sc8180x: Fix QUP0 nodes interconnect: qcom: sc8180x: Mark some BCMs keepalive Link: https://lore.kernel.org/r/20220503211925.1022169-1-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18Merge branch 'icc-const' into icc-nextGeorgi Djakov21-323/+323
Constify structs that are not modified. Link: https://lore.kernel.org/r/20220412102623.227607-1-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18interconnect: qcom: sc8180x: Reformat node and bcm definitionsBjorn Andersson1-181/+1559
The Qualcomm interconnect providers started off defining nodes and BCMs using the DEFINE_QNODE() and DEFINE_QBCM() macros. Unfortunately this results in a block of long lines that are hard to read, a transition to explicitly stated definition has been made for newly introduced platforms. Transition the SC8180X interconnect provider driver to this style as well, to make it easier to read while debugging interconnect related issues. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220503225300.1141814-1-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18interconnect: qcom: sc8180x: Mark some BCMs keepaliveBjorn Andersson1-7/+7
In line with other platforms, mark BCMs controlling paths between the CPU, AOSS, GIC and memory as keepalive. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220503211925.1022169-5-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18interconnect: qcom: sc8180x: Fix QUP0 nodesBjorn Andersson2-3/+34
The QUP0 BCM relates to some internal property of the QUPs, and should be configured independently of the path to the QUP. In line with other platforms expose QUP_CORE endpoints in order allow this configuration. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220503211925.1022169-4-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18interconnect: qcom: sc8180x: Modernize sc8180x probeBjorn Andersson1-93/+2
The introduction of the Qualcomm SC8180X provider raced with the refactoring of the RPMh common code and SC8180X was left with the old style of duplicating the probe function in each provider driver. Transition the driver to the "new" design. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220503211925.1022169-3-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18Merge branch 'icc-sdx65' into icc-nextGeorgi Djakov4-0/+307
This adds interconnect driver support for SDX65 platform for scaling the bandwidth requirements over RPMh. Link: https://lore.kernel.org/r/1649854415-11174-1-git-send-email-quic_rohiagar@quicinc.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-18Merge branch 'icc-sc8280xp' into icc-nextGeorgi Djakov4-0/+2658
Add interconnect driver support for Qualcomm SC8280XP platform. * icc-sc8280xp dt-bindings: interconnect: qcom: Add sc8280xp binding interconnect: qcom: Add SC8280XP interconnect provider interconnect: qcom: sc8280xp: constify qcom_icc_desc interconnect: qcom: sc8280xp: constify icc_node pointers interconnect: qcom: sc8280xp: constify qcom_icc_bcm pointers Link: https://lore.kernel.org/r/20220408214835.624494-1-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-04interconnect: qcom: icc-rpm: Cache every clock rateLeo Yan2-6/+10
The cached clock rate is used for all bus clocks, thus it has the assumption that all interconnect clock rates are always same, this causes trouble if we want to set different clock rates separately. This patch is to allocate a clock rate array to cache every clock rate. Signed-off-by: Leo Yan <leo.yan@linaro.org> Link: https://lore.kernel.org/r/20220416031029.693211-3-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-05-04interconnect: qcom: icc-rpm: Fix for cached clock rateLeo Yan2-4/+4
All nodes within an interconnect bus share interconnect bus clocks, but every node has its own cached clock rate values, this can lead to unexpected clock rate setting. Let's see an example shown in below, in this case, a bus have two nodes A and B, and its buswidth is 8: step1: vote bandwidth 1600M for node(A): aggregated(bw) = 1600M qcom_icc_node(A)->rate = 1600M / 8 = 200MHz step2: vote bandwidth 1600M for node(B): aggregated(bw) = 1600M + 1600M = 3200M qcom_icc_node(B)->rate = 3200M / 8 = 400MHz step3: unvote bandwidth 1600M for node(A) aggregated(bw) = 3200M - 1600M = 1600M target_clock = 1600M / 8 = 200MHz The problem is in step 3, the calculated target clock rate is 200MHz, which equals to the cached clock rate in node(A) (See step 1), unfortunately, qcom_icc_set() skips to set the new clock rate 200MHz in this case, so the bus clock rate will continue to stay at 400MHz. To resolve the issue, one possible solution is to invoke clk_get_rate() to retrieve the clock rates on the fly, thus we can totally remove the cached clock rates. But after review the code, many bus clock has set the flag CLK_GET_RATE_NOCACHE, this results in the retrieving bus clock rate is time cost for iterating parent clock nodes, and even challenges bus clock drivers to provide recalc_rate() callbacks. So this patch moves the cached rates into structure qcom_icc_provider, we use it as a central place to maintain bus clock handlers and cached clock rate, therefore, it can smoothly dismiss the mismatching problem. Signed-off-by: Leo Yan <leo.yan@linaro.org> Link: https://lore.kernel.org/r/20220416031029.693211-2-leo.yan@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-27interconnect: qcom: sc8280xp: constify qcom_icc_bcm pointersKrzysztof Kozlowski1-12/+12
Pointers to struct qcom_icc_bcm are not modified, so they can be made const for safety. The contents of struct qcom_icc_bcm must stay non-const. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220427131154.302581-3-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-27interconnect: qcom: sc8280xp: constify icc_node pointersKrzysztof Kozlowski1-12/+12
Pointers to struct qcom_icc_node (and similar structures) are not modified, so they can be made const for safety. The contents of struct qcom_icc_node must stay non-const. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220427131154.302581-2-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-27interconnect: qcom: sc8280xp: constify qcom_icc_descKrzysztof Kozlowski1-12/+12
struct qcom_icc_desc is not modified so it can be made const for safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220427131154.302581-1-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-26interconnect: qcom: Add SDX65 interconnect provider driverRohit Agarwal4-0/+307
Add driver for the Qualcomm interconnect buses found in SDX65 based platforms. Signed-off-by: Rohit Agarwal <quic_rohiagar@quicinc.com> Link: https://lore.kernel.org/r/1649854415-11174-3-git-send-email-quic_rohiagar@quicinc.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-23interconnect: qcom: constify qcom_icc_bcm pointersKrzysztof Kozlowski10-90/+90
Pointers to struct qcom_icc_bcm are not modified, so they can be made const for safety. The contents of struct qcom_icc_bcm must stay non-const. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220412102623.227607-3-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-23interconnect: qcom: constify icc_node pointersKrzysztof Kozlowski21-143/+143
Pointers to struct qcom_icc_node (and similar structures) are not modified, so they can be made const for safety. The contents of struct qcom_icc_node must stay non-const. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220412102623.227607-2-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-23interconnect: qcom: constify qcom_icc_descKrzysztof Kozlowski12-96/+96
struct qcom_icc_desc is not modified so it can be made const for safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20220412102623.227607-1-krzysztof.kozlowski@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-22interconnect: qcom: Add SC8280XP interconnect providerBjorn Andersson4-0/+2658
The Qualcomm SC8280XP provides the means for the OS to request bus bandwidth using RPMh. It consists of providers for each of the busses in the SoC and two virtual providers, for the "memory controller" and a few of "virtual clocks". Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220408214835.624494-2-bjorn.andersson@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-14interconnect: qcom: sdx55: Drop IP0 interconnectsStephen Boyd1-21/+0
Similar to the sc7180 commit, let's drop the IP0 interconnects here because the IP0 resource is also used in the clk-rpmh driver on sdx55. It's bad to have the clk framework and interconnect framework control the same RPMh resource without any coordination. The rpmh driver in the kernel doesn't aggregate resources between clients either, so leaving control to clk-rpmh avoids any issues with unused interconnects turning off IP0 behind the back of the clk framework. Cc: Alex Elder <elder@linaro.org> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Taniya Das <quic_tdas@quicinc.com> Cc: Mike Tipton <quic_mdtipton@quicinc.com> Fixes: b2150cab9a97 ("clk: qcom: rpmh: add support for SDX55 rpmh IPA clock") Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220412220033.1273607-3-swboyd@chromium.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-04-14interconnect: qcom: sc7180: Drop IP0 interconnectsStephen Boyd1-21/+0
The IPA BCM resource ("IP0") on sc7180 was moved to the clk-rpmh driver in commit bcd63d222b60 ("clk: qcom: rpmh: Add IPA clock for SC7180") and modeled as a clk, but this interconnect driver still had it modeled as an interconnect. This was mostly OK because nobody used the interconnect definition, until the interconnect framework started dropping bandwidth requests on interconnects that aren't used via the sync_state callback in commit 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state"). Once that patch was applied the IP0 resource was going to be controlled from two places, the clk framework and the interconnect framework. Even then, things were probably going to be OK, because commit b95b668eaaa2 ("interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate") was needed to actually drop bandwidth requests on unused interconnects, of which the IPA was one of the interconnect that wasn't getting dropped to zero. Combining the three commits together leads to bad behavior where the interconnect framework is disabling the IP0 resource because it has no users while the clk framework thinks the IP0 resource is on because the only user, the IPA driver, has turned it on via clk_prepare_enable(). Depending on when sync_state is called, we can get into a situation like below: IPA driver probes IPA driver gets notified modem started runtime PM get() IPA clk enabled -> IP0 resource is ON sync_state runs interconnect zeroes out the IP0 resource -> IP0 resource is off IPA driver tries to access a register and blows up The crash is an unclocked access that manifest as an SError. SError Interrupt on CPU0, code 0xbe000011 -- SError CPU: 0 PID: 3595 Comm: mmdata_mgr Not tainted 5.17.1+ #166 Hardware name: Google Lazor (rev1 - 2) with LTE (DT) pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : mutex_lock+0x4c/0x80 lr : mutex_lock+0x30/0x80 sp : ffffffc00da9b9c0 x29: ffffffc00da9b9c0 x28: 0000000000000000 x27: 0000000000000000 x26: ffffffc00da9bc90 x25: ffffff80c2024010 x24: ffffff80c2024000 x23: ffffff8083100000 x22: ffffff80831000d0 x21: ffffff80831000a8 x20: ffffff80831000a8 x19: ffffff8083100070 x18: 00000000ffff0a00 x17: 000000002f7254f1 x16: 0000000000000100 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 000000000001f0b8 x10: ffffffc00931f0b8 x9 : 0000000000000000 x8 : 0000000000000000 x7 : fefefefefeff2f60 x6 : 0000808080808080 x5 : 0000000000000000 x4 : 8080808080800000 x3 : ffffff80d2d4ee28 x2 : ffffff808c1d6e40 x1 : 0000000000000000 x0 : ffffff8083100070 Kernel panic - not syncing: Asynchronous SError Interrupt CPU: 0 PID: 3595 Comm: mmdata_mgr Not tainted 5.17.1+ #166 Hardware name: Google Lazor (rev1 - 2) with LTE (DT) Call trace: dump_backtrace+0xf4/0x114 show_stack+0x24/0x30 dump_stack_lvl+0x64/0x7c dump_stack+0x18/0x38 panic+0x150/0x38c nmi_panic+0x88/0xa0 arm64_serror_panic+0x74/0x80 do_serror+0x0/0x80 do_serror+0x58/0x80 el1h_64_error_handler+0x34/0x4c el1h_64_error+0x78/0x7c mutex_lock+0x4c/0x80 __gsi_channel_start+0x50/0x17c gsi_channel_start+0x54/0x90 ipa_endpoint_enable_one+0x34/0xc0 ipa_open+0x4c/0x120 Remove all IP0 resource management from the interconnect driver so that clk-rpmh is the sole owner. This fixes the issue by preventing the interconnect driver from overwriting the IP0 resource data that the clk-rpmh driver wrote. Cc: Alex Elder <elder@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Taniya Das <quic_tdas@quicinc.com> Cc: Mike Tipton <quic_mdtipton@quicinc.com> Fixes: b95b668eaaa2 ("interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate") Fixes: bcd63d222b60 ("clk: qcom: rpmh: Add IPA clock for SC7180") Fixes: 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state") Signed-off-by: Stephen Boyd <swboyd@chromium.org> Tested-by: Alex Elder <elder@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220412220033.1273607-2-swboyd@chromium.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2022-02-10interconnect: qcom: msm8939: Remove snoc_mm specific regmapBryan O'Donoghue1-9/+1
Booting tip-of-tree on msm8939 we find the following error caused by our modelling of snoc and snoc_mm as peer devices with the same address space. [ 1.212340] qnoc-msm8939 580000.interconnect_mm: can't request region for resource [mem 0x00580000-0x0059407f] [ 1.212391] qnoc-msm8939 580000.interconnect_mm: Cannot ioremap interconnect bus resource [ 1.221524] qnoc-msm8939: probe of 580000.interconnect_mm failed with error -16 Declaring snoc_mm as a child device of snoc mitigates the fault and is consistent with a similar extant implementation in qcm2290. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Link: https://lore.kernel.org/r/20220129032735.2410936-3-bryan.odonoghue@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-15Merge branch 'icc-qcm2290' into icc-nextGeorgi Djakov9-12/+1453
Add support for QCM2290 including a few prep changes. * icc-qcm2290 interconnect: icc-rpm: Define ICC device type interconnect: icc-rpm: Add QNOC type QoS support interconnect: icc-rpm: Support child NoC device probe dt-bindings: interconnect: Add Qualcomm QCM2290 NoC support interconnect: qcom: Add QCM2290 driver support Link: https://lore.kernel.org/r/20211215002324.1727-1-shawn.guo@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-15interconnect: qcom: Add QCM2290 driver supportShawn Guo3-0/+1374
It adds interconnect driver support for QCM2290 platform. The topology consists of 3 NoCs: BIMC, Config NoC (CNOC) and System NoC (SNOC). SNOC is a QCOM_ICC_QNOC type device, as well as its 3 virtual child devices, QUP, MMNRT and MMRT. QUP is owned by RPM and thus has no .regmap_cfg, while the other 2 share the same .regmap_cfg with SNOC (parent). Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Link: https://lore.kernel.org/r/20211215002324.1727-6-shawn.guo@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-15interconnect: icc-rpm: Support child NoC device probeShawn Guo1-1/+11
As shown in downstream DT[1], the System NoC of QCM2290 is modelled using 4 fab/noc devices: sys_noc + qup_virt + mmnrt_virt + mmrt_virt. Among those 3 virtual devices, qup is owned by RPM and has no regmap resource, while mmnrt and mmrt are owned by AP and share the same regmap as sys_noc. So it's logical to represent these virtual devices as child nodes of sys_noc in DT, so that such configuration can be supported with a couple of changes on qnoc_probe(): - If there are child nodes, populate them. - If the device descriptor has .regmap_cfg but there is no IOMEM resource for the device, use parent's regmap. [1] https://android.googlesource.com/kernel/msm-extra/devicetree/+/refs/tags/android-11.0.0_r0.56/qcom/scuba-bus.dtsi Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Link: https://lore.kernel.org/r/20211215002324.1727-4-shawn.guo@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-15interconnect: icc-rpm: Add QNOC type QoS supportShawn Guo2-3/+38
It adds QoS support for QNOC type device which can be found on QCM2290 platform. The downstream driver[1] includes support for priority, limiter, regulator and forwarding setup. As QCM2290 support only requires priority and forwarding configuration, limiter and regulator support are omitted for this initial submission. [1] https://source.codeaurora.org/quic/la/kernel/msm-4.19/tree/drivers/soc/qcom/msm_bus/msm_bus_qnoc_adhoc.c?h=kernel.lnx.4.19.r22-rel Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Link: https://lore.kernel.org/r/20211215002324.1727-3-shawn.guo@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-15interconnect: icc-rpm: Define ICC device typeShawn Guo6-9/+31
The driver currently uses .is_bimc_node to distinguish device type BIMC from NOC. Define type for bus/noc devices like what downstream[1] does to make support for more types easier. [1] https://source.codeaurora.org/quic/la/kernel/msm-4.19/tree/drivers/soc/qcom/msm_bus/msm_bus_core.h?h=kernel.lnx.4.19.r22-rel#n46 Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Link: https://lore.kernel.org/r/20211215002324.1727-2-shawn.guo@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-14Merge branch 'icc-sm8450' into icc-nextGeorgi Djakov4-0/+2167
This add device tree binding and driver for interconnect providers found in SM8450 SoC. * icc-sm8450 dt-bindings: interconnect: Add Qualcomm SM8450 DT bindings interconnect: qcom: Add SM8450 interconnect provider driver Link: https://lore.kernel.org/r/20211209084842.189627-1-vkoul@kernel.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-14interconnect: qcom: Add SM8450 interconnect provider driverVinod Koul4-0/+2167
Add driver for the Qualcomm interconnect buses found in SM8450 based platforms. The topology consists of several NoCs that are controlled by a remote processor that collects the aggregated bandwidth for each master-slave pairs. This is based on the downstream driver by Vivek Aknurwar <viveka@codeaurora.org> Signed-off-by: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20211209084842.189627-3-vkoul@kernel.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-06Merge branch 'icc-sc7280' into icc-nextGeorgi Djakov2-1/+21
Add Epoch Subsystem (EPSS) L3 provider support on SM7280 SoCs. * icc-sc7280 dt-bindings: interconnect: Add EPSS L3 DT binding on SC7280 interconnect: qcom: Add EPSS L3 support on SC7280 Link: https://lore.kernel.org/r/1634812857-10676-1-git-send-email-okukatla@codeaurora.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-06Merge branch 'icc-msm8996' into icc-nextGeorgi Djakov6-0/+2271
This series adds a driver for interconnects on MSM8996. This fixes some rare display underflows and provides a slight heat reduction. * icc-msm8996 dt-bindings: interconnect: Combine SDM660 bindings into RPM schema interconnect: icc-rpm: Add support for bus power domain dt-bindings: interconnect: Add Qualcomm MSM8996 DT bindings interconnect: qcom: Add MSM8996 interconnect provider driver Link: https://lore.kernel.org/r/20211021132329.234942-1-y.oudjana@protonmail.com Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-06interconnect: qcom: rpm: Prevent integer overflow in rateStephan Gerhold1-0/+1
Using icc-rpm on ARM32 currently results in clk_set_rate() errors during boot, e.g. "bus clk_set_rate error: -22". This is very similar to commit 7381e27b1e56 ("interconnect: qcom: msm8974: Prevent integer overflow in rate") where the u64 is converted to a signed long during clock rate rounding, resulting in an overflow on 32-bit platforms. Let's fix it similarly by making sure that the rate does not exceed LONG_MAX. Such high clock rates will surely result in the maximum frequency of the bus anyway. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20211206114542.45325-1-stephan@gerhold.net Signed-off-by: Georgi Djakov <djakov@kernel.org>
2021-12-06interconnect: icc-rpm: Use NOC_QOS_MODE_INVALID for qos_mode checkShawn Guo1-2/+2
Use NOC_QOS_MODE_INVALID for invalid qos_mode check to improve the readability. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Link: https://lore.kernel.org/r/20211206075808.18124-2-shawn.guo@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>