All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
@ 2022-04-21  1:39 Zheyu Ma
  2022-04-21 23:47 ` Damien Le Moal
  0 siblings, 1 reply; 5+ messages in thread
From: Zheyu Ma @ 2022-04-21  1:39 UTC (permalink / raw)
  To: s.shtylyov, damien.lemoal; +Cc: linux-ide, linux-kernel, Zheyu Ma

Before detecting the cable type on the dma bar, the driver should check
whether the 'bmdma_addr' is zero, which means the adapter does not
support DMA, otherwise we will get the following error:

[    5.146634] Bad IO access at port 0x1 (return inb(port))
[    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
[    5.150856] RIP: 0010:ioread8+0x4a/0x60
[    5.160238] Call Trace:
[    5.160470]  <TASK>
[    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
[    5.161728]  ata_eh_recover+0x3520/0x6cc0
[    5.168075]  ata_do_eh+0x49/0x3c0

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---Changes in v2:
    - Delete the useless 'else'
---
 drivers/ata/pata_marvell.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 0c5a51970fbf..014ccb0f45dc 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap)
 	switch(ap->port_no)
 	{
 	case 0:
+		if (!ap->ioaddr.bmdma_addr)
+			return ATA_CBL_PATA_UNK;
 		if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
 			return ATA_CBL_PATA40;
 		return ATA_CBL_PATA80;
-- 
2.25.1


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

* Re: [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
  2022-04-21  1:39 [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Zheyu Ma
@ 2022-04-21 23:47 ` Damien Le Moal
  2022-04-22  1:50   ` Zheyu Ma
  2022-04-25  0:38   ` Damien Le Moal
  0 siblings, 2 replies; 5+ messages in thread
From: Damien Le Moal @ 2022-04-21 23:47 UTC (permalink / raw)
  To: Zheyu Ma, s.shtylyov; +Cc: linux-ide, linux-kernel

