[EXT] Re: [PATCH v9 04/13] media: amphion: add vpu core driver

Ming Qian ming.qian at nxp.com
Thu Sep 23 18:52:00 PDT 2021


> -----Original Message-----
> From: Nicolas Dufresne [mailto:nicolas at ndufresne.ca]
> Sent: Thursday, September 23, 2021 10:27 PM
> To: Ming Qian <ming.qian at nxp.com>; mchehab at kernel.org;
> shawnguo at kernel.org; robh+dt at kernel.org; s.hauer at pengutronix.de
> Cc: hverkuil-cisco at xs4all.nl; kernel at pengutronix.de; festevam at gmail.com;
> dl-linux-imx <linux-imx at nxp.com>; Aisheng Dong <aisheng.dong at nxp.com>;
> linux-media at vger.kernel.org; linux-kernel at vger.kernel.org;
> devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: [EXT] Re: [PATCH v9 04/13] media: amphion: add vpu core driver
> 
> Caution: EXT Email
> 
> Le lundi 13 septembre 2021 à 17:11 +0800, Ming Qian a écrit :
> > The vpu supports encoder and decoder.
> > it needs mu core to handle it.
> > core will run either encoder or decoder firmware.
> >
> > This driver is for support the vpu core.
> >
> > Signed-off-by: Ming Qian <ming.qian at nxp.com>
> > Signed-off-by: Shijie Qin <shijie.qin at nxp.com>
> > Signed-off-by: Zhou Peng <eagle.zhou at nxp.com>
> > ---
> >  drivers/media/platform/amphion/vpu_codec.h |  68 ++
> >  drivers/media/platform/amphion/vpu_core.c  | 901
> +++++++++++++++++++++
> >  drivers/media/platform/amphion/vpu_core.h  |  16 +
> >  drivers/media/platform/amphion/vpu_dbg.c   | 496 ++++++++++++
> >  drivers/media/platform/amphion/vpu_log.h   |  44 +
> >  drivers/media/platform/amphion/vpu_rpc.c   | 263 ++++++
> >  drivers/media/platform/amphion/vpu_rpc.h   | 463 +++++++++++
> >  7 files changed, 2251 insertions(+)
> >  create mode 100644 drivers/media/platform/amphion/vpu_codec.h
> >  create mode 100644 drivers/media/platform/amphion/vpu_core.c
> >  create mode 100644 drivers/media/platform/amphion/vpu_core.h
> >  create mode 100644 drivers/media/platform/amphion/vpu_dbg.c
> >  create mode 100644 drivers/media/platform/amphion/vpu_log.h
> >  create mode 100644 drivers/media/platform/amphion/vpu_rpc.c
> >  create mode 100644 drivers/media/platform/amphion/vpu_rpc.h
> >
> > +static int vpu_core_remove(struct platform_device *pdev)
> > +{
> > +     struct device *dev = &pdev->dev;
> > +     struct vpu_core *core = platform_get_drvdata(pdev);
> > +     int ret;
> > +
> > +     vpu_core_remove_dbgfs_file(core);
> 
> This crash when the module us unloaded.
> 
> [ 1051.198290] Unable to handle kernel NULL pointer dereference at virtual
> address 00000000000000a0
> [ 1051.207653] Mem abort info:
> [ 1051.222130]   ESR = 0x96000004
> [ 1051.227543]   EC = 0x25: DABT (current EL), IL = 32 bits
> [ 1051.233354]   SET = 0, FnV = 0
> [ 1051.236604]   EA = 0, S1PTW = 0
> [ 1051.239837]   FSC = 0x04: level 0 translation fault
> [ 1051.245175] Data abort info:
> [ 1051.248480]   ISV = 0, ISS = 0x00000004
> [ 1051.253606]   CM = 0, WnR = 0
> [ 1051.257039] user pgtable: 4k pages, 48-bit VAs, pgdp=00000008826b4000
> [ 1051.271756] [00000000000000a0] pgd=0000000000000000,
> p4d=0000000000000000
> [ 1051.286908] Internal error: Oops: 96000004 [#1] PREEMPT SMP
> [ 1051.292536] Modules linked in: amphion_vpu_core(-) v4l2_mem2mem
> videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2
> videobuf2_common crct10dif_ce imx_sc_wdt imx_sc_thermal imx_sc_key
> rtc_imx_sc
> fsl_imx8_ddr_perf mpl3115 industrialio_triggered_buffer kfifo_buf isl29018
> videodev mc drm fuse ip_tables x_tables ipv6 [last unloaded:
> amphion_vpu_dev]
> [ 1051.324856] CPU: 0 PID: 491 Comm: rmmod Not tainted
> 5.15.0-rc2-imx8qxp+ #2
> [ 1051.331748] Hardware name: Freescale i.MX8QXP MEK (DT)
> [ 1051.336898] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS
> BTYPE=--)
> [ 1051.343875] pc : down_read_interruptible+0xec/0x200
> [ 1051.348772] lr : simple_recursive_removal+0x4c/0x29c
> [ 1051.353752] sp : ffff80001302bbd0
> [ 1051.357069] x29: ffff80001302bbd0 x28: ffff0008073d2300 x27:
> ffff0008073d2358
> [ 1051.364229] x26: 0000000000000000 x25: 00000000000000a0 x24:
> 0000000000000000
> [ 1051.371387] x23: ffff000800145090 x22: 0000000000000000 x21:
> ffff80001258ed3c
> [ 1051.378545] x20: ffff80001258ed40 x19: ffff0008073d2300 x18:
> ffff800012573f54
> [ 1051.385704] x17: 0000000000000000 x16: 000000000000000d x15:
> 0000104ca19aff10
> [ 1051.392863] x14: 00000000000000ad x13: 0000000000000001 x12:
> 0000000000000000
> [ 1051.400023] x11: 0000000000000000 x10: 0000000000000990 x9 :
> ffff80001302b860
> [ 1051.407179] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 :
> 000000000000126e
> [ 1051.414338] x5 : 0000000000000000 x4 : 0000000000000000 x3 :
> 00000000000000a0
> [ 1051.421496] x2 : 0000000000000001 x1 : 0000000000000000 x0 :
> 00000000000000a0
> [ 1051.428659] Call trace:
> [ 1051.431113]  down_read_interruptible+0xec/0x200
> [ 1051.435655]  debugfs_remove+0x5c/0x80
> [ 1051.439329]  vpu_core_remove_dbgfs_file+0x24/0x50
> [amphion_vpu_core]
> [ 1051.445734]  vpu_core_remove+0x24/0x150 [amphion_vpu_core]
> [ 1051.451261]  platform_remove+0x2c/0x60
> [ 1051.455028]  __device_release_driver+0x188/0x234
> [ 1051.459659]  driver_detach+0xc4/0x150
> [ 1051.463335]  bus_remove_driver+0x60/0xe0
> [ 1051.467270]  driver_unregister+0x34/0x64
> [ 1051.471204]  platform_driver_unregister+0x18/0x24
> [ 1051.475922]  amphion_vpu_core_driver_exit+0x20/0x2c
> [amphion_vpu_core]
> [ 1051.482494]  __arm64_sys_delete_module+0x194/0x25c
> [ 1051.487303]  invoke_syscall+0x48/0x114
> [ 1051.491063]  el0_svc_common.constprop.0+0x44/0xfc
> [ 1051.495781]  do_el0_svc+0x2c/0x94
> [ 1051.499107]  el0_svc+0x28/0x80
> [ 1051.502176]  el0t_64_sync_handler+0xa8/0x130
> [ 1051.506458]  el0t_64_sync+0x1a0/0x1a4
> [ 1051.510141] Code: c8047c62 35ffff84 17fffe63 f9800071 (c85ffc60)
> [ 1051.516247] ---[ end trace 38710d42422128dc ]---
> 
> 
I'm sorry that I didn't test the rmmod in recent version, I'll fix it in the next version.
> 
> 
> > +     ret = pm_runtime_get_sync(dev);
> > +     WARN_ON(ret < 0);
> > +
> > +     vpu_core_shutdown(core);
> > +     pm_runtime_put_sync(dev);
> > +     pm_runtime_disable(dev);
> > +
> > +     vpu_core_unregister(core->parent, core);
> > +     iounmap(core->fw.virt);
> > +     iounmap(core->rpc.virt);
> > +     mutex_destroy(&core->lock);
> > +     mutex_destroy(&core->cmd_lock);
> > +
> > +     return 0;
> > +}
> > +



More information about the linux-arm-kernel mailing list