Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sunxi-next drm can't set unusual resolutions #291

Open
cnlohr opened this issue Mar 13, 2018 · 4 comments
Open

sunxi-next drm can't set unusual resolutions #291

cnlohr opened this issue Mar 13, 2018 · 4 comments

Comments

@cnlohr
Copy link

cnlohr commented Mar 13, 2018

I'm trying to use the H3 in conjunction with the HTC Vive. I'm having a ton of issues getting the kernel to do the mandatory resolution the vive requires, though uboot seems to have no problem at all.

2160x1200p90 is the mode, and is listed in the modelines from the EDID (you can see below)

I've thrown a lot of XXX debugging into the module to try to understand where things are going awry, but no dice.

[    4.029671] platform mali-utgard: assigned reserved memory node linux,cma
[    4.030241] Allwinner sunXi mali glue initialized
[    4.030712] Mali: 
[    4.030718] Found Mali GPU Mali-400 MP r1p1
[    4.031348] Mali: 
[    4.031355] 2+0 PP cores initialized
[    4.031958] Mali: 
[    4.031963] Mali device driver loaded
[    4.075858] EXT4-fs (mmcblk0p1): re-mounted. Opts: commit=600,errors=remount-ro
[    4.524592] Adding 131068k swap on /var/swap.  Priority:-2 extents:2 across:139260k SS
[    5.183957] [drm:drm_core_init [drm]] Initialized
[    5.318388] [drm:sun4i_drv_probe [sun4i_drm]] Adding component /soc/mixer@1100000
[    5.318474] [drm:sun4i_drv_probe [sun4i_drm]] Adding component /soc/lcd-controller@1c0c000
[    5.318537] [drm:sun4i_drv_probe [sun4i_drm]] Adding component /soc/hdmi@1ee0000
[    5.318618] [drm:compare_of [sun4i_drm]] Comparing of node /soc/lcd-controller@1c0c000 with /soc/mixer@1100000
[    5.318634] [drm:compare_of [sun4i_drm]] Comparing of node /soc/mixer@1100000 with /soc/mixer@1100000
[    5.318648] [drm:compare_of [sun4i_drm]] Comparing of node /soc/lcd-controller@1c0c000 with /soc/lcd-controller@1c0c000
[    5.318661] [drm:compare_of [sun4i_drm]] Comparing of node /soc/lcd-controller@1c0c000 with /soc/hdmi@1ee0000
[    5.318675] [drm:compare_of [sun4i_drm]] Comparing of node /soc/mixer@1100000 with /soc/hdmi@1ee0000
[    5.318689] [drm:compare_of [sun4i_drm]] Comparing of node /soc/hdmi@1ee0000 with /soc/hdmi@1ee0000
[    5.329132] sun4i-drm display-engine: bound 1100000.mixer (ops sun8i_mixer_platform_driver_exit [sun8i_mixer])
[    5.329547] sun4i-drm display-engine: No panel or bridge found... RGB output disabled
[    5.329575] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops sun4i_tcon_platform_driver_exit [sun4i_tcon])
[    5.367498] sun8i-dw-hdmi 1ee0000.hdmi: Detected HDMI TX controller v1.32a with HDCP (sun8i_dw_hdmi_phy)
[    5.372160] sun8i-dw-hdmi 1ee0000.hdmi: registered DesignWare HDMI I2C bus driver
[    5.372952] sun4i-drm display-engine: bound 1ee0000.hdmi (ops sun8i_dw_hdmi_pltfm_driver_exit [sun8i_drm_hdmi])
[    5.372965] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    5.372968] [drm] No driver support for vblank timestamp query.
[    5.372977] checking generic (5e000000 9e3400) vs hw (0 ffffffff)
[    5.372981] fb: switching to sun4i-drm-fb from simple
[    5.373223] Console: switching to colour dummy device 80x30
[    5.378780] [drm:drm_mode_object_get [drm]] OBJ ID: 38 (2)
[    5.378845] [drm:drm_setup_crtcs [drm_kms_helper]] 
[    5.378871] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:38:HDMI-A-1]
[    5.378906] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:38:HDMI-A-1] status updated from unknown to connected
[    5.658006] [drm:drm_detect_monitor_audio [drm]] Monitor has basic audio support
[    5.658064] [drm:drm_add_display_info [drm]] non_desktop set to 1
[    5.658114] [drm:drm_add_display_info [drm]] HDMI: DVI dual 0, max TMDS clock 0 kHz
[    5.658206] [drm:drm_add_edid_modes [drm]] ELD monitor HTC-VIVE
[    5.658261] [drm:drm_add_edid_modes [drm]] HDMI: latency present 0 0, video latency 0 0, audio latency 0 0
[    5.658302] [drm:drm_add_edid_modes [drm]] ELD size 32, SAD count 1
[    5.658344] [drm:drm_add_display_info [drm]] non_desktop set to 1
[    5.658385] [drm:drm_add_display_info [drm]] HDMI: DVI dual 0, max TMDS clock 0 kHz
[    5.658912] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:38:HDMI-A-1] probed modes :
[    5.659005] [drm:drm_mode_debug_printmodeline [drm]] Modeline 40:"2160x1200" 90 297000 2160 2200 2220 2266 1200 1228 1230 1464 0x48 0xa
[    5.659053] [drm:drm_mode_debug_printmodeline [drm]] Modeline 49:"720x480" 60 27027 720 736 798 858 480 489 495 525 0x40 0xa
[    5.659098] [drm:drm_mode_debug_printmodeline [drm]] Modeline 47:"720x480" 60 27000 720 736 798 858 480 489 495 525 0x40 0xa
[    5.659143] [drm:drm_mode_debug_printmodeline [drm]] Modeline 48:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[    5.659187] [drm:drm_mode_debug_printmodeline [drm]] Modeline 46:"640x480" 60 25175 640 656 752 800 480 490 492 525 0x40 0xa
[    5.659226] [drm:drm_setup_crtcs [drm_kms_helper]] XXX drm_fb_helper_probe_connector_modes: 10 8192 8192 84a1ed8f
[    5.659264] [drm:drm_setup_crtcs [drm_kms_helper]] connector 38 enabled? non desktop
[    5.659289] [drm:drm_setup_crtcs [drm_kms_helper]] Next in line.  Config data:   (null) 8192 8192
[    5.659313] [drm:drm_setup_crtcs [drm_kms_helper]] picking CRTCs for 8192x8192 config
[    5.659336] [drm:drm_setup_crtcs [drm_kms_helper]] XXX Pre_modset_release 1
[    5.659358] [drm:drm_setup_crtcs [drm_kms_helper]] XXX Debug mode=  (null) fb_crtc=  (null)
[    5.659369] [drm] XXX CNL: desired_mode=0 mode_set=-665837504
[    5.659372] [drm] ___XXX___ -1 -1
[    5.659375] [drm] Cannot find any crtc or sizes
[    5.659434] [drm:drm_atomic_state_init [drm]] Allocated atomic state d5e72352
[    5.659486] [drm:drm_atomic_get_plane_state [drm]] Added [PLANE:28:plane-0] 39c75788 state to d5e72352
[    5.659532] [drm:drm_atomic_set_crtc_for_plane [drm]] Link plane state 39c75788 to [NOCRTC]
[    5.659573] [drm:drm_atomic_set_fb_for_plane [drm]] Set [NOFB] for plane state 39c75788
[    5.659618] [drm:drm_atomic_get_plane_state [drm]] Added [PLANE:30:plane-1] d3955aca state to d5e72352
[    5.659663] [drm:drm_atomic_get_plane_state [drm]] Added [PLANE:32:plane-2] 471b2c89 state to d5e72352
[    5.659705] [drm:drm_atomic_set_crtc_for_plane [drm]] Link plane state 471b2c89 to [NOCRTC]
[    5.659745] [drm:drm_atomic_set_fb_for_plane [drm]] Set [NOFB] for plane state 471b2c89
[    5.659836] [drm:drm_atomic_get_plane_state [drm]] Added [PLANE:34:plane-3] 53e72888 state to d5e72352
[    5.659893] [drm:drm_atomic_set_crtc_for_plane [drm]] Link plane state 53e72888 to [NOCRTC]
[    5.659965] [drm:drm_atomic_set_fb_for_plane [drm]] Set [NOFB] for plane state 53e72888
[    5.660041] [drm:drm_atomic_get_crtc_state [drm]] Added [CRTC:36:crtc-0] 97fff981 state to d5e72352
[    5.660108] [drm:drm_atomic_set_mode_for_crtc [drm]] Set [NOMODE] for CRTC state 97fff981
[    5.660157] [drm:drm_atomic_set_crtc_for_plane [drm]] Link plane state d3955aca to [NOCRTC]
[    5.660199] [drm:drm_atomic_set_fb_for_plane [drm]] Set [NOFB] for plane state d3955aca
[    5.660247] [drm:drm_atomic_add_affected_connectors [drm]] Adding all current connectors for [CRTC:36:crtc-0] to d5e72352
[    5.660294] [drm:drm_atomic_check_only [drm]] checking d5e72352
[    5.660361] [drm:drm_atomic_commit [drm]] committing d5e72352
[    5.660457] [drm:drm_atomic_state_default_clear [drm]] Clearing atomic state d5e72352
[    5.660511] [drm:__drm_atomic_state_free [drm]] Freeing atomic state d5e72352
[    5.660570] [drm:drm_minor_register [drm]] 
[    5.660608] [drm:drm_minor_register [drm]] 
[    5.660646] [drm:drm_minor_register [drm]] 
[    5.661116] [drm:drm_minor_register [drm]] new minor registered 0
[    5.661344] [drm:drm_sysfs_connector_add [drm]] adding "HDMI-A-1" to sysfs
[    5.661393] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event
[    5.661478] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    6.415147] systemd-journald[380]: Received request to flush runtime journal from PID 1
[    6.453057] Generic PHY 0.1:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0.1:01, irq=POLL)
[    6.454889] dwmac-sun8i 1c30000.ethernet eth0: No MAC Management Counters available
[    6.454901] dwmac-sun8i 1c30000.ethernet eth0: PTP not supported by HW
[    6.718536] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event
[    6.718670] [drm:drm_setup_crtcs [drm_kms_helper]] 
[    6.718702] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:38:HDMI-A-1]
[    6.926698] [drm:drm_detect_monitor_audio [drm]] Monitor has basic audio support
[    6.926754] [drm:drm_add_display_info [drm]] non_desktop set to 1
[    6.926798] [drm:drm_add_display_info [drm]] HDMI: DVI dual 0, max TMDS clock 0 kHz
[    6.926856] [drm:drm_mode_object_put [drm]] OBJ ID: 39 (1)
[    6.926915] [drm:drm_add_edid_modes [drm]] ELD monitor HTC-VIVE
[    6.926960] [drm:drm_add_edid_modes [drm]] HDMI: latency present 0 0, video latency 0 0, audio latency 0 0
[    6.927000] [drm:drm_add_edid_modes [drm]] ELD size 32, SAD count 1
[    6.927040] [drm:drm_add_display_info [drm]] non_desktop set to 1
[    6.927080] [drm:drm_add_display_info [drm]] HDMI: DVI dual 0, max TMDS clock 0 kHz
[    6.927545] [drm:drm_helper_probe_single_connector_modes [drm_kms_helper]] [CONNECTOR:38:HDMI-A-1] probed modes :
[    6.927603] [drm:drm_mode_debug_printmodeline [drm]] Modeline 40:"2160x1200" 90 297000 2160 2200 2220 2266 1200 1228 1230 1464 0x48 0xa
[    6.927649] [drm:drm_mode_debug_printmodeline [drm]] Modeline 49:"720x480" 60 27027 720 736 798 858 480 489 495 525 0x40 0xa
[    6.927694] [drm:drm_mode_debug_printmodeline [drm]] Modeline 47:"720x480" 60 27000 720 736 798 858 480 489 495 525 0x40 0xa
[    6.927738] [drm:drm_mode_debug_printmodeline [drm]] Modeline 48:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[    6.927781] [drm:drm_mode_debug_printmodeline [drm]] Modeline 46:"640x480" 60 25175 640 656 752 800 480 490 492 525 0x40 0xa
[    6.927813] [drm:drm_setup_crtcs [drm_kms_helper]] XXX drm_fb_helper_probe_connector_modes: 10 8192 8192 84a1ed8f
[    6.927836] [drm:drm_setup_crtcs [drm_kms_helper]] connector 38 enabled? non desktop
[    6.927861] [drm:drm_setup_crtcs [drm_kms_helper]] Next in line.  Config data:   (null) 8192 8192
[    6.927885] [drm:drm_setup_crtcs [drm_kms_helper]] picking CRTCs for 8192x8192 config
[    6.927907] [drm:drm_setup_crtcs [drm_kms_helper]] XXX Pre_modset_release 1
[    6.927930] [drm:drm_setup_crtcs [drm_kms_helper]] XXX Debug mode=  (null) fb_crtc=  (null)
[    6.927939] [drm] XXX CNL: desired_mode=0 mode_set=-665837504
[    6.927942] [drm] ___XXX___ -1 -1
[    6.927945] [drm] Cannot find any crtc or sizes

