Re: use generic DMA mapping code in powerpc V4

From: Christian Zigotzky
Date: Tue Jan 15 2019 - 05:55:37 EST


Next step: 21074ef03c0816ae158721a78cabe9035938dddd (powerpc/dma: use the generic direct mapping bypass)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout 21074ef03c0816ae158721a78cabe9035938dddd

I was able to compile the kernel for the AmigaOne X1000 (Nemo board with PA Semi PA6T-1682M SoC). It boots but the PA Semi onboard ethernet doesn't work.

dmesg:

[ÂÂ 12.698063] pasemi_mac 0000:00:14.3 enp0s20f3: renamed from eth0
[ÂÂ 16.516966] IPv6: ADDRCONF(NETDEV_UP): enp0s20f3: link is not ready
[ÂÂ 16.521025] pci 0000:00:1a.0: overflow 0x000000026a587802+1646 of DMA mask ffffffff bus mask 0
[ÂÂ 16.521047] WARNING: CPU: 0 PID: 2318 at kernel/dma/direct.c:43 .dma_direct_map_page+0x11c/0x200
[ÂÂ 16.521049] Modules linked in:
[ÂÂ 16.521056] CPU: 0 PID: 2318 Comm: NetworkManager Not tainted 5.0.0-rc2-2_A-EON_AmigaOne_X1000_Nemo-54576-g21074ef-dirty #1
[ÂÂ 16.521059] NIP:Â c00000000010395c LR: c000000000103a30 CTR: 0000000000000000
[ÂÂ 16.521062] REGS: c00000026a1a29a0 TRAP: 0700ÂÂ Not tainted (5.0.0-rc2-2_A-EON_AmigaOne_X1000_Nemo-54576-g21074ef-dirty)
[ÂÂ 16.521064] MSR:Â 900000000202b032 <SF,HV,VEC,EE,FP,ME,IR,DR,RI>Â CR: 22002442Â XER: 20000000
[ÂÂ 16.521074] IRQMASK: 0
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR00: c000000000103a30 c00000026a1a2c30 c000000001923f00 0000000000000052
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR04: c00000026f206778 c00000026f20d458 c000000001ab1178 7063693a30303030
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR08: 0000000000000007 0000000000000000 0000000000000000 0000000000000010
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR12: 3a30303a31612e30 c000000001b10000 0000000000a79020 0000000000ace140
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR16: 00000000fffdd958 0000000000000000 0000000000000000 c00000026be92220
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR20: 0000000000000000 c00000026a470000 0000000000000000 0000000000000000
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR24: 0000000000000800 c00000026a1c0000 c00000026bc69280 c00000026a1c0000
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GPR28: c000000277b1f588 000000000000066e c00000026d3c68b0 0000000000000802
[ÂÂ 16.521111] NIP [c00000000010395c] .dma_direct_map_page+0x11c/0x200
[ÂÂ 16.521114] LR [c000000000103a30] .dma_direct_map_page+0x1f0/0x200
[ÂÂ 16.521116] Call Trace:
[ÂÂ 16.521120] [c00000026a1a2c30] [c000000000103a30] .dma_direct_map_page+0x1f0/0x200 (unreliable)
[ÂÂ 16.521126] [c00000026a1a2cd0] [c00000000099b84c] .pasemi_mac_replenish_rx_ring+0x12c/0x2a0
[ÂÂ 16.521131] [c00000026a1a2da0] [c00000000099dcc4] .pasemi_mac_open+0x384/0x7c0
[ÂÂ 16.521137] [c00000026a1a2e40] [c000000000c6f4e4] .__dev_open+0x134/0x1e0
[ÂÂ 16.521142] [c00000026a1a2ee0] [c000000000c6fa4c] .__dev_change_flags+0x1bc/0x210
[ÂÂ 16.521147] [c00000026a1a2f90] [c000000000c6fae8] .dev_change_flags+0x48/0xa0
[ÂÂ 16.521153] [c00000026a1a3030] [c000000000c8c8ec] .do_setlink+0x3dc/0xf60
[ÂÂ 16.521158] [c00000026a1a31b0] [c000000000c8dde4] .__rtnl_newlink+0x5e4/0x900
[ÂÂ 16.521163] [c00000026a1a35f0] [c000000000c8e16c] .rtnl_newlink+0x6c/0xb0
[ÂÂ 16.521167] [c00000026a1a3680] [c000000000c89898] .rtnetlink_rcv_msg+0x2e8/0x3d0
[ÂÂ 16.521172] [c00000026a1a3760] [c000000000cc0ff0] .netlink_rcv_skb+0x120/0x170
[ÂÂ 16.521177] [c00000026a1a3820] [c000000000c87378] .rtnetlink_rcv+0x28/0x40
[ÂÂ 16.521181] [c00000026a1a38a0] [c000000000cc0458] .netlink_unicast+0x208/0x2f0
[ÂÂ 16.521186] [c00000026a1a3950] [c000000000cc0a08] .netlink_sendmsg+0x348/0x460
[ÂÂ 16.521190] [c00000026a1a3a30] [c000000000c387d4] .sock_sendmsg+0x44/0x70
[ÂÂ 16.521195] [c00000026a1a3ab0] [c000000000c3a7fc] .___sys_sendmsg+0x30c/0x320
[ÂÂ 16.521199] [c00000026a1a3ca0] [c000000000c3c414] .__sys_sendmsg+0x74/0xf0
[ÂÂ 16.521204] [c00000026a1a3d90] [c000000000cb4e00] .__se_compat_sys_sendmsg+0x40/0x60
[ÂÂ 16.521210] [c00000026a1a3e20] [c00000000000a21c] system_call+0x5c/0x70
[ÂÂ 16.521212] Instruction dump:
[ÂÂ 16.521215] 60000000 f8610070 3d20ffff 6129fffe 79290020 e8e70000 7fa74840 409d00b8
[ÂÂ 16.521222] 3d420001 892acb59 2f890000 419e00b8 <0fe00000> 382100a0 3860ffff e8010010
[ÂÂ 16.521231] ---[ end trace 2129e4121bbdd0e9 ]---

