From nobody Mon Feb 9 16:17:00 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 C64862F618F for ; Tue, 30 Dec 2025 06:28:41 +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=1767076123; cv=none; b=Hlg5ftfEjdgfgUKaW8OhKzmT8mwOgx0y49BvsDWO0F0LUdNtEEfCeRP7Z8QFEU4alCfTtDHoUnIfP5IycI9HrLS1efr9gWzwMsd8k3ubuLQZadu1r/bgZDY4fw6QAvpnMgJzzXIhkn8BMR2v1jUmBeiwgaxdFPOmjsDN0CTU/58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767076123; c=relaxed/simple; bh=OdLtVtiwW1xAkEP1Tuk8yBW78hA3TuPbGrqvdFREa1Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PpnxmDVMQJsAo/VKe2dcYcwUz0btng8Cy1/p9renGSTOcrqD+WFsGmbI4x+lnxbveO/AGK3K0vnvV79aoxo9YT7GN4UVDjchsnMoyf5cNNsRF7RxbHnMrvo8jzAibbwuZgepgFyl1bjfzz/73bLPsZUhJi1uFxgSXhX1TnKT2o0= 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=gQC5liGp; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=EuBkLKVc; 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="gQC5liGp"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="EuBkLKVc" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BU5RRX1898833 for ; Tue, 30 Dec 2025 06:28:41 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=p+hWMKFKc2m VbzgviX4dn/1pRPQOpQtDu/1ysXFdpkk=; b=gQC5liGpXVgNHhF4H0v7VM3rUtQ bdR7c38yZm9uTqQicj1XeDAxMNuW6N7aeO1r6yhOri4Djf0u4uurlkkfJQa4etGq lOQPdXvMUjxt7IuY5B1wnN1JyDhnR9z+wdYd6MdhwGbAkb2AX2cd2KJ2cNomXAPT +lNTBbbG+oGUjxCIZJmFZ4OdvTJZN5rFBO1a3O3Qa/lC+3tlLN7fb17rVer413JY PyKxRekNsr3iCfegm0ICPtdaPW1k1ZbNV6UPw5ZP5zcK4tYaR2j0Cw4zLyuW3j3G r+Tno1K1kOwsSOEkujnf7kib9U8B+fBss2jUXqwKuaL3bmVfNn+X47b0p/Q== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bc8ky047t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 30 Dec 2025 06:28:40 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-34c387d3eb6so8991194a91.2 for ; Mon, 29 Dec 2025 22:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767076120; x=1767680920; 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=p+hWMKFKc2mVbzgviX4dn/1pRPQOpQtDu/1ysXFdpkk=; b=EuBkLKVcsnFnvcyTf8k4CPlcWFddEBRxCAdNqhIhbEQwjNQKhMpqV/Oh37EkCwAPNE TkYd7YYT/E1q/rKg3IS7d+Z4FH8O+2mrL0gX0Odtc/KO3seYGxBlZlqP3c9fMfVRbBPX 2FC2/RfeXYG5kGxk71guCobMP06fUGloeWfenUHRUbyeHNNjnG2Agvm8+ea2KFc0U6p9 GVuhAJ0qen3kQ7JoMIMfal3kWa1xssGjNdcAcK6/zyZU6rzH74F+dktVYZsSV6crIngU MliAYJRrpV4PUm6QfeAmaaNWGEFYbEQa48wBZujiY+M6YEMQTfKI+5t0v8cVtfKtGX5V w88Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767076120; x=1767680920; 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=p+hWMKFKc2mVbzgviX4dn/1pRPQOpQtDu/1ysXFdpkk=; b=OnK/4OykO3rK0twcUCxqnPJyp4X3tTrQ0dUgsOiXdAJFUAbnSz6baxPxsQvKNquM9I KyclmUt02CFayI582GVHf0ckrs1VBXEcmXE16Rvzxszc7eK1I5V36koDYiABfHffvtcZ 29ia3863iXogy4UAWd1gYjhZxeD3Zd+P1A5sHQWwJxHyKCrNydps9JNtG/9tDCLI++Ia hE7xxxMZm62G3irPRaLNx5BAGveliM8AWQAcYrymseErhzC20vUir6j+iLi+aNBNCFcy j2koK6Aq5HhB7dcM/G/un32RVjKZ1M8aLlWFPcAe8l8Cwqczpy4uENBazhFWjNxATW0M R8Aw== X-Forwarded-Encrypted: i=1; AJvYcCWFn1tAdkwelnxkf7lmUGuBBo3aLLZSR38RjE8xl1vee6yd6Sbj8G9JAMjGbik5rN+KE3jqDVlQuwTzRF4=@vger.kernel.org X-Gm-Message-State: AOJu0YxguUHdg3yYfc9N5SyW3+nTND1sd7NOUttPBdS5YQ5EKFzcsx3h tgbYpMo56hbT9t4KU9Qx1ZTA7hukMaGyk1kTBUAk8CnjBEy4YxkmZd3I4GzazZWlTp6mUHCes2N y3a6H23KAdd72QWbf3FkKs18J8urFAOT4rr2mH6rzOCkGFSutk/2qfaGaJWpMmrMCGbI= X-Gm-Gg: AY/fxX4GBQZOU6QoKIkAY4lCJ/kXWXeKpCSueShXtRwbzJ/0cnjJEP4+/e3oMpEKsEA BSBU5ZiNzxj/WR/WSJE1bLp5lLUZZWP7vyapzEvZxYMF13t3aAjjQDUV93sNAFn8l6nKtzCKtx+ p0KwJ0e/ZvZJm8loPFPfvv1kRzSog06M806+YBi7N5jE1Ywozo1Yqqptvpflfm5np3DKVzxlgy/ XTkcP7knQEh1+9NAC4MwZQJwoiTDnkC2DZUp1hPpj5LrLvQcSAh+4pwBLOS8Z6eVC7Ct81GLigN DeyAPqQLqNJxsjd8+mWmaH7fyqOtZOBOLjYb6m71cjPMfSEFATWFO9rl74T77BhoaqNmZGJrWmT CMoNQNeJjT6WhRz3otwatC9FxxvZUC3gIZj8NlFSb5g== X-Received: by 2002:a05:6a20:2451:b0:35e:4f06:4fc6 with SMTP id adf61e73a8af0-376a81daff8mr32915501637.33.1767076120341; Mon, 29 Dec 2025 22:28:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMC8S1tcREodptdIQyyuwN5nUQy8IuK3aPyGljG7nPIvam307pIjnVBo/03fbiCYSgImk6wg== X-Received: by 2002:a05:6a20:2451:b0:35e:4f06:4fc6 with SMTP id adf61e73a8af0-376a81daff8mr32915482637.33.1767076119863; Mon, 29 Dec 2025 22:28:39 -0800 (PST) Received: from hu-ekangupt-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c1e7961b4d0sm26491536a12.5.2025.12.29.22.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Dec 2025 22:28:39 -0800 (PST) From: Ekansh Gupta To: srini@kernel.org, linux-arm-msm@vger.kernel.org Cc: gregkh@linuxfoundation.org, quic_bkumar@quicinc.com, linux-kernel@vger.kernel.org, quic_chennak@quicinc.com, dri-devel@lists.freedesktop.org, arnd@arndb.de, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com Subject: [PATCH v5 1/4] misc: fastrpc: Move fdlist to invoke context structure Date: Tue, 30 Dec 2025 11:58:28 +0530 Message-Id: <20251230062831.1195116-2-ekansh.gupta@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251230062831.1195116-1-ekansh.gupta@oss.qualcomm.com> References: <20251230062831.1195116-1-ekansh.gupta@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: AW1haW4tMjUxMjMwMDA1NyBTYWx0ZWRfX9vp9D6BQEbrZ LZ1Sm9/xhxUJuImdWee2aRqLhGw9+h42QPi28WpWTOESHDZHBe0nDS5I3KDHSVF9i0DNfSseFvh W2XXUEdkdKoEcPHJQXWT6H4MSiXB4LlR0ubx84WLoSSO/Lsd+mIgjQBSFzTKkCmWXwM0tdrHSZ3 VRA4HA55kCIIJHzAtBLWQQ00pcQXwZ7Ve5BP1gRNVMIIPTRoI/z6t6qujh+Lk06pxRK1MKJpyo4 8cGHyUuTk0TGtf5RSwH1CfeRC+b7T2LrvrsqdQio0QEW2gF3E74Aar/XtQdytR5yZX1thZsT5aK HXFjFp7hKIiy06qLjB5SPXRH9NtCU8Fujj1BvjfjCAK62ZwVpxXzQYZ0twvCwZh2s145KowDXws 0yh+Xy32pkCfqhyg6OAPWl2sLo3sJep8Oi6gMVAHMFiPYrtXgTGSPM/5bUVzklozxGTkJbc0NwY ujZz9JAOPO6WPam4IVQ== X-Proofpoint-ORIG-GUID: AKR4-JUWiYKf5H2VlX_UFYXbLskyI6-0 X-Authority-Analysis: v=2.4 cv=BuuQAIX5 c=1 sm=1 tr=0 ts=69537118 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=hRzSbfjIAxXVlyYcgJ4A:9 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-GUID: AKR4-JUWiYKf5H2VlX_UFYXbLskyI6-0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-29_07,2025-12-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512300057 Content-Type: text/plain; charset="utf-8" The fdlist is currently part of the meta buffer, computed during put_args. This leads to code duplication when preparing and reading critical meta buffer contents used by the FastRPC driver. Move fdlist to the invoke context structure to improve maintainability and reduce redundancy. This centralizes its handling and simplifies meta buffer preparation and reading logic. Signed-off-by: Ekansh Gupta --- drivers/misc/fastrpc.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index ee652ef01534..679cd8997a00 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -233,6 +233,7 @@ struct fastrpc_invoke_ctx { int pid; int client_id; u32 sc; + u64 *fdlist; u32 *crc; u64 ctxid; u64 msg_sz; @@ -987,6 +988,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_= invoke_ctx *ctx) rpra =3D ctx->buf->virt; list =3D fastrpc_invoke_buf_start(rpra, ctx->nscalars); pages =3D fastrpc_phy_page_start(list, ctx->nscalars); + ctx->fdlist =3D (u64 *)(pages + ctx->nscalars); args =3D (uintptr_t)ctx->buf->virt + metalen; rlen =3D pkt_size - metalen; ctx->rpra =3D rpra; @@ -1089,18 +1091,10 @@ static int fastrpc_put_args(struct fastrpc_invoke_c= tx *ctx, union fastrpc_remote_arg *rpra =3D ctx->rpra; struct fastrpc_user *fl =3D ctx->fl; struct fastrpc_map *mmap =3D NULL; - struct fastrpc_invoke_buf *list; - struct fastrpc_phy_page *pages; - u64 *fdlist; - int i, inbufs, outbufs, handles; + int i, inbufs; int ret =3D 0; =20 inbufs =3D REMOTE_SCALARS_INBUFS(ctx->sc); - outbufs =3D REMOTE_SCALARS_OUTBUFS(ctx->sc); - handles =3D REMOTE_SCALARS_INHANDLES(ctx->sc) + REMOTE_SCALARS_OUTHANDLES= (ctx->sc); - list =3D fastrpc_invoke_buf_start(rpra, ctx->nscalars); - pages =3D fastrpc_phy_page_start(list, ctx->nscalars); - fdlist =3D (uint64_t *)(pages + inbufs + outbufs + handles); =20 for (i =3D inbufs; i < ctx->nbufs; ++i) { if (!ctx->maps[i]) { @@ -1122,9 +1116,9 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx= *ctx, cleanup_fdlist: /* Clean up fdlist which is updated by DSP */ for (i =3D 0; i < FASTRPC_MAX_FDLIST; i++) { - if (!fdlist[i]) + if (!ctx->fdlist[i]) break; - if (!fastrpc_map_lookup(fl, (int)fdlist[i], &mmap)) + if (!fastrpc_map_lookup(fl, (int)ctx->fdlist[i], &mmap)) fastrpc_map_put(mmap); } =20 --=20 2.34.1