Re: [Nouveau] [PATCH v2] Revert "drm/nouveau/device/pci: set as non-CPU-coherent on ARM64"

2016-06-06 Thread Alexandre Courbot
On Mon, Jun 6, 2016 at 6:25 PM, Robin Murphy  wrote:
> On 06/06/16 08:11, Alexandre Courbot wrote:
>>
>> From: Robin Murphy 
>>
>> This reverts commit 1733a2ad36741b1812cf8b3f3037c28d0af53f50.
>>
>> There is apparently something amiss with the way the TTM code handles
>> DMA buffers, which the above commit was attempting to work around for
>> arm64 systems with non-coherent PCI. Unfortunately, this completely
>> breaks systems *with* coherent PCI (which appear to be the majority).
>>
>> Booting a plain arm64 defconfig + CONFIG_DRM + CONFIG_DRM_NOUVEAU on
>> a machine with a PCI GPU having coherent dma_map_ops (in this case a
>> 7600GT card plugged into an ARM Juno board) results in a fatal crash:
>>
>> [2.803438] nouveau :06:00.0: DRM: allocated 1024x768 fb: 0x9000,
>> bo ffc976141c00
>> [2.897662] Unable to handle kernel NULL pointer dereference at virtual
>> address 01ac
>> [2.897666] pgd = ff8008e0
>> [2.897675] [01ac] *pgd=0009e003, *pud=0009e003,
>> *pmd=
>> [2.897680] Internal error: Oops: 9645 [#1] PREEMPT SMP
>> [2.897685] Modules linked in:
>> [2.897692] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc5+ #543
>> [2.897694] Hardware name: ARM Juno development board (r1) (DT)
>> [2.897699] task: ffc9768a ti: ffc9768a8000 task.ti:
>> ffc9768a8000
>> [2.897711] PC is at __memcpy+0x7c/0x180
>> [2.897719] LR is at OUT_RINGp+0x34/0x70
>> [2.897724] pc : [] lr : [] pstate:
>> 8045
>> [2.897726] sp : ffc9768ab360
>> [2.897732] x29: ffc9768ab360 x28: 0001
>> [2.897738] x27: ffc97624c000 x26: 
>> [2.897744] x25: 0080 x24: 6c00
>> [2.897749] x23: 0005 x22: ffc97624c010
>> [2.897755] x21: 0004 x20: 0004
>> [2.897761] x19: ffc9763da000 x18: ffc976b2491c
>> [2.897766] x17: 0007 x16: 0006
>> [2.897771] x15: 0001 x14: 0001
>> [2.89] x13: 00e31b70 x12: ffc9768a0080
>> [2.897783] x11:  x10: fb00
>> [2.897788] x9 :  x8 : 
>> [2.897793] x7 :  x6 : 01ac
>> [2.897799] x5 :  x4 : 
>> [2.897804] x3 : 0010 x2 : 0010
>> [2.897810] x1 : ffc97624c010 x0 : 01ac
>> ...
>> [2.898494] Call trace:
>> [2.898499] Exception stack(0xffc9768ab1a0 to 0xffc9768ab2c0)
>> [2.898506] b1a0: ffc9763da000 0004 ffc9768ab360
>> ff80083465fc
>> [2.898513] b1c0: ffc976801e00 ffc9762b8000 ffc9768ab1f0
>> ff80080ec158
>> [2.898520] b1e0: ffc9768ab230 ff8008496d04 ffc975ce6d80
>> ffc9768ab36e
>> [2.898527] b200: ffc9768ab36f ffc9768ab29d ffc9768ab29e
>> ffc9768a
>> [2.898533] b220: ffc9768ab250 ff80080e70c0 ffc9768ab270
>> ff8008496e44
>> [2.898540] b240: 01ac ffc97624c010 0010
>> 0010
>> [2.898546] b260:   01ac
>> 
>> [2.898552] b280:   fb00
>> 
>> [2.898558] b2a0: ffc9768a0080 00e31b70 0001
>> 0001
>> [2.898566] [] __memcpy+0x7c/0x180
>> [2.898574] [] nv04_fbcon_imageblit+0x1d4/0x2e8
>> [2.898582] [] nouveau_fbcon_imageblit+0xd8/0xe0
>> [2.898591] [] soft_cursor+0x154/0x1d8
>> [2.898598] [] bit_cursor+0x4fc/0x538
>> [2.898605] [] fbcon_cursor+0x134/0x1a8
>> [2.898613] [] hide_cursor+0x38/0xa0
>> [2.898620] [] redraw_screen+0x120/0x228
>> [2.898628] [] fbcon_prepare_logo+0x370/0x3f8
>> [2.898635] [] fbcon_init+0x350/0x560
>> [2.898641] [] visual_init+0xac/0x108
>> [2.898648] [] do_bind_con_driver+0x1c4/0x3a8
>> [2.898655] [] do_take_over_console+0x174/0x1e8
>> [2.898662] [] do_fbcon_takeover+0x74/0x100
>> [2.898669] [] fbcon_event_notify+0x8cc/0x920
>> [2.898680] [] notifier_call_chain+0x50/0x90
>> [2.898685] []
>> __blocking_notifier_call_chain+0x4c/0x90
>> [2.898691] [] blocking_notifier_call_chain+0x14/0x20
>> [2.898696] [] fb_notifier_call_chain+0x1c/0x28
>> [2.898703] [] register_framebuffer+0x1cc/0x2e0
>> [2.898712] []
>> drm_fb_helper_initial_config+0x288/0x3e8
>> [2.898719] [] nouveau_fbcon_init+0xe0/0x118
>> [2.898727] [] nouveau_drm_load+0x268/0x890
>> [2.898734] [] drm_dev_register+0xbc/0xc8
>> [2.898740] [] drm_get_pci_dev+0xa0/0x180
>> [2.898747] [] nouveau_drm_probe+0x1a0/0x1e0
>> [2.898755] [] pci_device_probe+0x98/0x110
>> [2.898763] [] driver_probe_device+0x204/0x2b0
>> [2.898770] [] __driver_attach+0xac/0xb0
>> [

Re: [Nouveau] [PATCH v2] Revert "drm/nouveau/device/pci: set as non-CPU-coherent on ARM64"

2016-06-06 Thread Robin Murphy

On 06/06/16 08:11, Alexandre Courbot wrote:

From: Robin Murphy 

This reverts commit 1733a2ad36741b1812cf8b3f3037c28d0af53f50.

There is apparently something amiss with the way the TTM code handles
DMA buffers, which the above commit was attempting to work around for
arm64 systems with non-coherent PCI. Unfortunately, this completely
breaks systems *with* coherent PCI (which appear to be the majority).

Booting a plain arm64 defconfig + CONFIG_DRM + CONFIG_DRM_NOUVEAU on
a machine with a PCI GPU having coherent dma_map_ops (in this case a
7600GT card plugged into an ARM Juno board) results in a fatal crash:

[2.803438] nouveau :06:00.0: DRM: allocated 1024x768 fb: 0x9000, bo 
ffc976141c00
[2.897662] Unable to handle kernel NULL pointer dereference at virtual 
address 01ac
[2.897666] pgd = ff8008e0
[2.897675] [01ac] *pgd=0009e003, *pud=0009e003, 
*pmd=
[2.897680] Internal error: Oops: 9645 [#1] PREEMPT SMP
[2.897685] Modules linked in:
[2.897692] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc5+ #543
[2.897694] Hardware name: ARM Juno development board (r1) (DT)
[2.897699] task: ffc9768a ti: ffc9768a8000 task.ti: 
ffc9768a8000
[2.897711] PC is at __memcpy+0x7c/0x180
[2.897719] LR is at OUT_RINGp+0x34/0x70
[2.897724] pc : [] lr : [] pstate: 
8045
[2.897726] sp : ffc9768ab360
[2.897732] x29: ffc9768ab360 x28: 0001
[2.897738] x27: ffc97624c000 x26: 
[2.897744] x25: 0080 x24: 6c00
[2.897749] x23: 0005 x22: ffc97624c010
[2.897755] x21: 0004 x20: 0004
[2.897761] x19: ffc9763da000 x18: ffc976b2491c
[2.897766] x17: 0007 x16: 0006
[2.897771] x15: 0001 x14: 0001
[2.89] x13: 00e31b70 x12: ffc9768a0080
[2.897783] x11:  x10: fb00
[2.897788] x9 :  x8 : 
[2.897793] x7 :  x6 : 01ac
[2.897799] x5 :  x4 : 
[2.897804] x3 : 0010 x2 : 0010
[2.897810] x1 : ffc97624c010 x0 : 01ac
...
[2.898494] Call trace:
[2.898499] Exception stack(0xffc9768ab1a0 to 0xffc9768ab2c0)
[2.898506] b1a0: ffc9763da000 0004 ffc9768ab360 
ff80083465fc
[2.898513] b1c0: ffc976801e00 ffc9762b8000 ffc9768ab1f0 
ff80080ec158
[2.898520] b1e0: ffc9768ab230 ff8008496d04 ffc975ce6d80 
ffc9768ab36e
[2.898527] b200: ffc9768ab36f ffc9768ab29d ffc9768ab29e 
ffc9768a
[2.898533] b220: ffc9768ab250 ff80080e70c0 ffc9768ab270 
ff8008496e44
[2.898540] b240: 01ac ffc97624c010 0010 
0010
[2.898546] b260:   01ac 

[2.898552] b280:   fb00 

[2.898558] b2a0: ffc9768a0080 00e31b70 0001 
0001
[2.898566] [] __memcpy+0x7c/0x180
[2.898574] [] nv04_fbcon_imageblit+0x1d4/0x2e8
[2.898582] [] nouveau_fbcon_imageblit+0xd8/0xe0
[2.898591] [] soft_cursor+0x154/0x1d8
[2.898598] [] bit_cursor+0x4fc/0x538
[2.898605] [] fbcon_cursor+0x134/0x1a8
[2.898613] [] hide_cursor+0x38/0xa0
[2.898620] [] redraw_screen+0x120/0x228
[2.898628] [] fbcon_prepare_logo+0x370/0x3f8
[2.898635] [] fbcon_init+0x350/0x560
[2.898641] [] visual_init+0xac/0x108
[2.898648] [] do_bind_con_driver+0x1c4/0x3a8
[2.898655] [] do_take_over_console+0x174/0x1e8
[2.898662] [] do_fbcon_takeover+0x74/0x100
[2.898669] [] fbcon_event_notify+0x8cc/0x920
[2.898680] [] notifier_call_chain+0x50/0x90
[2.898685] [] __blocking_notifier_call_chain+0x4c/0x90
[2.898691] [] blocking_notifier_call_chain+0x14/0x20
[2.898696] [] fb_notifier_call_chain+0x1c/0x28
[2.898703] [] register_framebuffer+0x1cc/0x2e0
[2.898712] [] drm_fb_helper_initial_config+0x288/0x3e8
[2.898719] [] nouveau_fbcon_init+0xe0/0x118
[2.898727] [] nouveau_drm_load+0x268/0x890
[2.898734] [] drm_dev_register+0xbc/0xc8
[2.898740] [] drm_get_pci_dev+0xa0/0x180
[2.898747] [] nouveau_drm_probe+0x1a0/0x1e0
[2.898755] [] pci_device_probe+0x98/0x110
[2.898763] [] driver_probe_device+0x204/0x2b0
[2.898770] [] __driver_attach+0xac/0xb0
[2.898777] [] bus_for_each_dev+0x60/0xa0
[2.898783] [] driver_attach+0x20/0x28
[2.898789] [] bus_add_driver+0x1d0/0x238
[2.898796] [] driver_register+0x60/0xf8
[2.898802] [] __pci_register_driver+0x3c/0x48
[2.898809] [] drm_pci_init+0xf4/0x120
[2.898818] [] nouveau_drm_init+0x21c/0x230
[2.898825] [] do_one_initcall+0x8c/0x190
[

[Nouveau] [PATCH v2] Revert "drm/nouveau/device/pci: set as non-CPU-coherent on ARM64"

2016-06-06 Thread Alexandre Courbot
From: Robin Murphy 

This reverts commit 1733a2ad36741b1812cf8b3f3037c28d0af53f50.

There is apparently something amiss with the way the TTM code handles
DMA buffers, which the above commit was attempting to work around for
arm64 systems with non-coherent PCI. Unfortunately, this completely
breaks systems *with* coherent PCI (which appear to be the majority).

Booting a plain arm64 defconfig + CONFIG_DRM + CONFIG_DRM_NOUVEAU on
a machine with a PCI GPU having coherent dma_map_ops (in this case a
7600GT card plugged into an ARM Juno board) results in a fatal crash:

[2.803438] nouveau :06:00.0: DRM: allocated 1024x768 fb: 0x9000, bo 
ffc976141c00
[2.897662] Unable to handle kernel NULL pointer dereference at virtual 
address 01ac
[2.897666] pgd = ff8008e0
[2.897675] [01ac] *pgd=0009e003, *pud=0009e003, 
*pmd=
[2.897680] Internal error: Oops: 9645 [#1] PREEMPT SMP
[2.897685] Modules linked in:
[2.897692] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc5+ #543
[2.897694] Hardware name: ARM Juno development board (r1) (DT)
[2.897699] task: ffc9768a ti: ffc9768a8000 task.ti: 
ffc9768a8000
[2.897711] PC is at __memcpy+0x7c/0x180
[2.897719] LR is at OUT_RINGp+0x34/0x70
[2.897724] pc : [] lr : [] pstate: 
8045
[2.897726] sp : ffc9768ab360
[2.897732] x29: ffc9768ab360 x28: 0001
[2.897738] x27: ffc97624c000 x26: 
[2.897744] x25: 0080 x24: 6c00
[2.897749] x23: 0005 x22: ffc97624c010
[2.897755] x21: 0004 x20: 0004
[2.897761] x19: ffc9763da000 x18: ffc976b2491c
[2.897766] x17: 0007 x16: 0006
[2.897771] x15: 0001 x14: 0001
[2.89] x13: 00e31b70 x12: ffc9768a0080
[2.897783] x11:  x10: fb00
[2.897788] x9 :  x8 : 
[2.897793] x7 :  x6 : 01ac
[2.897799] x5 :  x4 : 
[2.897804] x3 : 0010 x2 : 0010
[2.897810] x1 : ffc97624c010 x0 : 01ac
...
[2.898494] Call trace:
[2.898499] Exception stack(0xffc9768ab1a0 to 0xffc9768ab2c0)
[2.898506] b1a0: ffc9763da000 0004 ffc9768ab360 
ff80083465fc
[2.898513] b1c0: ffc976801e00 ffc9762b8000 ffc9768ab1f0 
ff80080ec158
[2.898520] b1e0: ffc9768ab230 ff8008496d04 ffc975ce6d80 
ffc9768ab36e
[2.898527] b200: ffc9768ab36f ffc9768ab29d ffc9768ab29e 
ffc9768a
[2.898533] b220: ffc9768ab250 ff80080e70c0 ffc9768ab270 
ff8008496e44
[2.898540] b240: 01ac ffc97624c010 0010 
0010
[2.898546] b260:   01ac 

[2.898552] b280:   fb00 

[2.898558] b2a0: ffc9768a0080 00e31b70 0001 
0001
[2.898566] [] __memcpy+0x7c/0x180
[2.898574] [] nv04_fbcon_imageblit+0x1d4/0x2e8
[2.898582] [] nouveau_fbcon_imageblit+0xd8/0xe0
[2.898591] [] soft_cursor+0x154/0x1d8
[2.898598] [] bit_cursor+0x4fc/0x538
[2.898605] [] fbcon_cursor+0x134/0x1a8
[2.898613] [] hide_cursor+0x38/0xa0
[2.898620] [] redraw_screen+0x120/0x228
[2.898628] [] fbcon_prepare_logo+0x370/0x3f8
[2.898635] [] fbcon_init+0x350/0x560
[2.898641] [] visual_init+0xac/0x108
[2.898648] [] do_bind_con_driver+0x1c4/0x3a8
[2.898655] [] do_take_over_console+0x174/0x1e8
[2.898662] [] do_fbcon_takeover+0x74/0x100
[2.898669] [] fbcon_event_notify+0x8cc/0x920
[2.898680] [] notifier_call_chain+0x50/0x90
[2.898685] [] __blocking_notifier_call_chain+0x4c/0x90
[2.898691] [] blocking_notifier_call_chain+0x14/0x20
[2.898696] [] fb_notifier_call_chain+0x1c/0x28
[2.898703] [] register_framebuffer+0x1cc/0x2e0
[2.898712] [] drm_fb_helper_initial_config+0x288/0x3e8
[2.898719] [] nouveau_fbcon_init+0xe0/0x118
[2.898727] [] nouveau_drm_load+0x268/0x890
[2.898734] [] drm_dev_register+0xbc/0xc8
[2.898740] [] drm_get_pci_dev+0xa0/0x180
[2.898747] [] nouveau_drm_probe+0x1a0/0x1e0
[2.898755] [] pci_device_probe+0x98/0x110
[2.898763] [] driver_probe_device+0x204/0x2b0
[2.898770] [] __driver_attach+0xac/0xb0
[2.898777] [] bus_for_each_dev+0x60/0xa0
[2.898783] [] driver_attach+0x20/0x28
[2.898789] [] bus_add_driver+0x1d0/0x238
[2.898796] [] driver_register+0x60/0xf8
[2.898802] [] __pci_register_driver+0x3c/0x48
[2.898809] [] drm_pci_init+0xf4/0x120
[2.898818] [] nouveau_drm_init+0x21c/0x230
[2.898825] [] do_one_initcall+0x8c/0x190
[2.898832] [] kernel_init_freeable+0x14c/0x1f0
[