Commit Graph

1080740 Commits

Author SHA1 Message Date
XiaoDong Huang
0f39cdefa8 ARM: rockchip: rv1106: sleep: decrease pmu-fsm time
Change-Id: I57e88bb222ce26c7bf4736244e958e13b91ae184
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2023-09-27 17:14:24 +08:00
XiaoDong Huang
b1c3fa9777 ARM: rockchip: rv1106: sleep: fix flow for HPMCU_FAST_WAKEUP
1. Don't config PMU_WAKEUP_TIMEOUT_CNT.
2. Do hpmcu_fast_wkup if gpio0 wakeup.

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: Ib8ea97809e43d31e1f84212df72225d51f503f11
2023-09-27 17:14:24 +08:00
Chaoyi Chen
b87a32fd67 arm64: dts: rockchip: add rk3568 evb1 dual lvds devicetree
Add support for dual lvds with hdmi output

Change-Id: I8b6e294e6e96b2c65c27da346868a4f051d24ab2
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
2023-09-27 17:13:44 +08:00
Sugar Zhang
0c2c6c9430 drm/bridge: synopsys: Fix wrong FIFO reset on AUD_CONF0
Should use update_bits instead of write directly which
will override the other configs on AUD_CONF0.

Fixes: 19820cc653 ("drm/bridge: synopsys: Recover sound for XRUN routine")

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Ie64cdce700a30f1b4a64fc9d437d34bd0496aa30
2023-09-27 17:13:08 +08:00
Huang Chaoqun
dcec32c361 power: supply: test-power: modify battery_voltage
healthd will voltage_now/1000 cause batteryVoltageMillivolts too small
which cause BatteryStatsHistory.setBitField() error

Signed-off-by: Huang Chaoqun <chaoqun.huang@rock-chips.com>
Change-Id: I8da022a2b7461ac62f0cdcb34a2488a333967523
2023-09-27 14:16:34 +08:00
Shawn Lin
629252c396 mmc: dw_mmc: Don't reset controller when powering up vqmmc in thunderboot
It will lead the device pull down Data0 sometimes, which makes the insmod
process very long based on different eMMCs. The biggest will be 4s.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: I2dbf76f62c9cbaa31db101ed91765ecb7eaf6633
2023-09-26 19:39:48 +08:00
Finley Xiao
1e5bbbbd53 soc: rockchip: rockchip_system_monitor: Make mem volt greater than vdd volt
The vdd is the power supply of pvtpll, if mem volt less than vdd volt,
there will not be enough voltage margin.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I15b57904c20b74d16ac8113f3e49e3410bcf02af
2023-09-26 19:39:27 +08:00
Jianwei Fan
08d68a6729 arm64: dts: rockchip: rk3588-evb1: add rk3588 evb1 rk628 hdmi2csi config
Change-Id: Id4be886b25a9097b24a1b225db208eb4b727bbff
Signed-off-by: Jianwei Fan <jianwei.fan@rock-chips.com>
2023-09-26 18:54:28 +08:00
Jianwei Fan
c9885c773d media: i2c: rk628_csi: update the driver to v0.0.8
1.fix mipi timing bug when hsfreq is 1250Mbps
2.add continue mode config from dts

Change-Id: I62b6d8effe43b1915bbdf55eb377ce6f0d004b14
Signed-off-by: Jianwei Fan <jianwei.fan@rock-chips.com>
2023-09-26 18:54:14 +08:00
Lin Jianhua
09746a7b2c arm64: dts: rockchip: add rk3308 evb v13
Change-Id: I6f5ab31218236d6243e046270ba05bb7c5a48038
Signed-off-by: Lin Jianhua <linjh@rock-chips.com>
2023-09-26 18:46:18 +08:00
Lin Jianhua
d4a3eab170 arm64: dts: rockchip: fixup check warning about is31fl3236 addr in rk3308 evb
Change-Id: I67c50a48f22d8495528f52a353007e4efab7fa95
Signed-off-by: Lin Jianhua <linjh@rock-chips.com>
2023-09-26 18:39:33 +08:00
Lin Jianhua
58239c7ec1 ARM: dts: rockchip: rk3308 boards: add uart rts pinctrl for bt
Change-Id: I67ab4b33e5a31223c33fe224a928b9cbdeff936a
Signed-off-by: Lin Jianhua <linjh@rock-chips.com>
2023-09-26 18:38:36 +08:00
Lin Jianhua
cc36289ad4 arm64: dts: rockchip: rk3308-evb: add uart rts pinctrl for bt
Change-Id: I07e0f5aa459139b91c45be244a2c0df3d0340e10
Signed-off-by: Lin Jianhua <linjh@rock-chips.com>
2023-09-26 18:37:22 +08:00
William Wu
ed67590b8a arm64: dts: rockchip: rk3588: Add aclk_usb for ehci and ohci controllers
Test on RK3588 EVB1 with dwc3_of_simple_driver_init in
initcall_blacklist like this:

bootargs = "earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 irqchip.gicv3_pseudo_nmi=0 initcall_blacklist=dwc3_of_simple_driver_init";

Kernel halt in ehci_bus_resume when read the intr_enable
register of the ehci controller. It's because that the
ehci controllers depend on the aclk_usb which only be
managed by DWC3 controller driver right now.

The clock dependency when access ehci/ohci controller registers:
CPU -> hclk_vo1usbtop -> aclk_usb -> hclk_usb -> ehci/ohci

This patch adds the aclk_usb for all ehci and ohci controllers.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I66a622d7156d52451273423c4d6ca2cd965fe55a
2023-09-26 10:41:49 +08:00
Elaine Zhang
ec3fad65f8 arm64: dts: rockchip: rk3588s: Add aclk_usb3otg for usb pd
add aclk_usb3otg0\1 to resolve noc clock dependency.
hclk_host0 ----> hclk_usb |--->hclk_usb_root
                          |---->hclk_vo1usbtop

aclk_usb3otg0 ----> aclk_usb |--->aclk_usb_root
                             |---->aclk_vo1usbtop

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Change-Id: Iee97338d1960f0333fe6c79819f1872ece07ec04
2023-09-26 09:04:51 +08:00
Huibin Hong
df04f5eab5 arm64: rockchip_defconfig: set MINIDUMP_MAX_ENTRIES 512
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: If1e5d6e5c295c3f6581182c1fd36f306bfcf2045
2023-09-25 20:16:54 +08:00
Huibin Hong
fac207b672 arm64: traps: save cpu regs to minidump when cpus die
If two cpu die at the same time, the first cpu get die_lock,
calls minidump die notify and saves regs, then panics.
But the second cpu would hardlock because it can't get the die_lock.
And nothing is saved to minidump, so we have the patch.

Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: I38cda3a6cee160ba1293a2e18c7238c96cf2e755
2023-09-25 20:16:43 +08:00
Huibin Hong
6925da1c98 watchdog/hardlockup: move hardlock_notifier before panic
And update the cpu regs when it is soft lock.

Fixes: d851edc401 ("watchdog/hardlockup: add hardlock_notifier_list")
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: Id695ee4e7a80bfde2c15891f19e98af092f74a01
2023-09-25 20:08:25 +08:00
Huibin Hong
5a65668788 soc: rockchip: minidump: pass minidump_table to uboot
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: I67c7a0cd3817a145003afbad1b5d6d4275738ea1
2023-09-25 20:04:16 +08:00
Tao Huang
cd26d5970c drm/panel: simple: Replace msleep() with usleep_range()
On rk3588-evb1-lp4-v10:
Before:
[  266.604393][ T1971] PM: suspend exit
[  266.792421][  T410] dw-mipi-dsi2 fde20000.dsi: [drm:dw_mipi_dsi2_encoder_atomic_enable] final DSI-Link bandwidth: 880000 x 4 Kbps
total: 0.188028

After:
[  153.394800][ T1972] PM: suspend exit
[  153.559644][  T409] dw-mipi-dsi2 fde20000.dsi: [drm:dw_mipi_dsi2_encoder_atomic_enable] final DSI-Link bandwidth: 880000 x 4 Kbps
total: 0.164844, save about 0.023s

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Ifa5c73732478ee253fd81b7e4fd545a4d4b35ba8
2023-09-25 19:56:16 +08:00
Tao Huang
f12d67042f Input: gt1x - Enable async suspend/resume on fb blank
On rk3588-evb1-lp4-v10:
Before:
[  101.214271][ T1989] PM: suspend exit
[  101.772978][  T412] dw-mipi-dsi2 fde20000.dsi: [drm:dw_mipi_dsi2_encoder_atomic_enable] final DSI-Link bandwidth: 880000 x 4 Kbps
total: 0.558707

