linux.git
5 years agoMLK-22861: media: imx8: fix camera hang issue after system resume rel_imx_4.19.35_1.1.0
Guoniu.zhou [Wed, 30 Oct 2019 06:18:41 +0000 (14:18 +0800)]
MLK-22861: media: imx8: fix camera hang issue after system resume

For imx8qxp/qm, gpio will go to low level when system suspend and
will to high when system resume. It will lead ov5640 sensor to reset.
So add reinitialization for sensor when system resume at first time.

For imx815, gpio will have no this issue because GPIO will keep high
when system suspend. So the patch is for fixing issue introduced by
MLK-22202-1. More info, please refer to the ticket.

OV5640 will work at DVP mode by default, but in our use case, it need
to work on MIPI mode, so we can know whether sensor is resetted by
system by checking 0x300E[2] bits.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
5 years agoMGS-5261 [#imx-1771] fix dummy draw hang for 8MM GPU
Xianzhong [Wed, 30 Oct 2019 14:57:20 +0000 (22:57 +0800)]
MGS-5261 [#imx-1771] fix dummy draw hang for 8MM GPU

dummy draw is required for 8MM GPU errata - HBN1285,
this fix shall be applied for GPU power-up transition,
otherwise GPU shader hang with the unnecessary flush.

check GPU MMU state to enable dummy draw fix only.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit f3f44f213eb1c5210aa4fe723256a2e1e699a4dc)

5 years agoMLK-22850 i2c: rpmsg-imx: add msg_id for checking response id
Clark Wang [Fri, 25 Oct 2019 05:05:22 +0000 (13:05 +0800)]
MLK-22850 i2c: rpmsg-imx: add msg_id for checking response id

M4 deals with the rpmsg msg by FIFO. When a timeout occurs on Acore
side, it might impact the next several rpmsg requests and cause the
these requests timeout, too.

For this case, add a msg_id in the unused buffer field, check the
request id of response each time.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 8a94d641b4648a52bcfc43a41e8e8c084e64d2e7)

5 years agoMGS-5284 [#imx-1786] fix GPU panic with vm_mmap failure
Xianzhong [Mon, 28 Oct 2019 17:55:53 +0000 (01:55 +0800)]
MGS-5284 [#imx-1786] fix GPU panic with vm_mmap failure

When vm_mmap fail, code jump to OnError with error status and userLogical variable != 0.
Then _CMAFSLUnmapUser is called with a invalid virtual address (MdlMap->vmaAddr) and cause panic.

Check userLogical to avoid GPU kernel panic for error handling.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 710bbfc815c1058d32ad2295d630efb238ef1beb)

5 years agoMGS-5283 [#imx-1784] fix GPU AXI bus error
Xianzhong [Mon, 28 Oct 2019 14:12:10 +0000 (22:12 +0800)]
MGS-5283 [#imx-1784] fix GPU AXI bus error

Fix GPU safe memory with gcvALLOC_FLAG_4GB_ADDR

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 34b0f803e1ae45db7456fb732612fcdd87ef747a)

5 years agoMGS-5283 [#imx-1238] fix GPU memory without CMA
Xianzhong [Mon, 28 Oct 2019 16:19:05 +0000 (00:19 +0800)]
MGS-5283 [#imx-1238] fix GPU memory without CMA

Fix GPU memory problem when disable CMA allocator,
set LINUX_CMA_FSL=0 in gc_hal_kernel_platform_imx.config

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit ecd385c98fdbf8b0b83519b1ae710f08a617fc82)

5 years agoMGS-4376 [#imx-1238] fix low performance with CMA allocator
Xianzhong [Fri, 9 Nov 2018 18:37:56 +0000 (02:37 +0800)]
MGS-4376 [#imx-1238] fix low performance with CMA allocator

there are lots of PFNs busy message when run GPU tests:
 [  622.370671] alloc_contig_range: [4ea70, 4ea7c) PFNs busy
 [  626.518072] alloc_contig_range: [4ea90, 4ea9c) PFNs busy

this problem is related with CMA migration for fragments,

move CMA allocator after GFP to avoid memory migration,
also fix CMA preempt for contiguous memory request.

can improve CTS and gpubench benchmarks on M850D.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit ad77ed61b72c8362b04361acd2deb685fee15436)

5 years agoMGS-5176 [#imx-1744] Coveriy - need free the pages if malloc memory failed
Ella Feng [Thu, 24 Oct 2019 15:10:15 +0000 (23:10 +0800)]
MGS-5176 [#imx-1744] Coveriy - need free the pages if malloc memory failed

When alloc NonContiguous1MPages, if malloc fail, need free the pages to avoid memory leak

Signed-off-by: Xianzhong Li <xianzhong.li@nxp.com>
(cherry picked from commit 30b05a615613a7e47db5e98dddb0fae9ca42b924)

5 years agoMLK-22843 VPU decoder: first input do not count for XVID format
Shijie Qin [Fri, 25 Oct 2019 01:46:24 +0000 (09:46 +0800)]
MLK-22843 VPU decoder: first input do not count for XVID format

The first input only sequence info, shall do not count to
input-data amount.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
(cherry picked from commit fe111d74927f5f1ddfb8e096fc2f1fcacd377e76)

5 years agoMA-15552 VPU decoder: reset seek_flag and wait_res_change_done in time
Shijie Qin [Wed, 23 Oct 2019 02:56:20 +0000 (10:56 +0800)]
MA-15552 VPU decoder: reset seek_flag and wait_res_change_done in time

Reset seek_flag and wait_res_change_done when receive
VID_API_EVENT_STOPPED event.

This also can fix an Andorid case indirectly:
Seek in the beginning, but has not do capture port streamoff/on
when receive res changed event, then will cause seek_flag status
incorrect.
If abort before receive seq_hdr_found evnt will call stop cmd to
fw, then will reset seek_flag and wait_res_change_done.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
(cherry picked from commit 93019dc136f9ad3c294e6b4be73049977895aed4)

5 years agoMLK-22840:VPU Decoder: improve g_fmt/s_fmt of capture port
ming_qian [Thu, 24 Oct 2019 05:34:27 +0000 (13:34 +0800)]
MLK-22840:VPU Decoder: improve g_fmt/s_fmt of capture port

refine code to make it more clear

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
(cherry picked from commit 8e694ece0711d53339feacd22cbe99560b96957f)

5 years agoMLK-22822:VPU Encoder: check the stream buffer free space before encode
ming_qian [Tue, 22 Oct 2019 06:21:26 +0000 (14:21 +0800)]
MLK-22822:VPU Encoder: check the stream buffer free space before encode
frame

If the free space of stream buffer is not enough for one frame,
vpu may overwrite the data or hang.
so check before encode frame can avoid it.
Add new ctrl V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
user can use this ctrl to set the coded picture buffer size.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
(cherry picked from commit 1af0b35c6bfffa57e27f0a39c8b040b93d973278)

5 years agoMLK-22760:VPU Decoder:improve the start command
ming_qian [Wed, 16 Oct 2019 06:00:30 +0000 (14:00 +0800)]
MLK-22760:VPU Decoder:improve the start command

1. the start command is mixed with transfer data,
   separate them and make code more clear
2. some condition of start_code_bypass is missing.
3. config the pStreamBuffDesc only before send start command

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
(cherry picked from commit 775033eb3dcba27a2b7093caccbc81c1df55ba46)

5 years agoMLK-22753: VPU Decoder: fix stop timeout caused by waiting res change
ming_qian [Mon, 14 Oct 2019 08:26:25 +0000 (16:26 +0800)]
MLK-22753: VPU Decoder: fix stop timeout caused by waiting res change

If firmware report sequence header twice,
and the user don't support the format, such as 10-bit NV12,
user may close vpu decoder directly, it will send stop cmd.
but when driver receive the second sequence header event,
it may waiting for resolution change done,
it'll block the stop command, and cause it timeout.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
(cherry picked from commit 9e1d28861a6f89b9f25641131f8db1ef17b81d3a)

5 years agoMLK-22668 VPU Decoder: correct frame_byte typedef to int
Shijie Qin [Wed, 25 Sep 2019 09:10:18 +0000 (17:10 +0800)]
MLK-22668 VPU Decoder: correct frame_byte typedef to int

Correct frame_byte typedef to int in order to align with
update_stream_addr_vpu() typedef, it maybe negative.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
(cherry picked from commit b04249f00b7cb28a17d3b7b992d565ca0edbee28)

5 years agoMLK-22647: VPU Decoder: make sure clear b_firstseq before send source
ming_qian [Fri, 20 Sep 2019 02:22:42 +0000 (10:22 +0800)]
MLK-22647: VPU Decoder: make sure clear b_firstseq before send source
change event

If b_firstseq is cleared after sending source change event,
user may get invalid frame size.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 6794c08937d4b9b1f8509935ebaeb1072af0b4aa)

5 years agoMLK-22640 VPU Decoder: enhance check free space before add padding data
Shijie Qin [Wed, 18 Sep 2019 08:12:23 +0000 (16:12 +0800)]
MLK-22640 VPU Decoder: enhance check free space before add padding data

Free space may not enough when (end - wptr < SCODE_SIZE),
add this check.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
(cherry picked from commit ce944686a765f514a70e4731379179df30dbba0a)

5 years agoMLK-22606 VPU Decoder: refine decode performance info
Shijie Qin [Wed, 18 Sep 2019 02:43:34 +0000 (10:43 +0800)]
MLK-22606 VPU Decoder: refine decode performance info

1. change to use list record performance info for better trace each
   time-point and not limited to a fixed flow.
2. add total time from open device to each time-point.

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>
(cherry picked from commit 563d17921b33e3b1be96414ef80535146f00edb5)

5 years agoMLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts
Liu Ying [Wed, 23 Oct 2019 09:41:06 +0000 (17:41 +0800)]
MLK-22399 mxc IPUv3: cpmem: Get 0 u/v_offset in __ipu_ch_offset_calc() for some pfmts

There are no u/v planars in the pixel formats
IPU_PIX_FMT_BGRA4444/IPU_PIX_FMT_BGRA5551/IPU_PIX_FMT_AYUV,
so we should explicitly get zero u/v_offset from __ipu_ch_offset_calc()
for those pixel formats.  Without this patch, '-EINVAL' will be
returned from __ipu_ch_offset_calc() as the function return value
and input parameter u/v_offset will not be touched, which is not a
good behavior, because the caller is likely to ignore the function
return value and take the u/v_offset as valid value.  The MXC IPUv3 fb
driver is a such kind of caller, which may get the u/v_offset
for those pixel formats without checking the function return value,
and hence wrongly pass the u/v_offset to PRE driver(finally causes
malfunction).

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit c1ff0b03944e5196497be4f606979f5cb0c1b413)

5 years agoMLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size
Zhang Peng [Wed, 23 Oct 2019 02:02:00 +0000 (10:02 +0800)]
MLK-22815-1: ASoC: fsl: dsp: Expand parameter msg size

Modified parameter msg in dsp, make sure still can transfer right msg
between DSP and user, modified parameter msg in kernel.

Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
(cherry picked from commit ea234701fd310d822a8dd777e96f430ae0b70bc9)

5 years agoMLK-22798-1: dmaengine: fsl-edma-v3: do not enable interrupt in dev_2_dev
Robin Gong [Tue, 22 Oct 2019 16:33:42 +0000 (00:33 +0800)]
MLK-22798-1: dmaengine: fsl-edma-v3: do not enable interrupt in dev_2_dev

Do not enable interrupt in dev_2_dev with cyclic case, since in such
case no any interrupt needed. Otherwise many interrupt will come in
every 64 words transfered in ASRC case, which cause heavy system
loading.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit f0a3172e1ceb04c46377160486ad7dc6ee022850)

5 years agoMLK-22512: power: supply: sabresd_battery: correct wakeup irq for battery
Robin Gong [Wed, 4 Sep 2019 14:15:05 +0000 (22:15 +0800)]
MLK-22512: power: supply: sabresd_battery: correct wakeup irq for battery

Fix no wakeup from suspend while AC/USB charger plug in.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 1674f23cf12175833fa96e8030e9ceeff20f5998)

5 years agoMLK-22392: watchdog: imx8_wdt: correct pretimeout
Robin Gong [Thu, 8 Aug 2019 17:34:00 +0000 (01:34 +0800)]
MLK-22392: watchdog: imx8_wdt: correct pretimeout

scfw think 'new_pretimeout' as the time stamp from now, not
the time before watchdog timeout which is different with kernel
define. Convert it to scfw's format.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 674332ac12ddf593d89e87517573b31be2bbead3)

5 years agoMLK-22768 video: fbdev: mxc_ipuv3_fb: Handle enabled fg properly when set-par happens...
Liu Ying [Fri, 18 Oct 2019 07:55:23 +0000 (15:55 +0800)]
MLK-22768 video: fbdev: mxc_ipuv3_fb: Handle enabled fg properly when set-par happens on bg

When we do set-par for background framebuffer without on-the-fly
flag being set, we should also unset the enabled overlay framebuffer's
on-the-fly flag, otherwise the overlay framebuffer cannot be enabled
again properly because a full mode set procedure is needed for overlay
framebuffer as it experiences a period of time when background
framebuffer stops fetching frames.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit fad9437d99ae234f1c66087d47ad8a547f5f1142)

5 years agoMGS-4894 [#ccc] fix GPU hang for overheat protection
Xianzhong [Wed, 16 Oct 2019 13:09:12 +0000 (21:09 +0800)]
MGS-4894 [#ccc] fix GPU hang for overheat protection

set minimal scaling factor with 20 for 8MM and 6SX GPU

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 03f411ed00d173b683ff2d00edf6196724cccf9d)

5 years agoHSM-24: arm64: dtx: imx8qxp: enable more seco MU users
Stéphane Dion [Tue, 25 Jun 2019 12:36:15 +0000 (14:36 +0200)]
HSM-24: arm64: dtx: imx8qxp: enable more seco MU users

Enable all SECO MUs and increase number of users on the first one.

Signed-off-by: Stéphane Dion <stephane.dion_1@nxp.com>
(cherry picked from commit 56099536022e7e66cfc932069aa4a4701d84aa0b)

5 years agoHSM-24 arm64: dtx: imx8qm: enable more seco MU users
Stéphane Dion [Tue, 25 Jun 2019 12:35:38 +0000 (14:35 +0200)]
HSM-24 arm64: dtx: imx8qm: enable more seco MU users

enable all SECO MUs and increase number of users on the first one.

Signed-off-by: Stéphane Dion <stephane.dion_1@nxp.com>
(cherry picked from commit 2197e1f3a75fe9d9832cff3aa979aa4235a1e7a7)

5 years agoSHE-17 arm64: dts: imx8qm: enable first SECO MU
Stephane Dion [Thu, 13 Jun 2019 15:45:36 +0000 (17:45 +0200)]
SHE-17 arm64: dts: imx8qm: enable first SECO MU

Enabling use of the first SECO MU on i.MX8QM

Signed-off-by: Stephane Dion <stephane.dion_1@nxp.com>
(cherry picked from commit 2b65b323254965b1d563e0aee80e18678d631b9d)

5 years agoSHE-17 arm64: dts: imx8qxp: enable first SECO MU
Stephane Dion [Thu, 13 Jun 2019 15:41:51 +0000 (17:41 +0200)]
SHE-17 arm64: dts: imx8qxp: enable first SECO MU

Enabling use of the first SECO MU on i.MX8QXP

Signed-off-by: Stephane Dion <stephane.dion_1@nxp.com>
(cherry picked from commit b7865b23439de010187a211d1c283d6159807569)

5 years agoSHE-17 soc: imx8: SECO MU driver
Stephane Dion [Thu, 13 Jun 2019 14:20:31 +0000 (16:20 +0200)]
SHE-17 soc: imx8: SECO MU driver

Driver to communicate with SECO over messaging unit.
Expose a char device to user-space so user can write messages that
will be sent to SECO and read messages received from it.
Data that should be exchanged with SECO through shared memory are
indicated to this driver through ioctl calls.

Signed-off-by: Stephane Dion <stephane.dion_1@nxp.com>
(cherry picked from commit eb721810fdc309b6a32a7a64c7686eaa6052cdc7)

5 years agoSHE-17 dt-bindings: add i.MX8 SECO MU driver bindings
Stephane Dion [Thu, 13 Jun 2019 15:29:30 +0000 (17:29 +0200)]
SHE-17 dt-bindings: add i.MX8 SECO MU driver bindings

Documentation of device-tree entry describing messaging
unit (MU) used to communicate with SECO core on i.MX8.

Signed-off-by: Stephane Dion <stephane.dion_1@nxp.com>
(cherry picked from commit 238c7e4dab3b500c61b7def62dcd940b9c103658)

5 years agoMGS-5211 Integrate vivante 6.4.0.p1 GPU driver
Xianzhong [Wed, 9 Oct 2019 17:22:27 +0000 (01:22 +0800)]
MGS-5211 Integrate vivante 6.4.0.p1 GPU driver

Fix Coverity high impact and Vulkan 1.1.3 issues

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit b1c86d22ff27aefbd3d07b78d27cf5d7491cbc1c)

5 years agoMLK-21944: HDP: Fix DP 720x480@60 failed work
Sandor Yu [Tue, 8 Oct 2019 08:30:57 +0000 (16:30 +0800)]
MLK-21944: HDP: Fix DP 720x480@60 failed work

hsync in struct of drm_display_mode is modes's hsync rate in kHz.

But DP register should been set the value of Horizontal Sync Width
that is not define in DRM_MODE().
It could get by (mode->hsync_end - mode->hsync_start).

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
5 years agoMLK-22541 ahci: imx: ahci: imx: set the rx water mark to fix the gen3 link issue
Richard Zhu [Mon, 23 Sep 2019 07:56:25 +0000 (15:56 +0800)]
MLK-22541 ahci: imx: ahci: imx: set the rx water mark to fix the gen3 link issue

- Refine the tx/rx impedance ratio setting.
- Set the RxWaterMark to fix the GEN3 link unstable issue on iMX8QM.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
(cherry picked from commit 13234ea070f3b0048c98b59200bb3ed85659d013)

5 years agoMLK-22653-4 drm/imx: dpu: crtc: Precisely send vbland event if CRTC is active
Liu Ying [Mon, 23 Sep 2019 03:22:42 +0000 (11:22 +0800)]
MLK-22653-4 drm/imx: dpu: crtc: Precisely send vbland event if CRTC is active

If CRTC is active, we should send vblank event in vblank
interrupt handler to make sure it's sent precisely.  This
patch caches the event to be sent at dpu_crtc->event in
the ->atomic_enable() and the ->atomic_flush() callbacks
and finally sends it out in dpu_vbl_irq_handler().  Since
we rely on the interrupt handler to send the event, we
call drm_crtc_vblank_get() to get a vblank refcount to
guarantee the interrupt is enabled when caching the event
in dpu_crtc_queue_state_event() and call drm_crtc_vblank_put()
to drop a vblank refcount in the interrupt handler.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit c5f325790615eb16fe5a448e4b0afa122a33c23e)

