summaryrefslogtreecommitdiff
path: root/drivers/soc
AgeCommit message (Collapse)AuthorFilesLines
2022-06-09soc: aspeed: mctp: Add IOCTL to set own EIDIwona Winiarska1-0/+18
The driver doesn't implement MCTP logic, which means that it requires its clients to prepare valid MCTP over PCIe packets. Because we support MCTP stacks in both kernel and userspace, and since MCTP protocol is a part of userspace, we need userspace to update own EID information in kernel to provide it for in-kernel aspeed-mctp clients. Previously, own EID information was updated by userspace using SET_EID_INFO which now is deprecated and replaced by SET_EID_EXT_INFO to pass CPU EID and Domain ID mappings. To provide own EID information for in-kernel clients, add a dedicated IOCTL. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
2022-05-12Merge commit '49caedb668e476c100d727f2174724e0610a2b92' of ↵Sujoy Ray11-11/+175
https://github.com/openbmc/linux into openbmc/dev-5.15-intel-bump_v5.15.36 Signed-off-by: Sujoy Ray <sujoy.ray@intel.com>
2022-04-27Merge tag 'v5.15.35' into dev-5.15Joel Stanley1-1/+57
This is the 5.15.35 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-04-20soc: qcom: aoss: Fix missing put_device call in qmp_getMiaoqian Lin1-1/+5
commit 4b41a9d0fe3db5f91078a380f62f0572c3ecf2dd upstream. The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling paths. Fixes: 8c75d585b931 ("soc: qcom: aoss: Expose send for generic usecase") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220108095931.21527-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20soc: qcom: aoss: Expose send for generic usecaseDeepak Kumar Singh1-1/+53
commit 8c75d585b931ac874fbe4ee5a8f1811d20c2817f upstream. Not all upcoming usecases will have an interface to allow the aoss driver to hook onto. Expose the send api and create a get function to enable drivers to send their own messages to aoss. Signed-off-by: Chris Lew <clew@codeaurora.org> Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/1630420228-31075-2-git-send-email-deesin@codeaurora.org Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-15soc: aspeed: mctp: Extend internal aspeed-mctp driver APIKrzysztof Richert1-0/+22
New API allows to read DomainId information by internal kernel clients (for example peci-mctp). Signed-off-by: Krzysztof Richert <krzysztof.richert@intel.com>
2022-04-15soc: aspeed: mctp: Add IOCTLs for extended EID informationKrzysztof Richert1-20/+63
For PECI over MCTP purposes, aspeed-mctp driver needs to be extended that allows to set Domain ID information. Signed-off-by: Krzysztof Richert <krzysztof.richert@intel.com>
2022-04-15soc: aspeed: xdma: Add trace eventsEddie James1-2/+16
Trace the flow of the driver to aid debugging after an error. OpenBMC-Staging-Count: 1 Signed-off-by: Eddie James <eajames@linux.ibm.com> Acked-by: Andrew Jeffery <andrew@aj.id.au> Link: https://lore.kernel.org/r/20220412215331.42491-1-eajames@linux.ibm.com Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-04-14Merge tag 'v5.15.34' into dev-5.15Joel Stanley5-3/+10
This is the 5.15.34 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-04-08soc: mediatek: pm-domains: Add wakeup capacity support in power domainChun-Jie Chen1-0/+3
[ Upstream commit ac0ca395543af061f7ad77afcda0afb323d82468 ] Due to some power domain needs to keep on for wakeup in system suspend, so add GENPD_FLAG_ACTIVE_WAKEUP support in Mediatek power domain driver. Fixes: 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains") Signed-off-by: Chun-Jie Chen <chun-jie.chen@mediatek.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220130012104.5292-3-chun-jie.chen@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08soc: ti: wkup_m3_ipc: Fix IRQ check in wkup_m3_ipc_probeMiaoqian Lin1-2/+2
[ Upstream commit c3d66a164c726cc3b072232d3b6d87575d194084 ] platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example: int irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; Fix the check of return value to catch errors correctly. Fixes: cdd5de500b2c ("soc: ti: Add wkup_m3_ipc driver") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Dave Gerlach <d-gerlach@ti.com> Link: https://lore.kernel.org/r/20220114062840.16620-1-linmq006@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08soc: qcom: aoss: remove spurious IRQF_ONESHOT flagsDaniel Thompson1-1/+1
[ Upstream commit 8030cb9a55688c1339edd284d9d6ce5f9fc75160 ] Quoting the header comments, IRQF_ONESHOT is "Used by threaded interrupts which need to keep the irq line disabled until the threaded handler has been run.". When applied to an interrupt that doesn't request a threaded irq then IRQF_ONESHOT has a lesser known (undocumented?) side effect, which it to disable the forced threading of the irq. For "normal" kernels (without forced threading) then, if there is no thread_fn, then IRQF_ONESHOT is a nop. In this case disabling forced threading is not appropriate for this driver because it calls wake_up_all() and this API cannot be called from no-thread interrupt handlers on PREEMPT_RT systems (deadlock risk, triggers sleeping-while-atomic warnings). Fix this by removing IRQF_ONESHOT. Fixes: 2209481409b7 ("soc: qcom: Add AOSS QMP driver") Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> [bjorn: Added Fixes tag] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220127173554.158111-1-daniel.thompson@linaro.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08soc: qcom: ocmem: Fix missing put_device() call in of_get_ocmemMiaoqian Lin1-0/+1
[ Upstream commit 0ff027027e05a866491bbb53494f0e2a61354c85 ] The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling path. Fixes: 01f937ffc468 ("soc: qcom: ocmem: don't return NULL in of_get_ocmem") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220107073126.2335-1-linmq006@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08soc: qcom: rpmpd: Check for null return of devm_kcallocJiasheng Jiang1-0/+3
[ Upstream commit 5a811126d38f9767a20cc271b34db7c8efc5a46c ] Because of the possible failure of the allocation, data->domains might be NULL pointer and will cause the dereference of the NULL pointer later. Therefore, it might be better to check it and directly return -ENOMEM without releasing data manually if fails, because the comment of the devm_kmalloc() says "Memory allocated with this function is automatically freed on driver detach.". Fixes: bbe3a66c3f5a ("soc: qcom: rpmpd: Add a Power domain driver to model corners") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211231094419.1941054-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-31soc: aspeed: Correct mutex trylock checkVikash Chandola1-1/+1
Correct mutex_trylock to proceed if there is no contention otherwise return otherwise EBUSY. Signed-off-by: Vikash Chandola <vikash.chandola@intel.com>
2022-03-23soc: aspeed: Add support for eSPI Virtual WireAnkita Prasad4-1/+123
The Aspeed eSPI controller is a slave device to communicate with the master through the Enhanced Serial Peripheral Interface (eSPI). It supports all eSPI channels including the Virtual Wire that is used to transmit the sideband signal information to/from Management Controller (e.g. BMC). Add support for the Virtual Wire channel. Add IOCTL handler to support reading and writing GPIO value over the Virtual Wire channel. Signed-off-by: Ankita Prasad <ankita.prasad@intel.com>
2022-03-22Merge tag 'v5.15.30' into dev-5.15Joel Stanley2-5/+11
This is the 5.15.30 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-03-16ARM: soc: aspeed: Update secure boot controller supportJoel Stanley1-9/+11
Pick up changes from v2: - Place files in aspeed/sbc - Check for error when creating directory - Print secure boot message even if debugfs is disabled OpenBMC-Staging-Count: 1 Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-03-12soc: aspeed: Add support for eSPI OOB channelVikash Chandola6-11/+621
Add eSPI OOB channel slave. Add new device file to transact eSPI OOB messages with eSPI master in PCH. Signed-off-by: Vikash Chandola <vikash.chandola@intel.com>
2022-03-12soc: aspeed: Refactor aspeed espi slaveVikash Chandola2-96/+334
Move ASPEED_ESPI macro definitions to a aspeed-espi-ctrl header file. Fix the compilation warning: drivers/soc/aspeed/aspeed-espi-slave.c: In function 'aspeed_espi_pltrstn_open': drivers/soc/aspeed/aspeed-espi-slave.c:286:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 286 | struct aspeed_espi *priv = to_aspeed_espi(filp); | ^~~~~~ Signed-off-by: Vikash Chandola <vikash.chandola@intel.com>
2022-03-11Merge commit '2befcc6bb0bb1e0a4a31391a359adcab3925b6e4' of ↵Sujoy Ray15-23/+38
https://github.com/openbmc/linux into openbmc/linux_5.15.24_bump Signed-off-by: Sujoy Ray <sujoy.ray@intel.com>
2022-03-08soc: fsl: qe: Check of ioremap return valueJiasheng Jiang1-0/+2
[ Upstream commit a222fd8541394b36b13c89d1698d9530afd59a9c ] As the possible failure of the ioremap(), the par_io could be NULL. Therefore it should be better to check it and return error in order to guarantee the success of the initiation. But, I also notice that all the caller like mpc85xx_qe_par_io_init() in `arch/powerpc/platforms/85xx/common.c` don't check the return value of the par_io_init(). Actually, par_io_init() needs to check to handle the potential error. I will submit another patch to fix that. Anyway, par_io_init() itsely should be fixed. Fixes: 7aa1aa6ecec2 ("QE: Move QE from arch/powerpc to drivers/soc") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08soc: fsl: guts: Add a missing memory allocation failure checkChristophe JAILLET1-2/+7
[ Upstream commit b9abe942cda43a1d46a0fd96efb54f1aa909f757 ] If 'devm_kstrdup()' fails, we should return -ENOMEM. While at it, move the 'of_node_put()' call in the error handling path and after the 'machine' has been copied. Better safe than sorry. Fixes: a6fc3b698130 ("soc: fsl: add GUTS driver for QorIQ platforms") Depends-on: fddacc7ff4dd ("soc: fsl: guts: Revert commit 3c0d64e867ed") Suggested-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08soc: fsl: guts: Revert commit 3c0d64e867edChristophe JAILLET1-4/+3
[ Upstream commit b113737cf12964a20cc3ba1ddabe6229099661c6 ] This reverts commit 3c0d64e867ed ("soc: fsl: guts: reuse machine name from device tree"). A following patch will fix the missing memory allocation failure check instead. Suggested-by: Tyrel Datwyler <tyreld@linux.ibm.com> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08Merge tag 'v5.15.26' into dev-5.15Joel Stanley1-4/+3
This is the 5.15.26 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-03-07ARM: soc: aspeed: Add secure boot controller supportJoel Stanley3-0/+79
This reads out the status of the secure boot controller and exposes it in debugfs. An example on a AST2600A3 QEMU model: # grep -r . /sys/kernel/debug/aspeed/* /sys/kernel/debug/aspeed/abr_image:0 /sys/kernel/debug/aspeed/low_security_key:0 /sys/kernel/debug/aspeed/otp_protected:0 /sys/kernel/debug/aspeed/secure_boot:1 /sys/kernel/debug/aspeed/uart_boot:0 On boot the state of the system according to the secure boot controller will be printed: [ 0.037634] AST2600 secure boot enabled or [ 0.037935] AST2600 secure boot disabled OpenBMC-Staging-Count: 1 Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Link: https://lore.kernel.org/r/20220304030336.1017197-1-joel@jms.id.au Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-02-23soc: aspeed: lpc-ctrl: Block error printing on probe defer casesJae Hyun Yoo1-4/+3
[ Upstream commit 301a5d3ad2432d7829f59432ca0a93a6defbb9a1 ] Add a checking code when it gets -EPROBE_DEFER while getting a clock resource. In this case, it doesn't need to print out an error message because the probing will be re-visited. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com> Link: https://lore.kernel.org/r/20211104173709.222912-1-jae.hyun.yoo@intel.com Link: https://lore.kernel.org/r/20220201070118.196372-1-joel@jms.id.au' Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-02-17Merge tag 'v5.15.24' into dev-5.15Joel Stanley1-11/+4
This is the 5.15.24 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-02-08Revert "ASoC: mediatek: Check for error clk pointer"Guenter Roeck1-11/+4
This reverts commit 38accfd85e41b7ca547c5a7d4866bbc1462950cb which is commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e upstream With this patch in the tree, Chromebooks running the affected hardware no longer boot. Bisect points to this patch, and reverting it fixes the problem. An analysis of the code with this patch applied shows: ret = init_clks(pdev, clk); if (ret) return ERR_PTR(ret); ... for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) { struct clk *c = clk[data->clk_id[j]]; if (IS_ERR(c)) { dev_err(&pdev->dev, "%s: clk unavailable\n", data->name); return ERR_CAST(c); } scpd->clk[j] = c; } Not all clocks in the clk_names array have to be present. Only the clocks in the data->clk_id array are actually needed. The code already checks if the required clocks are available and bails out if not. The assumption that all clocks have to be present is wrong, and commit 9de2b9286a6d needs to be reverted. Fixes: 9de2b9286a6d ("ASoC: mediatek: Check for error clk pointer") Cc: Jiasheng Jiang <jiasheng@iscas.ac.cn> Cc: Mark Brown <broonie@kernel.org> Cc: James Liao <jamesjj.liao@mediatek.com> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Matthias Brugger <matthias.bgg@gmail.com Cc: Frank Wunderlich <frank-w@public-files.de> Cc: Daniel Golle <daniel@makrotopia.org> Link: https://lore.kernel.org/lkml/20220205014755.699603-1-linux@roeck-us.net/ Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-31Merge tag 'v5.15.18' into dev-5.15Joel Stanley4-7/+14
This is the 5.15.18 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-01-27PM: AVS: qcom-cpr: Use div64_ul instead of do_divChangcheng Deng1-1/+1
[ Upstream commit 92c550f9ffd2884bb5def52b5c0485a35e452784 ] do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211125014311.45942-1-deng.changcheng@zte.com.cn Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27soc: ti: pruss: fix referenced node in error messageJan Kiszka1-1/+1
[ Upstream commit 8aa35e0bb5eaa42bac415ad0847985daa7b4890c ] So far, "(null)" is reported for the node that is missing clocks. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Suman Anna <s-anna@ti.com> Signed-off-by: Nishanth Menon <nm@ti.com> Link: https://lore.kernel.org/r/d6e24953-ea89-fd1c-6e16-7a0142118054@siemens.com Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27soc: imx: gpcv2: Synchronously suspend MIX domainsMarek Vasut1-1/+1
[ Upstream commit f756f435f7dd823f2d4bd593ce1bf3168def1308 ] In case the following power domain sequence happens, iMX8M Mini always hangs: gpumix:on -> gpu:on -> gpu:off -> gpu:on This is likely due to another quirk of the GPC block. This situation can be prevented by always synchronously powering off both the domain and MIX domain. Make it so. This turns the aforementioned sequence into: gpumix:on -> gpu:on -> gpu:off -> gpumix:off -> gpumix:on -> gpu:on Signed-off-by: Marek Vasut <marex@denx.de> Cc: Frieder Schrempf <frieder.schrempf@kontron.de> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: NXP Linux Team <linux-imx@nxp.com> Cc: Peng Fan <peng.fan@nxp.com> Cc: Shawn Guo <shawnguo@kernel.org> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27ASoC: mediatek: Check for error clk pointerJiasheng Jiang1-4/+11
[ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ] Yes, you are right and now the return code depending on the init_clks(). Fixes: 6078c651947a ("soc: mediatek: Refine scpsys to support multiple platform") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Link: https://lore.kernel.org/r/20211222015157.1025853-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-14Merge tag 'v5.15.14' into dev-5.15Joel Stanley3-2/+6
This is the 5.15.14 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-12-22soc/tegra: fuse: Fix bitwise vs. logical OR warningNathan Chancellor2-2/+2
[ Upstream commit a7083763619f7485ccdade160deb81737cf2732f ] A new warning in clang points out two instances where boolean expressions are being used with a bitwise OR instead of logical OR: drivers/soc/tegra/fuse/speedo-tegra20.c:72:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] reg = tegra_fuse_read_spare(i) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/soc/tegra/fuse/speedo-tegra20.c:72:9: note: cast one or both operands to int to silence this warning drivers/soc/tegra/fuse/speedo-tegra20.c:87:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] reg = tegra_fuse_read_spare(i) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/soc/tegra/fuse/speedo-tegra20.c:87:9: note: cast one or both operands to int to silence this warning 2 warnings generated. The motivation for the warning is that logical operations short circuit while bitwise operations do not. In this instance, tegra_fuse_read_spare() is not semantically returning a boolean, it is returning a bit value. Use u32 for its return type so that it can be used with either bitwise or boolean operators without any warnings. Fixes: 25cd5a391478 ("ARM: tegra: Add speedo-based process identification") Link: https://github.com/ClangBuiltLinux/linux/issues/1488 Suggested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-22soc: imx: Register SoC device only on i.MX boardsStephan Gerhold1-0/+4
[ Upstream commit 4ebd29f91629e69da7d57390cdc953772eee03ab ] At the moment, using the ARM32 multi_v7_defconfig always results in two SoCs being exposed in sysfs. This is wrong, as far as I'm aware the Qualcomm DragonBoard 410c does not actually make use of a i.MX SoC. :) qcom-db410c:/sys/devices/soc0$ grep . * family:Freescale i.MX machine:Qualcomm Technologies, Inc. APQ 8016 SBC revision:0.0 serial_number:0000000000000000 soc_id:Unknown qcom-db410c:/sys/devices/soc1$ grep . * family:Snapdragon machine:APQ8016 ... This happens because imx_soc_device_init() registers the soc device unconditionally, even when running on devices that do not make use of i.MX. Arnd already reported this more than a year ago and even suggested a fix similar to this commit, but for some reason it was never submitted. Fix it by checking if the "__mxc_cpu_type" variable was actually initialized by earlier platform code. On devices without i.MX it will simply stay 0. Cc: Peng Fan <peng.fan@nxp.com> Fixes: d2199b34871b ("ARM: imx: use device_initcall for imx_soc_device_init") Reported-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/CAK8P3a0hxO1TmK6oOMQ70AHSWJnP_CAq57YMOutrxkSYNjFeuw@mail.gmail.com/ Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Fabio Estevam <festevam@gmail.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-15soc: aspeed: lpc-mbox: Avoid calling kfifo_to_user in atomic contextIwona Winiarska1-45/+33
kfifo_to_user() can sleep, which means that calling it in atomic context can cause deadlock. aspeed-lpc-mbox is calling it under spin_lock_irqsave(), causing the following lockdep splat: [ 44.939994] BUG: sleeping function called from invalid context at include/linux/uaccess.h:174 [ 44.949549] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 282, name: host-misc-manag [ 44.959280] INFO: lockdep is turned off. [ 44.963657] irq event stamp: 5950 [ 44.967361] hardirqs last enabled at (5949): [<802ba0cc>] get_page_from_freelist+0xf1c/0x1358 [ 44.977005] hardirqs last disabled at (5950): [<80a605e4>] _raw_spin_lock_irqsave+0x80/0x84 [ 44.986350] softirqs last enabled at (5908): [<80838a80>] release_sock+0x8c/0xa8 [ 44.994723] softirqs last disabled at (5906): [<80838a1c>] release_sock+0x28/0xa8 [ 45.003099] CPU: 0 PID: 282 Comm: host-misc-manag Tainted: G W 5.15.0-14fcc87-dirty-7b64388 #1 [ 45.014198] Hardware name: Generic DT based system [ 45.019553] Backtrace: [ 45.022296] [<80a48e84>] (dump_backtrace) from [<80a49268>] (show_stack+0x20/0x24) [ 45.030771] r7:8231dcf0 r6:00000080 r5:80cb88f4 r4:600f0093 [ 45.037094] [<80a49248>] (show_stack) from [<80a5592c>] (dump_stack_lvl+0x60/0x78) [ 45.045565] [<80a558cc>] (dump_stack_lvl) from [<80a5595c>] (dump_stack+0x18/0x1c) [ 45.054037] r7:8231dcf0 r6:000000ae r5:80c9b97c r4:848ea000 [ 45.060360] [<80a55944>] (dump_stack) from [<80160d3c>] (___might_sleep+0x1b0/0x2c0) [ 45.069015] [<80160b8c>] (___might_sleep) from [<80160ebc>] (__might_sleep+0x70/0xac) [ 45.077779] r6:00000000 r5:000000ae r4:80c9b97c [ 45.082938] [<80160e4c>] (__might_sleep) from [<802a1cf8>] (__might_fault+0x48/0xb0) [ 45.091606] r6:02363388 r5:00000000 r4:ffffe000 [ 45.096756] [<802a1cb0>] (__might_fault) from [<8058d564>] (kfifo_copy_to_user+0x74/0x1dc) [ 45.106006] r5:00000020 r4:00000020 [ 45.110002] [<8058d4f0>] (kfifo_copy_to_user) from [<8058dc04>] (__kfifo_to_user+0x58/0x78) [ 45.119340] r9:848ea000 r8:02363388 r7:00000020 r6:848ebe90 r5:00000020 r4:8231dcf0 [ 45.127992] [<8058dbac>] (__kfifo_to_user) from [<8060fc40>] (aspeed_mbox_read+0xe0/0x2d8) [ 45.137242] r7:848ebe90 r6:8231dd04 r5:200f0013 r4:00000020 [ 45.143567] [<8060fb60>] (aspeed_mbox_read) from [<802d6024>] (vfs_read+0xc0/0x320) [ 45.152149] r10:00000003 r9:848ea000 r8:8060fb60 r7:00000020 r6:00000001 r5:848ebf68 [ 45.160897] r4:848a9b40 [ 45.163727] [<802d5f64>] (vfs_read) from [<802d6e04>] (ksys_read+0x70/0xf4) [ 45.171529] r10:00000003 r9:848ea000 r8:80100224 r7:00000000 r6:00000000 r5:848a9b40 [ 45.180277] r4:848a9b40 [ 45.183108] [<802d6d94>] (ksys_read) from [<802d6ea0>] (sys_read+0x18/0x1c) [ 45.190906] r7:00000003 r6:7e9f9ad8 r5:76f26070 r4:0236357c [ 45.197229] [<802d6e88>] (sys_read) from [<80100060>] (ret_fast_syscall+0x0/0x1c) [ 45.205602] Exception stack(0x848ebfa8 to 0x848ebff0) [ 45.211258] bfa0: 0236357c 76f26070 00000009 02363388 00000020 00000000 [ 45.220401] bfc0: 0236357c 76f26070 7e9f9ad8 00000003 02366874 02363388 00000020 7e9f9b30 [ 45.229538] bfe0: 00526be4 7e9f9ab0 00504b88 76c1836c Rearrange the code to use mutex instead of spinlock to protect kifo_to_user, since we only need to serialize against other callers of aspeed_mbox_read(). Move kfifo_reset under spinlock to satisfy kfifo locking rules. Remove redundant MBX_USE_INTERRUPT. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Change-Id: I4b3fc32d65f2614bec92460bda55daded99e096d
2021-12-15soc: aspeed: espi-slave: Avoid calling put_user in atomic contextIwona Winiarska1-24/+20
put_user() can sleep, which means that calling it in atomic context can cause deadlock. aspeed-espi-slave is calling it under spin_lock_irqsave(), resulting in the following lockdep splat: [ 18.796723] BUG: sleeping function called from invalid context at drivers/soc/aspeed/aspeed-espi-slave.c:309 [ 18.807742] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 311, name: host-misc-manag [ 18.817486] INFO: lockdep is turned off. [ 18.821869] irq event stamp: 0 [ 18.825289] hardirqs last enabled at (0): [<00000000>] 0x0 [ 18.831551] hardirqs last disabled at (0): [<8011ed40>] copy_process+0x7b0/0x1be8 [ 18.839941] softirqs last enabled at (0): [<8011ed40>] copy_process+0x7b0/0x1be8 [ 18.848308] softirqs last disabled at (0): [<00000000>] 0x0 [ 18.854538] CPU: 0 PID: 311 Comm: host-misc-manag Not tainted 5.15.0-14fcc87-dirty-7b64388 #1 [ 18.864070] Hardware name: Generic DT based system [ 18.869421] Backtrace: [ 18.872155] [<80a48ec4>] (dump_backtrace) from [<80a492a8>] (show_stack+0x20/0x24) [ 18.880638] r7:0242c06c r6:00000080 r5:80cb88f4 r4:600d0093 [ 18.886969] [<80a49288>] (show_stack) from [<80a5596c>] (dump_stack_lvl+0x60/0x78) [ 18.895440] [<80a5590c>] (dump_stack_lvl) from [<80a5599c>] (dump_stack+0x18/0x1c) [ 18.903907] r7:0242c06c r6:00000135 r5:80d0a958 r4:8ffc2000 [ 18.910226] [<80a55984>] (dump_stack) from [<80160d3c>] (___might_sleep+0x1b0/0x2c0) [ 18.918901] [<80160b8c>] (___might_sleep) from [<80160ebc>] (__might_sleep+0x70/0xac) [ 18.927818] r6:00000000 r5:00000135 r4:80d0a958 [ 18.933024] [<80160e4c>] (__might_sleep) from [<802a1cf8>] (__might_fault+0x48/0xb0) [ 18.941690] r6:8238da58 r5:00000000 r4:ffffe000 [ 18.946848] [<802a1cb0>] (__might_fault) from [<8060ed78>] (aspeed_espi_pltrstn_read+0xac/0x254) [ 18.956679] r5:8238da80 r4:ffffe000 [ 18.960669] [<8060eccc>] (aspeed_espi_pltrstn_read) from [<802d6024>] (vfs_read+0xc0/0x320) [ 18.970011] r10:00000003 r9:8ffc2000 r8:8060eccc r7:00000001 r6:00000001 r5:8ffc3f68 [ 18.978754] r4:84eb48c0 [ 18.981582] [<802d5f64>] (vfs_read) from [<802d6e04>] (ksys_read+0x70/0xf4) [ 18.989378] r10:00000003 r9:8ffc2000 r8:80100224 r7:00000000 r6:00000000 r5:84eb48c0 [ 18.998122] r4:84eb48c0 [ 19.000946] [<802d6d94>] (ksys_read) from [<802d6ea0>] (sys_read+0x18/0x1c) [ 19.008735] r7:00000003 r6:7ec07a00 r5:76fc3070 r4:0242c220 [ 19.015055] [<802d6e88>] (sys_read) from [<80100060>] (ret_fast_syscall+0x0/0x1c) [ 19.023419] Exception stack(0x8ffc3fa8 to 0x8ffc3ff0) [ 19.029063] 3fa0: 0242c220 76fc3070 00000007 0242c06c 00000001 00000000 [ 19.038196] 3fc0: 0242c220 76fc3070 7ec07a00 00000003 0242c23c 0242c06c 00000001 00000000 [ 19.047330] 3fe0: 00446be4 7ec079d8 00424b88 76cb536c Rearrange the code to avoid calling *_user() function under spin_lock. Also, use the regular *_irq() variant instead if *_irqsave(), since it's only used for serializing process context with IRQ handler. Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Change-Id: Iaf17ddd17c020c8ee8c60c2fc98a57b97133e7a6
2021-11-26Merge tag 'v5.15.5' into dev-5.15Joel Stanley10-18/+29
This is the 5.15.5 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-11-18soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_readRobert-Ionut Alexa1-0/+1
[ Upstream commit 8120bd469f5525da229953c1197f2b826c0109f4 ] Free the kbuf buffer before returning from the dpaa2_console_read() function. The variable no longer goes out of scope, leaking the storage it points to. Fixes: c93349d8c170 ("soc: fsl: add DPAA2 console support") Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc: qcom: apr: Add of_node_put() before returnWan Jiabing1-0/+2
[ Upstream commit 72f1aa6205d84337b90b065f602a8fe190821781 ] Fix following coccicheck warning: ./drivers/soc/qcom/apr.c:485:1-23: WARNING: Function for_each_child_of_node should have of_node_put() before return Early exits from for_each_child_of_node should decrement the node reference counter. Fixes: 834735662602 ("soc: qcom: apr: Add avs/audio tracking functionality") Signed-off-by: Wan Jiabing <wanjiabing@vivo.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211014083017.19714-1-wanjiabing@vivo.com Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc: qcom: rpmhpd: fix sm8350_mxc's peer domainDmitry Baryshkov1-1/+1
[ Upstream commit 086f52fdc8f7bd273d06a3de2adf65a063eb5392 ] The sm8350_mxc's domain description incorrectly references sm8150_mmcx_ao as a peer instead of sm8350_mxc_ao. Correct this typo. Fixes: 639c85628757 ("soc: qcom: rpmhpd: Add SM8350 power domains") Cc: Vinod Koul <vkoul@kernel.org> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211020012639.1183806-1-dmitry.baryshkov@linaro.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc: qcom: socinfo: add two missing PMIC IDsDmitry Baryshkov1-2/+2
[ Upstream commit 2fae3ecc70405b72ea6c923b216d34547559d6a9 ] Add IDs for PMK8001 and PMI8996. They also fall in the list of 'duplicated' IDs, where the same index was used for multiple chips. Fixes: 7fda2b0bfbd9 ("soc: qcom: socinfo: import PMIC IDs from pmic-spmi") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211016190607.49866-1-dmitry.baryshkov@linaro.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc: qcom: rpmhpd: Make power_on actually enable the domainBjorn Andersson1-4/+14
[ Upstream commit e3e56c050ab6e3f1bd811f0787f50709017543e4 ] The general expectation is that powering on a power-domain should make the power domain deliver some power, and if a specific performance state is needed further requests has to be made. But in contrast with other power-domain implementations (e.g. rpmpd) the RPMh does not have an interface to enable the power, so the driver has to vote for a particular corner (performance level) in rpmh_power_on(). But the corner is never initialized, so a typical request to simply enable the power domain would not actually turn on the hardware. Further more, when no more clients vote for a performance state (i.e. the aggregated vote is 0) the power domain would be turned off. Fix both of these issues by always voting for a corner with non-zero value, when the power domain is enabled. The tracking of the lowest non-zero corner is performed to handle the corner case if there's ever a domain with a non-zero lowest corner, in which case both rpmh_power_on() and rpmh_rpmhpd_set_performance_state() would be allowed to use this lowest corner. Fixes: 279b7e8a62cc ("soc: qcom: rpmhpd: Add RPMh power domain driver") Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20211005033732.2284447-1-bjorn.andersson@linaro.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc/tegra: Fix an error handling path in tegra_powergate_power_up()Christophe JAILLET1-1/+1
[ Upstream commit 986b5094708e508baa452a23ffe809870934a7df ] If an error occurs after a successful tegra_powergate_enable_clocks() call, it must be undone by a tegra_powergate_disable_clocks() call, as already done in the below and above error handling paths of this function. Update the 'goto' to branch at the correct place of the error handling path. Fixes: a38045121bf4 ("soc/tegra: pmc: Add generic PM domain support") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc: qcom: llcc: Disable MMUHWT retentionNaina Mehta1-1/+1
[ Upstream commit 3a461009e195c3c17f6af73da310b886991309fd ] Disable MMUHWT retention for SC7280 as done for other platforms to avoid more power burn. Fixes: f6a07be63301 ("soc: qcom: llcc: Add configuration data for SC7280") Signed-off-by: Naina Mehta <nainmeht@codeaurora.org> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20210921055942.30600-1-saiprakash.ranjan@codeaurora.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18soc: fsl: dpio: use the combined functions to protect critical zoneMeng Li1-6/+3
commit dc7e5940aad6641bd5ab33ea8b21c4b3904d989f upstream. In orininal code, use 2 function spin_lock() and local_irq_save() to protect the critical zone. But when enable the kernel debug config, there are below inconsistent lock state detected. ================================ WARNING: inconsistent lock state 5.10.63-yocto-standard #1 Not tainted -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. lock_torture_wr/226 [HC0[0]:SC1[5]:HE1:SE0] takes: ffff002005b2dd80 (&p->access_spinlock){+.?.}-{3:3}, at: qbman_swp_enqueue_multiple_mem_back+0x44/0x270 {SOFTIRQ-ON-W} state was registered at: lock_acquire.part.0+0xf8/0x250 lock_acquire+0x68/0x84 _raw_spin_lock+0x68/0x90 qbman_swp_enqueue_multiple_mem_back+0x44/0x270 ...... cryptomgr_test+0x38/0x60 kthread+0x158/0x164 ret_from_fork+0x10/0x38 irq event stamp: 4498 hardirqs last enabled at (4498): [<ffff800010fcf980>] _raw_spin_unlock_irqrestore+0x90/0xb0 hardirqs last disabled at (4497): [<ffff800010fcffc4>] _raw_spin_lock_irqsave+0xd4/0xe0 softirqs last enabled at (4458): [<ffff8000100108c4>] __do_softirq+0x674/0x724 softirqs last disabled at (4465): [<ffff80001005b2a4>] __irq_exit_rcu+0x190/0x19c other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&p->access_spinlock); <Interrupt> lock(&p->access_spinlock); *** DEADLOCK *** So, in order to avoid deadlock, use the combined functions spin_lock_irqsave/spin_unlock_irqrestore() to protect critical zone. Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue") Cc: stable@vger.kernel.org Signed-off-by: Meng Li <Meng.Li@windriver.com> Signed-off-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-18soc: fsl: dpio: replace smp_processor_id with raw_smp_processor_idMeng Li1-1/+1
commit e775eb9fc2a4107f03222fa48bc95c2c82427e64 upstream. When enable debug kernel configs,there will be calltrace as below: BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1 caller is debug_smp_processor_id+0x20/0x30 CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.10.63-yocto-standard #1 Hardware name: NXP Layerscape LX2160ARDB (DT) Call trace: dump_backtrace+0x0/0x1a0 show_stack+0x24/0x30 dump_stack+0xf0/0x13c check_preemption_disabled+0x100/0x110 debug_smp_processor_id+0x20/0x30 dpaa2_io_query_fq_count+0xdc/0x154 dpaa2_eth_stop+0x144/0x314 __dev_close_many+0xdc/0x160 __dev_change_flags+0xe8/0x220 dev_change_flags+0x30/0x70 ic_close_devs+0x50/0x78 ip_auto_config+0xed0/0xf10 do_one_initcall+0xac/0x460 kernel_init_freeable+0x30c/0x378 kernel_init+0x20/0x128 ret_from_fork+0x10/0x38 Based on comment in the context, it doesn't matter whether preemption is disable or not. So, replace smp_processor_id() with raw_smp_processor_id() to avoid above call trace. Fixes: c89105c9b390 ("staging: fsl-mc: Move DPIO from staging to drivers/soc/fsl") Cc: stable@vger.kernel.org Signed-off-by: Meng Li <Meng.Li@windriver.com> Signed-off-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-18soc: samsung: exynos-pmu: Fix compilation when nothing selects CONFIG_MFD_COREDavid Virag1-0/+1
commit e37ef6dcdb1f4738b01cec7fb7be46af07816af9 upstream. Commit 93618e344a5e ("soc: samsung: exynos-pmu: instantiate clkout driver as MFD") adds a "devm_mfd_add_devices" call in the exynos-pmu driver which depends on CONFIG_MFD_CORE. If no driver selects that config, the build will fail if CONFIG_EXYNOS_PMU is enabled with the following error: drivers/soc/samsung/exynos-pmu.c:137: undefined reference to `devm_mfd_add_devices' Fix this by making CONFIG_EXYNOS_PMU select CONFIG_MFD_CORE. Fixes: 93618e344a5e ("soc: samsung: exynos-pmu: instantiate clkout driver as MFD") Cc: <stable@vger.kernel.org> Signed-off-by: David Virag <virag.david003@gmail.com> Link: https://lore.kernel.org/r/20210909222812.108614-1-virag.david003@gmail.com Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>