Commit Graph

47 Commits

Author SHA1 Message Date
Robby Cai
3841610add LF-13705-4 dma: pxp_dma_v3: Fix Coverity issues
Fix "Dereference null return value" Coverity issues of following CID:
21634744, 21634846, 21634870, 21634979, 21635089

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu Zhou <guoniu.zhou@nxp.com>
2024-10-22 15:34:11 +08:00
Robby Cai
912445b9f0 LF-13705-3 media: pxp_device: Fix Coverity issue
Fix Coverity issue: CID 21634622: Unchecked return value (CHECKED_RETURN)
Calling pxp_buffer_handle_delete without checking return value,
this patch added the check before use.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu Zhou <guoniu.zhou@nxp.com>
2024-10-22 15:34:10 +08:00
Robby Cai
768e074352 LF-9755 dma: pxp_dma_v3: fix typo causing function break
Fix typo introduced from the commit 9a06b8f28f ("LF-9509: dma: pxp_dma_v3:
fix dereference after null check issue") which causes pxp timeout when run
epdc test on MX8ULP EVK ('/unit_tests/Display/mxc_epdc_v2_fb_test.out').

...
[  223.598322] pxp_dispatch_thread: task is timeout
[  223.630619] imx_epdc_v2_fb 2db30000.epdc: PxP operation failed due to timeout
[  223.637898] imx_epdc_v2_fb 2db30000.epdc: Unable to complete PxP update task: pre_prcoess.
Change back to non-inverted RGB565
...

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: G.N. Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit a069b2188d)
2023-10-30 16:08:22 +08:00
Guoniu.zhou
cc893c8ad4 LF-9509: dma: pxp_dma_v3: fix dereference after null check issue
In pxp_is_v3(), it call pxp->devdata, but it out of null check for
pxp->devdata, so maybe refer null data when lut_transform is true.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 9a06b8f28f)
2023-10-30 16:08:22 +08:00
Guoniu.zhou
c0f1bf72b5 LF-9435: dma: pxp_dma_v3: fix dereference after null check
Fix dereference after null check issue reported by coverity(CID:25701409)

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 8af5982325)
2023-10-30 16:08:22 +08:00
Guoniu.zhou
61f86d18d5 LF-8978: dma: pxp: fix fetch/store engine low performance issue
When pxp read pixel data by fetch engine and output by store engine.
The performance is very low, about 50Mpixel/s when the bytes of both
read and write burst are the default value 8. While increase both
read and write burst bytes to 64, the performance will be improved
to about 125Mpixel/s.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 519de8586c)
2023-10-30 16:08:22 +08:00
Julien Vuillaumier
2cb0e42acd MGS-7088: dma: pxp: add generic dma-buf cache coherency management
PXP_IOC_FLUSH_PHYMEM ioctl implements support for cache coherency
of buffers previously allocated by the PXP driver using
PXP_IOC_GET_PHYMEM ioctl, hence associated to its PXP driver
handle.

This change adds the option to handle dma coherency on a dma-buf
issued by a generic exporter.
Handle associated to buffers allocated by PXP driver can not be null.
Therefore null handle is used by implementation as criteria to fall
back onto the dma-buf file descriptor passed in arguments, keeping
the backward compatibility.

Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Reviewed-by: G.N. Zhou <guoniu.zhou@nxp.com>
2023-10-30 16:08:22 +08:00
Guoniu.zhou
5367f9ac34 MLK-25315: dma: pxp: add monochrome mode support for PS engine
When input format of PS engine is monochrome, such as Y8 or Y4,
the low 16 bits of PS_VBUF are used as the U/V data in the data
path instead of sourcing U/V data from external buffers. In this
case it represents a fixed value for U/V data.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:22 +08:00
Guoniu.zhou
1930d2433d LF-6841: dma: pxp: fix pxp timeout issue when run g2d samples test
When run g2d sample test, pxp will report timeout issue. The reason
is that BGRA32 format is used in the case and driver will select AS
engine as input source. But from PXP datasheet, As can't do a simple
copy operation since it usually need to co-work with PS engine which
mean the output pixel value will determined by both AS and PS, such
as raster operation "AS OR PS" which usually used in legacy blending
operation. So add this workaround to fix this issue.