5 years agoMLK-22653-3 drm/imx: dpu: crtc: Remove WARN_ON(!crtc->state->event)
Liu Ying [Mon, 23 Sep 2019 02:30:58 +0000 (10:30 +0800)]
MLK-22653-3 drm/imx: dpu: crtc: Remove WARN_ON(!crtc->state->event)

The DRM atomic core ensures crtc->state->event is not NULL when
calling the ->atomic_disable() or the ->atomic_flush() callbacks.
So, let's remove the unnecessary NULL check warning on it.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 834bff532fe22a79708459ec976da0a74a2e97e2)

5 years agoMLK-22653-2 drm/imx: dpu: crtc: Do not send out bogus vblank event in ->atomic_disable()
Liu Ying [Fri, 20 Sep 2019 09:42:05 +0000 (17:42 +0800)]
MLK-22653-2 drm/imx: dpu: crtc: Do not send out bogus vblank event in ->atomic_disable()

When a full modeset is needed, the CRTC could be totally disabled or
enabled/re-enabled after the modeset.  If it's re-enabled, a vblank
event would be sent during the CRTC enablement procedure.  So, a bogus
event should be killed in the ->atomic_disable() callback.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit cee2d80af5e38fb022973c023f548ff02a515882)

5 years agoMLK-22653-1 drm/imx: dpu: crtc: Send vblank event after drm_crtc_vblank_off() in...
Liu Ying [Fri, 20 Sep 2019 09:39:25 +0000 (17:39 +0800)]
MLK-22653-1 drm/imx: dpu: crtc: Send vblank event after drm_crtc_vblank_off() in ->atomic_disable()

The Kdoc for the event entry of struct drm_crtc_state mentions that the
simplest way to send vblank event when a CRTC is being disabled is that
calling drm_crtc_send_vblank_event() somewhen after drm_crtc_vblank_off()
has been called.  This patch takes the way mentioned above to send vblank
event in the ->atomic_disable() callback.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 5b1a8127d98daf13d9f9891dfad2589f339b63d5)

5 years agoMLK-16715-4 usb: chipidea: imx: add imx8qm compatible
Peter Chen [Fri, 17 Nov 2017 02:48:34 +0000 (10:48 +0800)]
MLK-16715-4 usb: chipidea: imx: add imx8qm compatible

It is suitable for imx8qm and imx8qxp currently

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit c5068a42ef39fd97b46813fa51de00147826aaac)

5 years agoMLK-22084: fbdev: hdmi: Fix HDCP function failed work with Sony TV
Sandor Yu [Fri, 20 Sep 2019 07:27:34 +0000 (15:27 +0800)]
MLK-22084: fbdev: hdmi: Fix HDCP function failed work with Sony TV

HDCP function could work in other TVs
but it failed with Sony TV when run hdcp enable/disable stress test.
The TMDS clock is not detected by Sony TV.
The TV seems time sensitive for HDMI TMDS.
Add 20ms delay before TMDS enable make it work.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
5 years agoMLK-22643: mxc: hantro_845: Kconfig: fix dependency on ARCH_FSL_IMX8MM
Julien Olivain [Thu, 19 Sep 2019 10:13:08 +0000 (12:13 +0200)]
MLK-22643: mxc: hantro_845: Kconfig: fix dependency on ARCH_FSL_IMX8MM

Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit d5ee37f96629716042bb0b8317ff8ea0000a769c)

5 years agoMLK-22649 drm/imx: dpu: plane: Add color properties support
Liu Ying [Fri, 20 Sep 2019 05:12:14 +0000 (13:12 +0800)]
MLK-22649 drm/imx: dpu: plane: Add color properties support

As DPU fetchunits support ITU601(limited range)/ITU601_FR(full range)
and ITU709(limited range) YUV to RGB color space conversions, we may
add color encoding and color range properties support for planes.
Considering software backward compatibility, the default color encoding
is set to ITU601 with full color range.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit f491e24e65cb360fb0b3ce56f74d04fd80da77ab)

5 years agoMLK-22600-5 drm/imx: dpu: plane: Support multiple pixel blend modes
Liu Ying [Tue, 17 Sep 2019 01:44:58 +0000 (09:44 +0800)]
MLK-22600-5 drm/imx: dpu: plane: Support multiple pixel blend modes

This patch adds mulitple pixel blend modes for DPU plane.
The modes are "None", "Pre-multiplied" and "Coverage".

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 1259fedbcf2a54f58b47e8531a09b35cc60a43f7)

5 years agoMLK-22600-4 drm/imx: dpu: plane: Support alpha in pixel for overlay planes
Liu Ying [Thu, 12 Sep 2019 06:30:28 +0000 (14:30 +0800)]
MLK-22600-4 drm/imx: dpu: plane: Support alpha in pixel for overlay planes

Now that we've already got proper default blend mode support,
we may introduce alpha in pixel feature for overlay planes.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 4881b188f809d1e3de8662dff94b1b2dfc00a62a)

5 years agoMLK-22600-3 drm/imx: dpu: plane: Support full zpos range for planes
Liu Ying [Thu, 12 Sep 2019 06:29:27 +0000 (14:29 +0800)]
MLK-22600-3 drm/imx: dpu: plane: Support full zpos range for planes

DPU has no limitations on the plane's zpos, so we don't
have to limit the primary plane zpos to be zero and the
overlay plane zpos to be non-zero.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 4487aca4ab19623e1995322871e6f14d48bfef74)

5 years agoMLK-22600-2 drm/imx: dpu: plane: Improve bailout path of dpu_plane_init()
Liu Ying [Thu, 12 Sep 2019 06:24:56 +0000 (14:24 +0800)]
MLK-22600-2 drm/imx: dpu: plane: Improve bailout path of dpu_plane_init()

This patch improves bailout path of dpu_plane_init().
As we'll add more drm properties to the planes later,
this would simply the code.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 1a6ab9246b5d6e71e8a4a0a0b5ea15d7af0c9879)

5 years agoMLK-22600-1 drm/imx: dpu: kms: Support proper default blend mode
Liu Ying [Tue, 3 Sep 2019 19:16:54 +0000 (15:16 -0400)]
MLK-22600-1 drm/imx: dpu: kms: Support proper default blend mode

Without the new blend modes("None", "Pre-multiplied" and "Coverage")
introduced in the below commit, the old userspace assumes alpha in
pixel is per-premultiplied by default.  So, let's support the default
blend mode properly.

commit 468dba6432ca ("drm: Add per-plane pixel blend mode property")

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit ebb7b4874493a8fb42de636e9421877a54399177)

5 years agodrm: Add per-plane pixel blend mode property
Lowry Li [Thu, 23 Aug 2018 08:30:19 +0000 (16:30 +0800)]
drm: Add per-plane pixel blend mode property

Pixel blend modes represent the alpha blending equation
selection, describing how the pixels from the current
plane are composited with the background.

Adds a pixel_blend_mode to drm_plane_state and a
blend_mode_property to drm_plane, and related support
functions.

Defines three blend modes in drm_blend.h.

Changes since v1:
 - Moves the blending equation into the DOC comment
 - Refines the comments of drm_plane_create_blend_mode_property to not
   enumerate the #defines, but instead the string values
 - Uses fg.* instead of pixel.* and plane_alpha instead of plane.alpha
Changes since v2:
 - Refines the comments of drm_plane_create_blend_mode_property:
      1) Puts the descriptions (after the ":") on a new line
      2) Adds explaining why @supported_modes need PREMUL as default
Changes since v3:
 - Refines drm_plane_create_blend_mode_property(). drm_property_add_enum()
   can calculate the index itself just fine, so no point in having the
   caller pass it in.
 - Since the current DRM assumption is that alpha is premultiplied
   as default, define DRM_MODE_BLEND_PREMULTI as 0 will be better.
 - Refines some comments.
Changes since v4:
 - Adds comments in drm_blend.h.
 - Removes setting default value in drm_plane_create_blend_mode_property()
   as it is already in __drm_atomic_helper_plane_reset().
 - Fixes to use state->pixel_blend_mode instead of using
   plane->state->pixel_blend_mode in reset function.
 - Rebases on drm-misc-next.

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Lowry Li <lowry.li@arm.com>
Signed-off-by: Ayan Kumar Halder <ayan.halder@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/245734/
(cherry picked from commit a5ec8332d4280500544e316f76c04a7adc02ce03)
(cherry picked from commit 468dba6432ca97eedc2b8d6e6cc8905cd1e1f34e)

5 years agodrm/atomic: Add __drm_atomic_helper_plane_reset
Alexandru Gheorghe [Sat, 4 Aug 2018 16:15:21 +0000 (17:15 +0100)]
drm/atomic: Add __drm_atomic_helper_plane_reset

There are a lot of drivers that subclass drm_plane_state, all of them
duplicate the code that links together the plane with plane_state.

On top of that, drivers that enable core properties also have to
duplicate the code for initializing the properties to their default
values, which in all cases are the same as the defaults from core.

Change since v1:
- Make it consistent with the other helpers and require that both
  plane and state not be NULL, suggested by Boris Brezillon and
  Philipp Zabel.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20180804161530.12275-2-alexandru-cosmin.gheorghe@arm.com
(cherry picked from commit 7f4de521001f4ea705d505c9f91f58d0f56a0e6d)
(cherry picked from commit f09b192bf1316f0e65fa2dbb5ba4c82a558867ae)

5 years agoMGS-5160 [#imx-1676] enable dummy draw to fix gpu hang and failures on 8MM
Xianzhong [Fri, 6 Sep 2019 14:27:49 +0000 (22:27 +0800)]
MGS-5160 [#imx-1676] enable dummy draw to fix gpu hang and failures on 8MM

Problems:
- GPU hang when run Google Earth apk on 8MM EVK board
- Android DEQP/SKQP CTS have random failures
- Khronos ES20 CTS have random failures

Analysis:
GPU got stuck in shader module when process specific data format,
this is caused by VSI GCNanoUltra Errata(HBN1286), which does not set
the specific intermediate register to 0 in hardware reset sequence after power up,
this wrong register will cause the unexpected result when process specific data type,
wrong behavior will happen and may cause out of bound access in shader programming.

Fix:
GPU driver will submit the predefined command(dummy draw) with fake stream and shader,
also set scissor with (0,0,0,0) to avoid draw out, no pixel output on hardware pipeline,
this workaround can set the specific register to 0 as the effective SW remedy.

Impact:
No obvious functionality and performance impact with dummy draw workaround,
it only takes several cycles in command fetch --> vertex shader --> primitive,
and then cull out of reset of GPU pipelines.

This patch can fix the same GPU problem for 7ULP.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit b14813c419b1f733c0945e99fc403b7a25774d24)

5 years agoMLK-22599 drm/imx: dpu: kms: Support full screen CRTC background
Liu Ying [Tue, 3 Sep 2019 20:44:08 +0000 (16:44 -0400)]
MLK-22599 drm/imx: dpu: kms: Support full screen CRTC background

The CRTC background should be full screen instead of partial
screen, because the DRM core is likely to add configurable
background color support in the future.  We may cover the full
screen with ConstFrame0/1, upon which builds planes.  With this,
it is easier to compute each plane's layer offset vs CRTC start
point and all ConstFrame units can be controlled by CRTC.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit ba18a9874cf010032413ca70f9b358399a143037)

5 years agoMLK-22597 drm/imx: dpu: kms: Allow primary plane on-the-fly disablement
Liu Ying [Wed, 11 Sep 2019 21:06:23 +0000 (21:06 +0000)]
MLK-22597 drm/imx: dpu: kms: Allow primary plane on-the-fly disablement

By correcting plane's ExtDst source in ->atomic_begin() for
cases where pixel combiner is used, commit[1] acctually fixes
the primary plane on-the-fly disablement failure issue which
commit[2] tries to address.  So, let's revert commit[2] and
allow primary plane on-the-fly disablement.

[1] commit 2f3eaadf72c3 ("MLK-22584 drm/imx: dpu: crtc: Correct plane's ExtDst source in ->atomic_begin()")
[2] commit 6477bb1492b7 ("MLK-21525 drm/imx: dpu: kms: Disallow primary plane on-the-fly disablement")

Revert "MLK-21525 drm/imx: dpu: kms: Disallow primary plane on-the-fly disablement"

This reverts commit 6477bb1492b7ac89678891447f3d794e4fdb6df6.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 148075a270dafa0a04f1c9b61d62e2764e469cf3)

5 years agodma: dma-buf.h: change DMA_BUF_IOCTL_PHYS NR to 10
Dong Aisheng [Thu, 12 Sep 2019 07:32:22 +0000 (15:32 +0800)]
dma: dma-buf.h: change DMA_BUF_IOCTL_PHYS NR to 10

Change DMA_BUF_IOCTL_PHYS NR to 10 avoid conflicts with upstream
in the future.

Reviewed-by: Song Bing <bing.song@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit 36abba8f55078424e037e7f7877e9f22062cccbc)

5 years agodrm: drm_fourcc.h: change DRM_FORMAT_MOD_VENDOR_VSI to 0xf1
Dong Aisheng [Thu, 12 Sep 2019 07:30:52 +0000 (15:30 +0800)]
drm: drm_fourcc.h: change DRM_FORMAT_MOD_VENDOR_VSI to 0xf1

change DRM_FORMAT_MOD_VENDOR_VSI to 0xf1 to avoid conflicts
with upstream in the future.

Reviewed-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit aa4bedcc4c316d8d9400c3709840d5622e64e9b8)

5 years agodrm: drm_fourcc.h: change DRM_FORMAT_MOD_VENDOR_AMPHION to 0xf0
Dong Aisheng [Thu, 12 Sep 2019 07:29:10 +0000 (15:29 +0800)]
drm: drm_fourcc.h: change DRM_FORMAT_MOD_VENDOR_AMPHION to 0xf0

