Commit Graph

26 Commits

Author SHA1 Message Date
Ming Qian
08d3e59a62 MA-22424-1: mxc: vpu: h1: Use fixed-length types in ioctl parameters
To support 32bit application, we should use fixed-length types in ioctl
parameters, specifically avoid using the type long and unsigned long.

remove some unused ioctl cmd.
clear some building warning.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-02 10:07:51 +09:00
TaoJiang
a328b9713f LF-10253: arm64: vpu : h1: solve encode hang
1.imx8mm-evk run CI test script 5000 loops, can not reproduce
2.imx8mm-ddr4-evk can reproduce about 200~300 loops
3.hw timeout interrupt trigger and no register can change cycle(fixed)
4.try 300MHZ h1 root clock, run 5000 loops can not reproduce
5.we don't want to sacrifice performace,wo modify driver
  if hw abnormal interrupt trigger, don.t set irq_done flag
  driver will enter into waitEventTimeout process and release hw later

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2023-11-16 13:37:19 +05:30
TaoJiang
a2a14496de LF-10253: vpu: h1: solve encode dead loop
encode fail with log "en core suspend sem down error id".

some abnormal interrupts occur.
the 'core_suspend_sem' semaphore didn't do up operation but wakeup ctlrsw.
So the following enable core operation will timeout due to down operation.