Reproduce steps:
/opt/g2d_samples/g2d_wayland_shm_test

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:22 +08:00
Guoniu.zhou
ba8c267758 LF-8022: dma: pxp: fix Coverity Issue
Fix Coverity issue 25910920 about dereference after null check

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:22 +08:00
Guoniu.zhou
bc0d76fae8 LF-6441-06: dma: pxp: add workaround to support RGB with alpha for PS engine
PS engine doesn't support RGB format with alpha channel, so it will discard
alpha value in RGBA/ARGB when PXP carry data from source to destination. The
workaround enable ALPHA_A porter_duff and use source blend mode, so it will
keep the alpha component as same in source buffer.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:22 +08:00
Guoniu.zhou
27e3f85366 LF-6441-05: dma: pxp: fix pxp convert YUV to ABGR32 with rotation issue
The case is that source buffer is YUYV format and need to convert it
to ABGR32 and do rotation operation. But it will fail due to the reason
as bellow:

Driver will select PS as input engine according to input format(YUYV)
and OUT engine will be used as output engine since PS can't work with
STORE engine, but OUT engine don't support ABGR32 format.

When do rotation operation, ROTATION2(iMX93 reference manual) will be
selected first, but it only can work with fetch engine due to PXP's
limitation(TKT0603343), so driver need to clean it and select ROTATION1
engine to do the rotation operation.

This patch fix this issue by adding ABGR32 format for OUT engine and
selecting ROTATION1 for PS/AS engine

Reproduce steps as bellow and run on iMX93 platform:
/opt/g2d_samples/g2d_basic_test

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:22 +08:00
Guoniu.zhou
043bb6ba0f LF-6441-04: dma: pxp: enable 16x16 block size for fetch engine by default
PXP block size is selected as 16x16 pixels by default in order to request
data more efficient. So driver also need to set each module which support
block size to 16x16. This patch is used to set input fetch engine block
size to 16x16.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
713cc4dbf6 LF-6441-03: dma: pxp: fill fetch engine active size when user miss them
Fill input fetch engine upper left X-coordinate(in pixels) of the active
surface of the total input memory by frame boundary size when user don't
configure them.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
4027f887ff LF-6441-02: dma: pxp: enable input fetch arbitration bit for iMX93 platform
Enable input fetch engine arbitration bit for iMX93 platform when use its
two channel simultaneously since only one AXI bus interface is connected
to PXP fetch engine channel in order to balance system performance. For
other platform which use PXP don't have this design, so set arbitration
bit as platform data and only enable it for iMX93 platform(TKT0601126).

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
8fdebcad90 LF-6441-01: dma: pxp: remove unnecessary modules in PXP pipeline
The selected modules by user case in PXP pipeline will be configured
and enabled in pxp_2d_task_config() , so don't need to enable unused
modules and re-enable the used modules in pxp_start()

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
3f978fdaf9 LF-8372: dma: pxp/v3: fix U/V offset calculation issue when crop enabled
The offset of U/V relative to Y buffer address base in PS engine is
wrong when format is multi-plane YUV format and crop enabled. So
correct it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Robby Cai
60bb62a13f LF-8222 dma: pxp: fix build error for pxp_device
../drivers/dma/pxp/pxp_device.c: In function 'pxp_dmabuf_ops_map':
../drivers/dma/pxp/pxp_device.c:666:40: error: 'struct dma_buf' has no member named 'lock'
  666 | struct mutex *lock = &db_attach->dmabuf->lock;
      |                                        ^~
../drivers/dma/pxp/pxp_device.c:666:15: warning: unused variable 'lock' [-Wunused-variable]
  666 | struct mutex *lock = &db_attach->dmabuf->lock;
      |               ^~~~

Remove internal dma-buf lock as it's removed in new framework and dma-buf reservation
is guaranteed to be locked by importers during the mapping operations.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.zhou <guoniu.zhou@nxp.com>
2023-10-30 16:08:21 +08:00
Jindong Yue
8c40cd2dab MA-19811-3 dma: pxp: Support building pxp driver as module
Change defconfig as tristate type, and export
register/unregister API symbols.

Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: If457ca1fd5433a34ab82f750e3a298af9d71f234
2023-10-30 16:08:21 +08:00
Guoniu.zhou
53ba277269 LF-7334: dma: pxp: v3: fix kernel dump issue when enable debug output
Kernel will dump when enable debug output in PXP driver with iMX93 platform.
The root cause is that PXP in iMX93 remove LUT related register compared
with other PXP version, so access non exist register in PXP will trigger
bus error signal to system. The solution is to mark these registers as
optional and skip them when run iMX93 PXP.

