linux/drivers/soc
Douglas Anderson 555701a45f soc: qcom: rpmh-rsc: Simplify locking by eliminating the per-TCS lock
The rpmh-rsc code had both a driver-level lock (sometimes referred to
in comments as drv->lock) and a lock per-TCS.  The idea was supposed
to be that there would be times where you could get by with just
locking a TCS lock and therefor other RPMH users wouldn't be blocked.

The above didn't work out so well.

Looking at tcs_write() the bigger drv->lock was held for most of the
function anyway.  Only the __tcs_buffer_write() and
__tcs_set_trigger() calls were called without holding the drv->lock.
It actually turns out that in tcs_write() we don't need to hold the
drv->lock for those function calls anyway even if the per-TCS lock
isn't there anymore.  From the newly added comments in the code, this
is because:
- We marked "tcs_in_use" under lock.
- Once "tcs_in_use" has been marked nobody else could be writing
  to these registers until the interrupt goes off.
- The interrupt can't go off until we trigger w/ the last line
  of __tcs_set_trigger().
Thus, from a tcs_write() point of view, the per-TCS lock was useless.

Looking at rpmh_rsc_write_ctrl_data(), only the per-TCS lock was held.
It turns out, though, that this function already needs to be called
with the equivalent of the drv->lock held anyway (we either need to
hold drv->lock as we will in a future patch or we need to know no
other CPUs could be running as happens today).  Specifically
rpmh_rsc_write_ctrl_data() might be writing to a TCS that has been
borrowed for writing an active transation but it never checks this.

Let's eliminate this extra overhead and avoid possible AB BA locking
headaches.

Suggested-by: Maulik Shah <mkshah@codeaurora.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20200504104917.v6.4.Ib8dccfdb10bf6b1fb1d600ca1c21d9c0db1ef746@changeid
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-05-15 11:44:58 -07:00
..
actions treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
amlogic soc: amlogic: fix compile failure with MESON_SECURE_PM_DOMAINS & !MESON_SM 2020-02-29 08:53:43 -08:00
aspeed soc: aspeed: Fix snoop_file_poll()'s return type 2019-12-05 10:10:08 -08:00
atmel drivers: soc: atmel: move sam9x60 under its own config flag 2019-12-10 00:44:53 +01:00
bcm soc: bcm: brcmstb: biuctrl: Update programming for 7211 2020-01-05 13:44:04 -08:00
dove treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
fsl ARM: driver updates 2020-04-03 15:05:35 -07:00
gemini soc: Add SoC driver for Gemini 2018-01-04 17:01:53 +01:00
imx ARM: driver updates 2020-04-03 15:05:35 -07:00
ixp4xx soc: ixp4xx: Protect IXP4xx SoC drivers by ARCH_IXP4XX || COMPILE_TEST 2019-08-29 17:34:38 +02:00
kendryte riscv: Add Kendryte K210 SoC support 2020-04-03 10:49:52 -07:00
lantiq soc: lantiq: convert to devm_platform_ioremap_resource 2020-01-10 11:44:52 -08:00
mediatek soc: mediatek: pwrap: add support for MT6359 PMIC 2020-02-17 11:07:25 +01:00
qcom soc: qcom: rpmh-rsc: Simplify locking by eliminating the per-TCS lock 2020-05-15 11:44:58 -07:00
renesas ARM: driver updates 2020-04-03 15:05:35 -07:00
rockchip ARM: SoC-related driver updates 2019-07-19 17:13:56 -07:00
samsung soc: samsung: chipid: Fix return value on non-Exynos platforms 2020-03-25 14:27:27 +01:00
sifive riscv: move sifive_l2_cache.h to include/soc 2020-01-12 10:12:44 -08:00
sunxi treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tegra soc/tegra: Changes for v5.7-rc1 2020-03-25 20:56:55 +01:00
ti soc: ti: pm33xx: Add base cpuidle support 2020-02-27 09:27:28 -08:00
ux500 ARM: ux500: add missing of_node_put() 2019-07-23 09:49:32 +02:00
versatile treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
xilinx ARM: SoC-related driver updates 2020-02-08 14:04:19 -08:00
zte treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
Kconfig riscv: Add Kendryte K210 SoC support 2020-04-03 10:49:52 -07:00
Makefile RISC-V Patches for the 5.7 Merge Window, Part 1 2020-04-09 10:51:30 -07:00