Skip to content

Commit

Permalink
firmware: arm_scmi: Add core raw transmission support
Browse files Browse the repository at this point in the history
Add SCMI raw mode support which exposes a userspace interface to allow for
bare SCMI command injection and snooping from userspace.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20230118121426.492864-13-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
  • Loading branch information
freefall75 authored and sudeep-holla committed Jan 20, 2023
1 parent 0f62ed0 commit 3c3d818
Show file tree
Hide file tree
Showing 5 changed files with 1,372 additions and 2 deletions.
15 changes: 15 additions & 0 deletions drivers/firmware/arm_scmi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ config ARM_SCMI_NEED_DEBUGFS
which needs debugfs support. When selected causess the creation
of a common SCMI debugfs root directory.

config ARM_SCMI_RAW_MODE_SUPPORT
bool "Enable support for SCMI Raw transmission mode"
depends on DEBUG_FS
select ARM_SCMI_NEED_DEBUGFS
help
Enable support for SCMI Raw transmission mode.

If enabled allows the direct injection and snooping of SCMI bare
messages through a dedicated debugfs interface.
It is meant to be used by SCMI compliance/testing suites.

When enabled regular SCMI drivers interactions are inhibited in
order to avoid unexpected interactions with the SCMI Raw message
flow. If unsure say N.

config ARM_SCMI_HAVE_TRANSPORT
bool
help
Expand Down
1 change: 1 addition & 0 deletions drivers/firmware/arm_scmi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ scmi-bus-y = bus.o
scmi-core-objs := $(scmi-bus-y)

scmi-driver-y = driver.o notify.o
scmi-driver-$(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT) += raw_mode.o
scmi-transport-$(CONFIG_ARM_SCMI_HAVE_SHMEM) = shmem.o
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_MAILBOX) += mailbox.o
scmi-transport-$(CONFIG_ARM_SCMI_TRANSPORT_SMC) += smc.o
Expand Down
6 changes: 4 additions & 2 deletions drivers/firmware/arm_scmi/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,8 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,
trace_scmi_msg_dump(info->id, cinfo->id, xfer->hdr.protocol_id,
xfer->hdr.id,
xfer->hdr.type == MSG_TYPE_DELAYED_RESP ?
"DLYD" : "RESP",
(!SCMI_XFER_IS_RAW(xfer) ? "DLYD" : "dlyd") :
(!SCMI_XFER_IS_RAW(xfer) ? "RESP" : "resp"),
xfer->hdr.seq, xfer->hdr.status,
xfer->rx.buf, xfer->rx.len);

Expand Down Expand Up @@ -1045,7 +1046,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
/* Trace polled replies. */
trace_scmi_msg_dump(info->id, cinfo->id,
xfer->hdr.protocol_id, xfer->hdr.id,
"RESP",
!SCMI_XFER_IS_RAW(xfer) ?
"RESP" : "resp",
xfer->hdr.seq, xfer->hdr.status,
xfer->rx.buf, xfer->rx.len);
}
Expand Down

0 comments on commit 3c3d818

Please sign in to comment.