Linux-OMAP Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one
@ 2020-05-14  7:37 Tero Kristo
  2020-05-19 17:45 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Tero Kristo @ 2020-05-14  7:37 UTC (permalink / raw)
  To: ssantosh, linux-kernel, linux-arm-kernel; +Cc: linux-omap, tony, s-anna

The reset handling APIs for omap-prm can be invoked PM runtime which
runs in atomic context. For this to work properly, switch to atomic
iopoll version instead of the current which can sleep. Otherwise,
this throws a "BUG: scheduling while atomic" warning. Issue is seen
rather easily when CONFIG_PREEMPT is enabled.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/soc/ti/omap_prm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
index 96c6f777519c..c9b3f9ebf0bb 100644
--- a/drivers/soc/ti/omap_prm.c
+++ b/drivers/soc/ti/omap_prm.c
@@ -256,10 +256,10 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev,
 		goto exit;
 
 	/* wait for the status to be set */
-	ret = readl_relaxed_poll_timeout(reset->prm->base +
-					 reset->prm->data->rstst,
-					 v, v & BIT(st_bit), 1,
-					 OMAP_RESET_MAX_WAIT);
+	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
+						 reset->prm->data->rstst,
+						 v, v & BIT(st_bit), 1,
+						 OMAP_RESET_MAX_WAIT);
 	if (ret)
 		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
 		       reset->prm->data->name, id);
-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one
  2020-05-14  7:37 [PATCH 1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one Tero Kristo
@ 2020-05-19 17:45 ` Tony Lindgren
  2020-05-19 18:04   ` santosh.shilimkar
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2020-05-19 17:45 UTC (permalink / raw)
  To: Tero Kristo; +Cc: ssantosh, linux-kernel, linux-arm-kernel, linux-omap, s-anna

* Tero Kristo <t-kristo@ti.com> [200514 00:38]:
> The reset handling APIs for omap-prm can be invoked PM runtime which
> runs in atomic context. For this to work properly, switch to atomic
> iopoll version instead of the current which can sleep. Otherwise,
> this throws a "BUG: scheduling while atomic" warning. Issue is seen
> rather easily when CONFIG_PREEMPT is enabled.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>

Santosh do you want me to pick this for fixes?

Regards,

Tony

> ---
>  drivers/soc/ti/omap_prm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
> index 96c6f777519c..c9b3f9ebf0bb 100644
> --- a/drivers/soc/ti/omap_prm.c
> +++ b/drivers/soc/ti/omap_prm.c
> @@ -256,10 +256,10 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev,
>  		goto exit;
>  
>  	/* wait for the status to be set */
> -	ret = readl_relaxed_poll_timeout(reset->prm->base +
> -					 reset->prm->data->rstst,
> -					 v, v & BIT(st_bit), 1,
> -					 OMAP_RESET_MAX_WAIT);
> +	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
> +						 reset->prm->data->rstst,
> +						 v, v & BIT(st_bit), 1,
> +						 OMAP_RESET_MAX_WAIT);
>  	if (ret)
>  		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
>  		       reset->prm->data->name, id);
> -- 
> 2.17.1
> 
> --
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one
  2020-05-19 17:45 ` Tony Lindgren
@ 2020-05-19 18:04   ` santosh.shilimkar
  0 siblings, 0 replies; 3+ messages in thread
From: santosh.shilimkar @ 2020-05-19 18:04 UTC (permalink / raw)
  To: Tony Lindgren, Tero Kristo
  Cc: ssantosh, linux-kernel, linux-arm-kernel, linux-omap, s-anna

On 5/19/20 10:45 AM, Tony Lindgren wrote:
> * Tero Kristo <t-kristo@ti.com> [200514 00:38]:
>> The reset handling APIs for omap-prm can be invoked PM runtime which
>> runs in atomic context. For this to work properly, switch to atomic
>> iopoll version instead of the current which can sleep. Otherwise,
>> this throws a "BUG: scheduling while atomic" warning. Issue is seen
>> rather easily when CONFIG_PREEMPT is enabled.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> 
> Santosh do you want me to pick this for fixes?
> 
Sure Tony. Thanks !!

Acked-by: Santosh Shilimkar <ssantosh@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  7:37 [PATCH 1/1] soc: ti: omap-prm: use atomic iopoll instead of sleeping one Tero Kristo
2020-05-19 17:45 ` Tony Lindgren
2020-05-19 18:04   ` santosh.shilimkar

Linux-OMAP Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-omap/0 linux-omap/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-omap linux-omap/ https://lore.kernel.org/linux-omap \
		linux-omap@vger.kernel.org
	public-inbox-index linux-omap

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-omap


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git