On 4/21/22 10:39, Zheyu Ma wrote:
> Before detecting the cable type on the dma bar, the driver should check
> whether the 'bmdma_addr' is zero, which means the adapter does not
> support DMA, otherwise we will get the following error:
> 
> [    5.146634] Bad IO access at port 0x1 (return inb(port))
> [    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
> [    5.150856] RIP: 0010:ioread8+0x4a/0x60
> [    5.160238] Call Trace:
> [    5.160470]  <TASK>
> [    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
> [    5.161728]  ata_eh_recover+0x3520/0x6cc0
> [    5.168075]  ata_do_eh+0x49/0x3c0
> 
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---Changes in v2:
>      - Delete the useless 'else'

Note for future contributions: The change log should be placed *after* 
the "---" that comes before the "diff" line below. Otherwise, the change 
log pollutes the commit message.

I fixed that and applied to for-5.18-fixes. Thanks.

> ---
>   drivers/ata/pata_marvell.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
> index 0c5a51970fbf..014ccb0f45dc 100644
> --- a/drivers/ata/pata_marvell.c
> +++ b/drivers/ata/pata_marvell.c
> @@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap)
>   	switch(ap->port_no)
>   	{
>   	case 0:
> +		if (!ap->ioaddr.bmdma_addr)
> +			return ATA_CBL_PATA_UNK;
>   		if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
>   			return ATA_CBL_PATA40;
>   		return ATA_CBL_PATA80;


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
  2022-04-21 23:47 ` Damien Le Moal
@ 2022-04-22  1:50   ` Zheyu Ma
  2022-04-25  0:38   ` Damien Le Moal
  1 sibling, 0 replies; 5+ messages in thread
From: Zheyu Ma @ 2022-04-22  1:50 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Sergey Shtylyov, linux-ide, Linux Kernel Mailing List

On Fri, Apr 22, 2022 at 7:48 AM Damien Le Moal
<damien.lemoal@opensource.wdc.com> wrote:
>
> On 4/21/22 10:39, Zheyu Ma wrote:
> > Before detecting the cable type on the dma bar, the driver should check
> > whether the 'bmdma_addr' is zero, which means the adapter does not
> > support DMA, otherwise we will get the following error:
> >
> > [    5.146634] Bad IO access at port 0x1 (return inb(port))
> > [    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
> > [    5.150856] RIP: 0010:ioread8+0x4a/0x60
> > [    5.160238] Call Trace:
> > [    5.160470]  <TASK>
> > [    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
> > [    5.161728]  ata_eh_recover+0x3520/0x6cc0
> > [    5.168075]  ata_do_eh+0x49/0x3c0
> >
> > Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> > ---Changes in v2:
> >      - Delete the useless 'else'
>
> Note for future contributions: The change log should be placed *after*
> the "---" that comes before the "diff" line below. Otherwise, the change
> log pollutes the commit message.

Thank you for the reminder, I'll pay attention to this problem next time!

Zheyu Ma

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

* Re: [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
  2022-04-21 23:47 ` Damien Le Moal
  2022-04-22  1:50   ` Zheyu Ma
@ 2022-04-25  0:38   ` Damien Le Moal
  2022-04-25 10:18     ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Damien Le Moal @ 2022-04-25  0:38 UTC (permalink / raw)
  To: Zheyu Ma, s.shtylyov; +Cc: linux-ide, Greg KH, stable

On 4/22/22 08:47, Damien Le Moal wrote:
> On 4/21/22 10:39, Zheyu Ma wrote:
>> Before detecting the cable type on the dma bar, the driver should check
>> whether the 'bmdma_addr' is zero, which means the adapter does not
>> support DMA, otherwise we will get the following error:
>>
>> [    5.146634] Bad IO access at port 0x1 (return inb(port))
>> [    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
>> [    5.150856] RIP: 0010:ioread8+0x4a/0x60
>> [    5.160238] Call Trace:
>> [    5.160470]  <TASK>
>> [    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
>> [    5.161728]  ata_eh_recover+0x3520/0x6cc0
>> [    5.168075]  ata_do_eh+0x49/0x3c0
>>
>> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
>> ---Changes in v2:
>>      - Delete the useless 'else'
> 
> Note for future contributions: The change log should be placed *after* 
> the "---" that comes before the "diff" line below. Otherwise, the change 
> log pollutes the commit message.
> 
> I fixed that and applied to for-5.18-fixes. Thanks.

I completely overlooked that this needs a CC stable...

Greg,

Could you please pickup this commit for stable ?
In Linus tree/rc4, it is:

aafa9f958342 ("ata: pata_marvell: Check the 'bmdma_addr' beforing reading")

Thanks !

> 
>> ---
>>   drivers/ata/pata_marvell.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
>> index 0c5a51970fbf..014ccb0f45dc 100644
>> --- a/drivers/ata/pata_marvell.c
>> +++ b/drivers/ata/pata_marvell.c
>> @@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap)
>>   	switch(ap->port_no)
>>   	{
>>   	case 0:
>> +		if (!ap->ioaddr.bmdma_addr)
>> +			return ATA_CBL_PATA_UNK;
>>   		if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
>>   			return ATA_CBL_PATA40;
>>   		return ATA_CBL_PATA80;
> 
> 


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading
  2022-04-25  0:38   ` Damien Le Moal
@ 2022-04-25 10:18     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2022-04-25 10:18 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: Zheyu Ma, s.shtylyov, linux-ide, stable

On Mon, Apr 25, 2022 at 09:38:17AM +0900, Damien Le Moal wrote:
> On 4/22/22 08:47, Damien Le Moal wrote:
> > On 4/21/22 10:39, Zheyu Ma wrote:
> >> Before detecting the cable type on the dma bar, the driver should check
> >> whether the 'bmdma_addr' is zero, which means the adapter does not
> >> support DMA, otherwise we will get the following error:
> >>
> >> [    5.146634] Bad IO access at port 0x1 (return inb(port))
> >> [    5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
> >> [    5.150856] RIP: 0010:ioread8+0x4a/0x60
> >> [    5.160238] Call Trace:
> >> [    5.160470]  <TASK>
> >> [    5.160674]  marvell_cable_detect+0x6e/0xc0 [pata_marvell]
> >> [    5.161728]  ata_eh_recover+0x3520/0x6cc0
> >> [    5.168075]  ata_do_eh+0x49/0x3c0
> >>
> >> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> >> ---Changes in v2:
> >>      - Delete the useless 'else'
> > 
> > Note for future contributions: The change log should be placed *after* 
> > the "---" that comes before the "diff" line below. Otherwise, the change 
> > log pollutes the commit message.
> > 
> > I fixed that and applied to for-5.18-fixes. Thanks.
> 
> I completely overlooked that this needs a CC stable...
> 
> Greg,
> 
> Could you please pickup this commit for stable ?
> In Linus tree/rc4, it is:
> 
> aafa9f958342 ("ata: pata_marvell: Check the 'bmdma_addr' beforing reading")

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2022-04-25 10:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21  1:39 [PATCH v2] ata: pata_marvell: Check the 'bmdma_addr' beforing reading Zheyu Ma
2022-04-21 23:47 ` Damien Le Moal
2022-04-22  1:50   ` Zheyu Ma
2022-04-25  0:38   ` Damien Le Moal
2022-04-25 10:18     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.