change DRM_FORMAT_MOD_VENDOR_AMPHION to 0xf0 to avoid conflicts
with upstream in the future.

Reviewed-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
(cherry picked from commit c91d6eb654f557f683e5cdd44181581adbe15378)

5 years agoMLK-22584 drm/imx: dpu: crtc: Correct plane's ExtDst source in ->atomic_begin()
Liu Ying [Wed, 4 Sep 2019 18:01:13 +0000 (14:01 -0400)]
MLK-22584 drm/imx: dpu: crtc: Correct plane's ExtDst source in ->atomic_begin()

In dpu_helper_funcs->atomic_begin(), we temporarily set the plane's
ExtDst source to ConstFrame in shadow.  In the plane driver,
dpu_plane_helper_funcs->atomic_update() can update the shadow if
necessary.  This way, we may set the source as either ConstFrame
or LayerBlend.  We only set the source for the old top plane in
->atomic_begin().  However, in cases where pixel combiner is used,
the top planes are tracked separately for the master stream and
the slave stream with ->is_left_top or ->is_right_top flags
instead of ->is_top flag when pixel combiner is not used.  This
patch corrects the source for the cases where pixel combiner is
used.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit ff19118af177bab2dc765b242cf5b4392910a5e7)

5 years agoMLK-22573-2 gpu: imx: dpu-blit: Do not initialize STORE9_STATIC register
Liu Ying [Mon, 9 Sep 2019 21:50:13 +0000 (17:50 -0400)]
MLK-22573-2 gpu: imx: dpu-blit: Do not initialize STORE9_STATIC register

The bit DIV0 of register STORE9_STATIC is used as a control bit
to fix the unsynchronization issue bewteen two display streams
in FrameGen side-by-side mode, which is introduced from an ECO
operation for the display controller.  The bit has to be one
when the side-by-side mode is enabled.  And, it has to be zero
when the mode is disabled, otherwise, a single display stream
cannot startup correctly.  Since the DPU common driver initializes
the register for us at the driver probe stage and system resume
stage, we may remove the same initialization logic of our own.
Without this patch, as the DPU blit engine DRM driver is resumed
relatively late, the bit would be overwritten to be zero at the
driver's ->resume() callback, which causes the display controller
cannot be correctly resumed from FrameGen side-by-side mode and
content ExtDst shadow load done event from the slave stream won't
come.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 785a8705624e114f4f3d3d0836826130fb57b46f)

5 years agoMLK-22573-1 gpu: imx: dpu: common: Initialize Store9 when necessary
Liu Ying [Mon, 9 Sep 2019 21:49:07 +0000 (17:49 -0400)]
MLK-22573-1 gpu: imx: dpu: common: Initialize Store9 when necessary

The bit DIV0 of register STORE9_STATIC is used as a control bit
to fix the unsynchronization issue bewteen two display streams
in FrameGen side-by-side mode, which is introduced from an ECO
operation for the display controller.  The bit has to be one
when the side-by-side mode is enabled.  And, it has to be zero
when the mode is disabled, otherwise, a single display stream
cannot startup correctly.  As Store9 is a part of blit engine,
the rest bits of the register should also be initialized before
any regular blit.  Currently, we need to do the initialization
at driver probe stage and system resume stage at least.  Since
we have the DPU KMS driver and DPU blit engine DRM driver, the
initialization needs to be done only in the DPU common driver
so that the register won't be overwritten accidentally by the
two drivers with each other.  We see the overwriting issue at
the system resume stage because the blit engine driver resumes
relatively late and it initializes the register blindly by
writing the bit to zero, thus the display controller cannot be
resumed correctly in FrameGen side-by-side mode and content
ExtDst shadow load done event from the slave stream won't come.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit e90a6a917e3f5d7087e0de5616b6e8a055906767)

5 years agoMMFMWK-8552-2: correct the error no when reqbufs fail
ming_qian [Wed, 11 Sep 2019 08:59:58 +0000 (16:59 +0800)]
MMFMWK-8552-2: correct the error no when reqbufs fail

if stream status is on,
reqbufs will fail,
return -EBUSY instead of -EINVAL

Signed-off-by: ming_qian <ming.qian@nxp.com>
(cherry picked from commit 65cfc81f73639c633d9e9b7c23c9c58443fa661f)

5 years agoMMFMWK-8552: fix hang when do seek for resolution change stream
ming_qian [Wed, 11 Sep 2019 02:04:17 +0000 (10:04 +0800)]
MMFMWK-8552: fix hang when do seek for resolution change stream

driver tell seek and res change by the status of output stream.
if res change is not handled properly,
the stream may hang.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
(cherry picked from commit 86163d3eab3760f9659c7a58ff4cdf1a0a58a810)

5 years agoMLK-22527-2 usb: cdns3: quit if the port is woken up during suspending
Peter Chen [Mon, 1 Jul 2019 10:05:35 +0000 (18:05 +0800)]
MLK-22527-2 usb: cdns3: quit if the port is woken up during suspending

If the port receives the resume during the suspending, it needs to
quit instead of going on, it could keep controller status correct,
and eliminating below timeout warning message.

cdns-usb3 5b110000.usb3: wait lpm_clk_req timeout
cdns-usb3 5b110000.usb3: wait phy_refclk_req timeout

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests
Peter Chen [Mon, 9 Sep 2019 06:37:34 +0000 (14:37 +0800)]
MLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests

If the non-control endpoints want to halt, but there are pending
requests on this endpoint, we need to return -EAGAIN, otherwise,
the controller may be in stuck if we stall the doolbell'ed
endpoint.

With this change, we could pass the USB certification MSC test.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMGS-5144 GPU: Integrate 6.4.0 official release
Xianzhong [Tue, 10 Sep 2019 13:51:28 +0000 (21:51 +0800)]
MGS-5144 GPU: Integrate 6.4.0 official release

Include more bug-fixing for Vulkan 1.1 conformance,
Add EVIS2 shader binaries for vip8000nanosi,
Upgrade NNAPI 2.0 with OVXLIB.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
5 years agotcp: Reset bytes_acked and bytes_received when disconnecting
Christoph Paasch [Sat, 6 Jul 2019 23:13:07 +0000 (16:13 -0700)]
tcp: Reset bytes_acked and bytes_received when disconnecting

[ Upstream commit e858faf556d4e14c750ba1e8852783c6f9520a0e ]

If an app is playing tricks to reuse a socket via tcp_disconnect(),
bytes_acked/received needs to be reset to 0. Otherwise tcp_info will
report the sum of the current and the old connection..

Cc: Eric Dumazet <edumazet@google.com>
Fixes: 0df48c26d841 ("tcp: add tcpi_bytes_acked to tcp_info")
Fixes: bdd1f9edacb5 ("tcp: add tcpi_bytes_received to tcp_info")
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1b200acde418f4d6d87279d3f6f976ebf188f272)

5 years agotcp: fix tcp_set_congestion_control() use from bpf hook
Eric Dumazet [Fri, 19 Jul 2019 02:28:14 +0000 (19:28 -0700)]
tcp: fix tcp_set_congestion_control() use from bpf hook

[ Upstream commit 8d650cdedaabb33e85e9b7c517c0c71fcecc1de9 ]

Neal reported incorrect use of ns_capable() from bpf hook.

bpf_setsockopt(...TCP_CONGESTION...)
  -> tcp_set_congestion_control()
   -> ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)
    -> ns_capable_common()
     -> current_cred()
      -> rcu_dereference_protected(current->cred, 1)

Accessing 'current' in bpf context makes no sense, since packets
are processed from softirq context.

As Neal stated : The capability check in tcp_set_congestion_control()
was written assuming a system call context, and then was reused from
a BPF call site.

The fix is to add a new parameter to tcp_set_congestion_control(),
so that the ns_capable() call is only performed under the right
context.

Fixes: 91b5b21c7c16 ("bpf: Add support for changing congestion control")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lawrence Brakmo <brakmo@fb.com>
Reported-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c60f57dfe995172c2f01e59266e3ffa3419c6cd9)

5 years agotcp: be more careful in tcp_fragment()
Eric Dumazet [Fri, 19 Jul 2019 18:52:33 +0000 (11:52 -0700)]
tcp: be more careful in tcp_fragment()

[ Upstream commit b617158dc096709d8600c53b6052144d12b89fab ]

Some applications set tiny SO_SNDBUF values and expect
TCP to just work. Recent patches to address CVE-2019-11478
broke them in case of losses, since retransmits might
be prevented.

We should allow these flows to make progress.

This patch allows the first and last skb in retransmit queue
to be split even if memory limits are hit.

It also adds the some room due to the fact that tcp_sendmsg()
and tcp_sendpage() might overshoot sk_wmem_queued by about one full
TSO skb (64KB size). Note this allowance was already present
in stable backports for kernels < 4.15

Note for < 4.15 backports :
 tcp_rtx_queue_tail() will probably look like :

static inline struct sk_buff *tcp_rtx_queue_tail(const struct sock *sk)
{
struct sk_buff *skb = tcp_send_head(sk);

return skb ? tcp_write_queue_prev(sk, skb) : tcp_write_queue_tail(sk);
}

Fixes: f070ef2ac667 ("tcp: tcp_fragment() should apply sane memory limits")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrew Prout <aprout@ll.mit.edu>
Tested-by: Andrew Prout <aprout@ll.mit.edu>
Tested-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Tested-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Christoph Paasch <cpaasch@apple.com>
Cc: Jonathan Looney <jtl@netflix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6323c238bb4374d1477348cfbd5854f2bebe9a21)

5 years agotcp: refine memory limit test in tcp_fragment()
Eric Dumazet [Fri, 21 Jun 2019 13:09:55 +0000 (06:09 -0700)]
tcp: refine memory limit test in tcp_fragment()

commit b6653b3629e5b88202be3c9abc44713973f5c4b4 upstream.

tcp_fragment() might be called for skbs in the write queue.

Memory limits might have been exceeded because tcp_sendmsg() only
checks limits at full skb (64KB) boundaries.

Therefore, we need to make sure tcp_fragment() wont punish applications
that might have setup very low SO_SNDBUF values.

Fixes: f070ef2ac667 ("tcp: tcp_fragment() should apply sane memory limits")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Christoph Paasch <cpaasch@apple.com>
Tested-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit dad3a9314ac95dedc007bc7dacacb396ea10e376)

5 years agotcp: enforce tcp_min_snd_mss in tcp_mtu_probing()
Eric Dumazet [Sat, 8 Jun 2019 17:22:49 +0000 (10:22 -0700)]
tcp: enforce tcp_min_snd_mss in tcp_mtu_probing()

commit 967c05aee439e6e5d7d805e195b3a20ef5c433d6 upstream.

If mtu probing is enabled tcp_mtu_probing() could very well end up
with a too small MSS.

Use the new sysctl tcp_min_snd_mss to make sure MSS search
is performed in an acceptable range.

CVE-2019-11479 -- tcp mss hardcoded to 48

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Cc: Jonathan Looney <jtl@netflix.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Bruce Curtis <brucec@netflix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 59222807fcc99951dc769cd50e132e319d73d699)

5 years agotcp: add tcp_min_snd_mss sysctl
Eric Dumazet [Thu, 6 Jun 2019 16:15:31 +0000 (09:15 -0700)]
tcp: add tcp_min_snd_mss sysctl

commit 5f3e2bf008c2221478101ee72f5cb4654b9fc363 upstream.

Some TCP peers announce a very small MSS option in their SYN and/or
SYN/ACK messages.

This forces the stack to send packets with a very high network/cpu
overhead.

Linux has enforced a minimal value of 48. Since this value includes
the size of TCP options, and that the options can consume up to 40
bytes, this means that each segment can include only 8 bytes of payload.

In some cases, it can be useful to increase the minimal value
to a saner value.

We still let the default to 48 (TCP_MIN_SND_MSS), for compatibility
reasons.

Note that TCP_MAXSEG socket option enforces a minimal value
of (TCP_MIN_MSS). David Miller increased this minimal value
in commit c39508d6f118 ("tcp: Make TCP_MAXSEG minimum more correct.")
from 64 to 88.

We might in the future merge TCP_MIN_SND_MSS and TCP_MIN_MSS.

CVE-2019-11479 -- tcp mss hardcoded to 48

Signed-off-by: Eric Dumazet <edumazet@google.com>
Suggested-by: Jonathan Looney <jtl@netflix.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Bruce Curtis <brucec@netflix.com>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7f9f8a37e563c67b24ccd57da1d541a95538e8d9)

5 years agotcp: tcp_fragment() should apply sane memory limits
Eric Dumazet [Sat, 18 May 2019 12:12:05 +0000 (05:12 -0700)]
tcp: tcp_fragment() should apply sane memory limits

commit f070ef2ac66716357066b683fb0baf55f8191a2e upstream.

Jonathan Looney reported that a malicious peer can force a sender
to fragment its retransmit queue into tiny skbs, inflating memory
usage and/or overflow 32bit counters.

TCP allows an application to queue up to sk_sndbuf bytes,
so we need to give some allowance for non malicious splitting
of retransmit queue.

A new SNMP counter is added to monitor how many times TCP
did not allow to split an skb if the allowance was exceeded.

Note that this counter might increase in the case applications
use SO_SNDBUF socket option to lower sk_sndbuf.

CVE-2019-11478 : tcp_fragment, prevent fragmenting a packet when the
socket is already using more than half the allowed space

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jonathan Looney <jtl@netflix.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Cc: Bruce Curtis <brucec@netflix.com>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ec83921899a571ad70d582934ee9e3e07f478848)

5 years agotcp: limit payload size of sacked skbs
Eric Dumazet [Sat, 18 May 2019 00:17:22 +0000 (17:17 -0700)]
tcp: limit payload size of sacked skbs

commit 3b4929f65b0d8249f19a50245cd88ed1a2f78cff upstream.

Jonathan Looney reported that TCP can trigger the following crash
in tcp_shifted_skb() :

BUG_ON(tcp_skb_pcount(skb) < pcount);

This can happen if the remote peer has advertized the smallest
MSS that linux TCP accepts : 48

An skb can hold 17 fragments, and each fragment can hold 32KB
on x86, or 64KB on PowerPC.

This means that the 16bit witdh of TCP_SKB_CB(skb)->tcp_gso_segs
can overflow.

Note that tcp_sendmsg() builds skbs with less than 64KB
of payload, so this problem needs SACK to be enabled.
SACK blocks allow TCP to coalesce multiple skbs in the retransmit
queue, thus filling the 17 fragments to maximal capacity.

CVE-2019-11477 -- u16 overflow of TCP_SKB_CB(skb)->tcp_gso_segs

Fixes: 832d11c5cd07 ("tcp: Try to restore large SKBs while SACK processing")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jonathan Looney <jtl@netflix.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Bruce Curtis <brucec@netflix.com>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c09be31461ed140976c60a87364415454a2c3d42)

5 years agotcp: tcp_grow_window() needs to respect tcp_space()
Eric Dumazet [Tue, 16 Apr 2019 17:55:20 +0000 (10:55 -0700)]
tcp: tcp_grow_window() needs to respect tcp_space()

[ Upstream commit 50ce163a72d817a99e8974222dcf2886d5deb1ae ]

For some reason, tcp_grow_window() correctly tests if enough room
is present before attempting to increase tp->rcv_ssthresh,
but does not prevent it to grow past tcp_space()

This is causing hard to debug issues, like failing
the (__tcp_select_window(sk) >= tp->rcv_wnd) test
in __tcp_ack_snd_check(), causing ACK delays and possibly
slow flows.

Depending on tcp_rmem[2], MTU, skb->len/skb->truesize ratio,
we can see the problem happening on "netperf -t TCP_RR -- -r 2000,2000"
after about 60 round trips, when the active side no longer sends
immediate acks.

This bug predates git history.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6728c6174a47b8a04ceec89aca9e1195dee7ff6b)

5 years agoMLK-22562 usb:common Separated decoding functions from dwc3 driver.
Pawel Laszczak [Sun, 21 Jul 2019 18:32:15 +0000 (19:32 +0100)]
MLK-22562 usb:common Separated decoding functions from dwc3 driver.