/proc/cmdline:

root=UUID=a769471e-a787-40d3-8298-d31c195f1bb9
rootwait
rootfstype=ext4
console=tty1
console=ttyS0,115200
hdmi.audio=EDID:0
disp.screen0_output_mode=EDID:2160x1200p90
panic=10
consoleblank=0
loglevel=1
ubootpart=67b5d560-01
ubootsource=mmc
usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u
cma=256M
drm_kms_helper.drm_fbdev_overalloc=200
drm.debug=0xff 
sunxi_ve_mem_reserve=0
sunxi_g2d_mem_reserve=0
sunxi_fb_mem_reserve=16
cgroup_enable=memory swapaccount=1

Any idea what's going on here, or why the drm_fb_helper.c file is skipping over all the possible modelines?

P.S. h3disp gives me a sad time dealing with the kernel if I try running it but I can't see any way to command it to do custom modes anyway.

@cnlohr
Copy link
Author

cnlohr commented Mar 14, 2018

So... I found the problem...

index 035784ddd..c8bd01354 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -2110,7 +2113,8 @@ static bool drm_connector_enabled(struct drm_connector *connector, bool strict)
        bool enable;
 
        if (connector->display_info.non_desktop)
-               return false;
+               DRM_DEBUG_KMS( "XXX WARNING NON-DESKTOP OUTPUT ENABLED\n" );
+//             return false;
 
        if (strict)
                enable = connector->status == connector_status_connected;