After:
[  266.604393][ T1971] PM: suspend exit
[  266.792421][  T410] dw-mipi-dsi2 fde20000.dsi: [drm:dw_mipi_dsi2_encoder_atomic_enable] final DSI-Link bandwidth: 880000 x 4 Kbps
total: 0.188028, save about 0.37s.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I7310b11e2897c79ce8b0c61d8b98760a4f8699f3
2023-09-25 19:56:16 +08:00
Longjian Lin
b457b68a97 net: rfkill-bt: match irq_wake to irq.
Signed-off-by: Longjian Lin <llj@rock-chips.com>
Change-Id: I5965b5d12bf3fa8bb13c9346fb8ee609800abdf6
Signed-off-by: Zou Dengming <marsow.zou@rock-chips.com>
2023-09-25 19:55:34 +08:00
Weiwen Chen
b44e92aeac ARM: dts: rockchip: add rv1106g-evb2-v12-nofastae-spi-nand.dts
Signed-off-by: Weiwen Chen <cww@rock-chips.com>
Change-Id: Ia120e2dd041ca61efb904336f31ce34073a5a012
2023-09-25 19:47:02 +08:00
Huibin Hong
c78736852c fiq_debugger: fix spurious triggering of fiq
Before this patch, when input rk_fiq_debugger in commdline,
which would trigger fiq debugger mode.

Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: Id4360c1b41ab65b7edd82f676a82b27c7ec7c3b5
2023-09-25 18:01:22 +08:00
XiaoDong Huang
d0632dae5c ARM: rockchip: rv1106: pm: fix error when WAKEUP_TO_SYSTEM_RESET
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: I5136c90c75001d473543365f6aa31a532b84506f
2023-09-25 17:42:09 +08:00
XiaoDong Huang
93574e5e31 ARM: rockchip: rv1106: sleep: enable fst_glb_rst trigger pmu reset
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: I7bcd7dd2904435a6fc0faec6c3d3d3bc963207b4
2023-09-25 17:42:09 +08:00
XiaoDong Huang
110fd8f6d9 soc: rockchip: pm_config: support config wakeup irqs for virtual poweroff
Our platform supports wake-up by pwm and gpio0 by default
when virtual poweroff. If there are other wake source requirements,
we can configure property "rockchip,virtual-poweroff-irqs = <xx xx xx...>;"

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: Ied9ddb0a222479268f68aecceac8b950b9743444
2023-09-25 11:25:57 +08:00
XiaoDong Huang
c2ce041510 soc: rockchip: pm_config: do pm_wakeup_clear when virtual poweroff
pm_wakeup_pending will return 1 after system wakeup, witch makes
the failure of disable_secondary_cpus when virtual poweroff.
So we need to do pm_wakeup_clear before disable_secondary_cpus.

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: I96722898d22cd2c2ad8229e44b9ecbfa9024a2e4
2023-09-25 11:25:57 +08:00
Sugar Zhang
2e8f56f6a5 pinctrl: rockchip: rk3328: Add I2Sx-SCLK as iomux-route switch
Considering the MCLK is not a MUST for codec, but the SCLK is.
So, let's add SCLK as iomux-route switch.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I7010268ee4d2ee43670bb7fc118f4a39ab24a666
2023-09-23 09:05:47 +08:00
Sugar Zhang
11f85a1a0f pinctrl: rockchip: rk3568: Add I2Sx-SCLK as iomux-route switch
Considering the MCLK is not a MUST for codec, but the SCLK is.
So, let's add SCLK as iomux-route switch.

Still keep the MCLK as iomux-route switch to allow the pin can
be used individually.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Iab96f63ab93a5429c6b76dc1b0cb3c9d5e43d2e4
2023-09-23 09:05:46 +08:00
XiaoTan Luo
78f7fcfc45 pinctrl: rockchip: rv1126: Add I2Sx-SCLK as iomux-route switch
Considering the MCLK is not a MUST for codec, but the SCLK is.
So, let's add SCLK as iomux-route switch.