Hardware name: NXP i.MX93 11X11 EVK board (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : dump_pxp_reg+0xc8/0xec
lr : dump_pxp_reg+0xe0/0xec
sp : ffff800009e3b660
x29: ffff800009e3b660 x28: 00000000fffffffa x27: ffff80000973f2d8
x26: 0000000000000001 x25: 0000000000000070 x24: ffff0000047040e0
x23: ffff80000973ee60 x22: ffff8000096d5638 x21: ffff800009e3bb28
x20: ffff000004704080 x19: ffff800009e3ba08 x18: 0000000000000008
x17: 3030303030303078 x16: 30203a5d3039315b x15: ffff800009dbcb59
x14: 0000000000000000 x13: ffff800009c41f78 x12: 0000000000000420
x11: 0000000000000160 x10: ffff800009c41f78 x9 : ffff800009c41f78
x8 : 00000000ffffefff x7 : ffff800009c99f78 x6 : ffff800009c99f78
x5 : ffff80000a790240 x4 : 0000000000000240 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000004080000
Call trace:
 dump_pxp_reg+0xc8/0xec
 pxp_probe+0x31c/0x9e4
 platform_probe+0x68/0xe0
 really_probe.part.0+0x9c/0x30c
 __driver_probe_device+0x98/0x144
 driver_probe_device+0x44/0x15c
 __driver_attach+0x80/0x18c
 bus_for_each_dev+0x70/0xd0
 driver_attach+0x24/0x30
 bus_add_driver+0x108/0x1fc
 driver_register+0x78/0x130
 __platform_driver_register+0x28/0x34
 pxp_init+0x1c/0x28
 do_one_initcall+0x50/0x1b0
 kernel_init_freeable+0x20c/0x290
 kernel_init+0x24/0x12c
 ret_from_fork+0x10/0x20
 Code: d65f03c0 f9400e85 b9400264 8b2440a5 (b94000a5)
 ---[ end trace b6e6cc2fe83edf8f ]---
 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
1a06109b34 LF-6806: dma: pxp: workaround for PXP when do RGB to gray color conversion
CSC2 engine in PXP has IC bug(TKT272216) and fixed after 7D PXP version.
Driver update new CSC coefficient provided by PXP IP owner(MLK-25625-02).
But when run e-ink case, it can't do clear operation after applying the
patch. We don't know reason until now, so add a temporary patch to fix it
and will remove after finding the root cause.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
3e0af81f1c LF-6741: dma: pxp: fix coverity issue: Uninitialized scalar variable
Fix coverity issue: 22322873 Uninitialized scalar variable

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
4240caef4b LF-6743: dma: pxp: fix coverity issue: dereference before null check
Fix coverity issue 22322872: dereference before null check

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:21 +08:00
Li Yang
3ee1522c44 dma: pxp_device: Replace dma-buf-map with iosys-map
Since upstream commit 7938f421816 ("dma-buf-map: Rename to iosys-map")
the dma-buf-map names need to be updated.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
2023-10-30 16:08:21 +08:00
Guoniu.zhou
f21d626cdd LF-6244-06: dma: pxp: add PXP support for iMX93 platform
Add PXP support for iMX93 platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
d3361bfc50 LF-6244-03: dma: pxp: config block size to 16x16 for primary path
Select block size to 16x16 pixel blocks for PXP primary path in order
to improve PXP performance

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
84cef45c10 LF-6244-02: dma: pxp: config block size to 16x16 for fetch and store engine
Config block size to 16x16 for input fetch and store engine in order to
improve PXP performance

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
93b78fa77c LF-6244-01: dma: pxp: config write burst size to 64 bytes
Config write burst size to 64 bytes in order to improve PXP performance

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
776f92e9f1 MLK-25625-02: dma: pxp_v3: correct csc2 coefficient
Correct csc2 coefficient due to PXP issue(TKT272216). It apply to PXP
version after than iMX7D

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Tested-by: Jared Hu <jared.hu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
50758a54b2 MLK-25625-01: dma: pxp_v3: expose multi address settting for multi-plane format
In current pxp driver, U and V address are caculated by driver when input/output
format is multi-plane format, such as NV12. But for some cases, user space want
to set U and V address by themself, so expose multi address settting for the case

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Tested-by: Jared Hu <jared.hu@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Robby Cai
75c385c034 LF-5942-2 media: pxp_device: Fix build warning with clang
CC      drivers/dma/pxp/pxp_device.o
drivers/dma/pxp/pxp_device.c:358:8: warning: implicit conversion from enumeration type
'enum dma_data_direction' to different enumeration type 'enum dma_transfer_direction' [-Wenum-conversion]
                                                 DMA_TO_DEVICE,

To reproduce the warnings:
1) Install clang 12:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12