But this raises some very big questions, like why are non-desktop displays not allowed to be framebuffers?!? Would I get shot down if I made a patch that just did away with this code?

As soon as I comment out that line of code, everything, 3D acceleration and all works on my HTC Vive.

I will probably make a mailing list entry tomorrow.

@cnlohr
Copy link
Author

cnlohr commented Mar 14, 2018

I just found the offending patch:

https://lists.freedesktop.org/archives/dri-devel/2017-November/157322.html

Does that mean my complaint must go upstream?

amery pushed a commit that referenced this issue Nov 3, 2018
When switching to the new iovec accessors, a negation got subtly
dropped, leading to 9p being remarkably broken (here with kvmtool):

[    7.430941] VFS: Mounted root (9p filesystem) on device 0:15.
[    7.432080] devtmpfs: mounted
[    7.432717] Freeing unused kernel memory: 1344K
[    7.433658] Run /virt/init as init process
  Warning: unable to translate guest address 0x7e00902ff000 to host
  Warning: unable to translate guest address 0x7e00902fefc0 to host
  Warning: unable to translate guest address 0x7e00902ff000 to host
  Warning: unable to translate guest address 0x7e008febef80 to host
  Warning: unable to translate guest address 0x7e008febf000 to host
  Warning: unable to translate guest address 0x7e008febef00 to host
  Warning: unable to translate guest address 0x7e008febf000 to host