Patch moves some decoding functions from driver/usb/dwc3/debug.h driver
to driver/usb/common/debug.c file. These moved functions include:
    dwc3_decode_get_status
    dwc3_decode_set_clear_feature
    dwc3_decode_set_address
    dwc3_decode_get_set_descriptor
    dwc3_decode_get_configuration
    dwc3_decode_set_configuration
    dwc3_decode_get_intf
    dwc3_decode_set_intf
    dwc3_decode_synch_frame
    dwc3_decode_set_sel
    dwc3_decode_set_isoch_delay
    dwc3_decode_ctrl

These functions are used also in inroduced cdns3 driver.

All functions prefixes were changed from dwc3 to usb.
Also, function's parameters has been extended according to the name
of fields in standard SETUP packet.
Additionally, patch adds usb_decode_ctrl function to
include/linux/usb/ch9.h file.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
(cherry picked from commit 046b47df488c6956b9a4420e684274cc0ca0fb70)
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22507: mxc-jpeg: Return rgb24 pixfmt from decoder when app14 is present
Mirela Rabulea [Mon, 26 Aug 2019 15:51:20 +0000 (18:51 +0300)]
MLK-22507: mxc-jpeg: Return rgb24 pixfmt from decoder when app14 is present

When GST receives V4L2_EVENT_SOURCE_CHANGE, it calls g_fmt ioctl and
expects that the driver will report the pixel format.
So far, the driver was unable to distinguish, by looking at the jpeg
SOF marker, if an image is YUV444 or RGB24, both have 3 color components
and no subsampling.
Consider the colorspace is RGB if the transform flag from APP14 marker
segment has the value 0, in mxc_jpeg_parse, if needed, update the pixel
format from yuv444 to rgb24.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>
5 years agoMLK-22366-8 usb: cdns3: gadget: improve EP0 init and de-init routine
Peter Chen [Thu, 22 Aug 2019 09:37:52 +0000 (17:37 +0800)]
MLK-22366-8 usb: cdns3: gadget: improve EP0 init and de-init routine

 We find there is still EP0 request duirng EP0 configuration, and the
 pointer for this request is incorrect. In this commit, we make sure
 the EP0 request has deleted from the list at .udc_stop. If there is
 still one EP0 request during .udc_start, we will show a warning. Below
 oops is fixed by this change.

[ 6339.760440] init: Sending signal 9 to service 'adbd' (pid 1878) process group...
[ 6339.780901] audit: audit_lost=111533 audit_rate_limit=5 audit_backlog_limit=64
[ 6339.788319] audit: rate limit exceeded
[ 6339.823842] libprocessgroup: Successfully killed process cgroup uid 0 pid 1878 in 54ms
[ 6339.832589] init: Service 'adbd' (pid 1878) received signal 9
[ 6339.839108] init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:14)
[ 6340.002992] init: Received control message 'start' for 'adbd' from pid: 3324 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
[ 6340.023541] read descriptors
[ 6340.026452] read strings
[ 6340.927793] Unable to handle kernel paging request at virtual address 00020249
[ 6340.935026] Mem abort info:
[ 6340.937824]   Exception class = DABT (current EL), IL = 32 bits
[ 6340.943747]   SET = 0, FnV = 0
[ 6340.946805]   EA = 0, S1PTW = 0
[ 6340.949949] Data abort info:
[ 6340.952834]   ISV = 0, ISS = 0x00000044
[ 6340.956673]   CM = 0, WnR = 1
[ 6340.959648] user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008f0309000
[ 6340.966178] [0000000000020249] *pgd=0000000000000000
[ 6340.971151] Internal error: Oops: 96000044 [#1] PREEMPT SMP
[ 6340.976726] Modules linked in:
[ 6340.979789] CPU: 5 PID: 1910 Comm: usb@1.1-service Not tainted 4.14.98-07858-g3dd4133 #1
[ 6340.987888] Hardware name: Freescale i.MX8QM MEK (DT)
[ 6340.992945] task: ffff8008ee468e00 task.stack: ffff00000f1a8000
[ 6340.998884] PC is at cdns3_ep0_config+0x50/0xf0
[ 6341.003418] LR is at cdns3_ep0_config+0x40/0xf0
[ 6341.007949] pc : [<ffff0000089be374>] lr : [<ffff0000089be364>] pstate: 200001c5
[ 6341.015349] sp : ffff00000f1abc80
[ 6341.018668] x29: ffff00000f1abc80 x28: ffff8008ee468e00
[ 6341.023992] x27: ffff000009022000 x26: 0000000000000040
[ 6341.029318] x25: ffff00000f1abeb0 x24: ffff8008f05a4500
[ 6341.034635] x23: ffff8008f3929680 x22: 0000000000000040
[ 6341.039952] x21: 0000000000400001 x20: ffff00000f1f0000
[ 6341.045268] x19: ffff8008f2d22000 x18: 0000f7c42593c000
[ 6341.050585] x17: 0000f7c4258b17d0 x16: ffff00000829ecd8
[ 6341.055902] x15: 0000000000000000 x14: 0000000430060004
[ 6341.061219] x13: 0002010507010142 x12: ff02000004090002
[ 6341.066535] x11: 0002820507000200 x10: ffff8008eb685e68
[ 6341.071852] x9 : 0000000000000000 x8 : ffff8008ea9efd00
[ 6341.077168] x7 : 0000000000000000 x6 : 000000000000003f
[ 6341.082485] x5 : 0000000000000040 x4 : 0000000000000000
[ 6341.087802] x3 : 0000000000020241 x2 : 0000000000000000
[ 6341.093119] x1 : ffff8008f059d040 x0 : ffff8008f059d000
[ 6341.098438]
[ 6341.098438] X0: 0xffff8008f059cf80:
[ 6341.103405] cf80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.111623] cfa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.119842] cfc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.128051] cfe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.136261] d000  f059dc00 ffff8008 082a01f8 ffff0000 00000000 00000000 00000000 00000000
[ 6341.144479] d020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.152689] d040  00020241 00000000 00000000 00000000 00000000 00000000 f059d058 ffff8008
[ 6341.160898] d060  f059d058 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.169110]
[ 6341.169110] X1: 0xffff8008f059cfc0:
[ 6341.174077] cfc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.182287] cfe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.190496] d000  f059dc00 ffff8008 082a01f8 ffff0000 00000000 00000000 00000000 00000000
[ 6341.198706] d020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.206916] d040  00020241 00000000 00000000 00000000 00000000 00000000 f059d058 ffff8008
[ 6341.215126] d060  f059d058 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.223335] d080  00000000 00000000 00000000 00000000 f3647c00 ffff8008 00000000 00000000
[ 6341.231545] d0a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.239759]
[ 6341.239759] X8: 0xffff8008ea9efc80:
[ 6341.244724] fc80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.252934] fca0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.261145] fcc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.269371] fce0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.277580] fd00  6d766976 ffffffff 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.285790] fd20  00000000 00000000 00000000 00000000 ebbfb800 ffff8008 f7feee00 ffff8008
[ 6341.294000] fd40  f16a2980 ffff8008 f16a2300 ffff8008 00000000 00000000 00000000 00000000
[ 6341.302209] fd60  0000000d 00000006 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.310430]
[ 6341.310430] X10: 0xffff8008eb685de8:
[ 6341.315484] 5de8  00000000 00000000 00000000 00000000 00000000 00000000 f2d22010 ffff8008
[ 6341.323693] 5e08  00000000 00000000 00000000 00000000 eb685e18 ffff8008 eb685e18 ffff8008
[ 6341.331903] 5e28  4f894f89 00000000 ea9ef800 ffff8008 00000000 00000000 00000000 00000000
[ 6341.340113] 5e48  eb685e48 ffff8008 eb685e48 ffff8008 00000005 00000003 00000002 00000000
[ 6341.348323] 5e68  00000000 00010001 00000000 00000000 23df23df 00000000 eb685e80 ffff8008
[ 6341.356532] 5e88  eb685e80 ffff8008 00000003 00000000 316e316e 00000000 0fbcbdb8 ffff0000
[ 6341.364741] 5ea8  0fbcbdb8 ffff0000 00000000 00000000 f3b05b80 ffff8008 f2f2ce80 ffff8008
[ 6341.372952] 5ec8  eea86900 ffff8008 eea8691c ffff8008 00000074 00000003 00000003 00000005
[ 6341.381166]
[ 6341.381166] X19: 0xffff8008f2d21f80:
[ 6341.386217] 1f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.394427] 1fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.402637] 1fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.410846] 1fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.419057] 2000  f7540010 ffff8008 f7540010 ffff8008 00000000 00000000 f2d22018 ffff8008
[ 6341.427285] 2020  f2d22018 ffff8008 08a06998 ffff0000 f2d29800 ffff8008 091c3650 ffff0000
[ 6341.435502] 2040  f2d63218 ffff8008 f2d63330 ffff8008 f2d64030 ffff8008 00000000 00000005
[ 6341.443720] 2060  00000000 00000000 095d0150 ffff0000 f7540010 ffff8008 f2d64100 ffff8008
[ 6341.451932]
[ 6341.451932] X23: 0xffff8008f3929600:
[ 6341.456986] 9600  00000001 ffff8008 00010000 00000000 74737973 615f6d65 735f7070 63697274
[ 6341.465195] 9620  646f6d74 35314065 38333636 36303837 2e353432 00747874 00000000 00000000
[ 6341.473414] 9640  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.481632] 9660  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.489842] 9680  31316235 30303030 6273752e 00000033 00000000 00000000 f3929690 ffff8008
[ 6341.498051] 96a0  00000000 00000000 00000cfe 00000000 002010df 00000000 00000000 00000000
[ 6341.506261] 96c0  00000000 00000000 00000000 00000000 00000000 00000000 25401230 ffff0000
[ 6341.514470] 96e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.522683]
[ 6341.522683] X24: 0xffff8008f05a4480:
[ 6341.527737] 4480  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.535947] 44a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.544156] 44c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.552366] 44e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.560575] 4500  00000000 00000000 00000000 00000000 f7a338a0 ffff8008 6e038c00 ffff8000
[ 6341.568786] 4520  ec35b6a0 ffff8008 090571f0 ffff0000 00000000 00000000 00000002 00000000
[ 6341.577026] 4540  00028001 0005801e ee468e00 ffff8008 00000000 00000000 f05a4558 ffff8008
[ 6341.585248] 4560  f05a4558 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.593478]
[ 6341.593478] X28: 0xffff8008ee468d80:
[ 6341.598531] 8d80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.606740] 8da0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.614950] 8dc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.623160] 8de0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 6341.631369] 8e00  00000022 00000000 ffffffff ffffffff 00000002 00000000 00000000 00000000
[ 6341.639579] 8e20  0f1a8000 ffff0000 00000002 00404040 00000000 00000000 f7acd438 ffff8008
[ 6341.647789] 8e40  00000001 00000005 0000003d 00000000 00170a04 00000001 f2f9e200 ffff8008
[ 6341.655998] 8e60  00000005 00000001 00000078 00000078 00000078 00000000 09031d48 ffff0000
[ 6341.664209]
[ 6341.665707] Process usb@1.1-service (pid: 1910, stack limit = 0xffff00000f1a8000)
[ 6341.673192] Call trace:
[ 6341.675644] Exception stack(0xffff00000f1abb40 to 0xffff00000f1abc80)
[ 6341.682092] bb40: ffff8008f059d000 ffff8008f059d040 0000000000000000 0000000000020241
[ 6341.689927] bb60: 0000000000000000 0000000000000040 000000000000003f 0000000000000000
[ 6341.697763] bb80: ffff8008ea9efd00 0000000000000000 ffff8008eb685e68 0002820507000200
[ 6341.705599] bba0: ff02000004090002 0002010507010142 0000000430060004 0000000000000000
[ 6341.713435] bbc0: ffff00000829ecd8 0000f7c4258b17d0 0000f7c42593c000 ffff8008f2d22000
[ 6341.721271] bbe0: ffff00000f1f0000 0000000000400001 0000000000000040 ffff8008f3929680
[ 6341.729107] bc00: ffff8008f05a4500 ffff00000f1abeb0 0000000000000040 ffff000009022000
[ 6341.736943] bc20: ffff8008ee468e00 ffff00000f1abc80 ffff0000089be364 ffff00000f1abc80
[ 6341.744779] bc40: ffff0000089be374 00000000200001c5 ffff8008f36abe00 0000000000000000
[ 6341.752615] bc60: 0000ffffffffffff ffff8008f36abe00 ffff00000f1abc80 ffff0000089be374
[ 6341.760459] [<ffff0000089be374>] cdns3_ep0_config+0x50/0xf0
[ 6341.766041] [<ffff0000089b9ea0>] cdns3_gadget_config+0x18/0xb4
[ 6341.771878] [<ffff0000089ba074>] cdns3_gadget_udc_start+0x40/0x60
[ 6341.777978] [<ffff000008a06a8c>] udc_bind_to_driver+0xc8/0x118
[ 6341.783814] [<ffff000008a06e5c>] usb_gadget_probe_driver+0xa0/0x12c
[ 6341.790087] [<ffff000008a04d2c>] gadget_dev_desc_UDC_store+0xc8/0x124
[ 6341.796536] [<ffff00000832fc9c>] configfs_write_file+0xe8/0x184
[ 6341.802457] [<ffff00000829e640>] vfs_write+0xb8/0x1d4
[ 6341.807513] [<ffff00000829ed28>] SyS_write+0x50/0xb0
[ 6341.812480] Exception stack(0xffff00000f1abec0 to 0xffff00000f1ac000)
[ 6341.818928] bec0: 0000000000000014 0000f7c424dff219 000000000000000d 00000000000001b6
[ 6341.826764] bee0: 0000000000000000 0000f7c424dff008 0000000000000000 0000000000000000
[ 6341.834599] bf00: 0000000000000040 0000000000000000 000000000000000d 0000f7c424dff070
[ 6341.842436] bf20: 0000f7c424dff028 0000000000000bb0 0000f7c425400000 0000000000000000
[ 6341.850272] bf40: 0000f7c425e3ac28 0000f7c4258b17d0 0000f7c42593c000 000000000000000d
[ 6341.858108] bf60: 0000000000000014 0000f7c424dff219 0000000000088241 00000000000001b6
[ 6341.865944] bf80: 0000f7c424dff141 0000f7c424d02000 aaaaaaaaaaaaaaab 0000b23b75c123c8
[ 6341.873780] bfa0: 0000000000000022 0000f7c424dff060 0000f7c425e121b0 0000f7c424dff040
[ 6341.881617] bfc0: 0000f7c4258b17d8 0000000040000000 0000000000000014 0000000000000040
[ 6341.889452] bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 6341.897291] [<ffff000008083ac0>] el0_svc_naked+0x34/0x38
[ 6341.902608] Code: b4000100 f9402003 91010001 f9402402 (f9000462)
[ 6341.908714] ---[ end trace b38490f7134cdbe8 ]---
[ 6341.913334] Kernel panic - not syncing: Fatal exception
[ 6341.918567] SMP: stopping secondary CPUs
[ 6341.922494] Kernel Offset: disabled
[ 6341.925983] CPU features: 0x180200c
[ 6341.929473] Memory Limit: none
[ 6341.932541] Rebooting in 5 seconds..

Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-7 usb: cdns3: gadget: quit if endpoint has already disabled
Peter Chen [Thu, 8 Aug 2019 07:52:49 +0000 (15:52 +0800)]
MLK-22366-7 usb: cdns3: gadget: quit if endpoint has already disabled

