Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-24 Thread Julian Margetson

On 4/24/2016 11:21 AM, Christian Lamparter wrote:

On Sunday, April 24, 2016 09:05:43 AM Julian Margetson wrote:

On 4/23/2016 3:41 PM, Christian Lamparter wrote:

There's a known errata for the 460EX, with the CPU lockup upon
high AHB traffic:
<http://lists.denx.de/pipermail/u-boot/2008-June/036078.html>

"This patch implements a fix provided by AMCC so that the lockup upon
simultanious traffic on AHB USB OTG, USB 2.0 and SATA doesn't occur
anymore:..."

This should be fixed by u-boot. However, there's no telling if
there's more to this workaround in the dma engine. You could try
to do the testing without anything connected to the USB ports
and disable/remove all usb hcds modules. As for fixing this:
I did a quick search but couldn't find any public information.
There's always supp...@apm.com (contact them!), or maybe someone
from the Amiga community knows more?



Tested with kernel with all USB disabled. No sata error messages
during the partition copy but the copying is quite slow.

Ok. The CONFIG_DMADEVICES_DEBUG and CONFIG_DMADEVICES_VDEBUG option
have quite a large overhead, if this fixed the issue for now you
could try to disable them and look if the issue comes back or not.
(also, you can drop the mdelay patch if it's still applied). If
the issue doesn't come back, you could add your "Tested-by" tag
too.

Another thing, the sata dwc driver doesn't yet support NCQ. Do you
know if the driver for the Amiga OS does?


so this does appear to be the problem.

So, how to fix this? I know, there's an AHB DMA Arbiter. But I can't
get any documentation for it from AMCC/APM. Maybe denx.de or someone
from the Amiga community knows how to deal with it. In theory, we
could try if limiting the burst length, pending dma request count or
add code to retry failed dma transfers and reinit the usb-cores would
help.

Regards,
Christian



Disabled

CONFIG_DMADEVICES_DEBUG and CONFIG_DMADEVICES_VDEBUG

Still see issues with the USB enabled.
With USB also disabled I was able to finish the partition copy. But 
again it is very slow.


(parted) mklabel msdos
Warning: The existing disk label on /dev/sda will be destroyed and all 
data on

this disk will be lost. Do you want to continue?
Yes/No? y
(parted) p
Model: ATA WDC WD5000AAKX-0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted) q
Information: You may need to update /etc/fstab.

root@Amigaone:/home/amigaone# dd if=/dev/sdb6 of=/dev/sda
43597824+0 records in
43597824+0 records out
22322085888 bytes (22 GB, 21 GiB) copied, 2825.93 s, 7.9 MB/s

Regards
Julian





Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-24 Thread Julian Margetson

On 4/24/2016 11:21 AM, Christian Lamparter wrote:

On Sunday, April 24, 2016 09:05:43 AM Julian Margetson wrote:

On 4/23/2016 3:41 PM, Christian Lamparter wrote:

There's a known errata for the 460EX, with the CPU lockup upon
high AHB traffic:
<http://lists.denx.de/pipermail/u-boot/2008-June/036078.html>

"This patch implements a fix provided by AMCC so that the lockup upon
simultanious traffic on AHB USB OTG, USB 2.0 and SATA doesn't occur
anymore:..."

This should be fixed by u-boot. However, there's no telling if
there's more to this workaround in the dma engine. You could try
to do the testing without anything connected to the USB ports
and disable/remove all usb hcds modules. As for fixing this:
I did a quick search but couldn't find any public information.
There's always supp...@apm.com (contact them!), or maybe someone
from the Amiga community knows more?



Tested with kernel with all USB disabled. No sata error messages
during the partition copy but the copying is quite slow.

Ok. The CONFIG_DMADEVICES_DEBUG and CONFIG_DMADEVICES_VDEBUG option
have quite a large overhead, if this fixed the issue for now you
could try to disable them and look if the issue comes back or not.
(also, you can drop the mdelay patch if it's still applied). If
the issue doesn't come back, you could add your "Tested-by" tag
too.

Another thing, the sata dwc driver doesn't yet support NCQ. Do you
know if the driver for the Amiga OS does?


so this does appear to be the problem.

So, how to fix this? I know, there's an AHB DMA Arbiter. But I can't
get any documentation for it from AMCC/APM. Maybe denx.de or someone
from the Amiga community knows how to deal with it. In theory, we
could try if limiting the burst length, pending dma request count or
add code to retry failed dma transfers and reinit the usb-cores would
help.

Regards,
Christian



Disabled

CONFIG_DMADEVICES_DEBUG and CONFIG_DMADEVICES_VDEBUG

Still see issues with the USB enabled.
With USB also disabled I was able to finish the partition copy. But 
again it is very slow.


(parted) mklabel msdos
Warning: The existing disk label on /dev/sda will be destroyed and all 
data on

this disk will be lost. Do you want to continue?
Yes/No? y
(parted) p
Model: ATA WDC WD5000AAKX-0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted) q
Information: You may need to update /etc/fstab.

root@Amigaone:/home/amigaone# dd if=/dev/sdb6 of=/dev/sda
43597824+0 records in
43597824+0 records out
22322085888 bytes (22 GB, 21 GiB) copied, 2825.93 s, 7.9 MB/s

Regards
Julian





Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-24 Thread Julian Margetson

On 4/23/2016 3:41 PM, Christian Lamparter wrote:

On Saturday, April 23, 2016 11:44:09 AM Julian Margetson wrote:

On 4/23/2016 8:02 AM, Julian Margetson wrote:

On 4/22/2016 7:06 AM, Christian Lamparter wrote:

On Friday, April 22, 2016 06:50:44 AM Julian Margetson wrote:

On 4/21/2016 4:25 PM, Christian Lamparter wrote:

On Thursday, April 21, 2016 09:15:21 PM Andy Shevchenko wrote:

