HPASS (high-performance audio subsystem) is a distinct hardware block
from the LPASS-class ADSP, described in the devicetree with its own
"hpass" label. Depending on the firmware image it loads, an HPASS
domain can run either an audio image or a compute image. When it runs
a compute image it offloads user compute workloads and therefore
needs a non-secure node for unsigned PD offload, in addition to the
secure node; an audio image needs only the secure node.

The image type is reported by the DSP in its capability attributes,
which are now queried at probe time. Use that cached capability: when
an audio-PD domain reports a compute image, register both the secure
and non-secure nodes and enable unsigned PD support. When the
capability query did not complete, retain the existing domain-id based
gating.

Signed-off-by: Anandu Krishnan E <[email protected]>
---
 drivers/misc/fastrpc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 59ef755feeaf..eb107d0f2bc2 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -88,6 +88,14 @@
 #define FASTRPC_MAX_DSP_ATTRIBUTES (256)
 #define FASTRPC_MAX_DSP_ATTRIBUTES_LEN (sizeof(u32) * 
FASTRPC_MAX_DSP_ATTRIBUTES)
 
+/* remote_dsp_attributes[] index reporting the DSP's image configuration */
+#define DSP_IMAGE_CONFIG_ATTR_IDX (14)
+
+/* enum dsp_image_config: values reported at DSP_IMAGE_CONFIG_ATTR_IDX */
+#define FASTRPC_DSP_COMPUTE            (1)
+#define FASTRPC_DSP_COMPUTE_LITE       (2)
+#define FASTRPC_DSP_AUDIO              (3)
+
 /* Retrives number of input buffers from the scalars parameter */
 #define REMOTE_SCALARS_INBUFS(sc)      (((sc) >> 16) & 0x0ff)
 
@@ -2713,12 +2721,22 @@ static int fastrpc_register_devices(struct 
fastrpc_channel_ctx *cctx,
 {
        struct device *rdev = &rpdev->dev;
        int err, i;
+       bool compute_lite = false;
+
+       /* An audio-PD domain (e.g. HPASS) running a compute image also
+        * needs an unsigned PD node, same as CDSP/GDSP.
+        */
+       if (cctx->valid_attributes &&
+           cctx->dsp_attributes[DSP_IMAGE_CONFIG_ATTR_IDX] == 
FASTRPC_DSP_COMPUTE_LITE)
+               compute_lite = true;
 
        switch (cctx->domain_id) {
        case ADSP_DOMAIN_ID:
        case MDSP_DOMAIN_ID:
        case SDSP_DOMAIN_ID:
        case HPASS_DOMAIN_ID:
+               if (compute_lite)
+                       goto unsigned_capable;
                cctx->unsigned_support = false;
                err = fastrpc_device_register(rdev, cctx, cctx->secure, 
cctx->domain);
                if (err)
@@ -2726,6 +2744,7 @@ static int fastrpc_register_devices(struct 
fastrpc_channel_ctx *cctx,
                break;
        case CDSP_DOMAIN_ID:
        case GDSP_DOMAIN_ID:
+unsigned_capable:
                cctx->unsigned_support = true;
                err = fastrpc_device_register(rdev, cctx, true, cctx->domain);
                if (err)

-- 
2.34.1

Reply via email to