summaryrefslogtreecommitdiff
path: root/drivers/firmware/qcom
AgeCommit message (Collapse)Author
13 hoursMerge branch 'for-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git # Conflicts: # include/linux/mod_devicetable.h
2 daysMerge branch 'soc/drivers' into for-nextArnd Bergmann
* soc/drivers: (133 commits) arm64: enable HAVE_SHARED_GPIOS for all ARM64 platforms bus: arm-cci: Drop cci-control-port node reference in __cci_ace_get_port() bus: arm-cci: Drop CPU node reference in cci_ace_init_ports() soc: fsl: dpio: Free the IRQ before releasing the I/O object soc: fsl: dpio: Fix cleanup on IRQ registration failure bus: fsl-mc: Annotate fsl_mc_io.portal_virt_addr with __counted_by_ptr bus: fsl-mc: drop the fwnode links of the dpmacs nodes soc: fsl: cpm1: tsa: Fix clock leak in tsa_of_parse_tdms() soc: qcom: geni-se: Drop unused icc_ddr parameter from geni_icc_get() firmware: qcom: scm: Allow QSEECOM on ThinkPad T14s Gen 7 dt-bindings: mailbox: qcom: Document Maili CPUCP mailbox controller dt-bindings: spmi: glymur-spmi-pmic-arb: Add compatible for Qualcomm Maili SoC soc: qcom: pmic_pdcharger_ulog: prevent work requeue during remove ASoC: dt-bindings: qcom,apr: Add modem_apps GLINK channel for shikra firmware: qcom: tzmem: disable SHM bridge for SM7125 platform soc: qcom: ubwc: Add Kalambo UBWC config firmware: qcom: scm: Allow QSEECOM on Kalambo CRD firmware: qcom: scm: Allow QSEECOM on the Glymur QCB soc: qcom: stats: Add stats compatible and config for Shikra dt-bindings: soc: qcom: stats: Add compatible for Shikra ...
2 daysMerge tag 'qcom-drivers-for-7.4-3' of ↵Arnd Bergmann
https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers More Qualcomm driver updates for v7.4 Add SM8950 Maili and SM8975 Hawi SoC IDs. Document the Maili CPUCP mailbox and PMIC arbiter compatibles. Allow QSEECOM on the Kalambo CRD, Glymur QCB, and Lenovo ThinkPad T14s Gen 7. Reuse Glymur's UBWC configuration for Kalambo, and add the Nord LLCC configuration and binding. Add Shikra SoC and subsystem low-power statistics. Document its modem_apps GLINK audio channel. Document MSM8952 SCM and record that MSM8952 has no UBWC. Describe IPQ5424 IMEM as mmio-sram and add the MSM8960 SPS interrupt-controller syscon compatible. Fix SCM PAS resource-table retries and handling of empty tables. Use sleepable one-time initialization for TZMEM, and correct SCM Kconfig selection for non-Qualcomm builds. Disable the SHM bridge on SM7125 to avoid boot-time RCU stalls. Fix PMIC GLINK probe ordering and PD charger ULOG removal races. Provide I2C Hub serial-engine program-RAM depth without accessing absent DMA registers. * tag 'qcom-drivers-for-7.4-3' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: (31 commits) soc: qcom: geni-se: Drop unused icc_ddr parameter from geni_icc_get() firmware: qcom: scm: Allow QSEECOM on ThinkPad T14s Gen 7 dt-bindings: mailbox: qcom: Document Maili CPUCP mailbox controller dt-bindings: spmi: glymur-spmi-pmic-arb: Add compatible for Qualcomm Maili SoC soc: qcom: pmic_pdcharger_ulog: prevent work requeue during remove ASoC: dt-bindings: qcom,apr: Add modem_apps GLINK channel for shikra firmware: qcom: tzmem: disable SHM bridge for SM7125 platform soc: qcom: ubwc: Add Kalambo UBWC config firmware: qcom: scm: Allow QSEECOM on Kalambo CRD firmware: qcom: scm: Allow QSEECOM on the Glymur QCB soc: qcom: stats: Add stats compatible and config for Shikra dt-bindings: soc: qcom: stats: Add compatible for Shikra soc: qcom: fix typo "upto" in comment firmware: qcom: fix typo "uninterruptable" in comment soc: qcom: socinfo: Add SM8950 SoC ID dt-bindings: arm: qcom,ids: Add SoC ID for SM8950 soc: qcom: geni-se: provide PROG_RAM_DEPTH for I2C HUB Serial Engines dt-bindings: mfd: syscon: add qcom,msm8960-sps-sic firmware: qcom: scm: Hide QCOM_SCM instead of depending on ARCH_QCOM soc: qcom: llcc: Add LLCC configuration for Nord ... Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 daysMerge tag 'qcom-drivers-for-7.4-2' of ↵Arnd Bergmann
https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into soc/drivers Qualcomm driver updates for v7.4 (second attempt) Add UBWC 7.0 configuration for Hawi and Maili, and reuse Glymur's UBWC configuration for Nord. Parse Glymur's DDR information from SMEM, including its frequency plan and highest bank bit. Correct DDR frequency overflow and byte order, and handle unrecognized DDR layouts correctly. Configure dedicated LLCC slices for the IPQ5424 PPE and Wi-Fi datapaths, adjust the CPU slice, and propagate errors from optional IRQ lookup. Allow the GENI serial-engine driver to be selected on 32-bit Qualcomm SoCs such as Kuno. Fix firmware loading bounds, endianness, and writes to read-only firmware. Allow QSEECOM on the Glymur-based HP EliteBook X G2q 14 AI, Lenovo Yoga Slim 7x Gen11, and Asus Zenbook A14 (UX3407NA), enabling EFI variable access on the HP and Asus laptops. Release SCM reserved memory on probe failure or unbind, and limit Qualcomm firmware Kconfig options to Qualcomm platforms. Defer PMIC GLINK altmode work until devices resume to avoid accessing suspended I2C controllers. Fix cleanup of failed APR service registrations to prevent stale lookups, and remove unused APR device-ID matching. Add the SM7250 SoC ID, correct SMSM and SMP2P I/O annotations, and clean up RPMh kernel-doc and redundant IRQ error messages. Document the Kuno SCM interface, Shikra CTCU fallback, and Milos CPU bandwidth monitor. Add Abel Vesa as a Qualcomm SoC reviewer. * tag 'qcom-drivers-for-7.4-2' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: (34 commits) firmware: qcom: scm: Allow QSEECOM on Asus Zenbook A14 (UX3407NA) firmware: qcom: scm: Allow QSEECOM on Yoga Slim 7x Gen11 MAINTAINERS: add Abel as reviewer for linux-arm-msm soc: qcom: ubwcg: Add Nord UBWC config firmware: QCOM interfaces should depend on ARCH_QCOM firmware: qcom: scm: Use devm_of_reserved_mem_device_init() soc: qcom: smp2p: fix __iomem annotation on entry->value pointer soc: qcom: apr: clean up failed service registrations soc: qcom: smem: Fix signedness bug in smem_dram_parse() soc: qcom: ubwc: Add configuration for Maili soc: qcom: ubwc: Add configuration for Hawi soc: qcom: rpmh-rsc: fix kernel-doc issues in rpmh-rsc.c soc: qcom: rpmh: fix kernel-doc issues in rpmh.c soc: qcom: rpmh-internal: fix kernel-doc issues in rpmh-internal.h soc: qcom: pmic_glink: Fix device access from worker during suspend soc: qcom: llcc-qcom: Handle errors from optional IRQ lookup soc: qcom: geni-se: Fix write to read-only firmware buffer soc: qcom: geni-se: Fix fw_end computed before round-up; propagate size to caller soc: qcom: geni-se: Widen fw_size to u32 to prevent wrap-around soc: qcom: geni-se: Fix endian conversion for serial_protocol comparison ... Signed-off-by: Arnd Bergmann <arnd@arndb.de>
11 daysfirmware: qcom: scm: Allow QSEECOM on ThinkPad T14s Gen 7Srinivas Kandagatla
Allow the use of QSEECOM on the Mahua-based Lenovo ThinkPad T14s Gen 7, matching the pattern established for the Yoga Slim 7x Gen 11. Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/20260928145122.1337186-4-srinivas.kandagatla@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: tzmem: disable SHM bridge for SM7125 platformVitalii Skorkin
Currently SHM bridge causes RCU stalls when booting. Disable it for SM7125 until a fix is available. Signed-off-by: Vitalii Skorkin <nikroksm@mail.ru> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com> Link: https://patch.msgid.link/20260910-sm7125-samsung-v3-2-c467bea0fb9c@gmail.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: scm: Allow QSEECOM on Kalambo CRDGopikrishna Garmidi
Add Kalambo CRD board to the QSEECOM allowlist for enabling access to efivars. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com> Link: https://patch.msgid.link/20260909-b4-kalambo-crd-v7-4-f5685804478a@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: scm: Allow QSEECOM on the Glymur QCBGopikrishna Garmidi
Add Glymur QCB board to the QSEECOM allowlist for enabling access to efivars and uefi bootloader. Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com> Link: https://patch.msgid.link/20260908-glymur-qcb-v3-3-c194c0219218@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: fix typo "uninterruptable" in commentHemanth Selam
Correct "uninterruptable" to "uninterruptible", reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260907061742.10954-2-hemanth.selam@gmail.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: scm: Hide QCOM_SCM instead of depending on ARCH_QCOMSasha Levin
imx_v6_v7_defconfig fails to link: arm-linux-gnueabihf-ld: drivers/firmware/qcom/qcom_scm.o: in function `qcom_scm_pas_init_image': qcom_scm.c:(.text+0xecc): undefined reference to `qcom_tzmem_alloc' qcom_scm.c:(.text+0x2b0): undefined reference to `qcom_tzmem_free' qcom_scm.c:(.text+0x1514): undefined reference to `qcom_tzmem_to_phys' QCOM_SCM gained a "depends on ARCH_QCOM || COMPILE_TEST", but it is selected from 20 places in the tree and several of those are reachable without ARCH_QCOM. DRM_MSM is one of them, via SOC_IMX5, which is how imx_v6_v7_defconfig ends up here: WARNING: unmet direct dependencies detected for QCOM_SCM Depends on [n]: ARCH_QCOM [=n] || COMPILE_TEST [=n] Selected by [y]: - DRM_MSM [=y] && ... && (ARCH_QCOM [=n] || SOC_IMX5 [=y] || COMPILE_TEST [=n]) && ... kconfig still honours the select and sets QCOM_SCM=y, but it does not propagate the selects of a symbol whose own dependencies are unmet, so QCOM_TZMEM is left unset, qcom_tzmem.c is not built, and the unconditional qcom_tzmem_*() calls in qcom_scm.c and qcom_scm-smc.c have nothing to bind to. The point of the dependency was only to stop asking the user about Qualcomm firmware interfaces when configuring a non-Qualcomm kernel. Express that as a prompt condition, which is what the same commit already did for QCOM_PAS: the symbol stays invisible, but it no longer carries a dependency that silently drops its selects. Found by KernelCI builds of the linux-next tree. Fixes: 8fecd3194de3 ("firmware: QCOM interfaces should depend on ARCH_QCOM") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202609120634.g0HMAp3g-lkp@intel.com/ Assisted-by: LLM Signed-off-by: Sasha Levin <sashal@kernel.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260913173049.1168963-1-sashal@kernel.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom_scm: align PAS resource table retryMukesh Ojha
The initial PAS resource-table buffer can be too small. TrustZone returns the required size and the wrapper retries the SCM call. Although qcom_tzmem_alloc() aligns the allocated buffer, the size passed to TrustZone remained unaligned. Align the retry size to a page boundary so that both the buffer and its advertised size satisfy the PAS/TrustZone contract. Fixes: 8b9d2050cfa0 ("firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table") Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260921195636.1925869-3-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
11 daysfirmware: qcom_scm: handle empty PAS resource tableMukesh Ojha
The PAS resource-table query may successfully return a zero-sized table. kmemdup() with a zero length returns ZERO_SIZE_PTR, which is stored in rproc->table_ptr. The remoteproc core then dereferences this invalid pointer while processing resources. Treat a zero-sized result as an absent resource table and return NULL after releasing the TrustZone memory buffer. This allows the remoteproc core to skip resource-table processing. Fixes: 8b9d2050cfa0 ("firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table") Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260921195636.1925869-2-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
11 daysfirmware: qcom: tzmem: Use DO_ONCE_SLEEPABLE() in qcom_tzmem_enable()Mukesh Ojha
qcom_tzmem_enable() is called from qcom_scm_probe() in a sleepable process context. The helper it wraps, qcom_tzmem_init(), calls qcom_scm_shm_bridge_enable() -> qcom_scm_call(), which invokes might_sleep() and later acquires the qcom_scm_lock mutex via __scm_smc_do(). DO_ONCE() takes the once_lock spinlock with IRQs disabled, so invoking qcom_tzmem_init() from inside DO_ONCE() runs a sleepable call chain in atomic context. CONFIG_DEBUG_ATOMIC_SLEEP=y catches this on boot: BUG: sleeping function called from invalid context at drivers/firmware/qcom/qcom_scm.c:334 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 49, name: kworker/u16:2 ... __might_resched+0x148/0x24c __might_sleep+0x48/0x7c qcom_scm_call+0x30/0xc0 __qcom_scm_is_call_available+0x98/0x100 qcom_scm_shm_bridge_enable+0x60/0xbc qcom_tzmem_enable+0xf8/0x118 qcom_scm_probe+0x2d0/0x680 [ BUG: Invalid wait context ] ... kworker/u16:2/49 is trying to lock: ffffa83e8a485e38 (qcom_scm_lock){....}-{4:4}, at: __scm_smc_do+0x70/0x488 Switch to DO_ONCE_SLEEPABLE(), which guards the one-shot init with a mutex-style path (__do_once_sleepable_start/done) that is safe to hold across sleeping callees. All callers of qcom_tzmem_enable() are in process context (driver probe), so this is safe. Fixes: 9941fe8a04f3 ("firmware: qcom: scm: Fix tzmem state on probe retry") Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Closes: https://lore.kernel.org/lkml/5ea74dd3-7471-4c7c-9242-c2005312b1ab@samsung.com/ Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://patch.msgid.link/20260921195636.1925869-1-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
11 daysfirmware: qcom: scm: Allow QSEECOM on Asus Zenbook A14 (UX3407NA)Bjorn Andersson
In line with other Glymur-based machines, the Asus Zenbook A14 (UX3407NA) exposes EFI variables through the "uefisecapp". Add it to the QSEECOM allowlist to enable this access. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com> Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260915-zenbook-dts-v2-3-41de8669a7a8@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: scm: Allow QSEECOM on Yoga Slim 7x Gen11Konrad Dybcio
Allow the use of QSEECOM on the Glymur-based Lenovo Yoga Slim 7x Gen11, as there seem to be no issues with the firmware that would mandate disabling it. Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Tested-by: Oleg Keri <okerixx@gmail.com> Link: https://lore.kernel.org/r/20260731-topic-yoga_submission-v2-3-f1887031da4f@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: QCOM interfaces should depend on ARCH_QCOMGeert Uytterhoeven
The various Qualcomm firmware interfaces are only present on Qualcomm systems. Hence add dependencies on ARCH_QCOM, to prevent asking the user about them when configuring a kernel without Qualcomm SoC support. Make QCOM_PAS invisible instead, as it is already selected by its users when needed. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Acked-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/888efe8e63b6a18fae4acd5a90a1e0e69dcdf2ca.1786012495.git.geert+renesas@glider.be Signed-off-by: Bjorn Andersson <andersson@kernel.org>
11 daysfirmware: qcom: scm: Use devm_of_reserved_mem_device_init()Mukesh Ojha
Switch from of_reserved_mem_device_init() to the new resource managed devm_of_reserved_mem_device_init() so that the reserved memory region is released automatically on probe failure or device unbind. This eliminates the err_rmem cleanup label and the need to call of_reserved_mem_device_release() explicitly on error paths. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260902193948.1999595-1-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-09-18Merge tag 'kbuild-fixes-7.3-1' into kbuild-nextNathan Chancellor
Future changes in kbuild-next depend on 281b61d408d4 ("scripts/mksysmap: drop the MODULE_INFO() symbols from kallsyms") 59351365ac27 ("scripts/mksysmap: fix escape of '$' in the __pi_ pattern") from kbuild-fixes. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17tee: remove TZMEM_MODE_GENERICJulian Braha
'select' does not work on config options in a 'choice', so currently it is possible to enable QCOMTEE without QCOM_TZMEM_MODE_SHMBRIDGE, even though this is needed at runtime. There are no users of the generic allocator option, QCOM_TZMEM_MODE_GENERIC, so let's remove it. Then, we can remove the containing choice..endchoice, which allows the 'select' to work as intended. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Link: https://patch.msgid.link/20260807175041.3299349-1-julianbraha@gmail.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-04treewide: refresh kmalloc_obj() conversionsKees Cook
This is another run of the Coccinelle script for converting kmalloc() family of allocations to kmalloc_obj() via the existing rules in scripts/coccinelle/api/kmalloc_objs.cocci This catches both the set of kmalloc() uses added since the first kmalloc_obj() conversions in v7.0 and adds a large group missed in the first pass due to Coccinelle not interacting well with the cleanup.h scoped_...() family of macros[1]. I worked around this with spatch's "--macro-file" argument to a file with all the scoped_...() macros mapped to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control flow indicator I could find. Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc, riscv, and s390 with no new warnings. Link: https://lore.kernel.org/lkml/202609021314.8A9C0B8@keescook/ [1] Link: https://github.com/coccinelle/coccinelle/blob/master/standard.h [2] Signed-off-by: Kees Cook <kees+treewide@kernel.org>
2026-08-31firmware: qcom_scm: Remove SCM PAS wrappersSumit Garg
Now since all the Qcom SCM client drivers have been migrated over to generic PAS TZ service, let's drop the exported SCM PAS wrappers. Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> # Lemans Tested-by: Vignesh Viswanathan <vignesh.viswanathan@oss.qualcomm.com> # IPQ9650 Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260702115835.167602-14-sumit.garg@kernel.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-08-31firmware: qcom: scm: Allow QSEECOM on HP EliteBook X G2q 14 AIJason Pettit
The HP EliteBook X G2q 14" Next Gen AI PC is a Snapdragon X2 Elite (Glymur) laptop whose firmware exposes EFI variables through QSEECOM. Add its board compatible to the QSEECOM allowlist so that EFI variable access (efivarfs) works on this machine. Without it the kernel reports "qseecom: untested machine, skipping" and efivarfs is empty. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Jason Pettit <jason.pettit@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260829-glymur-send-v5-3-a11bdf6a4b66@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-30firmware: qcom: scm: Fix tzmem state on probe retryMukesh Ojha
qcom_tzmem_enable() returns -EBUSY if called a second time, but this causes probe retries to fail permanently if a later step in qcom_scm_probe() defers after qcom_tzmem_enable() has already succeeded. Use DO_ONCE() to ensure qcom_tzmem_init() runs exactly once across all calls in a thread-safe manner. qcom_tzmem_dev is set on every call since probe retries use the same device pointer. The result of the first initialisation is cached and returned to every subsequent caller. Fixes: 40289e35ca52 ("firmware: qcom: scm: enable the TZ mem allocator") Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260724094939.613844-4-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-30firmware: qcom: scm: Fix reserved memory cleanup on probe failureMukesh Ojha
of_reserved_mem_device_init() adds an entry to a global list with no devres counterpart. If qcom_scm_probe() fails after the call the assignment is never cleaned up. A probe retry would add a duplicate entry, leaking the original one permanently. Add an err_rmem label that calls of_reserved_mem_device_release() and route all error paths after of_reserved_mem_device_init() through it. of_reserved_mem_device_release() is safe to call unconditionally as it simply walks an empty list when nothing was assigned. Fixes: a33b2579c8d3 ("firmware: qcom: scm: add support for SHM bridge memory carveout") Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260724094939.613844-3-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-30firmware: qcom: scm: Fix NULL dereference in IRQ handler before __scm is ↵Mukesh Ojha
published In qcom_scm_probe(), devm_request_threaded_irq() is called before smp_store_release(&__scm, scm). Two paths can dereference __scm before it is published, both causing a NULL pointer dereference. The IRQ handler receives scm via its data argument but passes only wq_ctx to qcom_scm_waitq_wakeup() and qcom_scm_get_completion(), which then dereference __scm directly. Thread scm through both functions so the IRQ handler path never touches __scm. Non-atomic SMC calls made during probe (e.g. from qcom_tzmem_init via qcom_scm_shm_bridge_enable) can return WAITQ_SLEEP, causing qcom_scm_wait_for_wq_completion() to run before __scm is published and dereference it. Add platform_set_drvdata(pdev, scm) early in probe and change qcom_scm_wait_for_wq_completion() to take the device pointer and use dev_get_drvdata() to reach scm, removing any dependency on __scm. Fixes: 6bf325992236 ("firmware: qcom: scm: Add wait-queue handling logic") Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260724094939.613844-2-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-30firmware: qcom: scm: Allow QSEECOM on Asus Zenbook A16 (UX3607OA)Konrad Dybcio
In line with other Glymur-based machines, the Asus Zenbook A16 (UX3607OA) exposes EFI variables through the "uefisecapp". Add it to the QSEECOM allowlist to enable this access. Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260721-topic-a16_submission-v1-3-8ea213130d05@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-13firmware: qcom: scm: Add minidump SRAM supportMukesh Ojha
On most Qualcomm SoCs where minidump is supported, a word in always-on SRAM is shared between the operating system (OS) and boot firmware. Before DDR is initialized on the warm reset following a crash, firmware reads this word to decide if minidump is enabled and collect a minidump, and where to deliver it (USB upload to a host, or save to local storage). The OS is expected to select one of the destinations. The SRAM region is described by a 'sram' phandle on the SCM DT node. If the property is absent the feature is silently disabled, keeping existing SoCs unaffected. Expose a 'minidump_dest' module parameter (default: usb) so the user can select the destination. Only the string names "usb" or "storage" are accepted. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260624190830.3131112-6-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-13firmware: qcom: scm: use dev_err_probe() for dload address failureMukesh Ojha
Replace the bare `return ret` after qcom_scm_find_dload_address() with dev_err_probe() to produce a consistent, deferred-probe-aware error message when the download-mode address cannot be resolved. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260624190830.3131112-5-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-13firmware: qcom: scm: Fix missing smp_load_acquire()Mukesh Ojha
__scm is published in qcom_scm_probe() with smp_store_release() but qcom_scm_set_download_mode() reads it directly without smp_load_acquire(), creating a potential ordering violation where a CPU could observe a stale or partially initialised __scm pointer. Use smp_load_acquire() to acquire __scm in the qcom_scm_set_download_mode() function. Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260624190830.3131112-4-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11firmware: qcom: scm: Allow QSEECOM on Honor Magicbook Art 14Konstantin Shabanov
Allow particular machine accessing eg. efivars. Signed-off-by: Konstantin Shabanov <mail@etehtsea.me> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260629154812.9066-5-mail@etehtsea.me Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11firmware: qcom: scm: instrument SMC call path with tracepointsYuvaraj Ranganathan
Wire the five tracepoints defined in qcom_scm_trace.h into the SMC execution path by including the header with CREATE_TRACE_POINTS. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Yuvaraj Ranganathan <yuvaraj.ranganathan@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260522-scm-tracepoints-v2-2-e27cdbe0c585@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11firmware: qcom: scm: add trace events for the SMC call interfaceYuvaraj Ranganathan
The SCM SMC call path is opaque at runtime. Stalls caused by firmware congestion, QCOM_SCM_WAITQ_SLEEP/RESUME cycles, and EBUSY retry loops are invisible without recompiling the kernel with temporary printk statements or attaching a hardware debugger. Add five TRACE_EVENTs covering the complete lifecycle of an SCM call: scm_smc_request Emit before each arm_smccc_smc_quirk() invocation. Records the SMC function ID, decoded service and command identifiers, argument count, and up to six register arguments in hex and decimal. Because the caller loops on QCOM_SCM_INTERRUPTED, this event fires once per physical SMC instruction including inte scm_smc_done Emit after the outer __scm_smc_do() returns, pairing each request with its final outcome. Records the SMC function ID, the kernel error code returned to the caller, and the four firmware result registers a0-a3. scm_waitq_sleep Emit when the firmware returns QCOM_SCM_WAITQ_SLEEP. Records the wait-queue context and the SMC call context handles required to issue the matching WAITQ_RESUME. scm_waitq_resume Emit just before constructing and sending the WAITQ_RESUME follow-up call. Records the SMC call context handle being resumed. scm_waitq_get_wq_ctx Emit after a successful WAITQ_GET_WQ_CTX fast-call. Records the returned wait-queue context, flags, and more_pending indicator. These events let ftrace and perf reconstruct the full sequence of firmware interactions, measure per-call and end-to-end latency, and attribute waitqueue stalls to specific service/command pairs without modifying driver source. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Yuvaraj Ranganathan <yuvaraj.ranganathan@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260522-scm-tracepoints-v2-1-e27cdbe0c585@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-09firmware: qcom: Add a PAS TEE serviceSumit Garg
Add support for Peripheral Authentication Service (PAS) driver based on TEE bus with OP-TEE providing the backend PAS service implementation. The TEE PAS service ABI is designed to be extensible with additional API as PTA_QCOM_PAS_CAPABILITIES. This allows to accommodate any future extensions of the PAS service needed while still maintaining backwards compatibility. Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> # Lemans Reviewed-by: Harshal Dev <harshal.dev@oss.qualcomm.com> Tested-by: Vignesh Viswanathan <vignesh.viswanathan@oss.qualcomm.com> # IPQ9650 Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260702115835.167602-4-sumit.garg@kernel.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-09firmware: qcom_scm: Migrate to generic PAS serviceSumit Garg
With the availability of generic PAS service, let's add SCM calls as a backend to keep supporting legacy QTEE interfaces. The exported qcom_scm* wrappers will get dropped once all the client drivers get migrated as part of future patches. Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> # Lemans Reviewed-by: Harshal Dev <harshal.dev@oss.qualcomm.com> Tested-by: Vignesh Viswanathan <vignesh.viswanathan@oss.qualcomm.com> # IPQ9650 Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260702115835.167602-3-sumit.garg@kernel.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-09firmware: qcom: Add a generic PAS serviceSumit Garg
Qcom platforms has the legacy of using non-standard SCM calls splintered over the various kernel drivers. These SCM calls aren't compliant with the standard SMC calling conventions which is a prerequisite to enable migration to the FF-A specifications from Arm. OP-TEE as an alternative trusted OS to Qualcomm TEE (QTEE) can't support these non-standard SCM calls. And even for newer architectures using S-EL2 with Hafnium support, QTEE won't be able to support SCM calls either with FF-A requirements coming in. And with both OP-TEE and QTEE drivers well integrated in the TEE subsystem, it makes further sense to reuse the TEE bus client drivers infrastructure. The added benefit of TEE bus infrastructure is that there is support for discoverable/enumerable services. With that client drivers don't have to manually invoke a special SCM call to know the service status. So enable the generic Peripheral Authentication Service (PAS) provided by the firmware. It acts as the common layer with different TZ backends plugged in whether it's an SCM implementation or a proper TEE bus based PAS service implementation. Reviewed-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> # Lemans Reviewed-by: Harshal Dev <harshal.dev@oss.qualcomm.com> Tested-by: Vignesh Viswanathan <vignesh.viswanathan@oss.qualcomm.com> # IPQ9650 Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260702115835.167602-2-sumit.garg@kernel.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-05-13firmware: qcom: scm: Allow QSEECOM on Surface Pro 12inHarrison Vanderbyl
Add the Surface Pro 12in to the QSEECOM allowlist so that the Qualcomm Secure Execution Environment interface is available on this device. Signed-off-by: Harrison Vanderbyl <harrison.vanderbyl@gmail.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/92171ad5e7851e6758dd205246b4289f32e12655.1778498477.git.harrison.vanderbyl@gmail.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-04-02firmware: qcom: scm: Allow QSEECOM on Lenovo IdeaCentre Mini XBjorn Andersson
The Hamoa-based Lenovo IdeaCentre Mini X provides the same UEFI variable access through uefisecapp as other Hamoa devices, add it to the allowlist. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260401-ideacentre-v2-3-5745fe2c764e@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-30firmware: qcom: scm: Register gunyah watchdog deviceHrishabh Rajput
To restrict Gunyah watchdog initialization to Qualcomm platforms running under the Gunyah Hypervisor, register the watchdog device in the QCOM SCM driver. When Gunyah is not present or Gunyah emulates MMIO-based watchdog, we expect Qualcomm watchdog or ARM SBSA watchdog device to be present in the devicetree. First, we make sure we're running under the Gunyah Hypervisor. Then we move to check if any of the above mentioned watchdog device nodes are present, if not then we proceed to register the SMC-based Gunyah watchdog device. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Tested-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Hrishabh Rajput <hrishabh.rajput@oss.qualcomm.com> Signed-off-by: Pavankumar Kondeti <pavan.kondeti@oss.qualcomm.com> Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260311-gunyah_watchdog-v8-1-4c1c0689de22@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-30firmware: qcom: scm: Allow QSEECOM on Mahua CRDGopikrishna Garmidi
Add Mahua CRD board to the QSEECOM allowlist for enabling access to efivars and uefi bootloader. Signed-off-by: Gopikrishna Garmidi <gopikrishna.garmidi@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260322-mahua-qcom_scm-support-v1-1-00c50db332ee@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-23firmware: qcom_scm: don't opencode kmemdupMukesh Ojha
Lets not opencode kmemdup which is reported by coccinelle tool. Fix it using kmemdup. cocci warnings: (new ones prefixed by >>) >> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup Fixes: 8b9d2050cfa0 ("firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/ Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260310140255.2520230-1-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-18firmware: qcom: scm: Allow QSEECOM on Glymur CRDPankaj Patil
Add glymur-crd to QSEECOM allowlist for enabling access to efivars and uefi bootloader Signed-off-by: Pankaj Patil <pankaj.patil@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260225-qseecom_glymur-v1-1-0cafc709e2ef@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-18firmware: qcom: scom: Simplify mutex with guardKrzysztof Kozlowski
Simplify error path unlocking mutex with the guard. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260216091525.107935-6-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-18firmware: qcom: uefisecapp: Annotate acquiring locks for context trackingKrzysztof Kozlowski
qcuefi_acquire() and qcuefi_release() end with mutex locked or unlocked respectively, so annotate them so the lock usage will be tracked by context tracking tools. Note that mutex is tracked since commit 370f0a345a70 ("locking/mutex: Support Clang's context analysis"). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260216091525.107935-5-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-18firmware: qcom: uefisecapp: Simplify mutex with guardKrzysztof Kozlowski
Simplify error path unlocking mutex with the guard. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260216091525.107935-4-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-04firmware: qcom: scm: Allow QSEECOM on ECS LIVA QC710Val Packett
Allow this machine to access efivars through qseecom/uefisecapp. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Val Packett <val@packett.cool> Link: https://lore.kernel.org/r/20260120234029.419825-11-val@packett.cool Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-03-04firmware: qcom: scm: Allow QSEECOM on PURWA-IOT-EVKYijie Yang
Add the Purwa-IoT-EVK board to the list to enable access to EFI variables. Guarantee that subsystems relying on SCM services can access secure-world features. This change improves reliability and prevents missing functionality or boot-time issues by making service availability explicit. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Yijie Yang <yijie.yang@oss.qualcomm.com> Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260202073555.1345260-2-yijie.yang@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-02-25firmware: qcom: scm: allow QSEECOM on ASUS Vivobook X1P42100 variantJens Glathe
Enables access to EFI variables on this machine. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Tested-by: Colin K. Williams <colin@li-nk.org> Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz> Link: https://lore.kernel.org/r/20260214-b4-vivobook-v3-2-3c88065bbf77@oldschoolsolutions.biz Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-02-21Convert more 'alloc_obj' cases to default GFP_KERNEL argumentsLinus Torvalds
This converts some of the visually simpler cases that have been split over multiple lines. I only did the ones that are easy to verify the resulting diff by having just that final GFP_KERNEL argument on the next line. Somebody should probably do a proper coccinelle script for this, but for me the trivial script actually resulted in an assertion failure in the middle of the script. I probably had made it a bit _too_ trivial. So after fighting that far a while I decided to just do some of the syntactically simpler cases with variations of the previous 'sed' scripts. The more syntactically complex multi-line cases would mostly really want whitespace cleanup anyway. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21Convert '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>
2026-02-21treewide: 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>