It fixed below oops:
audit: audit_lost=500851 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
libprocessgroup: Successfully killed process cgroup uid 0 pid 25371 in 49ms
init: Service 'adbd' (pid 25371) received signal 9
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:14)
init: Received control message 'start' for 'adbd' from pid: 3308 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
init: Received control message 'start' for 'adbd' from pid: 3447 (system_server)
android_work: did not send uevent (0 0           (null))
audit: audit_lost=500888 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=500925 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC 32:e7:67:29:5f:d8
usb0: MAC 02:5c:48:b3:2b:d7
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
Unable to handle kernel NULL pointer dereference at virtual address 00000002
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008f7bed000
[0000000000000002] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 2 PID: 3326 Comm: Binder:3276_2 Not tainted 4.14.98-07848-gfb2a5a8 #1
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f77f3800 task.stack: ffff00000b378000
PC is at __cdns3_gadget_ep_queue.isra.18+0x238/0x524
LR is at cdns3_gadget_ep_queue+0x44/0xd8
pc : [<ffff0000089bbf90>] lr : [<ffff0000089bc2c0>] pstate: 400001c5
sp : ffff00000b37ba40
x29: ffff00000b37ba40 x28: ffff8008f235fa00
x27: ffff8008f2f11600 x26: ffff8008f2dee118
x25: ffff8008f2df0000 x24: 0000000000000000
x23: ffff000009c8e000 x22: ffff8008f2df0000
x21: 0000000000000000 x20: ffff8008f2dee118
x19: ffff8008f1f1ac00 x18: 0000fcc72810fc1a
x17: 0000fcc729e2d0e0 x16: ffff0000082b4430
x15: 0000000000000000 x14: ffffffffffffffff
x13: 0000000000000000 x12: 0000000000000020
x11: 0000000000000020 x10: 0101010101010101
x9 : 0000000000000000 x8 : 0000000000000024
x7 : 0000000040000000 x6 : 0000000000000020
x5 : 0000000000000000 x4 : 0000000000000000
x3 : 0000000000000140 x2 : 0000000000000000
x1 : ffff8008f1f1ac00 x0 : ffff8008f7738010

X0: 0xffff8008f7737f90:
7f90  f75baef8 ffff8008 00000000 00000000 3305708c 00000000 f7332aa0 ffff8008
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00005408 00000001 a1ff0014 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f7548780 ffff8008 ffffffff 00000000
8010  09dc50d8 ffff0000 f76fc800 ffff8008 f7548780 ffff8008 f7738428 ffff8008
8030  f76e7c28 ffff8008 09dc50e8 ffff0000 f6e6ae80 ffff8008 09dc4ac8 ffff0000
8050  f753e660 ffff8008 00000007 00000007 00000000 00000000 00000000 00000000
8070  00000000 00000000 00000000 00000000 f7738080 ffff8008 f7738080 ffff8008

X1: 0xffff8008f1f1ab80:
ab80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
aba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ac00  ec128080 ffff8008 0000062a 00000000 f5383800 00000000 00000000 00000000
ac20  00000000 00000000 00000000 00000000 08a179d8 ffff0000 e85aeb00 ffff8008
ac40  f1f1ac40 ffff8008 f1f1ac40 ffff8008 ffffff8d 00000000 f2dee118 ffff8008
ac60  0afdb024 ffff0000 00000003 00000003 00000000 00000000 00000000 00000000

X19: 0xffff8008f1f1ab80:
ab80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
aba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
abe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ac00  ec128080 ffff8008 0000062a 00000000 f5383800 00000000 00000000 00000000
ac20  00000000 00000000 00000000 00000000 08a179d8 ffff0000 e85aeb00 ffff8008
ac40  f1f1ac40 ffff8008 f1f1ac40 ffff8008 ffffff8d 00000000 f2dee118 ffff8008
ac60  0afdb024 ffff0000 00000003 00000003 00000000 00000000 00000000 00000000

X20: 0xffff8008f2dee098:
e098  ae000000 00000000 f2df0000 ffff8008 00307065 00000000 00000000 00000000
e0b8  00000000 00000010 00000000 00000000 00000080 00000000 00000002 00000000
e0d8  00000000 00000000 00000002 00000000 00000000 00000000 00000000 00000000
e0f8  00000000 00000000 f2dee200 ffff8008 f2dee000 ffff8008 087793a4 ffff0000
e118  f0475900 ffff8008 f2dee1a8 ffff8008 091c36b0 ffff0000 f2dee230 ffff8008
e138  f2df0048 ffff8008 0000002e 02000000 000f0400 00000101 00000000 00000000
e158  00000000 00000000 f2dee160 ffff8008 f2dee160 ffff8008 f2dee170 ffff8008
e178  f2dee170 ffff8008 f2dee180 ffff8008 f2dee180 ffff8008 0afdb000 ffff0000

X22: 0xffff8008f2deff80:
ff80  f33b40a0 ffff8008 f3dd6810 ffff8008 f03f8de8 ffff8008 00000000 00000000
ffa0  27ac430e 00000000 00000000 00000000 f2aec128 ffff8008 f32e0680 ffff8008
ffc0  00000000 00000000 f3623400 ffff8008 000000ac 00000001 41e80011 00000000
ffe0  f3b18000 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
0000  f7738010 ffff8008 f7738010 ffff8008 000000c0 00000000 f2df0018 ffff8008
0020  f2df0018 ffff8008 08a077e4 ffff0000 f2d42c00 ffff8008 091c3650 ffff0000
0040  f2dee018 ffff8008 f2dee130 ffff8008 f2deee30 ffff8008 00000003 00000005
0060  00000007 00000000 095d1550 ffff0000 f7738010 ffff8008 f2deef00 ffff8008

X25: 0xffff8008f2deff80:
ff80  f33b40a0 ffff8008 f3dd6810 ffff8008 f03f8de8 ffff8008 00000000 00000000
ffa0  27ac430e 00000000 00000000 00000000 f2aec128 ffff8008 f32e0680 ffff8008
ffc0  00000000 00000000 f3623400 ffff8008 000000ac 00000001 41e80011 00000000
ffe0  f3b18000 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
0000  f7738010 ffff8008 f7738010 ffff8008 000000c0 00000000 f2df0018 ffff8008
0020  f2df0018 ffff8008 08a077e4 ffff0000 f2d42c00 ffff8008 091c3650 ffff0000
0040  f2dee018 ffff8008 f2dee130 ffff8008 f2deee30 ffff8008 00000003 00000005
0060  00000007 00000000 095d1550 ffff0000 f7738010 ffff8008 f2deef00 ffff8008

X26: 0xffff8008f2dee098:
e098  ae000000 00000000 f2df0000 ffff8008 00307065 00000000 00000000 00000000
e0b8  00000000 00000010 00000000 00000000 00000080 00000000 00000002 00000000
e0d8  00000000 00000000 00000002 00000000 00000000 00000000 00000000 00000000
e0f8  00000000 00000000 f2dee200 ffff8008 f2dee000 ffff8008 087793a4 ffff0000
e118  f0475900 ffff8008 f2dee1a8 ffff8008 091c36b0 ffff0000 f2dee230 ffff8008
e138  f2df0048 ffff8008 0000002e 02000000 000f0400 00000101 00000000 00000000
e158  00000000 00000000 f2dee160 ffff8008 f2dee160 ffff8008 f2dee170 ffff8008
e178  f2dee170 ffff8008 f2dee180 ffff8008 f2dee180 ffff8008 0afdb000 ffff0000

X27: 0xffff8008f2f11580:
1580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
15a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
15c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
15e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1600  f0475000 ffff8008 00000003 00000000 f235fa00 ffff8008 00000000 00000000
1620  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1640  00000000 00000000 00000000 00000000 00000002 00000000 00000000 00000000
1660  00000000 00000000 00000000 00000000 08e3b158 ffff0000 f2f11600 ffff8008

X28: 0xffff8008f235f980:
f980  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
f9a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
f9c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
f9e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
fa00  00000000 00000000 09f6e3d8 ffff0000 00000000 00000000 f2f11600 ffff8008
fa20  00000000 00000000 00000000 00000000 812aa8c0 812aa8c0 00ffffff ff2aa8c0
fa40  00001800 00000080 30627375 00000000 00000000 00000000 00000000 00000000
fa60  0046ac7c 00000001 0046ac7c 00000001 00000000 00000000 00000000 00000000

