From nobody Tue Feb 10 09:24:47 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 707B543DA38 for ; Thu, 5 Feb 2026 17:14:30 +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=1770311670; cv=none; b=SjQpNZunqo9PY9QihD2ClAEN5Jm1sXiaS27lUxQfXnuVPcmdV01+olnnVRPIEvpcONVAsAwZQw+MEDiWwhuudBZ2ybm3HgubXDfqTnFHpwxI4tRQJrqACoasbt5tO/gYWS6rpnXZIIWXSm38oGZyMFQx4KgMvBBa6hOZr41d21k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770311670; c=relaxed/simple; bh=1o79ow1bIiOv5CRwM/ZPHhJrp0A3v74qMbYwG0K9OoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oXtVKr+kY6BRa1In+YUpSDx6ipNz0G2DJiW8LYFpY6/qNS3VnjivWlr9g4C9wAJlxeozG+e6iC/YPFh0EbYIw+eVLIXxYBQ2uogrnhGJPFHySRoH3yM/DpPRnib9MO26ioxQFT6CD8Klmy2dqJ3GUX+6WXVKtf2xy53/r8Zp5YY= 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=NL7Bf4zg; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IcWHohMF; 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="NL7Bf4zg"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IcWHohMF" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 615F7fLB2945186 for ; Thu, 5 Feb 2026 17:14:30 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=fPI1A9ucPaM cjLIVgjdmicQQNCHcfLusgVWrHdAui+Y=; b=NL7Bf4zgPthI4xf7aaJE+w05KbJ a2iV5pS3NzXYpHumzJ/olqZ6T4GPgLtF7QN8XS0UIJPPnVieyzYVZB/V5Y18s8CT xw3ONXMwyhl4/LOabidCkAqmcM/mKJVeYb5e5JZIJQ5X5pOkkov1Q3MNpLJNwxkx ki5gaFTTwIJKtuqZPdabDbDnxLxrA1m2mHjd7PGlgOAgKLEZ6m9OWsX8PAP9ktwE moQaZDGzUyblNOnRt49Nqq/BlgjMsULnkawZegzQ85MotAH1sNVMKcMojgFnU38+ Veg+8bfGR6/no35icUVXgKd35EmIe7ehSHuNp6PlQgA+CMBztv0Ey+x89Pw== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c4q55srs3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 05 Feb 2026 17:14:29 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8c70ab7f67fso481684385a.3 for ; Thu, 05 Feb 2026 09:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770311669; x=1770916469; 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=fPI1A9ucPaMcjLIVgjdmicQQNCHcfLusgVWrHdAui+Y=; b=IcWHohMFotV+7z0CYg9VbNb/dotm3VLbCf3FxLlToQSzR+xTmiTWFZax0oJQn4WkO9 CoERCILqAsQxxDXfUgHBERuSYNW2xZboASDQ/afxBDMkQoj8tkD3uRIzXgshIZBfhZ6q jTRzu/UM5P+YtybSxHDt0OUoLYeT36oCYOOaEchJ9xSBIEPDCGDm/EZ/iG22k2RG9C5n eyQDBj86gfpLQZcRrBLkBxdpUV7pZXYxBYqLn87/A6WdDBmjo//bUsFaOXGl627HH6Vc cZSgHpcy/BeISa8CdBT7Pj5IIKcqoR8MxeQb18H/GJJBsOivQJ8FaoN0IgJWGsta/vb/ 3PtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770311669; x=1770916469; 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=fPI1A9ucPaMcjLIVgjdmicQQNCHcfLusgVWrHdAui+Y=; b=P1+tI9K/OTj3mbus4f382GfeTer2jYEbzxLIGnmAyh3+QTsKfm++B+8dLL8OzCOjXo J6VvUWAaJQpixpu9ZGhmNCPLdsmGtwwN8kG/bhtihQNTfeCiJVIt7b4HcVRW7Vsu9Icg 1nEypcx6wkrLBTzBSETasLBX4MWTuI0B1DlvQWSzITLxUMDVARQOtt3+4NNN1EV/bp1f ZfN9gMCtQvoVoMgppVTtJq8YsFoSEBn5iXlzBWQ14/l3USMsPjMdbKpXKVRGxb4h/aUl 1ynlwX9vGjWWnbI0IYT9ZIE+dZar++bRZ8aCZDc+t/9B5DfabURb9GHnLn62Ajvic7/o Xd0w== X-Forwarded-Encrypted: i=1; AJvYcCWaK/N2aNNC3IvmOTVxTSgXn8/uRFiqewpJPNRYP73e5YaJsD87dnjGPsdXSKj+JSvvke+cjY5rV5QeRNE=@vger.kernel.org X-Gm-Message-State: AOJu0YzLS+vhvqZF7Rm8KRfz8HCy6RN91q1tEGr9qtsxplL1VBOck1b9 gXQD5kidwdUj/xdDyrU6hfCPxwfKFmqaD0hBm1fO0OSh51xp4csoIJfghgPc0aeyFrR9iIZcYtn qLwJm4X+zukcJZVim/uf1PrSP2l85WMQTUXqphjmAnrgb+9v8aIaIebfUoinFk8ADGi8= X-Gm-Gg: AZuq6aIwUdDL1LMLcmChm3sQUzKghxa/GbyRzKTbRWHH08BZWrnY3IgXf1/c7z/u4L4 a2UW/+M+QM1YuP3N2zKYRATWxOvNiWjjjj5SkIC5NOSTpWpzz7anKX2E+bUVTOie62q0HovphU5 mYHC9E1oDHOzmR2i26Q99mdNSnp3k0oDXvMHcDb0MewthSWETP+OhQ6+1VWaWojlE2pxz+Ylani Ow1TJ28gN+sYTA1ysUFkpsmkca1Ot5IuAdlInOZyb8/79OFBTfO1hGHUu2vkafy87Vs38owHIpN L3oUSo4PzqAof0TCMo3unQq7U2xSJ6z/CcMl/S1EJxWIBahKWwUI8/EoCq+iDnw/vY2vbKZp5SG DqQOTsnZGnImnCiGbdj1dTreLPWGPz2VxXhVIcsHtTRc= X-Received: by 2002:a05:620a:4056:b0:8ca:3c67:891c with SMTP id af79cd13be357-8ca3c679845mr595857685a.71.1770311668593; Thu, 05 Feb 2026 09:14:28 -0800 (PST) X-Received: by 2002:a05:620a:4056:b0:8ca:3c67:891c with SMTP id af79cd13be357-8ca3c679845mr595850485a.71.1770311667932; Thu, 05 Feb 2026 09:14:27 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43618057f87sm14802849f8f.21.2026.02.05.09.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 09:14:27 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, robh@kernel.org, krzk+dt@kernel.org, cnor+dt@kernel.org, srini@kernel.org, perex@perex.cz, tiwai@suse.com, alexey.klimov@linaro.org, mohammad.rafi.shaik@oss.qualcomm.com, quic_wcheng@quicinc.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 09/10] ASoC: qcom: qdsp6: remove search for module iid in hot path Date: Thu, 5 Feb 2026 12:14:10 -0500 Message-ID: <20260205171411.34908-10-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260205171411.34908-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260205171411.34908-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: AW1haW4tMjYwMjA1MDEzMCBTYWx0ZWRfX12DLfJHWDJ8y TL3+oQ2YjL4SkkrTqpBlV1XUdTxo5wLnG17SLvOG1h8TIL9SAXciUSp3QIPt4fng6wSSqbbTCIn OFz0HwJ3Nj99QQRu6lz17HST3WfKMQY+q5jPGKMo+FEkpGc5BolvxYPRDaiRpZq2v5ckPAmdwQa GZZBc//K3o/PzA4rEiwaTHsBoAO1isBcwgmJofC78vv1tkwAgOi4UHv5xE0Kwe1lK6CCouG7MbG w+g83NWd38ixZGfoEbnYo3YmuqAsAY9W/axrENWw1olIc+7G1u/+SsJyLdZnFBzQ6BQu1ICgpDY 7Rn/XVo3srfFzOk2qBnoRiQgfx9fPa8oF4g5sDD1cJ98oFKpSVhkin3iF5wvgupJvTPu5RspAwW Im/QqnP9yf1t70EEOKYW+fywUVBo5juUcugZFqrU2FmXjmu3JkMmzOdSMfO01rI7kGYZGPpE/wR iTL9P5XNkgzEeijz3WA== X-Proofpoint-ORIG-GUID: ShkV_OvoCIwmpCG8wFFKmgAVRVZYLwKm X-Proofpoint-GUID: ShkV_OvoCIwmpCG8wFFKmgAVRVZYLwKm X-Authority-Analysis: v=2.4 cv=Z6zh3XRA c=1 sm=1 tr=0 ts=6984cff5 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=Ll4dbTg5roZnn8cDlSAA:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_04,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050130 Content-Type: text/plain; charset="utf-8" Remove searching for Shared Memory module instance id on every read/write call, this is ineffecient and becomes un-necessary if we can cache the shared memory module instance id per PCM graph. Add new member to graph struct to store sharedmemory 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 87e4474d680a..94066b69b5b5 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 21624a2803a6..569ba1991992 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -202,7 +202,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); @@ -239,7 +239,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 2cfebd622be2..282ba22938e7 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 189ed8a1a60d..19e223635edf 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -98,6 +98,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; @@ -112,7 +113,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