2) Build kernel with clang:
export PATH=/usr/lib/llvm-12/bin/:$PATH  LLVM=1
make ARCH=arm64 imx_v8_defconfig
make ARCH=arm64

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2023-10-30 16:08:20 +08:00
Robby Cai
ca5c6c2c68 LF-5942-1 dma: pxp_v3: fix build warning with clang
drivers/dma/pxp/pxp_dma_v3.c:7769:15: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                if ((output == enode->adjvex)) {
                     ~~~~~~~^~~~~~~~~~~~~~~~
drivers/dma/pxp/pxp_dma_v3.c:7769:15: note: remove extraneous parentheses around the comparison to silence this warning
                if ((output == enode->adjvex)) {
                    ~       ^               ~
drivers/dma/pxp/pxp_dma_v3.c:7769:15: note: use '=' to turn this equality comparison into an assignment
                if ((output == enode->adjvex)) {

To reproduce the warnings:
1) Install clang 12:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12

2) Build kernel with clang:
export PATH=/usr/lib/llvm-12/bin/:$PATH  LLVM=1
make ARCH=arm64 imx_v8_defconfig
make ARCH=arm64

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2023-10-30 16:08:20 +08:00
Robby Cai
ee98bc2ca3 LF-5061 dma: pxp_v3: Fix Coverity Issue 17888794:Out-of-bounds access
Fixed together with LF-5068, just make the coverity checking system no complain.
actually there's no potential issue for out-of-bounds access.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: G.N. Zhou <guoniu.zhou@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
bae2ea06e1 LF-4550: dma: pxp: fix -Wimplicit-fallthrough build warning issue
In linux-nxp repo, -Wimplicit-fallthrough is set to 5, so it causes
warning for /* fall through */ in switch case statement. So the patch
is used to fix it

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
608692314d MLK-25707-01: dma: pxp_v3: add software restart for iMX8ULP
When pxp driver probe, it will do software reset and reconfigure
operation. For iMX8ULP, power domain will be turned off in runtime
suspend and the status will be missed, so need to do software reset
and reconfigure operation again. But for other platform, such as 7D,
it's not necessary.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
f69da07357 MLK-25591-04: uapi: linux: fix segmentation fault when run pxp lib unit test
Fix segmentation fault when run pxp lib unit test on iMX8ULP platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by  : Robby.Cai <robby.cai@nxp.com>
2023-10-30 16:08:20 +08:00
Guoniu.zhou
610925eade MLK-25591-06: dma: pxp_v3: Add PXP driver support for iMX8ULP
Add PXP driver support for iMX8ULP platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by  : Robby.Cai <robby.cai@nxp.com>
2023-10-30 16:08:19 +08:00
Guoniu.zhou
a09028baa1 MLK-25591-05: dma: pxp_v3: fix warning for data type mismatch issue
Fix data type mismatch issue when PXP driver run on arm64 platform

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by  : Robby.Cai <robby.cai@nxp.com>
2023-10-30 16:08:19 +08:00
Guoniu.zhou
1678afba3d MLK-25591-03: pxp: Kconfg: remove dependency of 32 bits ARM platform
Due to PXP is used in iMX6, iMX7 Serial platform and they are 32 bits arm
platform, so add the dependency for PXP driver.

In iMX8ULP, it also integrate PXP and it's 64 bits arm platform, so remove
the dependency for it.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by  : Robby.Cai <robby.cai@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
1bb609622a LF-4342 dma: pxp: set register for LUT cleanup is not available on mx8ulp
set register (offset 4) for LUT cleanup can't be accessed on mx8ulp (different
from other SoCs), otherwise generate APB bus error.