Process Binder:3276_2 (pid: 3326, stack limit = 0xffff00000b378000)
Call trace:
Exception stack(0xffff00000b37b900 to 0xffff00000b37ba40)
b900: ffff8008f7738010 ffff8008f1f1ac00 0000000000000000 0000000000000140
b920: 0000000000000000 0000000000000000 0000000000000020 0000000040000000
b940: 0000000000000024 0000000000000000 0101010101010101 0000000000000020
b960: 0000000000000020 0000000000000000 ffffffffffffffff 0000000000000000
b980: ffff0000082b4430 0000fcc729e2d0e0 0000fcc72810fc1a ffff8008f1f1ac00
b9a0: ffff8008f2dee118 0000000000000000 ffff8008f2df0000 ffff000009c8e000
b9c0: 0000000000000000 ffff8008f2df0000 ffff8008f2dee118 ffff8008f2f11600
b9e0: ffff8008f235fa00 ffff00000b37ba40 ffff0000089bc2c0 ffff00000b37ba40
ba00: ffff0000089bbf90 00000000400001c5 ffff00000b37ba20 ffff00000827c354
ba20: 0000ffffffffffff ffff000008d578c4 ffff00000b37ba40 ffff0000089bbf90
[<ffff0000089bbf90>] __cdns3_gadget_ep_queue.isra.18+0x238/0x524
[<ffff0000089bc2c0>] cdns3_gadget_ep_queue+0x44/0xd8
[<ffff000008a06f70>] usb_ep_queue+0x5c/0xfc
[<ffff000008a1762c>] rx_submit+0xec/0x1bc
[<ffff000008a1775c>] rx_fill+0x60/0xb4
[<ffff000008a17c7c>] eth_open+0x64/0x78
[<ffff000008d72cf4>] __dev_open+0xe0/0x164
[<ffff000008d73128>] __dev_change_flags+0x160/0x18c
[<ffff000008d73174>] dev_change_flags+0x20/0x5c
[<ffff000008e359f0>] devinet_ioctl+0x68c/0x724
[<ffff000008e37cc4>] inet_ioctl+0x8c/0xa8
[<ffff000008d48a48>] sock_do_ioctl+0x34/0x70
[<ffff000008d49da0>] sock_ioctl+0x21c/0x320
[<ffff0000082b3b98>] do_vfs_ioctl+0xbc/0x954
[<ffff0000082b44b4>] SyS_ioctl+0x84/0x98
Exception stack(0xffff00000b37bec0 to 0xffff00000b37c000)
bec0: 000000000000003d 0000000000008914 0000fcc728110840 0000000000000003
bee0: 0000fcc728110850 6f43ffffffffffff 0000000000000000 0000000000800000
bf00: 000000000000001d 0000fcc7281107f8 0000fcc7281107f8 0000fcc728110840
bf20: 0000fcc728110458 0000000000000028 ffffffffffffffff 00002d18ec000000
bf40: 0000fcc72962af68 0000fcc729e2d0e0 0000fcc72810fc1a 0000fcc728111588
bf60: 0000fcc72962b000 0000ab36f6e99ac5 0000ab36f6e99a8e 0000000000000008
bf80: 0000ab36f6e99ac8 0000fcc728111588 0000ab36f6e99c0e 0000000000000006
bfa0: 0000fcc72902b108 0000fcc728110830 0000fcc729e2d16c 0000fcc728110740
bfc0: 0000fcc729e73758 00000000a0000000 000000000000003d 000000000000001d
bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[<ffff000008083ac0>] el0_svc_naked+0x34/0x38
Code: d503201f f9401e82 aa1303e1 f94006c0 (39c00842)
---[ end trace f7b45310362d53ac ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
SMP: failed to stop secondary CPUs 0,2,4
Kernel Offset: disabled
CPU features: 0x180200c
Memory Limit: none
Rebooting in 5 seconds..
SMP: stopping secondary CPUs
SMP: failed to stop secondary CPUs 0,2,4

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-6 usb: cdns3: gadget: do not call disconnect if it is not configured
Peter Chen [Wed, 7 Aug 2019 01:47:06 +0000 (09:47 +0800)]
MLK-22366-6 usb: cdns3: gadget: do not call disconnect if it is not configured

Fix below oops:
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=179935 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=179970 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC f2:80:c5:eb:a1:fd
usb0: MAC 92:da:4f:13:01:73
android_work: did not send uevent (0 0           (null))
audit: audit_lost=180005 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
composite_disconnect: Calling disconnect on a Gadget that is                      not connected
android_work: did not send uevent (0 0           (null))
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: Sending signal 9 to service 'adbd' (pid 22343) process group...
------------[ cut here ]------------
audit: audit_lost=180038 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
WARNING: CPU: 0 PID: 3468 at /home/tianyang/maddev_pie9.0/vendor/nxp-opensource/kernel_imx/drivers/usb/gadget/composite.c:2009 composite_disconnect+0x80/0x88
Modules linked in:
CPU: 0 PID: 3468 Comm: HWC-UEvent-Thre Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2349c00 task.stack: ffff00000b0a8000
PC is at composite_disconnect+0x80/0x88
LR is at composite_disconnect+0x80/0x88
pc : [<ffff0000089ff9b0>] lr : [<ffff0000089ff9b0>] pstate: 600001c5
sp : ffff000008003dd0
x29: ffff000008003dd0 x28: ffff8008f2349c00
x27: ffff000009885018 x26: ffff000008004000
Timeout for IPC response!
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff8008f2d98010 x22: 00000000000001c0
x21: ffff8008f2d98394 x20: ffff8008f2d98010
x19: 0000000000000000 x18: 0000e3956f4f075a
fxos8700 4-001e: i2c block read acc failed
x17: 0000e395735727e8 x16: ffff00000829f4d4
x15: ffffffffffffffff x14: 7463656e6e6f6320
x13: 746f6e2009090920 x12: 7369207461687420
x11: 7465676461472061 x10: 206e6f207463656e
x9 : 6e6f637369642067 x8 : ffff000009c8e280
x7 : ffff0000086ca6cc x6 : ffff000009f15e78
x5 : 0000000000000000 x4 : 0000000000000000
x3 : ffffffffffffffff x2 : c3f28b86000c3900
x1 : c3f28b86000c3900 x0 : 000000000000004e

X20: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
libprocessgroup: Failed to kill process cgroup uid 0 pid 22343 in 215ms, 1 processes remain
7fd0
Timeout for IPC response!
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
using random self ethernet address
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc
using random host ethernet address
 ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X21: 0xffff8008f2d98314:
8314  ffff8008 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8334  00000000 00000000 00000000 00000000 00000000 08a04cf4 ffff0000 00000000
8354  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8374  00000000 00000000 00000000 00001001 00000000 00000000 00000000 00000000
8394  e4bbe4bb 0f230000 ffff0000 0afae000 ffff0000 ae001000 00000000 f206d400
Timeout for IPC response!
83b4  ffff8008 00000000 00000000 f7957b18 ffff8008 f7957718 ffff8008 f7957018
83d4  ffff8008 f7957118 ffff8008 f7957618 ffff8008 f7957818 ffff8008 f7957918
83f4  ffff8008 f7957d18 ffff8008 00000000 00000000 00000000 00000000 00000000

X23: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X28: 0xffff8008f2349b80:
9b80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
9c20  0b0a8000 ffff0000 00000002 00404040 00000000 00000000 00000000 00000000
9c40  00000001 00000000 00000001 00000000 001ebd44 00000001 f390b800 ffff8008
9c60  00000000 00000001 00000070 00000070 00000070 00000000 09031d48 ffff0000

Call trace:
Exception stack(0xffff000008003c90 to 0xffff000008003dd0)
3c80:                                   000000000000004e c3f28b86000c3900
3ca0: c3f28b86000c3900 ffffffffffffffff 0000000000000000 0000000000000000
3cc0: ffff000009f15e78 ffff0000086ca6cc ffff000009c8e280 6e6f637369642067
3ce0: 206e6f207463656e 7465676461472061 7369207461687420 746f6e2009090920
3d00: 7463656e6e6f6320 ffffffffffffffff ffff00000829f4d4 0000e395735727e8
3d20: 0000e3956f4f075a 0000000000000000 ffff8008f2d98010 ffff8008f2d98394
3d40: 00000000000001c0 ffff8008f2d98010 ffff000009c8e280 ffff000009885018
3d60: ffff000008004000 ffff000009885018 ffff8008f2349c00 ffff000008003dd0
3d80: ffff0000089ff9b0 ffff000008003dd0 ffff0000089ff9b0 00000000600001c5
3da0: ffff8008f33f2cd8 0000000000000000 0000ffffffffffff 0000000000000000
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
3dc0: ffff000008003dd0 ffff0000089ff9b0
[<ffff0000089ff9b0>] composite_disconnect+0x80/0x88
[<ffff000008a044d4>] android_disconnect+0x3c/0x68
[<ffff0000089ba9f8>] cdns3_device_irq_handler+0xfc/0x2c8
[<ffff0000089b84c0>] cdns3_irq+0x44/0x94
[<ffff00000814494c>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008144c0c>] handle_irq_event+0x58/0xc0
[<ffff00000814873c>] handle_fasteoi_irq+0x98/0x180
[<ffff000008143a10>] generic_handle_irq+0x24/0x38
[<ffff000008144170>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c
Exception stack(0xffff00000b0ab950 to 0xffff00000b0aba90)

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-5 usb: cdns3: ep0: check NULL pointer before calling composite_setup
Peter Chen [Tue, 6 Aug 2019 07:18:30 +0000 (15:18 +0800)]
MLK-22366-5 usb: cdns3: ep0: check NULL pointer before calling composite_setup

Fix below oops at stress USB switch test at android:
read strings
audit: rate limit exceeded
android_work: did not send uevent (0 0           (null))
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: super-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3515 (system_server)
Unable to handle kernel NULL pointer dereference at virtual address 0000002a
init: Received control message 'stop' for 'adbd' from pid: 3375 (/vendor/bin/hw/android.hardware.usb@1.1-servic)
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008f1b7f000
[000000000000002a] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 4 PID: 2457 Comm: irq/125-5b11000 Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2a98000 task.stack: ffff00000b7b8000
PC is at composite_setup+0x44/0x1508
LR is at android_setup+0xb8/0x13c
pc : [<ffff0000089ffb3c>] lr : [<ffff000008a032fc>] pstate: 800001c5
sp : ffff00000b7bbb80
x29: ffff00000b7bbb80 x28: ffff8008f2a3c010
x27: 0000000000000001 x26: 0000000000000000                                                          [1232/1897]
audit: audit_lost=25791 audit_rate_limit=5 audit_backlog_limit=64
x25: 00000000ffffffa1 x24: ffff8008f2a3c010
audit: rate limit exceeded
x23: 0000000000000409 x22: ffff000009c8e000
x21: ffff8008f7a8b428 x20: ffff00000afae000
x19: ffff0000089ff000 x18: 0000000000000000
x17: 0000000000000000 x16: ffff0000082b7c9c
x15: 0000000000000000 x14: f1866f5b952aca46
x13: e35502e30d44349c x12: 0000000000000008
x11: 0000000000000008 x10: 0000000000000a30
x9 : ffff00000b7bbd00 x8 : ffff8008f2a98a90
x7 : ffff8008f27a9c90 x6 : 0000000000000001
x5 : 0000000000000000 x4 : 0000000000000001
x3 : 0000000000000000 x2 : 0000000000000006
x1 : ffff0000089ff8d0 x0 : 732a010310b9ed00

X7: 0xffff8008f27a9c10:
9c10  00000002 00000000 00000001 00000000 13110000 ffff0000 00000002 00208040
9c30  00000000 00000000 00000000 00000000 00000000 00000005 00000029 00000000
9c50  00051778 00000001 f27a8e00 ffff8008 00000005 00000000 00000078 00000078
9c70  00000078 00000000 09031d48 ffff0000 00100000 00000000 00400000 00000000
9c90  00000001 00000000 00000000 00000000 00000000 00000000 ffefb1a0 ffff8008
9cb0  f27a9ca8 ffff8008 00000000 00000000 b9d88037 00000173 1618a3eb 00000001
9cd0  870a792a 0000002e 16188fe6 00000001 0000242b 00000000 00000000 00000000
using random self ethernet address
9cf0  019a4646 00000000 000547f3 00000000 ecfd6c33 00000002 00000000
using random host ethernet address
 00000000

X8: 0xffff8008f2a98a10:
8a10  00000000 00000000 f7788d00 ffff8008 00000001 00000000 00000000 00000000
8a30  eb218000 ffff8008 f2a98000 ffff8008 f2a98000 ffff8008 09885000 ffff0000
8a50  f34df480 ffff8008 00000000 00000000 f2a98648 ffff8008 09c8e000 ffff0000
8a70  fff2c800 ffff8008 09031d48 ffff0000 0b7bbd00 ffff0000 0b7bbd00 ffff0000
8a90  080861bc ffff0000 00000000 00000000 00000000 00000000 00000000 00000000
8ab0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8ad0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8af0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

X21: 0xffff8008f7a8b3a8:
b3a8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b3c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b3e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b408  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
b428  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
b448  0053004d 00540046 00300031 00010030 eb07b520 ffff8008 20011201 00000003
b468  e418d109 0104404e 00010302 00000000 eb07b558 ffff8008 eb07b558 ffff8008
b488  f7a8b488 ffff8008 f7a8b488 ffff8008 f7a8b300 ffff8008 00000000 00000000

X24: 0xffff8008f2a3bf90:
bf90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
c010  00000000 00000000 f2a3c018 ffff8008 f2a3c018 ffff8008 08a067dc ffff0000
c030  f2a5a000 ffff8008 091c3650 ffff0000 f716fd18 ffff8008 f716fe30 ffff8008
c050  f2ce4a30 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
c070  f76c8010 ffff8008 f2ce4b00 ffff8008 095cac68 ffff0000 f2a5a028 ffff8008

X28: 0xffff8008f2a3bf90:
bf90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bfd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
bff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
c010  00000000 00000000 f2a3c018 ffff8008 f2a3c018 ffff8008 08a067dc ffff0000
c030  f2a5a000 ffff8008 091c3650 ffff0000 f716fd18 ffff8008 f716fe30 ffff8008
c050  f2ce4a30 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
c070  f76c8010 ffff8008 f2ce4b00 ffff8008 095cac68 ffff0000 f2a5a028 ffff8008

Process irq/125-5b11000 (pid: 2457, stack limit = 0xffff00000b7b8000)
Call trace:
Exception stack(0xffff00000b7bba40 to 0xffff00000b7bbb80)
ba40: 732a010310b9ed00 ffff0000089ff8d0 0000000000000006 0000000000000000
ba60: 0000000000000001 0000000000000000 0000000000000001 ffff8008f27a9c90
ba80: ffff8008f2a98a90 ffff00000b7bbd00 0000000000000a30 0000000000000008
baa0: 0000000000000008 e35502e30d44349c f1866f5b952aca46 0000000000000000
bac0: ffff0000082b7c9c 0000000000000000 0000000000000000 ffff0000089ff000
bae0: ffff00000afae000 ffff8008f7a8b428 ffff000009c8e000 0000000000000409
bb00: ffff8008f2a3c010 00000000ffffffa1 0000000000000000 0000000000000001
bb20: ffff8008f2a3c010 ffff00000b7bbb80 ffff000008a032fc ffff00000b7bbb80
bb40: ffff0000089ffb3c 00000000800001c5 ffff00000b7bbb80 732a010310b9ed00
bb60: ffffffffffffffff ffff0000080f777c ffff00000b7bbb80 ffff0000089ffb3c
[<ffff0000089ffb3c>] composite_setup+0x44/0x1508
[<ffff000008a032fc>] android_setup+0xb8/0x13c
[<ffff0000089bd9a8>] cdns3_ep0_delegate_req+0x44/0x70
[<ffff0000089bdff4>] cdns3_check_ep0_interrupt_proceed+0x33c/0x654
[<ffff0000089bca44>] cdns3_device_thread_irq_handler+0x4b0/0x4bc
[<ffff0000089b77b4>] cdns3_thread_irq+0x48/0x68
[<ffff000008145bf0>] irq_thread_fn+0x28/0x88
[<ffff000008145e38>] irq_thread+0x13c/0x228
[<ffff0000080fed70>] kthread+0x104/0x130
[<ffff000008085064>] ret_from_fork+0x10/0x18
Code: 91234261 f94006ba f90057a0 79400a97 (3940ab40)
---[ end trace e8f0a7c675a161ca ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x180200c
Memory Limit: none
Rebooting in 5 seconds..

Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-4 usb: cdns3: gadget: don't call request handler for the unconfigured device
Peter Chen [Thu, 1 Aug 2019 03:23:24 +0000 (11:23 +0800)]
MLK-22366-4 usb: cdns3: gadget: don't call request handler for the unconfigured device

We don't need to notify the bus reset for class driver if the non-control
endpoints are not enabled. It could cause unnecessary disconnect event for
android due to below two reasons:
- Android declares the disconnect event for reset handler.
- The controller will get two reset interrupts at HS mode
it fixed two below oops:

oops #1

android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=8846 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
init: Received control message 'start' for 'adbd' from pid: 3275 (system_server)
android_work: sent uevent USB_STATE=CONNECTED
android_disconnect: gadget driver already disconnected
init: Received control message 'stop' for 'adbd' from pid: 3135
(/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: Sending signal 9 to service 'adbd' (pid 5859) process group...
android_work: sent uevent USB_STATE=DISCONNECTED
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5858 at kernel_imx/drivers/usb/gadget/configfs.c:1533 android_disconnect+0x60/0x68
Modules linked in:
audit: audit_lost=8877 audit_rate_limit=5 audit_backlog_limit=64
CPU: 0 PID: 5858 Comm: main Not tainted 4.14.98-07844-g346f959 #14
audit: rate limit exceeded
Hardware name: Freescale i.MX8QXP MEK (DT)
task: ffff800063950e00 task.stack: ffff00000daf8000
PC is at android_disconnect+0x60/0x68
LR is at android_disconnect+0x60/0x68
pc : [<ffff000008a044cc>] lr : [<ffff000008a044cc>] pstate: 600001c5
sp : ffff000008003e00
x29: ffff000008003e00 x28: ffff800063950e00
Timeout for IPC response!
x27: ffff000009885018 x26: ffff000008004000
Failed power operation on resource 248 sc_err 3
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff800836158810 x22: 00000000000001c0
x21: ffff800836158b94 x20: ffff800836158810
x19: 0000000000000000 x18: 0000f6cba5d06050
Synchronous External Abort: synchronous external abort (0x96000210) at 0xffff000011790024
x17: 0000f6cba74ac218 x16: ffff00000829be84
Internal error: : 96000210 [#1] PREEMPT SMP
Modules linked in:
x15: 0000f6cba5d067f0
x14: 0000f6cba5d0a3d0
CPU: 2 PID: 2353 Comm: kworker/2:1H Not tainted 4.14.98-07844-g346f959 #14
Hardware name: Freescale i.MX8QXP MEK (DT)
x13: 656c626174206665 x12: 078db5fab2ae6e00
Workqueue: kblockd blk_mq_run_work_fn
x11: ffff000008003ad0
task: ffff80083bf62a00 task.stack: ffff00000b5e8000
x10: ffff000008003ad0
PC is at esdhc_readl_le+0x8/0x15c
x9 : 0000000000000006
LR is at sdhci_send_command+0xc4/0xa54
x8 : ffff000009c8e280
pc : [<ffff000008b82ea4>] lr : [<ffff000008b6ca48>] pstate: 200001c5
i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: rpmsg_xfer failed: timeout
fxos8700 14-001e: i2c block read acc failed
i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: rpmsg_xfer failed: timeout

oops 2#:

init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=179935 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=179970 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC f2:80:c5:eb:a1:fd
usb0: MAC 92:da:4f:13:01:73
android_work: did not send uevent (0 0           (null))
audit: audit_lost=180005 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
composite_disconnect: Calling disconnect on a Gadget that is                      not connected
android_work: did not send uevent (0 0           (null))
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
init: Sending signal 9 to service 'adbd' (pid 22343) process group...
------------[ cut here ]------------
audit: audit_lost=180038 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
WARNING: CPU: 0 PID: 3468 at /home/tianyang/maddev_pie9.0/vendor/nxp-opensource/kernel_imx/drivers/usb/gadget/composite.c:2009 composite_disconnect+0x80/0x88
Modules linked in:
CPU: 0 PID: 3468 Comm: HWC-UEvent-Thre Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2349c00 task.stack: ffff00000b0a8000
PC is at composite_disconnect+0x80/0x88
LR is at composite_disconnect+0x80/0x88
pc : [<ffff0000089ff9b0>] lr : [<ffff0000089ff9b0>] pstate: 600001c5
sp : ffff000008003dd0
x29: ffff000008003dd0 x28: ffff8008f2349c00
x27: ffff000009885018 x26: ffff000008004000
Timeout for IPC response!
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff8008f2d98010 x22: 00000000000001c0
x21: ffff8008f2d98394 x20: ffff8008f2d98010
x19: 0000000000000000 x18: 0000e3956f4f075a
fxos8700 4-001e: i2c block read acc failed
x17: 0000e395735727e8 x16: ffff00000829f4d4
x15: ffffffffffffffff x14: 7463656e6e6f6320
x13: 746f6e2009090920 x12: 7369207461687420
x11: 7465676461472061 x10: 206e6f207463656e
x9 : 6e6f637369642067 x8 : ffff000009c8e280
x7 : ffff0000086ca6cc x6 : ffff000009f15e78
x5 : 0000000000000000 x4 : 0000000000000000
x3 : ffffffffffffffff x2 : c3f28b86000c3900
x1 : c3f28b86000c3900 x0 : 000000000000004e

X20: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
libprocessgroup: Failed to kill process cgroup uid 0 pid 22343 in 215ms, 1 processes remain
7fd0
Timeout for IPC response!
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
using random self ethernet address
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc
using random host ethernet address
 ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X21: 0xffff8008f2d98314:
8314  ffff8008 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8334  00000000 00000000 00000000 00000000 00000000 08a04cf4 ffff0000 00000000
8354  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8374  00000000 00000000 00000000 00001001 00000000 00000000 00000000 00000000
8394  e4bbe4bb 0f230000 ffff0000 0afae000 ffff0000 ae001000 00000000 f206d400
Timeout for IPC response!
83b4  ffff8008 00000000 00000000 f7957b18 ffff8008 f7957718 ffff8008 f7957018
83d4  ffff8008 f7957118 ffff8008 f7957618 ffff8008 f7957818 ffff8008 f7957918
83f4  ffff8008 f7957d18 ffff8008 00000000 00000000 00000000 00000000 00000000

X23: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X28: 0xffff8008f2349b80:
9b80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
9c20  0b0a8000 ffff0000 00000002 00404040 00000000 00000000 00000000 00000000
9c40  00000001 00000000 00000001 00000000 001ebd44 00000001 f390b800 ffff8008
9c60  00000000 00000001 00000070 00000070 00000070 00000000 09031d48 ffff0000

Call trace:
Exception stack(0xffff000008003c90 to 0xffff000008003dd0)
3c80:                                   000000000000004e c3f28b86000c3900
3ca0: c3f28b86000c3900 ffffffffffffffff 0000000000000000 0000000000000000
3cc0: ffff000009f15e78 ffff0000086ca6cc ffff000009c8e280 6e6f637369642067
3ce0: 206e6f207463656e 7465676461472061 7369207461687420 746f6e2009090920
3d00: 7463656e6e6f6320 ffffffffffffffff ffff00000829f4d4 0000e395735727e8
3d20: 0000e3956f4f075a 0000000000000000 ffff8008f2d98010 ffff8008f2d98394
3d40: 00000000000001c0 ffff8008f2d98010 ffff000009c8e280 ffff000009885018
3d60: ffff000008004000 ffff000009885018 ffff8008f2349c00 ffff000008003dd0
3d80: ffff0000089ff9b0 ffff000008003dd0 ffff0000089ff9b0 00000000600001c5
3da0: ffff8008f33f2cd8 0000000000000000 0000ffffffffffff 0000000000000000
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/android.hardware.usb@1.1-service.imx)
3dc0: ffff000008003dd0 ffff0000089ff9b0
[<ffff0000089ff9b0>] composite_disconnect+0x80/0x88
[<ffff000008a044d4>] android_disconnect+0x3c/0x68
[<ffff0000089ba9f8>] cdns3_device_irq_handler+0xfc/0x2c8
[<ffff0000089b84c0>] cdns3_irq+0x44/0x94
[<ffff00000814494c>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008144c0c>] handle_irq_event+0x58/0xc0
[<ffff00000814873c>] handle_fasteoi_irq+0x98/0x180
[<ffff000008143a10>] generic_handle_irq+0x24/0x38
[<ffff000008144170>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c
Exception stack(0xffff00000b0ab950 to 0xffff00000b0aba90)
b940:                                   ffff8008f2a65c00 0000000000000140
b960: 00000000000068ea ffff8008f6cf9c00 0000000000000000 0000000000000000
b980: ffff000009893800 ffff8008f23c38a8 ffff8008ffee21a0 00000000ffffffff
b9a0: 0000000000000001 6f6674616c702f73 30313162352f6d72 336273752e303030
b9c0: 3162352f6364752f ffffffffffffffff ffff00000829f4d4 0000e395735727e8
b9e0: 0000e3956f4f075a ffff8008f2a65c00 0000000000000001 0000000000000140
ba00: 00000000000000c3 0000000000000001 0000000000000001 ffff000009c8e000
ba20: ffff8008f2c5b940 ffff8008d5a6fb00 0000000000000067 ffff00000b0aba90
ba40: ffff00000812b354 ffff00000b0aba90 ffff000009010044 0000000060000145
ba60: 0000000000000140 00000000000000c3 0000ffffffffffff 0000000000000001
ba80: ffff00000b0aba90 ffff000009010044
[<ffff000008083230>] el1_irq+0xb0/0x124
[<ffff000009010044>] _raw_spin_unlock_irqrestore+0x18/0x48
[<ffff00000812b354>] __wake_up_common_lock+0xa0/0xd4
[<ffff00000812b3c0>] __wake_up_sync_key+0x1c/0x24
[<ffff000008d515f0>] sock_def_readable+0x40/0x70
[<ffff000008e7a71c>] unix_dgram_sendmsg+0x45c/0x728
[<ffff000008d4df10>] sock_write_iter+0x10c/0x124
[<ffff00000829c4e0>] do_iter_readv_writev+0xf8/0x160
[<ffff00000829d2e4>] do_iter_write.part.17+0x38/0x154
[<ffff00000829e9c4>] vfs_writev+0x114/0x158
[<ffff00000829ea68>] do_writev+0x60/0xe8
[<ffff00000829f4e4>] SyS_writev+0x10/0x18
Exception stack(0xffff00000b0abec0 to 0xffff00000b0ac000)
bec0: 000000000000000f 0000e3956f4f0cb0 0000000000000004 0000000000000003
bee0: 0000000000000067 0000000080000000 725705beff78606b 7f7f7fff7f7f7f7f
bf00: 0000000000000042 000000000000005c 0000e3956f4f0e60 0000000000000053
bf20: 0000e3956f4f0f98 ffffffffffffffff ffffffffff000000 ffffffffffffffff
bf40: 0000e39572bf0cc0 0000e395735727e8 0000e3956f4f075a 0000000000000000
bf60: 000000000000000f 0000e3956f4f0cb0 0000000000000004 0000e39572bf17e0
bf80: 0000e3956f4f2588 0000e39572bf1618 0000000000000004 0000000000000000
bfa0: 0000e39572bf1618 0000e3956f4f0d70 0000e39572bd4260 0000e3956f4f0cb0
bfc0: 0000e395735727f0 0000000060000000 000000000000000f 0000000000000042
bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[<ffff000008083ac0>] el0_svc_naked+0x34/0x38

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-3 usb: cdns3: gadget: set request as NULL when it is freed
Peter Chen [Thu, 1 Aug 2019 02:36:54 +0000 (10:36 +0800)]
MLK-22366-3 usb: cdns3: gadget: set request as NULL when it is freed

Meanwhile, the pending_setup_status work item needs to be flushed after
EP0 is dequeued. It fixed below oops:

[  292.766596] android_work: sent uevent USB_STATE=DISCONNECTED
[  292.769602] ------------[ cut here ]------------
[  292.769631] WARNING: CPU: 3 PID: 88 at /home/b29397/work/projects/linux-imx/drivers/usb/gadget/composite.c:1383 com
posite_setup_complete+0xc8/0xd0
[  292.769639] Modules linked in:
[  292.790493] audit: audit_lost=5519 audit_rate_limit=5 audit_backlog_limit=64
[  292.796604] audit: rate limit exceeded
[  292.803165] CPU: 3 PID: 88 Comm: kworker/3:1 Not tainted 4.14.98-07842-g3848d2f45363-dirty #51
[  292.803168] Hardware name: Freescale i.MX8QXP MEK (DT)
[  292.803183] Workqueue: events_freezable cdns3_pending_setup_status_handler
[  292.803188] task: ffff80083ac68e80 task.stack: ffff00000ada8000
[  292.803195] PC is at composite_setup_complete+0xc8/0xd0
[  292.803200] LR is at composite_setup_complete+0xc8/0xd0
[  292.803204] pc : [<ffff000008aa17c8>] lr : [<ffff000008aa17c8>] pstate: 000001c5
[  292.803206] sp : ffff00000adabd70
[  292.803208] x29: ffff00000adabd70 x28: 0000000000000000
[  292.803215] x27: ffff80083abf8c38 x26: ffff000009619518
[  292.803227] x25: 0000000000000000 x24: ffff00000a150cf8
[  292.870582] x23: 0000000000000000 x22: ffff80083ff6c100
[  292.875901] x21: 0000000000000140 x20: ffff800836342718
[  292.881216] x19: ffff8000706e5900 x18: 0000000000000010
[  292.886533] x17: 0000eb3821d31268 x16: ffff000008313fc8
[  292.891850] x15: ffffffffffffffff x14: ffff00000a12e008
[  292.897166] x13: ffff00008a4319d7 x12: ffff00000a4319df
[  292.902483] x11: ffff00000a157000 x10: ffff00000adaba90
[  292.907801] x9 : 00000000ffffffd0 x8 : ffff000008729658
[  292.913116] x7 : 75716572206e776f x6 : 0000000000000006
[  292.918433] x5 : 0000000000000000 x4 : 0000000000000000
[  292.923749] x3 : 0000000000000000 x2 : 13710ac2b6ac9b00
[  292.929067] x1 : 0000000000000000 x0 : 0000000000000020
[  292.934397]
[  292.934397] X19: 0xffff8000706e5880:
[  292.939448] 5880  00004ef4 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  292.947651] 58a0  00000000 00000000 00004ef5 00000000 00000000 00000000 00000000 00000000
[  292.955860] 58c0  00000000 00000000 00000000 00000000 00000000 00000000 71f24600 ffff8000
[  292.964070] 58e0  00000300 00000001 706e58e0 ffff8000 395101c0 ffff8008 00000000 00000000
[  292.972280] 5900  706e5000 ffff8000 00000000 00000000 f47ff000 00000000 00000000 00000000
[  292.980487] 5920  00000000 00000000 00000000 00000000 08aa1700 ffff0000 3bb36428 ffff8008
[  292.988697] 5940  706e5940 ffff8000 706e5940 ffff8000 00000000 00000000 36342718 ffff8008
[  292.996907] 5960  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.005121]
[  293.005121] X20: 0xffff800836342698:
[  293.010181] 2698  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.014718] using random self ethernet address
[  293.018391] 26b8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.018413] 26d8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.018435] 26f8  00000000 00000000 36342900 ffff8008 3ac7c880 ffff8008 087e56b0 ffff0000
[  293.018458] 2718  3bb36428 ffff8008 363427a8 ffff8008 092cbfa0
[  293.030136] using random host ethernet address
[  293.031092]  ffff0000 00000000 00000000
[  293.031101] 2738  00000000 00000000 00000031 02000000 00000200 00000004 0a286238 ffff0000
[  293.031136] 2758  00000000 00000000 36342760 ffff8008 36342760 ffff8008 36342770 ffff8008
[  293.077978] 2778  36342770 ffff8008 36342780 ffff8008 36342780 ffff8008 0ae25000 ffff0000
[  293.086193]
[  293.086193] X22: 0xffff80083ff6c080:
[  293.091253] c080  3ff6c080 ffff8008 3ff6c080 ffff8008 ffffffe0 0000000f 3ff6c098 ffff8008
[  293.099463] c0a0  3ff6c098 ffff8008 080fb2b0 ffff0000 00000000 00000000 00000000 00000000
[  293.107672] c0c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.115882] c0e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.124083] c100  3ff68000 ffff8008 3a00ce00 ffff8008 00000000 ffffffff 00000002 00000001
[  293.132293] c120  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.140494] c140  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000100
[  293.148695] c160  3ff6c160 ffff8008 3ff6c160 ffff8008 3ff53170 ffff8008 3a00ce00 ffff8008
[  293.156903]
[  293.156903] X27: 0xffff80083abf8bb8:
[  293.161961] 8bb8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.170162] 8bd8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.178371] 8bf8  00000000 00000000 00000000 00000000 643a725f 5f706368 3aafd100 ffff8008
[  293.186583] 8c18  00000000 73706d75 00000000 74706f5f 3abf8c28 ffff8008 3abf8c28 ffff8008
[  293.194791] 8c38  00000000 dead0000 00000000 ffff8008 3abf8c48 ffff8008 3abf8c48 ffff8008
[  293.203001] 8c58  00000050 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  293.211210] 8c78  00000000 00000000 00000001 ffff8008 3607ac00 ffff8008 00000002 00000000
[  293.219420] 8c98  3abf8c98 ffff8008 00000000 00000000 00000000 00000000 3ad74fb0 ffff8008
[  293.227625]
[  293.229119] Call trace:
[  293.231573] Exception stack(0xffff00000adabc30 to 0xffff00000adabd70)
[  293.238027] bc20:                                   0000000000000020 0000000000000000
[  293.245865] bc40: 13710ac2b6ac9b00 0000000000000000 0000000000000000 0000000000000000
[  293.253707] bc60: 0000000000000006 75716572206e776f ffff000008729658 00000000ffffffd0
[  293.261543] bc80: ffff00000adaba90 ffff00000a157000 ffff00000a4319df ffff00008a4319d7
[  293.269379] bca0: ffff00000a12e008 ffffffffffffffff ffff000008313fc8 0000eb3821d31268
[  293.277217] bcc0: 0000000000000010 ffff8000706e5900 ffff800836342718 0000000000000140
[  293.285051] bce0: ffff80083ff6c100 0000000000000000 ffff00000a150cf8 0000000000000000
[  293.292887] bd00: ffff000009619518 ffff80083abf8c38 0000000000000000 ffff00000adabd70
[  293.300723] bd20: ffff000008aa17c8 ffff00000adabd70 ffff000008aa17c8 00000000000001c5
[  293.308562] bd40: ffff000008aa1700 0000000000000000 ffffffffffffffff ffff800838000058
[  293.316406] bd60: ffff00000adabd70 ffff000008aa17c8
[  293.321303] [<ffff000008aa17c8>] composite_setup_complete+0xc8/0xd0
[  293.327584] [<ffff000008a56040>] cdns3_pending_setup_status_handler+0x70/0x98
[  293.334729] [<ffff0000080fe1e0>] process_one_work+0x1d8/0x470
[  293.340476] [<ffff0000080fe4c4>] worker_thread+0x4c/0x458
[  293.345885] [<ffff0000081052ec>] kthread+0x134/0x138
[  293.350862] [<ffff00000808525c>] ret_from_fork+0x10/0x1c
[  293.356175] ---[ end trace 9b2dcf754a0dbda5 ]---
[  293.392462] init: Service 'adbd' (pid 4743) received signal 9
[  293.399231] init: Sending signal 9 to service 'adbd' (pid 4743) process group...
[  293.412539] libprocessgroup: Successfully killed process cgroup uid 0 pid 4743 in 4ms
[  295.781315] init: Received control message 'start' for 'adbd' from pid: 3253 (system_server)
[  295.790279] init: starting service 'adbd'...
[  295.798116] init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-2 usb: cdns3: gadget: fix the hot plug and function switch issue
Peter Chen [Mon, 29 Jul 2019 06:34:18 +0000 (14:34 +0800)]
MLK-22366-2 usb: cdns3: gadget: fix the hot plug and function switch issue

