linux.git
4 years agoarm64: dts: imx8m: add NVMEM provider and consumer to read soc unique ID
Alice Guo [Mon, 4 Jan 2021 09:15:43 +0000 (17:15 +0800)]
arm64: dts: imx8m: add NVMEM provider and consumer to read soc unique ID

In order to be able to use NVMEM APIs to read soc unique ID, add the
nvmem data cell and name for nvmem-cells to the "soc" node, and add a
nvmem node which provides soc unique ID to efuse@30350000.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
4 years agoarm64: dts: imx8m: add SoC ID compatible
Alice Guo [Mon, 4 Jan 2021 09:15:42 +0000 (17:15 +0800)]
arm64: dts: imx8m: add SoC ID compatible

Add compatible string to .dtsi files for binding of imx8_soc_info and
device.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
4 years agodt-bindings: soc: imx8m: add DT Binding doc for soc unique ID
Alice Guo [Mon, 4 Jan 2021 09:15:41 +0000 (17:15 +0800)]
dt-bindings: soc: imx8m: add DT Binding doc for soc unique ID

Add DT Binding doc for the Unique ID of i.MX 8M series.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
4 years agoMLK-25346: arm64: defconfig: Add i.MX8QM cockpit config
Nitin Garg [Tue, 23 Mar 2021 21:08:08 +0000 (16:08 -0500)]
MLK-25346: arm64: defconfig: Add i.MX8QM cockpit config

Add config to support 2 cluster cockpit on i.MX8QM.
make imx_v8_defconfig imx8qm_cockpit.config

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoMLK-25346: arm64: dts: imx8qm: Add Cockpit domain device trees
Nitin Garg [Fri, 26 Mar 2021 19:52:14 +0000 (14:52 -0500)]
MLK-25346: arm64: dts: imx8qm: Add Cockpit domain device trees

Add i.MX8QM Cockpit domain device trees for the
2 clusters of the SOC.

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoMLK-25346: arm64: dts: imx8qm: add MU8A and MU8B node in lsio
Nitin Garg [Tue, 23 Mar 2021 20:51:55 +0000 (15:51 -0500)]
MLK-25346: arm64: dts: imx8qm: add MU8A and MU8B node in lsio

Add the MU8 A & B for communication between partitions
of cortex-A53 and cortex-A72 clusters in cockpit
configuration.

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoLF-882 arm64: imx8qm-ss-lvds.dtsi: add definition for lvds_ipg_clk
Seb Fagard [Mon, 20 Jan 2020 17:00:08 +0000 (18:00 +0100)]
LF-882 arm64: imx8qm-ss-lvds.dtsi: add definition for lvds_ipg_clk

Each lvds subsystem must be independent from the other:
- add 'lvds_ipg_clk' clock definiton as needed by 'lvds1_subsys'
  and 'lvds2_subsys'.

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoMLK-25346: rtc: add readonly option to rtc-imx-sc driver
Nitin Garg [Tue, 23 Mar 2021 20:42:46 +0000 (15:42 -0500)]
MLK-25346: rtc: add readonly option to rtc-imx-sc driver

Setting RTC time requires ownership of SCU's SYSTEM
resource. Add an 'readonly' option to the driver to
allow usage of the RTC even without owning the SYSTEM
resource. In that case, time setting is not allowed.

Signed-off-by: Fabrice Goucem <fabrice.goucem@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoMLK-25346: net: add imx-shmem-net driver
Nitin Garg [Tue, 23 Mar 2021 20:37:57 +0000 (15:37 -0500)]
MLK-25346: net: add imx-shmem-net driver

This driver uses the shared memory and the mailbox units to
provide a virtual network interface toward a peer device on
the same SoC. This new driver is based on ivshmem-net driver,
where we replace ivshmem's registers by struct 'regs' in the
context, and push in MU all modifications to 'regs' value lstate.

FEATURES:
Only 2 identical devices in different HW partitions and connected
by an MU can talk to each other.
All MU transaction may timeout: if first message sent through MU,
then the driver will be probed again.
The driver supports peer's partition reset:
driver registers to SCFW service to receive a notification when
peer's partition resets.
The driver supports multiple devices
(i.e. multiple connections to different partitions).

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoMLK-25346: irqchip/gic: change affinity settings strategy
Nitin Garg [Tue, 23 Mar 2021 20:33:53 +0000 (15:33 -0500)]
MLK-25346: irqchip/gic: change affinity settings strategy

Instead of setting the same affinity for all interrupts
at boot time, only set it when interrupts are registered.
This way, a cluster will not mess up the other cluster's
settings in Cockpit configuration.