Still keep the MCLK as iomux-route switch to allow the pin can
be used individually.

Change-Id: I855cd399ada956434a820db06ca586de986caa11
Signed-off-by: XiaoTan Luo <lxt@rock-chips.com>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2023-09-23 09:05:45 +08:00
Sugar Zhang
19820cc653 drm/bridge: synopsys: Recover sound for XRUN routine
This patch add audio reset in prepare stage to clean audio FIFO
to recover sound from XRUN state.

Change-Id: I3808be7973306cc6f8d377f5eb5a0bcec844ab16
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2023-09-23 09:05:44 +08:00
Sugar Zhang
352863bfa2 ASoC: rockchip: pdm: Add support for PATHx controls
This patch add support PATHx controls which allow user
can select PATHx dynamically.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Ie7d286ed60363734bc25bf3127daab0d8fcc7144
2023-09-23 09:05:43 +08:00
Sugar Zhang
5c77c0737d ASoC: rockchip: pdm: Use add_component_controls
This patch use add_component_controls instead of dai's one
to support multiple instance with name_prefix.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I5e4872991eb1115ef0f56aba0635cde817fd31b8
2023-09-23 09:05:42 +08:00
Sugar Zhang
caf846fe5d ASoC: rockchip: i2s: Add property 'bclk-fs'
This patch bring back property 'rockchip,bclk-fs' to allow
user to set it from DT, though we can set it from machine
driver or by 'BCLK_Ratio' control.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Id50833a8899782ac4aac34e146a424b9f6da590d
2023-09-23 09:05:41 +08:00
Sugar Zhang
b0bc0c46c3 ASoC: rockchip: i2s: Add "BCLK_Ratio" kcontrol
This patch allow user to set bclk-ratio by kcontrols.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I6ddf153bc5fd7558e3ba5d4138739a477d9facc6
2023-09-22 16:47:51 +08:00
Sugar Zhang
1f85aed306 ASoC: rockchip: i2s: Add support for PCM R/W Wait Time
ALSA core blocks userspace for 10 seconds for PCM R/W default.

Consider the situation BT-slave which acts as SLAVE mode, when
BT-master offline sometime, the CLK lost, user have to wait the
core timeout(10s), it's quite bad experience.

This patch allows userspace to override the WAIT_TIME to recover
more quickly from terminal audio stream. especially for stream
which have no mechanism to detect the LINK offline.

Usage:

/# amixer -c 0 contents | grep Wait
numid=43,iface=PCM,name='PCM Read Wait Time MS'
numid=44,iface=PCM,name='PCM Write Wait Time MS'

/# amixer -c 0 cset numid=43 500
numid=43,iface=PCM,name='PCM Read Wait Time MS'
  ; type=INTEGER,access=rw------,values=1,min=0,max=10000,step=1
  : values=500

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I36c03859d3d91552dc4247864fe6697624245b6c
2023-09-22 16:47:50 +08:00
Sugar Zhang
54475d9b1a ASoC: rockchip: i2s: Add support for CLK-ALWAYS-ON quirks
This patch add support for keeping BCLK / FSYNC always on.
it's required by some devices, such as HDMI, PA, etc.

For example: on HDMI situation

There are some TVs require maintaining N/CTS packets or AUDS
packets to keep audio logic active, otherwise, the first tone
may be lost.

In order to optimize the user experience, we need to ensure
continuous transmission of N/CTS and AUDS packets from the
HDMI-TX, so that the SINK TV devices can maintain audio logic
activation, promptly process audio data, and achieve the
completeness of the first tone.

We init a 48k I2S-STANDARD clock timing as default.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Icdf2101c4117bc0ec4c05343e7317477cc02d6c0
2023-09-22 16:47:48 +08:00
Sugar Zhang
a2d0c7f12f ASoC: rockchip: i2s: Use add_component_controls
This patch use add_component_controls instead of dai's one
to support multiple instance with name_prefix.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Ideb9af565f8b44dffaa32f88fed412c5781bcaed
2023-09-22 16:47:47 +08:00
Sugar Zhang
2e41a8e117 ASoC: rockchip: i2s-tdm: Add support for PCM R/W Wait Time
ALSA core blocks userspace for 10 seconds for PCM R/W default.