The last approach in the commit 8b3444852a2b ("sata_dwc_460ex:
move to generic
DMA driver") to switch to generic DMA engine API wasn't tested on
bare metal.
Besides that we expecting new board support coming with the same
SATA IP but
with different DMA.

The driver has been tested myself on Sam460ex and WD MyBookLive
(apollo3g)
boards. In any case I ask Christian, Måns, and Julian to
independently test and
provide Tested-by tag or error report.

I did a test run on my WD MyBook Live. I applied all the patches in
this series on top of the topic/dw branch of Vinod Koul:
<https://git.kernel.org/cgit/linux/kernel/git/vkoul/slave-dma.git/>

Tested-by: Christian Lamparter<chunk...@googlemail.com>
---
results for my old ST3808110AS HDD. filesystem is ext4.

# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads: 204 MB in  3.02 seconds = 67.51 MB/sec

# bonnie++ -u mbl
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.97   --Sequential Output-- --Sequential
Input- --Random-
Concurrency   1 -Per Chr- --Block-- -Rewrite- -Per Chr-
--Block-- --Seeks--
MachineSize K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec
%CP  /sec %CP
mbl496M98  99 26011  21 17589  20   538  99 80138
39 208.9   8
Latency 95267us1409ms 295ms   26947us 9644us
1787ms
Version  1.97   --Sequential Create-- Random
Create
mbl -Create-- --Read--- -Delete-- -Create--
--Read--- -Delete--
 files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec
%CP  /sec %CP
16  6959  78 + +++  5197  40  7250 79 +
+++  4718  37
Latency   149ms6742us 212ms 177ms 767us
217ms
1.97,1.97,mbl,1,1461269771,496M,,98,99,26011,21,17589,20,538,99,80138,39,208.9,8,16,6959,78,+,+++,5197,40,7250,79,+,+++,4718,37,95267us,1409ms,295ms,26947us,9644us,1787ms,149ms,6742us,212ms,177ms,767us,217ms



Again on copy partitions .

Ok, here's the copy from my mail off-list.

Well, a unrelated driver "m41t80" caused a crash:
[   12.912739] Oops: Kernel access of bad area, sig: 11 [#3]
[   12.912743] PREEMPT Canyonlands
[   12.912753] CPU: 0 PID: 1413 Comm: irq/45-m41t80 Tainted: G
D 4.6.0-rc4-next-20160421-sam460ex-jm #1
[   12.912757] task: ea9834e0 ti: eea6c000 task.ti: eea6c000
[   12.912760] NIP: c0224480 LR: c0023494 CTR: c0042508
[   12.912764] REGS: eea6daf0 TRAP: 0300   Tainted: G D
(4.6.0-rc4-next-20160421-sam460ex-jm)
[   12.912774] MSR: 00029000 <CE,EE,ME>  CR: 24008282 XER: 
[   12.912825] DEAR: 0008 ESR: 
[...]
[   12.912927] --- interrupt: 300 at mutex_lock+0x0/0x1c
[   12.912927] LR = m41t80_handle_irq+0x28/0xac
[   12.912932] [eea6de40] []   (null) (unreliable)
[   12.912938] [eea6de60] [c004ffac] irq_thread_fn+0x2c/0x48
[   12.912944] [eea6de80] [c00501cc] irq_thread+0xc4/0x160
[   12.912951] [eea6ded0] [c003a3f8] kthread+0xc8/0xcc
[   12.912957] [eea6df40] [c000aee8] ret_from_kernel_thread+0x5c/0x64
[   12.912960] Instruction dump:
[   12.912974] 80010014 7fc3f378 bbc10008 7c0803a6 38210010 4be24ca8
9421ffd0 7c0802a6
[   12.912987] bf210014 90010034 3b4302d8 812302ec <83890008>
812302d8 7f9a4840 419e011c
[   12.912995] Fixing recursive fault but reboot is needed!
   ^^^ "reboot is needed!"

Another thing that came to my mind: Have you checked if your hard drive
and the cables are ok? Are there any pending sectors or suspicious smart
values? Has the drive passed the extended offline test?
   Otherwise, I can't reproduce the error with my MyBook system. I've
tested
your kernel and it worked on the device without crashing. (I
copied/dd'ed
80GB from and back to the hard-drive. It was long and boring, but I
didn't
encounter any issues and the crc32 matched).

Sorry, but I can't help you if I can't reproduce it... And short of
sending
your box to test, I see no efficient way to debug it. However, what I
can
do, if you are interested: I have a few "build your own" My Book Live
kits.
It just needs a 3.5" hard-drive and 12v power adapter. If you are
interested
PM me off-list, this way you can veri

Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-24 Thread Julian Margetson

On 4/23/2016 3:41 PM, Christian Lamparter wrote:

On Saturday, April 23, 2016 11:44:09 AM Julian Margetson wrote:

On 4/23/2016 8:02 AM, Julian Margetson wrote:

On 4/22/2016 7:06 AM, Christian Lamparter wrote:

On Friday, April 22, 2016 06:50:44 AM Julian Margetson wrote:

On 4/21/2016 4:25 PM, Christian Lamparter wrote:

On Thursday, April 21, 2016 09:15:21 PM Andy Shevchenko wrote:

The last approach in the commit 8b3444852a2b ("sata_dwc_460ex:
move to generic
DMA driver") to switch to generic DMA engine API wasn't tested on
bare metal.
Besides that we expecting new board support coming with the same
SATA IP but
with different DMA.

The driver has been tested myself on Sam460ex and WD MyBookLive
(apollo3g)
boards. In any case I ask Christian, Måns, and Julian to
independently test and
provide Tested-by tag or error report.

I did a test run on my WD MyBook Live. I applied all the patches in
this series on top of the topic/dw branch of Vinod Koul:
<https://git.kernel.org/cgit/linux/kernel/git/vkoul/slave-dma.git/>

Tested-by: Christian Lamparter
---
results for my old ST3808110AS HDD. filesystem is ext4.

# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads: 204 MB in  3.02 seconds = 67.51 MB/sec

# bonnie++ -u mbl
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.97   --Sequential Output-- --Sequential
Input- --Random-
Concurrency   1 -Per Chr- --Block-- -Rewrite- -Per Chr-
--Block-- --Seeks--
MachineSize K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec
%CP  /sec %CP
mbl496M98  99 26011  21 17589  20   538  99 80138
39 208.9   8
Latency 95267us1409ms 295ms   26947us 9644us
1787ms
Version  1.97   --Sequential Create-- Random
Create
mbl -Create-- --Read--- -Delete-- -Create--
--Read--- -Delete--
 files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec
%CP  /sec %CP
16  6959  78 + +++  5197  40  7250 79 +
+++  4718  37
Latency   149ms6742us 212ms 177ms 767us
217ms
1.97,1.97,mbl,1,1461269771,496M,,98,99,26011,21,17589,20,538,99,80138,39,208.9,8,16,6959,78,+,+++,5197,40,7250,79,+,+++,4718,37,95267us,1409ms,295ms,26947us,9644us,1787ms,149ms,6742us,212ms,177ms,767us,217ms



Again on copy partitions .

Ok, here's the copy from my mail off-list.

Well, a unrelated driver "m41t80" caused a crash:
[   12.912739] Oops: Kernel access of bad area, sig: 11 [#3]
[   12.912743] PREEMPT Canyonlands
[   12.912753] CPU: 0 PID: 1413 Comm: irq/45-m41t80 Tainted: G
D 4.6.0-rc4-next-20160421-sam460ex-jm #1
[   12.912757] task: ea9834e0 ti: eea6c000 task.ti: eea6c000
[   12.912760] NIP: c0224480 LR: c0023494 CTR: c0042508
[   12.912764] REGS: eea6daf0 TRAP: 0300   Tainted: G D
(4.6.0-rc4-next-20160421-sam460ex-jm)
[   12.912774] MSR: 00029000   CR: 24008282 XER: 
[   12.912825] DEAR: 0008 ESR: 
[...]
[   12.912927] --- interrupt: 300 at mutex_lock+0x0/0x1c
[   12.912927] LR = m41t80_handle_irq+0x28/0xac
[   12.912932] [eea6de40] []   (null) (unreliable)
[   12.912938] [eea6de60] [c004ffac] irq_thread_fn+0x2c/0x48
[   12.912944] [eea6de80] [c00501cc] irq_thread+0xc4/0x160
[   12.912951] [eea6ded0] [c003a3f8] kthread+0xc8/0xcc
[   12.912957] [eea6df40] [c000aee8] ret_from_kernel_thread+0x5c/0x64
[   12.912960] Instruction dump:
[   12.912974] 80010014 7fc3f378 bbc10008 7c0803a6 38210010 4be24ca8
9421ffd0 7c0802a6
[   12.912987] bf210014 90010034 3b4302d8 812302ec <83890008>
812302d8 7f9a4840 419e011c
[   12.912995] Fixing recursive fault but reboot is needed!
   ^^^ "reboot is needed!"

Another thing that came to my mind: Have you checked if your hard drive
and the cables are ok? Are there any pending sectors or suspicious smart
values? Has the drive passed the extended offline test?
   Otherwise, I can't reproduce the error with my MyBook system. I've
tested
your kernel and it worked on the device without crashing. (I
copied/dd'ed
80GB from and back to the hard-drive. It was long and boring, but I
didn't
encounter any issues and the crc32 matched).

Sorry, but I can't help you if I can't reproduce it... And short of
sending
your box to test, I see no efficient way to debug it. However, what I
can
do, if you are interested: I have a few "build your own" My Book Live
kits.
It just needs a 3.5" hard-drive and 12v power adapter. If you are
interested
PM me off-list, this way you can verify that the kernels you build do
work,
just in case

Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-23 Thread Julian Margetson

On 4/22/2016 7:06 AM, Christian Lamparter wrote:

On Friday, April 22, 2016 06:50:44 AM Julian Margetson wrote:

On 4/21/2016 4:25 PM, Christian Lamparter wrote:

On Thursday, April 21, 2016 09:15:21 PM Andy Shevchenko wrote:

The last approach in the commit 8b3444852a2b ("sata_dwc_460ex: move to generic
DMA driver") to switch to generic DMA engine API wasn't tested on bare metal.
Besides that we expecting new board support coming with the same SATA IP but
with different DMA.

The driver has been tested myself on Sam460ex and WD MyBookLive (apollo3g)
boards. In any case I ask Christian, Måns, and Julian to independently test and
provide Tested-by tag or error report.

I did a test run on my WD MyBook Live. I applied all the patches in
this series on top of the topic/dw branch of Vinod Koul:
<https://git.kernel.org/cgit/linux/kernel/git/vkoul/slave-dma.git/>

Tested-by: Christian Lamparter<chunk...@googlemail.com>
---
results for my old ST3808110AS HDD. filesystem is ext4.

# hdparm -t /dev/sda

/dev/sda:
   Timing buffered disk reads: 204 MB in  3.02 seconds =  67.51 MB/sec

# bonnie++ -u mbl
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.97   --Sequential Output-- --Sequential Input- --Random-
Concurrency   1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
MachineSize K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
mbl496M98  99 26011  21 17589  20   538  99 80138  39 208.9   8
Latency 95267us1409ms 295ms   26947us9644us1787ms
Version  1.97   --Sequential Create-- Random Create
mbl -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec 
%CP
   16  6959  78 + +++  5197  40  7250  79 + +++  4718  
37
Latency   149ms6742us 212ms 177ms 767us 217ms
1.97,1.97,mbl,1,1461269771,496M,,98,99,26011,21,17589,20,538,99,80138,39,208.9,8,16,6959,78,+,+++,5197,40,7250,79,+,+++,4718,37,95267us,1409ms,295ms,26947us,9644us,1787ms,149ms,6742us,212ms,177ms,767us,217ms


Again on copy partitions .

Ok, here's the copy from my mail off-list.

Well, a unrelated driver "m41t80" caused a crash:
[   12.912739] Oops: Kernel access of bad area, sig: 11 [#3]
[   12.912743] PREEMPT Canyonlands
[   12.912753] CPU: 0 PID: 1413 Comm: irq/45-m41t80 Tainted: G  D 
4.6.0-rc4-next-20160421-sam460ex-jm #1
[   12.912757] task: ea9834e0 ti: eea6c000 task.ti: eea6c000
[   12.912760] NIP: c0224480 LR: c0023494 CTR: c0042508
[   12.912764] REGS: eea6daf0 TRAP: 0300   Tainted: G  D  
(4.6.0-rc4-next-20160421-sam460ex-jm)
[   12.912774] MSR: 00029000 <CE,EE,ME>  CR: 24008282  XER: 
[   12.912825] DEAR: 0008 ESR: 
[...]
[   12.912927] --- interrupt: 300 at mutex_lock+0x0/0x1c
[   12.912927] LR = m41t80_handle_irq+0x28/0xac
[   12.912932] [eea6de40] []   (null) (unreliable)
[   12.912938] [eea6de60] [c004ffac] irq_thread_fn+0x2c/0x48
[   12.912944] [eea6de80] [c00501cc] irq_thread+0xc4/0x160
[   12.912951] [eea6ded0] [c003a3f8] kthread+0xc8/0xcc
[   12.912957] [eea6df40] [c000aee8] ret_from_kernel_thread+0x5c/0x64
[   12.912960] Instruction dump:
[   12.912974] 80010014 7fc3f378 bbc10008 7c0803a6 38210010 4be24ca8 9421ffd0 
7c0802a6
[   12.912987] bf210014 90010034 3b4302d8 812302ec <83890008> 812302d8 7f9a4840 
419e011c
[   12.912995] Fixing recursive fault but reboot is needed!
  ^^^ "reboot is needed!"

Another thing that came to my mind: Have you checked if your hard drive
and the cables are ok? Are there any pending sectors or suspicious smart
values? Has the drive passed the extended offline test?
  
Otherwise, I can't reproduce the error with my MyBook system. I've tested

your kernel and it worked on the device without crashing. (I copied/dd'ed
80GB from and back to the hard-drive. It was long and boring, but I didn't
encounter any issues and the crc32 matched).

Sorry, but I can't help you if I can't reproduce it... And short of sending
your box to test, I see no efficient way to debug it. However, what I can
do, if you are interested: I have a few "build your own" My Book Live kits.
It just needs a 3.5" hard-drive and 12v power adapter. If you are interested
PM me off-list, this way you can verify that the kernels you build do work,
just in case this error is due to a hardware issue (zapped controller,
bad ram/drive/cab

Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-23 Thread Julian Margetson

On 4/22/2016 7:06 AM, Christian Lamparter wrote:

On Friday, April 22, 2016 06:50:44 AM Julian Margetson wrote:

On 4/21/2016 4:25 PM, Christian Lamparter wrote:

On Thursday, April 21, 2016 09:15:21 PM Andy Shevchenko wrote:

The last approach in the commit 8b3444852a2b ("sata_dwc_460ex: move to generic
DMA driver") to switch to generic DMA engine API wasn't tested on bare metal.
Besides that we expecting new board support coming with the same SATA IP but
with different DMA.

The driver has been tested myself on Sam460ex and WD MyBookLive (apollo3g)
boards. In any case I ask Christian, Måns, and Julian to independently test and
provide Tested-by tag or error report.

I did a test run on my WD MyBook Live. I applied all the patches in
this series on top of the topic/dw branch of Vinod Koul:
<https://git.kernel.org/cgit/linux/kernel/git/vkoul/slave-dma.git/>

Tested-by: Christian Lamparter
---
results for my old ST3808110AS HDD. filesystem is ext4.

# hdparm -t /dev/sda

/dev/sda:
   Timing buffered disk reads: 204 MB in  3.02 seconds =  67.51 MB/sec

# bonnie++ -u mbl
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.97   --Sequential Output-- --Sequential Input- --Random-
Concurrency   1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
MachineSize K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
mbl496M98  99 26011  21 17589  20   538  99 80138  39 208.9   8
Latency 95267us1409ms 295ms   26947us9644us1787ms
Version  1.97   --Sequential Create-- Random Create
mbl -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec 
%CP
   16  6959  78 + +++  5197  40  7250  79 + +++  4718  
37
Latency   149ms6742us 212ms 177ms 767us 217ms
1.97,1.97,mbl,1,1461269771,496M,,98,99,26011,21,17589,20,538,99,80138,39,208.9,8,16,6959,78,+,+++,5197,40,7250,79,+,+++,4718,37,95267us,1409ms,295ms,26947us,9644us,1787ms,149ms,6742us,212ms,177ms,767us,217ms


Again on copy partitions .

Ok, here's the copy from my mail off-list.

Well, a unrelated driver "m41t80" caused a crash:
[   12.912739] Oops: Kernel access of bad area, sig: 11 [#3]
[   12.912743] PREEMPT Canyonlands
[   12.912753] CPU: 0 PID: 1413 Comm: irq/45-m41t80 Tainted: G  D 
4.6.0-rc4-next-20160421-sam460ex-jm #1
[   12.912757] task: ea9834e0 ti: eea6c000 task.ti: eea6c000
[   12.912760] NIP: c0224480 LR: c0023494 CTR: c0042508
[   12.912764] REGS: eea6daf0 TRAP: 0300   Tainted: G  D  
(4.6.0-rc4-next-20160421-sam460ex-jm)
[   12.912774] MSR: 00029000   CR: 24008282  XER: 
[   12.912825] DEAR: 0008 ESR: 
[...]
[   12.912927] --- interrupt: 300 at mutex_lock+0x0/0x1c
[   12.912927] LR = m41t80_handle_irq+0x28/0xac
[   12.912932] [eea6de40] []   (null) (unreliable)
[   12.912938] [eea6de60] [c004ffac] irq_thread_fn+0x2c/0x48
[   12.912944] [eea6de80] [c00501cc] irq_thread+0xc4/0x160
[   12.912951] [eea6ded0] [c003a3f8] kthread+0xc8/0xcc
[   12.912957] [eea6df40] [c000aee8] ret_from_kernel_thread+0x5c/0x64
[   12.912960] Instruction dump:
[   12.912974] 80010014 7fc3f378 bbc10008 7c0803a6 38210010 4be24ca8 9421ffd0 
7c0802a6
[   12.912987] bf210014 90010034 3b4302d8 812302ec <83890008> 812302d8 7f9a4840 
419e011c
[   12.912995] Fixing recursive fault but reboot is needed!
  ^^^ "reboot is needed!"

Another thing that came to my mind: Have you checked if your hard drive
and the cables are ok? Are there any pending sectors or suspicious smart
values? Has the drive passed the extended offline test?
  
Otherwise, I can't reproduce the error with my MyBook system. I've tested

your kernel and it worked on the device without crashing. (I copied/dd'ed
80GB from and back to the hard-drive. It was long and boring, but I didn't
encounter any issues and the crc32 matched).

Sorry, but I can't help you if I can't reproduce it... And short of sending
your box to test, I see no efficient way to debug it. However, what I can
do, if you are interested: I have a few "build your own" My Book Live kits.
It just needs a 3.5" hard-drive and 12v power adapter. If you are interested
PM me off-list, this way you can verify that the kernels you build do work,
just in case this error is due to a hardware issue (zapped controller,
bad ram/drive/cable?) with your sam460ex box.

Regards,
Christian

Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-22 Thread Julian Margetson

On 4/21/2016 4:25 PM, Christian Lamparter wrote:

On Thursday, April 21, 2016 09:15:21 PM Andy Shevchenko wrote:

The last approach in the commit 8b3444852a2b ("sata_dwc_460ex: move to generic
DMA driver") to switch to generic DMA engine API wasn't tested on bare metal.
Besides that we expecting new board support coming with the same SATA IP but
with different DMA.

This series is targetting the following things:
- a few bug fixes to the original driver
- a part to fix the DMA engine usage and in particularly dw_dmac driver
- move driver to use generic PHY and "dmas" property which leads to update in 
DTS

The driver has been tested myself on Sam460ex and WD MyBookLive (apollo3g)
boards. In any case I ask Christian, Måns, and Julian to independently test and
provide Tested-by tag or error report.

I did a test run on my WD MyBook Live. I applied all the patches in
this series on top of the topic/dw branch of Vinod Koul:


Tested-by: Christian Lamparter 
---
results for my old ST3808110AS HDD. filesystem is ext4.

# hdparm -t /dev/sda

/dev/sda:
  Timing buffered disk reads: 204 MB in  3.02 seconds =  67.51 MB/sec

# bonnie++ -u mbl
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.97   --Sequential Output-- --Sequential Input- --Random-
Concurrency   1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
MachineSize K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
mbl496M98  99 26011  21 17589  20   538  99 80138  39 208.9   8
Latency 95267us1409ms 295ms   26947us9644us1787ms
Version  1.97   --Sequential Create-- Random Create
mbl -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
   files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
  16  6959  78 + +++  5197  40  7250  79 + +++  4718  37
Latency   149ms6742us 212ms 177ms 767us 217ms
1.97,1.97,mbl,1,1461269771,496M,,98,99,26011,21,17589,20,538,99,80138,39,208.9,8,16,6959,78,+,+++,5197,40,7250,79,+,+++,4718,37,95267us,1409ms,295ms,26947us,9644us,1787ms,149ms,6742us,212ms,177ms,767us,217ms





Again on copy partitions .
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2016.04.21 20:03:45 =~=~=~=~=~=~=~=~=~=~=~=
[0.00] Using Canyonlands machine description
[0.00] Linux version 4.6.0-rc4-next-20160421-sam460ex-jm 
(root@julian-VirtualBox) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) 
#1 PREEMPT Thu Apr 21 19:56:14 AST 2016
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [mem 0x-0x7fff]
[0.00] MMU: Allocated 1088 bytes of context maps for 255 contexts
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 522752
[0.00] Kernel command line: root=/dev/sdb6 console=ttyS0,115200 
console=tty0
[0.00] PID hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Sorting __ex_table...
[0.00] Memory: 2001640K/2097152K available (7432K kernel code, 316K 
rwdata, 3816K rodata, 240K init, 370K bss, 95512K reserved, 0K cma-reserved, 
1310720K highmem)
[0.00] Kernel virtual memory layout:
[0.00]   * 0xfffcf000..0xf000  : fixmap
[0.00]   * 0xffc0..0xffe0  : highmem PTEs
[0.00]   * 0xffa0..0xffc0  : consistent mem
[0.00]   * 0xffa0..0xffa0  : early ioremap
[0.00]   * 0xf100..0xffa0  : vmalloc & ioremap
[0.00] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[0.00] Preemptible hierarchical RCU implementation.
[0.00] Build-time adjustment of leaf fanout to 32.
[0.00] NR_IRQS:512 nr_irqs:512 16
[0.00] UIC0 (32 IRQ sources) at DCR 0xc0
[0.00] UIC1 (32 IRQ sources) at DCR 0xd0
[0.00] UIC2 (32 IRQ sources) at DCR 0xe0
[0.00] UIC3 (32 IRQ sources) at DCR 0xf0
[0.13] clocksource: timebase: mask: 

Re: [PATCH v1 00/23] ata: sata_dwc_460ex: make it working again

2016-04-22 Thread Julian Margetson

On 4/21/2016 4:25 PM, Christian Lamparter wrote:

On Thursday, April 21, 2016 09:15:21 PM Andy Shevchenko wrote:

The last approach in the commit 8b3444852a2b ("sata_dwc_460ex: move to generic
DMA driver") to switch to generic DMA engine API wasn't tested on bare metal.
Besides that we expecting new board support coming with the same SATA IP but
with different DMA.

This series is targetting the following things:
- a few bug fixes to the original driver
- a part to fix the DMA engine usage and in particularly dw_dmac driver
- move driver to use generic PHY and "dmas" property which leads to update in 
DTS

The driver has been tested myself on Sam460ex and WD MyBookLive (apollo3g)
boards. In any case I ask Christian, Måns, and Julian to independently test and
provide Tested-by tag or error report.

I did a test run on my WD MyBook Live. I applied all the patches in
this series on top of the topic/dw branch of Vinod Koul:


Tested-by: Christian Lamparter 
---
results for my old ST3808110AS HDD. filesystem is ext4.

# hdparm -t /dev/sda

/dev/sda:
  Timing buffered disk reads: 204 MB in  3.02 seconds =  67.51 MB/sec

# bonnie++ -u mbl
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version  1.97   --Sequential Output-- --Sequential Input- --Random-
Concurrency   1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
MachineSize K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
mbl496M98  99 26011  21 17589  20   538  99 80138  39 208.9   8
Latency 95267us1409ms 295ms   26947us9644us1787ms
Version  1.97   --Sequential Create-- Random Create
mbl -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
   files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
  16  6959  78 + +++  5197  40  7250  79 + +++  4718  37
Latency   149ms6742us 212ms 177ms 767us 217ms
1.97,1.97,mbl,1,1461269771,496M,,98,99,26011,21,17589,20,538,99,80138,39,208.9,8,16,6959,78,+,+++,5197,40,7250,79,+,+++,4718,37,95267us,1409ms,295ms,26947us,9644us,1787ms,149ms,6742us,212ms,177ms,767us,217ms





Again on copy partitions .
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2016.04.21 20:03:45 =~=~=~=~=~=~=~=~=~=~=~=
[0.00] Using Canyonlands machine description
[0.00] Linux version 4.6.0-rc4-next-20160421-sam460ex-jm 
(root@julian-VirtualBox) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) ) 
#1 PREEMPT Thu Apr 21 19:56:14 AST 2016
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [mem 0x-0x7fff]
[0.00] MMU: Allocated 1088 bytes of context maps for 255 contexts
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 522752
[0.00] Kernel command line: root=/dev/sdb6 console=ttyS0,115200 
console=tty0
[0.00] PID hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Sorting __ex_table...
[0.00] Memory: 2001640K/2097152K available (7432K kernel code, 316K 
rwdata, 3816K rodata, 240K init, 370K bss, 95512K reserved, 0K cma-reserved, 
1310720K highmem)
[0.00] Kernel virtual memory layout:
[0.00]   * 0xfffcf000..0xf000  : fixmap
[0.00]   * 0xffc0..0xffe0  : highmem PTEs
[0.00]   * 0xffa0..0xffc0  : consistent mem
[0.00]   * 0xffa0..0xffa0  : early ioremap
[0.00]   * 0xf100..0xffa0  : vmalloc & ioremap
[0.00] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[0.00] Preemptible hierarchical RCU implementation.
[0.00] Build-time adjustment of leaf fanout to 32.
[0.00] NR_IRQS:512 nr_irqs:512 16
[0.00] UIC0 (32 IRQ sources) at DCR 0xc0
[0.00] UIC1 (32 IRQ sources) at DCR 0xd0
[0.00] UIC2 (32 IRQ sources) at DCR 0xe0
[0.00] UIC3 (32 IRQ sources) at DCR 0xf0
[0.13] clocksource: timebase: mask: 0x max_cycles: 

Re: [PATCH] mm: fix pfn_t vs highmem

2016-02-10 Thread Julian Margetson

On 2/10/2016 10:18 PM, Dan Williams wrote:

The pfn_t type uses an unsigned long to store a pfn + flags value.  On a
64-bit platform the upper 12 bits of an unsigned long are never used for
storing the value of a pfn.  However, this is not true on highmem
platforms, all 32-bits of a pfn value are used to address a 44-bit
physical address space.  A pfn_t needs to store a 64-bit value.

Reported-by: Stuart Foster 
Reported-by: Julian Margetson 
Cc: 
Link: https://bugzilla.kernel.org/show_bug.cgi?id=112211
Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
Signed-off-by: Dan Williams 
---
  include/linux/pfn.h   |2 +-
  include/linux/pfn_t.h |   19 +--
  kernel/memremap.c |2 +-
  3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/linux/pfn.h b/include/linux/pfn.h
index 2d8e49711b63..1132953235c0 100644
--- a/include/linux/pfn.h
+++ b/include/linux/pfn.h
@@ -10,7 +10,7 @@
   * backing is indicated by flags in the high bits of the value.
   */
  typedef struct {
-   unsigned long val;
+   u64 val;
  } pfn_t;
  #endif
  
diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h

index 37448ab5fb5c..94994810c7c0 100644
--- a/include/linux/pfn_t.h
+++ b/include/linux/pfn_t.h
@@ -9,14 +9,13 @@
   * PFN_DEV - pfn is not covered by system memmap by default
   * PFN_MAP - pfn has a dynamic page mapping established by a device driver
   */
-#define PFN_FLAGS_MASK (((unsigned long) ~PAGE_MASK) \
-   << (BITS_PER_LONG - PAGE_SHIFT))
-#define PFN_SG_CHAIN (1UL << (BITS_PER_LONG - 1))
-#define PFN_SG_LAST (1UL << (BITS_PER_LONG - 2))
-#define PFN_DEV (1UL << (BITS_PER_LONG - 3))
-#define PFN_MAP (1UL << (BITS_PER_LONG - 4))
-
-static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, unsigned long flags)
+#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - 
PAGE_SHIFT))
+#define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
+#define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
+#define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
+#define PFN_MAP (1ULL << (BITS_PER_LONG_LONG - 4))
+
+static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, u64 flags)
  {
pfn_t pfn_t = { .val = pfn | (flags & PFN_FLAGS_MASK), };
  
@@ -29,7 +28,7 @@ static inline pfn_t pfn_to_pfn_t(unsigned long pfn)

return __pfn_to_pfn_t(pfn, 0);
  }
  
-extern pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags);

+extern pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags);
  
  static inline bool pfn_t_has_page(pfn_t pfn)

  {
@@ -87,7 +86,7 @@ static inline pmd_t pfn_t_pmd(pfn_t pfn, pgprot_t pgprot)
  #ifdef __HAVE_ARCH_PTE_DEVMAP
  static inline bool pfn_t_devmap(pfn_t pfn)
  {
-   const unsigned long flags = PFN_DEV|PFN_MAP;
+   const u64 flags = PFN_DEV|PFN_MAP;
  
  	return (pfn.val & flags) == flags;

  }
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 3427cca5a2a6..b04ea2f5fbfe 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -152,7 +152,7 @@ void devm_memunmap(struct device *dev, void *addr)
  }
  EXPORT_SYMBOL(devm_memunmap);
  
-pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags)

+pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags)
  {
return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags);
  }





Thanks.This fixes my issue.
Tested-by:  Julian Margetson 

Julian



Re: [PATCH] mm: fix pfn_t vs highmem

2016-02-10 Thread Julian Margetson

On 2/10/2016 10:18 PM, Dan Williams wrote:

The pfn_t type uses an unsigned long to store a pfn + flags value.  On a
64-bit platform the upper 12 bits of an unsigned long are never used for
storing the value of a pfn.  However, this is not true on highmem
platforms, all 32-bits of a pfn value are used to address a 44-bit
physical address space.  A pfn_t needs to store a 64-bit value.

Reported-by: Stuart Foster <smf.li...@ntlworld.com>
Reported-by: Julian Margetson <runa...@candw.ms>
Cc: <dri-de...@lists.freedesktop.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=112211
Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
---
  include/linux/pfn.h   |2 +-
  include/linux/pfn_t.h |   19 +--
  kernel/memremap.c |2 +-
  3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/linux/pfn.h b/include/linux/pfn.h
index 2d8e49711b63..1132953235c0 100644
--- a/include/linux/pfn.h
+++ b/include/linux/pfn.h
@@ -10,7 +10,7 @@
   * backing is indicated by flags in the high bits of the value.
   */
  typedef struct {
-   unsigned long val;
+   u64 val;
  } pfn_t;
  #endif
  
diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h

index 37448ab5fb5c..94994810c7c0 100644
--- a/include/linux/pfn_t.h
+++ b/include/linux/pfn_t.h
@@ -9,14 +9,13 @@
   * PFN_DEV - pfn is not covered by system memmap by default
   * PFN_MAP - pfn has a dynamic page mapping established by a device driver
   */
-#define PFN_FLAGS_MASK (((unsigned long) ~PAGE_MASK) \
-   << (BITS_PER_LONG - PAGE_SHIFT))
-#define PFN_SG_CHAIN (1UL << (BITS_PER_LONG - 1))
-#define PFN_SG_LAST (1UL << (BITS_PER_LONG - 2))
-#define PFN_DEV (1UL << (BITS_PER_LONG - 3))
-#define PFN_MAP (1UL << (BITS_PER_LONG - 4))
-
-static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, unsigned long flags)
+#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - 
PAGE_SHIFT))
+#define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
+#define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
+#define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
+#define PFN_MAP (1ULL << (BITS_PER_LONG_LONG - 4))
+
+static inline pfn_t __pfn_to_pfn_t(unsigned long pfn, u64 flags)
  {
pfn_t pfn_t = { .val = pfn | (flags & PFN_FLAGS_MASK), };
  
@@ -29,7 +28,7 @@ static inline pfn_t pfn_to_pfn_t(unsigned long pfn)

return __pfn_to_pfn_t(pfn, 0);
  }
  
-extern pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags);

+extern pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags);
  
  static inline bool pfn_t_has_page(pfn_t pfn)

  {
@@ -87,7 +86,7 @@ static inline pmd_t pfn_t_pmd(pfn_t pfn, pgprot_t pgprot)
  #ifdef __HAVE_ARCH_PTE_DEVMAP
  static inline bool pfn_t_devmap(pfn_t pfn)
  {
-   const unsigned long flags = PFN_DEV|PFN_MAP;
+   const u64 flags = PFN_DEV|PFN_MAP;
  
  	return (pfn.val & flags) == flags;

  }
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 3427cca5a2a6..b04ea2f5fbfe 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -152,7 +152,7 @@ void devm_memunmap(struct device *dev, void *addr)
  }
  EXPORT_SYMBOL(devm_memunmap);
  
-pfn_t phys_to_pfn_t(phys_addr_t addr, unsigned long flags)

+pfn_t phys_to_pfn_t(phys_addr_t addr, u64 flags)
  {
    return __pfn_to_pfn_t(addr >> PAGE_SHIFT, flags);
  }





Thanks.This fixes my issue.
Tested-by:  Julian Margetson <runa...@candw.ms>

Julian



Re: [PATCH] mm: fix pfn_t to page conversion in vm_insert_mixed

2016-01-26 Thread Julian Margetson

On 1/26/2016 4:34 PM, Dan Williams wrote:

On Tue, Jan 26, 2016 at 11:46 AM, Julian Margetson  wrote:

On 1/26/2016 2:37 PM, Dan Williams wrote:

pfn_t_to_page() honors the flags in the pfn_t value to determine if a
pfn is backed by a page.  However, vm_insert_mixed() was originally
written to use pfn_valid() to make this determination.  To restore the
old/correct behavior, ignore the pfn_t flags in the !pfn_t_devmap() case
and fallback to trusting pfn_valid().

Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
Cc: Dave Hansen 
Cc: David Airlie 
Reported-by: Julian Margetson 
Reported-by: Tomi Valkeinen 
Signed-off-by: Dan Williams 
---
  mm/memory.c |9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 30991f83d0bf..93ce37989471 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1591,10 +1591,15 @@ int vm_insert_mixed(struct vm_area_struct *vma,
unsigned long addr,
   * than insert_pfn).  If a zero_pfn were inserted into a VM_MIXEDMAP
   * without pte special, it would there be refcounted as a normal page.
   */
