From nobody Wed Apr 15 16:02:29 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 628FE390234 for ; Wed, 4 Mar 2026 13:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772629659; cv=none; b=Vw1zs8L9q95CwdUdKQWuFfptYEhEh0XjmSppB5PTUQNkZnHh7HDbs3r7kvBMKddMncO0i5lM89KOvW+3U1xxnzEfmg5ffbwCRoyAQl4IfbkEh161L9iAwdpetoVpvmBZIWM+bUouv5kD+4mqKoInpgWwkOjSe/nb+qayAECxP2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772629659; c=relaxed/simple; bh=VyhmcmdCocO/mXPDB+OqytJYIreg7wlJAag5CLmUSxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hXyZzZwIxDbVKeTzgvlbPYP4G7BF84pUzPv0yQG3BKPq20EO2PQPI4XQyI9ZBbGIDsVekhOTntWeHCPbpHTl52hk7QFRLUM3dJRtBJVPGBF5/C88kPuhUjzyWQU29OMzWcEC/g3myWPiA76sZSmbAzkbhFe930aJXHc4lCoGGNY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=F/SaP/W2; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Gt2aVQCB; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="F/SaP/W2"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Gt2aVQCB" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 624CxeC91203427 for ; Wed, 4 Mar 2026 13:07:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=XJegSL9SyIW 8NkmReRK6OuDLMZtYbsuyhgigi3fazVM=; b=F/SaP/W28w6nfKb1AW+JcTbv0bn zLI/5PE1pqdGw+LTKTmuODoDAXq5iO4Kl0kWyd6JkhjgDObOcyDEwMkI1a1JSA9Z qY2UNPGWcShbiJUBLM3eYvfgCqlTUgPDWwSyhiFWYXG4gDrs1oKa88BFiUFzyDgF WJeypmJXw4lg1mo8bq1v9emyO89ITzuOPDcwzFHUnayqOPjmxSUB+RPuStT5xP8Y 97YIpTx+0B1bdWBzUU2dP5ad2LtFxrSeA/aEXfkslM04iW+m33CKGGXQ77PZUN6t WYktLSypYHLwEbNU6WRHsC+cBXnNeuNefueB0jobll0p9l8/UlbLTZDuiXw== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cpf9c1a9w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 04 Mar 2026 13:07:34 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8c71655aa11so6219909585a.3 for ; Wed, 04 Mar 2026 05:07:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772629653; x=1773234453; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XJegSL9SyIW8NkmReRK6OuDLMZtYbsuyhgigi3fazVM=; b=Gt2aVQCBXdWAD3bMRsOoisZlT9WQQirKFhegnNYIc1pbfPQLowYirt6dQTjJKvjM+D ByKb6rAeZF7gBVk1Xu7NkujU3DGEqZdyy2L8VwiNz+eD9gZNy5K+sQofdPMpsLyZqnf3 u5VHorNcU8yrvqokkfILw1Bez512Z7Rw2OC0VAXTkJL+fXj+Y+nn/H8/iqyYsNXvXcAN ucilmR33mR6Ulv5Xy0aGf5NxshvVkzSgUq9sdnfmsL5UEGpCFetWIVFnXVt06hgekHmH X2ULhDusE2rurUdJ5w3RRaCPrNj3Q7UnM/Fo0hYGHDqBC8wA5h/x8zEIaFS+U9KafLYQ v7wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772629653; x=1773234453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XJegSL9SyIW8NkmReRK6OuDLMZtYbsuyhgigi3fazVM=; b=E/4pbZtfqUgUkbyDLvXmvoIvSgJp1Bz8eYhvjpm9xbtrmLesoPwVFCpKnMNVQyKfdr Gr0qAVECeZtg5sNPN3xt2c6bzScIDh3mNV8ePP2WXXFrpA83DJFRkMmdlrYRtKevVt5M ukaHqoa9YqmWY6fkCe828cFnlPlOvzBNbUQSqn/Av83TUuDcpxEDCjXryDENuu7B46qW hk2YnyfzGN4h5lx32n4JTgc1zvUmdQsLxn3fyySYiBLTFsOs0JA8sN95f97SMjqzV0jV 8n5woTkCjH0g78zAdXIhbxX7BW0HPk9hFUmZekj4J0WGZBZnAfsQAGp83+jTxU1ZioXU IKHw== X-Forwarded-Encrypted: i=1; AJvYcCVgBLw/hSx94Uam5BUimpUtB+ggxSthgvr9GHM1xg4tQjBMGkRuw/0y3uBGceLAqH3KeM6J1fhtXXEewx8=@vger.kernel.org X-Gm-Message-State: AOJu0YxGHjzcmfNFxpkS0pu54LqoiGEGGG06JmP6DL15v1r3YfyBXc// YfgoL6qDIGvIludl57wCjbffMLw7THOrZue8gKd27l15G2zee3cBMDb6+HcAhGVE3HE/XT9XO2m BAp5cKPtxCtnOfY/yEA8ShlCAENnHST/XZo1Ug6gDyPv3vPZ1WVuFza0v+Y06d7/jzAU= X-Gm-Gg: ATEYQzyGQB4XnT5Ft63OdK4G5HLVEiT55lbfGf3fBRNLuFNczVq/e9UtaEbihnSo+Ns ust/3Ef79Hq+CWg8WjshX2hVx7xJBEJHBwcbioRfIlYbLQ7ahESGcO+YYIjubEKddJ8yBFCgXiX V3kK/sWu40nkA0A1hl6SkjeGcB8qtvI3SLr9y8Jl+AjaTl1kk2ymN7wg2dfZCcYMC+7tnUo3bX5 jve/i0CfL7kbGcOYLiJrnUU5SQbolunLfRl0qJ2mz2t+6RG4fKYwxUSKFMzRXWWKyRjYz0Z8RA7 zjx9YM/htEzC4CuSjY6aTW3NShBQ7OhYu7AHHpurFd5PSh/L7WUUZB3aWf3vRUL6CfuVySk/9HB 4zBigEPfliLOBzYRAUaeamBhxwsEMnDlSeBDFCikQAn0uUHoJau0RNhg= X-Received: by 2002:a05:620a:2a05:b0:8b2:2066:ffca with SMTP id af79cd13be357-8cd5afe90e4mr174418985a.82.1772629653407; Wed, 04 Mar 2026 05:07:33 -0800 (PST) X-Received: by 2002:a05:620a:2a05:b0:8b2:2066:ffca with SMTP id af79cd13be357-8cd5afe90e4mr174412685a.82.1772629652898; Wed, 04 Mar 2026 05:07:32 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485188122a6sm49969745e9.12.2026.03.04.05.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 05:07:32 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, srini@kernel.org, Srinivas Kandagatla Subject: [PATCH v3 13/14] ASoC: qcom: qdsp6: remove search for module iid in hot path Date: Wed, 4 Mar 2026 13:07:11 +0000 Message-ID: <20260304130712.222246-14-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260304130712.222246-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260304130712.222246-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA0MDEwNSBTYWx0ZWRfX9KoudWYjjC6B g8SOxGy1B+Y98aLONZ3mvaOgF1IZepJSyBoPvVOZ+obMd9te9hRbt3ERRonrTsMTRF2V6j5NkWW mH4Q+aboMFBLz0REzH8CYpVrPYqML9Xymr/gDOYHaHhy55PPJRGyyw5FdeePFORbX7d+0JKEaMj 7iFx98nfzKPdslL15C5+Qqsjz/yxFxCrVkjmDvxPuOLegtLgGzPHjnGSrz9H99YtVC5+/rAgvCv Wl1ahq0fjJ+NZZn0YOhXEjoEWOu+TgcKBNpIO/Ug3xiun5gFVe3sxUpJcqeXAWHi3TY4wEMa3Me qTFAt/LbKEfDT/UZmsOttqEB99Hs/Sd1PvF9AZHDZ+soYbDYGnRq8/XeJO7zTCMauUgavaZX1h/ 9fx7jkm89dymS3qvkRNdSsaUtT0ahBLAOGr+vC50F+lY7f1APqAtp/Lfl0wsNnEVuDtZC+cyquA t0wIzRofdxYcl+iv0eQ== X-Proofpoint-GUID: iq0OAybPjYKym05j7eSKZMnEmVJu3X7p X-Authority-Analysis: v=2.4 cv=S4LUAYsP c=1 sm=1 tr=0 ts=69a82e96 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=Ll4dbTg5roZnn8cDlSAA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-ORIG-GUID: iq0OAybPjYKym05j7eSKZMnEmVJu3X7p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-04_06,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 impostorscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 clxscore=1015 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603040105 Content-Type: text/plain; charset="utf-8" Remove searching for Shared Memory module instance id on every read/write call, this is un-necessary if we can cache the shared memory module instance id per PCM graph. Add new member to graph struct to store shared memory module instance id to avoid searching for this in hot path. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-dai.c | 5 +++-- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 4 ++-- sound/soc/qcom/qdsp6/q6apm.c | 14 +++++++++----- sound/soc/qcom/qdsp6/q6apm.h | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 3eff45b241c9..bdd4cc458acd 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -355,7 +355,7 @@ static int q6apm_dai_open(struct snd_soc_component *com= ponent, =20 spin_lock_init(&prtd->lock); prtd->substream =3D substream; - prtd->graph =3D q6apm_graph_open(dev, event_handler, prtd, graph_id); + prtd->graph =3D q6apm_graph_open(dev, event_handler, prtd, graph_id, subs= tream->stream); if (IS_ERR(prtd->graph)) { dev_err(dev, "%s: Could not allocate memory\n", __func__); ret =3D PTR_ERR(prtd->graph); @@ -496,7 +496,8 @@ static int q6apm_dai_compr_open(struct snd_soc_componen= t *component, return -ENOMEM; =20 prtd->cstream =3D stream; - prtd->graph =3D q6apm_graph_open(dev, event_handler_compr, prtd, graph_id= ); + prtd->graph =3D q6apm_graph_open(dev, event_handler_compr, prtd, graph_id, + SNDRV_PCM_STREAM_PLAYBACK); if (IS_ERR(prtd->graph)) { ret =3D PTR_ERR(prtd->graph); kfree(prtd); diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6= /q6apm-lpass-dais.c index 70e283671f43..aceb2ac9bac8 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -203,7 +203,7 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_subst= ream *substream, struct s * graph, so sequence for playback and capture will be different */ if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK && dai_data->graph= [dai->id] =3D=3D NULL) { - graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); + graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id, substream= ->stream); if (IS_ERR(graph)) { dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); rc =3D PTR_ERR(graph); @@ -240,7 +240,7 @@ static int q6apm_lpass_dai_startup(struct snd_pcm_subst= ream *substream, struct s int graph_id =3D dai->id; =20 if (substream->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) { - graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); + graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id, substream= ->stream); if (IS_ERR(graph)) { dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); return PTR_ERR(graph); diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index f190ad5e912a..7ef6ae0b1759 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -411,12 +411,11 @@ int q6apm_write_async(struct q6apm_graph *graph, uint= 32_t len, uint32_t msw_ts, { struct apm_data_cmd_wr_sh_mem_ep_data_buffer_v2 *write_buffer; struct audio_buffer *ab; - int iid =3D q6apm_graph_get_rx_shmem_module_iid(graph); =20 struct gpr_pkt *pkt __free(kfree) =3D audioreach_alloc_pkt(sizeof(*write_= buffer), DATA_CMD_WR_SH_MEM_EP_DATA_BUFFER_V2, graph->rx_data.dsp_buf | (len << APM_WRITE_TOKEN_LEN_SHIFT), - graph->port->id, iid); + graph->port->id, graph->shm_iid); if (IS_ERR(pkt)) return PTR_ERR(pkt); =20 @@ -449,11 +448,10 @@ int q6apm_read(struct q6apm_graph *graph) struct data_cmd_rd_sh_mem_ep_data_buffer_v2 *read_buffer; struct audioreach_graph_data *port; struct audio_buffer *ab; - int iid =3D q6apm_graph_get_tx_shmem_module_iid(graph); =20 struct gpr_pkt *pkt __free(kfree) =3D audioreach_alloc_pkt(sizeof(*read_b= uffer), DATA_CMD_RD_SH_MEM_EP_DATA_BUFFER_V2, - graph->tx_data.dsp_buf, graph->port->id, iid); + graph->tx_data.dsp_buf, graph->port->id, graph->shm_iid); if (IS_ERR(pkt)) return PTR_ERR(pkt); =20 @@ -604,7 +602,7 @@ static int graph_callback(const struct gpr_resp_pkt *da= ta, void *priv, int op) } =20 struct q6apm_graph *q6apm_graph_open(struct device *dev, q6apm_cb cb, - void *priv, int graph_id) + void *priv, int graph_id, int dir) { struct q6apm *apm =3D dev_get_drvdata(dev->parent); struct audioreach_graph *ar_graph; @@ -631,6 +629,12 @@ struct q6apm_graph *q6apm_graph_open(struct device *de= v, q6apm_cb cb, graph->id =3D ar_graph->id; graph->dev =3D dev; =20 + if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) + graph->shm_iid =3D q6apm_graph_get_rx_shmem_module_iid(graph); + else + graph->shm_iid =3D q6apm_graph_get_tx_shmem_module_iid(graph); + + mutex_init(&graph->lock); init_waitqueue_head(&graph->cmd_wait); =20 diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 5cf538397841..7c646ffcf956 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -99,6 +99,7 @@ struct q6apm_graph { void *priv; q6apm_cb cb; uint32_t id; + uint32_t shm_iid; struct device *dev; struct q6apm *apm; gpr_port_t *port; @@ -113,7 +114,7 @@ struct q6apm_graph { =20 /* Graph Operations */ struct q6apm_graph *q6apm_graph_open(struct device *dev, q6apm_cb cb, - void *priv, int graph_id); + void *priv, int graph_id, int dir); int q6apm_graph_close(struct q6apm_graph *graph); int q6apm_graph_prepare(struct q6apm_graph *graph); int q6apm_graph_start(struct q6apm_graph *graph); --=20 2.47.3