- If the UDC is not started, we need not to access register at .udc_stop
- Clear all priv_ep flags except EP_CLAIMED which should be cleared at
.udc_stop
- Clear warning message that the .ep_disable may be called twice, one
from class driver, one from UDC driver.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22366-1 usb: cdns3: gadget: enlarge the TD list
Peter Chen [Mon, 22 Jul 2019 08:59:50 +0000 (16:59 +0800)]
MLK-22366-1 usb: cdns3: gadget: enlarge the TD list

At Android ADB and MTP use case, TD consumes very fast compared to TD has
finished, so we need to enlarge the TD list to avoid "no free TD error".

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
5 years agoMLK-22094 usb: cdns3: include head directory to find it
Li Jun [Mon, 24 Jun 2019 07:28:31 +0000 (15:28 +0800)]
MLK-22094 usb: cdns3: include head directory to find it

define_trace.h needs to know how to find our header, otherwise
we will have below build error:

In file included from drivers/usb/cdns3/trace.h:446:0,
                 from drivers/usb/cdns3/trace.c:11:
./include/trace/define_trace.h:89:43: fatal error: ./trace.h: No such
file or directory
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
                                           ^
compilation terminated.
scripts/Makefile.build:326: recipe for target
'drivers/usb/cdns3/trace.o' failed
make[3]: *** [drivers/usb/cdns3/trace.o] Error 1
make[3]: *** Waiting for unfinished jobs....
  CC      drivers/usb/host/pci-quirks.o
  CC      drivers/usb/isp1760/isp1760-core.o
  CC      drivers/usb/misc/ehset.o
  CC      drivers/usb/isp1760/isp1760-if.o
scripts/Makefile.build:585: recipe for target 'drivers/usb/cdns3' failed
make[2]: *** [drivers/usb/cdns3] Error 2
make[2]: *** Waiting for unfinished jobs....
  CC      drivers/usb/misc/usb3503.o
  CC      drivers/usb/host/ehci-hcd.o
  CC      drivers/usb/isp1760/isp1760-hcd.o

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit b0067d4b7c4e6f11625d3989b903189d73a45363)

5 years agoMLK-18579-2 usb: cdns3: xhci: disable BEI support
Peter Chen [Wed, 19 Jun 2019 08:55:12 +0000 (16:55 +0800)]
MLK-18579-2 usb: cdns3: xhci: disable BEI support

The Cadence xHCI doesn't support BEI well, it causes the disconnection
of ISOC devices can't be detected, so we disable it.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 258bb7de5b60bae44b7b775ea9d03e8a59410868)

5 years agoMLK-18579-1 usb: cdns3: using upstream multiple TD driver
Peter Chen [Wed, 19 Jun 2019 08:06:40 +0000 (16:06 +0800)]
MLK-18579-1 usb: cdns3: using upstream multiple TD driver

Keep the internal framework, just use the UDC driver from
upstream version which supports multiple TD.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 2336a88d3867bbc68dd11420f7b1269c1eaf6cae)

5 years agoMLK-20754 usb: cdns3: add role switch sys entry
Peter Chen [Mon, 14 Jan 2019 08:46:18 +0000 (16:46 +0800)]
MLK-20754 usb: cdns3: add role switch sys entry

It is an experimental feature, and tested by internal team for
Carplay feature.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 270c1ea5168763a03f79c4f9ecadb2cd18dc08f9)

5 years agoMA-13475 usb: cdns3: gadget: fix NULL pointer issue when switch functions
Peter Chen [Wed, 6 Mar 2019 09:12:29 +0000 (17:12 +0800)]
MA-13475 usb: cdns3: gadget: fix NULL pointer issue when switch functions

Below oops is reproduced when switch between mtp and ptp function
at Android, the interrupt occurs when the usb_ss->gadget_driver
is already NULL. In this commit, we add NULL pointer check for
it as well as protecting for clear usb_ss->gadget_driver.

init: Sending signal 9 to service 'adbd' (pid 4644) process group...
Mem abort info:
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000004
  CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgd = ffff800830e49000
[0000000000000020] *pgd=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
Modules linked in: wlan
CPU: 0 PID: 3226 Comm: surfaceflinger Not tainted 4.14.98 #1
init: Successfully killed process cgroup uid 0 pid 4644 in 11ms
Hardware name: Freescale i.MX8QXP MEK (DT)
task: ffff80083bf55400 task.stack: ffff00000ffe8000
PC is at cdns_get_setup_ret+0x38/0x64
LR is at cdns_get_setup_ret+0x24/0x64
pc : [<ffff0000089b0e88>] lr : [<ffff0000089b0e74>] pstate: 000001c5
sp : ffff000008003d10
x29: ffff000008003d10 x28: ffff80083bf55400
x27: ffff000009873018 x26: ffff000008004000
x25: ffff000009873018 x24: ffff000009c6a288
x23: ffff000008003f24 x22: ffff00000a85e000
x21: 0000000000000001 x20: ffff8008361c97b8
x19: ffff8008361c9000 x18: 0000000000000001
x17: 0000fe6e544aee34 x16: ffff0000082b54f0
x15: 0000ffffccae15f0 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000010000
x11: 0000000000000040 x10: 0000000000000040
x9 : ffff8008380ae238 x8 : ffff800838000248
x7 : 0000000000000000 x6 : ffff800838000248
init: Service 'adbd' (pid 4644) killed by signal 9
x5 : ffff80083ae40600 x4 : 0000000000000000
x3 : 00000000000001c0 x2 : 0000000000000000
x1 : ffff00000a85e000 x0 : ffff8008361c9300