Signed-off-by: Seb Fagard <sebastien.fagard@nxp.com>
Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
4 years agoarm64: imx8mx: vpu: integrate vsi 20210409 release
Zhou Peng [Fri, 9 Apr 2021 12:23:25 +0000 (20:23 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210409 release

- M865SW-729: VSI V4L2 Engineer release package 20210409
  M865SW-725: [VPU/V4l2] utest met error when handle some hevc streams like these, 10bits->8bits->10bits bit-depth changing
  M865SW-727: [VPU/V4L2] common: potential risk in code
  M865SW-658: [VPU/V4L2] encoder: support resolution change stream transcoding.
  M865SW-696: [VPU/V4L2] VC8000E: Flush encoder then get V4L2_EVENT_CODEC_ERROR event
  M865SW-697: [VPU/V4L2] encoder: the bitrate of encoding vp8 is not accurate

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 9d01ea827a624280ada828f68fc1a12036ff1812)

4 years agoLF-3673: ASoC: ak5558: Fix the value for gpiod_set_value
Shengjiu Wang [Fri, 9 Apr 2021 09:31:08 +0000 (17:31 +0800)]
LF-3673: ASoC: ak5558: Fix the value for gpiod_set_value

The GPIO is defined as ACTIVE_LOW, so the value need
to be corrected for each purpose.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
4 years agoLF-3623: media: imx8: isi: fix Can't match soc version
Guoniu.zhou [Mon, 29 Mar 2021 07:32:15 +0000 (15:32 +0800)]
LF-3623: media: imx8: isi: fix Can't match soc version

ISI core driver depend on soc version info but driver provided the info
is not ready when ISI core driver probe, so return -EPROBE_DEFER replaced
with -EINVAL.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3687: media: isi: refine message handle for isi device driver
Guoniu.zhou [Thu, 8 Apr 2021 06:32:52 +0000 (14:32 +0800)]
LF-3687: media: isi: refine message handle for isi device driver

ISI capture device driver will depend on mediamix reset driver when do
probe, but sometimes the driver is not ready when isi capture driver
probe, so for this case, driver only return the error value and don't
print error message

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3685: media: cap: move s_power subdev from open to streamon
Guoniu.zhou [Thu, 8 Apr 2021 02:16:45 +0000 (10:16 +0800)]
LF-3685: media: cap: move s_power subdev from open to streamon

When user open video device, most of cases it will go through all video
device node registered in system. If power on subdev when open, it will
cost about 500ms due to ov5640 loading firmware. So move the operation
from open to streamon.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3683: media: csi2: replace hard code with macro for isp dewarp control
Guoniu.zhou [Wed, 7 Apr 2021 10:15:14 +0000 (18:15 +0800)]
LF-3683: media: csi2: replace hard code with macro for isp dewarp control

Replace hard code with marco for isp dewarp control in mediamix GPR

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoMLK-24711: media: csi: samsung: fix print error info when csi driver probe
Guoniu.zhou [Wed, 7 Apr 2021 09:26:48 +0000 (17:26 +0800)]
MLK-24711: media: csi: samsung: fix print error info when csi driver probe

"gpr" property only used for iMX8MP platform, so add checking before
get the property handle

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoMLK-25258: media: imx: unregister v4l2 async notifier when no sensor connected
Guoniu.zhou [Sat, 20 Feb 2021 08:00:54 +0000 (16:00 +0800)]
MLK-25258: media: imx: unregister v4l2 async notifier when no sensor connected

In order to support hotplug-like mechanism, driver will call subdev notifier
complete function manually if there is sensor connected. If there there is no
valid sensor conneted when imx8-media-dev driver loaded, it will unregister
video device subdev. But in some case, sensor driver will be loaded after it.
In order to cover the case, imx8-media-dev driver unregister v4l2 async notifier
if there is no sensor connected. After sensor driver load, user can unload imx8-
media-dev driver and load it again.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-10: media: isi: m2m: fix v4l2-compliance buffer ioctls test fail issue
Guoniu.zhou [Fri, 19 Feb 2021 10:18:09 +0000 (18:18 +0800)]
LF-3334-10: media: isi: m2m: fix v4l2-compliance buffer ioctls test fail issue

Fix VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF test fail issue, log as bellow:
  test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
    fail: v4l2-test-buffers.cpp(614): q.reqbufs(node, 1)

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-09: media: isi: m2m: fix v4l2-compliance multiple opens test fail issue
Guoniu.zhou [Fri, 19 Feb 2021 10:14:13 +0000 (18:14 +0800)]
LF-3334-09: media: isi: m2m: fix v4l2-compliance multiple opens test fail issue

Fix isi memory to memory multiple opens test fail issue, log as bellow:
  test second /dev/video0 open: FAIL
  fail: v4l2-compliance.cpp(735): !ok
  test for unlimited opens: FAIL

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-08: media: isi: m2m: add subscribe event support
Guoniu.zhou [Fri, 5 Feb 2021 06:37:33 +0000 (14:37 +0800)]
LF-3334-08: media: isi: m2m: add subscribe event support

Add subscribe event support

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-07: media: isi: m2m: fix v4l2-compliance S_FMT test fail issue
Guoniu.zhou [Fri, 5 Feb 2021 06:31:40 +0000 (14:31 +0800)]
LF-3334-07: media: isi: m2m: fix v4l2-compliance S_FMT test fail issue

Fix v4l2-compliance S_FMT test fail issue
  test VIDIOC_S_FMT: FAIL
    fail: ../../../v4l-utils-1.18.1/utils/v4l2-compliance/v4l2-test-formats.cpp(1103): S_FMT cannot handle an invalid format

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-06: media: isi: m2m: fix v4l2-compliance TRY_FMT test fail issue
Guoniu.zhou [Fri, 5 Feb 2021 06:24:23 +0000 (14:24 +0800)]
LF-3334-06: media: isi: m2m: fix v4l2-compliance TRY_FMT test fail issue

Fix v4l2-compliance TRY_FMT test fail issue
  test VIDIOC_TRY_FMT: FAIL
    fail: ../../../v4l-utils-1.18.1/utils/v4l2-compliance/v4l2-test-formats.cpp(467): pix_mp.field == V4L2_FIELD_ANY

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-05: media: isi: m2m: fix v4l2-compliance G_FMT test fail issue
Guoniu.zhou [Fri, 5 Feb 2021 03:06:34 +0000 (11:06 +0800)]
LF-3334-05: media: isi: m2m: fix v4l2-compliance G_FMT test fail issue

Fix v4l2-compliance G_FMT test fail issue, error log as bellow:
[  110.057121] Unable to handle kernel NULL pointer dereference at virtual address 000000000000000c
  ...
[  110.227985] Call trace:
[  110.230431]  mxc_isi_m2m_g_fmt_vid_cap+0x48/0xb0
[  110.235046]  v4l_g_fmt+0xc8/0x2f0
[  110.238358]  __video_do_ioctl+0x180/0x3e4
[  110.242365]  video_usercopy+0x190/0x410
[  110.246197]  video_ioctl2+0x18/0x24
[  110.249684]  v4l2_ioctl+0x44/0x64
[  110.252998]  __arm64_sys_ioctl+0xa8/0xf0
[  110.256920]  el0_svc_common.constprop.0+0x78/0x1a0
[  110.261708]  do_el0_svc+0x24/0x90
[  110.265022]  el0_svc+0x14/0x20
[  110.268074]  el0_sync_handler+0x1a4/0x1b0
[  110.272080]  el0_sync+0x174/0x180
[  110.275395] Code: b9489405 b9000e65 b9001664 f9446404 (b9400c84)
[  110.281487] ---[ end trace 115fd9c0a779b4d9 ]---

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-04: media: isi: cap: fix v4l2-compliance buffer ioctls test fail issue
Guoniu.zhou [Wed, 3 Feb 2021 07:33:44 +0000 (15:33 +0800)]
LF-3334-04: media: isi: cap: fix v4l2-compliance buffer ioctls test fail issue

Fix v4l2-compliance VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF test fail issue, error
as bellow:

  test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
    fail: v4l2-test-buffers.cpp(722): q.create_bufs(node, 1, &fmt) != EINVAL

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-03: media: isi: cap: fix v4l2-compliance EVENT test fail issue
Guoniu.zhou [Wed, 3 Feb 2021 06:57:34 +0000 (14:57 +0800)]
LF-3334-03: media: isi: cap: fix v4l2-compliance EVENT test fail issue

Fix v4l2-compliance (UN)SUBSCRIBE_EVENT/DQEVENT test fail issue, error log as bellow:
  test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-02: media: isi: cap: fix v4l2-compliance TRY_FMT/S_FMT test fail issue
Guoniu.zhou [Tue, 2 Feb 2021 06:30:57 +0000 (14:30 +0800)]
LF-3334-02: media: isi: cap: fix v4l2-compliance TRY_FMT/S_FMT test fail issue

Fix v4l2-compliance TRY_FMT/S_FMT test fail issue, error log as bellow:
  test VIDIOC_TRY_FMT: FAIL
    fail: ../../../v4l-utils-1.18.1/utils/v4l2-compliance/v4l2-test-formats.cpp(346): colorspace >= 0xff
    fail: ../../../v4l-utils-1.18.1/utils/v4l2-compliance/v4l2-test-formats.cpp(464): testColorspace(node->has_inputs || node->has_output)
  test VIDIOC_S_FMT: FAIL

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3334-01: media: isi: cap: fix v4l2-compliance G_FMT test fail issue
Guoniu.zhou [Thu, 4 Feb 2021 07:13:14 +0000 (15:13 +0800)]
LF-3334-01: media: isi: cap: fix v4l2-compliance G_FMT test fail issue

Fix v4l2-compliance G_FMT test fail issue, error log as bellow:
  test VIDIOC_G_FMT: FAIL
    fail: ../../../v4l-utils-1.18.1/utils/v4l2-compliance/v4l2-test-formats.cpp(343): pixelformat != V4L2_PIX_FMT_JPEG && pixelformat != G
    fail: ../../../v4l-utils-1.18.1/utils/v4l2-compliance/v4l2-test-formats.cpp(464): testColorspace(node->has_inputs || node->has_output)

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3695: media: i2c: ov5640: fix QQVGA mode undefined issue
Guoniu.zhou [Fri, 9 Apr 2021 10:01:00 +0000 (18:01 +0800)]
LF-3695: media: i2c: ov5640: fix QQVGA mode undefined issue

Fix QQVGA mode undefined issue

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
4 years agoLF-3694: media: i2c: ov5640: add QQVGA mode support
Guoniu.zhou [Fri, 9 Apr 2021 08:50:16 +0000 (16:50 +0800)]
LF-3694: media: i2c: ov5640: add QQVGA mode support

Add QQVGA mode support for OV5640

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
4 years agoMLK-25349-3 PCI: imx: clear vreg bypass when pcie vph voltage is 3v3
Richard Zhu [Tue, 23 Mar 2021 00:54:43 +0000 (08:54 +0800)]
MLK-25349-3 PCI: imx: clear vreg bypass when pcie vph voltage is 3v3

Both 1.8v and 3.3v power supplies can be used by i.MX8MQ PCIe PHY.
In default, the PCIE_VPH voltage is suggested to be 1.8v refer to data
sheet. When PCIE_VPH is supplied by 3.3v in the HW schematic design,
the VREG_BYPASS bits of GPR registers should be cleared from default
value 1b'1 to 1b'0. Thus, the internal 3v3 to 1v8 translator would be
turned on.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
(cherry picked from commit 94e84f467b688ce79eb3239f1516f6009b75a19b)

4 years agoMLK-25349-2 arm64: dts: imx8mq-evk: add one regulator used to power up pcie phy
Richard Zhu [Tue, 23 Mar 2021 00:54:27 +0000 (08:54 +0800)]
MLK-25349-2 arm64: dts: imx8mq-evk: add one regulator used to power up pcie phy

Both 1.8v and 3.3v power supplies can be used by i.MX8MQ PCIe PHY.
In default, the PCIE_VPH voltage is suggested to be 1.8v refer to data
sheet. When PCIE_VPH is supplied by 3.3v in the HW schematic design,
the VREG_BYPASS bits of GPR registers should be cleared from default
value 1b'1 to 1b'0. Thus, the internal 3v3 to 1v8 translator would be
turned on.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
(cherry picked from commit d9f9d0c73d3965e6a7b130e2b762a8ff7d4f04a7)

4 years agoMLK-25349-1 dt-bindings: imx6q-pcie: add one regulator used to power up pcie phy
Richard Zhu [Tue, 23 Mar 2021 00:54:18 +0000 (08:54 +0800)]
MLK-25349-1 dt-bindings: imx6q-pcie: add one regulator used to power up pcie phy

Both 1.8v and 3.3v power supplies can be used by i.MX8MQ PCIe PHY.
In default, the PCIE_VPH voltage is suggested to be 1.8v refer to data
sheet. When PCIE_VPH is supplied by 3.3v in the HW schematic design,
the VREG_BYPASS bits of GPR registers should be cleared from default
value 1b'1 to 1b'0. Thus, the internal 3v3 to 1v8 translator would be
turned on.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
(cherry picked from commit c14681471c737280d93d1e5f83221576caf352ee)

4 years agoMLK-25334-2 PCI: imx: export one property to disable l1ss support or not
Richard Zhu [Mon, 8 Mar 2021 05:08:02 +0000 (13:08 +0800)]
MLK-25334-2 PCI: imx: export one property to disable l1ss support or not

Some HW boards might not support the L1.1 ASPM, although the L1.1 ASPM
is supported by the SOC chip.
So, export one property to disable L1.1 ASPM supported or not.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
(cherry picked from commit 4e42c418396d545a48a4eb47a04ce73a27b0415e)

4 years agoMLK-25334-1 dt-bindings: imx6q-pcie: add one property to disable l1ss support or not
Richard Zhu [Tue, 9 Mar 2021 07:13:13 +0000 (15:13 +0800)]
MLK-25334-1 dt-bindings: imx6q-pcie: add one property to disable l1ss support or not

HW board design may not support the L1.1 ASPM, although the L1.1 ASPM
can be supported by the SOC chip.
So, export one property to disable L1.1 ASPM supported or not.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
(cherry picked from commit 7bd2d56b72d33e223305aa2ef9046c0e38f225e6)

4 years agoMLK-25333-3 clk: imx8mq: correct one pcie1 ctrl clock sel
Richard Zhu [Tue, 9 Mar 2021 06:49:32 +0000 (14:49 +0800)]
MLK-25333-3 clk: imx8mq: correct one pcie1 ctrl clock sel

Correct one of the imx8mq_pcie1_ctrl_sels, from "sys2_pll_250m"
to "sys2_pll_333m".

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
(cherry picked from commit 6c34e907db3da694a63dbd44668189f769e686fe)

4 years agoMLK-25333-2 clk: imx8mm: remove the parent setting in clock driver
Richard Zhu [Thu, 8 Apr 2021 08:03:38 +0000 (16:03 +0800)]
MLK-25333-2 clk: imx8mm: remove the parent setting in clock driver

Since the parent clock setting had been done in dts node.
Remove the codes from clock driver.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
4 years agoMLK-25333-1 arm64: dts: specify the clock rate and parent of pcie clocks
Richard Zhu [Thu, 8 Apr 2021 08:02:33 +0000 (16:02 +0800)]
MLK-25333-1 arm64: dts: specify the clock rate and parent of pcie clocks

Specify the clock rate and parent of i.MX8MQ/MM PCIe clocks.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
4 years agoMLK-25283-4 PCI: imx: adjust the l1ss support to proper place
Richard Zhu [Tue, 9 Feb 2021 02:48:33 +0000 (10:48 +0800)]
MLK-25283-4 PCI: imx: adjust the l1ss support to proper place

Add one final quirk to adjust the l1ss support to proper place.
Only enable the L1sub support when both RC and EP supports the L1sub.
In this case, remove the over-ride of the CLKREQ# signal, let HW to
control it automatically.
Since "dis_gpio" GPIO pin is used as M.2 Key-E interface PIN56 for
power control of EP device, adjust active sequence just after the
turn-on of the power domains.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
4 years agoMLK-25283-3 arm64: dts: imx8mp: set clkreq input and add view port property
Richard Zhu [Tue, 9 Feb 2021 02:37:14 +0000 (10:37 +0800)]
MLK-25283-3 arm64: dts: imx8mp: set clkreq input and add view port property

Set the PCIe CLKREQ# as input and add the num-viewport property for
i.MX8MP PCIe RC port.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
4 years agoMLK-25283-2 arm64: dts: imx8mq: fix the l1ss failure
Richard Zhu [Tue, 20 Oct 2020 08:42:33 +0000 (16:42 +0800)]
MLK-25283-2 arm64: dts: imx8mq: fix the l1ss failure

fix the clkreq# is always low issue when L1.1 ASPM is enabled.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
4 years agoMLK-25283-1 dt-binding: imx6q-pcie: add the l1sub for imx8m pcie
Richard Zhu [Tue, 9 Feb 2021 02:34:49 +0000 (10:34 +0800)]
MLK-25283-1 dt-binding: imx6q-pcie: add the l1sub for imx8m pcie

Add one clkreq reset to support the L1sub for i.MX8M PCIe.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
4 years agoMLK-25282-2 clk: imx8mp: remove the pcie phy clock
Richard Zhu [Sun, 7 Feb 2021 03:09:07 +0000 (11:09 +0800)]
MLK-25282-2 clk: imx8mp: remove the pcie phy clock

In the i.MX8MP PCIe design, the PCIe PHY REF clock comes from external
OSC or internal system PLL. It is configured in the IOMUX_GPR14 register
directly, and can't be contolled by CCM at all.
Remove it from clock driver to clean up codes.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jason Liu <jason.hui.liu@nxp.com>
4 years agoMLK-25282-1 arm64: dts: imx8mp: correct the pcie phy clock
Richard Zhu [Sun, 7 Feb 2021 03:07:19 +0000 (11:07 +0800)]
MLK-25282-1 arm64: dts: imx8mp: correct the pcie phy clock

In the i.MX8MP PCIe design, the PCIe PHY REF clock comes from external
OSC or internal system PLL. It is configured in the IOMUX_GPR14 register
directly, and can't be contolled by CCM at all.
So, correct it in the DTS node.

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Jason Liu <jason.hui.liu@nxp.com>
4 years agoMLK-25302: clk: imx8qxp: whitelist M4 lpuart
Shenwei Wang [Tue, 23 Mar 2021 19:51:40 +0000 (14:51 -0500)]
MLK-25302: clk: imx8qxp: whitelist M4 lpuart

Add m4 lpuart0 to the array of imx8qxp_clk_scu_rsrc_table.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
4 years agoLF-3434: arm64: dts: imx8m: add pmu node
Alice Guo [Mon, 22 Feb 2021 10:07:58 +0000 (18:07 +0800)]
LF-3434: arm64: dts: imx8m: add pmu node

Adding pmu node supports to use perf tool to monitor the CPU performance
of the inmate cell when enabling Jailhouse and running dual Linux OS.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
4 years agousb: cdns3: fix static checker warning.
Frank Li [Wed, 10 Mar 2021 16:01:25 +0000 (10:01 -0600)]
usb: cdns3: fix static checker warning.

The patch c450e48eb570: "usb: cdns3: add power lost support for
system resume" from Feb 18, 2021, leads to the following static
checker warning:

        drivers/usb/cdns3/core.c:551 cdns_resume()
        error: uninitialized symbol 'ret'.

drivers/usb/cdns3/core.c
544
545     if (!role_changed) {
546            if (cdns->role == USB_ROLE_HOST)
547                  ret = cdns_drd_host_on(cdns);
548     else if (cdns->role == USB_ROLE_DEVICE)
549            ret = cdns_drd_gadget_on(cdns);

"ret" is uninitialized at else branch.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>
4 years agoLF-3101-2 Revert "MLK-24135 clk: imx: Add a temporary workaround for suspend hang...
Joakim Zhang [Tue, 30 Mar 2021 02:46:24 +0000 (10:46 +0800)]
LF-3101-2 Revert "MLK-24135 clk: imx: Add a temporary workaround for suspend hang casued by the EQOS module"

This reverts commit fbfbe622533ad24c25c9443c97176e87f7934964.

Root cause please see ticket LF-3101-1.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoLF-3101-1 net: stmmac: fix system hang caused by eee_ctrl_timer during suspend/resume
Joakim Zhang [Thu, 1 Apr 2021 10:48:32 +0000 (18:48 +0800)]
LF-3101-1 net: stmmac: fix system hang caused by eee_ctrl_timer during suspend/resume

commit 5f58591323bf ("net: stmmac: delete the eee_ctrl_timer after
napi disabled"), this patch tries to fix system hang caused by eee_ctrl_timer,
unfortunately, it only can resolve it for system reboot stress test. System
hang also can be reproduced easily during system suspend/resume stess test
when mount NFS on i.MX8MP EVK board.

In stmmac driver, eee feature is combined to phylink framework. When do
system suspend, phylink_stop() would queue delayed work, it invokes
stmmac_mac_link_down(), where to deactivate eee_ctrl_timer synchronizly.
In above commit, try to fix issue by deactivating eee_ctrl_timer obviously,
but it is not enough. Looking into eee_ctrl_timer expire callback
stmmac_eee_ctrl_timer(), it could enable hareware eee mode again. What is
unexpected is that LPI interrupt (MAC_Interrupt_Enable.LPIEN bit) is always
asserted. This interrupt has chance to be issued when LPI state entry/exit
from the MAC, and at that time, clock could have been already disabled.
The result is that system hang when driver try to touch register from
interrupt handler.

The reason why above commit can fix system hang issue in stmmac_release()
is that, deactivate eee_ctrl_timer not just after napi disabled, further
after irq freed.

In conclusion, hardware would generate LPI interrupt when clock has been
disabled during suspend or resume, since hareware is in eee mode and LPI
interrupt enabled.

Interrupts from MAC, MTL and DMA level are enabled and never been disabled
when system suspend, so move clocks management from suspend stage to
noirq suspend stage should be more safe.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoSCM-1516 net: phy: realtek: issue soft reset after setting PHYCR2 register
Joakim Zhang [Wed, 31 Mar 2021 07:12:45 +0000 (15:12 +0800)]
SCM-1516 net: phy: realtek: issue soft reset after setting PHYCR2 register

Per RTL8211F guide, a PHY reset should be issued after setting these
bits in PHYCR2 register. After this patch, CLKOUT clock output to be
disabled.

Fixes: 83430a4ffadb ("MLK-24295 net: phy: realtek: add dt property to enable clkout)
Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoLF-3506-3 net: phy: realtek: add workaround to fix RXC issue
Joakim Zhang [Thu, 25 Mar 2021 03:49:28 +0000 (11:49 +0800)]
LF-3506-3 net: phy: realtek: add workaround to fix RXC issue

PHY will delay about 11.5ms to generate RXC clock when switching from
power down to normal operation. Read/write registers would also cause RXC
become unstable and stop for a while during this process. Realtek engineer
suggest 15ms or more delay can workaround this issue. All these
statistics are collected with ALDPS mode disabled, so use RTL821X_ALDPS_DISABLE
quirk.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoLF-3506-2 arm64: dts: imx8mp: disable ALDPS mode for EQOS
Joakim Zhang [Thu, 18 Mar 2021 08:30:42 +0000 (16:30 +0800)]
LF-3506-2 arm64: dts: imx8mp: disable ALDPS mode for EQOS

Disable RTL8211F PHY ALDPS mode to let it generats continuous RXC clock
during auto-negotiation.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoLF-3506-1 net: phy: realteck: add property to disable ALDPS mode
Joakim Zhang [Thu, 18 Mar 2021 08:27:27 +0000 (16:27 +0800)]
LF-3506-1 net: phy: realteck: add property to disable ALDPS mode

If enable Advance Link Down Power Saving (ALDPS) mode, it will change
crystal/clock behavior, which cause RXC clock stop for dozens to hundreds
of miliseconds. For EQOS, it needs RXC clock to support RX logic, after
this patch, PHY can generate continuous RXC clock during auto-negotiation.
This patch adds property to disable ALDPS mode.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoLF-3347(MLK-10199) ARM: dts: imx6qdl: set ENET_REF clock to 125Mhz
Joakim Zhang [Thu, 18 Mar 2021 07:17:19 +0000 (15:17 +0800)]
LF-3347(MLK-10199) ARM: dts: imx6qdl: set ENET_REF clock to 125Mhz

Set ENET_REF clock to 125Mhz for RGMII tx reference clock.

Cherry-picked from the commit(6ee3d49271b1f13e359c1acde189dbb6dc4cb13e),
and refined by Joakim.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
4 years agoMLK-25376: ARM: dts: imx6ull: add uart1 as Mega/Fast mix wakeup source
Sherry Sun [Fri, 26 Mar 2021 09:24:50 +0000 (17:24 +0800)]
MLK-25376: ARM: dts: imx6ull: add uart1 as Mega/Fast mix wakeup source

Add uart1 as Mega/Fast mix wakeup source for i.MX6ull.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
4 years agoLF-3673-2: arm64: dts: imx8mm-evk: Fix the GPIO active level
Shengjiu Wang [Fri, 2 Apr 2021 11:13:50 +0000 (19:13 +0800)]
LF-3673-2: arm64: dts: imx8mm-evk: Fix the GPIO active level

Fix the GPIO active level for ak4497 and ak5558

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
4 years agoLF-3673-1: arm64: dts: imx8mq-evk: Fix the GPIO active level
Shengjiu Wang [Fri, 2 Apr 2021 11:12:32 +0000 (19:12 +0800)]
LF-3673-1: arm64: dts: imx8mq-evk: Fix the GPIO active level

Fix the GPIO active level for ak4497 and ak5558

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
4 years agoarm64: imx8mx: vpu: integrate vsi 20210402 release
Zhou Peng [Fri, 2 Apr 2021 11:08:08 +0000 (19:08 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210402 release

- M865SW-723: VSI V4L2 Engineer release package 20210402
  M865SW-694: [VPU/V4L2] MJPEG decoder: Android cannot playback YUV422 MJPEG streams
  M865SW-697: [VPU/V4L2] encoder: the bitrate of encoding vp8 is not accurate
  M865SW-713: [VPU/V4L2] decoder: return excess 'POLLIN' event in 'DEC_STATUS_SEEK' event
  M865SW-719: [VPU/V4L2] correct name for V4L2_CID_DIS_REORDER
  M865SW-720: [VPU/V4L2] encoder HEVC(h2): gplay cannot playback encoded stream which 'gop=1'
  M865SW-722: [VPU/V4L2] decoder VP9: output timestamp incorrect
  M865SW-605: [VPU/V4L2] decoder: Support secure video decoding
  M865SW-658: [VPU/V4L2] encoder: support resolution change stream transcoding.

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 1ab3f9754a33e4abcf9d8e66931274441cf3dbe1)

4 years agoarm64: imx8mx: vpu: integrate vsi 20210326 release
Zhou Peng [Fri, 26 Mar 2021 12:12:16 +0000 (20:12 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210326 release

- M865SW-716: VSI V4L2 Engineer release package 20210326
  M865SW-523: [VPU/V4L2] decoder: correctly handle stream file that contained codec data only
  M865SW-697: [VPU/V4L2] encoder: the bitrate of encoding vp8 is not accurate
  M865SW-707: [VPU/V4L2] daemon segmentation fault when running multi-instances
  M865SW-708: [VPU/V4L2] decoder: pipeline stall when playback MPEG4 stream with trick mode
  M865SW-710: [VPU/V4L2] daemon: wrong usage of sem_timedwait() in daemon
  M865SW-419: [VPU/V4L2] Pass stress test for resolution change stream
  M865SW-631: [VPU/V4L2] 8MM HEVC decoder: driver stall at streamoff when seek
  M865SW-644: [VPU/V4L2] decoder: can't recover to capture on state if stop cmd comes earlier than capture on cmd
  M865SW-658: [VPU/V4L2] encoder: support resolution change stream transcoding
  M865SW-694: [VPU/V4L2] MJPEG decoder: Android cannot playback YUV422 MJPEG streams
  M865SW-696: [VPU/V4L2] VC8000E: Flush encoder then get V4L2_EVENT_CODEC_ERROR event

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 3486e4074e606180f1b4a4c4639d58109d7a53ca)

4 years agoarm64: imx8mx: vpu: integrate vsi 20210319 release
Zhou Peng [Fri, 19 Mar 2021 12:54:48 +0000 (20:54 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210319 release

- M865SW-705: VSI V4L2 Engineer release package 20210319
  M865SW-644: [VPU/V4L2] decoder: can't recover to capture on state if stop cmd comes earlier than capture on cmd
  M865SW-650: [VPU/V4L2] Calculate h264 level before encoding since ctrl sw will check it
  M865SW-688: [VPU/V4L2] H264CheckCfg return error if refFrameAmount is 0
  M865SW-689: [VPU/V4L2] encoder: GOP doesn't take effect when encoding vp8
  M865SW-697: [VPU/V4L2] encoder: the bitrate of encoding vp8 is not accurate
  M865SW-686: [VPU/V4L2] vp9 decoder:daemon return wrong picture buffer size after res changed
  M865SW-694: [VPU/V4L2] MJPEG decoder: Android cannot playback YUV422 MJPEG streams
  M865SW-696: [VPU/V4L2] VC8000E: Flush encoder then get V4L2_EVENT_CODEC_ERROR event

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 7e9ddfa520c61e004a0f7da821948e6451b5410e)

4 years agoarm64: imx8mx: vpu: integrate vsi v1.5 20210315 release
Zhou Peng [Tue, 16 Mar 2021 02:11:50 +0000 (10:11 +0800)]
arm64: imx8mx: vpu: integrate vsi v1.5 20210315 release

- VSI v1.5 20210315 formal release
  Change List (compare with v1.4.1):
  Enrich kernel log function to haste debug.
  Enrich warning message sent to application.
  Enhance sys API function of v4l2 driver.
  Remove some system dependency in v4l2 daemon code.
  Adjust state maintain in driver to be more conformant to spec.
  Adjust state maintain in daemon to solve issues met in trick mode playback.
  Resolve possible deadlock in driver code.
  Fix a series of VP9 failed tests.
  Fix a series of VP8 failed tests.
  Fix some jpeg decoding issues.
  Full support of DTRC output.
  Full support of 10-bit format.
  Add event for crop change support.

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit b594b76295a36401423eda713a952712cf641e62)

4 years agoarm64: imx8mx: vpu: integrate vsi 20210307 release
Zhou Peng [Sun, 7 Mar 2021 03:35:59 +0000 (11:35 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210307 release

- M865SW-692: VSI V4L2 Engineer release package 20210307
  M865SW-543: [VPU/V4L2] decode: some MJPEG decoded frames have mosaic
  M865SW-597: [VPU/V4L2] Easy to met hang issue when handle errors or exceptions
  M865SW-650: [VPU/V4L2] Calculate h264 level before encoding since ctrl sw will check it
  M865SW-675: [VPU/V4L2] Need to implement different ctrls based on encoder or decoder
  M865SW-677: [VPU/V4L2] DTRC: need to report rfc luma/chroma offset of output buffer to app
  M865SW-685: [VPU/V4L2] decoder: 8MQ: adding new format for DTRC & RFC
  M865SW-419: [VPU/V4L2] Pass stress test for resolution change stream
  M865SW-523: [VPU/V4L2] decoder: correctly handle stream file that contained codec data only
  M865SW-571: [VPU/V4L2] decoder: input has 240 frames, output only get 239 pictures
  M865SW-658: [VPU/V4L2] encoder: support resolution change stream transcoding.
  M865SW-662: [VPU/V4l2] H264EncSetRateCtrl return error if GOP length is larger than 300

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 60928cb11bf1c960783fa8c80cd38fffbd21f761)

4 years agoarm64: imx8mx: vpu: integrate vsi 20210226 release
Zhou Peng [Sun, 28 Feb 2021 03:14:26 +0000 (11:14 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210226 release

- M865SW-681: VSI V4L2 Engineer release package 20210226
  M865SW-595: [VPU/V4L2] report hdr10 metadata to userspace
  M865SW-608: [VPU/V4L2] decoder: enumerate CAPTURE formats according to the currently established coded format
  M865SW-655: [VPU/V4l2] Refine assert reference for Android build
  M865SW-663: [VPU/V4L2] decoder: app can't receive codec error event
  M865SW-668: [VPU/V4L2] daemon: update vsidaemon ts manager to fix Android GTS issue
  M865SW-671: [VPU/V4L2] decoder: seek a resolution changed vp9 stream meet decoding error
  M865SW-676: [VPU/V4L2] decoder: please add new formats into verfiyPlanesize()
  M865SW-678: [VPU/V4L2] decoder: please add 10bit depth into vsiv4l2_decidepixeldepth()
  M865SW-572: [VPU/V4L2] decoder/encoder: one frame stream can't receive EOS
  M865SW-674: [VPU/V4L2] the dtrc and dtrx output is incorrect when decoding 10bit stream

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit ff9ceb52fbeb20cd6f9738bf6bdee95d53e02d23)

4 years agoarm64: imx8mx: vpu: integrate vsi 20210205 release
Zhou Peng [Fri, 5 Feb 2021 12:30:45 +0000 (20:30 +0800)]
arm64: imx8mx: vpu: integrate vsi 20210205 release

- M865SW-664: VSI V4L2 Engineer release package 20210205
  M865SW-511: [VPU/V4L2] decoder: add extr v4l2 event to report 'PIC_CONSUMED' buffer
  M865SW-554: [VPU/V4L2] decoder: decoder return wrong timestamp because of wrong consumed length
  M865SW-595: [VPU/V4L2] report hdr10 metadata to userspace
  M865SW-608: [VPU/V4L2] decoder: enumerate CAPTURE formats according to the currently established coded format
  M865SW-648: [VPU/V4L2] encoder: streamoff failed in VSI_STATUS_INIT state
  M865SW-654: [VPU/V4L2] Extend maximum h265 level to 5_2
  M865SW-655: [VPU/V4l2] Refine assert reference for Android build
  M865SW-659: [VPU/V4L2] Android meet dead waiting in open video device if rootfs does exists vsidaemon
  M865SW-523: [VPU/V4L2] decoder: correctly handle stream file that contained codec data only
  M865SW-572: [VPU/V4L2] decoder/encoder: one frame stream can't receive EOS
  M865SW-644: [VPU/V4L2] decoder: can't recover to capture on state if stop cmd comes earlier than capture on cmd

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit e1d2db5e7dd5acc980ebf8a87e88df71f611d81e)

4 years agoarm64: imx8mx: vpu: integrate vsi v1.4.1 20210129 release
Zhou Peng [Fri, 29 Jan 2021 15:05:53 +0000 (23:05 +0800)]
arm64: imx8mx: vpu: integrate vsi v1.4.1 20210129 release

- VSI v1.4.1 20210129 formal release
  Change List (compare with v1.4):
  Regenerating code to make modules' boundary clearer.
  Adjust license declaration to meet NXP requirement. Passed NPX's license check.
  Remove unused code from project or release.
  Clean up code style to get conformant to kernel spec(driver) or google (daemon).
  Better support of AVS and RV format in unit test.
  Better support of 10-bit decoding.
  Save bandwidth by reducing data transfer number.
  Add extra event for communication between driver and application.
  Resolve some potential sync problem.
  Better support of crop feature in decoding.
  Resolve several CTS cases.
  Re-organize imx-vpu.h in conformance to standard kernel driver API's framework.
  JIRA ticket 503, 523, 528, 546, 554, 557, 589, 597, 608, 626, 627, 628, 633, 640 are resolved in this release

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 88bd34e9d5306cbff6c2e8a316ec81970ec147de)

4 years agoarm64: imx8mx: vpu: add vpu_v4l2 device node
Zhou Peng [Tue, 26 Jan 2021 04:44:33 +0000 (12:44 +0800)]
arm64: imx8mx: vpu: add vpu_v4l2 device node

add vpu_v4l2 device node for 8mm/8mq/8mp

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 26f3196e493ce50ad8e8790ee802b7ec4d23c260)

4 years agoarm64: imx8mx: vpu: enable vsi-v4l2 in android
Zhou Peng [Tue, 26 Jan 2021 02:24:52 +0000 (10:24 +0800)]
arm64: imx8mx: vpu: enable vsi-v4l2 in android

Define variables for daemon and logpath in android

Signed-off-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 1d1b844fd19198c87d98224b70d8ecc1f6238313)

4 years agoarm64: imx8mx: vpu: Add vsi v4l2 driver
Zhou Peng [Mon, 25 Jan 2021 06:50:51 +0000 (14:50 +0800)]
arm64: imx8mx: vpu: Add vsi v4l2 driver

Add vpu v4l2 driver 'drivers/mxc/hantro_v4l2/'
Source are based on VSI 20210121 release

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 57586a84aa42162168696ac4176a08dc44ec8b3b)

4 years agoRevert "net: phy: micrel: set soft_reset callback to genphy_soft_reset for KSZ8081"
Jason Liu [Thu, 1 Apr 2021 06:45:17 +0000 (14:45 +0800)]
Revert "net: phy: micrel: set soft_reset callback to genphy_soft_reset for KSZ8081"

This reverts commit 8545519b1f51b73372c86d754bc9ee83c5d06760.

The patch breaks i.MX6ULL EVK board. Just revert it now.

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
4 years agoMerge tag 'v5.10.27' into lf-5.10.y
Jason Liu [Wed, 31 Mar 2021 09:00:07 +0000 (17:00 +0800)]
Merge tag 'v5.10.27' into lf-5.10.y

This is the 5.10.27 stable release

* tag 'v5.10.27': (2341 commits)
  Linux 5.10.27
  xen-blkback: don't leak persistent grants from xen_blkbk_map()
  can: peak_usb: Revert "can: peak_usb: add forgotten supported devices"
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
 Conflicts:
drivers/net/ethernet/freescale/enetc/enetc_hw.h
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/usb/cdns3/host.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h
sound/soc/codecs/ak4458.c

4 years agoLinux 5.10.27
Greg Kroah-Hartman [Tue, 30 Mar 2021 12:32:09 +0000 (14:32 +0200)]
Linux 5.10.27

Tested-by: Andrei Rabusov <a.rabusov@tum.de>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Jason Self <jason@bluehome.net>
Tested-by: Hulk Robot <hulkrobot@huawei.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20210329101340.196712908@linuxfoundation.org
Link: https://lore.kernel.org/r/20210329075629.172032742@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoxen-blkback: don't leak persistent grants from xen_blkbk_map()
Jan Beulich [Fri, 26 Mar 2021 15:28:57 +0000 (16:28 +0100)]
xen-blkback: don't leak persistent grants from xen_blkbk_map()

commit a846738f8c3788d846ed1f587270d2f2e3d32432 upstream.

The fix for XSA-365 zapped too many of the ->persistent_gnt[] entries.
Ones successfully obtained should not be overwritten, but instead left
for xen_blkbk_unmap_prepare() to pick up and put.

This is XSA-371.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wl@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agocan: peak_usb: Revert "can: peak_usb: add forgotten supported devices"
Marc Kleine-Budde [Sat, 20 Mar 2021 19:21:54 +0000 (20:21 +0100)]
can: peak_usb: Revert "can: peak_usb: add forgotten supported devices"

commit 5d7047ed6b7214fbabc16d8712a822e256b1aa44 upstream.

In commit 6417f03132a6 ("module: remove never implemented
MODULE_SUPPORTED_DEVICE") the MODULE_SUPPORTED_DEVICE macro was
removed from the kerne entirely. Shortly before this patch was applied
mainline the commit 59ec7b89ed3e ("can: peak_usb: add forgotten
supported devices") was added to net/master. As this would result in a
merge conflict, let's revert this patch.

Fixes: 59ec7b89ed3e ("can: peak_usb: add forgotten supported devices")
Link: https://lore.kernel.org/r/20210320192649.341832-1-mkl@pengutronix.de
Suggested-by: Leon Romanovsky <leon@kernel.org>
Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agonvme: fix the nsid value to print in nvme_validate_or_alloc_ns
Christoph Hellwig [Fri, 12 Mar 2021 19:55:36 +0000 (20:55 +0100)]
nvme: fix the nsid value to print in nvme_validate_or_alloc_ns

commit f4f9fc29e56b6fa9d7fa65ec51d3c82aff99c99b upstream.

ns can be NULL at this point, and my move of the check from
the original patch by Chaitanya broke this.

Fixes: 0ec84df4953b ("nvme-core: check ctrl css before setting up zns")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoRevert "net: bonding: fix error return code of bond_neigh_init()"
David S. Miller [Fri, 12 Mar 2021 20:15:03 +0000 (12:15 -0800)]
Revert "net: bonding: fix error return code of bond_neigh_init()"

commit 080bfa1e6d928a5d1f185cc44e5f3c251df06df5 upstream.

This reverts commit 2055a99da8a253a357bdfd359b3338ef3375a26c.

This change rejects legitimate configurations.

A slave doesn't need to exist nor implement ndo_slave_setup.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoRevert "xen: fix p2m size in dom0 for disabled memory hotplug case"
Roger Pau Monne [Wed, 24 Mar 2021 12:24:24 +0000 (13:24 +0100)]
Revert "xen: fix p2m size in dom0 for disabled memory hotplug case"

commit af44a387e743ab7aa39d3fb5e29c0a973cf91bdc upstream.

This partially reverts commit 882213990d32 ("xen: fix p2m size in dom0
for disabled memory hotplug case")

There's no need to special case XEN_UNPOPULATED_ALLOC anymore in order
to correctly size the p2m. The generic memory hotplug option has
already been tied together with the Xen hotplug limit, so enabling
memory hotplug should already trigger a properly sized p2m on Xen PV.

Note that XEN_UNPOPULATED_ALLOC depends on ZONE_DEVICE which pulls in
MEMORY_HOTPLUG.

Leave the check added to __set_phys_to_machine and the adjusted
comment about EXTRA_MEM_RATIO.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/20210324122424.58685-3-roger.pau@citrix.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[boris: fixed formatting issues]
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
4 years agofs/ext4: fix integer overflow in s_log_groups_per_flex
Sabyrzhan Tasbolatov [Wed, 24 Feb 2021 09:58:00 +0000 (15:58 +0600)]
fs/ext4: fix integer overflow in s_log_groups_per_flex

commit f91436d55a279f045987e8b8c1385585dca54be9 upstream.

syzbot found UBSAN: shift-out-of-bounds in ext4_mb_init [1], when
1 << sbi->s_es->s_log_groups_per_flex is bigger than UINT_MAX,
where sbi->s_mb_prefetch is unsigned integer type.

32 is the maximum allowed power of s_log_groups_per_flex. Following if
check will also trigger UBSAN shift-out-of-bound:

if (1 << sbi->s_es->s_log_groups_per_flex >= UINT_MAX) {

So I'm checking it against the raw number, perhaps there is another way
to calculate UINT_MAX max power. Also use min_t as to make sure it's
uint type.

[1] UBSAN: shift-out-of-bounds in fs/ext4/mballoc.c:2713:24
shift exponent 60 is too large for 32-bit type 'int'
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x137/0x1be lib/dump_stack.c:120
 ubsan_epilogue lib/ubsan.c:148 [inline]
 __ubsan_handle_shift_out_of_bounds+0x432/0x4d0 lib/ubsan.c:395
 ext4_mb_init_backend fs/ext4/mballoc.c:2713 [inline]
 ext4_mb_init+0x19bc/0x19f0 fs/ext4/mballoc.c:2898
 ext4_fill_super+0xc2ec/0xfbe0 fs/ext4/super.c:4983

Reported-by: syzbot+a8b4b0c60155e87e9484@syzkaller.appspotmail.com
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210224095800.3350002-1-snovitoll@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoext4: add reclaim checks to xattr code
Jan Kara [Mon, 22 Feb 2021 17:16:26 +0000 (18:16 +0100)]
ext4: add reclaim checks to xattr code

commit 163f0ec1df33cf468509ff38cbcbb5eb0d7fac60 upstream.

Syzbot is reporting that ext4 can enter fs reclaim from kvmalloc() while
the transaction is started like:

  fs_reclaim_acquire+0x117/0x150 mm/page_alloc.c:4340
  might_alloc include/linux/sched/mm.h:193 [inline]
  slab_pre_alloc_hook mm/slab.h:493 [inline]
  slab_alloc_node mm/slub.c:2817 [inline]
  __kmalloc_node+0x5f/0x430 mm/slub.c:4015
  kmalloc_node include/linux/slab.h:575 [inline]
  kvmalloc_node+0x61/0xf0 mm/util.c:587
  kvmalloc include/linux/mm.h:781 [inline]
  ext4_xattr_inode_cache_find fs/ext4/xattr.c:1465 [inline]
  ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1508 [inline]
  ext4_xattr_set_entry+0x1ce6/0x3780 fs/ext4/xattr.c:1649
  ext4_xattr_ibody_set+0x78/0x2b0 fs/ext4/xattr.c:2224
  ext4_xattr_set_handle+0x8f4/0x13e0 fs/ext4/xattr.c:2380
  ext4_xattr_set+0x13a/0x340 fs/ext4/xattr.c:2493

This should be impossible since transaction start sets PF_MEMALLOC_NOFS.
Add some assertions to the code to catch if something isn't working as
expected early.

Link: https://lore.kernel.org/linux-ext4/000000000000563a0205bafb7970@google.com/
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210222171626.21884-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agomac80211: fix double free in ibss_leave
Markus Theil [Sat, 13 Feb 2021 13:36:53 +0000 (14:36 +0100)]
mac80211: fix double free in ibss_leave

commit 3bd801b14e0c5d29eeddc7336558beb3344efaa3 upstream.

Clear beacon ie pointer and ie length after free
in order to prevent double free.

==================================================================
BUG: KASAN: double-free or invalid-free \
in ieee80211_ibss_leave+0x83/0xe0 net/mac80211/ibss.c:1876

CPU: 0 PID: 8472 Comm: syz-executor100 Not tainted 5.11.0-rc6-syzkaller #0
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2c6 mm/kasan/report.c:230
 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:355
 ____kasan_slab_free+0xcc/0xe0 mm/kasan/common.c:341
 kasan_slab_free include/linux/kasan.h:192 [inline]
 __cache_free mm/slab.c:3424 [inline]
 kfree+0xed/0x270 mm/slab.c:3760
 ieee80211_ibss_leave+0x83/0xe0 net/mac80211/ibss.c:1876
 rdev_leave_ibss net/wireless/rdev-ops.h:545 [inline]
 __cfg80211_leave_ibss+0x19a/0x4c0 net/wireless/ibss.c:212
 __cfg80211_leave+0x327/0x430 net/wireless/core.c:1172
 cfg80211_leave net/wireless/core.c:1221 [inline]
 cfg80211_netdev_notifier_call+0x9e8/0x12c0 net/wireless/core.c:1335
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2040
 call_netdevice_notifiers_extack net/core/dev.c:2052 [inline]
 call_netdevice_notifiers net/core/dev.c:2066 [inline]
 __dev_close_many+0xee/0x2e0 net/core/dev.c:1586
 __dev_close net/core/dev.c:1624 [inline]
 __dev_change_flags+0x2cb/0x730 net/core/dev.c:8476
 dev_change_flags+0x8a/0x160 net/core/dev.c:8549
 dev_ifsioc+0x210/0xa70 net/core/dev_ioctl.c:265
 dev_ioctl+0x1b1/0xc40 net/core/dev_ioctl.c:511
 sock_do_ioctl+0x148/0x2d0 net/socket.c:1060
 sock_ioctl+0x477/0x6a0 net/socket.c:1177
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl fs/ioctl.c:739 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Reported-by: syzbot+93976391bf299d425f44@syzkaller.appspotmail.com
Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Link: https://lore.kernel.org/r/20210213133653.367130-1-markus.theil@tu-ilmenau.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agonet: dsa: b53: VLAN filtering is global to all users
Florian Fainelli [Wed, 10 Mar 2021 18:46:10 +0000 (10:46 -0800)]
net: dsa: b53: VLAN filtering is global to all users

commit d45c36bafb94e72fdb6dee437279b61b6d97e706 upstream.

The bcm_sf2 driver uses the b53 driver as a library but does not make
usre of the b53_setup() function, this made it fail to inherit the
vlan_filtering_is_global attribute. Fix this by moving the assignment to
b53_switch_alloc() which is used by bcm_sf2.

Fixes: 7228b23e68f7 ("net: dsa: b53: Let DSA handle mismatched VLAN filtering settings")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agor8169: fix DMA being used after buffer free if WoL is enabled
Heiner Kallweit [Sat, 20 Mar 2021 20:40:08 +0000 (21:40 +0100)]
r8169: fix DMA being used after buffer free if WoL is enabled

commit f658b90977d2e79822a558e48116e059a7e75dec upstream.

IOMMU errors have been reported if WoL is enabled and interface is
brought down. It turned out that the network chip triggers DMA
transfers after the DMA buffers have been freed. For WoL to work we
need to leave rx enabled, therefore simply stop the chip from being
a DMA busmaster.

Fixes: 567ca57faa62 ("r8169: add rtl8169_up")
Tested-by: Paul Blazejowski <paulb@blazebox.homeip.net>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agocan: dev: Move device back to init netns on owning netns delete
Martin Willi [Tue, 2 Mar 2021 12:24:23 +0000 (13:24 +0100)]
can: dev: Move device back to init netns on owning netns delete

commit 3a5ca857079ea022e0b1b17fc154f7ad7dbc150f upstream.

When a non-initial netns is destroyed, the usual policy is to delete
all virtual network interfaces contained, but move physical interfaces
back to the initial netns. This keeps the physical interface visible
on the system.

CAN devices are somewhat special, as they define rtnl_link_ops even
if they are physical devices. If a CAN interface is moved into a
non-initial netns, destroying that netns lets the interface vanish
instead of moving it back to the initial netns. default_device_exit()
skips CAN interfaces due to having rtnl_link_ops set. Reproducer:

  ip netns add foo
  ip link set can0 netns foo
  ip netns delete foo

WARNING: CPU: 1 PID: 84 at net/core/dev.c:11030 ops_exit_list+0x38/0x60
CPU: 1 PID: 84 Comm: kworker/u4:2 Not tainted 5.10.19 #1
Workqueue: netns cleanup_net
[<c010e700>] (unwind_backtrace) from [<c010a1d8>] (show_stack+0x10/0x14)
[<c010a1d8>] (show_stack) from [<c086dc10>] (dump_stack+0x94/0xa8)
[<c086dc10>] (dump_stack) from [<c086b938>] (__warn+0xb8/0x114)
[<c086b938>] (__warn) from [<c086ba10>] (warn_slowpath_fmt+0x7c/0xac)
[<c086ba10>] (warn_slowpath_fmt) from [<c0629f20>] (ops_exit_list+0x38/0x60)
[<c0629f20>] (ops_exit_list) from [<c062a5c4>] (cleanup_net+0x230/0x380)
[<c062a5c4>] (cleanup_net) from [<c0142c20>] (process_one_work+0x1d8/0x438)
[<c0142c20>] (process_one_work) from [<c0142ee4>] (worker_thread+0x64/0x5a8)
[<c0142ee4>] (worker_thread) from [<c0148a98>] (kthread+0x148/0x14c)
[<c0148a98>] (kthread) from [<c0100148>] (ret_from_fork+0x14/0x2c)

To properly restore physical CAN devices to the initial netns on owning
netns exit, introduce a flag on rtnl_link_ops that can be set by drivers.
For CAN devices setting this flag, default_device_exit() considers them
non-virtual, applying the usual namespace move.

The issue was introduced in the commit mentioned below, as at that time
CAN devices did not have a dellink() operation.

Fixes: e008b5fc8dc7 ("net: Simplfy default_device_exit and improve batching.")
Link: https://lore.kernel.org/r/20210302122423.872326-1-martin@strongswan.org
Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoch_ktls: fix enum-conversion warning
Arnd Bergmann [Tue, 23 Mar 2021 21:52:50 +0000 (22:52 +0100)]
ch_ktls: fix enum-conversion warning

commit 6f235a69e59484e382dc31952025b0308efedc17 upstream.

gcc points out an incorrect enum assignment:

drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c: In function 'chcr_ktls_cpl_set_tcb_rpl':
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:684:22: warning: implicit conversion from 'enum <anonymous>' to 'enum ch_ktls_open_state' [-Wenum-conversion]

This appears harmless, and should apparently use 'CH_KTLS_OPEN_SUCCESS'
instead of 'false', with the same value '0'.

Fixes: efca3878a5fb ("ch_ktls: Issue if connection offload fails")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agofs/cachefiles: Remove wait_bit_key layout dependency
Matthew Wilcox (Oracle) [Sat, 20 Mar 2021 05:40:38 +0000 (05:40 +0000)]
fs/cachefiles: Remove wait_bit_key layout dependency

commit 39f985c8f667c80a3d1eb19d31138032fa36b09e upstream.

Cachefiles was relying on wait_page_key and wait_bit_key being the
same layout, which is fragile.  Now that wait_page_key is exposed in
the pagemap.h header, we can remove that fragility

A comment on the need to maintain structure layout equivalence was added by
Linus[1] and that is no longer applicable.

Fixes: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: kafs-testing@auristor.com
cc: linux-cachefs@redhat.com
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20210320054104.1300774-2-willy@infradead.org/
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3510ca20ece0150af6b10c77a74ff1b5c198e3e2
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agomm/memcg: fix 5.10 backport of splitting page memcg
Hugh Dickins [Mon, 29 Mar 2021 00:13:13 +0000 (17:13 -0700)]
mm/memcg: fix 5.10 backport of splitting page memcg

The straight backport of 5.12's e1baddf8475b ("mm/memcg: set memcg when
splitting page") works fine in 5.11, but turned out to be wrong for 5.10:
because that relies on a separate flag, which must also be set for the
memcg to be recognized and uncharged and cleared when freeing. Fix that.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agox86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc()
Isaku Yamahata [Thu, 18 Mar 2021 20:26:57 +0000 (13:26 -0700)]
x86/mem_encrypt: Correct physical address calculation in __set_clr_pte_enc()

commit 8249d17d3194eac064a8ca5bc5ca0abc86feecde upstream.

The pfn variable contains the page frame number as returned by the
pXX_pfn() functions, shifted to the right by PAGE_SHIFT to remove the
page bits. After page protection computations are done to it, it gets
shifted back to the physical address using page_level_shift().

That is wrong, of course, because that function determines the shift
length based on the level of the page in the page table but in all the
cases, it was shifted by PAGE_SHIFT before.

Therefore, shift it back using PAGE_SHIFT to get the correct physical
address.

 [ bp: Rewrite commit message. ]

Fixes: dfaaec9033b8 ("x86: Add support for changing memory encryption attribute in early boot")
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/81abbae1657053eccc535c16151f63cd049dcb97.1616098294.git.isaku.yamahata@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agolocking/mutex: Fix non debug version of mutex_lock_io_nested()
Thomas Gleixner [Mon, 22 Mar 2021 08:46:13 +0000 (09:46 +0100)]
locking/mutex: Fix non debug version of mutex_lock_io_nested()

commit 291da9d4a9eb3a1cb0610b7f4480f5b52b1825e7 upstream.

If CONFIG_DEBUG_LOCK_ALLOC=n then mutex_lock_io_nested() maps to
mutex_lock() which is clearly wrong because mutex_lock() lacks the
io_schedule_prepare()/finish() invocations.

Map it to mutex_lock_io().

Fixes: f21860bac05b ("locking/mutex, sched/wait: Fix the mutex_lock_io_nested() define")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/878s6fshii.fsf@nanos.tec.linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agocifs: Adjust key sizes and key generation routines for AES256 encryption
Shyam Prasad N [Thu, 25 Mar 2021 12:34:54 +0000 (12:34 +0000)]
cifs: Adjust key sizes and key generation routines for AES256 encryption

commit 45a4546c6167a2da348a31ca439d8a8ff773b6ea upstream.

For AES256 encryption (GCM and CCM), we need to adjust the size of a few
fields to 32 bytes instead of 16 to accommodate the larger keys.

Also, the L value supplied to the key generator needs to be changed from
to 256 when these algorithms are used.

Keeping the ioctl struct for dumping keys of the same size for now.
Will send out a different patch for that one.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
CC: <stable@vger.kernel.org> # v5.10+
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agosmb3: fix cached file size problems in duplicate extents (reflink)
Steve French [Fri, 26 Mar 2021 23:41:55 +0000 (18:41 -0500)]
smb3: fix cached file size problems in duplicate extents (reflink)

commit cfc63fc8126a93cbf95379bc4cad79a7b15b6ece upstream.

There were two problems (one of which could cause data corruption)
that were noticed with duplicate extents (ie reflink)
when debugging why various xfstests were being incorrectly skipped
(e.g. generic/138, generic/140, generic/142). First, we were not
updating the file size locally in the cache when extending a
file due to reflink (it would refresh after actimeo expires)
but xfstest was checking the size immediately which was still
0 so caused the test to be skipped.  Second, we were setting
the target file size (which could shrink the file) in all cases
to the end of the reflinked range rather than only setting the
target file size when reflink would extend the file.

CC: <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoscsi: mpt3sas: Fix error return code of mpt3sas_base_attach()
Jia-Ju Bai [Mon, 8 Mar 2021 03:52:41 +0000 (19:52 -0800)]
scsi: mpt3sas: Fix error return code of mpt3sas_base_attach()

[ Upstream commit 3401ecf7fc1b9458a19d42c0e26a228f18ac7dda ]

When kzalloc() returns NULL, no error return code of mpt3sas_base_attach()
is assigned. To fix this bug, r is assigned with -ENOMEM in this case.

Link: https://lore.kernel.org/r/20210308035241.3288-1-baijiaju1990@gmail.com
Fixes: c696f7b83ede ("scsi: mpt3sas: Implement device_remove_in_progress check in IOCTL path")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoscsi: qedi: Fix error return code of qedi_alloc_global_queues()
Jia-Ju Bai [Mon, 8 Mar 2021 03:30:24 +0000 (19:30 -0800)]
scsi: qedi: Fix error return code of qedi_alloc_global_queues()

[ Upstream commit f69953837ca5d98aa983a138dc0b90a411e9c763 ]

When kzalloc() returns NULL to qedi->global_queues[i], no error return code
of qedi_alloc_global_queues() is assigned.  To fix this bug, status is
assigned with -ENOMEM in this case.

Link: https://lore.kernel.org/r/20210308033024.27147-1-baijiaju1990@gmail.com
Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoscsi: Revert "qla2xxx: Make sure that aborted commands are freed"
Bart Van Assche [Sat, 20 Mar 2021 23:23:53 +0000 (16:23 -0700)]
scsi: Revert "qla2xxx: Make sure that aborted commands are freed"

[ Upstream commit 39c0c8553bfb5a3d108aa47f1256076d507605e3 ]

Calling vha->hw->tgt.tgt_ops->free_cmd() from qlt_xmit_response() is wrong
since the command for which a response is sent must remain valid until the
SCSI target core calls .release_cmd(). It has been observed that the
following scenario triggers a kernel crash:

 - qlt_xmit_response() calls qlt_check_reserve_free_req()

 - qlt_check_reserve_free_req() returns -EAGAIN

 - qlt_xmit_response() calls vha->hw->tgt.tgt_ops->free_cmd(cmd)

 - transport_handle_queue_full() tries to retransmit the response

Fix this crash by reverting the patch that introduced it.

Link: https://lore.kernel.org/r/20210320232359.941-2-bvanassche@acm.org
Fixes: 0dcec41acb85 ("scsi: qla2xxx: Make sure that aborted commands are freed")
Cc: Quinn Tran <qutran@marvell.com>
Cc: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoblock: recalculate segment count for multi-segment discards correctly
David Jeffery [Thu, 11 Feb 2021 14:38:07 +0000 (09:38 -0500)]
block: recalculate segment count for multi-segment discards correctly

[ Upstream commit a958937ff166fc60d1c3a721036f6ff41bfa2821 ]

When a stacked block device inserts a request into another block device
using blk_insert_cloned_request, the request's nr_phys_segments field gets
recalculated by a call to blk_recalc_rq_segments in
blk_cloned_rq_check_limits. But blk_recalc_rq_segments does not know how to
handle multi-segment discards. For disk types which can handle
multi-segment discards like nvme, this results in discard requests which
claim a single segment when it should report several, triggering a warning
in nvme and causing nvme to fail the discard from the invalid state.

 WARNING: CPU: 5 PID: 191 at drivers/nvme/host/core.c:700 nvme_setup_discard+0x170/0x1e0 [nvme_core]
 ...
 nvme_setup_cmd+0x217/0x270 [nvme_core]
 nvme_loop_queue_rq+0x51/0x1b0 [nvme_loop]
 __blk_mq_try_issue_directly+0xe7/0x1b0
 blk_mq_request_issue_directly+0x41/0x70
 ? blk_account_io_start+0x40/0x50
 dm_mq_queue_rq+0x200/0x3e0
 blk_mq_dispatch_rq_list+0x10a/0x7d0
 ? __sbitmap_queue_get+0x25/0x90
 ? elv_rb_del+0x1f/0x30
 ? deadline_remove_request+0x55/0xb0
 ? dd_dispatch_request+0x181/0x210
 __blk_mq_do_dispatch_sched+0x144/0x290
 ? bio_attempt_discard_merge+0x134/0x1f0
 __blk_mq_sched_dispatch_requests+0x129/0x180
 blk_mq_sched_dispatch_requests+0x30/0x60
 __blk_mq_run_hw_queue+0x47/0xe0
 __blk_mq_delay_run_hw_queue+0x15b/0x170
 blk_mq_sched_insert_requests+0x68/0xe0
 blk_mq_flush_plug_list+0xf0/0x170
 blk_finish_plug+0x36/0x50
 xlog_cil_committed+0x19f/0x290 [xfs]
 xlog_cil_process_committed+0x57/0x80 [xfs]
 xlog_state_do_callback+0x1e0/0x2a0 [xfs]
 xlog_ioend_work+0x2f/0x80 [xfs]
 process_one_work+0x1b6/0x350
 worker_thread+0x53/0x3e0
 ? process_one_work+0x350/0x350
 kthread+0x11b/0x140
 ? __kthread_bind_mask+0x60/0x60
 ret_from_fork+0x22/0x30

This patch fixes blk_recalc_rq_segments to be aware of devices which can
have multi-segment discards. It calculates the correct discard segment
count by counting the number of bio as each discard bio is considered its
own segment.

Fixes: 1e739730c5b9 ("block: optionally merge discontiguous discard bios into a single request")
Signed-off-by: David Jeffery <djeffery@redhat.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Link: https://lore.kernel.org/r/20210211143807.GA115624@redhat
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoio_uring: fix provide_buffers sign extension
Pavel Begunkov [Fri, 19 Mar 2021 10:21:19 +0000 (10:21 +0000)]
io_uring: fix provide_buffers sign extension

[ Upstream commit d81269fecb8ce16eb07efafc9ff5520b2a31c486 ]

io_provide_buffers_prep()'s "p->len * p->nbufs" to sign extension
problems. Not a huge problem as it's only used for access_ok() and
increases the checked length, but better to keep typing right.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: efe68c1ca8f49 ("io_uring: validate the full range of provided buffers for access")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/562376a39509e260d8532186a06226e56eb1f594.1616149233.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoperf synthetic events: Avoid write of uninitialized memory when generating PERF_RECOR...
Ian Rogers [Tue, 9 Mar 2021 23:49:45 +0000 (15:49 -0800)]
perf synthetic events: Avoid write of uninitialized memory when generating PERF_RECORD_MMAP* records

[ Upstream commit 2a76f6de07906f0bb5f2a13fb02845db1695cc29 ]

Account for alignment bytes in the zero-ing memset.

Fixes: 1a853e36871b533c ("perf record: Allow specifying a pid to record")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20210309234945.419254-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoperf auxtrace: Fix auxtrace queue conflict
Adrian Hunter [Mon, 8 Mar 2021 15:11:43 +0000 (17:11 +0200)]
perf auxtrace: Fix auxtrace queue conflict

[ Upstream commit b410ed2a8572d41c68bd9208555610e4b07d0703 ]

The only requirement of an auxtrace queue is that the buffers are in
time order.  That is achieved by making separate queues for separate
perf buffer or AUX area buffer mmaps.

That generally means a separate queue per cpu for per-cpu contexts, and
a separate queue per thread for per-task contexts.

When buffers are added to a queue, perf checks that the buffer cpu and
thread id (tid) match the queue cpu and thread id.

However, generally, that need not be true, and perf will queue buffers
correctly anyway, so the check is not needed.

In addition, the check gets erroneously hit when using sample mode to
trace multiple threads.

Consequently, fix that case by removing the check.

Fixes: e502789302a6 ("perf auxtrace: Add helpers for queuing AUX area tracing data")
Reported-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20210308151143.18338-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoACPI: scan: Use unique number for instance_no
Andy Shevchenko [Mon, 22 Mar 2021 16:31:00 +0000 (18:31 +0200)]
ACPI: scan: Use unique number for instance_no

[ Upstream commit eb50aaf960e3bedfef79063411ffd670da94b84b ]

The decrementation of acpi_device_bus_id->instance_no
in acpi_device_del() is incorrect, because it may cause
a duplicate instance number to be allocated next time
a device with the same acpi_device_bus_id is added.

Replace above mentioned approach by using IDA framework.

While at it, define the instance range to be [0, 4096).

Fixes: e49bd2dd5a50 ("ACPI: use PNPID:instance_no as bus_id of ACPI device")
Fixes: ca9dc8d42b30 ("ACPI / scan: Fix acpi_bus_id_list bookkeeping")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoACPI: scan: Rearrange memory allocation in acpi_device_add()
Rafael J. Wysocki [Thu, 14 Jan 2021 18:46:47 +0000 (19:46 +0100)]
ACPI: scan: Rearrange memory allocation in acpi_device_add()

[ Upstream commit c1013ff7a5472db637c56bb6237f8343398c03a7 ]

The upfront allocation of new_bus_id is done to avoid allocating
memory under acpi_device_lock, but it doesn't really help,
because (1) it leads to many unnecessary memory allocations for
_ADR devices, (2) kstrdup_const() is run under that lock anyway and
(3) it complicates the code.

Rearrange acpi_device_add() to allocate memory for a new struct
acpi_device_bus_id instance only when necessary, eliminate a redundant
local variable from it and reduce the number of labels in there.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agoRevert "netfilter: x_tables: Update remaining dereference to RCU"
Mark Tomlinson [Mon, 8 Mar 2021 01:24:11 +0000 (14:24 +1300)]
Revert "netfilter: x_tables: Update remaining dereference to RCU"

[ Upstream commit abe7034b9a8d57737e80cc16d60ed3666990bdbf ]

This reverts commit 443d6e86f821a165fae3fc3fc13086d27ac140b1.

This (and the following) patch basically re-implemented the RCU
mechanisms of patch 784544739a25. That patch was replaced because of the
performance problems that it created when replacing tables. Now, we have
the same issue: the call to synchronize_rcu() makes replacing tables
slower by as much as an order of magnitude.

Revert these patches and fix the issue in a different way.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
4 years agomm/mmu_notifiers: ensure range_end() is paired with range_start()
Sean Christopherson [Thu, 25 Mar 2021 04:37:23 +0000 (21:37 -0700)]
mm/mmu_notifiers: ensure range_end() is paired with range_start()

[ Upstream commit c2655835fd8cabdfe7dab737253de3ffb88da126 ]

If one or more notifiers fails .invalidate_range_start(), invoke
.invalidate_range_end() for "all" notifiers.  If there are multiple
notifiers, those that did not fail are expecting _start() and _end() to
be paired, e.g.  KVM's mmu_notifier_count would become imbalanced.
Disallow notifiers that can fail _start() from implementing _end() so
that it's unnecessary to either track which notifiers rejected _start(),
or had already succeeded prior to a failed _start().

Note, the existing behavior of calling _start() on all notifiers even
after a previous notifier failed _start() was an unintented "feature".
Make it canon now that the behavior is depended on for correctness.

As of today, the bug is likely benign:

  1. The only caller of the non-blocking notifier is OOM kill.
  2. The only notifiers that can fail _start() are the i915 and Nouveau
     drivers.
  3. The only notifiers that utilize _end() are the SGI UV GRU driver
     and KVM.
  4. The GRU driver will never coincide with the i195/Nouveau drivers.
  5. An imbalanced kvm->mmu_notifier_count only causes soft lockup in the
     _guest_, and the guest is already doomed due to being an OOM victim.

Fix the bug now to play nice with future usage, e.g.  KVM has a
potential use case for blocking memslot updates in KVM while an
invalidation is in-progress, and failure to unblock would result in said
updates being blocked indefinitely and hanging.

Found by inspection.  Verified by adding a second notifier in KVM that
periodically returns -EAGAIN on non-blockable ranges, triggering OOM,
and observing that KVM exits with an elevated notifier count.

Link: https://lkml.kernel.org/r/20210311180057.1582638-1-seanjc@google.com
Fixes: 93065ac753e4 ("mm, oom: distinguish blockable mode for mmu notifiers")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Suggested-by: Jason Gunthorpe <jgg@ziepe.ca>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Ben Gardon <bgardon@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>