Consider the situation BT-slave which acts as SLAVE mode, when
BT-master offline sometime, the CLK lost, user have to wait the
core timeout(10s), it's quite bad experience.

This patch allows userspace to override the WAIT_TIME to recover
more quickly from terminal audio stream. especially for stream
which have no mechanism to detect the LINK offline.

Usage:

/# amixer -c 0 contents | grep Wait
numid=43,iface=PCM,name='PCM Read Wait Time MS'
numid=44,iface=PCM,name='PCM Write Wait Time MS'

/# amixer -c 0 cset numid=43 500
numid=43,iface=PCM,name='PCM Read Wait Time MS'
  ; type=INTEGER,access=rw------,values=1,min=0,max=10000,step=1
  : values=500

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I53a35344238557813ea3683dd19474819e987d19
2023-09-22 16:47:46 +08:00
Sugar Zhang
9f997ad95e ASoC: rockchip: i2s-tdm: Add support for PATHx controls
This patch add support PATHx controls which allow user
can select PATHx dynamically.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I9c3af821f9080ec2a07ed846ad059f68c82ec74f
2023-09-22 16:47:09 +08:00
Sugar Zhang
f7cdb2cfca ASoC: rockchip: i2s-tdm: Use add_component_controls
This patch use add_component_controls instead of dai's one
to support multiple instance with name_prefix.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I5aed3ba8e071544154f39b92c1180bbda0afe767
2023-09-22 16:44:07 +08:00
Sugar Zhang
562725ba70 ASoC: rockchip: multi-dais: Fix component's name_prefix
name_prefix should be assigned before dai probe to support
add_component_controls in probe routine.

Fixes: e92cb0063f ("ASoC: rockchip: multi-dais: Add support controls for sub dais")

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I056ad90c877be16467f25c7cbd90d682b223b58a
2023-09-22 16:44:06 +08:00
Sugar Zhang
7664a3c45f ASoC: rockchip: sai: Fix Transmit SDOx Select
To keep the same order with TRM.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: Idadd729223381522b347997ffc3ab2d120087cc6
2023-09-22 16:44:05 +08:00
Sugar Zhang
7cbc3d9057 ASoC: rockchip: sai: Reduce FIFO XRUN warning prompt
Warning once each time FIFO XRUN occurs, and then disable
it, until the next time the stream resume.

Before:
  rockchip_sai_isr: 222 callbacks suppressed
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  rockchip-sai ff800000.sai: TX FIFO Underrun
  ...

  cat /proc/interrupts | grep sai
  30:      512 0 0 0 0 0 0 0 GICv2 110 Level  sai

After:

  rockchip-sai ff800000.sai: TX FIFO Underrun

  cat /proc/interrupts | grep sai
  30:        1 0 0 0 0 0 0 0 GICv2 110 Level  sai

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I0d3aa37a36ae8e44ccec97053076ef5d74dff9cc
2023-09-21 22:16:23 +08:00
Wangqiang Guo
b795e7c67f media: rockchip: hdmirx: avoid PKTDEC_AVIIF_CHG_IRQ mistrigger.
HDMIRX enable PKTDEC_AVIIF_CHG_IRQ to detect whether
color_range/color_space/color_fmt change or not,
but other aviif changes also cause the interrupt to trigger.

Change-Id: I7add2a6b519ad97e74ad3ba64dd8961e46a32584
Signed-off-by: Wangqiang Guo <kay.guo@rock-chips.com>
2023-09-21 19:19:16 +08:00
Yandong Lin
f421f8a977 video: rockchip: mpp: rkvenc2: fix slice mode poll failed
the return value 0 of the func wait_event_interruptible() means success.

