WSL2-Linux-Kernel/drivers/firmware
Cristian Marussi 614cc65032 firmware: arm_scmi: Check mailbox/SMT channel for consistency
commit 437a310b22244d4e0b78665c3042e5d1c0f45306 upstream.

On reception of a completion interrupt the shared memory area is accessed
to retrieve the message header at first and then, if the message sequence
number identifies a transaction which is still pending, the related
payload is fetched too.

When an SCMI command times out the channel ownership remains with the
platform until eventually a late reply is received and, as a consequence,
any further transmission attempt remains pending, waiting for the channel
to be relinquished by the platform.

Once that late reply is received the channel ownership is given back
to the agent and any pending request is then allowed to proceed and
overwrite the SMT area of the just delivered late reply; then the wait
for the reply to the new request starts.

It has been observed that the spurious IRQ related to the late reply can
be wrongly associated with the freshly enqueued request: when that happens
the SCMI stack in-flight lookup procedure is fooled by the fact that the
message header now present in the SMT area is related to the new pending
transaction, even though the real reply has still to arrive.

This race-condition on the A2P channel can be detected by looking at the
channel status bits: a genuine reply from the platform will have set the
channel free bit before triggering the completion IRQ.

Add a consistency check to validate such condition in the A2P ISR.

Reported-by: Xinglong Yang <xinglong.yang@cixtech.com>
Closes: https://lore.kernel.org/all/PUZPR06MB54981E6FA00D82BFDBB864FBF08DA@PUZPR06MB5498.apcprd06.prod.outlook.com/
Fixes: 5c8a47a5a9 ("firmware: arm_scmi: Make scmi core independent of the transport type")
Cc: stable@vger.kernel.org # 5.15+
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Xinglong Yang <xinglong.yang@cixtech.com>
Link: https://lore.kernel.org/r/20231220172112.763539-1-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-23 08:54:32 +01:00
..
arm_ffa firmware: arm_ffa: Assign the missing IDR allocation ID to the FFA device 2023-11-20 11:08:21 +01:00
arm_scmi firmware: arm_scmi: Check mailbox/SMT channel for consistency 2024-02-23 08:54:32 +01:00
broadcom
efi x86/efistub: Fix PCI ROM preservation in mixed mode 2023-09-19 12:22:31 +02:00
google firmware: coreboot: framebuffer: Ignore reserved pixel color bits 2023-03-10 09:39:55 +01:00
imx firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels() 2023-11-08 17:26:37 +01:00
meson firmware: meson_sm: populate platform devices from sm device tree data 2024-01-25 14:52:36 -08:00
psci firmware/psci: fix application of sizeof to pointer 2021-11-18 19:15:53 +01:00
smccc firmware: smccc: Fix check for ARCH_SOC_ID not implemented 2021-12-01 09:04:49 +01:00
tegra firmware: tegra: bpmp: Do only aligned access to IPC memory area 2022-09-05 10:30:03 +02:00
xilinx firmware: xilinx: don't make a sleepable memory allocation from an atomic context 2023-03-22 13:31:32 +01:00
Kconfig ACPI: APEI: explicit init of HEST and GHES in apci_init() 2022-08-17 14:23:11 +02:00
Makefile ARM: SoC drivers for 5.15 2021-09-01 15:25:28 -07:00
arm_scpi.c firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails 2022-08-17 14:24:20 +02:00
arm_sdei.c arm64: sdei: abort running SDEI handlers during crash 2023-09-19 12:22:52 +02:00
dmi-id.c firmware: dmi: Move product_sku info to the end of the modalias 2021-09-02 17:28:53 +02:00
dmi-sysfs.c firmware: dmi-sysfs: Fix null-ptr-deref in dmi_sysfs_register_handle 2023-03-10 09:39:39 +01:00
dmi_scan.c
edd.c
iscsi_ibft.c iscsi_ibft: Fix isa_bus_to_virt not working under ARM 2021-09-02 16:22:00 -04:00
iscsi_ibft_find.c
memmap.c
pcdp.c
pcdp.h
qcom_scm-legacy.c
qcom_scm-smc.c
qcom_scm.c firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit 2023-11-28 16:56:29 +00:00
qcom_scm.h firmware: qcom_scm: Introduce SCM calls to access LMh 2021-08-18 09:31:53 +02:00
qemu_fw_cfg.c firmware: qemu_fw_cfg: fix kobject leak in probe error path 2022-01-20 09:13:15 +01:00
raspberrypi.c firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe() 2022-12-31 13:14:29 +01:00
scpi_pm_domain.c firmware: arm_scpi: Fix string overflow in SCPI genpd driver 2021-12-22 09:32:35 +01:00
stratix10-rsu.c
stratix10-svc.c firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe 2023-09-06 21:28:39 +01:00
sysfb.c efi: sysfb_efi: Fix DMI quirks not working for simpledrm 2023-03-30 12:47:55 +02:00
sysfb_simplefb.c efi: sysfb_efi: Fix DMI quirks not working for simpledrm 2023-03-30 12:47:55 +02:00
ti_sci.c firmware: ti_sci: Fix an off-by-one in ti_sci_debugfs_create() 2024-01-25 14:52:36 -08:00
ti_sci.h
trusted_foundations.c
turris-mox-rwtm.c