- if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) {
+ if (!HAVE_PTE_SPECIAL && !pfn_t_devmap(pfn) && pfn_t_valid(pfn)) {
   struct page *page;

- page = pfn_t_to_page(pfn);
+ /*
+ * At this point we are committed to insert_page()
+ * regardless of whether the caller specified flags that
+ * result in pfn_t_has_page() == false.
+ */
+ page = pfn_to_page(pfn_t_to_pfn(pfn));
   return insert_page(vma, addr, page, vma->vm_page_prot);
   }
   return insert_pfn(vma, addr, pfn, vma->vm_page_prot);



[   16.503323] systemd[1]: Mounting FUSE Control File System...
[   42.703092] Oops: Machine check, sig: 7 [#1]
[   42.707624] PREEMPT Canyonlands
[   42.710959] Modules linked in:
[   42.714201] CPU: 0 PID: 553 Comm: Xorg Not tainted 4.5.0-rc1-Sam460ex #1
[   42.721283] task: ee1e45c0 ti: ecd46000 task.ti: ecd46000
[   42.726983] NIP: 1fed2480 LR: 1fed2404 CTR: 1fed24d0
[   42.732227] REGS: ecd47f10 TRAP: 0214   Not tainted  (4.5.0-rc1-Sam460ex)
[   42.739395] MSR: 0002d000   CR: 28004262  XER: 
[   42.746244]
GPR00: 1f396134 bfcb0970 b77fc6f0 b6fbeffc b67d5008 0780 0004

GPR08:  b6fbeffc  bfcb0920 1fed2404 2076dff4 
0780
GPR16:  0020   1e00 209be650 0438
b67d5008
GPR24: 0780 bfcb09c8 209a8728 b6fbf000 b6fbf000 b67d5008 1ffdaff4
1e00
[   42.778096] NIP [1fed2480] 0x1fed2480
[   42.781967] LR [1fed2404] 0x1fed2404
[   42.785741] Call Trace:
[   42.943688] ---[ end trace 5d20a91d2d30d9d6 ]---
[   42.948311]
[   46.641774] Machine check in kernel mode.
[   46.645805] Data Write PLB Error
[   46.649031] Machine Check exception is imprecise
[   46.653658] Vector: 214  at [eccfbf10]
[   46.657408] pc: 1ffa9480
[   46.660325] lr: 1ffa9404
[   46.663241] sp: bf9252b0
[   46.666123]msr: 2d000
[   46.668746]   current = 0xee1e73c0
[   46.672149] pid   = 663, comm = Xorg
[   46.676074] Linux version 4.5.0-rc1-Sam460ex (root@julian-VirtualBox)

Ok, I think the patch is still needed for the issue Tomi reported,
this appears to be a separate bug.

Can you send me your kernel config?




#
# Automatically generated file; DO NOT EDIT.
# Linux/powerpc 4.5.0-rc1 Kernel Configuration
#
# CONFIG_PPC64 is not set

#
# Processor support
#
# CONFIG_PPC_BOOK3S_32 is not set
# CONFIG_PPC_85xx is not set
# CONFIG_PPC_8xx is not set
# CONFIG_40x is not set
CONFIG_44x=y
# CONFIG_E200 is not set
CONFIG_PPC_FPU=y
CONFIG_4xx=y
CONFIG_BOOKE=y
CONFIG_PTE_64BIT=y
CONFIG_PHYS_64BIT=y
CONFIG_PPC_MMU_NOHASH=y
# CONFIG_PPC_MM_SLICES is not set
CONFIG_NOT_COHERENT_CACHE=y
# CONFIG_PPC_DOORBELL is not set
CONFIG_VDSO32=y
CONFIG_CPU_BIG_ENDIAN=y
CONFIG_PPC32=y
CONFIG_32BIT=y
CONFIG_WORD_SIZE=32
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_MMU=y
# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
CONFIG_NR_IRQS=512
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
CONFIG_PPC=y
# CONFIG_GENERIC_CSUM is not set
CONFIG_EARLY_PRINTK=y
CONFIG_PANIC_TIMEOUT=180
CONFIG_GENERIC_NVRAM=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_UDBG_16550=y
# CONFIG_GENERIC_TBSYNC is not set
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_EPAPR_BOOT is not set
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_PPC_DCR_NATIVE=y
# CONFIG_PPC_DCR_MMIO is not set
CONFIG_PPC_DCR=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_PPC_ADV_DEBUG_REGS=y
CONFIG_PPC_ADV_DEBUG_IACS=4
CONFIG_PPC_ADV_DEBUG_DACS=2
CONFIG_PPC_ADV_DEBUG_DVCS=2
CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y
CONFIG_PPC_EMULATE_SSTEP=y
CONFIG_PGTABLE_LEVE

Re: [PATCH] mm: fix pfn_t to page conversion in vm_insert_mixed

2016-01-26 Thread Julian Margetson

On 1/26/2016 4:34 PM, Dan Williams wrote:

On Tue, Jan 26, 2016 at 11:46 AM, Julian Margetson <runa...@candw.ms> wrote:

On 1/26/2016 2:37 PM, Dan Williams wrote:

pfn_t_to_page() honors the flags in the pfn_t value to determine if a
pfn is backed by a page.  However, vm_insert_mixed() was originally
written to use pfn_valid() to make this determination.  To restore the
old/correct behavior, ignore the pfn_t flags in the !pfn_t_devmap() case
and fallback to trusting pfn_valid().

Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
Cc: Dave Hansen <d...@sr71.net>
Cc: David Airlie <airl...@linux.ie>
Reported-by: Julian Margetson <runa...@candw.ms>
Reported-by: Tomi Valkeinen <tomi.valkei...@ti.com>
Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
---
  mm/memory.c |9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 30991f83d0bf..93ce37989471 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1591,10 +1591,15 @@ int vm_insert_mixed(struct vm_area_struct *vma,
unsigned long addr,
   * than insert_pfn).  If a zero_pfn were inserted into a VM_MIXEDMAP
   * without pte special, it would there be refcounted as a normal page.
   */
- if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) {
+ if (!HAVE_PTE_SPECIAL && !pfn_t_devmap(pfn) && pfn_t_valid(pfn)) {
   struct page *page;

- page = pfn_t_to_page(pfn);
+ /*
+ * At this point we are committed to insert_page()
+ * regardless of whether the caller specified flags that
+ * result in pfn_t_has_page() == false.
+ */
+ page = pfn_to_page(pfn_t_to_pfn(pfn));
   return insert_page(vma, addr, page, vma->vm_page_prot);
   }
   return insert_pfn(vma, addr, pfn, vma->vm_page_prot);



[   16.503323] systemd[1]: Mounting FUSE Control File System...
[   42.703092] Oops: Machine check, sig: 7 [#1]
[   42.707624] PREEMPT Canyonlands
[   42.710959] Modules linked in:
[   42.714201] CPU: 0 PID: 553 Comm: Xorg Not tainted 4.5.0-rc1-Sam460ex #1
[   42.721283] task: ee1e45c0 ti: ecd46000 task.ti: ecd46000
[   42.726983] NIP: 1fed2480 LR: 1fed2404 CTR: 1fed24d0
[   42.732227] REGS: ecd47f10 TRAP: 0214   Not tainted  (4.5.0-rc1-Sam460ex)
[   42.739395] MSR: 0002d000 <CE,EE,PR,ME>  CR: 28004262  XER: 
[   42.746244]
GPR00: 1f396134 bfcb0970 b77fc6f0 b6fbeffc b67d5008 0780 0004

GPR08:  b6fbeffc  bfcb0920 1fed2404 2076dff4 
0780
GPR16:  0020   1e00 209be650 0438
b67d5008
GPR24: 0780 bfcb09c8 209a8728 b6fbf000 b6fbf000 b67d5008 1ffdaff4
1e00
[   42.778096] NIP [1fed2480] 0x1fed2480
[   42.781967] LR [1fed2404] 0x1fed2404
[   42.785741] Call Trace:
[   42.943688] ---[ end trace 5d20a91d2d30d9d6 ]---
[   42.948311]
[   46.641774] Machine check in kernel mode.
[   46.645805] Data Write PLB Error
[   46.649031] Machine Check exception is imprecise
[   46.653658] Vector: 214  at [eccfbf10]
[   46.657408] pc: 1ffa9480
[   46.660325] lr: 1ffa9404
[   46.663241] sp: bf9252b0
[   46.666123]msr: 2d000
[   46.668746]   current = 0xee1e73c0
[   46.672149] pid   = 663, comm = Xorg
[   46.676074] Linux version 4.5.0-rc1-Sam460ex (root@julian-VirtualBox)

Ok, I think the patch is still needed for the issue Tomi reported,
this appears to be a separate bug.

Can you send me your kernel config?




#
# Automatically generated file; DO NOT EDIT.
# Linux/powerpc 4.5.0-rc1 Kernel Configuration
#
# CONFIG_PPC64 is not set

#
# Processor support
#
# CONFIG_PPC_BOOK3S_32 is not set
# CONFIG_PPC_85xx is not set
# CONFIG_PPC_8xx is not set
# CONFIG_40x is not set
CONFIG_44x=y
# CONFIG_E200 is not set
CONFIG_PPC_FPU=y
CONFIG_4xx=y
CONFIG_BOOKE=y
CONFIG_PTE_64BIT=y
CONFIG_PHYS_64BIT=y
CONFIG_PPC_MMU_NOHASH=y
# CONFIG_PPC_MM_SLICES is not set
CONFIG_NOT_COHERENT_CACHE=y
# CONFIG_PPC_DOORBELL is not set
CONFIG_VDSO32=y
CONFIG_CPU_BIG_ENDIAN=y
CONFIG_PPC32=y
CONFIG_32BIT=y
CONFIG_WORD_SIZE=32
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_MMU=y
# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
CONFIG_NR_IRQS=512
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
CONFIG_PPC=y
# CONFIG_GENERIC_CSUM is not set
CONFIG_EARLY_PRINTK=y
CONFIG_PANIC_TIMEOUT=180
CONFIG_GENERIC_NVRAM=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_UDBG_16550=y
# CONFIG_GENERIC_TBSYNC is not set
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_EPAPR_BOOT is not set
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_PPC_DCR_NATIVE=y
# CONFIG_PPC_DCR_MMIO is not set
CONFIG_PPC_DCR=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
C

Re: [PATCH] ata: sata_dwc_460ex: remove incorrect locking

2015-12-21 Thread Julian Margetson

On 12/21/2015 4:41 PM, Andy Shevchenko wrote:

On Mon, 2015-12-21 at 18:17 +, Mans Rullgard wrote:

This lock is already taken in ata_scsi_queuecmd() a few levels up the
call stack so attempting to take it here is an error.  Moreover, it
is
pointless in the first place since it only protects a single, atomic
assignment.

Enabling lock debugging gives the following output:


+Julian.

I think Julian may give his Tested-by: tag.


=
[ INFO: possible recursive locking detected ]
4.4.0-rc5+ #189 Not tainted
-
kworker/u2:3/37 is trying to acquire lock:
  (&(>lock)->rlock){-.-...}, at: [<90283294>]
sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c

but task is already holding lock:
  (&(>lock)->rlock){-.-...}, at: [<902761ac>]
ata_scsi_queuecmd+0x2c/0x330

other info that might help us debug this:
  Possible unsafe locking scenario:

CPU0

   lock(&(>lock)->rlock);
   lock(&(>lock)->rlock);

  *** DEADLOCK ***
  May be due to missing lock nesting notation

4 locks held by kworker/u2:3/37:
  #0:  ("events_unbound"){.+.+.+}, at: [<9003a0a4>]
process_one_work+0x12c/0x430
  #1:  ((>work)){+.+.+.}, at: [<9003a0a4>]
process_one_work+0x12c/0x430
  #2:  (>bd_mutex){+.+.+.}, at: [<9011fd54>]
__blkdev_get+0x50/0x380
  #3:  (&(>lock)->rlock){-.-...}, at: [<902761ac>]
ata_scsi_queuecmd+0x2c/0x330

stack backtrace:
CPU: 0 PID: 37 Comm: kworker/u2:3 Not tainted 4.4.0-rc5+ #189
Workqueue: events_unbound async_run_entry_fn
Stack : 90b38e30 0021 0003 9b2a6040  9005f3f0
904fc8dc 0025
 906b96e4  90528648 9b3336c4 904fc8dc 9009bf18
0002 0004
   9b3336c4 9b3336e4 904fc8dc 9003d074
 9050
 9005e738     
 
 6e657665 755f7374 756f626e 646e  
9b00ca00 9b025000
   ...
Call Trace:
[<90009d6c>] show_stack+0x88/0xa4
[<90057744>] __lock_acquire+0x1ce8/0x2154
[<900583e4>] lock_acquire+0x64/0x8c
[<9045ff10>] _raw_spin_lock_irqsave+0x54/0x78
[<90283294>] sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c
[<90283484>] sata_dwc_qc_issue+0x1a8/0x24c
[<9026b39c>] ata_qc_issue+0x1f0/0x410
[<90273c6c>] ata_scsi_translate+0xb4/0x200
[<90276234>] ata_scsi_queuecmd+0xb4/0x330
[<9025800c>] scsi_dispatch_cmd+0xd0/0x128
[<90259934>] scsi_request_fn+0x58c/0x638
[<901a3e50>] __blk_run_queue+0x40/0x5c
[<901a83d4>] blk_queue_bio+0x27c/0x28c
[<901a5914>] generic_make_request+0xf0/0x188
[<901a5a54>] submit_bio+0xa8/0x194
[<9011adcc>] submit_bh_wbc.isra.23+0x15c/0x17c
[<9011c908>] block_read_full_page+0x3e4/0x428
[<9009e2e0>] do_read_cache_page+0xac/0x210
[<9009fd90>] read_cache_page+0x18/0x24
[<901bbd18>] read_dev_sector+0x38/0xb0
[<901bd174>] msdos_partition+0xb4/0x5c0
[<901bcb8c>] check_partition+0x140/0x274
[<901bba60>] rescan_partitions+0xa0/0x2b0
[<9011ff68>] __blkdev_get+0x264/0x380
[<901201ac>] blkdev_get+0x128/0x36c
[<901b9378>] add_disk+0x3c0/0x4bc
[<90268268>] sd_probe_async+0x100/0x224
[<90043a44>] async_run_entry_fn+0x50/0x124
[<9003a11c>] process_one_work+0x1a4/0x430
[<9003a4f4>] worker_thread+0x14c/0x4fc
[<900408f4>] kthread+0xd0/0xe8
[<90004338>] ret_from_kernel_thread+0x14/0x1c

Fixes: 62936009f35a ("[libata] Add 460EX on-chip SATA driver,
sata_dwc_460ex")
Signed-off-by: Mans Rullgard 
---
  drivers/ata/sata_dwc_460ex.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/sata_dwc_460ex.c
b/drivers/ata/sata_dwc_460ex.c
index 902034991517..7a7faca0ddcd 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -924,15 +924,13 @@ static void sata_dwc_exec_command_by_tag(struct
ata_port *ap,
 struct ata_taskfile *tf,
 u8 tag, u32 cmd_issued)
  {
-   unsigned long flags;
struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
  
  	dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__,

tf->command,
ata_get_cmd_descript(tf->command), tag);
  
-	spin_lock_irqsave(>host->lock, flags);

hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+
/*
 * Clear SError before executing a new command.
 * sata_dwc_scr_write and read can not be used here.
Clearing the PM


Tested-by: Julian Margetson 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 4:25 PM, Andy Shevchenko wrote:

On Mon, 2015-12-21 at 15:19 -0400, Julian Margetson wrote:

On 12/21/2015 2:27 PM, Måns Rullgård wrote:

The hard drive is recognized .

These system gets unresponsive with USB devices like the mouse
and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


It is working.

Indeed, thanks, Julian!

I might ask you to test my branch with set of patches when it will be
ready (apparently after Xmas) if you are okay with that.

Måns, also I would ask you to test on your hardware (AVR32) as well if
you have no objections.


I have no problem testing.

Regards
Julian


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 3:27 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/21/2015 2:27 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson  wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
 wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård 
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


It is working.

That's good news.  Thanks a lot for helping to test this.


No problem.
If you can influence anyone of the radeon guys to have a look at the 
ring test failure on the Sam460ex again,

I will  be happy to help test in that area as well .

http://lists.freedesktop.org/archives/dri-devel/2013-September/045050.html
https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-February/125060.html



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 2:27 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson  wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
 wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård 
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


It is working.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 2:27 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson  wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
 wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård 
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


Ah. Will try with debug disabled.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson  wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
 wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård 
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and 
keyboard not responding  when I start Gparted.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
 wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård 
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.


patch -p1 -R <../0001-dw_dmac-debug-dma-controller-IO.patch
patching file drivers/dma/dw/core.c
Hunk #1 succeeded at 543 (offset -27 lines).
Hunk #2 FAILED at 1571.
Hunk #3 FAILED at 1717.
2 out of 3 hunks FAILED -- saving rejects to file drivers/dma/dw/core.c.rej
patching file drivers/dma/dw/regs.h
Hunk #1 succeeded at 114 (offset -16 lines).
Hunk #2 succeeded at 262 (offset -39 lines).
Hunk #3 succeeded at 293 (offset -40 lines).
root@julian-VirtualBox:/usr/src/linux-test# patch -p1 
<../0001-dw_dmac-debug-dma-controller-IO.patch

patching file drivers/dma/dw/core.c
Hunk #1 succeeded at 543 (offset -27 lines).
Hunk #2 FAILED at 1572.
Hunk #3 FAILED at 1716.
2 out of 3 hunks FAILED -- saving rejects to file drivers/dma/dw/core.c.rej
patching file drivers/dma/dw/regs.h
Hunk #1 succeeded at 114 (offset -16 lines).
Hunk #2 succeeded at 264 (offset -39 lines).
Hunk #3 succeeded at 307 (offset -40 lines).


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 8:16 AM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/21/2015 4:40 AM, Andy Shevchenko wrote:

+Viresh

On Mon, Dec 21, 2015 at 2:58 AM, Måns Rullgård  wrote:

Andy Shevchenko  writes:


On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård  wrote:

Julian Margetson  writes:

On 12/20/2015 1:11 PM, Måns Rullgård wrote:

Julian Margetson  writes:

[   48.769671] ata3.00: failed command: READ FPDMA QUEUED

Well, that didn't help.  I still think it's part of the problem, but
something else must be wrong as well.  The various Master Select fields
look like a good place to start.

Master number (which is here would be either 1 or 0) should not affect
as long as they are connected to the same AHB bus (I would be
surprised if they are not).

I think they are not.  The relevant part of the block diagram for the
460EX looks something like this:

+-+
| CPU |
+-+
   |
   +---+
   |  BUS  |
   +---+
  | |
   +-+   +-+
   | DMA |   | RAM |
   +-+   +-+
  |
   +--+
   | SATA |
   +--+

The DMA-SATA link is private and ignores the address, which is the only
reason the driver can possibly work (it's programming a CPU virtual
address there).

If you look at the original code the SMS and DMS are programmed
statically independent on DMA direction, so LLP is programmed always
to master 1. I don't think your scheme is reflecting this right. I
could imagine two AHB buses, one of them connects CPU, SATA and RAM,
and the other CPU and DMA.

In any case on all Intel SoCs and AVR32, and as far as I can tell on
Spear13xx (Viresh?) there is not a case, that's why I hardly imagine
that the problem is in master numbers by themselves.


Also, the manual says the LLP_SRC_EN
and LLP_DST_EN flags should be cleared on the last in a chain of blocks.
The old sata_dwc driver does this whereas dw_dma does not.

Easy to fix, however I can't get how it might affect.

  From the Atmel doc:

In Table 17-1 on page 185, all other combinations of LLPx.LOC = 0,
CTLx.LLP_S_EN, CFGx.RELOAD_SR, CTLx.LLP_D_EN, and CFGx.RELOAD_DS are
illegal, and causes indeterminate or erroneous behavior.

I will check Synospys documentation later on.


Most likely nothing happens, but I think it ought to be fixed.  In fact,
I have a patch already.

Good. Send with Fixes tag if it's upstream ready.


Come to think of it, I have an AVR32 dev somewhere.  Maybe I should dust
it off.

I have ATNGW100.

P.S. Anyway we have to ask Julian to try the kernel with
8b3444852a2b58129 reverted.


git revert 8b3444852a2b58129
error: could not revert 8b34448... sata_dwc_460ex: move to generic DMA driver
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

Yeah, that won't work since there are numerous changes afterward.  Just
revert the entire file back to 4.0 like this:

$ git checkout v4.0 drivers/ata/sata_dwc_460ex.c


 CC [M]  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:467:36: error: macro "dma_request_channel" 
requires 3 arguments, but only 1 given

 static int dma_request_channel(void)
^
drivers/ata/sata_dwc_460ex.c:468:1: error: expected ‘=’, ‘,’, 
‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

 {
 ^
drivers/ata/sata_dwc_460ex.c: In function ‘dma_dwc_xfer_setup’:
drivers/ata/sata_dwc_460ex.c:758:31: error: macro "dma_request_channel" 
requires 3 arguments, but only 1 given

  dma_ch = dma_request_channel();
   ^
drivers/ata/sata_dwc_460ex.c:758:11: error: ‘dma_request_channel’ 
undeclared (first use in this function)

  dma_ch = dma_request_channel();
   ^
drivers/ata/sata_dwc_460ex.c:758:11: note: each undeclared identifier is 
reported only once for each function it appears in

drivers/ata/sata_dwc_460ex.c: In function ‘sata_dwc_dma_filter’:
drivers/ata/sata_dwc_460ex.c:1282:35: error: ‘struct 
sata_dwc_device_port’ has no member named ‘dws’

  struct dw_dma_slave *dws = hsdevp->dws;
   ^
drivers/ata/sata_dwc_460ex.c: In function ‘sata_dwc_port_start’:
drivers/ata/sata_dwc_460ex.c:1325:17: warning: unused variable 
‘mask’ [-Wunused-variable]

  dma_cap_mask_t mask;
 ^
drivers/ata/sata_dwc_460ex.c: At top level:
drivers/ata/sata_dwc_460ex.c:345:28: warning: ‘sata_dwc_dma_dws’ 
defined but not used [-Wunused-variable]

 static struct dw_dma_slave sata_dwc_dma_dws = {
^
drivers/ata/sata_dwc_460ex.c:1279:13: warning: ‘sata_dwc_dma_filter’ 
defined but not used [-Wunused-function]

 static bool sata_dwc_dma_filter(struct dma_chan *chan, void *param)
 ^
make[2]: *** [drivers/ata/sata_dwc_460ex.o] Error 1
make[1]: *** [drivers/ata] Error 2
make: *** [drivers] Error 2
make: *** Wait

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 3:27 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/21/2015 2:27 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson <runa...@candw.ms> wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
<andy.shevche...@gmail.com> wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård <m...@mansr.com>
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


It is working.

That's good news.  Thanks a lot for helping to test this.


No problem.
If you can influence anyone of the radeon guys to have a look at the 
ring test failure on the Sam460ex again,

I will  be happy to help test in that area as well .

http://lists.freedesktop.org/archives/dri-devel/2013-September/045050.html
https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-February/125060.html



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson <runa...@candw.ms> wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
<andy.shevche...@gmail.com> wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård <m...@mansr.com>
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and 
keyboard not responding  when I start Gparted.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 2:27 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson <runa...@candw.ms> wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
<andy.shevche...@gmail.com> wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård <m...@mansr.com>
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


It is working.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 2:27 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/21/2015 1:55 PM, Andy Shevchenko wrote:

On Mon, Dec 21, 2015 at 7:26 PM, Julian Margetson <runa...@candw.ms> wrote:

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
<andy.shevche...@gmail.com> wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård <m...@mansr.com>
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.

So, the original driver (with patch from Måns) works, right?


The hard drive is recognized .
These system gets unresponsive with USB devices like the mouse and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


Ah. Will try with debug disabled.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 4:25 PM, Andy Shevchenko wrote:

On Mon, 2015-12-21 at 15:19 -0400, Julian Margetson wrote:

On 12/21/2015 2:27 PM, Måns Rullgård wrote:

The hard drive is recognized .

These system gets unresponsive with USB devices like the mouse
and
keyboard not responding  when I start Gparted.

Did you disable the SATA and DMA debug messages?


It is working.

Indeed, thanks, Julian!

I might ask you to test my branch with set of patches when it will be
ready (apparently after Xmas) if you are okay with that.

Måns, also I would ask you to test on your hardware (AVR32) as well if
you have no objections.


I have no problem testing.

Regards
Julian


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ata: sata_dwc_460ex: remove incorrect locking

2015-12-21 Thread Julian Margetson

On 12/21/2015 4:41 PM, Andy Shevchenko wrote:

On Mon, 2015-12-21 at 18:17 +, Mans Rullgard wrote:

This lock is already taken in ata_scsi_queuecmd() a few levels up the
call stack so attempting to take it here is an error.  Moreover, it
is
pointless in the first place since it only protects a single, atomic
assignment.

Enabling lock debugging gives the following output:


+Julian.

I think Julian may give his Tested-by: tag.


=
[ INFO: possible recursive locking detected ]
4.4.0-rc5+ #189 Not tainted
-
kworker/u2:3/37 is trying to acquire lock:
  (&(>lock)->rlock){-.-...}, at: [<90283294>]
sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c

but task is already holding lock:
  (&(>lock)->rlock){-.-...}, at: [<902761ac>]
ata_scsi_queuecmd+0x2c/0x330

other info that might help us debug this:
  Possible unsafe locking scenario:

CPU0

   lock(&(>lock)->rlock);
   lock(&(>lock)->rlock);

  *** DEADLOCK ***
  May be due to missing lock nesting notation

4 locks held by kworker/u2:3/37:
  #0:  ("events_unbound"){.+.+.+}, at: [<9003a0a4>]
process_one_work+0x12c/0x430
  #1:  ((>work)){+.+.+.}, at: [<9003a0a4>]
process_one_work+0x12c/0x430
  #2:  (>bd_mutex){+.+.+.}, at: [<9011fd54>]
__blkdev_get+0x50/0x380
  #3:  (&(>lock)->rlock){-.-...}, at: [<902761ac>]
ata_scsi_queuecmd+0x2c/0x330

stack backtrace:
CPU: 0 PID: 37 Comm: kworker/u2:3 Not tainted 4.4.0-rc5+ #189
Workqueue: events_unbound async_run_entry_fn
Stack : 90b38e30 0021 0003 9b2a6040  9005f3f0
904fc8dc 0025
 906b96e4  90528648 9b3336c4 904fc8dc 9009bf18
0002 0004
   9b3336c4 9b3336e4 904fc8dc 9003d074
 9050
 9005e738     
 
 6e657665 755f7374 756f626e 646e  
9b00ca00 9b025000
   ...
Call Trace:
[<90009d6c>] show_stack+0x88/0xa4
[<90057744>] __lock_acquire+0x1ce8/0x2154
[<900583e4>] lock_acquire+0x64/0x8c
[<9045ff10>] _raw_spin_lock_irqsave+0x54/0x78
[<90283294>] sata_dwc_exec_command_by_tag.constprop.14+0x44/0x8c
[<90283484>] sata_dwc_qc_issue+0x1a8/0x24c
[<9026b39c>] ata_qc_issue+0x1f0/0x410
[<90273c6c>] ata_scsi_translate+0xb4/0x200
[<90276234>] ata_scsi_queuecmd+0xb4/0x330
[<9025800c>] scsi_dispatch_cmd+0xd0/0x128
[<90259934>] scsi_request_fn+0x58c/0x638
[<901a3e50>] __blk_run_queue+0x40/0x5c
[<901a83d4>] blk_queue_bio+0x27c/0x28c
[<901a5914>] generic_make_request+0xf0/0x188
[<901a5a54>] submit_bio+0xa8/0x194
[<9011adcc>] submit_bh_wbc.isra.23+0x15c/0x17c
[<9011c908>] block_read_full_page+0x3e4/0x428
[<9009e2e0>] do_read_cache_page+0xac/0x210
[<9009fd90>] read_cache_page+0x18/0x24
[<901bbd18>] read_dev_sector+0x38/0xb0
[<901bd174>] msdos_partition+0xb4/0x5c0
[<901bcb8c>] check_partition+0x140/0x274
[<901bba60>] rescan_partitions+0xa0/0x2b0
[<9011ff68>] __blkdev_get+0x264/0x380
[<901201ac>] blkdev_get+0x128/0x36c
[<901b9378>] add_disk+0x3c0/0x4bc
[<90268268>] sd_probe_async+0x100/0x224
[<90043a44>] async_run_entry_fn+0x50/0x124
[<9003a11c>] process_one_work+0x1a4/0x430
[<9003a4f4>] worker_thread+0x14c/0x4fc
[<900408f4>] kthread+0xd0/0xe8
[<90004338>] ret_from_kernel_thread+0x14/0x1c

Fixes: 62936009f35a ("[libata] Add 460EX on-chip SATA driver,
sata_dwc_460ex")
Signed-off-by: Mans Rullgard <m...@mansr.com>
---
  drivers/ata/sata_dwc_460ex.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/sata_dwc_460ex.c
b/drivers/ata/sata_dwc_460ex.c
index 902034991517..7a7faca0ddcd 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -924,15 +924,13 @@ static void sata_dwc_exec_command_by_tag(struct
ata_port *ap,
 struct ata_taskfile *tf,
 u8 tag, u32 cmd_issued)
  {
-   unsigned long flags;
struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap);
  
  	dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__,

tf->command,
ata_get_cmd_descript(tf->command), tag);
  
-	spin_lock_irqsave(>host->lock, flags);

hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+
/*
 * Clear SError before executing a new command.
 * sata_dwc_scr_write and read can not be used here.
Clearing the PM


Tested-by: Julian Margetson <runa...@candw.ms>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 8:16 AM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/21/2015 4:40 AM, Andy Shevchenko wrote:

+Viresh

On Mon, Dec 21, 2015 at 2:58 AM, Måns Rullgård <m...@mansr.com> wrote:

Andy Shevchenko <andy.shevche...@gmail.com> writes:


On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård <m...@mansr.com> wrote:

Julian Margetson <runa...@candw.ms> writes:

On 12/20/2015 1:11 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:

[   48.769671] ata3.00: failed command: READ FPDMA QUEUED

Well, that didn't help.  I still think it's part of the problem, but
something else must be wrong as well.  The various Master Select fields
look like a good place to start.

Master number (which is here would be either 1 or 0) should not affect
as long as they are connected to the same AHB bus (I would be
surprised if they are not).

I think they are not.  The relevant part of the block diagram for the
460EX looks something like this:

+-+
| CPU |
+-+
   |
   +---+
   |  BUS  |
   +---+
  | |
   +-+   +-+
   | DMA |   | RAM |
   +-+   +-+
  |
   +--+
   | SATA |
   +--+

The DMA-SATA link is private and ignores the address, which is the only
reason the driver can possibly work (it's programming a CPU virtual
address there).

If you look at the original code the SMS and DMS are programmed
statically independent on DMA direction, so LLP is programmed always
to master 1. I don't think your scheme is reflecting this right. I
could imagine two AHB buses, one of them connects CPU, SATA and RAM,
and the other CPU and DMA.

In any case on all Intel SoCs and AVR32, and as far as I can tell on
Spear13xx (Viresh?) there is not a case, that's why I hardly imagine
that the problem is in master numbers by themselves.


Also, the manual says the LLP_SRC_EN
and LLP_DST_EN flags should be cleared on the last in a chain of blocks.
The old sata_dwc driver does this whereas dw_dma does not.

Easy to fix, however I can't get how it might affect.

  From the Atmel doc:

In Table 17-1 on page 185, all other combinations of LLPx.LOC = 0,
CTLx.LLP_S_EN, CFGx.RELOAD_SR, CTLx.LLP_D_EN, and CFGx.RELOAD_DS are
illegal, and causes indeterminate or erroneous behavior.

I will check Synospys documentation later on.


Most likely nothing happens, but I think it ought to be fixed.  In fact,
I have a patch already.

Good. Send with Fixes tag if it's upstream ready.


Come to think of it, I have an AVR32 dev somewhere.  Maybe I should dust
it off.

I have ATNGW100.

P.S. Anyway we have to ask Julian to try the kernel with
8b3444852a2b58129 reverted.


git revert 8b3444852a2b58129
error: could not revert 8b34448... sata_dwc_460ex: move to generic DMA driver
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

Yeah, that won't work since there are numerous changes afterward.  Just
revert the entire file back to 4.0 like this:

$ git checkout v4.0 drivers/ata/sata_dwc_460ex.c


 CC [M]  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:467:36: error: macro "dma_request_channel" 
requires 3 arguments, but only 1 given

 static int dma_request_channel(void)
^
drivers/ata/sata_dwc_460ex.c:468:1: error: expected ‘=’, ‘,’, 
‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

 {
 ^
drivers/ata/sata_dwc_460ex.c: In function ‘dma_dwc_xfer_setup’:
drivers/ata/sata_dwc_460ex.c:758:31: error: macro "dma_request_channel" 
requires 3 arguments, but only 1 given

  dma_ch = dma_request_channel();
   ^
drivers/ata/sata_dwc_460ex.c:758:11: error: ‘dma_request_channel’ 
undeclared (first use in this function)

  dma_ch = dma_request_channel();
   ^
drivers/ata/sata_dwc_460ex.c:758:11: note: each undeclared identifier is 
reported only once for each function it appears in

drivers/ata/sata_dwc_460ex.c: In function ‘sata_dwc_dma_filter’:
drivers/ata/sata_dwc_460ex.c:1282:35: error: ‘struct 
sata_dwc_device_port’ has no member named ‘dws’

  struct dw_dma_slave *dws = hsdevp->dws;
   ^
drivers/ata/sata_dwc_460ex.c: In function ‘sata_dwc_port_start’:
drivers/ata/sata_dwc_460ex.c:1325:17: warning: unused variable 
‘mask’ [-Wunused-variable]

  dma_cap_mask_t mask;
 ^
drivers/ata/sata_dwc_460ex.c: At top level:
drivers/ata/sata_dwc_460ex.c:345:28: warning: ‘sata_dwc_dma_dws’ 
defined but not used [-Wunused-variable]

 static struct dw_dma_slave sata_dwc_dma_dws = {
^
drivers/ata/sata_dwc_460ex.c:1279:13: warning: ‘sata_dwc_dma_filter’ 
defined but not used [-Wunused-function]

 static bool sata_dwc_dma_filter(struct dma_chan *chan, void *param)
 ^

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Julian Margetson

On 12/21/2015 12:48 PM, Andy Shevchenko wrote:

On Sun, 2015-12-20 at 22:55 +0200, Andy Shevchenko wrote:

On Sun, Dec 20, 2015 at 10:17 PM, Andy Shevchenko
 wrote:

On Sun, Dec 20, 2015 at 8:49 PM, Måns Rullgård 
wrote:
I noticed thanks to DWC_PARAMS that burst size is hardcoded to 32
items on this board, however registers for SATA program it to 64. I
remember that I got no interrupt when I programmed transfer width
wrongly (64 bits against 32 bits) when I ported dw_dmac to be used
on
Intel SoCs.

One more thing, I have a patch to monitor DMA IO, we may check what
exactly the values are written / read  in DMA. I can share it
tomorrow.

As promised the patch I have to debug IO of DW DMA. Didn't check though
if it applies cleanly on top of recent vanilla kernel.


patch -p1 -R <../0001-dw_dmac-debug-dma-controller-IO.patch
patching file drivers/dma/dw/core.c
Hunk #1 succeeded at 543 (offset -27 lines).
Hunk #2 FAILED at 1571.
Hunk #3 FAILED at 1717.
2 out of 3 hunks FAILED -- saving rejects to file drivers/dma/dw/core.c.rej
patching file drivers/dma/dw/regs.h
Hunk #1 succeeded at 114 (offset -16 lines).
Hunk #2 succeeded at 262 (offset -39 lines).
Hunk #3 succeeded at 293 (offset -40 lines).
root@julian-VirtualBox:/usr/src/linux-test# patch -p1 
<../0001-dw_dmac-debug-dma-controller-IO.patch

patching file drivers/dma/dw/core.c
Hunk #1 succeeded at 543 (offset -27 lines).
Hunk #2 FAILED at 1572.
Hunk #3 FAILED at 1716.
2 out of 3 hunks FAILED -- saving rejects to file drivers/dma/dw/core.c.rej
patching file drivers/dma/dw/regs.h
Hunk #1 succeeded at 114 (offset -16 lines).
Hunk #2 succeeded at 264 (offset -39 lines).
Hunk #3 succeeded at 307 (offset -40 lines).


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 4:41 PM, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Sat, Dec 19, 2015 at 10:16 PM, Julian Margetson  wrote:

On 12/19/2015 3:07 PM, Måns Rullgård wrote:

Julian Margetson  writes:

Total pages: 522752
[0.00] Kernel command line: root=/dev/sda8 console=ttyS0,115200
console=tty1 dw_dmac_core.dyndbg dw_dmac.dyndbg

Please add ignore_log_level.


Had to truncate the kernel command line to add it.

I guess Måns meant 'ignore_loglevel'

Obviously.  I can never remember where the underscores go.


:-)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 3:07 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/19/2015 1:19 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/19/2015 1:05 PM, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Sat, Dec 19, 2015 at 5:40 PM, Måns Rullgård  wrote:


OK, I've found something.  The dma setup errors are benign, caused by
the driver calling dmaengine_prep_slave_sg() even for non-dma
operations.

I suppose the following is a quick fix to avoid preparing descriptor
for non-DMA operations (not tested anyhow)

a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1041,6 +1041,9 @@ static void sata_dwc_qc_prep_by_tag(struct
ata_queued_cmd *qc, u8 tag)
   __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
qc->n_elem);

+   if (!is_slave_direction(qc->dma_dir))
+   return;
+
   desc = dma_dwc_xfer_setup(qc);
   if (!desc) {
   dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",

I already have a better patch sitting here.


The real error is the lock recursion that's reported
later.  I wasn't seeing it since I was running a UP non-preempt kernel.
With lock debugging enabled, I get the same error.  This patch should
fix it.
-   spin_lock_irqsave(>host->lock, flags);
   hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+

This will create a second empty line, though I don't care it is so minor.

The patch leaves one blank line before the following block comment.  I
think it looks better that way.


Still can't get the patch applied .

Sorry, didn't realise it conflicted with an intervening patch I had in
my tree.  Try this one.



=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.12.19 14:44:52 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot 2015.a (May 16 2015 - 14:20:11)

CPU:   AMCC PowerPC 460EX Rev. B at 1155 MHz (PLB=231 OPB=115 EBC=115)
No Security/Kasumi support
Bootstrap Option H - Boot ROM Location I2C (Addr 0x52)
Internal PCI arbiter enabled
32 kB I-Cache 32 kB D-Cache
Board: Sam460ex/cr, PCIe 4x + SATA-2
I2C:   ready
DRAM:  2 GiB (ECC not enabled, 462 MHz, CL4)
PCI:   Bus Dev VenId DevId Class Int
 00  04  1095  3512  0104  00
 00  06  126f  0501  0380  00
PCIE1: successfully set as root-complex
 02  00  1002  683f  0300  ff
Net:   ppc_4xx_eth0
FPGA:  Revision 03 (2010-10-07)
SM502: found
PERMD2:not found
VGA:   1
VESA:  OK
[0.00] Using Canyonlands machine description
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.0-rc5-Sam460ex (root@julian-VirtualBox) (gcc 
version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Sat Dec 19 14:25:55 AST 2015
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [mem 0x-0x7fff]
[0.00] MMU: Allocated 1088 bytes of context maps for 255 contexts
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 522752
[0.00] Kernel command line: root=/dev/sda8 console=ttyS0,115200 
console=tty1 dw_dmac_core.dyndbg dw_dmac.dyndbg

Please add ignore_log_level.


Had to truncate the kernel command line to add it.
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.12.19 15:59:55 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot 2015.a (May 16 2015 - 14:20:11)

CPU:   AMCC PowerPC 460EX Rev. B at 1155 MHz (PLB=231 OPB=115 EBC=115)
   No Security/Kasumi support
   Bootstrap Option H - Boot ROM Location I2C (Addr 0x52)
   Internal PCI arbiter enabled
   32 kB I-Cache 32 kB D-Cache
Board: Sam460ex/cr, PCIe 4x + SATA-2
I2C:   ready
DRAM:  2 GiB (ECC not enabled, 462 MHz, CL4)
PCI:   Bus Dev VenId DevId Class Int
00  04  1095  3512  0104  00
00  06  126f  0501  0380  00
PCIE1: successfully set as root-complex
02  00  1002  683f  0300  ff
Net:   ppc_4xx_eth0
FPGA:  Revision 03 (2010-10-07)
SM502: found
PERMD2:not found
VGA:   1
VESA:  OK
[0.00] Using Canyonlands machine description
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.0-rc5-Sam460ex (root@julian-VirtualBox) (gcc 
version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Sat Dec 19 14:25:55 AST 2015
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [m

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 1:19 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/19/2015 1:05 PM, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Sat, Dec 19, 2015 at 5:40 PM, Måns Rullgård  wrote:


OK, I've found something.  The dma setup errors are benign, caused by
the driver calling dmaengine_prep_slave_sg() even for non-dma
operations.

I suppose the following is a quick fix to avoid preparing descriptor
for non-DMA operations (not tested anyhow)

a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1041,6 +1041,9 @@ static void sata_dwc_qc_prep_by_tag(struct
ata_queued_cmd *qc, u8 tag)
  __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
   qc->n_elem);

+   if (!is_slave_direction(qc->dma_dir))
+   return;
+
  desc = dma_dwc_xfer_setup(qc);
  if (!desc) {
  dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",

I already have a better patch sitting here.


The real error is the lock recursion that's reported
later.  I wasn't seeing it since I was running a UP non-preempt kernel.
With lock debugging enabled, I get the same error.  This patch should
fix it.
-   spin_lock_irqsave(>host->lock, flags);
  hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+

This will create a second empty line, though I don't care it is so minor.

The patch leaves one blank line before the following block comment.  I
think it looks better that way.


Still can't get the patch applied .

Sorry, didn't realise it conflicted with an intervening patch I had in
my tree.  Try this one.



=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.12.19 14:44:52 =~=~=~=~=~=~=~=~=~=~=~=


U-Boot 2015.a (May 16 2015 - 14:20:11)

CPU:   AMCC PowerPC 460EX Rev. B at 1155 MHz (PLB=231 OPB=115 EBC=115)
   No Security/Kasumi support
   Bootstrap Option H - Boot ROM Location I2C (Addr 0x52)
   Internal PCI arbiter enabled
   32 kB I-Cache 32 kB D-Cache
Board: Sam460ex/cr, PCIe 4x + SATA-2
I2C:   ready
DRAM:  2 GiB (ECC not enabled, 462 MHz, CL4)
PCI:   Bus Dev VenId DevId Class Int
00  04  1095  3512  0104  00
00  06  126f  0501  0380  00
PCIE1: successfully set as root-complex
02  00  1002  683f  0300  ff
Net:   ppc_4xx_eth0
FPGA:  Revision 03 (2010-10-07)
SM502: found
PERMD2:not found
VGA:   1
VESA:  OK
[0.00] Using Canyonlands machine description
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.0-rc5-Sam460ex (root@julian-VirtualBox) (gcc 
version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Sat Dec 19 14:25:55 AST 2015
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [mem 0x-0x7fff]
[0.00] MMU: Allocated 1088 bytes of context maps for 255 contexts
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 522752
[0.00] Kernel command line: root=/dev/sda8 console=ttyS0,115200 
console=tty1 dw_dmac_core.dyndbg dw_dmac.dyndbg
[0.00] PID hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Sorting __ex_table...
[0.00] Memory: 2068868K/2097152K available (6732K kernel code, 332K 
rwdata, 3232K rodata, 236K init, 368K bss, 28284K reserved, 0K cma-reserved, 
1310720K highmem)
[0.00] Kernel virtual memory layout:
[0.00]   * 0xfffcf000..0xf000  : fixmap
[0.00]   * 0xffc0..0xffe0  : highmem PTEs
[0.00]   * 0xffa0..0xffc0  : consistent mem
[0.00]   * 0xffa0..0xffa0  : early ioremap
[0.00]   * 0xf100..0xffa0  : vmalloc & ioremap
[0.00] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[0.00] Preemptible hierarchical RCU implementation.
[0.00] Build-time adjustment of leaf fanout to 32.
[0.00] NR_IRQS:512 nr_irqs:512 16
[0.00] UIC0 (32 IRQ sources) at DCR 0xc0
[0.00] UIC1 (32 IRQ sources) at DCR 0xd0
[0.00] UIC2 (32 IRQ sources) at DCR 0xe0
[0.00] UIC3 (32 IRQ sources) at DCR 0xf0
[0.13] clocksource: timebase: mask: 0x max_cycles: 
0x10a60dda894, max_idle_ns: 440795207041 ns
[0.23] clocksource: timebase mult[dda520] shift[24] registered
[0.000144] Console: colour dummy device 80x25
[0.000712] console [tty1] enabled
[0.000749] pid_max: default: 32768 minimum: 301
[0.000859] Mount-cache ha

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 1:05 PM, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Sat, Dec 19, 2015 at 5:40 PM, Måns Rullgård  wrote:


OK, I've found something.  The dma setup errors are benign, caused by
the driver calling dmaengine_prep_slave_sg() even for non-dma
operations.

I suppose the following is a quick fix to avoid preparing descriptor
for non-DMA operations (not tested anyhow)

a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1041,6 +1041,9 @@ static void sata_dwc_qc_prep_by_tag(struct
ata_queued_cmd *qc, u8 tag)
 __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
  qc->n_elem);

+   if (!is_slave_direction(qc->dma_dir))
+   return;
+
 desc = dma_dwc_xfer_setup(qc);
 if (!desc) {
 dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",

I already have a better patch sitting here.


The real error is the lock recursion that's reported
later.  I wasn't seeing it since I was running a UP non-preempt kernel.
With lock debugging enabled, I get the same error.  This patch should
fix it.
-   spin_lock_irqsave(>host->lock, flags);
 hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+

This will create a second empty line, though I don't care it is so minor.

The patch leaves one blank line before the following block comment.  I
think it looks better that way.



Still can't get the patch applied .

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 1:05 PM, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Sat, Dec 19, 2015 at 5:40 PM, Måns Rullgård  wrote:


OK, I've found something.  The dma setup errors are benign, caused by
the driver calling dmaengine_prep_slave_sg() even for non-dma
operations.

I suppose the following is a quick fix to avoid preparing descriptor
for non-DMA operations (not tested anyhow)

a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1041,6 +1041,9 @@ static void sata_dwc_qc_prep_by_tag(struct
ata_queued_cmd *qc, u8 tag)
 __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
  qc->n_elem);

+   if (!is_slave_direction(qc->dma_dir))
+   return;
+
 desc = dma_dwc_xfer_setup(qc);
 if (!desc) {
 dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",

I already have a better patch sitting here.


The real error is the lock recursion that's reported
later.  I wasn't seeing it since I was running a UP non-preempt kernel.
With lock debugging enabled, I get the same error.  This patch should
fix it.
-   spin_lock_irqsave(>host->lock, flags);
 hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+

This will create a second empty line, though I don't care it is so minor.

The patch leaves one blank line before the following block comment.  I
think it looks better that way.



Still can't get the patch applied .

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 1:19 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/19/2015 1:05 PM, Måns Rullgård wrote:

Andy Shevchenko <andy.shevche...@gmail.com> writes:


On Sat, Dec 19, 2015 at 5:40 PM, Måns Rullgård <m...@mansr.com> wrote:


OK, I've found something.  The dma setup errors are benign, caused by
the driver calling dmaengine_prep_slave_sg() even for non-dma
operations.

I suppose the following is a quick fix to avoid preparing descriptor
for non-DMA operations (not tested anyhow)

a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1041,6 +1041,9 @@ static void sata_dwc_qc_prep_by_tag(struct
ata_queued_cmd *qc, u8 tag)
  __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
   qc->n_elem);

+   if (!is_slave_direction(qc->dma_dir))
+   return;
+
  desc = dma_dwc_xfer_setup(qc);
  if (!desc) {
  dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",

I already have a better patch sitting here.


The real error is the lock recursion that's reported
later.  I wasn't seeing it since I was running a UP non-preempt kernel.
With lock debugging enabled, I get the same error.  This patch should
fix it.
-   spin_lock_irqsave(>host->lock, flags);
  hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+

This will create a second empty line, though I don't care it is so minor.

The patch leaves one blank line before the following block comment.  I
think it looks better that way.


Still can't get the patch applied .

Sorry, didn't realise it conflicted with an intervening patch I had in
my tree.  Try this one.



=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.12.19 14:44:52 =~=~=~=~=~=~=~=~=~=~=~=


U-Boot 2015.a (May 16 2015 - 14:20:11)

CPU:   AMCC PowerPC 460EX Rev. B at 1155 MHz (PLB=231 OPB=115 EBC=115)
   No Security/Kasumi support
   Bootstrap Option H - Boot ROM Location I2C (Addr 0x52)
   Internal PCI arbiter enabled
   32 kB I-Cache 32 kB D-Cache
Board: Sam460ex/cr, PCIe 4x + SATA-2
I2C:   ready
DRAM:  2 GiB (ECC not enabled, 462 MHz, CL4)
PCI:   Bus Dev VenId DevId Class Int
00  04  1095  3512  0104  00
00  06  126f  0501  0380  00
PCIE1: successfully set as root-complex
02  00  1002  683f  0300  ff
Net:   ppc_4xx_eth0
FPGA:  Revision 03 (2010-10-07)
SM502: found
PERMD2:not found
VGA:   1
VESA:  OK
[0.00] Using Canyonlands machine description
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.0-rc5-Sam460ex (root@julian-VirtualBox) (gcc 
version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Sat Dec 19 14:25:55 AST 2015
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [mem 0x-0x7fff]
[0.00] MMU: Allocated 1088 bytes of context maps for 255 contexts
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 522752
[0.00] Kernel command line: root=/dev/sda8 console=ttyS0,115200 
console=tty1 dw_dmac_core.dyndbg dw_dmac.dyndbg
[0.00] PID hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Sorting __ex_table...
[0.00] Memory: 2068868K/2097152K available (6732K kernel code, 332K 
rwdata, 3232K rodata, 236K init, 368K bss, 28284K reserved, 0K cma-reserved, 
1310720K highmem)
[0.00] Kernel virtual memory layout:
[0.00]   * 0xfffcf000..0xf000  : fixmap
[0.00]   * 0xffc0..0xffe0  : highmem PTEs
[0.00]   * 0xffa0..0xffc0  : consistent mem
[0.00]   * 0xffa0..0xffa0  : early ioremap
[0.00]   * 0xf100..0xffa0  : vmalloc & ioremap
[0.00] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[0.00] Preemptible hierarchical RCU implementation.
[0.00] Build-time adjustment of leaf fanout to 32.
[0.00] NR_IRQS:512 nr_irqs:512 16
[0.00] UIC0 (32 IRQ sources) at DCR 0xc0
[0.00] UIC1 (32 IRQ sources) at DCR 0xd0
[0.00] UIC2 (32 IRQ sources) at DCR 0xe0
[0.00] UIC3 (32 IRQ sources) at DCR 0xf0
[0.13] clocksource: timebase: mask: 0x max_cycles: 
0x10a60dda894, max_idle_ns: 440795207041 ns
[0.23] clocksource: timebase mult[dda520] shift[24] registered
[0.000144] Console: colour dummy device 80x25
[0.000712] console [tty1] enabled
[  

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 3:07 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/19/2015 1:19 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/19/2015 1:05 PM, Måns Rullgård wrote:

Andy Shevchenko <andy.shevche...@gmail.com> writes:


On Sat, Dec 19, 2015 at 5:40 PM, Måns Rullgård <m...@mansr.com> wrote:


OK, I've found something.  The dma setup errors are benign, caused by
the driver calling dmaengine_prep_slave_sg() even for non-dma
operations.

I suppose the following is a quick fix to avoid preparing descriptor
for non-DMA operations (not tested anyhow)

a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1041,6 +1041,9 @@ static void sata_dwc_qc_prep_by_tag(struct
ata_queued_cmd *qc, u8 tag)
   __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir),
qc->n_elem);

+   if (!is_slave_direction(qc->dma_dir))
+   return;
+
   desc = dma_dwc_xfer_setup(qc);
   if (!desc) {
   dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns NULL\n",

I already have a better patch sitting here.


The real error is the lock recursion that's reported
later.  I wasn't seeing it since I was running a UP non-preempt kernel.
With lock debugging enabled, I get the same error.  This patch should
fix it.
-   spin_lock_irqsave(>host->lock, flags);
   hsdevp->cmd_issued[tag] = cmd_issued;
-   spin_unlock_irqrestore(>host->lock, flags);
+

This will create a second empty line, though I don't care it is so minor.

The patch leaves one blank line before the following block comment.  I
think it looks better that way.


Still can't get the patch applied .

Sorry, didn't realise it conflicted with an intervening patch I had in
my tree.  Try this one.



=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.12.19 14:44:52 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot 2015.a (May 16 2015 - 14:20:11)

CPU:   AMCC PowerPC 460EX Rev. B at 1155 MHz (PLB=231 OPB=115 EBC=115)
No Security/Kasumi support
Bootstrap Option H - Boot ROM Location I2C (Addr 0x52)
Internal PCI arbiter enabled
32 kB I-Cache 32 kB D-Cache
Board: Sam460ex/cr, PCIe 4x + SATA-2
I2C:   ready
DRAM:  2 GiB (ECC not enabled, 462 MHz, CL4)
PCI:   Bus Dev VenId DevId Class Int
 00  04  1095  3512  0104  00
 00  06  126f  0501  0380  00
PCIE1: successfully set as root-complex
 02  00  1002  683f  0300  ff
Net:   ppc_4xx_eth0
FPGA:  Revision 03 (2010-10-07)
SM502: found
PERMD2:not found
VGA:   1
VESA:  OK
[0.00] Using Canyonlands machine description
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.0-rc5-Sam460ex (root@julian-VirtualBox) (gcc 
version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Sat Dec 19 14:25:55 AST 2015
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x7fff]
[0.00] Initmem setup node 0 [mem 0x-0x7fff]
[0.00] MMU: Allocated 1088 bytes of context maps for 255 contexts
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total 
pages: 522752
[0.00] Kernel command line: root=/dev/sda8 console=ttyS0,115200 
console=tty1 dw_dmac_core.dyndbg dw_dmac.dyndbg

Please add ignore_log_level.


Had to truncate the kernel command line to add it.
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.12.19 15:59:55 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot 2015.a (May 16 2015 - 14:20:11)

CPU:   AMCC PowerPC 460EX Rev. B at 1155 MHz (PLB=231 OPB=115 EBC=115)
   No Security/Kasumi support
   Bootstrap Option H - Boot ROM Location I2C (Addr 0x52)
   Internal PCI arbiter enabled
   32 kB I-Cache 32 kB D-Cache
Board: Sam460ex/cr, PCIe 4x + SATA-2
I2C:   ready
DRAM:  2 GiB (ECC not enabled, 462 MHz, CL4)
PCI:   Bus Dev VenId DevId Class Int
00  04  1095  3512  0104  00
00  06  126f  0501  0380  00
PCIE1: successfully set as root-complex
02  00  1002  683f  0300  ff
Net:   ppc_4xx_eth0
FPGA:  Revision 03 (2010-10-07)
SM502: found
PERMD2:not found
VGA:   1
VESA:  OK
[0.00] Using Canyonlands machine description
[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 4.4.0-rc5-Sam460ex (root@julian-VirtualBox) (gcc 
version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Sat Dec 19 14:25:55 AST 2015
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x2fff]
[0.00]   Normal   empty
[0.00]   HighMem  [mem 0x3000-0x7fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-19 Thread Julian Margetson

On 12/19/2015 4:41 PM, Måns Rullgård wrote:

Andy Shevchenko <andy.shevche...@gmail.com> writes:


On Sat, Dec 19, 2015 at 10:16 PM, Julian Margetson <runa...@candw.ms> wrote:

On 12/19/2015 3:07 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:

Total pages: 522752
[0.00] Kernel command line: root=/dev/sda8 console=ttyS0,115200
console=tty1 dw_dmac_core.dyndbg dw_dmac.dyndbg

Please add ignore_log_level.


Had to truncate the kernel command line to add it.

I guess Måns meant 'ignore_loglevel'

Obviously.  I can never remember where the underscores go.


:-)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-18 Thread Julian Margetson

On 12/18/2015 8:04 AM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 8:06 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 3:53 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 2:51 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 1:59 PM, Måns Rullgård wrote:

Julian Margetson  writes:


I have been running my machine mostly configured for pciex1  thus with
the sata_dwc disabled.
The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .

The driver as is upstream would do that since it unconditionally
dereferences a null pointer in the probe function.  My patch fixes that
as a side-effect.


patching file drivers/ata/Kconfig

Hunk #1 FAILED at 296.

[...]


root@julian-VirtualBox:/usr/src/linux-3.18.25#

The patch is against 4.4-rc5.


CC  drivers/ata/sata_dwc_460ex.o

drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type

static struct dw_dma_slave sata_dwc_dma_dws = {
  ^

It builds, albeit with an unrelated warning, using the attached config.
Maybe there's a missing config dependency somewhere.


I am attempting to cross compile under Ubuntu 14.04 X86 in Virtualbox
with your .config.
4.4.0-rc5 builds ok with no patches applied .
Once your patch is applied it fails to build .

CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type
   static struct dw_dma_slave sata_dwc_dma_dws = {
 ^

Bizarre.  This is what it looks like here:

mru@unicorn:/tmp/linux-sata$ git status
On branch sata-dwc
nothing to commit, working directory clean
mru@unicorn:/tmp/linux-sata$ git describe
v4.4-rc5
mru@unicorn:/tmp/linux-sata$ sha1sum 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
e300971aa483390f82de2e9120dc16e460e74feb  
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
mru@unicorn:/tmp/linux-sata$ git am 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
Applying: ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
mru@unicorn:/tmp/linux-sata$ sha1sum .config
4e7615b8d2fa9a1c4b4ae9ffc363aefcaf3789ca  .config
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- oldconfig
HOSTCC  scripts/basic/fixdep
HOSTCC  scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC  scripts/kconfig/zconf.tab.o
HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- drivers/ata/sata_dwc_460ex.o
scripts/kconfig/conf  --silentoldconfig Kconfig
CHK include/config/kernel.release
UPD include/config/kernel.release
WRAParch/powerpc/include/generated/asm/clkdev.h
WRAParch/powerpc/include/generated/asm/div64.h
WRAParch/powerpc/include/generated/asm/irq_regs.h
WRAParch/powerpc/include/generated/asm/irq_work.h
WRAParch/powerpc/include/generated/asm/local64.h
WRAParch/powerpc/include/generated/asm/mcs_spinlock.h
WRAParch/powerpc/include/generated/asm/preempt.h
WRAParch/powerpc/include/generated/asm/rwsem.h
WRAParch/powerpc/include/generated/asm/vtime.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC  kernel/bounds.s
CHK include/generated/bounds.h
UPD include/generated/bounds.h
CHK include/generated/timeconst.h
UPD include/generated/timeconst.h
CC  arch/powerpc/kernel/asm-offsets.s
CHK include/generated/asm-offsets.h
UPD include/generated/asm-offsets.h
CALLscripts/checksyscalls.sh
HOSTCC  scripts/dtc/dtc.o
HOSTCC  scripts/dtc/flattree.o
HOSTCC  scripts/dtc/fstree.o
HOSTCC  scripts/dtc/data.o
HOSTCC  scripts/dtc/livetree.o
HOSTCC  scripts/dtc/treesource.o
HOSTCC  scripts/dtc/srcpos.o
HOSTCC  scripts/dtc/checks.o
HOSTCC  scripts/dtc/util.o
SHIPPED scripts/dtc/dtc-lexer.lex.c
SHIPPED scripts/dtc/dtc-parser.tab.h
HOSTCC  scripts/dtc/dtc-lexer.lex.o
SHIPPED scripts/dtc/dtc-parser.tab.c
HOSTCC  scripts/dtc/dtc-parser.tab.o
HOSTLD  scripts/dtc/dtc
CC  scripts/mod/empty.o
HOSTCC  scripts/mod/mk_elfconfig
MKELF   scripts/mod/elfconfig.h
HOSTCC  scripts/mod/modpost.o
CC  scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC  scripts/mod/file2alias.o
HOSTCC  scripts/mod/sumversion.o
HOSTLD  scripts/mod/modpost
HOSTCC  scripts/kallsyms
CC  d

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-18 Thread Julian Margetson

On 12/17/2015 8:06 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 3:53 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 2:51 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 1:59 PM, Måns Rullgård wrote:

Julian Margetson  writes:


I have been running my machine mostly configured for pciex1  thus with
the sata_dwc disabled.
The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .

The driver as is upstream would do that since it unconditionally
dereferences a null pointer in the probe function.  My patch fixes that
as a side-effect.


patching file drivers/ata/Kconfig

Hunk #1 FAILED at 296.

[...]


root@julian-VirtualBox:/usr/src/linux-3.18.25#

The patch is against 4.4-rc5.


   CC  drivers/ata/sata_dwc_460ex.o

drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type

   static struct dw_dma_slave sata_dwc_dma_dws = {
 ^

It builds, albeit with an unrelated warning, using the attached config.
Maybe there's a missing config dependency somewhere.


I am attempting to cross compile under Ubuntu 14.04 X86 in Virtualbox
with your .config.
4.4.0-rc5 builds ok with no patches applied .
Once your patch is applied it fails to build .

CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type
  static struct dw_dma_slave sata_dwc_dma_dws = {
^

Bizarre.  This is what it looks like here:

mru@unicorn:/tmp/linux-sata$ git status
On branch sata-dwc
nothing to commit, working directory clean
mru@unicorn:/tmp/linux-sata$ git describe
v4.4-rc5
mru@unicorn:/tmp/linux-sata$ sha1sum 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
e300971aa483390f82de2e9120dc16e460e74feb  
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
mru@unicorn:/tmp/linux-sata$ git am 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
Applying: ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
mru@unicorn:/tmp/linux-sata$ sha1sum .config
4e7615b8d2fa9a1c4b4ae9ffc363aefcaf3789ca  .config
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- oldconfig
   HOSTCC  scripts/basic/fixdep
   HOSTCC  scripts/kconfig/conf.o
   SHIPPED scripts/kconfig/zconf.tab.c
   SHIPPED scripts/kconfig/zconf.lex.c
   SHIPPED scripts/kconfig/zconf.hash.c
   HOSTCC  scripts/kconfig/zconf.tab.o
   HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- drivers/ata/sata_dwc_460ex.o
scripts/kconfig/conf  --silentoldconfig Kconfig
   CHK include/config/kernel.release
   UPD include/config/kernel.release
   WRAParch/powerpc/include/generated/asm/clkdev.h
   WRAParch/powerpc/include/generated/asm/div64.h
   WRAParch/powerpc/include/generated/asm/irq_regs.h
   WRAParch/powerpc/include/generated/asm/irq_work.h
   WRAParch/powerpc/include/generated/asm/local64.h
   WRAParch/powerpc/include/generated/asm/mcs_spinlock.h
   WRAParch/powerpc/include/generated/asm/preempt.h
   WRAParch/powerpc/include/generated/asm/rwsem.h
   WRAParch/powerpc/include/generated/asm/vtime.h
   CHK include/generated/uapi/linux/version.h
   UPD include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   UPD include/generated/utsrelease.h
   CC  kernel/bounds.s
   CHK include/generated/bounds.h
   UPD include/generated/bounds.h
   CHK include/generated/timeconst.h
   UPD include/generated/timeconst.h
   CC  arch/powerpc/kernel/asm-offsets.s
   CHK include/generated/asm-offsets.h
   UPD include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   HOSTCC  scripts/dtc/dtc.o
   HOSTCC  scripts/dtc/flattree.o
   HOSTCC  scripts/dtc/fstree.o
   HOSTCC  scripts/dtc/data.o
   HOSTCC  scripts/dtc/livetree.o
   HOSTCC  scripts/dtc/treesource.o
   HOSTCC  scripts/dtc/srcpos.o
   HOSTCC  scripts/dtc/checks.o
   HOSTCC  scripts/dtc/util.o
   SHIPPED scripts/dtc/dtc-lexer.lex.c
   SHIPPED scripts/dtc/dtc-parser.tab.h
   HOSTCC  scripts/dtc/dtc-lexer.lex.o
   SHIPPED scripts/dtc/dtc-parser.tab.c
   HOSTCC  scripts/dtc/dtc-parser.tab.o
   HOSTLD  scripts/dtc/dtc
   CC  scripts/mod/empty.o
   HOSTCC  scripts/mod/mk_elfconfig
   MKELF   scripts/mod/elfconfig.h
   HOSTCC  scripts/mod/modpost.o
   CC  scripts/mod/devicetable-offsets.s
   GEN scripts/mod/devicetable-offsets.h
   HOSTCC  scripts/mod/file2alias.o
   HOSTCC  scripts/mod/sumversion.o
   HOSTLD  scripts/mod/modpost
   HOSTCC  scripts/kallsyms
   CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c: In function 'dma_dwc_xfer_setup':
drivers/ata/sata_dwc_460ex.c:383:20: warning: cast fr

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-18 Thread Julian Margetson

On 12/17/2015 8:06 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 3:53 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 2:51 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 1:59 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


I have been running my machine mostly configured for pciex1  thus with
the sata_dwc disabled.
The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .

The driver as is upstream would do that since it unconditionally
dereferences a null pointer in the probe function.  My patch fixes that
as a side-effect.


patching file drivers/ata/Kconfig

Hunk #1 FAILED at 296.

[...]


root@julian-VirtualBox:/usr/src/linux-3.18.25#

The patch is against 4.4-rc5.


   CC  drivers/ata/sata_dwc_460ex.o

drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type

   static struct dw_dma_slave sata_dwc_dma_dws = {
 ^

It builds, albeit with an unrelated warning, using the attached config.
Maybe there's a missing config dependency somewhere.


I am attempting to cross compile under Ubuntu 14.04 X86 in Virtualbox
with your .config.
4.4.0-rc5 builds ok with no patches applied .
Once your patch is applied it fails to build .

CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type
  static struct dw_dma_slave sata_dwc_dma_dws = {
^

Bizarre.  This is what it looks like here:

mru@unicorn:/tmp/linux-sata$ git status
On branch sata-dwc
nothing to commit, working directory clean
mru@unicorn:/tmp/linux-sata$ git describe
v4.4-rc5
mru@unicorn:/tmp/linux-sata$ sha1sum 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
e300971aa483390f82de2e9120dc16e460e74feb  
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
mru@unicorn:/tmp/linux-sata$ git am 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
Applying: ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
mru@unicorn:/tmp/linux-sata$ sha1sum .config
4e7615b8d2fa9a1c4b4ae9ffc363aefcaf3789ca  .config
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- oldconfig
   HOSTCC  scripts/basic/fixdep
   HOSTCC  scripts/kconfig/conf.o
   SHIPPED scripts/kconfig/zconf.tab.c
   SHIPPED scripts/kconfig/zconf.lex.c
   SHIPPED scripts/kconfig/zconf.hash.c
   HOSTCC  scripts/kconfig/zconf.tab.o
   HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- drivers/ata/sata_dwc_460ex.o
scripts/kconfig/conf  --silentoldconfig Kconfig
   CHK include/config/kernel.release
   UPD include/config/kernel.release
   WRAParch/powerpc/include/generated/asm/clkdev.h
   WRAParch/powerpc/include/generated/asm/div64.h
   WRAParch/powerpc/include/generated/asm/irq_regs.h
   WRAParch/powerpc/include/generated/asm/irq_work.h
   WRAParch/powerpc/include/generated/asm/local64.h
   WRAParch/powerpc/include/generated/asm/mcs_spinlock.h
   WRAParch/powerpc/include/generated/asm/preempt.h
   WRAParch/powerpc/include/generated/asm/rwsem.h
   WRAParch/powerpc/include/generated/asm/vtime.h
   CHK include/generated/uapi/linux/version.h
   UPD include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   UPD include/generated/utsrelease.h
   CC  kernel/bounds.s
   CHK include/generated/bounds.h
   UPD include/generated/bounds.h
   CHK include/generated/timeconst.h
   UPD include/generated/timeconst.h
   CC  arch/powerpc/kernel/asm-offsets.s
   CHK include/generated/asm-offsets.h
   UPD include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   HOSTCC  scripts/dtc/dtc.o
   HOSTCC  scripts/dtc/flattree.o
   HOSTCC  scripts/dtc/fstree.o
   HOSTCC  scripts/dtc/data.o
   HOSTCC  scripts/dtc/livetree.o
   HOSTCC  scripts/dtc/treesource.o
   HOSTCC  scripts/dtc/srcpos.o
   HOSTCC  scripts/dtc/checks.o
   HOSTCC  scripts/dtc/util.o
   SHIPPED scripts/dtc/dtc-lexer.lex.c
   SHIPPED scripts/dtc/dtc-parser.tab.h
   HOSTCC  scripts/dtc/dtc-lexer.lex.o
   SHIPPED scripts/dtc/dtc-parser.tab.c
   HOSTCC  scripts/dtc/dtc-parser.tab.o
   HOSTLD  scripts/dtc/dtc
   CC  scripts/mod/empty.o
   HOSTCC  scripts/mod/mk_elfconfig
   MKELF   scripts/mod/elfconfig.h
   HOSTCC  scripts/mod/modpost.o
   CC  scripts/mod/devicetable-offsets.s
   GEN scripts/mod/devicetable-offsets.h
   HOSTCC  scripts/mod/file2alias.o
   HOSTCC  scripts/mod/sumversion.o
   HOSTLD  scripts/mod/modpost
   HOSTCC  scripts/kallsyms
   CC  drivers/ata/sata_dwc_460ex.o
drivers

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-18 Thread Julian Margetson

On 12/18/2015 8:04 AM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 8:06 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 3:53 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 2:51 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 1:59 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


I have been running my machine mostly configured for pciex1  thus with
the sata_dwc disabled.
The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .

The driver as is upstream would do that since it unconditionally
dereferences a null pointer in the probe function.  My patch fixes that
as a side-effect.


patching file drivers/ata/Kconfig

Hunk #1 FAILED at 296.

[...]


root@julian-VirtualBox:/usr/src/linux-3.18.25#

The patch is against 4.4-rc5.


CC  drivers/ata/sata_dwc_460ex.o

drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type

static struct dw_dma_slave sata_dwc_dma_dws = {
  ^

It builds, albeit with an unrelated warning, using the attached config.
Maybe there's a missing config dependency somewhere.


I am attempting to cross compile under Ubuntu 14.04 X86 in Virtualbox
with your .config.
4.4.0-rc5 builds ok with no patches applied .
Once your patch is applied it fails to build .

CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type
   static struct dw_dma_slave sata_dwc_dma_dws = {
 ^

Bizarre.  This is what it looks like here:

mru@unicorn:/tmp/linux-sata$ git status
On branch sata-dwc
nothing to commit, working directory clean
mru@unicorn:/tmp/linux-sata$ git describe
v4.4-rc5
mru@unicorn:/tmp/linux-sata$ sha1sum 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
e300971aa483390f82de2e9120dc16e460e74feb  
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
mru@unicorn:/tmp/linux-sata$ git am 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
Applying: ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
mru@unicorn:/tmp/linux-sata$ sha1sum .config
4e7615b8d2fa9a1c4b4ae9ffc363aefcaf3789ca  .config
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- oldconfig
HOSTCC  scripts/basic/fixdep
HOSTCC  scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC  scripts/kconfig/zconf.tab.o
HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- drivers/ata/sata_dwc_460ex.o
scripts/kconfig/conf  --silentoldconfig Kconfig
CHK include/config/kernel.release
UPD include/config/kernel.release
WRAParch/powerpc/include/generated/asm/clkdev.h
WRAParch/powerpc/include/generated/asm/div64.h
WRAParch/powerpc/include/generated/asm/irq_regs.h
WRAParch/powerpc/include/generated/asm/irq_work.h
WRAParch/powerpc/include/generated/asm/local64.h
WRAParch/powerpc/include/generated/asm/mcs_spinlock.h
WRAParch/powerpc/include/generated/asm/preempt.h
WRAParch/powerpc/include/generated/asm/rwsem.h
WRAParch/powerpc/include/generated/asm/vtime.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC  kernel/bounds.s
CHK include/generated/bounds.h
UPD include/generated/bounds.h
CHK include/generated/timeconst.h
UPD include/generated/timeconst.h
CC  arch/powerpc/kernel/asm-offsets.s
CHK include/generated/asm-offsets.h
UPD include/generated/asm-offsets.h
CALLscripts/checksyscalls.sh
HOSTCC  scripts/dtc/dtc.o
HOSTCC  scripts/dtc/flattree.o
HOSTCC  scripts/dtc/fstree.o
HOSTCC  scripts/dtc/data.o
HOSTCC  scripts/dtc/livetree.o
HOSTCC  scripts/dtc/treesource.o
HOSTCC  scripts/dtc/srcpos.o
HOSTCC  scripts/dtc/checks.o
HOSTCC  scripts/dtc/util.o
SHIPPED scripts/dtc/dtc-lexer.lex.c
SHIPPED scripts/dtc/dtc-parser.tab.h
HOSTCC  scripts/dtc/dtc-lexer.lex.o
SHIPPED scripts/dtc/dtc-parser.tab.c
HOSTCC  scripts/dtc/dtc-parser.tab.o
HOSTLD  scripts/dtc/dtc
CC  scripts/mod/empty.o
HOSTCC  scripts/mod/mk_elfconfig
MKELF   scripts/mod/elfconfig.h
HOSTCC  scripts/mod/modpost.o
CC  scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC  scripts/mod/file2alia

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-17 Thread Julian Margetson

On 12/17/2015 8:06 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 3:53 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 2:51 PM, Måns Rullgård wrote:

Julian Margetson  writes:


On 12/17/2015 1:59 PM, Måns Rullgård wrote:

Julian Margetson  writes:


I have been running my machine mostly configured for pciex1  thus with
the sata_dwc disabled.
The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .

The driver as is upstream would do that since it unconditionally
dereferences a null pointer in the probe function.  My patch fixes that
as a side-effect.


patching file drivers/ata/Kconfig

Hunk #1 FAILED at 296.

[...]


root@julian-VirtualBox:/usr/src/linux-3.18.25#

The patch is against 4.4-rc5.


   CC  drivers/ata/sata_dwc_460ex.o

drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type

   static struct dw_dma_slave sata_dwc_dma_dws = {
 ^

It builds, albeit with an unrelated warning, using the attached config.
Maybe there's a missing config dependency somewhere.


I am attempting to cross compile under Ubuntu 14.04 X86 in Virtualbox
with your .config.
4.4.0-rc5 builds ok with no patches applied .
Once your patch is applied it fails to build .

CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type
  static struct dw_dma_slave sata_dwc_dma_dws = {
^

Bizarre.  This is what it looks like here:

mru@unicorn:/tmp/linux-sata$ git status
On branch sata-dwc
nothing to commit, working directory clean
mru@unicorn:/tmp/linux-sata$ git describe
v4.4-rc5
mru@unicorn:/tmp/linux-sata$ sha1sum 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
e300971aa483390f82de2e9120dc16e460e74feb  
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
mru@unicorn:/tmp/linux-sata$ git am 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
Applying: ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
mru@unicorn:/tmp/linux-sata$ sha1sum .config
4e7615b8d2fa9a1c4b4ae9ffc363aefcaf3789ca  .config
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- oldconfig
   HOSTCC  scripts/basic/fixdep
   HOSTCC  scripts/kconfig/conf.o
   SHIPPED scripts/kconfig/zconf.tab.c
   SHIPPED scripts/kconfig/zconf.lex.c
   SHIPPED scripts/kconfig/zconf.hash.c
   HOSTCC  scripts/kconfig/zconf.tab.o
   HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- drivers/ata/sata_dwc_460ex.o
scripts/kconfig/conf  --silentoldconfig Kconfig
   CHK include/config/kernel.release
   UPD include/config/kernel.release
   WRAParch/powerpc/include/generated/asm/clkdev.h
   WRAParch/powerpc/include/generated/asm/div64.h
   WRAParch/powerpc/include/generated/asm/irq_regs.h
   WRAParch/powerpc/include/generated/asm/irq_work.h
   WRAParch/powerpc/include/generated/asm/local64.h
   WRAParch/powerpc/include/generated/asm/mcs_spinlock.h
   WRAParch/powerpc/include/generated/asm/preempt.h
   WRAParch/powerpc/include/generated/asm/rwsem.h
   WRAParch/powerpc/include/generated/asm/vtime.h
   CHK include/generated/uapi/linux/version.h
   UPD include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   UPD include/generated/utsrelease.h
   CC  kernel/bounds.s
   CHK include/generated/bounds.h
   UPD include/generated/bounds.h
   CHK include/generated/timeconst.h
   UPD include/generated/timeconst.h
   CC  arch/powerpc/kernel/asm-offsets.s
   CHK include/generated/asm-offsets.h
   UPD include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   HOSTCC  scripts/dtc/dtc.o
   HOSTCC  scripts/dtc/flattree.o
   HOSTCC  scripts/dtc/fstree.o
   HOSTCC  scripts/dtc/data.o
   HOSTCC  scripts/dtc/livetree.o
   HOSTCC  scripts/dtc/treesource.o
   HOSTCC  scripts/dtc/srcpos.o
   HOSTCC  scripts/dtc/checks.o
   HOSTCC  scripts/dtc/util.o
   SHIPPED scripts/dtc/dtc-lexer.lex.c
   SHIPPED scripts/dtc/dtc-parser.tab.h
   HOSTCC  scripts/dtc/dtc-lexer.lex.o
   SHIPPED scripts/dtc/dtc-parser.tab.c
   HOSTCC  scripts/dtc/dtc-parser.tab.o
   HOSTLD  scripts/dtc/dtc
   CC  scripts/mod/empty.o
   HOSTCC  scripts/mod/mk_elfconfig
   MKELF   scripts/mod/elfconfig.h
   HOSTCC  scripts/mod/modpost.o
   CC  scripts/mod/devicetable-offsets.s
   GEN scripts/mod/devicetable-offsets.h
   HOSTCC  scripts/mod/file2alias.o
   HOSTCC  scripts/mod/sumversion.o
   HOSTLD  scripts/mod/modpost
   HOSTCC  scripts/kallsyms
   CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c: In function 'dma_dwc_xfer_setup':
drivers/ata/sata_dwc_460ex.c:383:20: warning: cast fr

Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-17 Thread Julian Margetson

On 12/17/2015 12:53 PM, Andy Shevchenko wrote:

On Thu, 2015-12-17 at 16:04 +, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Thu, 2015-12-17 at 15:13 +, Måns Rullgård wrote:

Andy Shevchenko  writes:


On Tue, 2015-12-15 at 23:34 +, Måns Rullgård wrote:

Mans Rullgard  writes:


Currently this driver only works with a DesignWare DMA
engine
which it registers manually using the second "reg" address
range and interrupt number from the DT node.

This patch makes the driver instead use the "dmas" property
if
present, otherwise optionally falling back on the old way
so
existing device trees can continue to work.

With this change, there is no longer any reason to depend
on
the 460EX machine type so drop that from Kconfig.

Signed-off-by: Mans Rullgard 
---
  drivers/ata/Kconfig  |  10 ++-
  drivers/ata/sata_dwc_460ex.c | 192
+++--
--
  2 files changed, 131 insertions(+), 71 deletions(-)

The corresponding patch for the canyonlands devicetree looks
something
like this.  I don't have any such hardware or even a manual,
so I
don't
know what values to use for the various required DT
properties of
the
DMA controller node, nor can I test it.  The SATA driver
works
with a
different DMA controller on a Sigma Designs chip.

diff --git a/arch/powerpc/boot/dts/canyonlands.dts
b/arch/powerpc/boot/dts/canyonlands.dts
index 3dc75de..959f36e 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -190,12 +190,22 @@
 /* DMA */ 0x2 
0xc
0x4>;
};
  
+		DMA0: dma@bffd0800 {

+   compatible = "snps,dma-spear1340";
+   reg = <4 0xbffd0800 0x400>;
+   interrupt-parent = <>;
+   interrupts = <0x5 0x4>;
+   #dma-cells = <3>;
+   /* required properties here */

You have to move the master assignments and other custom
dw_dmac
properties. Maybe at some point I will fix that in
dw/platform.c.


+   };

The current sata_dwc driver calls dw_dma_probe() with null pdata
which causes the dw_dma driver to auto-detect most
parameters.  It
looks like simply omitting those properties here results in the
same
thing, although in this case dw_dma_parse_dt() leaves a
devm-allocated pdata struct adrift.  Deferring the allocation of
that
and changing the DT binding doc to make these properties optional
for
auto-detect-capable hardware should just work.

Yeah, I would like to allow autoconfiguration in case of DT as well
and
translate it to use unified device property API.


Something like this:

If it works for you, please, submit as a patch. Thanks.

I can't test it since I have no such hardware.

It's currently broken, last person who seems to have it is
(was?) Julian Margetson [1]

[1] https://patchwork.ozlabs.org/patch/439850/

I have been running my machine mostly configured for pciex1  thus with 
the sata_dwc disabled.

The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-17 Thread Julian Margetson

On 12/17/2015 12:53 PM, Andy Shevchenko wrote:

On Thu, 2015-12-17 at 16:04 +, Måns Rullgård wrote:

Andy Shevchenko <andriy.shevche...@linux.intel.com> writes:


On Thu, 2015-12-17 at 15:13 +, Måns Rullgård wrote:

Andy Shevchenko <andriy.shevche...@linux.intel.com> writes:


On Tue, 2015-12-15 at 23:34 +, Måns Rullgård wrote:

Mans Rullgard <m...@mansr.com> writes:


Currently this driver only works with a DesignWare DMA
engine
which it registers manually using the second "reg" address
range and interrupt number from the DT node.

This patch makes the driver instead use the "dmas" property
if
present, otherwise optionally falling back on the old way
so
existing device trees can continue to work.

With this change, there is no longer any reason to depend
on
the 460EX machine type so drop that from Kconfig.

Signed-off-by: Mans Rullgard <m...@mansr.com>
---
  drivers/ata/Kconfig  |  10 ++-
  drivers/ata/sata_dwc_460ex.c | 192
+++--
--
  2 files changed, 131 insertions(+), 71 deletions(-)

The corresponding patch for the canyonlands devicetree looks
something
like this.  I don't have any such hardware or even a manual,
so I
don't
know what values to use for the various required DT
properties of
the
DMA controller node, nor can I test it.  The SATA driver
works
with a
different DMA controller on a Sigma Designs chip.

diff --git a/arch/powerpc/boot/dts/canyonlands.dts
b/arch/powerpc/boot/dts/canyonlands.dts
index 3dc75de..959f36e 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -190,12 +190,22 @@
 /* DMA */ 0x2 
0xc
0x4>;
};
  
+		DMA0: dma@bffd0800 {

+   compatible = "snps,dma-spear1340";
+   reg = <4 0xbffd0800 0x400>;
+   interrupt-parent = <>;
+   interrupts = <0x5 0x4>;
+   #dma-cells = <3>;
+   /* required properties here */

You have to move the master assignments and other custom
dw_dmac
properties. Maybe at some point I will fix that in
dw/platform.c.


+   };

The current sata_dwc driver calls dw_dma_probe() with null pdata
which causes the dw_dma driver to auto-detect most
parameters.  It
looks like simply omitting those properties here results in the
same
thing, although in this case dw_dma_parse_dt() leaves a
devm-allocated pdata struct adrift.  Deferring the allocation of
that
and changing the DT binding doc to make these properties optional
for
auto-detect-capable hardware should just work.

Yeah, I would like to allow autoconfiguration in case of DT as well
and
translate it to use unified device property API.


Something like this:

If it works for you, please, submit as a patch. Thanks.

I can't test it since I have no such hardware.

It's currently broken, last person who seems to have it is
(was?) Julian Margetson [1]

[1] https://patchwork.ozlabs.org/patch/439850/

I have been running my machine mostly configured for pciex1  thus with 
the sata_dwc disabled.

The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-17 Thread Julian Margetson

On 12/17/2015 8:06 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 3:53 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 2:51 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


On 12/17/2015 1:59 PM, Måns Rullgård wrote:

Julian Margetson <runa...@candw.ms> writes:


I have been running my machine mostly configured for pciex1  thus with
the sata_dwc disabled.
The changes to sata_dwc-460ex do cause an oops.
I will try to give more detailed info over this weekend .

The driver as is upstream would do that since it unconditionally
dereferences a null pointer in the probe function.  My patch fixes that
as a side-effect.


patching file drivers/ata/Kconfig

Hunk #1 FAILED at 296.

[...]


root@julian-VirtualBox:/usr/src/linux-3.18.25#

The patch is against 4.4-rc5.


   CC  drivers/ata/sata_dwc_460ex.o

drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type

   static struct dw_dma_slave sata_dwc_dma_dws = {
 ^

It builds, albeit with an unrelated warning, using the attached config.
Maybe there's a missing config dependency somewhere.


I am attempting to cross compile under Ubuntu 14.04 X86 in Virtualbox
with your .config.
4.4.0-rc5 builds ok with no patches applied .
Once your patch is applied it fails to build .

CC  drivers/ata/sata_dwc_460ex.o
drivers/ata/sata_dwc_460ex.c:198:15: error: variable ‘sata_dwc_dma_dws’ has 
initializer but incomplete type
  static struct dw_dma_slave sata_dwc_dma_dws = {
^

Bizarre.  This is what it looks like here:

mru@unicorn:/tmp/linux-sata$ git status
On branch sata-dwc
nothing to commit, working directory clean
mru@unicorn:/tmp/linux-sata$ git describe
v4.4-rc5
mru@unicorn:/tmp/linux-sata$ sha1sum 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
e300971aa483390f82de2e9120dc16e460e74feb  
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
mru@unicorn:/tmp/linux-sata$ git am 
/tmp/0001-ata-sata_dwc_460ex-use-dmas-DT-property-to-find-dma-.patch
Applying: ata: sata_dwc_460ex: use "dmas" DT property to find dma channel
mru@unicorn:/tmp/linux-sata$ sha1sum .config
4e7615b8d2fa9a1c4b4ae9ffc363aefcaf3789ca  .config
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- oldconfig
   HOSTCC  scripts/basic/fixdep
   HOSTCC  scripts/kconfig/conf.o
   SHIPPED scripts/kconfig/zconf.tab.c
   SHIPPED scripts/kconfig/zconf.lex.c
   SHIPPED scripts/kconfig/zconf.hash.c
   HOSTCC  scripts/kconfig/zconf.tab.o
   HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --oldconfig Kconfig
#
# configuration written to .config
#
mru@unicorn:/tmp/linux-sata$ make ARCH=powerpc 
CROSS_COMPILE=powerpc64-none-linux-gnu- drivers/ata/sata_dwc_460ex.o
scripts/kconfig/conf  --silentoldconfig Kconfig
   CHK include/config/kernel.release
   UPD include/config/kernel.release
   WRAParch/powerpc/include/generated/asm/clkdev.h
   WRAParch/powerpc/include/generated/asm/div64.h
   WRAParch/powerpc/include/generated/asm/irq_regs.h
   WRAParch/powerpc/include/generated/asm/irq_work.h
   WRAParch/powerpc/include/generated/asm/local64.h
   WRAParch/powerpc/include/generated/asm/mcs_spinlock.h
   WRAParch/powerpc/include/generated/asm/preempt.h
   WRAParch/powerpc/include/generated/asm/rwsem.h
   WRAParch/powerpc/include/generated/asm/vtime.h
   CHK include/generated/uapi/linux/version.h
   UPD include/generated/uapi/linux/version.h
   CHK include/generated/utsrelease.h
   UPD include/generated/utsrelease.h
   CC  kernel/bounds.s
   CHK include/generated/bounds.h
   UPD include/generated/bounds.h
   CHK include/generated/timeconst.h
   UPD include/generated/timeconst.h
   CC  arch/powerpc/kernel/asm-offsets.s
   CHK include/generated/asm-offsets.h
   UPD include/generated/asm-offsets.h
   CALLscripts/checksyscalls.sh
   HOSTCC  scripts/dtc/dtc.o
   HOSTCC  scripts/dtc/flattree.o
   HOSTCC  scripts/dtc/fstree.o
   HOSTCC  scripts/dtc/data.o
   HOSTCC  scripts/dtc/livetree.o
   HOSTCC  scripts/dtc/treesource.o
   HOSTCC  scripts/dtc/srcpos.o
   HOSTCC  scripts/dtc/checks.o
   HOSTCC  scripts/dtc/util.o
   SHIPPED scripts/dtc/dtc-lexer.lex.c
   SHIPPED scripts/dtc/dtc-parser.tab.h
   HOSTCC  scripts/dtc/dtc-lexer.lex.o
   SHIPPED scripts/dtc/dtc-parser.tab.c
   HOSTCC  scripts/dtc/dtc-parser.tab.o
   HOSTLD  scripts/dtc/dtc
   CC  scripts/mod/empty.o
   HOSTCC  scripts/mod/mk_elfconfig
   MKELF   scripts/mod/elfconfig.h
   HOSTCC  scripts/mod/modpost.o
   CC  scripts/mod/devicetable-offsets.s
   GEN scripts/mod/devicetable-offsets.h
   HOSTCC  scripts/mod/file2alias.o
   HOSTCC  scripts/mod/sumversion.o
   HOSTLD  scripts/mod/modpost
   HOSTCC  scripts/kallsyms
   CC  drivers/ata/sata_dwc_460ex.o
drivers