[    7.436376] Kernel panic - not syncing: Requested init /virt/init failed (error -8).
[    7.437554] CPU: 29 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc8-02267-g00e23707442a #291
[    7.439006] Hardware name: linux,dummy-virt (DT)
[    7.439902] Call trace:
[    7.440387]  dump_backtrace+0x0/0x148
[    7.441104]  show_stack+0x14/0x20
[    7.441768]  dump_stack+0x90/0xb4
[    7.442425]  panic+0x120/0x27c
[    7.443036]  kernel_init+0xa4/0x100
[    7.443725]  ret_from_fork+0x10/0x18
[    7.444444] SMP: stopping secondary CPUs
[    7.445391] Kernel Offset: disabled
[    7.446169] CPU features: 0x0,23000438
[    7.446974] Memory Limit: none
[    7.447645] ---[ end Kernel panic - not syncing: Requested init /virt/init failed (error -8). ]---

Restoring the missing "!" brings the guest back to life.

Fixes: 00e2370 ("iov_iter: Use accessor function")
Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
jwrdegoede pushed a commit to jwrdegoede/linux-sunxi that referenced this issue Feb 27, 2019
Booting 4.20 on SolidRun Clearfog issues this warning with DMA API
debug enabled:

WARNING: CPU: 0 PID: 555 at kernel/dma/debug.c:1230 check_sync+0x514/0x5bc
mvneta f1070000.ethernet: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000002dd7dc00] [size=240 bytes]
Modules linked in: ahci mv88e6xxx dsa_core xhci_plat_hcd xhci_hcd devlink armada_thermal marvell_cesa des_generic ehci_orion phy_armada38x_comphy mcp3021 spi_orion evbug sfp mdio_i2c ip_tables x_tables
CPU: 0 PID: 555 Comm: bridge-network- Not tainted 4.20.0+ linux-sunxi#291
Hardware name: Marvell Armada 380/385 (Device Tree)
[<c0019638>] (unwind_backtrace) from [<c0014888>] (show_stack+0x10/0x14)
[<c0014888>] (show_stack) from [<c07f54e0>] (dump_stack+0x9c/0xd4)
[<c07f54e0>] (dump_stack) from [<c00312bc>] (__warn+0xf8/0x124)
[<c00312bc>] (__warn) from [<c00313b0>] (warn_slowpath_fmt+0x38/0x48)
[<c00313b0>] (warn_slowpath_fmt) from [<c00b0370>] (check_sync+0x514/0x5bc)
[<c00b0370>] (check_sync) from [<c00b04f8>] (debug_dma_sync_single_range_for_cpu+0x6c/0x74)
[<c00b04f8>] (debug_dma_sync_single_range_for_cpu) from [<c051bd14>] (mvneta_poll+0x298/0xf58)
[<c051bd14>] (mvneta_poll) from [<c0656194>] (net_rx_action+0x128/0x424)
[<c0656194>] (net_rx_action) from [<c000a230>] (__do_softirq+0xf0/0x540)
[<c000a230>] (__do_softirq) from [<c00386e0>] (irq_exit+0x124/0x144)
[<c00386e0>] (irq_exit) from [<c009b5e0>] (__handle_domain_irq+0x58/0xb0)
[<c009b5e0>] (__handle_domain_irq) from [<c03a63c4>] (gic_handle_irq+0x48/0x98)
[<c03a63c4>] (gic_handle_irq) from [<c0009a10>] (__irq_svc+0x70/0x98)
...

