1. 13 Dec, 2023 6 commits
    • Ming Qian's avatar
      media: amphion: remove mutext lock in condition of wait_event · f9c8ddce
      Ming Qian authored
      mutext_lock should not be called in condition of wait_event, otherwise,
      when CONFIG_DEBUG_ATOMIC_SLEEP is enabled, we may meet the following
      warning:
      do not call blocking ops when !TASK_RUNNING; state=2
      WARNING: CPU: 5 PID: 741 at kernel/sched/core.c:9859
      __might_sleep+0x80/0xa4
      Hardware name: Freescale i.MX8QM MEK (DT)
      pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)  pc :
      __might_sleep+0x80/0xa4  lr : __might_sleep+0x80/0xa4  sp : ffffffc0123738a0
      x29: ffffffc0123738a0 x28: ffffffc009194c48 x27: ffffffc00bbc1050
      x26: ffffff8814b282f0 x25: ffffff8814b280d0 x24: ffffff8814b28080
      x23: 0000000000000001 x22: 0000000000000032 x21: ffffffc00bbc1000
      x20: 000000000000011b x19: ffffffc009324670 x18: 00000000fffffffd
      x17: 30303c5b20746120 x16: 74657320323d6574 x15: 617473203b474e49
      x14: 00058b5b8b9aa1f1 x13: ffffffc00903cda0 x12: 00000000d744fcc9
      x11: 000000000000001c x10: 00000000000009a0 x9 : ffffffc0090201f4
      x8 : ffffff8828245000 x7 : 0000000000000001 x6 : 0000000000000001
      x5 : 00000000410fd080 x4 : 0000000000000002 x3 : ffffff8815aab4c8
      x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff8828244600
      Call trace:
       __might_sleep+0x80/0xa4
       mutex_lock+0x2c/0x80
       sync_session_response+0x110/0x310
       vpu_session_send_cmd+0x18c/0x244
       vpu_session_start+0x38/0x70
       vdec_start_session+0x1b4/0x3e0
       vpu_vb2_start_streaming+0xa0/0x1c4
       vb2_start_streaming+0x74/0x160
       vb2_core_qbuf+0x488/0x650
       vb2_qbuf+0x9c/0x100
       v4l2_m2m_qbuf+0x7c/0x224
       v4l2_m2m_ioctl_qbuf+0x20/0x2c
       v4l_qbuf+0x50/0x6c
       __video_do_ioctl+0x174/0x3f0
       video_usercopy+0x210/0x7cc
       video_ioctl2+0x20/0x30
       v4l2_ioctl+0x48/0x6c
      
      we need to refine check_is_responsed() to remove the mutext_lock, each
      cmd has a monotonically increasing id, and cmds are executed
      sequentially, so we can check the id of the last reponsed cmd, then
      determine whether a command has been responded or not.
      Signed-off-by: default avatarMing Qian <ming.qian@nxp.com>
      CC: Xiaolei Wang <xiaolei.wang@windriver.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      f9c8ddce
    • Randy Dunlap's avatar
      media: chips-media: wave5: Requires GENERIC_ALLOCATOR · 1ddeeac2
      Randy Dunlap authored
      This driver uses the API that is provided by GENERIC_ALLOCATOR API, so
      select it to prevent build errors:
      
      riscv32-linux-ld: drivers/media/platform/chips-media/wave5/wave5-vpu.o: in function `.L37':
      wave5-vpu.c:(.text+0x468): undefined reference to `of_gen_pool_get'
      riscv32-linux-ld: drivers/media/platform/chips-media/wave5/wave5-vdi.o: in function `.L116':
      wave5-vdi.c:(.text+0xaac): undefined reference to `gen_pool_dma_alloc'
      riscv32-linux-ld: drivers/media/platform/chips-media/wave5/wave5-vdi.o: in function `wave5_vdi_free_sram':
      wave5-vdi.c:(.text+0xb60): undefined reference to `gen_pool_free_owner'
      
      Fixes: 9707a625 ("media: chips-media: wave5: Add the v4l2 layer")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Nas Chung <nas.chung@chipsnmedia.com>
      Cc: Jackson Lee <jackson.lee@chipsnmedia.com>
      Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: linux-media@vger.kernel.org
      Signed-off-by: default avatarSebastian Fricke <sebastian.fricke@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      1ddeeac2
    • Mattijs Korpershoek's avatar
      media: chips-media: wave5: Fix panic on decoding DECODED_IDX_FLAG_SKIP · 4e4103d6
      Mattijs Korpershoek authored
      The display frame region information received from the vpu also
      contains the frame display index: info->index_frame_display.
      
      This index, being a s32, can be negative when a skip option is passed.
      In that case, its value is DECODED_IDX_FLAG_SKIP (-2).
      
      When disp_idx == -2, the following exception occurs:
      
      [ 1530.782246][ T1900] Hardware name: Texas Instruments AM62P5 SK (DT)
      [ 1530.788501][ T1900] pstate: a0400005 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [ 1530.796144][ T1900] pc : wave5_vpu_dec_get_output_info+0x300/0x308 [wave5]
      [ 1530.803060][ T1900] lr : wave5_vpu_dec_get_output_info+0x80/0x308 [wave5]
      [ 1530.809873][ T1900] sp : ffffffc00b85bc00
      [ 1530.813872][ T1900] x29: ffffffc00b85bc00 x28: 0000000000000000 x27: 0000000000000001
      [ 1530.821695][ T1900] x26: 00000000fffffffd x25: 00000000ffffffff x24: ffffff8812820000
      [ 1530.829516][ T1900] x23: ffffff88199f7840 x22: ffffff8873f5e000 x21: ffffffc00b85bc58
      [ 1530.837336][ T1900] x20: 0000000000000000 x19: ffffff88199f7920 x18: ffffffc00a899030
      [ 1530.845156][ T1900] x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 0000000000198487
      [ 1530.852975][ T1900] x14: ffffffc009f2b650 x13: 0000000000058016 x12: 0000000005000000
      [ 1530.860795][ T1900] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
      [ 1530.868615][ T1900] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000004086
      [ 1530.876434][ T1900] x5 : 0000000000000001 x4 : ffffffc001454b94 x3 : ffffffc001454d94
      [ 1530.884256][ T1900] x2 : ffffffc00b8201d0 x1 : 0000000000000020 x0 : 0000000000000000
      [ 1530.892087][ T1900] Call trace:
      [ 1530.895225][ T1900]  wave5_vpu_dec_get_output_info+0x300/0x308 [wave5]
      [ 1530.901788][ T1900]  wave5_vpu_dec_finish_decode+0x6c/0x3dc [wave5]
      [ 1530.908081][ T1900]  wave5_vpu_irq_thread+0x140/0x168 [wave5]
      [ 1530.913856][ T1900]  irq_thread_fn+0x44/0xa4
      [ 1530.918154][ T1900]  irq_thread+0x15c/0x288
      [ 1530.922330][ T1900]  kthread+0x104/0x1d4
      [ 1530.926247][ T1900]  ret_from_fork+0x10/0x20
      [ 1530.930520][ T1900] Code: 2a1f03ea 2a1f03eb 35ffef2c 17ffff74 (d42aa240)
      [ 1530.937296][ T1900] ---[ end trace 0000000000000000 ]---
      [ 1530.942596][ T1900] Kernel panic - not syncing: BRK handler: Fatal exception
      [ 1530.949629][ T1900] SMP: stopping secondary CPUs
      [ 1530.954244][ T1900] Kernel Offset: disabled
      [ 1530.958415][ T1900] CPU features: 0x00,00000000,00800184,0000421b
      [ 1530.964496][ T1900] Memory Limit: none
      
      Move the disp_info assignment after testing that the index is positive
      to avoid the exception.
      
      Fixes: 45d1a2b9 ("media: chips-media: wave5: Add vpuapi layer")
      Signed-off-by: default avatarMattijs Korpershoek <mkorpershoek@baylibre.com>
      Reviewed-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
      Signed-off-by: default avatarSebastian Fricke <sebastian.fricke@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      4e4103d6
    • Colin Ian King's avatar
      media: chips-media: wave5: Fix spelling mistake "bufferur" -> "buffer" · a3d51462
      Colin Ian King authored
      There is a spelling mistake in a dev_dbg message. Fix it.
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarSebastian Fricke <sebastian.fricke@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      a3d51462
    • Lukas Bulwahn's avatar
      media: MAINTAINERS: Correct file entry in WAVE5 VPU CODEC DRIVER · f54ce765
      Lukas Bulwahn authored
      Commit 26dde1be ("media: chips-media: wave5: Add wave5 driver to
      maintainers file") adds the MAINTAINERS section WAVE5 VPU CODEC DRIVER
      referring to the 'cnm,wave5.yaml' media devicetree binding, but the file
      actually added in the commit de4b9f7e ("dt-bindings: media: wave5: add
      yaml devicetree bindings") is named 'cnm,wave521c.yaml'.
      
      Correct the file entry in WAVE5 VPU CODEC DRIVER.
      
      Fixes: 26dde1be ("media: chips-media: wave5: Add wave5 driver to maintainers file")
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarSebastian Fricke <sebastian.fricke@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      f54ce765
    • Dan Carpenter's avatar
      media: chips-media: wave5: Remove duplicate check · b9407b25
      Dan Carpenter authored
      We already verified that "ret" is zero a few lines earlier.  Delete this
      duplicate check.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
      Signed-off-by: default avatarSebastian Fricke <sebastian.fricke@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      b9407b25
  2. 12 Dec, 2023 1 commit
  3. 09 Dec, 2023 21 commits
  4. 08 Dec, 2023 7 commits
  5. 07 Dec, 2023 5 commits