reproduce step:
run '/unit_tests/Display/mxc_epdc_v2_fb_test.out'
...
*** Try again at 1,1 ***
[  153.808422] SError Interrupt on CPU1, code 0xbf000002 -- SError
[  153.808431] CPU: 1 PID: 124 Comm: pxp_dispatch Not tainted 5.10.52-02305-gd72ff8b018b0-dirty #7
[  153.808435] Hardware name: NXP i.MX8ULP EVK (DT)
[  153.808441] pstate: 60000085 (nZCv daIf -PAN -UAO -TCO BTYPE=--)
[  153.808445] pc : pxp_wfe_a_process+0xec/0x28c
[  153.808449] lr : pxp_dispatch_thread+0x1758/0x2430
[  153.808453] sp : ffff80001247bd40
[  153.808457] x29: ffff80001247bd40 x28: ffff000008a8c080
[  153.808471] x27: ffff0000054f8080 x26: ffff000008a8c000
[  153.808480] x25: ffff800011cd2000 x24: ffff800011cd2028
[  153.808490] x23: ffff0000054f80a4 x22: fffffffffffffffc
[  153.808499] x21: 0000000000000040 x20: ffff0000054f8080
[  153.808509] x19: ffff0000054f9480 x18: 0000000000001b90
[  153.808518] x17: 0000000000001b80 x16: 0000000000001c60
[  153.808528] x15: 0000000000001c50 x14: 0000000000001c40
[  153.808537] x13: 0000000000001c30 x12: 0000000000001c20
[  153.808546] x11: 0000000000001c10 x10: 0000000000001400
[  153.808556] x9 : 0000000000001bf0 x8 : 0000000000000000
[  153.808565] x7 : 0000000000000400 x6 : 0000000000000000
[  153.808574] x5 : ffff800012750ca0 x4 : 0000000000000000
[  153.808584] x3 : 00000000000002f5 x2 : 00000000000002f6
[  153.808593] x1 : ffff800012750000 x0 : 00000000000003ff
[  153.808604] Kernel panic - not syncing: Asynchronous SError Interrupt
[  153.808610] CPU: 1 PID: 124 Comm: pxp_dispatch Not tainted 5.10.52-02305-gd72ff8b018b0-dirty #7
[  153.808614] Hardware name: NXP i.MX8ULP EVK (DT)
[  153.808618] Call trace:
[  153.808622]  dump_backtrace+0x0/0x1a0
[  153.808626]  show_stack+0x18/0x70
[  153.808630]  dump_stack+0xd0/0x12c
[  153.808633]  panic+0x16c/0x334
[  153.808637]  nmi_panic+0x8c/0x90
[  153.808641]  arm64_serror_panic+0x78/0x84
[  153.808644]  do_serror+0x64/0x6c
[  153.808648]  el1_error+0x90/0x110
[  153.808652]  pxp_wfe_a_process+0xec/0x28c
[  153.808656]  pxp_dispatch_thread+0x1758/0x2430
[  153.808660]  kthread+0x154/0x160
[  153.808664]  ret_from_fork+0x10/0x30
[  153.808697] SMP: stopping secondary CPUs
[  153.808701] Kernel Offset: disabled
[  153.808705] CPU features: 0x0240002,20002008
[  153.808709] Memory Limit: none

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: G.n. Zhou <guoniu.zhou@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
8f4e5a8bc5 MLK-25335 dma: pxp: fix kernel dump for pxp device
dma API(s) can't use NULL device because of following patch:

d7e02a9312 dma-mapping: remove leftover NULL device support

this patch uses pxp_dev instead of NULL device to resolve kernel dump.