This appears to be caused by mvneta_rx_hwbm() calling
dma_sync_single_range_for_cpu() with the wrong struct device pointer,
as the buffer manager device pointer is used to map and unmap the
buffer.  Fix this.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
repojohnray pushed a commit to repojohnray/linux-sunxi-4.7.y that referenced this issue Mar 24, 2019
[ Upstream commit a8fef9b ]

Booting 4.20 on SolidRun Clearfog issues this warning with DMA API
debug enabled:

WARNING: CPU: 0 PID: 555 at kernel/dma/debug.c:1230 check_sync+0x514/0x5bc
mvneta f1070000.ethernet: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000002dd7dc00] [size=240 bytes]
Modules linked in: ahci mv88e6xxx dsa_core xhci_plat_hcd xhci_hcd devlink armada_thermal marvell_cesa des_generic ehci_orion phy_armada38x_comphy mcp3021 spi_orion evbug sfp mdio_i2c ip_tables x_tables
CPU: 0 PID: 555 Comm: bridge-network- Not tainted 4.20.0+ linux-sunxi#291
Hardware name: Marvell Armada 380/385 (Device Tree)
[<c0019638>] (unwind_backtrace) from [<c0014888>] (show_stack+0x10/0x14)
[<c0014888>] (show_stack) from [<c07f54e0>] (dump_stack+0x9c/0xd4)
[<c07f54e0>] (dump_stack) from [<c00312bc>] (__warn+0xf8/0x124)
[<c00312bc>] (__warn) from [<c00313b0>] (warn_slowpath_fmt+0x38/0x48)
[<c00313b0>] (warn_slowpath_fmt) from [<c00b0370>] (check_sync+0x514/0x5bc)
[<c00b0370>] (check_sync) from [<c00b04f8>] (debug_dma_sync_single_range_for_cpu+0x6c/0x74)
[<c00b04f8>] (debug_dma_sync_single_range_for_cpu) from [<c051bd14>] (mvneta_poll+0x298/0xf58)
[<c051bd14>] (mvneta_poll) from [<c0656194>] (net_rx_action+0x128/0x424)
[<c0656194>] (net_rx_action) from [<c000a230>] (__do_softirq+0xf0/0x540)
[<c000a230>] (__do_softirq) from [<c00386e0>] (irq_exit+0x124/0x144)
[<c00386e0>] (irq_exit) from [<c009b5e0>] (__handle_domain_irq+0x58/0xb0)
[<c009b5e0>] (__handle_domain_irq) from [<c03a63c4>] (gic_handle_irq+0x48/0x98)
[<c03a63c4>] (gic_handle_irq) from [<c0009a10>] (__irq_svc+0x70/0x98)
...

