linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: imx: protect Soft Reset of port with lock
@ 2015-03-13  6:38 Jiada Wang
  2015-03-26 22:01 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Jiada Wang @ 2015-03-13  6:38 UTC (permalink / raw)
  To: linux-arm-kernel

Previously Soft Reset (clear of SRST bit in UCR2 register)
of UART in startup is not protected by lock, which may have race
with console_write, as console_write may occur at anytime even
when UART port is shutdown.

To avoid this race, protect Soft reset of UART port with spin_lock.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/tty/serial/imx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 0eb29b1..f81ccb1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1165,6 +1165,12 @@ static int imx_startup(struct uart_port *port)
 
 	writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
 
+	/* Can we enable the DMA support? */
+	if (is_imx6q_uart(sport) && !uart_console(port) &&
+	    !sport->dma_is_inited)
+		imx_uart_dma_init(sport);
+
+	spin_lock_irqsave(&sport->port.lock, flags);
 	/* Reset fifo's and state machines */
 	i = 100;
 
@@ -1175,12 +1181,6 @@ static int imx_startup(struct uart_port *port)
 	while (!(readl(sport->port.membase + UCR2) & UCR2_SRST) && (--i > 0))
 		udelay(1);
 
-	/* Can we enable the DMA support? */
-	if (is_imx6q_uart(sport) && !uart_console(port) &&
-	    !sport->dma_is_inited)
-		imx_uart_dma_init(sport);
-
-	spin_lock_irqsave(&sport->port.lock, flags);
 	/*
 	 * Finally, clear and enable interrupts
 	 */
-- 
1.9.3

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

* [PATCH] serial: imx: protect Soft Reset of port with lock
  2015-03-13  6:38 [PATCH] serial: imx: protect Soft Reset of port with lock Jiada Wang
@ 2015-03-26 22:01 ` Greg KH
  2015-04-13  6:52   ` jiwang
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2015-03-26 22:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 13, 2015 at 03:38:11PM +0900, Jiada Wang wrote:
> Previously Soft Reset (clear of SRST bit in UCR2 register)
> of UART in startup is not protected by lock, which may have race
> with console_write, as console_write may occur at anytime even
> when UART port is shutdown.
> 
> To avoid this race, protect Soft reset of UART port with spin_lock.
> 
> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
> ---
>  drivers/tty/serial/imx.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Doesn't apply to my tree :(

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

* [PATCH] serial: imx: protect Soft Reset of port with lock
  2015-03-26 22:01 ` Greg KH
@ 2015-04-13  6:52   ` jiwang
  2015-04-13  7:20     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: jiwang @ 2015-04-13  6:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Greg

On 03/27/2015 07:01 AM, Greg KH wrote:
> On Fri, Mar 13, 2015 at 03:38:11PM +0900, Jiada Wang wrote:
>> Previously Soft Reset (clear of SRST bit in UCR2 register)
>> of UART in startup is not protected by lock, which may have race
>> with console_write, as console_write may occur at anytime even
>> when UART port is shutdown.
>>
>> To avoid this race, protect Soft reset of UART port with spin_lock.
>>
>> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
>> ---
>>   drivers/tty/serial/imx.c | 12 ++++++------
>>   1 file changed, 6 insertions(+), 6 deletions(-)
> Doesn't apply to my tree :(
Can you tell me which tree are you using?
so that I can submit another patch based same tree.

Thanks,
Jiada

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

* [PATCH] serial: imx: protect Soft Reset of port with lock
  2015-04-13  6:52   ` jiwang
@ 2015-04-13  7:20     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2015-04-13  7:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 13, 2015 at 03:52:01PM +0900, jiwang wrote:
> Hi Greg
> 
> On 03/27/2015 07:01 AM, Greg KH wrote:
> >On Fri, Mar 13, 2015 at 03:38:11PM +0900, Jiada Wang wrote:
> >>Previously Soft Reset (clear of SRST bit in UCR2 register)
> >>of UART in startup is not protected by lock, which may have race
> >>with console_write, as console_write may occur at anytime even
> >>when UART port is shutdown.
> >>
> >>To avoid this race, protect Soft reset of UART port with spin_lock.
> >>
> >>Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
> >>---
> >>  drivers/tty/serial/imx.c | 12 ++++++------
> >>  1 file changed, 6 insertions(+), 6 deletions(-)
> >Doesn't apply to my tree :(
> Can you tell me which tree are you using?
> so that I can submit another patch based same tree.

Always either work off of linux-next, or my tty tree, and the tty-next
branch of it on git.kernel.org.

What tree were you working against, Linus's?  If so, please read
Documentation/development_process to get an understanding of how the
kernel development process works.

thanks,

greg k-h

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

end of thread, other threads:[~2015-04-13  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13  6:38 [PATCH] serial: imx: protect Soft Reset of port with lock Jiada Wang
2015-03-26 22:01 ` Greg KH
2015-04-13  6:52   ` jiwang
2015-04-13  7:20     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).