[  445.484900] 8<--- cut here ---
[  445.488002] Unable to handle kernel NULL pointer dereference at virtual address 0000015c
[  445.512965] pgd = 2afadd37
[  445.515707] [0000015c] *pgd=00000000
[  445.521436] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[  445.526776] Modules linked in: 8021q mx6s_capture ov5640_camera_v2
[  445.532993] CPU: 0 PID: 2117 Comm: vqueue:src Not tainted 5.4.70-2.3.0+g4f2631b022d8 #1
[  445.541006] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[  445.547214] PC is at pxp_device_ioctl+0xc64/0xe80
[  445.551933] LR is at pxp_buffer_object_lookup+0x30/0x38
[  445.557169] pc : [<80550e20>]    lr : [<8054fd00>]    psr: 60000013
[  445.563446] sp : 93bffea8  ip : 908a03ac  fp : 76957ff8
[  445.568681] r10: 00000036  r9 : 93bfe000  r8 : 93b04540
[  445.573917] r7 : 939d78c0  r6 : 80085007  r5 : 939d77c0  r4 : 00000000
[  445.580454] r3 : 00000001  r2 : 00000000  r1 : 00000002  r0 : 939d77c0
[  445.586993] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  445.594140] Control: 10c5387d  Table: 93bd806a  DAC: 00000051
[  445.599904] Process vqueue:src (pid: 2117, stack limit = 0xcf85841b)
[  445.606270] Stack: (0x93bffea8 to 0x93c00000)
[  445.610645] fea0:                   73800000 8020a840 93ab8800 81304f08 739bc000 93ab8800
[  445.618841] fec0: 93b8f840 739bc000 93b0fa80 8020eddc 93ab8800 00000002 00000001 00100c00
[  445.627037] fee0: 00000000 93bffee8 00000000 81304f08 00000008 741d7ff4 926428d0 80085007
[  445.635234] ff00: 741d7ff4 93b04540 93bfe000 00000036 76957ff8 80256c3c 93ab8800 0000010a
[  445.643430] ff20: 00000106 00000000 00000000 93b8f840 00000001 80210c20 000001e7 00000000
[  445.651626] ff40: 0009a100 93b8f848 93bfff54 0001c200 93bfff7c 00000001 93b04540 0000000b
[  445.659822] ff60: 00000001 00004000 93adc200 81304f08 93b04541 0000000b 80085007 741d7ff4
[  445.668019] ff80: 93b04540 93bfe000 00000036 8025716c 75742980 743caee0 01a152e0 00000036
[  445.676214] ffa0: 80101204 80101000 75742980 743caee0 0000000b 80085007 741d7ff4 743cb004
[  445.684410] ffc0: 75742980 743caee0 01a152e0 00000036 00000002 741d8064 741d81d4 76957ff8
[  445.692605] ffe0: 743caf40 741d7fd4 743b88d1 76d2cfe8 80000030 0000000b 00000000 00000000
[  445.700820] [<80550e20>] (pxp_device_ioctl) from [<80256c3c>] (do_vfs_ioctl+0x404/0x900)
[  445.708936] [<80256c3c>] (do_vfs_ioctl) from [<8025716c>] (ksys_ioctl+0x34/0x60)
[  445.716355] [<8025716c>] (ksys_ioctl) from [<80101000>] (ret_fast_syscall+0x0/0x54)
[  445.724023] Exception stack(0x93bfffa8 to 0x93bffff0)
[  445.729091] ffa0:                   75742980 743caee0 0000000b 80085007 741d7ff4 743cb004
[  445.737287] ffc0: 75742980 743caee0 01a152e0 00000036 00000002 741d8064 741d81d4 76957ff8
[  445.745477] ffe0: 743caf40 741d7fd4 743b88d1 76d2cfe8
[  445.750550] Code: e595100c e3a00000 e12fff34 eafffd39 (e594315c)
[  445.773509] ---[ end trace a4bb9353c99e0cef ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: G.n. Zhou <guoniu.zhou@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
4cc4435291 LF-1596 dma: pxp: add checking for out against NULL
Coverity Issue ID: 414719

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
437b49e593 LF-1595 dma: pxp: fix the typo for possible_inputs_s1 checking
Coverity Issue ID: 379378

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
42fd87ca8b LF-1594 dma: pxp: fix out-of-bounds access
Coverity issue ID: 379372

As only one overlayer supported, the initialization for ol_param
need to be adjusted accordingly.

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Fancy Fang <chen.fang@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
1f696ce529 LF-105-1 dmaengine: pxp: fix build warning of fall through
Fix the following build warning:
../drivers/dma/pxp/pxp_dma_v3.c: In function 'pxp_store_shift_ctrl_config':
../drivers/dma/pxp/pxp_dma_v3.c:1700:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
    shift_bypass = 1;
    ~~~~~~~~~~~~~^~~
../drivers/dma/pxp/pxp_dma_v3.c:1701:3: note: here
   case PXP_PIX_FMT_YVYU:
   ^~~~
../drivers/dma/pxp/pxp_dma_v3.c:1705:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
    shift_bypass = 1;
    ~~~~~~~~~~~~~^~~
../drivers/dma/pxp/pxp_dma_v3.c:1706:3: note: here
   case PXP_PIX_FMT_NV61:
   ^~~~

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Sandor Yu <Sandor.yu@nxp.com>
2023-10-30 16:08:19 +08:00
Robby Cai
e38c4297f7 media: pxp device: fix kernel dump when run pxp_test
In 5.x, the first parameter of dma_alloc_coherent() can't be 0, otherwise
the following dump will arise when run the command:
`/unit_tests/Display/pxp_test.out -I "-o 1.yuv" '. This patch fixed this.
And also, use register_chrdev instead of misc_register to make it clean.

[   53.838653] Internal error: Oops: 17 [#1] SMP ARM
[   53.844538] Modules linked in:
[   53.847610] CPU: 0 PID: 754 Comm: pxp_test.out Not tainted 5.4.0-rc5-03564-g9792b86 #46
[   53.855620] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[   53.861473] PC is at dma_alloc_attrs+0x10/0x114
[   53.866015] LR is at pxp_device_ioctl+0x90c/0xe98
[   53.870728] pc : [<c01bf1e8>]    lr : [<c05eb360>]    psr: a0070013
[   53.877001] sp : ed4e7e74  ip : 00000001  fp : b6591f9c
[   53.882232] r10: 00000000  r9 : e47efd40  r8 : ed4e7ecc
[   53.887463] r7 : ed508cc0  r6 : c1408b08  r5 : 00000000  r4 : 00000051
[   53.893997] r3 : 00000cc1  r2 : e47efd4c  r1 : 00055000  r0 : 00000240
[   53.900533] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   53.907675] Control: 10c5387d  Table: ad14804a  DAC: 00000051
[   53.913428] Process pxp_test.out (pid: 754, stack limit = 0x(ptrval))
[   53.919878] Stack: (0xed4e7e74 to 0xed4e8000)
[   53.924245] 7e60:                                              00000051 b6591cf4 c1408b08
[   53.932434] 7e80: ed508cc0 ed4e7ecc e47efd40 00000000 b6591f9c c05eb360 00000000 c0605e08
[   53.940622] 7ea0: ed42ac00 c0607e3c 00000034 e47fe3c0 ed4e6000 00000034 c1408b08 c0605cc0
[   53.948810] 7ec0: ed4e7f78 00000000 ed4e6000 00000000 00054600 00000000 00000000 00000000
[   53.956998] 7ee0: c1408b08 0479b828 00000000 c1408b08 b6591cf4 e47fb640 c02b7b8c b6591cf4
[   53.965187] 7f00: ed4e6000 eca65e00 b6591f9c c02b71e0 c02c4bbc c0192be8 ec2dc380 c018dc54
[   53.973374] 7f20: c1408b08 00000001 00000000 0479b828 c15344fd 00000004 00004000 e47fb3c0
[   53.981562] 7f40: c15344fd c112a1d4 c110a05c c02c4bcc 00000000 00000000 c02c4aa8 00000000
[   53.989750] 7f60: e47fab41 0479b828 bee8aad0 e47fb641 e47fb640 00000004 c0145004 b6591cf4
[   53.997938] 7f80: ed4e6000 00000036 b6591f9c c02b7b8c b6591cf4 bee8aad0 b6591ce8 00000036
[   54.006125] 7fa0: c01011c4 c0101000 b6591cf4 bee8aad0 00000004 c0145004 b6591cf4 b6ee603c
[   54.014313] 7fc0: b6591cf4 bee8aad0 b6591ce8 00000036 00077858 00000000 bee8aad0 b6591f9c
[   54.022502] 7fe0: b6ee6018 b6591cac b6ed5848 b6e604bc 60070010 00000004 00000000 00000000
[   54.030699] [<c01bf1e8>] (dma_alloc_attrs) from [<00000034>] (0x34)
[   54.036981] Code: e92d4ff0 e1a05000 e2800d09 e59f60ec (e140a0d8)
[   54.043222] ---[ end trace d872f4c07e2464bf ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:18 +08:00
Robby Cai
2af6194aa2 dma: pxp: porting pxp dma driver from imx_4.19.y
Porting pxp dma drivers v2 and v3 from imx_4.19.y

Signed-off-by: Robby Cai <robby.cai@nxp.com>
2023-10-30 16:08:18 +08:00