Repository navigation
drivers: qcom: ipcc: add IPCC driver and enable for shikra - #110
pradeep-kondoju wants to merge 2 commits into
Conversation
| TEE_Result ipcc_attach(struct ipcc_handle **h __unused, | ||
| enum ipcc_protocol protocol __unused) | ||
| { | ||
| return TEE_ERROR_NOT_SUPPORTED; |
There was a problem hiding this comment.
If we really intend to use a stub, we should be returning TEE_SUCCESS and not TEE_ERROR_NOT_SUPPORTED
There was a problem hiding this comment.
My understanding is that if the driver is unsupported, clients may still invoke the APIs, and we notify them by returning an error.
There was a problem hiding this comment.
That's not the case for any downstream qcom stub driver. They return success so that execution can proceed seamlessly. If we really want to indicate to the client that the driver is unsupported, we avoid enabling compilation.
Have you checked any upstream stub driver for reference?
There was a problem hiding this comment.
I've gone with your second suggestion and dropped the stub entirely
rather than changing its return values, so the driver simply isn't compiled on
a chipset with no IPCC.
037d812 to
6b7e353
Compare
| * ipcc_core.c compiles ipcc_apply_block_cfg() unconditionally regardless, so | ||
| * these two still need a value even though this target never calls it. | ||
| */ | ||
| #define IPCC_TOP_MODE_BLOCK_OFF UL(0x0) |
There was a problem hiding this comment.
These macros are not Shikra specific. Should be shifted to ipcc_regs.h
|
|
||
| /* RPM_TZ_IPC[2:0]; three outbound bits is the hardware limit on AOP */ | ||
| #define IPCC_DIRECT_AOP_SIG0_MASK BIT32(0) | ||
| #define IPCC_DIRECT_AOP_SIG1_MASK BIT32(1) |
There was a problem hiding this comment.
Though these are specific to Shikra, do we really need to put them in a common header at top level?
They are specifically for IPCC driver consumption.
There was a problem hiding this comment.
Moved to Shikra specific config.
07c0cb3 to
05c3457
Compare
|
|
||
| /* AOP is the only client this TEE reaches on MPROC */ | ||
| static const struct ipcc_client_cfg mproc_clients[] = { | ||
| { .client = IPCC_CLIENT_AOP }, |
There was a problem hiding this comment.
I believe we have use cases were our downstream drivers TZ needs to interact with MCU and others as well in shikra if i'm not wrong apart from AOP. I remember MPROC team asking for this support on downstream. can we check if there is such requirement in OPTEE as well.
There was a problem hiding this comment.
This requires further input from the client. As of now, TZ supports HW-triggered communication between TZ and RPM. In our downstream driver, we are using the HYP lines in TZ, but it is unclear whether these are actually being utilized by the clients.
| return res; | ||
| } | ||
|
|
||
| static TEE_Result ipcc_direct_signal(struct ipcc_handle *h __unused, |
There was a problem hiding this comment.
consider renaming the APIs in this file... these seem to be AI named, losing a bit context.
| #include <util.h> | ||
|
|
||
| /* | ||
| * The controller runs one of two mechanisms for the whole block, selected by |
There was a problem hiding this comment.
Also strip down the commentary here, we have documentation repo which needs updates for our drivers, https://github.com/OP-TEE/optee_docs, pls do plan to update the required concise documentation for our drivers here.
| } | ||
|
|
||
| /* Release every line this handle still holds, across all described clients */ | ||
| static void ipcc_direct_detach(struct ipcc_handle *h) |
There was a problem hiding this comment.
are we expecting clients to invoke only detach but not attach in case of direct connect? are clients really invoking this ? ideally clients invoke deregister and i see we are already doing this free line call there as well for cleaning up. why do we need this explicitly again ?
There was a problem hiding this comment.
Agreed, this was redundant. It was a safety net in case a client called ipcc_detach() without deregistering first: the handle would be freed while its interrupt line, and the ISR's stale callback context, stayed live. Correct cleanup is the client's job, so I've removed the logic and made direct detach a no-op.
|
1d2e486 to
c096ad8
Compare
Secure-world drivers on Qualcomm SoCs need to signal other subsystems such as AOP and be notified back. That goes through the IPCC (Inter-Processor Communication Controller), which OP-TEE has no driver for. Add one exposing attach/detach, register/deregister interrupt and trigger, with a router and a direct backend picked by the controller's mode. Each chipset describes its clients and protocols in <PLATFORM_FLAVOR>/ipcc_config.c; a chipset without an IPCC leaves CFG_QCOM_IPCC unset and the driver is not built. Signed-off-by: pradeep-kondoju <skondoju@qti.qualcomm.com>
Secure-world clients on shikra need to signal AOP and receive its replies. Shikra's IPCC runs in direct mode only: TZ raises AOP via RPM_TZ_IPC[2:0] in APSS_SHARED_TZ_IPC and AOP returns on dedicated GIC lines 198-200, so wire the MPROC protocol for AOP with those three signals. Signed-off-by: pradeep-kondoju <skondoju@qti.qualcomm.com>
c096ad8 to
7bbf9e9
Compare
drivers: qcom: ipcc: enable IPCC for shikra
Secure-world clients on shikra need to signal RPM and receive its
replies. Shikra's IPCC runs in direct mode only: TZ raises RPM via
RPM_TZ_IPC[2:0] in APSS_SHARED_TZ_IPC and RPM returns on dedicated
GIC lines 198-200, so wire the MPROC protocol for RPM with those
three signals.
Signed-off-by: pradeep-kondoju skondoju@qti.qualcomm.com