Den 10.11.2017 18.01, skrev Stefan Agner:
On 2017-11-04 14:04, Noralf Trønnes wrote:Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on the fact that drm_device holds a pointer to the drm_fb_helper structure. This means that the driver doesn't have to keep track of that. Also use the drm_fb_helper functions directly.With the suspend/resume helper and this patchset applied I get: [ 0.788177] Unable to handle kernel NULL pointer dereference at virtual address 00000008
Sorry about this, Benjamin caught this as well. I will send a new version this
weekend. This is the solution:diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 0c73957d7aad..6abb0ab4e7ca 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -294,7 +294,7 @@ drm_fbdev_cma_create(struct drm_fb_helper *helper, fbi->screen_size = size; fbi->fix.smem_len = size; - if (fbdev_cma->fb_funcs->dirty) { + if (fb->funcs->dirty) { ret = drm_fbdev_cma_defio_init(fbi, obj); if (ret) goto err_cma_destroy;
[ 0.796341] pgd = 80004000 [ 0.799074] [00000008] *pgd=00000000 [ 0.802687] Internal error: Oops: 5 [#1] ARM [ 0.806981] Modules linked in: [ 0.810070] CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.0-rc3-00048-gea604dafe5ec-dirty #732 [ 0.818635] Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree) [ 0.825100] task: 8e444000 task.stack: 8e442000 [ 0.829673] PC is at drm_fbdev_cma_create+0x148/0x268 [ 0.834747] LR is at 0x10 [ 0.837388] pc : [<804867b4>] lr : [<00000010>] psr: 80000053 [ 0.843678] sp : 8e443b98 ip : 00000000 fp : 8e443bd4 [ 0.848926] r10: 8e620400 r9 : 8e623a00 r8 : 8e617240 [ 0.854179] r7 : 8e617180 r6 : 000e1000 r5 : 8e443bd8 r4 : 8e620c00 [ 0.860733] r3 : 00000000 r2 : 8ed00000 r1 : 00000000 r0 : 00000003 [ 0.867288] Flags: Nzcv IRQs on FIQs off Mode SVC_32 ISA ARM Segment none [ 0.874549] Control: 10c5387d Table: 80004059 DAC: 00000051 [ 0.880318] Process swapper (pid: 1, stack limit = 0x8e442208) [ 0.886177] Stack: (0x8e443b98 to 0x8e444000) [ 0.890560] 3b80: 00000000 00000018 [ 0.898782] 3ba0: 8e625240 00000003 80c39ecc 8e617180 00000018 8e620400 80c20428 00000001 [ 0.907009] 3bc0: 8e6250a8 00000000 8e443c1c 8e443bd8 80485c00 80486678 00000280 000001e0 [ 0.915235] 3be0: 00000280 000001e0 00000018 00000018 8e617210 8e617180 00000018 00000000 [ 0.923463] 3c00: 8e617180 00000000 8e618700 00000000 8e443c34 8e443c20 80485e18 80485a30 [ 0.931690] 3c20: 00000018 8e620400 8e443cfc 8e443c38 80486518 80485de8 00000000 00000000 [ 0.939915] 3c40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 0.948133] 3c60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 0.956352] 3c80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 0.964570] 3ca0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 0.972790] 3cc0: 00000000 00000000 00000000 00000000 00000000 00000000 8e443d0c 8e620400 [ 0.981018] 3ce0: 80c20878 8e61c810 80c208d8 00000000 8e443d0c 8e443d00 8048654c 8048637c [ 0.989245] 3d00: 8e443d2c 8e443d10 804ae0f4 80486544 8e620400 00000000 00000000 80c208d8 [ 0.997472] 3d20: 8e443d64 8e443d30 8048da94 804ae070 00000000 809b0410 8e443d64 8e443d48 [ 1.005699] 3d40: 8e61c810 8e4b7a10 8e4b7a00 8e620400 00000000 809b0410 8e443dcc 8e443d68 [ 1.013925] 3d60: 804ae350 8048d960 9004e054 00000000 00000008 00000010 00000000 00000001 [ 1.022153] 3d80: 30756364 7669645f 7869705f 8e443d00 802417c8 8023ded4 8e4b7a10 00000000 [ 1.030380] 3da0: 8e4b7a18 8e4b7a10 ffffffed 80c2088c fffffdfb 80c2088c 00000000 00000000 [ 1.038607] 3dc0: 8e443dec 8e443dd0 804b90b4 804ae178 8e4b7a10 80c5b410 80c5b414 00000000 [ 1.046835] 3de0: 8e443e1c 8e443df0 804b7578 804b9068 00000000 8e4b7a10 80c2088c 8e4b7a44 [ 1.055061] 3e00: 00000000 000000c2 80b0061c 00000007 8e443e3c 8e443e20 804b76b0 804b730c [ 1.063289] 3e20: 00000000 80c2088c 804b75f0 00000000 8e443e64 8e443e40 804b5878 804b75fc [ 1.071516] 3e40: 8e403f4c 8e4b63b0 8e6128b4 80c2088c 8e612880 80c20ee8 8e443e74 8e443e68 [ 1.079743] 3e60: 804b6eb8 804b5814 8e443e9c 8e443e78 804b6930 804b6ea0 809b9bcc 8e443e88 [ 1.087970] 3e80: 80c2088c 80b1b304 00000000 80b2d830 8e443eb4 8e443ea0 804b802c 804b6834 [ 1.096197] 3ea0: 80c20ee8 80b1b304 8e443ecc 8e443eb8 804b9010 804b7fb8 ffffe000 80b1b304 [ 1.104424] 3ec0: 8e443edc 8e443ed0 80b1b320 804b8fd4 8e443f4c 8e443ee0 8010190c 80b1b310 [ 1.112651] 3ee0: 8e443f4c 8e443ef0 80134300 80b00628 8096fbd0 8096fbb0 8096fbfc 8096fb88 [ 1.120878] 3f00: 80977cc4 00000006 00000006 00000000 80a351fc 809cdb30 8fdffc04 8fdffc0d [ 1.129105] 3f20: 00000000 80c37800 80c37800 80c37800 80c37800 80b38adc 000000c2 80b0061c [ 1.137332] 3f40: 8e443f94 8e443f50 80b00e88 801018cc 00000006 00000006 00000000 80b0061c [ 1.145558] 3f60: 00000000 80a351fc 00000000 00000000 80792c48 00000000 00000000 00000000 [ 1.153777] 3f80: 00000000 00000000 8e443fac 8e443f98 80792c58 80b00d5c 00000000 80792c48 [ 1.162004] 3fa0: 00000000 8e443fb0 80107cb0 80792c54 00000000 00000000 00000000 00000000 [ 1.170230] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 1.178449] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 5aefffff 7deefbff [ 1.186662] Backtrace: [ 1.189151] [<8048666c>] (drm_fbdev_cma_create) from [<80485c00>] (__drm_fb_helper_initial_config_and_unlock+0x1dc/0x3b8) [ 1.200164] r10:00000000 r9:8e6250a8 r8:00000001 r7:80c20428 r6:8e620400 r5:00000018 [ 1.208030] r4:8e617180 [ 1.210598] [<80485a24>] (__drm_fb_helper_initial_config_and_unlock) from [<80485e18>] (drm_fb_helper_initial_config+0x3c/0x40) [ 1.222126] r10:00000000 r9:8e618700 r8:00000000 r7:8e617180 r6:00000000 r5:00000018 [ 1.229986] r4:8e617180 [ 1.232553] [<80485ddc>] (drm_fb_helper_initial_config) from [<80486518>] (drm_fb_cma_fbdev_init_with_funcs+0x1a8/0x1c8) [ 1.243464] r5:8e620400 r4:00000018 [ 1.247072] [<80486370>] (drm_fb_cma_fbdev_init_with_funcs) from [<8048654c>] (drm_fb_cma_fbdev_init+0x14/0x18) [ 1.257208] r8:00000000 r7:80c208d8 r6:8e61c810 r5:80c20878 r4:8e620400 [ 1.263951] [<80486538>] (drm_fb_cma_fbdev_init) from [<804ae0f4>] (fsl_dcu_load+0x90/0x108) [ 1.272446] [<804ae064>] (fsl_dcu_load) from [<8048da94>] (drm_dev_register+0x140/0x1d8) [ 1.280581] r7:80c208d8 r6:00000000 r5:00000000 r4:8e620400 [ 1.286277] [<8048d954>] (drm_dev_register) from [<804ae350>] (fsl_dcu_drm_probe+0x1e4/0x2e4) [ 1.294854] r9:809b0410 r8:00000000 r7:8e620400 r6:8e4b7a00 r5:8e4b7a10 r4:8e61c810 [ 1.302652] [<804ae16c>] (fsl_dcu_drm_probe) from [<804b90b4>] (platform_drv_probe+0x58/0xb8) [ 1.311222] r10:00000000 r9:00000000 r8:80c2088c r7:fffffdfb r6:80c2088c r5:ffffffed [ 1.319087] r4:8e4b7a10 [ 1.321653] [<804b905c>] (platform_drv_probe) from [<804b7578>] (driver_probe_device+0x278/0x2f0) [ 1.330570] r7:00000000 r6:80c5b414 r5:80c5b410 r4:8e4b7a10 [ 1.336262] [<804b7300>] (driver_probe_device) from [<804b76b0>] (__driver_attach+0xc0/0xc4) [ 1.344745] r10:00000007 r9:80b0061c r8:000000c2 r7:00000000 r6:8e4b7a44 r5:80c2088c [ 1.352613] r4:8e4b7a10 r3:00000000 [ 1.356228] [<804b75f0>] (__driver_attach) from [<804b5878>] (bus_for_each_dev+0x70/0xa4) [ 1.364449] r7:00000000 r6:804b75f0 r5:80c2088c r4:00000000 [ 1.370145] [<804b5808>] (bus_for_each_dev) from [<804b6eb8>] (driver_attach+0x24/0x28) [ 1.378193] r6:80c20ee8 r5:8e612880 r4:80c2088c [ 1.382845] [<804b6e94>] (driver_attach) from [<804b6930>] (bus_add_driver+0x108/0x214) [ 1.390895] [<804b6828>] (bus_add_driver) from [<804b802c>] (driver_register+0x80/0xfc) [ 1.398945] r7:80b2d830 r6:00000000 r5:80b1b304 r4:80c2088c [ 1.404640] [<804b7fac>] (driver_register) from [<804b9010>] (__platform_driver_register+0x48/0x50) [ 1.413721] r5:80b1b304 r4:80c20ee8 [ 1.417346] [<804b8fc8>] (__platform_driver_register) from [<80b1b320>] (fsl_dcu_drm_platform_driver_init+0x1c/0x20) [ 1.427914] r5:80b1b304 r4:ffffe000 [ 1.431530] [<80b1b304>] (fsl_dcu_drm_platform_driver_init) from [<8010190c>] (do_one_initcall+0x4c/0x170) [ 1.441241] [<801018c0>] (do_one_initcall) from [<80b00e88>] (kernel_init_freeable+0x138/0x1c8) [ 1.449986] r9:80b0061c r8:000000c2 r6:80b38adc r5:80c37800 r4:80c37800 [ 1.456737] [<80b00d50>] (kernel_init_freeable) from [<80792c58>] (kernel_init+0x10/0x10c) [ 1.465052] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:80792c48 [ 1.472919] r4:00000000 [ 1.475491] [<80792c48>] (kernel_init) from [<80107cb0>] (ret_from_fork+0x14/0x24) [ 1.483093] r5:80792c48 r4:00000000 [ 1.486697] Code: e58460d8 e0823003 e58430d4 e59730ac (e5935008) [ 1.492895] ---[ end trace 95d88c85f82f6379 ]--- [ 1.497604] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b I did not yet look further into this, maybe you have an idea? -- StefanCc: Stefan Agner <stefan@xxxxxxxx> Cc: Alison Wang <alison.wang@xxxxxxxxxxxxx> Signed-off-by: Noralf Trønnes <noralf@xxxxxxxxxxx> --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++++++-------------------- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 1 - 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 1a9ee657bbac..45a44bb7a2e4 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -11,7 +11,6 @@#include <linux/clk.h>#include <linux/clk-provider.h> -#include <linux/console.h> #include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/mm.h> @@ -25,6 +24,7 @@ #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_modeset_helper.h> @@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) "Invalid legacyfb_depth. Defaulting to 24bpp\n"); legacyfb_depth = 24; } - fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1); - if (IS_ERR(fsl_dev->fbdev)) { - ret = PTR_ERR(fsl_dev->fbdev); - fsl_dev->fbdev = NULL; + ret = drm_fb_cma_fbdev_init(dev, legacyfb_depth, 1); + if (ret) goto done; - }return 0;done: drm_kms_helper_poll_fini(dev);- if (fsl_dev->fbdev)- drm_fbdev_cma_fini(fsl_dev->fbdev); + drm_fb_cma_fbdev_fini(dev);drm_mode_config_cleanup(dev);drm_irq_uninstall(dev); @@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags)static void fsl_dcu_unload(struct drm_device *dev){ - struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - drm_atomic_helper_shutdown(dev); drm_kms_helper_poll_fini(dev);- if (fsl_dev->fbdev)- drm_fbdev_cma_fini(fsl_dev->fbdev); + drm_fb_cma_fbdev_fini(dev);drm_mode_config_cleanup(dev);drm_irq_uninstall(dev); @@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg) return IRQ_HANDLED; }-static void fsl_dcu_drm_lastclose(struct drm_device *dev)-{ - struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - - drm_fbdev_cma_restore_mode(fsl_dev->fbdev); -} - DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);static struct drm_driver fsl_dcu_drm_driver = {.driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC, - .lastclose = fsl_dcu_drm_lastclose, + .lastclose = drm_fb_helper_lastclose, .load = fsl_dcu_load, .unload = fsl_dcu_unload, .irq_handler = fsl_dcu_drm_irq, diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h index 93bfb98012d4..cb87bb74cb87 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h @@ -191,7 +191,6 @@ struct fsl_dcu_drm_device { /*protects hardware register*/ spinlock_t irq_lock; struct drm_device *drm; - struct drm_fbdev_cma *fbdev; struct drm_crtc crtc; struct drm_encoder encoder; struct fsl_dcu_drm_connector connector;
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel