28 Apr, 2021

1 commit


16 Dec, 2020

1 commit


06 Dec, 2020

2 commits


04 Dec, 2020

3 commits

  • GPU hardware access cannot be guaranteed to complete after unlock memory,
    Need perform asynchronous unlock to avoid GPU access the freed MMU page.

    Signed-off-by: Xianzhong
    (cherry picked from commit f902173b8ece1f6367c30557498077c569db31ff)

    Xianzhong
     
  • The pixel clock of display controller lcdifv3 source from hdmi phy.
    When hdmi cable plugout irq trigger,
    hdmi phy will be poweroff immediately in hdmi controller driver.
    But DRM and user app may still working until they received plugout event.
    For such case, the kernel will dump.

    [ 89.707045] ------------[ cut here ]------------
    [ 89.711705] [CRTC:39:crtc-2] vblank wait timed out
    [ 89.716563] WARNING: CPU: 2 PID: 7 at drivers/gpu/drm/drm_atomic_helper.c:1467 drm_atomic_helper_wait_for_vblanks.part.0+0x274/0x290
    [ 89.728472] Modules linked in:
    [ 89.731533] CPU: 2 PID: 7 Comm: kworker/u8:0 Not tainted 5.4.70-00041-g631cb8d6e2b2-dirty #23
    [ 89.740055] Hardware name: NXP i.MX8MPlus EVK board (DT)
    [Playing (No Repeated)][Vol=1.0][ 89.745372] Workqueue: events_unbound commit_work
    [00:00:04/00:02:18][ 89.752939] pstate: 40000005 (nZcv daif -PAN -UAO)
    [ 89.759376] pc : drm_atomic_helper_wait_for_vblanks.part.0+0x274/0x290
    [ 89.765905] lr : drm_atomic_helper_wait_for_vblanks.part.0+0x274/0x290
    [ 89.772431] sp : ffff800011c43ca0
    [ 89.775744] x29: ffff800011c43ca0 x28: 0000000000000000
    [ 89.781054] x27: 000000000000055f x26: 0000000000000070
    [ 89.786363] x25: ffff00017786b800 x24: 0000000000000001
    [ 89.791674] x23: 0000000000000038 x22: 0000000000000004
    [ 89.796983] x21: ffff00016a375400 x20: ffff00017786b088
    [ 89.802293] x19: 0000000000000002 x18: 0000000000000010
    [ 89.807604] x17: 0000000000000000 x16: 0000000000000000
    [ 89.812913] x15: ffff0001760c5870 x14: ffffffffffffffff
    [ 89.818225] x13: ffff800091c439f7 x12: ffff800011c439ff
    [ 89.823537] x11: ffff800011a11000 x10: ffff800011b36328
    [ 89.828847] x9 : 0000000000000000 x8 : ffff800011b37000
    [ 89.834158] x7 : ffff80001069fc68 x6 : 0000000000000341
    [ 89.839469] x5 : 0000000000000000 x4 : ffff00017f3a0188
    [ 89.844778] x3 : ffff00017f3a6f20 x2 : ffff00017f3a0188
    [ 89.850088] x1 : 4d8823010d259700 x0 : 0000000000000000
    [ 89.855404] Call trace:
    [ 89.857854] drm_atomic_helper_wait_for_vblanks.part.0+0x274/0x290
    [ 89.864033] drm_atomic_helper_wait_for_vblanks+0x14/0x20
    [ 89.869433] lcdifv3_drm_atomic_commit_tail+0x64/0x7c
    [ 89.874484] commit_tail+0x9c/0x138
    [ 89.877970] commit_work+0x10/0x18
    [ 89.881372] process_one_work+0x198/0x320
    [ 89.885382] worker_thread+0x48/0x420
    [ 89.889042] kthread+0x138/0x158
    [ 89.892272] ret_from_fork+0x10/0x1c
    [ 89.895847] ---[ end trace ed53d661901a6437 ]---

    Keep hdmi phy in poweron status when cable plugout to workaround the issue.
    HDMI phy power off function will be move to lcdifv3 or hdmi phy driver
    later.

    Signed-off-by: Sandor Yu
    Reviewed-by: Robby Cai

    Sandor Yu
     
  • According to board team signal measure result and update trim value as

    For USB OTG1, setting 0x5b100010=0X10080802 (default 0X10080807).
    For USB OTG2, setting 0x5b110010=0X10080803 (default 0X10080807).

    Signed-off-by: Frank Li
    Acked-by: Peter Chen

    Frank Li
     

