Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794846136; b=C8RBRTyaXbtTWc3JuhwuGJIkJ2NOk7WnIWRwV5qd9jslsSj+2tq1PBQFQAEF2MO4OdMD uop5JxotvoRUQ3usJVHy22MwVeS6DxByBibcZrwqz3NHhMeHR/E7/QPPm/hx3e/x7sxgu J4imZvv2p/v1XZEia287vVdgEg7QV/0ieV5PuNoxE7vqOv5tvwwM7R4fbUhPA4QuXYBi0 O2aTVb7LdGejguJF3zVY/WItdbtsOvIibVYb04KoEnuciaSatu2Wzd4zGbaP91IotgwI9 AzQM2UPubykY8jQkUIWsnhvi4QEUi4hNdvB/xBEVHI81uOWUx5rmDGNPegjbJhbqqHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794846136; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Proofpoint-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=k5XQA/BMzueiAfY2ScGRfdX/31fwXQIQ8yG08xIXEKI=; b=Hv7nLJCUe/ZfZZn6Mp3J1u8dmQj4Yv1wl41UkXPNd78iZ1jAV5ZRzQY4zNnbtgJDBQVw tiuy3L9Nesym7298VLV9/3WvauvE71ppPveUgpi2BNO93vHCWCatFZUrXHF3ZkHi/PmP8 E1QKRXKNdAknqt/oVlCddK8Hd4FSk/d15jtVYCkDoPeUjqXlgoEw48gRU6wC6D8A5AySI 2ZhNoSmkK0/jaWD69kiu3tDn0qrCJxcJ7bNP92Mi0V2IYEEp4iTl0zUQu4qf7HDqCABaV 2MG0sw55nK5uWHH7bMmwn1mT8SKGSE8bJingBO5yj7gO6GIU90pBo7hvIllV1nFY4xQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b="iaOQbQ/V"; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=idBLOiMA; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFB55606A32A for ; Mon, 16 Nov 2026 16:22:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EFB55606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=iaOQbQ/V; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=idBLOiMA Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AGGIS9j1677077 for ; Mon, 16 Nov 2026 16:22:15 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=k5XQA/BMzue iAfY2ScGRfdX/31fwXQIQ8yG08xIXEKI=; b=iaOQbQ/VnwK28Q7DB7onLCF1Vyv PQESzDoSFO1a/4RMUY/krilKAOkTsodyyfsg7daDC6nWKq9wBQINmJI4VospHbQu v4AvglZihlgUcqU0u8uidncVsg//B3evdhwddZuDa2qW8Sl/Ydbslys2C7JihE9b Ehd4oFDFdgQGVzgVIGxsKlcnIhBP9OljwUArJxBY53yks6K/IVXxiKaBrnsV5g0V +jBey2O14f2+UkW6oAtbZttFS9buS3FX5nOhyFT0AbtX0kepV8qrBdWEXTnO2m+b 3o3dBNvbZgBtrcbRlwaXQan6GqLEDs/0yFEA3NOfdGK6LczaMljfKnoYqQw== Received: from mail-dl1-f69.google.com (mail-dl1-f69.google.com [74.125.82.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j0003hc5k-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 16 Nov 2026 16:22:14 +0000 (GMT) Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-1b3b45597c7so1916842c88.1 for ; Mon, 16 Nov 2026 08:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1794846134; x=1795450934; 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:content-type; bh=k5XQA/BMzueiAfY2ScGRfdX/31fwXQIQ8yG08xIXEKI=; b=idBLOiMAfkhXVjCCt2oOtWQV2K22SbQ94vCrOVFdEWNLgR/9Zn0MHMeKRBW5MAuUKr GFtqMH/OOsH0Q/vhhGt7X9KbQ+lhtXMqXKWeZkPVaqc871X0wNtzF0YILFycRxMP0RM1 IypFac2P+tdGIa7auuHFK6N9eP/rv1DD/yu/EAPhL21jm85IGGEvWqnTx39qvhoBEKwm E1GBU6XUI++otMmK8omq55WCxq4jxFXnKGjuQe+omGw9uyyB2e6PhZaJzHcjfklb7XLx gSg2UjdJUro6IPcGi6mi+pmRThpGzObfzzyV8S774E8HiHRF7xWN0S1R8tKRYFoXqgNm N7NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794846134; x=1795450934; 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:content-type; bh=k5XQA/BMzueiAfY2ScGRfdX/31fwXQIQ8yG08xIXEKI=; b=2Y5XGsyOzwgF2b4xrlQp7zDrjqk2qppdsaT9pWp9G/EG+9q632AgJtIDRrovNmBssg kAy3zTpNmuvwDhmsv9K+kGrfulZibs+r9PGN+/LnC+YIUmNisGljLaQFN+7QBSm34Y1s 91/pTrzzYq4vINTo/7MPzt9Nkq7azSSBo6gE07Vgm0yD5gJdfwwKIctao1yL9FLrRB6C 9euagbs49KeGan5G5TJlvHDXJMg0N3ZFDCuDs4tKBPy3sa5r2HgOUxjKe/OuZl8IGTvp ZXM3V6HKvHDequlwHa/0Fm2krFUy3kPrjwZvqx/9vfrYZ6b6JAZ8KoGMv0eylj7555LX eGCQ== X-Forwarded-Encrypted: i=1; AL+hErH/seBQzzgl+62Gh/p+3lfRj/6odBl0TGn28kMY50PbAAQBr2iHNVgRKO0XrqWrILkqeVZzzZTazlWpo3nA@vger.kernel.org X-Gm-Message-State: APuU4Z8tSWoWhxgS+xi1HENCE8ThIWKcqLswYMNrMnOkMZU1xgFFAQoD TjEWspD1PPB/XwD3hOQPJIZW9dj/5r/GapflJH2w0tgTTfq0J6JuP6YquE1jbm2/nEEVNnCxr4O NU/+s6O/7iCU8lkOLqhvUae/AahI6Ym7xL4tNQAhSXPvouLZksZhAqQLaQRcSLKg0gQ8t X-Gm-Gg: AYBFou2gW5n++J/sk5c5uUFoH8/vsFGLT0wjli2CpETIH99Of1Kze3+mRjh2ukPtQdy WMU/nvX65EqEGjRbpZToz53MsC4qJNkx/BVU4HG0kFLf3OkaeWCLlj38Y0Hq/JjopqBSDi8RFl4 4fQLzqLqDRgdF9M2ZVBq4F6V4Fn/ND5LV9OC06nMNaHmjd6wvQyC9UaRcZ5nkeGiL6iZwExpe1C Hr2t7AL1YxWbOYdLz7yUtYUXpNmiAPL82yRZHXVYbwjvm1Om4E2mNbfa+eIWEHjypP6xwoc2Z3B VY30+4L06IrMEL+v9MQII0wni5qErlXXtgm43JGW0/BEI74lXdlmYbF11PWCpjlLW+jjGaz1rzc kWdwNgCrmdQW4Fp9cD5tItiSRV4eeSSe+FYWXu4gq7iOTnQz6CRmGe8/5bGeo6I73fxmuV3JtE5 eu X-Received: by 2002:a05:7023:a4b:20b0:149:1feb:6d9d with SMTP id a92af1059eb24-1b5030fb74emr12065928c88.19.1794846133662; Mon, 16 Nov 2026 08:22:13 -0800 (PST) X-Received: by 2002:a05:7023:a4b:20b0:149:1feb:6d9d with SMTP id a92af1059eb24-1b5030fb74emr12065862c88.19.1794846132861; Mon, 16 Nov 2026 08:22:12 -0800 (PST) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5031468b7sm38623826c88.5.2026.11.16.08.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 08:22:12 -0800 (PST) From: Mukesh Ojha To: Sumit Garg , Bjorn Andersson , Konrad Dybcio , Rob Clark , Dmitry Baryshkov , David Airlie , Simona Vetter , Vikash Garodia , Dikshita Agarwal , "Bryan O'Donoghue" , Mauro Carvalho Chehab , Alex Elder , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jeff Johnson , Mathieu Poirier Cc: Abel Vesa , Sean Paul , Akhil P Oommen , Abhinav Kumar , Jessica Zhang , Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha , Alex Elder Subject: [PATCH v3 1/9] firmware: qcom: pas: add qcom_pas_context_init() for pre-allocated context Date: Mon, 16 Nov 2026 21:51:40 +0530 Message-ID: <20261116162148.2864501-2-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261116162148.2864501-1-mukesh.ojha@oss.qualcomm.com> References: <20261116162148.2864501-1-mukesh.ojha@oss.qualcomm.com> X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: 9OHHQa4_UI6a3AeRoKywqqUDnk4Nx-cT X-Proofpoint-Spam-Info: AW1haW4tMjYxMTE2MDA2NCBTYWx0ZWRfX3zbNuazczYc6 6SK3L4MGSsQ1E0zA/a7o3uVVULv6OZDqHrnM504bclu7OaQ9yPOz0x9alhiDsjxr0bzwiYEoOPk Mq8l1iqGD/qtPOJPwIzlZ2eoeyO8pPs= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTE2MDA2NCBTYWx0ZWRfX7Ga0LnrQoa23 AEnpJtNr4JWP+IVTh5mI/p4EhTIQHO8Pciyw6D5rGs6wH97HkaMDNG3Bm/5qwxJkKSFeE2DEusQ yI271sief+67u62hE+9+WbooXt8QArsu+omqyAzL8JYeIk1UNzUQ1H6rIoRyYSmilsiuaP0qTv9 8IXy9eJzPS2/t3AU7Qu2khceOaJZfbyzI+0PvZ2J/6isEADMjbD5DgBbgE6oF1oDKrb+EUbqKOL PVcst8+sqvaN/PGMKpyOwo8lLhPyjRAcsHAzA+wQb/D204mdqokIa9PUsH+wm0X2sKmYz2JcxAm iA7QzuSAVyOBm9f4+mYo630r2Llftxmvbd3NbulES1O/4LvrjsJq9fjo5Ie4dI/nK621Jn/t3wg ZlaeNLdW7yoQs8h3RavakNeZvSQeXzDayDZanrY+W4dW4mFIaKRAf3aqLnKRfG9zyYHuRC3CyXJ y8QiPSmS+FN/gEQB6mg== X-Authority-Analysis: v=2.4 cv=Z4N5j3RA c=1 sm=1 tr=0 ts=6afb2db6 cx=c_pps a=kVLUcbK0zfr7ocalXnG1qA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=ee_2aqc6AAAA:8 a=EUspDBNiAAAA:8 a=A8JJMgtFIkyHT4jqAlUA:9 a=vr4QvYf-bLy2KjpDp97w:22 a=VOpmJXOdbJOWo2YY3GeN:22 X-Proofpoint-ORIG-GUID: 9OHHQa4_UI6a3AeRoKywqqUDnk4Nx-cT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-16_05,2026-11-16_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 malwarescore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611160064 devm_qcom_pas_context_alloc() allocates and initializes a struct qcom_pas_context using devres. Several callers, however, either live entirely on the stack (short-lived helper functions) or embed the context in a larger structure that is already managed by other means. Forcing those callers through the devm allocation path is wasteful and, in the case of functions called on every power cycle, causes a devres entry to accumulate on every invocation. Add qcom_pas_context_init() that initializes a caller-supplied struct qcom_pas_context in place using memset + field assignment, with no allocation at all. Rework devm_qcom_pas_context_alloc() to delegate to qcom_pas_context_init() after the kzalloc, so both helpers share the same initialization logic. Update the kernel-doc for qcom_mdt_pas_load() to reflect that the PAS context may now be initialized by either qcom_pas_context_init() or devm_qcom_pas_context_alloc(). Signed-off-by: Alex Elder Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_pas.c | 26 ++++++++++++++++++++++---- drivers/soc/qcom/mdt_loader.c | 4 ++-- include/linux/firmware/qcom/qcom_pas.h | 2 ++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/qcom/qcom_pas.c b/drivers/firmware/qcom/qcom_pas.c index d74dd7b4f332..fdf62003fbf1 100644 --- a/drivers/firmware/qcom/qcom_pas.c +++ b/drivers/firmware/qcom/qcom_pas.c @@ -14,6 +14,27 @@ static struct qcom_pas_ops *ops_ptr; +/** + * qcom_pas_context_init() - Initialize a peripheral authentication service + * context for a given peripheral + * + * @ctx: Caller-provided PAS context to initialize + * @dev: PAS firmware device + * @pas_id: peripheral authentication service id + * @mem_phys: Subsystem reserve memory start address + * @mem_size: Subsystem reserve memory size + */ +void qcom_pas_context_init(struct qcom_pas_context *ctx, struct device *dev, + u32 pas_id, phys_addr_t mem_phys, size_t mem_size) +{ + memset(ctx, 0, sizeof(*ctx)); + ctx->dev = dev; + ctx->pas_id = pas_id; + ctx->mem_phys = mem_phys; + ctx->mem_size = mem_size; +} +EXPORT_SYMBOL_GPL(qcom_pas_context_init); + /** * devm_qcom_pas_context_alloc() - Allocate peripheral authentication service * context for a given peripheral @@ -39,10 +60,7 @@ struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev, if (!ctx) return ERR_PTR(-ENOMEM); - ctx->dev = dev; - ctx->pas_id = pas_id; - ctx->mem_phys = mem_phys; - ctx->mem_size = mem_size; + qcom_pas_context_init(ctx, dev, pas_id, mem_phys, mem_size); return ctx; } diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index 0d55e9e0af3f..c6ec67e1da09 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -476,8 +476,8 @@ EXPORT_SYMBOL_GPL(qcom_mdt_load); * firmware segments (e.g., .bXX files). Authentication of the segments done * by a separate call. * - * The PAS context must be initialized using devm_qcom_pas_context_alloc() - * prior to invoking this function. + * The PAS context must be initialized using qcom_pas_context_init() or + * devm_qcom_pas_context_alloc() prior to invoking this function. * * @ctx: Pointer to the PAS (Peripheral Authentication Service) context * @fw: Firmware object representing the .mdt file diff --git a/include/linux/firmware/qcom/qcom_pas.h b/include/linux/firmware/qcom/qcom_pas.h index 1d132e89536e..458075868bf5 100644 --- a/include/linux/firmware/qcom/qcom_pas.h +++ b/include/linux/firmware/qcom/qcom_pas.h @@ -36,6 +36,8 @@ static inline void __iomem *qcom_pas_ctx_map(struct qcom_pas_context *ctx) } bool qcom_pas_is_available(void); +void qcom_pas_context_init(struct qcom_pas_context *ctx, struct device *dev, + u32 pas_id, phys_addr_t mem_phys, size_t mem_size); struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev, u32 pas_id, phys_addr_t mem_phys, -- 2.55.0