This appears to be caused by mvneta_rx_hwbm() calling
dma_sync_single_range_for_cpu() with the wrong struct device pointer,
as the buffer manager device pointer is used to map and unmap the
buffer.  Fix this.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
repojohnray pushed a commit to repojohnray/linux-sunxi-4.7.y that referenced this issue Mar 27, 2019
[ Upstream commit a8fef9b ]

Booting 4.20 on SolidRun Clearfog issues this warning with DMA API
debug enabled:

WARNING: CPU: 0 PID: 555 at kernel/dma/debug.c:1230 check_sync+0x514/0x5bc
mvneta f1070000.ethernet: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000002dd7dc00] [size=240 bytes]
Modules linked in: ahci mv88e6xxx dsa_core xhci_plat_hcd xhci_hcd devlink armada_thermal marvell_cesa des_generic ehci_orion phy_armada38x_comphy mcp3021 spi_orion evbug sfp mdio_i2c ip_tables x_tables
CPU: 0 PID: 555 Comm: bridge-network- Not tainted 4.20.0+ linux-sunxi#291
Hardware name: Marvell Armada 380/385 (Device Tree)
[<c0019638>] (unwind_backtrace) from [<c0014888>] (show_stack+0x10/0x14)
[<c0014888>] (show_stack) from [<c07f54e0>] (dump_stack+0x9c/0xd4)
[<c07f54e0>] (dump_stack) from [<c00312bc>] (__warn+0xf8/0x124)
[<c00312bc>] (__warn) from [<c00313b0>] (warn_slowpath_fmt+0x38/0x48)
[<c00313b0>] (warn_slowpath_fmt) from [<c00b0370>] (check_sync+0x514/0x5bc)
[<c00b0370>] (check_sync) from [<c00b04f8>] (debug_dma_sync_single_range_for_cpu+0x6c/0x74)
[<c00b04f8>] (debug_dma_sync_single_range_for_cpu) from [<c051bd14>] (mvneta_poll+0x298/0xf58)
[<c051bd14>] (mvneta_poll) from [<c0656194>] (net_rx_action+0x128/0x424)
[<c0656194>] (net_rx_action) from [<c000a230>] (__do_softirq+0xf0/0x540)
[<c000a230>] (__do_softirq) from [<c00386e0>] (irq_exit+0x124/0x144)
[<c00386e0>] (irq_exit) from [<c009b5e0>] (__handle_domain_irq+0x58/0xb0)
[<c009b5e0>] (__handle_domain_irq) from [<c03a63c4>] (gic_handle_irq+0x48/0x98)
[<c03a63c4>] (gic_handle_irq) from [<c0009a10>] (__irq_svc+0x70/0x98)
...

