aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/firmware/arm_scmi/smc.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-12-21firmware: arm_scmi: Add new parameter to mark_txdoneCristian Marussi1-1/+2
Add a new xfer parameter to mark_txdone transport operation which enables the SCMI core to optionally pass back into the transport layer a reference to the xfer descriptor that is being handled. Link: https://lore.kernel.org/r/20211220195646.44498-9-cristian.marussi@arm.com Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-12-21firmware: arm_scmi: Add atomic mode support to smc transportCristian Marussi1-6/+50
Add a Kernel configuration option to enable SCMI SMC transport atomic mode operation for selected SCMI transactions and leave it as default disabled. Substitute mutex usages with busy-waiting and declare smc transport as .atomic_enabled if such Kernel configuration option is enabled. Link: https://lore.kernel.org/r/20211220195646.44498-8-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-12-21firmware: arm_scmi: Make smc support sync_cmds_completed_on_retCristian Marussi1-9/+9
Enable sync_cmds_completed_on_ret in the SMC transport descriptor and remove SMC specific .poll_done callback support since polling is bypassed when sync_cmds_completed_on_ret is set. Link: https://lore.kernel.org/r/20211220195646.44498-5-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-12-21firmware: arm_scmi: Make smc transport use common completionsCristian Marussi1-19/+20
When a completion irq is available use it and delegate command completion handling to the core SCMI completion mechanism. If no completion irq is available revert to polling, using the core common polling machinery. Link: https://lore.kernel.org/r/20211220195646.44498-3-cristian.marussi@arm.com Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-08-05firmware: arm_scmi: Add priv parameter to scmi_rx_callbackCristian Marussi1-1/+2
Add a new opaque void *priv parameter to scmi_rx_callback which can be optionally provided by the transport layer when invoking scmi_rx_callback and that will be passed back to the transport layer in xfer->priv. This can be used by transports that needs to keep track of their specific data structures together with the valid xfers. Link: https://lore.kernel.org/r/20210803131024.40280-15-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-06-08firmware: arm_scmi: Add compatibility checks for shmem nodeSudeep Holla1-0/+3
The shared memory node used for communication between the firmware and the OS should be compatible with "arm,scmi-shmem". Add the check for the same while parsing the node before fetching the memory regions. Link: https://lore.kernel.org/r/20210602073851.1005607-2-sudeep.holla@arm.com Cc: Rob Herring <robh+dt@kernel.org> Cc: Cristian Marussi <cristian.marussi@arm.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Jim Quinlan <jim2101024@gmail.com> Cc: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Tested-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2021-01-06firmware: arm_scmi: Augment SMC/HVC to allow optional interruptJim Quinlan1-1/+41
The SMC/HVC SCMI transport is modified to allow the completion of an SCMI message to be indicated by an interrupt rather than the return of the smc/hvc call. This accommodates the existing behavior of the BrcmSTB SCMI "platform". Link: https://lore.kernel.org/r/20201222145603.40192-3-jim2101024@gmail.com Signed-off-by: Jim Quinlan <jim2101024@gmail.com> [sudeep.holla: added call to reinit_completion, whitespace cleanup, dropped irrelavant info in the commit log] Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-10-12firmware: arm_scmi: Expand SMC/HVC message pool to more than oneEtienne Carriere1-1/+1
SMC/HVC can transmit only one message at the time as the shared memory needs to be protected and the calls are synchronous. However, in order to allow multiple threads to send SCMI messages simultaneously, we need a larger poll of memory. Let us just use value of 20 to keep it in sync mailbox transport implementation. Any other value must work perfectly. Link: https://lore.kernel.org/r/20201008143722.21888-4-etienne.carriere@linaro.org Fixes: 1dc6558062da ("firmware: arm_scmi: Add smc/hvc transport") Cc: Peng Fan <peng.fan@nxp.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> [sudeep.holla: reworded the commit message to indicate the practicality] Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-09-07firmware: arm_scmi: Constify static scmi-opsRikard Falkeborn1-1/+1
These are never modified, so make them const to allow the compiler to put them in read-only memory. Link: https://lore.kernel.org/r/20200906230452.33410-4-rikard.falkeborn@gmail.com Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-07-13firmware: arm_scmi: Provide a missing function param descriptionSudeep Holla1-0/+1
gcc as well as clang now produce warnings for missing kerneldoc function parameter. Fix the following W=1 kernel build warning: drivers/firmware/arm_scmi/smc.c:32: warning: Function parameter or member 'shmem_lock' not described in 'scmi_smc' Link: https://lore.kernel.org/r/20200709153155.22573-1-sudeep.holla@arm.com Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-04-20firmware: arm_scmi: Fix return error code in smc_send_messageSudeep Holla1-1/+4
SMCCC can return NOT_SUPPORTED(-1). Map it to appropriate Linux error codes namely -EOPNOTSUPP. Link: https://lore.kernel.org/r/20200417103232.6896-1-sudeep.holla@arm.com Reported-and-Tested-by:: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-04-14firmware: arm_scmi: Drop checking for shmem property in parent nodeSudeep Holla1-2/+0
The scmi protocol core driver checks for the channel availability before evaluating the shmem property. If the individual protocols don't have separate channel assigned to them, the channel alloted for the BASE protocol is reused automatically. Therefore there is no need to check for the shmem property in the parent node if it is absent in the child protocol node. Link: https://lore.kernel.org/r/20200327163654.13389-5-sudeep.holla@arm.com Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-04-14firmware: arm_scmi: Check shmem property for channel availablitySudeep Holla1-0/+5
Instead of declaring the channel availabilty unconditionally, let us check for the presence of "shmem" property and return the channel availablity accordingly. Link: https://lore.kernel.org/r/20200327163654.13389-4-sudeep.holla@arm.com Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-04-14firmware: arm_scmi: Drop empty stub for smc_mark_txdoneSudeep Holla1-5/+0
The scmi protocol core driver check for non NULL mark_txdone before invoking the same. There is no need to provide a empty stub. SMC/HVC calls are synchronous and the call return indicates the completion. Link: https://lore.kernel.org/r/20200327163654.13389-3-sudeep.holla@arm.com Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-04-14firmware: arm_scmi: Make mutex channel specificSudeep Holla1-4/+4
In order to support multiple SMC/HVC transport channels with associated shared memory, it is better to maintain the mutex per channel instead of existing global one. Move the smc_mutex into the scmi_smc structure and also rename it to shmem_lock which is more appropriate for it's use. Link: https://lore.kernel.org/r/20200327163654.13389-2-sudeep.holla@arm.com Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-04-14firmware: arm_scmi: Add smc/hvc transportPeng Fan1-0/+152
Use the value of "arm,smc-id" property from the device tree as the first argument for SMCCC call leaving all the other arguments as zero for now. There is no Rx, only Tx because of smc/hvc not support Rx. Link: https://lore.kernel.org/r/1583673879-20714-3-git-send-email-peng.fan@nxp.com Signed-off-by: Peng Fan <peng.fan@nxp.com> [sudeep.holla: reworded commit log/subject and fixed !HAVE_ARM_SMCCC build] Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>