X0: 0xffff8008361c9280:
9280  00000000 00000000 00000000 00000000 000f000f
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15)
 00000000 3bf6ce00 ffff8008
92a0  3acd9a00 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
92c0  00000000 00000000 00000000 00000000 00000000 00000000 089b0e3c ffff0000
92e0  00000000
init: processing action (sys.usb.config=mtp,adb && sys.usb.configfs=1) from (/init.usb.configfs.rc:33)
 00000000 00000000 00000000
read descriptors
read strings
init: starting service 'adbd'...
 00000000
init: property_set("ro.boottime.adbd", "97804848500") failed: property already set
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
 00000000 0e0f0000 ffff0000
9300  3ff21105 ffff8008 3ff1d120 ffff8008 2e15d4e0 ffff8008 089f9558 ffff0000
9320  3618ac00 ffff8008 091b7860 ffff0000 3bf6ce18 ffff8008 3bf6cd30
read descriptors
read strings
 ffff8008
9340  3acd9a30 ffff8008 00000000 00000005 00000000 00000000 095c4e58 ffff0000
9360  361c9000 ffff8008 3acd9700 ffff8008 095be4c8 ffff0000 3618ac28 ffff8008

X5: 0xffff80083ae40580:
0580  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
05a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
05c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
05e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0600  03440204 ffffffff 00000000 00000000 00000000 00000000 0000000f 00000000
0620  00000001 00000000 00000000 00000030 0000010f 00000000 3ae40600 ffff8008
0640  09d7aae0 ffff0000 3a088000 ffff8008 3aa22c80 ffff8008 00000000 00000000
0660  09886e24 ffff0000 081496ec ffff0000 3b444080 ffff8008 00000000 00000000

X6: 0xffff8008380001c8:
01c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0208  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0228  fffffc00 ffffffff 00000000 00000000 00000000 00000000 38000248 ffff8008
0248  003f0000 00000000 380af6c0 ffff8008 09c937f0 ffff0000 38000260 ffff8008
0268  38000260 ffff8008 00000000 00000000 3a007400 ffff8008 3a007600 ffff8008
0288  3a007800 ffff8008 3a007a00 ffff8008 3a007c00 ffff8008 3a6be600 ffff8008
02a8  3ab1da00 ffff8008 3ab1dc00 ffff8008 3ab1de00 ffff8008 3ac52000 ffff8008

X8: 0xffff8008380001c8:
01c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0208  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0228  fffffc00 ffffffff 00000000 00000000 00000000 00000000 38000248 ffff8008
0248  003f0000 00000000 380af6c0 ffff8008 09c937f0 ffff0000 38000260 ffff8008
0268  38000260 ffff8008 00000000 00000000 3a007400 ffff8008 3a007600 ffff8008
0288  3a007800 ffff8008 3a007a00 ffff8008 3a007c00 ffff8008 3a6be600 ffff8008
02a8  3ab1da00 ffff8008 3ab1dc00 ffff8008 3ab1de00 ffff8008 3ac52000 ffff8008

X9: 0xffff8008380ae1b8:
e1b8  3ae1ddd0 ffff8008 3ae1de58 ffff8008 3ae1dee0 ffff8008 3ae1df68 ffff8008
e1d8  3aad9000 ffff8008 3aad9088 ffff8008 3aad9110 ffff8008 3aad9198 ffff8008
e1f8  3aad9220 ffff8008 3aad92a8 ffff8008 3aad9330 ffff8008 3aad93b8 ffff8008
e218  00000000 00000000 00000000 00000000 00000000 00000000 380ae238 ffff8008
e238  000b0400 00000000 3802c490 ffff8008 3a081060 ffff8008 380ae250 ffff8008
e258  380ae250 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
e278  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
e298  00000000 00000000 3aea2c28 ffff8008 3aea2e28 ffff8008 00000000 00000000

X19: 0xffff8008361c8f80:
8f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9000  3ab9f410 ffff8008 3bf6b000 ffff8008 095c4e48 ffff0000 361c9378 ffff8008
9020  360ed558 ffff8008 3ab9f420 ffff8008 3a7d5800 ffff8008 09d9fa00 ffff0000
9040  361b94c8 ffff8008 00000006 00000003 00000000 00000000 00000000 00000000
9060  00000000 00000000 00000000 00000000 361c9070 ffff8008 361c9070 ffff8008

X20: 0xffff8008361c9738:
9738  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9758  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9778  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9798  0000000e 00000000 71a71600 ffff8000 00000000 00000000 00000000 00000000
97b8  044c044c 00000002 00000000 00000000 00000001 00000000 3ab9f410 ffff8008
97d8  00000001 00000000 3bf6cc70 ffff8008 3bf6c170 ffff8008 00000000 00000000
97f8  00000000 00000000 361c9800 ffff8008 361c9800 ffff8008 089b1dc8 ffff0000
9818  71a71600 ffff8000 00000000 00000000 00000000 00000000 00000000 00000000

X28: 0xffff80083bf55380:
5380  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
53a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
53c0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
53e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5400  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
5420  0ffe8000 ffff0000 00000006 00404100 00000000 00000000 00000000 00000000
5440  00000001 00000000 000000e6 00000000 ffff3a2d 00000000 30c10000 ffff8008
5460  00000000 00000001 00000062 00000070 00000062 00000001 09023e38 ffff0000

Process surfaceflinger (pid: 3226, stack limit = 0xffff00000ffe8000)
Call trace:
Exception stack(0xffff000008003bd0 to 0xffff000008003d10)
3bc0:                                   ffff8008361c9300 ffff00000a85e000
3be0: 0000000000000000 00000000000001c0 0000000000000000 ffff80083ae40600
3c00: ffff800838000248 0000000000000000 ffff800838000248 ffff8008380ae238
3c20: 0000000000000040 0000000000000040 0000000000010000 0000000000000000
3c40: 0000000000000000 0000ffffccae15f0 ffff0000082b54f0 0000fe6e544aee34
3c60: 0000000000000001 ffff8008361c9000 ffff8008361c97b8 0000000000000001
3c80: ffff00000a85e000 ffff000008003f24 ffff000009c6a288 ffff000009873018
3ca0: ffff000008004000 ffff000009873018 ffff80083bf55400 ffff000008003d10
3cc0: ffff0000089b0e74 ffff000008003d10 ffff0000089b0e88 00000000000001c5
3ce0: 00000000000001c0 1a8824534cfb2000 0000ffffffffffff ffff0000080f87c8
3d00: ffff000008003d10 ffff0000089b0e88
[<ffff0000089b0e88>] cdns_get_setup_ret+0x38/0x64
[<ffff0000089b2a48>] cdns_check_ep0_interrupt_proceed+0xc0/0x8dc
[<ffff0000089b3508>] cdns_irq_handler_thread+0x2a4/0x4e8
[<ffff0000089afd98>] cdns3_irq+0x44/0x94
[<ffff000008145994>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008145c54>] handle_irq_event+0x58/0xc0
[<ffff000008149784>] handle_fasteoi_irq+0x98/0x180
[<ffff000008144a58>] generic_handle_irq+0x24/0x38
[<ffff0000081451b8>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c

Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit 6ee6e32b0c3fcbea70117eaea3c315f0e220144c)

5 years agoMLK-22526: VPU: synchronize sending message to MU
ming_qian [Fri, 30 Aug 2019 02:47:47 +0000 (10:47 +0800)]
MLK-22526: VPU: synchronize sending message to MU

use a spinlock to synchronize sending message to MU

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
5 years agoMLK-22484: ARM64: dts: Fix mem clock for asrc
Shengjiu Wang [Fri, 30 Aug 2019 03:24:54 +0000 (11:24 +0800)]
MLK-22484: ARM64: dts: Fix mem clock for asrc

The mem clock is used to access the register, if there is no
mem clock defined, we should use the ipg clock instead,
otherwise there will be kernel dump after system reboot.

[    3.010962] Kernel panic - not syncing: Asynchronous SError Interrupt
[    3.010964] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.19.35-05057-g2134d856e6b2 #2889
[    3.010966] Hardware name: Freescale i.MX8QXP MEK (DT)
[    3.010968] Call trace:
[    3.010969]  dump_backtrace+0x0/0x178
[    3.010971]  show_stack+0x14/0x20
[    3.010972]  dump_stack+0x8c/0xac
[    3.010974]  panic+0x120/0x28c
[    3.010975]  __stack_chk_fail+0x0/0x18
[    3.010977]  arm64_serror_panic+0x74/0x80
[    3.010979]  do_serror+0x68/0x130
[    3.010980]  el1_error+0x7c/0xdc
[    3.010982]  _raw_spin_unlock_irqrestore+0xc/0x48
[    3.010984]  clk_core_disable_lock+0x28/0x38
[    3.010985]  clk_disable+0x1c/0x30
[    3.010987]  regmap_mmio_write+0x54/0x68
[    3.010989]  _regmap_bus_reg_write+0x14/0x20
[    3.010990]  _regmap_write+0x60/0xa8
[    3.010992]  regmap_write+0x48/0x70
[    3.010994]  fsl_asrc_probe+0x258/0x660
[    3.010995]  platform_drv_probe+0x50/0xb0

Why this issue only happen at kernel reboot, it is because the ipg
clock is enabled in default after system reset, after used once, the
ipg clock is disabled, then reboot system, the issue happen.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
5 years agoMLK-22519-2 VPU Decoder: remove *ctrls[V4L2_MAX_CTRLS] from vpu_ctx
Shijie Qin [Wed, 28 Aug 2019 12:34:44 +0000 (20:34 +0800)]
MLK-22519-2 VPU Decoder: remove *ctrls[V4L2_MAX_CTRLS] from vpu_ctx

*ctrls[V4L2_MAX_CTRLS] is not actually used, and it is easy to cause
out-of-bound when add v4l2_ctrl. Hence remove it.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
5 years agoMLK-22519-1 VPU Decoder: separate setting start_code_bypass and stream_input_mode
Shijie Qin [Wed, 28 Aug 2019 12:18:28 +0000 (20:18 +0800)]
MLK-22519-1 VPU Decoder: separate setting start_code_bypass and stream_input_mode

There is no dependency between start_code_bypass and stream_input_mode,
should be set separately.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
5 years agoMLK-22522: ASoC: fsl_sai: fix stack-out-of-bounds KASAN complain
Viorel Suman [Thu, 29 Aug 2019 10:17:33 +0000 (13:17 +0300)]
MLK-22522: ASoC: fsl_sai: fix stack-out-of-bounds KASAN complain

Fix the following KASAN reported issue:
==================================================================
[   11.580278] BUG: KASAN: stack-out-of-bounds in find_next_bit+0x3c/0xc0
[   11.586815] Read of size 8 at addr ffffffc8c8d4f760 by task swapper/0/1
[   11.593440]
[   11.594943] CPU: 4 PID: 1 Comm: swapper/0 Tainted: G W 4.19.35-05042-g. #157
[   11.604259] Hardware name: Freescale i.MX8QM MEK (DT)
[   11.609323] Call trace:
[   11.611785]  dump_backtrace+0x0/0x230
[   11.615458]  show_stack+0x14/0x20
[   11.618787]  dump_stack+0xbc/0xf4
[   11.622118]  print_address_description+0x60/0x270
[   11.626830]  kasan_report+0x230/0x360
[   11.630505]  __asan_load8+0x84/0xa8
[   11.634005]  find_next_bit+0x3c/0xc0
[   11.637595]  fsl_sai_calc_dl_off+0x1c/0x50
[   11.641703]  fsl_sai_read_dlcfg+0x184/0x368
[   11.645898]  fsl_sai_probe+0x3ec/0xb48
[   11.649663]  platform_drv_probe+0x70/0xd8
[   11.653683]  really_probe+0x24c/0x370
[   11.657358]  driver_probe_device+0x70/0x138
[   11.661554]  __driver_attach+0x124/0x128
[   11.665489]  bus_for_each_dev+0xe8/0x158
[   11.669425]  driver_attach+0x30/0x40
[   11.673012]  bus_add_driver+0x290/0x308
[   11.676861]  driver_register+0xbc/0x1d0
[   11.680711]  __platform_driver_register+0x7c/0x88
[   11.685431]  fsl_sai_driver_init+0x18/0x20
[   11.689537]  do_one_initcall+0xe8/0x5a8
[   11.693387]  kernel_init_freeable+0x6b0/0x760
[   11.697759]  kernel_init+0x10/0x120
[   11.701255]  ret_from_fork+0x10/0x18
....
==================================================================
[   11.800186] Disabling lock debugging due to kernel taint

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
5 years agoMLK-22521-3: ASoC: fsl_easrc: Add multi context for bps_iec958
Shengjiu Wang [Thu, 29 Aug 2019 08:31:06 +0000 (16:31 +0800)]
MLK-22521-3: ASoC: fsl_easrc: Add multi context for bps_iec958

Add multi context support for bps_iec958

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 131408cc5b9f7957502c01bf3bff18c9c4b4fca0)

5 years agoMLK-22521-2: ASoC: fsl_easrc: support configuration of channel status
Shengjiu Wang [Thu, 29 Aug 2019 05:56:22 +0000 (13:56 +0800)]
MLK-22521-2: ASoC: fsl_easrc: support configuration of channel status

support configuration of channel status for IEC958

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit 92aee54f844098080c878ae59878dadab28d8ea3)

5 years agoMLK-22521-1: ASoC: fsl_easrc:IEC958 is only supported for output
Shengjiu Wang [Thu, 29 Aug 2019 06:07:18 +0000 (14:07 +0800)]
MLK-22521-1: ASoC: fsl_easrc:IEC958 is only supported for output

IEC958 is only supported for output according to the RM

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
(cherry picked from commit bf36888526c420776c18ca06548b9d3798200beb)

5 years agoMLK-22514 arm64: dts: imx8mm: Fix GPU axi/ahb rates
Leonard Crestez [Tue, 27 Aug 2019 11:34:40 +0000 (14:34 +0300)]
MLK-22514 arm64: dts: imx8mm: Fix GPU axi/ahb rates

On imx8mm gpu AXI should be 800m and AHB 400m but assigned-clock-rates
incorrectly assigned 400m to AXI and left AHB at 800m.

Fixes: e744bde4148b ("MLK-21700-4 arm64: dts: imx8mm: Consolidate composite assigned-clocks")

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
5 years agoMLK-22502: arm64: dts: fsl-imx8mq: Use SYNC_PULSE for Raydium panel
Robert Chiras [Mon, 26 Aug 2019 08:38:08 +0000 (11:38 +0300)]
MLK-22502: arm64: dts: fsl-imx8mq: Use SYNC_PULSE for Raydium panel

On 8MQ, it seems that the panel has issues when video-mode used is with
SYNC_EVENTS (default). So, use the video-mode to <2> (SYNC_PULSE), since
the video signal is much stable with this mode.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
5 years agoMLK-22360 soc: imx8qm/imx8qxp: Fix power state of parent power domains
Ranjani Vaidyanathan [Thu, 15 Aug 2019 19:54:49 +0000 (14:54 -0500)]
MLK-22360 soc: imx8qm/imx8qxp: Fix power state of parent power domains

Handle the case when powering down a pd with no active slave domains.

Signed-off-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
5 years agoMLK-22506: VPU Decoder: fix mutex may not unlock if v4l2_open fail
ming_qian [Tue, 27 Aug 2019 01:46:39 +0000 (09:46 +0800)]
MLK-22506: VPU Decoder: fix mutex may not unlock if v4l2_open fail

there is an bug in v4l2_open,
that the dev_mutex may be not unlock in some flow,
it'll cause dead lock.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
5 years agoMLK-22463-2: ASoC: imx-sii902x: Fix constant variable guards dead code
Shengjiu Wang [Mon, 26 Aug 2019 07:55:14 +0000 (15:55 +0800)]
MLK-22463-2: ASoC: imx-sii902x: Fix constant variable guards dead code

Fix constant variable guards dead code which is reported by coverity.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>