I wasn't able to compile it for the AmigaOne X5000 (Cyrus+ board with Qoriq P5020 SoC). Error message:

CALLÂÂÂ scripts/checksyscalls.sh
 CHK include/generated/compile.h
 CC arch/powerpc/sysdev/fsl_pci.o
arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pci_dma_set_mask':
arch/powerpc/sysdev/fsl_pci.c:142:21: error: 'dma_nommu_ops' undeclared (first use in this function)
ÂÂ set_dma_ops(dev, &dma_nommu_ops);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ^
arch/powerpc/sysdev/fsl_pci.c:142:21: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:276: recipe for target 'arch/powerpc/sysdev/fsl_pci.o' failed
make[2]: *** [arch/powerpc/sysdev/fsl_pci.o] Error 1
scripts/Makefile.build:492: recipe for target 'arch/powerpc/sysdev' failed
make[1]: *** [arch/powerpc/sysdev] Error 2
Makefile:1049: recipe for target 'arch/powerpc' failed
make: *** [arch/powerpc] Error 2

-- Christian


On 15 January 2019 at 09:49AM, Christian Zigotzky wrote:
Next step: 63a6e350e037a21e9a88c8b710129bea7049a80f (powerpc/dma: use the dma_direct mapping routines)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout 63a6e350e037a21e9a88c8b710129bea7049a80f

Error message:

arch/powerpc/kernel/dma.o:(.data.rel.ro+0x0): undefined reference to `__dma_nommu_alloc_coherent'
arch/powerpc/kernel/dma.o:(.data.rel.ro+0x8): undefined reference to `__dma_nommu_free_coherent'
Makefile:1027: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

-- Christian


On 15 January 2019 at 09:07AM, Christian Zigotzky wrote:
Next step: 240d7ecd7f6fa62e074e8a835e620047954f0b28 (powerpc/dma: use the dma-direct allocator for coherent platforms)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout 240d7ecd7f6fa62e074e8a835e620047954f0b28

Link to the Git: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/powerpc-dma.6

env LANG=C make CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc zImage

Error message:

arch/powerpc/kernel/dma.o:(.data.rel.ro+0x0): undefined reference to `__dma_nommu_alloc_coherent'
arch/powerpc/kernel/dma.o:(.data.rel.ro+0x8): undefined reference to `__dma_nommu_free_coherent'
Makefile:1027: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

-- Christian


On 12 January 2019 at 7:14PM, Christian Zigotzky wrote:
Next step: 4558b6e1ddf3dcf5a86d6a5d16c2ac1600c7df39 (swiotlb: remove swiotlb_dma_supported)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout 4558b6e1ddf3dcf5a86d6a5d16c2ac1600c7df39

Output:

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

 git checkout -b <new-branch-name>

HEAD is now at 4558b6e... swiotlb: remove swiotlb_dma_supported

----

Link to the Git: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/powerpc-dma.6

Results: PASEMI onboard ethernet (X1000) works and the X5000 (P5020 board) boots. I also successfully tested sound, hardware 3D acceleration, Bluetooth, network, booting with a label etc. The uImages work also in a virtual e5500 quad-core QEMU machine.

-- Christian


On 11 January 2019 at 03:10AM, Christian Zigotzky wrote:
Next step: 891dcc1072f1fa27a83da920d88daff6ca08fc02 (powerpc/dma: remove dma_nommu_dma_supported)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout 891dcc1072f1fa27a83da920d88daff6ca08fc02

Output:

Note: checking out '891dcc1072f1fa27a83da920d88daff6ca08fc02'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b <new-branch-name>

HEAD is now at 891dcc1... powerpc/dma: remove dma_nommu_dma_supported

---

Link to the Git: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/powerpc-dma.6

Results: PASEMI onboard ethernet works and the X5000 (P5020 board) boots. I also successfully tested sound, hardware 3D acceleration, Bluetooth, network, booting with a label etc. The uImages work also in a virtual e5500 quad-core QEMU machine.

-- Christian


On 09 January 2019 at 10:31AM, Christian Zigotzky wrote:
Next step: a64e18ba191ba9102fb174f27d707485ffd9389c (powerpc/dma: remove dma_nommu_get_required_mask)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout a64e18ba191ba9102fb174f27d707485ffd9389c

Link to the Git: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/powerpc-dma.6

Results: PASEMI onboard ethernet works and the X5000 (P5020 board) boots. I also successfully tested sound, hardware 3D acceleration, Bluetooth, network, booting with a label etc. The uImages work also in a virtual e5500 quad-core QEMU machine.

-- Christian


On 05 January 2019 at 5:03PM, Christian Zigotzky wrote:
Next step: c446404b041130fbd9d1772d184f24715cf2362f (powerpc/dma: remove dma_nommu_mmap_coherent)

git clone git://git.infradead.org/users/hch/misc.git -b powerpc-dma.6 a

git checkout c446404b041130fbd9d1772d184f24715cf2362f

Output:

Note: checking out 'c446404b041130fbd9d1772d184f24715cf2362f'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

 git checkout -b <new-branch-name>

HEAD is now at c446404... powerpc/dma: remove dma_nommu_mmap_coherent

-----

Link to the Git: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/powerpc-dma.6

Result: PASEMI onboard ethernet works and the X5000 (P5020 board) boots.

-- Christian