just do up and wake up operation  after receiving frame ready interrupt.
if abnormal interrupt received, just do nothing.
current encoding process will timeout.
at last enter into release hardware process.

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:10 +08:00
TaoJiang
b0172d28d0 LF-8969: vpu : hantro_encoder: optimize 32 bit interface
1.optimzie some error reported by coverity
2.sanity test ok

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
TaoJiang
5ccb79959e LF-8969: vpu : hantro_h1: optimize 32 bit interface
1.get user space data in ioctl
2.optimize 32 bit user pointer

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Zhou Peng
64c93a4203 arm64: imx8m: vpu: update class_create() usage
Cope with API change:
1aaba11da9 ("driver core: class: remove module * from class_create()")

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:08 +08:00
TaoJiang
834e0f954b LF-8496: imx8mm: vpu: media: hantro: solve h1 suspend error
1.add shadow register to protect write clear register

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:08 +08:00
Li Yang
e17a1890a6 arm64: imx8m: vpu: update vm_flags with modifier calls
Deal with 1c71222e5f ("mm: replace vma->vm_flags direct modifications
with modifier calls")

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
46080cc6d8 LF-7711-7: imx8m: vpu: unlock semaphore when encode/decode timeout
the semaphore is unlocked in isr in normal case,
if the interrupt is missed, and timeout is triggered,
there will be no change to unlock it

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
07326c1956 LF-7711-4: imx8m: vpu: request irq without shared flag
there is no need to share vpu irq

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
59b50d5f3b LF-7711-3: imx8m: vpu: don't disable irq
there is no need to disable irq

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
3e43c1f22c LF-7711-2: imx8m: vpu: remove unused mutex
the dev_mutex is only used for pm_rumtime_get_sync,
it's useless

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
cf5d8485eb LF-7711-1: imx8m: vpu: fix a typo in switching to blkctl
the node name of blkctl may be "blk-ctl" or "blk-ctrl"

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:07 +08:00
Zhou Peng
914a53fda7 LF-7016-1: arm64: imx8m: vpu: change file mode to 644
Change file mode to 644 to comply with community rule.

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:06 +08:00
Zhou Peng
746c9a05f2 LF-5789-2: arm64: vpu: 8mm: remove calling of force_uaccess_xxx()
Remove calling of force_uaccess_xxx() since set_fs was not supported again

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:05 +08:00
Shijie Qin
4fbdbc9366 LF-5670-1 imx8mm: vpu_enc: skip blk-ctrl operation in vpu driver
Since kernel verision 5.16, there has a blk-ctrl driver uniformly
handle blk-ctrls, so, don't need vpu driver handle it separately,
otherwise, will lead to system hang, described as: failing to meet
the ADB handshake and/or reset sequencing requirements will generally
lead to system hangs (not necessarily at the point where the sequence
is violated).

blk-ctrl driver: commit 2684ac05a8 ("soc: imx: add i.MX8M blk-ctrl driver")

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:04 +08:00
Shijie Qin
b45e815a91 LF-5607 imx8mm: vpu_enc: correctly recover encoder status when power resume
Rewrite mirror_regs to hw_regs only in encoding finished(irq_status & 0x04),
also need to clear 'reg_corrupt'.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2023-10-30 15:58:04 +08:00
Shijie Qin
2137b926c4 MLK-25830-1 imx8mm: vpu_enc: use file handle indicate which instance is occupying encoder core
Previously, use 'currrent->pid' indicate which instance is occupying the
core, which might has issue in below case:
Application(pid_0) create a new thread(pid_1) to do encode, thus
current->pid = pid_1. If directly 'kill -9 pid_0', will close encoder in
pid_0, hence, 'dev->pid(pid_1) != pid_0', and some dev flag will not be
cleaned, which will impact following encode.

File handle is unique for each instance, it is more reasonable and safe
to use file handle to indicate which instance is occuping encoder core.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:03 +08:00
Shijie Qin
b29c36c4e2 LF-4936 imx8mm: vpu_enc: potential risk during suspend/resume operation
In EncAsicFrameStart():
(1) set sw mirror registers through EncAsicSetRegisterValue()
(2) set hw registers through EWLWriteReg()
(3) set hw enable register to trigger HW
if suspend happen between (1) and (3), e.g. most hw registers will be
cleared before trigger HW, as a result, 'ASIC_STATUS_ERROR' will be
reported after EWLWaitHwRdy().

Add new ioctl 'HX280ENC_IOCG_EN_CORE' to trigger HW.
During suspend, if HW is reserved, backup HW registers to mirror_regs;
if in encoding, enter suspend until encode current frame finish.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2023-10-30 15:58:03 +08:00
Shijie Qin
b191ea1963 LF-4670 arm64: imx8m: vpu: check regs.offset/size accurately
Directly check 'regs.offset + regs.size', instead of
'(regs.offset + regs.size) / 4', that has a risk if it isn't
multiple of 4.
(coverity ID 17802820)

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2023-10-30 15:58:02 +08:00
Shijie Qin
802228c1cb MA-19423-2 arm64: imx8mm: vpu: h1: add new ioctl to read/write HW registers
imx8mm vpu h1 encoder: add new ioctl to read/write VPU HW registers.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:02 +08:00
Zhou Peng
7de9dbf02c LF-3332-1: arm64: imx8: vpu: fix build errors due to API change
hantro g1/g2/h1/vc8000:
replace get_fs()/set_fs() with force_uaccess_xxx()

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:00 +08:00
Zhou Peng
422d364a6d MLK-24009-3 arm64: imx8mm: vpu: h1: fix build issue as module
release clk to avoid memory leak

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 420a357a1b)
2023-10-30 15:58:00 +08:00
Zhou Peng
68942305c6 arm64: vpu: hantro: remove legacy ioremap_nocache interface
replace ioremap_nocache with ioremap
ioremap has provided non-cached semantics by default since the Linux 2.6

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
2023-10-30 15:57:59 +08:00
Dong Aisheng
75b9d5201f vpu: hantro_845_h1: fix compat_ptr building issue
compat_ptr() depends on CONFIG_COMPAT.
Make hx280enc_ioctl() conditionally compiled to avoid a build
break in case CONFIG_COMPAT is not defined.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2023-10-30 15:57:59 +08:00
Zhou Peng
6d5d6de13a vpu: hantro: add encoder for imx845 h1
add hantro 845 source code, include h1

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
[ Aisheng: merge Kconfig&Makefile changes ]
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2023-10-30 15:57:58 +08:00