03 Dec, 2020

2 commits

  • TRNG "sample size" (the total number of entropy samples that will be taken
    during entropy generation) default / POR value is very conservatively
    set to 2500.

    Let's set it to 512, the same as the caam driver in U-boot
    (drivers/crypto/fsl_caam.c) does.

    This solves the issue of RNG performance dropping after a suspend/resume
    cycle on parts where caam loses power, since the initial U-boot setttings
    are lost and kernel does not restore them when resuming.

    Note: when changing the sample size, the self-test parameters need to be
    updated accordingly.

    Signed-off-by: Horia Geantă
    Reviewed-by: Iuliana Prodan

    Horia Geantă
     
  • Remove read of rtmctl register, which is not needed after
    commit 8439e94fceb3 ("crypto: caam - fix sparse warnings").

    Fixes: 8439e94fceb3 ("crypto: caam - fix sparse warnings")
    Signed-off-by: Horia Geantă
    Reviewed-by: Iuliana Prodan

    Horia Geantă
     

02 Dec, 2020

3 commits

  • The following stack trace is met when stress-testing suspend/resume:

    [...]
    PM: suspend devices took 1.972 seconds
    [...]
    SError Interrupt on CPU1, code 0xbf000002 -- SError
    CPU: 1 PID: 213 Comm: hwrng Not tainted 5.4.70-2.3.0+g72209dedd129 #1
    Hardware name: Freescale i.MX8DXL EVK (DT)
    pstate: 60000005 (nZCv daif -PAN -UAO)
    pc : _raw_spin_unlock_bh+0x0/0x28
    lr : caam_jr_enqueue+0x24c/0x378
    sp : ffff8000127dbd10
    x29: ffff8000127dbd10 x28: ffff00003cac5940
    x27: 00000000bcb5ef80 x26: 0000000000000010
    x25: ffff800011c12000 x24: ffff8000127dbdb8
    x23: ffff800010ca2298 x22: ffff00003c8aec10
    x21: ffff00003cb5ef80 x20: 00000000ffffff8d
    x19: 0000000000000010 x18: 000000000000000e
    x17: 0000000000000001 x16: 0000000000000019
    x15: 0000000000000033 x14: 000000000000004c
    x13: 0000000000000068 x12: ffff800011188e90
    x11: ffff00003c897210 x10: 0000000000000026
    x9 : 00000000a4dcb313 x8 : 0000000000000000
    x7 : 0000000000000001 x6 : ffff800011b59000
    x5 : 0000000000000000 x4 : 0000000000000001
    x3 : 0000000000000004 x2 : 0000000000000014
    x1 : 00000000000001ec x0 : ffff00003cac5940
    Kernel panic - not syncing: Asynchronous SError Interrupt
    CPU: 1 PID: 213 Comm: hwrng Not tainted 5.4.70-2.3.0+g72209dedd129 #1
    Hardware name: Freescale i.MX8DXL EVK (DT)
    Call trace:
    dump_backtrace+0x0/0x140
    show_stack+0x14/0x20
    dump_stack+0xb4/0x114
    panic+0x158/0x324
    nmi_panic+0x84/0x88
    arm64_serror_panic+0x74/0x80
    do_serror+0x80/0x138
    el1_error+0x84/0xf8
    _raw_spin_unlock_bh+0x0/0x28
    caam_rng_read_one.isra.0+0x1c8/0x3a0
    caam_read+0x80/0xa8
    hwrng_fillfn+0x8c/0x140
    kthread+0x138/0x158
    ret_from_fork+0x10/0x1c
    SMP: stopping secondary CPUs
    Kernel Offset: disabled
    CPU features: 0x0002,20002008
    Memory Limit: none

    This happens when:
    -the generic "hwrng" kthread tries to draw entropy and
    -the current rng is caam's rng and
    -the job ring used for caam rng hasn't been resumed yet
    (after a suspend)

    The issue has been noticed also in upstream (for TPM device in ChromeOS)
    and the fix proposed involved making the "hwrng" kthread freezable:
    03a3bb7ae631 ("hwrng: core - Freeze khwrng thread during suspend")
    ff296293b353 ("random: Support freezable kthreads in add_hwgenerator_randomness()")
    59b569480dc8 ("random: Use wait_event_freezable() in add_hwgenerator_randomness()")

    However, because these commits introduced a regression in virtio-rng
    (Link: https://lore.kernel.org/lkml/4a45b3e0-ed3a-61d3-bfc6-957c7ba631bb@maciej.szmigiero.name)
    they were later reverted in commit
    08e97aec700a ("Revert "hwrng: core - Freeze khwrng thread during suspend"")

    Since there was no progress in upstream and fixing virtio-rng regression
    is not trivial, the solution chosen is to unregister / re-register
    caam rng driver from hwrng during suspend / resume.

    Signed-off-by: Horia Geantă
    Tested-by: Iuliana Prodan

    Horia Geantă
     
  • The global driver_data.jr_list contains the list of active job rings
    at a given moment.

    Picking a JR is done using caam_jr_alloc(), which goes through this list
    and chooses the JR with the least number of users ("tfm_count").

    During the JR suspend/resume, this list must be updated to reflect that
    the JR is no longer available - otherwise caam_jr_alloc() could return
    a JR that has been suspended.

    While this is rather a theoretical issue (i.e. was not met in practice),
    it is a prerequisite for fixing the RNG failure met during suspend/resume.

    Signed-off-by: Horia Geantă
    Tested-by: Iuliana Prodan

    Horia Geantă
     
  • With MCU SDK 2.9, there are two copy resource tables published to Linux,
    the 1st is vdev0vring0, the 2nd is in rsc-table address.

    The 1st is for legacy compatible usage, it will be removed in future
    releases. we will only use 2nd new address in future releases.

    But at current stage, we still use the 1st one in linux, but we
    also need to reserve area for the 2nd one, otherwise when using
    linux to kick Mcore, Mcore might overwrite the data used by Linux.

    The 2nd table address is as below:
    8QXP/DX/DXL: [0x90000000 + 1M – 4KB, 0x90000000 + 1M)
    8QM: CM40: [0x90000000 + 1M – 4KB, 0x90000000 + 1M)
    CM41: [0x90100000 + 1M – 4KB, 0x90100000 + 1M)
    8MQ/MM/MN-evk: [0xb8000000 + 1M – 4KB, 0xb8000000 + 1M)
    8MP-evk: [0x55000000 + 1M – 4KB, 0x55000000 + 1M)

    Currently only 8DXL and 8MP use MCU SDK 2.9 and others still use MCU
    SDK 2.8, but for prepare future update, we update all SoC to reserve
    the 2nd table address.

    Reviewed-by: Ye Li
    Reviewed-by: Richard Zhu
    Signed-off-by: Peng Fan

    Peng Fan
     

01 Dec, 2020

1 commit

  • This is just a workaround for Linux 5.4 Q4 release
    to avoid Linux use the memory.
    This board only has 1GB memory, the 0xb8000000
    exceeds the DRAM, and round back to 0x78000000,
    since we not modify Mcore image, so we need to avoid
    Linux touch 0x78000000 which might crash the system
    and mark mcore ddr demo broken and only support booting mcore image
    from U-Boot bootaux.

    Reviewed-by: Shengjiu Wang
    Signed-off-by: Peng Fan

    Peng Fan
     

27 Nov, 2020

3 commits


21 Nov, 2020

4 commits


20 Nov, 2020

13 commits


19 Nov, 2020

7 commits

  • firmware

    move timestamp to firmware, it will make our driver more easy to
    upstream

    Signed-off-by: Ming Qian

    Ming Qian
     
  • firmware

    move timestamp to firmware, it will make our driver more easy to
    upstream

    Signed-off-by: Ming Qian

    Ming Qian
     
  • We hit the problem with below sequence:
    - ci_udc_vbus_session() update vbus_active flag and ci->driver
    is valid,
    - before calling the ci_hdrc_gadget_connect(),
    usb_gadget_udc_stop() is called by application remove gadget
    driver,
    - ci_udc_vbus_session() will contine do ci_hdrc_gadget_connect() as
    gadget_ready is 1, so udc interrupt is enabled, but ci->driver is
    NULL.
    - USB connection irq generated but ci->driver is NULL.

    As udc irq only should be enabled when gadget driver is binded, so
    add spinlock to protect the usb irq enable for vbus session handling.

    Signed-off-by: Jun Li
    Signed-off-by: Peter Chen
    (cherry picked from commit 72dc8df7920fc24eba0f586c56e900a1643ff2b3)
    (cherry picked from commit 0fe900249814f73ecb79c6fb2ae75d46ed9d3a3e)

    Jun Li
     
  • The 'lcdif_crtc' allocated by devm_kzalloc() in bind() will
    be freed automatically during unbind() stage if any other
    component bind failed and this will cause use-after-free
    issue in drm_mode_config_cleanup().

    Kasan reports below error related with this issue:

    [ 2.188122] ==================================================================
    [ 2.195370] BUG: KASAN: use-after-free in drm_mode_config_cleanup+0x274/0x478
    [ 2.202524] Read of size 8 at addr ffff000069c1e098 by task swapper/0/1
    [ 2.209145]
    [ 2.210659] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.70-00056-g8e43cd16c8bb-dirty #139
    [ 2.219020] Hardware name: FSL i.MX8MM EVK board (DT)
    [ 2.224080] Call trace:
    [ 2.226546] dump_backtrace+0x0/0x1e8
    [ 2.230220] show_stack+0x14/0x20
    [ 2.233554] dump_stack+0xe0/0x14c
    [ 2.236981] print_address_description.isra.0+0x68/0x34c
    [ 2.242311] __kasan_report+0x118/0x220
    [ 2.246165] kasan_report+0xc/0x18
    [ 2.249587] __asan_load8+0x94/0xb8
    [ 2.253090] drm_mode_config_cleanup+0x274/0x478
    [ 2.257728] imx_drm_bind+0xd8/0x1b0
    [ 2.261324] try_to_bring_up_master+0x24c/0x2c8
    [ 2.265870] __component_add+0x110/0x258
    [ 2.269812] component_add+0x10/0x18
    [ 2.273407] imx_sec_dsim_probe+0x74/0xa0
    [ 2.277438] platform_drv_probe+0x6c/0xc8
    [ 2.281462] really_probe+0x148/0x440
    [ 2.285140] driver_probe_device+0x74/0x130
    [ 2.289340] device_driver_attach+0x94/0xa0
    [ 2.293537] __driver_attach+0x70/0x110
    [ 2.297390] bus_for_each_dev+0xe4/0x158
    [ 2.301329] driver_attach+0x30/0x40
    [ 2.304918] bus_add_driver+0x21c/0x2b8
    [ 2.308771] driver_register+0xbc/0x1d0
    [ 2.312627] __platform_driver_register+0x7c/0x88
    [ 2.317350] imx_sec_dsim_driver_init+0x18/0x20
    [ 2.321897] do_one_initcall+0xa4/0x24c
    [ 2.325751] kernel_init_freeable+0x238/0x2e8
    [ 2.330128] kernel_init+0x10/0x114
    [ 2.333635] ret_from_fork+0x10/0x1c
    [ 2.337215]
    [ 2.338717] Allocated by task 1:
    [ 2.341963] save_stack+0x24/0xb0
    [ 2.345296] __kasan_kmalloc.isra.0+0xc0/0xe0
    [ 2.349671] kasan_slab_alloc+0x14/0x20
    [ 2.353525] __kmalloc_node_track_caller+0x118/0x2c8
    [ 2.358512] devm_kmalloc+0x48/0xc8
    [ 2.362016] lcdif_crtc_bind+0x38/0x278
    [ 2.365868] component_bind_all+0x1c0/0x3c8
    [ 2.370070] imx_drm_bind+0x104/0x1b0
    [ 2.373750] try_to_bring_up_master+0x24c/0x2c8
    [ 2.378298] __component_add+0x110/0x258
    [ 2.382235] component_add+0x10/0x18
    [ 2.385827] imx_sec_dsim_probe+0x74/0xa0
    [ 2.389854] platform_drv_probe+0x6c/0xc8
    [ 2.393877] really_probe+0x148/0x440
    [ 2.397555] driver_probe_device+0x74/0x130
    [ 2.401757] device_driver_attach+0x94/0xa0
    [ 2.405954] __driver_attach+0x70/0x110
    [ 2.409803] bus_for_each_dev+0xe4/0x158
    [ 2.413740] driver_attach+0x30/0x40
    [ 2.417330] bus_add_driver+0x21c/0x2b8
    [ 2.421180] driver_register+0xbc/0x1d0
    [ 2.425035] __platform_driver_register+0x7c/0x88
    [ 2.429754] imx_sec_dsim_driver_init+0x18/0x20
    [ 2.434300] do_one_initcall+0xa4/0x24c
    [ 2.438150] kernel_init_freeable+0x238/0x2e8
    [ 2.442526] kernel_init+0x10/0x114
    [ 2.446031] ret_from_fork+0x10/0x1c
    [ 2.449612]
    [ 2.451112] Freed by task 1:
    [ 2.454010] save_stack+0x24/0xb0
    [ 2.457343] __kasan_slab_free+0x108/0x180
    [ 2.461456] kasan_slab_free+0x10/0x18
    [ 2.465219] kfree+0x80/0x298
    [ 2.468207] release_nodes+0x358/0x3e8
    [ 2.471975] devres_release_group+0xd0/0x140
    [ 2.476261] component_unbind.isra.0+0x98/0xb8
    [ 2.480724] component_bind_all+0x25c/0x3c8
    [ 2.484924] imx_drm_bind+0x104/0x1b0
    [ 2.488605] try_to_bring_up_master+0x24c/0x2c8
    [ 2.493153] __component_add+0x110/0x258
    [ 2.497090] component_add+0x10/0x18
    [ 2.500682] imx_sec_dsim_probe+0x74/0xa0
    [ 2.504707] platform_drv_probe+0x6c/0xc8
    [ 2.508732] really_probe+0x148/0x440
    [ 2.512411] driver_probe_device+0x74/0x130
    [ 2.516610] device_driver_attach+0x94/0xa0
    [ 2.520807] __driver_attach+0x70/0x110
    [ 2.524657] bus_for_each_dev+0xe4/0x158
    [ 2.528594] driver_attach+0x30/0x40
    [ 2.532183] bus_add_driver+0x21c/0x2b8
    [ 2.536036] driver_register+0xbc/0x1d0
    [ 2.539889] __platform_driver_register+0x7c/0x88
    [ 2.544608] imx_sec_dsim_driver_init+0x18/0x20
    [ 2.549152] do_one_initcall+0xa4/0x24c
    [ 2.553006] kernel_init_freeable+0x238/0x2e8
    [ 2.557380] kernel_init+0x10/0x114
    [ 2.560884] ret_from_fork+0x10/0x1c
    [ 2.564464]
    [ 2.565972] The buggy address belongs to the object at ffff000069c1e000
    [ 2.565972] which belongs to the cache kmalloc-2k of size 2048
    [ 2.578510] The buggy address is located 152 bytes inside of
    [ 2.578510] 2048-byte region [ffff000069c1e000, ffff000069c1e800)
    [ 2.590343] The buggy address belongs to the page:
    [ 2.595154] page:fffffe0001870600 refcount:1 mapcount:0 mapping:ffff000068003400 index:0x0 compound_mapcount: 0
    [ 2.605260] flags: 0xffff00000010200(slab|head)
    [ 2.609820] raw: 0ffff00000010200 dead000000000100 dead000000000122 ffff000068003400
    [ 2.617583] raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000
    [ 2.625339] page dumped because: kasan: bad access detected
    [ 2.630917]
    [ 2.632417] Memory state around the buggy address:
    [ 2.637225] ffff000069c1df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [ 2.644463] ffff000069c1e000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [ 2.651700] >ffff000069c1e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [ 2.658931] ^
    [ 2.662954] ffff000069c1e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [ 2.670193] ffff000069c1e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    [ 2.677421] ==================================================================

    Signed-off-by: Fancy Fang
    Reported-by: Bo Zhang
    (cherry picked from commit 6c91a51df9425a93157409546feca7107baaf4dd)

    Fancy Fang
     
  • Due to commit b3a420c9cf3f (MLK-24998-4 drm/bridge: sec-dsim:
    use 12MHz for default PHY REF clock), the dsi PHY reference
    clock source need to be assigned to osc_24m clock.

    Signed-off-by: Fancy Fang
    Reviewed-by: Jacky Bai
    (cherry picked from commit 8e43cd16c8bbfe5b7e3c0fc1e7c3ddf738d8db01)

    Fancy Fang
     
  • Due to commit b3a420c9cf3f (MLK-24998-4 drm/bridge: sec-dsim:
    use 12MHz for default PHY REF clock), the dsi PHY reference
    clock source need to be assigned to osc_24m clock.

    Signed-off-by: Fancy Fang
    Reviewed-by: Jacky Bai
    (cherry picked from commit 2972241b831ed65f641ccdb80b504cadef0ba591)

    Fancy Fang
     
  • Add mode_valid() implementation for CRTC to filter out any
    mode which cannot be supported by LCDIFv3. Only check the
    CEA and DMT modes for pixel clock round rate is same with
    the value from mode.

    Signed-off-by: Fancy Fang
    Reviewed-by: Liu Ying
    (cherry picked from commit f252a44da9f90951614c0bf513df6bd4d145e76e)

    Fancy Fang