Fixes: eecc48ce7b ("video: rockchip: mpp: disable usr poll timeout")
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I849625aecb6713d0f4f8652f69ae9335d56d8b65
2023-09-21 18:08:39 +08:00
Wu Liangqing
44e562e446 arm64: dts: rockchip: px30: Add reboot_mode label for Android
Change-Id: I93d73ed9ee84eaa690b844deaa392241e42f094f
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
2023-09-21 07:44:16 +00:00
Weiwen Chen
b61b2776d4 ARM: dts: rockchip: add rv1106g-evb1-v11-nofastae-spi-nand
Signed-off-by: Weiwen Chen <cww@rock-chips.com>
Change-Id: Iacddf213a6415e927f4a70cbf761b706f45f1a05
2023-09-20 15:26:54 +08:00
Shawn Lin
da03114d74 PCI: rockchip: dw: Use handle_level_irq for legacy irq
We get a report that a wireless ethernet device which uses legacy interrupt, exposes a
buggy behaviour when patching RT support. It can be observed on RK3588 EVB1 with NVMe under
RT environment when adding pci=nomsi to cmdline. The backtrace looks like below:

echo 3 > /proc/sys/vm/drop_caches && dd if=/dev/nvme0n1 of=/dev/null bs=1M count=50000

[   10.826850] irq 155: nobody cared (try booting with the "irqpoll" option)
[   10.826862] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.160-rt89 #505
[   10.826867] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[   10.826870] Call trace:
[   10.826871]  dump_backtrace+0x0/0x1e0
[   10.826881]  show_stack+0x18/0x24
[   10.826886]  dump_stack_lvl+0xcc/0xf8
[   10.826891]  dump_stack+0x18/0x54
[   10.826895]  __report_bad_irq+0x4c/0xdc
[   10.826899]  note_interrupt+0x2cc/0x380
[   10.826905]  handle_irq_event+0x10c/0x180
[   10.826909]  handle_simple_irq+0xac/0x120
[   10.826913]  generic_handle_irq+0x30/0x50
[   10.826917]  rk_pcie_legacy_int_handler+0xa8/0x160
[   10.826923]  __handle_domain_irq+0xb8/0x140
[   10.826927]  gic_handle_irq+0xd8/0x2e4
[   10.826932]  el1_irq+0xcc/0x180
[   10.826935]  arch_cpu_idle+0x18/0x3c
[   10.826940]  default_idle_call+0x2c/0x9c
[   10.826944]  do_idle+0x21c/0x2a0
[   10.826949]  cpu_startup_entry+0x24/0x70
[   10.826952]  rest_init+0xd0/0xe0
[   10.826956]  arch_call_rest_init+0x10/0x1c
[   10.826960]  start_kernel+0x50c/0x544
[   10.826963] handlers:
[   10.826965] [<0000000015317c1f>] irq_default_primary_handler threaded [<00000000edb1561e>] pcie_pme_irq
[   10.826977] [<0000000015317c1f>] irq_default_primary_handler threaded [<000000000065643b>] nvme_irq
[   10.826988] [<0000000015317c1f>] irq_default_primary_handler threaded [<000000000065643b>] nvme_irq
[   10.826996] Disabling IRQ #155

And NVMe can't work anymore due to the irq problem. The actual problem looks like:

nvme_irq                                    nvme_irq
 //process the previous request
   -> nvme_process_cq(nvmeq)		    // the previous one is still processing
                                            -> if(nvme_process_cq(nvmeq))
   -> return IRQ_HANDLED                    -> return IRQ_NONE

so a spurious irq was counted and if the irq ack time is short enough to increase the spurious
irq exceeding the limitation, report_bad_irq was triggered. This is why the bug was only observed
under RT environment since the irq was distributed more quickly than ever, but the bug was always there.

root@linaro-alip:/# cat /proc/irq/155/spurious
count 8990
unhandled 24339
last_unhandled 189829 ms

This can be fixed by the drivers as we could see many patches regarding "irq xxx: nobody cared",
and it's the case if we don't allow nvme_irq to nest itself or postpone the handler. However the
legacy interrupt support is also buggy. For legacy interrupt, it's a level irq rather than an edge
one. But it happened to work because Rockchip PCIe RC only generates oneshot irq instead of level,
preventing the irq storm from happening. So changing to use handle_level_irq is correct and should
help mask/unmask the irq when dealing with it in between. That's a decent solution for all.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: Ie9499b3dbd19ac053500b4c726294296be537ffd
2023-09-20 15:18:52 +08:00