summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_scmi
AgeCommit message (Collapse)Author
8 daysConvert 'alloc_obj' family to use the new default GFP_KERNEL argumentLinus Torvalds
This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8 daystreewide: Replace kmalloc with kmalloc_obj for non-scalar typesKees Cook
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
2026-01-21Merge tag 'imx-drivers-6.20' of ↵Arnd Bergmann
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into soc/drivers i.MX drivers changes for 6.20: - A few changes from Peng Fan adding dump syslog support for i.MX System Manager firmware driver, cleaning up soc-imx9 driver, fixing error handling for soc-imx8m driver * tag 'imx-drivers-6.20' of https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: soc: imx8m: Fix error handling for clk_prepare_enable() soc: imx: Spport i.MX9[4,52] soc: imx: Use dev_err_probe() for i.MX9 soc: imx: Use device-managed APIs for i.MX9 firmware: imx: sm-misc: Dump syslog info firmware: arm_scmi: imx: Support getting syslog of MISC protocol Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2026-01-21Merge tag 'tee-bus-callback-for-6.20' of ↵Arnd Bergmann
git://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee into soc/drivers TEE bus callback for 6.20 - Move from generic device_driver to TEE bus-specific callbacks - Add module_tee_client_driver() and registration helpers to reduce boilerplate - Convert several client drivers (TPM, KEYS, firmware, EFI, hwrng, and RTC) - Update documentation and fix kernel-doc warnings * tag 'tee-bus-callback-for-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/jenswi/linux-tee: tpm/tpm_ftpm_tee: Fix kdoc after function renames tpm/tpm_ftpm_tee: Make use of tee bus methods tpm/tpm_ftpm_tee: Make use of tee specific driver registration KEYS: trusted: Make use of tee bus methods KEYS: trusted: Migrate to use tee specific driver registration function firmware: tee_bnxt: Make use of tee bus methods firmware: tee_bnxt: Make use of module_tee_client_driver() firmware: arm_scmi: Make use of tee bus methods firmware: arm_scmi: optee: Make use of module_tee_client_driver() efi: stmm: Make use of tee bus methods efi: stmm: Make use of module_tee_client_driver() hwrng: optee - Make use of tee bus methods hwrng: optee - Make use of module_tee_client_driver() rtc: optee: Make use of tee bus methods rtc: optee: Migrate to use tee specific driver registration function tee: Adapt documentation to cover recent additions tee: Add probe, remove and shutdown bus callbacks to tee_client_driver tee: Add some helpers to reduce boilerplate for tee client drivers Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2026-01-17firmware: arm_scmi: imx: Support getting syslog of MISC protocolPeng Fan
MISC protocol supports getting system log regarding system sleep latency, wakeup interrupt and etc. Add the API for user to retrieve the information from SM. Signed-off-by: Peng Fan <peng.fan@nxp.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2026-01-07firmware: arm_scmi: Make use of tee bus methodsUwe Kleine-König
The tee bus got dedicated callbacks for probe and remove. Make use of these. This fixes a runtime warning about the driver needing to be converted to the bus methods. Note that the return value of .remove() was already ignored before, so there is no problem introduced by dropping the error returns. Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2026-01-07firmware: arm_scmi: optee: Make use of module_tee_client_driver()Uwe Kleine-König
Reduce boilerplate by using the newly introduced module_tee_client_driver(). That takes care of assigning the driver's bus, so the explicit assigning in this driver can be dropped. Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2025-12-27firmware: arm_scmi: Remove legacy protocol versioning logicCristian Marussi
Protocol version negotiation logic is centralized in the SCMI core stack so that most of the legacy per-protocol versioning logic is redundant and can be removed. Remove protocol-specific versioning code and refactor all the protocols to use the new simplified centralized logic. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251227164132.1311988-3-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-12-27firmware: arm_scmi: Rework protocol version negotiation logicCristian Marussi
Protocol version negotiation can be used by an agent to request the server to downgrade the version effectively utilized by a specific protocol during the current session, if the latest version used by the server is newer than the latest version known to the client. In order for the negotiation process to be fully effective at preventing any possible version incompatibility, it must happen early on, well before the specific protocol initialization phase takes place. Delegate protocol version querying to the core SCMI stack and rework the protocol negotiation logic in order to execute the needed negotiation exchanges upfront, right before the initialization phase takes place. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251227164132.1311988-2-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-12-16firmware: arm_scmi: Increase performance MAX_OPPS limit to 64Vivek Aknurwar
Some platforms expose more than 32 operating performance points (OPPs) per performance domain via the SCMI performance protocol, but the driver currently limits the number of OPPs it can handle to 32 via MAX_OPPS. Bump MAX_OPPS to 64 so that these platforms can register all their performance levels. This is an internal limit in the driver only and does not affect the SCMI protocol ABI. 64 is chosen as the next power of two above the existing limit. Signed-off-by: Vivek Aknurwar <vivek.aknurwar@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Alexey Klimov <alexey.klimov@linaro.org> Message-Id: <20251014073454.461999-1-vivek.aknurwar@oss.qualcomm.com> (sudeep.holla: Updated commit log to reflect driver limitation rather than spec) Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-12-16firmware: arm_scmi: Move boiler plate code into the get info functionsDan Carpenter
This code to check whether the selector is valid and if the item has already been recorded in the array can be moved to the scmi_pinctrl_get_function_info() type functions. That way it's in one place instead of duplicated in each of the callers. Remove the check for if "pi->nr_groups == 0" because if that were the case then "selector >= pi->nr_groups" would already be true. It already was not checked for the pin case so this makes things a bit more uniform. Also remove the check for if (!pin) since pin is an offset into the middle of an array and can't be NULL. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <287b5302f583e3535d50617ec3b0856e38253171.1761576798.git.dan.carpenter@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-12-16firmware: arm_scmi: Refactor reset domain handlingArtem Shimko
Introduce scmi_reset_domain_lookup() to centralize domain ID validation and unify error reporting behaviour across the SCMI reset protocol. All reset domain operations are updated to use the new helper, removing duplicated validation logic and ensuring consistent handling of invalid domain IDs and lookup failures. This simplifies the internal flow and improves robustness of the reset protocol implementation. Suggested-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com> Message-Id: <20251123163557.230530-1-a.shimko.dev@gmail.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-12-15firmware: arm_scmi: Fix uninitialized pointers with __free attrAlly Heev
Uninitialized pointers with `__free` attribute can cause undefined behaviour as the memory assigned(randomly) to the pointer is freed automatically when the pointer goes out of scope arm doesn't have any bugs related to this as of now, but it is better to initialize and assign pointers with `__free` attr in one statement to ensure proper scope-based cleanup Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/ Signed-off-by: Ally Heev <allyheev@gmail.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251105-aheev-uninitialized-free-attr-arm-v1-1-f7b6cb5d3361@gmail.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-10-15firmware: arm_scmi: Fix premature SCMI_XFER_FLAG_IS_RAW clearing in raw modeArtem Shimko
The SCMI_XFER_FLAG_IS_RAW flag was being cleared prematurely in scmi_xfer_raw_put() before the transfer completion was properly acknowledged by the raw message handlers. Move the clearing of SCMI_XFER_FLAG_IS_RAW and SCMI_XFER_FLAG_CHAN_SET from scmi_xfer_raw_put() to __scmi_xfer_put() to ensure the flags remain set throughout the entire raw message processing pipeline until the transfer is returned to the free pool. Fixes: 3095a3e25d8f ("firmware: arm_scmi: Add xfer helpers to provide raw access") Suggested-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251008091057.1969260-1-a.shimko.dev@gmail.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-10-15firmware: arm_scmi: Skip RAW initialization on failureCristian Marussi
Avoid attempting to initialize RAW mode when the debug subsystem itself has failed to initialize, since doing so is pointless and emits misleading error messages. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251014115346.2391418-3-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-10-15include: trace: Fix inflight count helper on failed initializationCristian Marussi
Add a check to the scmi_inflight_count() helper to handle the case when the SCMI debug subsystem fails to initialize. Fixes: f8e656382b4a ("include: trace: Add tracepoint support for inflight xfer count") Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251014115346.2391418-2-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-10-15firmware: arm_scmi: Account for failed debug initializationCristian Marussi
When the SCMI debug subsystem fails to initialize, the related debug root will be missing, and the underlying descriptor will be NULL. Handle this fault condition in the SCMI debug helpers that maintain metrics counters. Fixes: 0b3d48c4726e ("firmware: arm_scmi: Track basic SCMI communication debug metrics") Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20251014115346.2391418-1-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-09-12firmware: arm_scmi: Simplify printks with pOF formatKrzysztof Kozlowski
Print full device node name with %pOF format, so the code will be a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Message-Id: <20250912092423.162497-2-krzysztof.kozlowski@linaro.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-09-09firmware: arm_scmi: imx: Discover MISC board info from the system managerPeng Fan
The i.MX SCMI MISC protocol can report board information from the System Manager (SM), including a board name and board-specific attributes. Query this during protocol initialization. If the firmware does not implement BOARD_INFO, handle -EOPNOTSUPP gracefully and continue. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250904-sm-misc-api-v1-v4-4-0bf10eaabdf1@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-09-08firmware: arm_scmi: imx: Support retrieving MISC protocol configuration infoPeng Fan
The MISC protocol can provide System Manager (SM) configuration information, including platform identifiers and board-specific attributes. Add support to retrieve this information during protocol initialization. If the firmware does not implement the CFG_INFO command, handle -EOPNOTSUPP gracefully and continue without failing init. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250904-sm-misc-api-v1-v4-3-0bf10eaabdf1@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-09-08firmware: arm_scmi: imx: Discover MISC build info from the system managerPeng Fan
MISC protocol can report System Manager (SM) build information (commit, build date/time, etc.). Discover those information at the init time. If the firmware doesn't support it, ignore -EOPNOTSUPP. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250904-sm-misc-api-v1-v4-2-0bf10eaabdf1@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-09-08firmware: arm_scmi: imx: Add documentation for MISC_BOARD_INFOPeng Fan
System Manager Firmware supports getting board information, add documentation for this MISC_BOARD_INFO command. Also extends the SYSLOG response to include NOT_SUPPORTED. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250904-sm-misc-api-v1-v4-1-0bf10eaabdf1@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-09-02firmware: arm_scmi: quirk: Prevent writes to string constantsJohan Hovold
The quirk version range is typically a string constant and must not be modified (e.g. as it may be stored in read-only memory). Attempting to do so can trigger faults such as: | Unable to handle kernel write to read-only memory at virtual | address ffffc036d998a947 Update the range parsing so that it operates on a copy of the version range string, and mark all the quirk strings as const to reduce the risk of introducing similar future issues. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220437 Fixes: 487c407d57d6 ("firmware: arm_scmi: Add common framework to handle firmware quirks") Cc: stable@vger.kernel.org # 6.16 Cc: Cristian Marussi <cristian.marussi@arm.com> Reported-by: Jan Palus <jpalus@fastmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> Message-Id: <20250829132152.28218-1-johan@kernel.org> [sudeep.holla: minor commit message rewording; switch to cleanup helpers] Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-08-21firmware: arm_scmi: Mark VirtIO ready before registering scmi_virtio_driverJunnan Wu
After commit 20bda12a0ea0 (“firmware: arm_scmi: Make VirtIO transport a standalone driver”), the VirtIO transport probes independently. During scmi_virtio_probe, scmi_probe() is called, which intune invokes scmi_protocol_acquire() that sends a message over the virtqueue and waits for a reply. Previously, DRIVER_OK was only set after scmi_vio_probe, in the core virtio via virtio_dev_probe(). According to the Virtio spec (3.1 Device Initialization): | The driver MUST NOT send any buffer available notifications to the | device before setting DRIVER_OK. Some type-1 hypervisors block available-buffer notifications until the driver is marked OK. In such cases, scmi_vio_probe stalls in scmi_wait_for_reply(), and the probe never completes. Resolve this by setting DRIVER_OK immediately after the device-specific setup, so scmi_probe() can safely send notifications. Note after splitting the transports into modules, the probe sequence changed a bit. We can no longer rely on virtio_device_ready() being called by the core in virtio_dev_probe(), because scmi_vio_probe() doesn’t complete until the core SCMI stack runs scmi_probe(), which immediately issues the initial BASE protocol exchanges. Fixes: 20bda12a0ea0 ("firmware: arm_scmi: Make VirtIO transport a standalone driver") Signed-off-by: Junnan Wu <junnan01.wu@samsung.com> Message-Id: <20250812075343.3201365-1-junnan01.wu@samsung.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-08-21firmware: arm_scmi: Constify struct scmi_transport_opsChristophe JAILLET
Mark struct scmi_transport_ops as const since this driver never modifies it. Constifying moves it to read-only memory, improving hardening - especially important for structures with function pointers. x86_64 (allmodconfig) size diff: Before: text data bss dec hex filename 6907 680 48 7635 1dd3 drivers/firmware/arm_scmi/transports/optee.o After: text data bss dec hex filename 6987 576 48 7611 1dbb drivers/firmware/arm_scmi/transports/optee.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Message-Id: <881be6ad61037ed95d5e750a2565fd9840120a08.1753816459.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-08-21firmware: arm_scmi: Constify struct scmi_voltage_proto_opsChristophe JAILLET
Constify struct scmi_voltage_proto_ops since the driver never modifies it. Placing it in read-only memory (.rodata) improves hardening, particularly because it contains function pointers. x86_64 (allmodconfig) size impact: Before: text data bss dec hex filename 13142 1808 0 14950 3a66 drivers/firmware/arm_scmi/voltage.o After: text data bss dec hex filename 13238 1712 0 14950 3a66 drivers/firmware/arm_scmi/voltage.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Message-Id: <2091660c072dd2d5599897243a5d69e89d46ed4d.1753816459.git.christophe.jaillet@wanadoo.fr> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-09firmware: arm_scmi: Convert to SYSTEM_SLEEP_PM_OPSArnd Bergmann
The old SET_SYSTEM_SLEEP_PM_OPS() macro leads to a warning about an unused function: | drivers/firmware/arm_scmi/scmi_power_control.c:363:12: error: | 'scmi_system_power_resume' defined but not used [-Werror=unused-function] | static int scmi_system_power_resume(struct device *dev) The proper way to do this these days is to use SYSTEM_SLEEP_PM_OPS() and pm_sleep_ptr(). Fixes: 9a0658d3991e ("firmware: arm_scmi: power_control: Ensure SCMI_SYSPOWER_IDLE is set early during resume") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250709070107.1388512-1-arnd@kernel.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-08firmware: arm_scmi: Avoid notifier registration for unsupported eventsCristian Marussi
Some platforms may be configured to not support notification events from certain sources. This scenario is already handled gracefully by avoiding any attempt to send a notification enable request for those sources, as such requests would inevitably fail. However, in a more extreme case, a platform might not support even a single source for a given event type. In this situation, allowing notifier registration is meaningless. Attempting to register a notifier would serve no purpose and only result in unnecessary overhead. To address this, we now detect such conditions during the protocol initialization. When identified, we flag the unsupported event types and reject any subsequent notifier registration attempts for them with -ENOTSUPP. This early rejection avoids redundant processing and simplifies runtime logic. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20250707144220.485365-1-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-07firmware: arm_scmi: power_control: Ensure SCMI_SYSPOWER_IDLE is set early ↵Peng Fan
during resume Fix a race condition where a second suspend notification from another SCMI agent wakes the system before SCMI_SYSPOWER_IDLE is set, leading to ignored suspend requests. This is due to interrupts triggering early execution of `scmi_userspace_notifier()` before the SCMI state is updated. To resolve this, set SCMI_SYSPOWER_IDLE earlier in the device resume path, prior to `thaw_processes()`. This ensures the SCMI state is correct when the notifier runs, allowing the system to suspend again as expected. On some platforms using SCMI, SCP cannot distinguish between CPU idle and suspend since both result in cluster power-off. By explicitly setting the idle state early, the Linux SCMI agent can correctly re-suspend in response to external notifications. Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250704-scmi-pm-v2-2-9316cec2f9cc@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-07firmware: arm_scmi: Add power management operations to SCMI busPeng Fan
Introduce suspend and resume power management callbacks for `scmi_bus_type`, modeled after `platform_pm_ops`. This enables SCMI devices on the bus to implement their own suspend and resume behavior, allowing for more fine-grained power control at the device level. Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250704-scmi-pm-v2-1-9316cec2f9cc@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-03include: trace: Add tracepoint support for inflight xfer countPhilip Radford
Enhance the existing SCMI transfer tracepoints by including the current in-flight transfer count in `scmi_xfer_begin` and `scmi_xfer_end`. Introduce a new helper `scmi_inflight_count()` to retrieve the active transfer count from the SCMI debug counters when debug is enabled. This trace data is useful for visualizing transfer activity over time and identifying congestion or unexpected behavior in SCMI messaging. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Philip Radford <philip.radford@arm.com> Message-Id: <20250630105544.531723-4-philip.radford@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-03firmware: arm_scmi: Track number of inflight SCMI transfersPhilip Radford
Add a new debug counter, `XFERS_INFLIGHT`, to track the number of currently active in-flight SCMI message transfers. This helps in understanding system behavior and diagnosing potential issues with pending or stuck messages. The counter is incremented when a transfer is registered as in-flight, and decremented when it completes and is released. It is automatically added to debugfs for visibility through SCMI debugfs. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Philip Radford <philip.radford@arm.com> Message-Id: <20250630105544.531723-3-philip.radford@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-07-03firmware: arm_scmi: Add support for debug counter decrementPhilip Radford
Introduce a new `scmi_dec_count` helper to complement the existing `scmi_inc_count`, allowing controlled decrement of SCMI debug counters. This provides symmetry in debug counter management and enables accurate tracking of counters that may both increase and decrease, such as those used for in-flight message tracking. Only active when CONFIG_ARM_SCMI_DEBUG_COUNTERS is enabled. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Philip Radford <philip.radford@arm.com> Message-Id: <20250630105544.531723-2-philip.radford@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-06-23firmware: arm_scmi: Fix up turbo frequencies selectionSibi Sankar
Sustained frequency when greater than or equal to 4Ghz on 64-bit devices currently result in marking all frequencies as turbo. Address the turbo frequency selection bug by fixing the truncation. Fixes: a897575e79d7 ("firmware: arm_scmi: Add support for marking certain frequencies as turbo") Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> Message-Id: <20250514214719.203607-1-quic_sibis@quicinc.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-05-31Merge tag 'soc-drivers-6.16' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc Pull SoC driver updates from Arnd Bergmann: "Updates are across the usual driver subsystems with SoC specific drivers: - added soc specicific drivers for sophgo cv1800 and sg2044, qualcomm sm8750, and amlogic c3 and s4 chips. - cache controller updates for sifive chips, plus binding changes for other cache descriptions. - memory controller drivers for mediatek mt6893, stm32 and cleanups for a few more drivers - reset controller drivers for T-Head TH1502, Sophgo sg2044 and Renesas RZ/V2H(P) - SCMI firmware updates to better deal with buggy firmware, plus better support for Qualcomm X1E and NXP i.MX specific interfaces - a new platform driver for the crypto firmware on Cznic Turris Omnia/MOX - cleanups for the TEE firmware subsystem and amdtee driver - minor updates and fixes for freescale/nxp, qualcomm, google, aspeed, wondermedia, ti, nxp, renesas, hisilicon, mediatek, broadcom and samsung SoCs" * tag 'soc-drivers-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (133 commits) soc: aspeed: Add NULL check in aspeed_lpc_enable_snoop() soc: aspeed: lpc: Fix impossible judgment condition ARM: aspeed: Don't select SRAM docs: firmware: qcom_scm: Fix kernel-doc warning soc: fsl: qe: Consolidate chained IRQ handler install/remove firmware: qcom: scm: Allow QSEECOM for HP EliteBook Ultra G1q dt-bindings: mfd: qcom,tcsr: Add compatible for ipq5018 dt-bindings: cache: add QiLai compatible to ax45mp memory: stm32_omm: Fix error handling in stm32_omm_disable_child() dt-bindings: cache: Convert marvell,tauros2-cache to DT schema dt-bindings: cache: Convert marvell,{feroceon,kirkwood}-cache to DT schema soc: samsung: exynos-pmu: enable CPU hotplug support for gs101 MAINTAINERS: Add google,gs101-pmu-intr-gen.yaml binding file dt-bindings: soc: samsung: exynos-pmu: gs101: add google,pmu-intr-gen phandle dt-bindings: soc: google: Add gs101-pmu-intr-gen binding documentation bus: fsl-mc: Use strscpy() instead of strscpy_pad() soc: fsl: qbman: Remove const from portal->cgrs allocation type bus: fsl_mc: Fix driver_managed_dma check bus: fsl-mc: increase MC_CMD_COMPLETION_TIMEOUT_MS value bus: fsl-mc: drop useless cleanup ...
2025-05-06firmware: arm_scmi: quirk: Force perf level get fastchannelJohan Hovold
The Qualcomm SCP firmware in X1E machines like the Lenovo ThinkPad T14s does not set the FastChannel supported attribute bit for PERF_LEVEL_GET but crashes when falling back to regular messaging. Use the new SCMI quirk framework to force FastChannel initialisation for this implementation. Note that we can add an upper bound on the version matching when we learn which version has a fix (or limit matching using a SoC compatible string in the unlikely event that always enabling FC causes trouble somewhere). Link: https://lore.kernel.org/lkml/Z4Dt8E7C6upVtEGV@hovoldconsulting.com/ Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Message-Id: <20250430135146.5154-1-johan+linaro@kernel.org> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-05-06firmware: arm_scmi: quirk: Fix CLOCK_DESCRIBE_RATES tripletCristian Marussi
Convert an existing quirk in CLOCK_DESCRIBE_RATES parsing to the new quirk framework. This is a sort of a peculiar quirk since it matches any platform and any firmware. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20250429141108.406045-4-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-05-06firmware: arm_scmi: Add common framework to handle firmware quirksCristian Marussi
Add a common framework to describe SCMI quirks and associate them with a specific platform or a specific set of SCMI firmware versions. All the matching SCMI quirks will be enabled when the SCMI core stack probes and after all the needed SCMI firmware versioning information was retrieved using the base protocol. Tested-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20250429141108.406045-3-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-05-06firmware: arm_scmi: Ensure that the message-id supports fastchannelSibi Sankar
Currently the perf and powercap protocol relies on the protocol domain attributes, which just ensures that one fastchannel per domain, before instantiating fastchannels for all possible message-ids. Fix this by ensuring that each message-id supports fastchannel before initialization. Logs: | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:0] - ret:-95. Using regular messaging | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:1] - ret:-95. Using regular messaging | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:2] - ret:-95. Using regular messaging CC: stable@vger.kernel.org Reported-by: Johan Hovold <johan+linaro@kernel.org> Closes: https://lore.kernel.org/lkml/ZoQjAWse2YxwyRJv@hovoldconsulting.com/ Fixes: 6f9ea4dabd2d ("firmware: arm_scmi: Generalize the fast channel support") Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Tested-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com> [Cristian: Modified the condition checked to establish support or not] Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20250429141108.406045-2-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: imx: Add i.MX95 SCMI CPU driverPeng Fan
The i.MX95 System manager exports SCMI CPU protocol for linux to manage cpu cores. The driver is to use the cpu Protocol interface to start, stop a cpu cores (eg, M7). Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250408-imx-lmm-cpu-v4-6-4c5f4a456e49@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: imx: Add i.MX95 SCMI LMM driverPeng Fan
The i.MX95 System manager exports SCMI LMM protocol for linux to manage Logical Machines. The driver is to use the LMM Protocol interface to boot, shutdown a LM. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250408-imx-lmm-cpu-v4-5-4c5f4a456e49@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: imx: Add i.MX95 CPU ProtocolPeng Fan
This protocol allows an agent to start, stop a CPU or set reset vector. It is used to manage auxiliary CPUs in an LM (e.g. additional cores in an AP cluster). Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250408-imx-lmm-cpu-v4-4-4c5f4a456e49@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: imx: Add i.MX95 LMM protocolPeng Fan
Add Logical Machine Management(LMM) protocol which is intended for boot, shutdown, and reset of other logical machines (LM). It is usually used to allow one LM to manager another used as an offload or accelerator engine. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250408-imx-lmm-cpu-v4-3-4c5f4a456e49@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: imx: Add LMM and CPU documentationPeng Fan
Add i.MX95 Logical Machine Management and CPU Protocol documentation. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250408-imx-lmm-cpu-v4-1-4c5f4a456e49@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: Add polling support to raw modeCristian Marussi
Provide a couple of additional debugfs entries to enable polling-mode on the waiting path of injected messages: message_poll will cause the system to poll while waiting for the reply, while message_poll_async will send an asynchronous message, as usual, and will use polling mode for the immediate synchronous part of the async command. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20250310180811.1463539-1-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: Exclude transport devices from bus matchingSudeep Holla
Transport devices are currently being unintentionally matched to drivers with the same name, allowing their probe function to be invoked. However, the bus notifier prevents them from setting up handles, rendering them unable to utilize SCMI core functionality. Instead of relying on the bus notifier which can't prevent bus matching even if it returns early or error, move the check into the bus matching logic itself. This change ensures that transport devices are entirely excluded from driver matching, preventing any unintended probe attempts. Message-Id: <20250317-b4-scmi_minor_cleanup-v2-5-f4be99bd9864@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: Assign correct parent to arm-scmi platform deviceSudeep Holla
With the decoupling of transport drivers from the SCMI core, the "arm-scmi" platform device is now created dynamically from the probed transport driver. Currently, this "arm-scmi" platform device is added to the root of the platform bus since no parent is assigned. However, the transport platform device, created from the "firmware:scmi" node in the device tree, should be considered its parent. Ensure that the parent device is correctly set for the "arm-scmi" platform device, aligning it with the correct transport hierarchy. This will be more useful on systems with multiple transport and/or SCMI firmware instances as the hierarchy is maintained correctly. Message-Id: <20250317-b4-scmi_minor_cleanup-v2-4-f4be99bd9864@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: Refactor error logging from SCMI device creation to ↵Sudeep Holla
single helper Refactors the error logging related to SCMI device creation. The goal is to remove duplicated error-handling code and centralize it into a single helper function: _scmi_device_create(). By doing so, any code redundancy around error logging is avoided, as error logging during device creation will now be handled by a unified helper function. Message-Id: <20250317-b4-scmi_minor_cleanup-v2-3-f4be99bd9864@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: Refactor device matching logic to eliminate duplicationSudeep Holla
Currently, the device matching logic is duplicated in two functions: - scmi_dev_match() used by the scmi_bus to match scmi_devices with scmi_drivers. - scmi_child_dev_find() used to check for the presence of a device with the same name and protocol_id to avoid adding duplicates to the bus. Refactor the code to eliminate the redundant matching logic and consolidates the functionality for better maintainability and efficiency. Message-Id: <20250317-b4-scmi_minor_cleanup-v2-2-f4be99bd9864@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-04-14firmware: arm_scmi: Ensure scmi_devices are always matched by name as wellSudeep Holla
Currently, devices without a name in the id_table cannot register drivers, and no scmi_device is created without a name via scmi_device_create(). However, the function __scmi_device_create() allows devices with no name, which are then labeled as "unknown." Removes support for matching scmi_device instances without a name, ensuring consistency across the driver registration and probing process. Message-Id: <20250317-b4-scmi_minor_cleanup-v2-1-f4be99bd9864@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>