This appears to be caused by mvneta_rx_hwbm() calling
dma_sync_single_range_for_cpu() with the wrong struct device pointer,
as the buffer manager device pointer is used to map and unmap the
buffer.  Fix this.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
@nikp123
Copy link

nikp123 commented Mar 26, 2021

@cnlohr Hey, just one question. Does this patch also enable LCD's to work on devices such as tablets?

Love your vids btw

@nikp123
Copy link

nikp123 commented Mar 31, 2021

Ignore that, I've figured it out. Look here (for those who have my problem): https://forum.armbian.com/topic/14560-sun4i-drm-and-lcd-panels/

jwrdegoede pushed a commit to jwrdegoede/linux-sunxi that referenced this issue Nov 22, 2021
Preset both receive and send CQ pointers prior to call to the drivers and
overwrite it later again till the mlx4 is going to be changed do not
overwrite ibqp properties.

This change is needed for mlx5, because in case of QP creation failure, it
will go to the path of QP destroy which relies on proper CQ pointers.

 BUG: KASAN: use-after-free in create_qp.cold+0x164/0x16e [mlx5_ib]
 Write of size 8 at addr ffff8880064c55c0 by task a.out/246

 CPU: 0 PID: 246 Comm: a.out Not tainted 5.15.0+ linux-sunxi#291
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
 Call Trace:
  dump_stack_lvl+0x45/0x59
  print_address_description.constprop.0+0x1f/0x140
  kasan_report.cold+0x83/0xdf
  create_qp.cold+0x164/0x16e [mlx5_ib]
  mlx5_ib_create_qp+0x358/0x28a0 [mlx5_ib]
  create_qp.part.0+0x45b/0x6a0 [ib_core]
  ib_create_qp_user+0x97/0x150 [ib_core]
  ib_uverbs_handler_UVERBS_METHOD_QP_CREATE+0x92c/0x1250 [ib_uverbs]
  ib_uverbs_cmd_verbs+0x1c38/0x3150 [ib_uverbs]
  ib_uverbs_ioctl+0x169/0x260 [ib_uverbs]
  __x64_sys_ioctl+0x866/0x14d0
  do_syscall_64+0x3d/0x90
  entry_SYSCALL_64_after_hwframe+0x44/0xae

 Allocated by task 246:
  kasan_save_stack+0x1b/0x40
  __kasan_kmalloc+0xa4/0xd0
  create_qp.part.0+0x92/0x6a0 [ib_core]
  ib_create_qp_user+0x97/0x150 [ib_core]
  ib_uverbs_handler_UVERBS_METHOD_QP_CREATE+0x92c/0x1250 [ib_uverbs]
  ib_uverbs_cmd_verbs+0x1c38/0x3150 [ib_uverbs]
  ib_uverbs_ioctl+0x169/0x260 [ib_uverbs]
  __x64_sys_ioctl+0x866/0x14d0
  do_syscall_64+0x3d/0x90
  entry_SYSCALL_64_after_hwframe+0x44/0xae

 Freed by task 246:
  kasan_save_stack+0x1b/0x40
  kasan_set_track+0x1c/0x30
  kasan_set_free_info+0x20/0x30
  __kasan_slab_free+0x10c/0x150
  slab_free_freelist_hook+0xb4/0x1b0
  kfree+0xe7/0x2a0
  create_qp.part.0+0x52b/0x6a0 [ib_core]
  ib_create_qp_user+0x97/0x150 [ib_core]
  ib_uverbs_handler_UVERBS_METHOD_QP_CREATE+0x92c/0x1250 [ib_uverbs]
  ib_uverbs_cmd_verbs+0x1c38/0x3150 [ib_uverbs]
  ib_uverbs_ioctl+0x169/0x260 [ib_uverbs]
  __x64_sys_ioctl+0x866/0x14d0
  do_syscall_64+0x3d/0x90
  entry_SYSCALL_64_after_hwframe+0x44/0xae

Fixes: 514aee6 ("RDMA: Globally allocate and release QP memory")
Link: https://lore.kernel.org/r/2dbb2e2cbb1efb188a500e5634be1d71956424ce.1636631035.git.leonro@nvidia.com
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants