linux_dsm_epyc7002/drivers/clk
Mike Turquette 533ddeb1e8 clk: allow reentrant calls into the clk framework
Reentrancy into the clock framework is necessary for clock operations
that result in nested calls to the clk api.  A common example is a clock
that is prepared via an i2c transaction, such as a clock inside of a
discrete audio chip or a power management IC.  The i2c subsystem itself
will use the clk api resulting in a deadlock:

clk_prepare(audio_clk)
	i2c_transfer(..)
		clk_prepare(i2c_controller_clk)

The ability to reenter the clock framework prevents this deadlock.

Other use cases exist such as allowing .set_rate callbacks to call
clk_set_parent to achieve the best rate, or to save power in certain
configurations.  Yet another example is performing pinctrl operations
from a clk_ops callback.  Calls into the pinctrl subsystem may call
clk_{un}prepare on an unrelated clock.  Allowing for nested calls to
reenter the clock framework enables both of these use cases.

Reentrancy is implemented by two global pointers that track the owner
currently holding a global lock.  One pointer tracks the owner during
sleepable, mutex-protected operations and the other one tracks the owner
during non-interruptible, spinlock-protected operations.

When the clk framework is entered we try to hold the global lock.  If it
is held we compare the current task against the current owner; a match
implies a nested call and we reenter.  If the values do not match then
we block on the lock until it is released.

Signed-off-by: Mike Turquette <mturquette@linaro.org>
Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Cc: David Brown <davidb@codeaurora.org>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
2013-04-02 10:23:41 -07:00
..
mmp clk: mmp: add clock definition for mmp2 2012-08-28 14:15:42 -07:00
mvebu cpufreq: kirkwood: Add a cpufreq driver for Marvell Kirkwood SoCs 2013-02-09 12:56:08 +01:00
mxs clk: mxs: Fix sparse warnings 2013-03-19 12:58:41 -07:00
socfpga ARM: socfpga: initial support for Altera's SOCFPGA platform 2012-07-19 10:39:00 +02:00
spear clk:SPEAr1340: Correct parent clock configuration 2013-03-21 14:36:55 -07:00
sunxi clk: sunxi: rename compatible strings 2013-03-27 08:35:35 -07:00
tegra clk: add table lookup to mux 2013-03-22 15:18:18 -07:00
ux500 clk: ux500: Fix prcmu clocks registration 2013-03-27 08:35:33 -07:00
versatile arm-soc: driver specific changes 2013-02-21 15:12:18 -08:00
x86 clk: x86: add support for Lynxpoint LPSS clocks 2013-01-23 21:14:22 +01:00
clk-axi-clkgen.c clk: Add axi-clkgen driver 2013-03-19 17:20:30 -07:00
clk-bcm2835.c clk: bcm2835: probe for fixed-clock in device tree 2013-01-14 21:46:59 -07:00
clk-composite.c clk: Add composite clock type 2013-03-26 12:51:48 -07:00
clk-devres.c ARM: 7537/1: clk: Fix release in devm_clk_put() 2012-09-19 21:51:27 +01:00
clk-divider.c clk-divider: fix macros 2013-01-18 09:44:02 -08:00
clk-fixed-factor.c clk: fixed-factor: round_rate should use do_div 2013-01-11 18:43:27 -08:00
clk-fixed-rate.c clk: add common of_clk_init() function 2013-01-24 11:09:28 -08:00
clk-gate.c clk: Add CLK_IS_BASIC flag to identify basic clocks 2012-07-11 15:36:43 -07:00
clk-highbank.c ACPI and power management updates for 3.9-rc1 2013-02-20 11:26:56 -08:00
clk-ls1x.c clk: add Loongson1B clock support 2012-08-31 11:05:18 -07:00
clk-max77686.c clk: max77686: Avoid double free at remove time 2013-01-15 16:16:26 -08:00
clk-mux.c clk: add table lookup to mux 2013-03-22 15:18:18 -07:00
clk-nomadik.c ARM: nomadik: switch over to using the FSMC driver 2012-11-15 15:37:47 +02:00
clk-prima2.c clk: prima2: fix return value check in sirfsoc_of_clk_init() 2013-03-22 15:16:31 -07:00
clk-twl6040.c Drivers: misc: remove __dev* attributes. 2013-01-03 15:57:16 -08:00
clk-u300.c ARM: u300: convert to common clock 2012-07-11 15:36:45 -07:00
clk-vt8500.c clk: vt8500: Use common of_clk_init() function 2013-01-24 11:12:52 -08:00
clk-wm831x.c Driver core updates for 3.8-rc1 2012-12-11 13:13:55 -08:00
clk-zynq.c clk: zynq: Add missing zynq clk header 2013-03-27 08:44:07 -07:00
clk.c clk: allow reentrant calls into the clk framework 2013-04-02 10:23:41 -07:00
clkdev.c ARM: 7534/1: clk: Make the managed clk functions generically available 2012-09-15 21:55:27 +01:00
Kconfig clk: Add axi-clkgen driver 2013-03-19 17:20:30 -07:00
Makefile clk: arm: sunxi: Add a new clock driver for sunxi SOCs 2013-03-27 08:35:34 -07:00