From nobody Fri Jul 24 20:48:45 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 3F9DC44C64C for ; Fri, 24 Jul 2026 18:29:14 +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=1784917756; cv=none; b=aTAKy2WT86qSeH9m10vJrFtgNoXkdlNY5QhDR+Zohn187m7wJ9PAzRO2FWPI0UPuq6ilqcqvyoOI/gPzUH5j/ZPDg9OoACKoUG3fFbqBk9HEoNvvK/kAusUTsC29nRkzddagWdS6bANb+EYnNMfBdLCii/wADWp3P9t5T065s4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784917756; c=relaxed/simple; bh=ajG7LgiJ5p3r9yao4QqzF9RmZZWT6brpGmFfsQNfxWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ft+63LVGYzXm9cZ0ZKWc1PSIrkpl2vXNVRbeyT43Wns4QhND85ARg0MjoelEwcqEQzHsMND3Qtr439YG7eSwWMVv6w8EDmYCBN2dpPlvlPEKy6xbUX4DASvo+621rom6xz4qQyPFi1X2Q6YBpSrebIN+mP9BeBnao5FHIV9cw74= 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=BOTE5QyC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ix1VgX+4; 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="BOTE5QyC"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ix1VgX+4" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66OGqXgf3936441 for ; Fri, 24 Jul 2026 18:29:13 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=hOd800wfgL3 J2dUjIr9lnlGMjGoYy/8xteok0hcXWEE=; b=BOTE5QyCBoeUppA9+TKtky1YGW6 +KfYL+yaF8Qp9QXl9Sq4fNBf8P351K+bFyt+GRGRVNGIkkn/3xZQOu3utgnb1l+0 7KoX9eDhW8B+582evm5rznDNiyMcELPL2aNyucgzYs/1u3OAb+yBPmchJbW8hyBX h9Obf7OGSHNEl1fLrpr+5HP1CqCovXtsRbczeu31K4Q63cTITqWAudP2ezsrHCzS lLH/9PKP+2Z90ozOCSu1Zk2WInWHZreG7OJKD3dN+MisFBApKvclpm/G8EWXNtBv MJzZW6z6taLjLjzkUGvyuEkvV5oCZt4brvk21nwmz3eCbuDAvJ0Y8Yh5uWw== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fmb6p8h3t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Jul 2026 18:29:13 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-cbb6433e9d4so908502a12.3 for ; Fri, 24 Jul 2026 11:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784917752; x=1785522552; 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=hOd800wfgL3J2dUjIr9lnlGMjGoYy/8xteok0hcXWEE=; b=ix1VgX+4EYJ2nKGmGuiHooOJbL5RxuLLGyhgo2ttamezeQbUpFsn0hYj6J9RJhbi1C qPyD1GadpTaPAiR8B3T2uxMG7+6v9d/LTDHRtfunkEQCyl/G2Pd8Jo2eBUbNHJ/L8uNW M2XIJmYWmO64ELkv+wF5/w9cWIJBzWr75mNYmxFxF5WayyThrUus1CC15w/7SYa4J+h4 8+1CL7un7xd8aR4al8ofbSQv5tuqS9b8vCAXLUOPO35GZe+ObOoHP9wjo7WizcmPwUKt kRd0Yiov7RJ7AlLEGDWYsbZirCKkwjr79L24ETIOyhiFvKHrtxlQy6MIZBlE7UrSZrvG v3/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784917752; x=1785522552; 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=hOd800wfgL3J2dUjIr9lnlGMjGoYy/8xteok0hcXWEE=; b=Hkpr7216wOAEbEEj5b6/nsORRdLff3vJXgs0Z9ZdTN3ogjXx1Q5hsEnzP6FVKya2OT nn67ybyOVPPkHVaWmxC3oWH+uqxwmDre0JNrt/gyWguXWDEnNUJwS7MMHJdK60W3JPcE 6BsrDa60wgSbkCGrb7lfQswugWMBNLYOnJlelfJ0ruq2G/+ZYOT5YT9iYiyLhkjbV9rE RptBNdeseXruHOCGI72Vp5JXYlk21Ustfr9/Rqb+BDHnTasyIRMqO+RoeAg5gAM3epzy /i6n3cTg8UAeR316TGl7aF+aHXlzb9j2wzec9YtHbnFmrfSrt+F6wndC4M82byVukIkP X/5g== X-Forwarded-Encrypted: i=1; AHgh+RolVRtsrhfz3J4/84Mi0E2/cGAWsHJ1hNuyh7yPCR8fHe5PxU0N2L8cd4x+oHw0g786iOUI1ODDCNDX1f0=@vger.kernel.org X-Gm-Message-State: AOJu0YwDD5hapunzgvrO4QbpKek0sCVSp7KJheZCUZY9q2niEb0dh4m4 dKVGOJWGVjWd5jcLoGMboJbADYfp4E9vLR7zXsj5NLjDSISaU2fPx9aJsy5y5x8AMc+UuwjCIdT f44qW7zDQjkFSFZsn2f/Ti5OHkpAxlXDFX8ZsOikRH+1u8Us7MdciRws1/4IfbzjSyPA= X-Gm-Gg: AR+sD12UkFjnV8B3v8sj6NOVUBFzk++UFYcNJ5N2gupRq+4qsfU69X3KX6JLDOLduwm ZPM+noROeQPCRN1PztgqgYxvzLZLW8v5OO8dEBwyw98BMvsYOsXoJ6v2coVjZ+xlhFvP4EZbe3s 5j0hD1kMdlX6AzRxLCbCGZSvCqKPReCFjqpiU3AQ80XgpMpkNIKBIuOsnpG01VpVQ2RCwuJhBYT suRbt3RlX/b3AJ91rqeI7RxoR1PSINdMP0hbMf89Nic51mk3wscbUCy9AtrjnalIz1/gmuCrLri qbppmkPmWlJmswcbZ4/86uGfrIecBlKGcbF9KK2KsE+naMfD2ebbFDyC9fYbOyNM/xQfw+CpzGT 0fj6+7g6kEOHXn9VZ7geb2/Jr+Mw= X-Received: by 2002:a05:6a21:1405:b0:3c3:a08d:5b44 with SMTP id adf61e73a8af0-3c44affc62dmr9515485637.23.1784917752332; Fri, 24 Jul 2026 11:29:12 -0700 (PDT) X-Received: by 2002:a05:6a21:1405:b0:3c3:a08d:5b44 with SMTP id adf61e73a8af0-3c44affc62dmr9515460637.23.1784917751862; Fri, 24 Jul 2026 11:29:11 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5c53f3sm1341510eec.30.2026.07.24.11.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 11:29:11 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sumit Garg , Neil Armstrong Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha Subject: [PATCH v5 1/6] remoteproc: qcom: annotate mem_region fields with __iomem Date: Fri, 24 Jul 2026 23:58:53 +0530 Message-ID: <20260724182858.1868271-2-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> References: <20260724182858.1868271-1-mukesh.ojha@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-Authority-Analysis: v=2.4 cv=AureGu9P c=1 sm=1 tr=0 ts=6a63aef9 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=ctNy7iMIxOgxZ4Gl-TwA:9 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX15RzRpI0TncJ RwBXuSYQYSLExxebCjh3OXJ7W2fE45Gpg/rLEvotitDir4exvNhndc3PiRPuel63SLqvAVFaCeh R/zPvFyQDxxnVLvO0JKLcqs388arsl8= X-Proofpoint-GUID: 4777ioiNpZa0NAYj_rfuPnQt7bMw4BBv X-Proofpoint-ORIG-GUID: 4777ioiNpZa0NAYj_rfuPnQt7bMw4BBv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX92QPujLwiqhc XX3aFJC0DrU9jS4taXZr2xAhsujQ9E6A0RswNM4w/LfK5xqrbqSzI0pXsEHEaraHeDJemJoN5CQ W2qd8f/MtqAzoGV784nEzMIgXh47BOYEgjlmeJcQulLRskhhCsex6KxPgrlrOWBaJRxtluP+BoO zLi8rWq551elU+W94z37WUxwBmeDWdFYnPj35Y5mn2Oguh91I8efAzanZsLuZ85h2eqJTlNjQ9g drSJBKKD4ILgmVotACHDILcIqrRgldhCE7mQh22/PSJTvh8kjdvUu+wmdus/RWRIoen4Wo9sTL+ Q8Pk/BoQ/8hfgtfUoO4Ck4OHU5Dd2KE0IzoIrW4XfhBRxjNEjRcZul4fkaGQoDR2gVqOMjn5BVl EWLIoDulSVPgTxwVqXZad2jgSoK1PJxdm9QeCznnlwKy6DQ7T6U3wlvfzcs5TOYd0al1WvpBD6P YkcVzsHtCImLxLy5PfA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-24_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607240166 Content-Type: text/plain; charset="utf-8" The firmware memory regions in qcom_adsp, qcom_pas and qcom_wcnss are mapped using devm_ioremap_wc() / devm_ioremap_resource_wc(), which return void __iomem *. However, the mem_region (and dtb_mem_region) fields in the respective driver structs were declared as plain void *, causing sparse to flag address space mismatches: qcom_q6v5_adsp.c:639:26: warning: incorrect type in assignment (different a= ddress spaces) qcom_q6v5_adsp.c:639:26: expected void *mem_region qcom_q6v5_adsp.c:639:26: got void [noderef] __iomem * qcom_q6v5_pas.c:141:45: warning: incorrect type in argument 2 (different ad= dress spaces) qcom_q6v5_pas.c:141:45: expected void const volatile [noderef] __iomem *= src qcom_q6v5_pas.c:141:45: got void * qcom_q6v5_pas.c:637:25: warning: incorrect type in assignment (different ad= dress spaces) qcom_q6v5_pas.c:637:25: expected void *mem_region qcom_q6v5_pas.c:637:25: got void [noderef] __iomem * qcom_q6v5_pas.c:654:29: warning: incorrect type in assignment (different ad= dress spaces) qcom_q6v5_pas.c:654:29: expected void *dtb_mem_region qcom_q6v5_pas.c:654:29: got void [noderef] __iomem * qcom_wcnss.c:540:27: warning: incorrect type in assignment (different addre= ss spaces) qcom_wcnss.c:540:27: expected void *mem_region qcom_wcnss.c:540:27: got void [noderef] __iomem * Fix this by annotating the struct fields with __iomem to correctly reflect the address space of the underlying mapping. These regions are subsequently passed to qcom_mdt_load(), qcom_mdt_load_no_init() and qcom_mdt_pas_load(), all of which take void * and use plain memcpy()/memset() internally to write firmware segments into the region. This is intentional and safe: the mappings are write-combining (WC), which on arm64 permits bulk CPU stores without requiring the memcpy_toio()/memset_io() accessors. Changing the MDT loader API to accept void __iomem * would be a more invasive change and would affect callers. Signed-off-by: Mukesh Ojha --- drivers/remoteproc/qcom_q6v5_adsp.c | 6 +++--- drivers/remoteproc/qcom_q6v5_pas.c | 10 +++++----- drivers/remoteproc/qcom_wcnss.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_= q6v5_adsp.c index c81e6c33c747..39654206781d 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -105,7 +105,7 @@ struct qcom_adsp { =20 phys_addr_t mem_phys; phys_addr_t mem_reloc; - void *mem_region; + void __iomem *mem_region; size_t mem_size; bool has_iommu; =20 @@ -318,7 +318,7 @@ static int adsp_load(struct rproc *rproc, const struct = firmware *fw) int ret; =20 ret =3D qcom_mdt_load_no_init(adsp->dev, fw, rproc->firmware, - adsp->mem_region, adsp->mem_phys, + (__force void *)adsp->mem_region, adsp->mem_phys, adsp->mem_size, &adsp->mem_reloc); if (ret) return ret; @@ -492,7 +492,7 @@ static void *adsp_da_to_va(struct rproc *rproc, u64 da,= size_t len, bool *is_iom if (offset < 0 || offset + len > adsp->mem_size) return NULL; =20 - return adsp->mem_region + offset; + return (__force void *)adsp->mem_region + offset; } =20 static int adsp_parse_firmware(struct rproc *rproc, const struct firmware = *fw) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 25599d728208..9076c82ac878 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -101,8 +101,8 @@ struct qcom_pas { phys_addr_t mem_reloc; phys_addr_t dtb_mem_reloc; phys_addr_t region_assign_phys[MAX_ASSIGN_COUNT]; - void *mem_region; - void *dtb_mem_region; + void __iomem *mem_region; + void __iomem *dtb_mem_region; size_t mem_size; size_t dtb_mem_size; size_t region_assign_size[MAX_ASSIGN_COUNT]; @@ -243,7 +243,7 @@ static int qcom_pas_load(struct rproc *rproc, const str= uct firmware *fw) } =20 ret =3D qcom_mdt_pas_load(pas->dtb_pas_ctx, pas->dtb_firmware, - pas->dtb_firmware_name, pas->dtb_mem_region, + pas->dtb_firmware_name, (__force void *)pas->dtb_mem_region, &pas->dtb_mem_reloc); if (ret) goto release_dtb_metadata; @@ -321,7 +321,7 @@ static int qcom_pas_start(struct rproc *rproc) } =20 ret =3D qcom_mdt_pas_load(pas->pas_ctx, pas->firmware, rproc->firmware, - pas->mem_region, &pas->mem_reloc); + (__force void *)pas->mem_region, &pas->mem_reloc); if (ret) goto release_pas_metadata; =20 @@ -447,7 +447,7 @@ static void *qcom_pas_da_to_va(struct rproc *rproc, u64= da, size_t len, bool *is if (is_iomem) *is_iomem =3D true; =20 - return pas->mem_region + offset; + return (__force void *)pas->mem_region + offset; } =20 static int qcom_pas_parse_firmware(struct rproc *rproc, const struct firmw= are *fw) diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcns= s.c index e9a00efe97f6..c856a92af43c 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -94,7 +94,7 @@ struct qcom_wcnss { =20 phys_addr_t mem_phys; phys_addr_t mem_reloc; - void *mem_region; + void __iomem *mem_region; size_t mem_size; =20 struct qcom_rproc_subdev smd_subdev; @@ -158,7 +158,7 @@ static int wcnss_load(struct rproc *rproc, const struct= firmware *fw) int ret; =20 ret =3D qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID, - wcnss->mem_region, wcnss->mem_phys, + (__force void *)wcnss->mem_region, wcnss->mem_phys, wcnss->mem_size, &wcnss->mem_reloc); if (ret) return ret; @@ -327,7 +327,7 @@ static void *wcnss_da_to_va(struct rproc *rproc, u64 da= , size_t len, bool *is_io if (offset < 0 || offset + len > wcnss->mem_size) return NULL; =20 - return wcnss->mem_region + offset; + return (__force void *)wcnss->mem_region + offset; } =20 static const struct rproc_ops wcnss_ops =3D { --=20 2.53.0 From nobody Fri Jul 24 20:48:45 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 7607541A4FA for ; Fri, 24 Jul 2026 18:29:18 +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=1784917760; cv=none; b=Pyt6dkl0sQe/2YjNkyEIjTwff+vkkIL0d4xABvcX2Lfb/oH/5S+YW7DCmBVhaY8Sr0xptdfeQiwJ1VgijAFSjhu4UzlxXaIpxPJxJo9JG6J2gIZoSfvXxu3tj9PIpOwS3yMlCyPjbosUKRR5L3NmFWP7tKZHbC9Tc8e4UpBJOGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784917760; c=relaxed/simple; bh=DY8VFqJjyMky+pruQfRM5PAcQO10FyR8Wx2ZfO+d6cM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cSXIz/SQU4v/aYfyGM1lUmZCll0nJsvcGeZHGZ85Jm7Rycc2P8bawy7VaCcXMsNNYMG4yaPvjHc9utdPp7J/WrohjojfvfDZE0EvJE5ILNE3Tl0fOJUiJ7ujjELGDMRxbDyHHGjyGpz8yzarJy4OiASpMVkACqviA0F4zicoltw= 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=bTxgvFX8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CM+QubMH; 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="bTxgvFX8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CM+QubMH" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66OGqQP2594616 for ; Fri, 24 Jul 2026 18:29:17 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=j5emzuRgACX 9a1cgqepsrcMt9zKe22Qqa2hBXKHbruc=; b=bTxgvFX8NKX5eDXxqIaBpXp0ciQ BGc0fryJenJH5LAVyBAQEyawLfJou8zs+DYflyC4RDR1qDT1WKcA5i7MI1AMhEMU lYLYlua6JYvBA47wCavq3zv2G3jMh+brLKlg6Wm1HMz5RW3MqFkCWRPhnmjaqZj3 /Wjs3F1bU5EffYZCTIwDAYxazOH9OegI6T2WTzs9yvpHgQ3p/Pc01VMgvG/2sWKG TUKYb4FShIpFL+3fS8Hn8h6banQ+qQAAe1TTsVbUTXHC1c8QVUSrPOg7oGiLzcq4 BQekU7Yqhw/NGAJeht+Xk1ulY0jjf3LHuicMgzp2kkq57Ns+azzrlqshzAA== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fm8ck96n4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Jul 2026 18:29:17 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cb7d6ba548eso824878a12.1 for ; Fri, 24 Jul 2026 11:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784917757; x=1785522557; 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=j5emzuRgACX9a1cgqepsrcMt9zKe22Qqa2hBXKHbruc=; b=CM+QubMH5EImzK79Riq/9SyQdbiN1t27mW5tRtMwh54dI3WgK5t9TMRTRyzZuDMRrM geceWOrWU2idZeJh/hp2xKefJIt+ZDivlimmblOlDJy4xmLQcCc+9sXIO0QpAGaDU+aw N2UrR5NHBowQ6wOEDMrHQZ7TisXxuMjGLkfAIVErqGL4yIn34l0PKlF3rMmAMDpt9TYV 36sx/ZdQcBFmbpEEmqrJqLsTFxaaLlG8mNbf9rsSdArRmAFJ2t2FqS2888kD1cubVgma PEnCj3dJLUyT7iZQTnEQSpiT5nFHuFmQs2F7BdqHXK++DTq/YM96k91qM7grBISRzxsw mhSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784917757; x=1785522557; 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=j5emzuRgACX9a1cgqepsrcMt9zKe22Qqa2hBXKHbruc=; b=Goc/m3NcekivYaOcqoP+MzMHzOIzm98NyfbrM5gedaGIBBpISYaHJ8NKBRPK1VkNYf y5t+OWRt9N2aMkB7k45qcE2Grp3EUW1Wu0ia5PX96IaswEcoEHnzU2mGyn9xsMw6hZvm LoHZu6Fcebl2FgnYP++eZsCHOlhkwWX51afyPl63CtZjwqSZ9RaPV8Y/y+a7bPGeq+Pg 5ZXRtOivjlzV8N9N1rpef3mK8KLSajDpdkmSN20tggJCy7oHvpxQ/exvW1AEYUW28ah/ vwansgWqIJu1ukNtGu7V9NIJaRjvw7u7paip9y9/PXc5vkgn0ieJ5rD3sf9M18SIe9Hv 4awQ== X-Forwarded-Encrypted: i=1; AHgh+RrezF9m6+marfU7trmJKHg2SFXOzIT+vvuEgEXXcWY2R3R3TScrHfnk7umWzPrlf9IQiYmtrrZlSVUXl/M=@vger.kernel.org X-Gm-Message-State: AOJu0Yxl+AmqU8xmm+kdeEhCb1GQhogXw7KQ8luOTEvKoI30Fx1EguQO +wmzL04FM1XHd/RfCb7bUUpHs+vYZEWdJRzABJE037HzkFAZd0GtM5uI1wrX9B3/Z42ND7CJXVw k8Y2nFClaO1tsYp/wPjg0HNgl1uIjTtESZh7SfMoJrQmVBAkrNBJeFIYit29T6UNQfyk= X-Gm-Gg: AR+sD13nGP4Y6BZeDnycy/scZK7+86MnguNvat7CVJqW2l6wctoaiCMmyCVUWlB/cDa RFG1PngYCXLfM8uBczOB8nr3iDFXAoMziVAaDib+fcqgVZ8e/iWuRBaspwCmNHxl2OVZYM/YG+F 4X38BBWeEeqrxlTzbORb5OURAe7xHd9Ue2BK7pXlVdValMvVr7KldiddDW6gXELMG9vQ+niLabf /pr8EPUy9UKf8uPM/AK5z2N76q/RnG6gRBIGx7XlmSGXSWDEXdyfv6GKo2zskSGI46xY6PBexVY uLCtap3SDU/ICZYBT7HwNyOqpw4o0lhBYdHt5pD9Ys4VN2FyFIMPdIlV52JtTDlB8u800rBtTlY 0k/gLBCgj4nKdLMfDsq3W9JOkb4Q= X-Received: by 2002:a05:6a21:a347:b0:3c0:9c1a:8941 with SMTP id adf61e73a8af0-3c44b2c1b51mr8939955637.73.1784917756885; Fri, 24 Jul 2026 11:29:16 -0700 (PDT) X-Received: by 2002:a05:6a21:a347:b0:3c0:9c1a:8941 with SMTP id adf61e73a8af0-3c44b2c1b51mr8939936637.73.1784917756355; Fri, 24 Jul 2026 11:29:16 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5c53f3sm1341510eec.30.2026.07.24.11.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 11:29:15 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sumit Garg , Neil Armstrong Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha , Konrad Dybcio , stable@vger.kernel.org, Dmitry Baryshkov Subject: [PATCH v5 2/6] remoteproc: qcom: pas: Guard dtb metadata release with dtb_pas_id check Date: Fri, 24 Jul 2026 23:58:54 +0530 Message-ID: <20260724182858.1868271-3-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> References: <20260724182858.1868271-1-mukesh.ojha@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: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX2hyXg1a7/1mK LI5vUf7eswg5GFK8f8JvuXHNTa9LWzH+fSBtMCOaTiHHvuTTyowoN5ePAfEQwPM8AgR9xUj3WjJ unnL+bAKZZmDxZf8J4MBV6eQugcb0lRv540fOF8bojjBavuk5WF97DCvmAnFwU+BjPCQCzO9bbc oquqivdyu4LZ0sHv6ZK29ySGwhOJ7mf8rX22dshibGN1DJQsezdkz5b2D0nMjugRQYQJc6+RS2G W1Ovmcaw2DJ7DJZfAQLYvg3Hc7IvXIxzshHWMu1p6Cm/x8ojCOSBn/ry7P/GLzGsHa355ur1hAr x3wZpkoWdqgh5cYOHI7uVWZCy4AoQBoy246LDraXNq4A7Nd2tfreShQmKzzPduv3/Zdvg9fa1sO suJUNVzvlTHTUulTR1xLvj9iBes2LFK0Ap6wXjxls+9Rb/ZRReQ4iykf0YDFLq8cdex0W+bQTnA H/a6EvgbBEpalmW70HA== X-Proofpoint-GUID: 41r3D6-WtR0-GYLkyaN99KzOSYywE-2o X-Proofpoint-ORIG-GUID: 41r3D6-WtR0-GYLkyaN99KzOSYywE-2o X-Authority-Analysis: v=2.4 cv=F79nsKhN c=1 sm=1 tr=0 ts=6a63aefd cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=Td1J0TjYGYW-NjyS66IA:9 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX2FJ/My1tzRD3 v/gH9lUAzS9/A2rr7MKX4ZigvQN3ttVBWIRtXl84dtH6elB4f9SSsVNvWw2XUc2TxA2X4Mbn70z 5QBxJyr1xcmiTNabCNlYHpbwdipJG0s= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-24_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 suspectscore=0 spamscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607240166 Content-Type: text/plain; charset="utf-8" All other call sites of qcom_scm_pas_metadata_release() for the DTB context are guarded by a check on pas->dtb_pas_id, but the call inside qcom_pas_load() was not. Fix this by moving the call to the guarded block. Reviewed-by: Konrad Dybcio Fixes: 29814986b82e ("remoteproc: qcom_q6v5_pas: add support for dtb co-fir= mware loading") Cc: stable@vger.kernel.org Reviewed-by: Dmitry Baryshkov Signed-off-by: Mukesh Ojha --- drivers/remoteproc/qcom_q6v5_pas.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 9076c82ac878..f70836cc382d 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -245,17 +245,14 @@ static int qcom_pas_load(struct rproc *rproc, const s= truct firmware *fw) ret =3D qcom_mdt_pas_load(pas->dtb_pas_ctx, pas->dtb_firmware, pas->dtb_firmware_name, (__force void *)pas->dtb_mem_region, &pas->dtb_mem_reloc); - if (ret) - goto release_dtb_metadata; + if (ret) { + qcom_pas_metadata_release(pas->dtb_pas_ctx); + release_firmware(pas->dtb_firmware); + return ret; + } } =20 return 0; - -release_dtb_metadata: - qcom_pas_metadata_release(pas->dtb_pas_ctx); - release_firmware(pas->dtb_firmware); - - return ret; } =20 static void qcom_pas_unmap_carveout(struct rproc *rproc, phys_addr_t mem_p= hys, size_t size) --=20 2.53.0 From nobody Fri Jul 24 20:48:45 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 8903F3624C9 for ; Fri, 24 Jul 2026 18:29:22 +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=1784917764; cv=none; b=cuxWKKyXXOk+1vXkbE2SQGuEaGU2m/sHM7cW3MSOmS1mPGcFlXxn6vDe2QkMEP04fWlGooKqjVVRt3zQEz+wdpZ3L1lnAZHkY5cNBnBZAN0tsY49o+Ln0Z+3Wm+8xp3Su6r9IUJSCpRNxXjgrtTr7+rW3tal+l5sYJZ0iT/P+HE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784917764; c=relaxed/simple; bh=hk/7ubGPWMHf3ExLeXN5MmJ64rS6xLpNKSDdHtjRwPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YzEryKZ4dUB8XaiDaSMCndtM2qwchskCFtVH3ixatPhYG2k/wLWbjf1n+5dsQQGzZsWkMKVvRbNG8CrItwzc0ZLv9Z0Ic9KSOTyPdHXe1A+CefUu40mBQDHv8GA7eWkko+QcO4gC8GYAyUH9hmdXRLPTLh4XTMsnmMdIuCnndzA= 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=UV/b68DC; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Rh9q61eB; 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="UV/b68DC"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Rh9q61eB" 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 66OGr5sL3381319 for ; Fri, 24 Jul 2026 18:29:22 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=nBq8TxCsSEK bJFCImF72Xj1Hz4ZPMv+oaYD4rv7ZvrY=; b=UV/b68DC0EI/t+PBM/GSd/5rzW3 yMjLk+Q5k/9wI+PDj0E9XhSRLWuF/vjcTApvhfojAZpJFfAL7/Mw1pYI4Lq/MAnU vAt3B/nEkMyeYVHw/x1YIad36w3sUxNVetHifwTi7IzE3wbFGC5qf4zUDMEp//aT ZkgLu3nKI4a3gVjiQd9x1Qe84KwPOcICXzX06lWSaWfWcIpcjQejimaQeCGfd/bj r+0Pq9u6EvXt1vRAk7S0VALNsswrIRwvR2ZORje330UqGowq30+RZ+578D6TxORs 1rRPD+txN1GEi0t60IS2ox0CXrkRlEfZ8X4vFN9loHhMrixJfAA14gfqBbg== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fm8cj97df-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Jul 2026 18:29:21 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cb7049fa552so492025a12.2 for ; Fri, 24 Jul 2026 11:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784917761; x=1785522561; 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=nBq8TxCsSEKbJFCImF72Xj1Hz4ZPMv+oaYD4rv7ZvrY=; b=Rh9q61eB1cm7t3ZwvbiRdYMu6PdkG88EQwH0GEhUbYZEOAIOjNzjuaWgxpVj1I/yCV itkNuHwG8GOhKN2dD3w7z8dFf2KBSrGTs3dYbdgjOgpr5nZ/a0UvVdPUYSOjm8dIPirb rR3evif7AmiGZzgDjmTstW4RGwE5qRt0WXuDBiNci7cha7eQEIeR6w1D4laqUl5Zp8iO /gpU0lz1d4LuAONf6Wnwao36FZNWPTZeBErijqGrWn2xOfQD8EVAk/Wyq0yDXCXbwO+P HUHtbibO3y/bs5DjEyRQOeSdFZh/PSiW/AKhrYL4ZEt074hyD8+cmQNQuTRZln/WvFPu rfxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784917761; x=1785522561; 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=nBq8TxCsSEKbJFCImF72Xj1Hz4ZPMv+oaYD4rv7ZvrY=; b=RFj0JD/vq/jarPnkTibj6mPH9p/Ili02DgjrMtw3/ZyZ2sINunn3p8TC5JwfCHsXZE YfHGegR7dS2zky1ov2dAbN6kA+FMHxHiGqiPdiIpHSW6tBBtdZvNhLpZT+rgCIdMCdsE HT8Y7i0QaLfzO2eWxVQuCF2mTAJKpQvXbKNbO3mSwFL8eAVt7futhaW2D1dk8i705ED/ 6eCc+V0xO4q8QX3w8d0DKIUohOlZFzTndVXkD0x0/AsYVvKPT8CoKnOQSSQtVGUiSUKe UrhGW2yszZ6Fx8hib5mZT4bn9HoKtUYDfbMwDc4AVpsAyT+kSKZpq5T4jichz77aCnz+ Y9zw== X-Forwarded-Encrypted: i=1; AHgh+RoDivJQEzDqS7edaKNhPfhXUbcfbNzVGdRwXoqhJQw1Ly6eH+Ebm5iq95yOq3xuOliirvPdGwmNTiCKPZs=@vger.kernel.org X-Gm-Message-State: AOJu0Yy776GlvbInqlI0RkjjpX9Y8QeyHYymbEX/qsFKwhG1Kr8WzIyM LZfoq9PYHQhgDdBphmfQVTp3VPNFcdvSS4O+YQpfzdL3Eefi4DQKc9cDcuIDQNmNYGHVkTNu4MU u2wQkaz9JvAlPVhrl7sjlYiBufuVIM+MRkfoRaw9xsu6WM/wLkLkCbnUlKnjcEeRVwSI= X-Gm-Gg: AR+sD10/s3PXdDqhSwOCmHT4pbkgwKbXw4eEryMzTKvPhL3If65dpHAFsZGU6PZy0Tf PPC5sRj4uTPOhi1Vw59lirehi7ZZNC8ELvYvdf+tpBf99vtYWd8qyGytkbigoFCgqb7BfJfleLH OAKvjgHK//qeleBRI1P6hpxpYSEwdqDbLTWWohtIIRDk9I5QmhYCTtg6qSMrOEdSmMakf8AsIZu i4QRjAZiiY+FDQovf77Yt4T8xyEyB/tS8yGoR0BSmoCmlZW+XD1aOdzeOGQs73sAcghoYuKRGDS aJshoD6yYjAGVqy9BXZJrTYcieU2Xx4jAlTstLmYK2zmqAwE/yOFjAt6cW6cZB2aQO6jpQ+SIpp W2JcKIEsnMWT5iCQEQPi/z3bwocg= X-Received: by 2002:a05:6a21:9206:b0:3c3:9746:1fcb with SMTP id adf61e73a8af0-3c44b1eb341mr9040977637.35.1784917761139; Fri, 24 Jul 2026 11:29:21 -0700 (PDT) X-Received: by 2002:a05:6a21:9206:b0:3c3:9746:1fcb with SMTP id adf61e73a8af0-3c44b1eb341mr9040940637.35.1784917760630; Fri, 24 Jul 2026 11:29:20 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5c53f3sm1341510eec.30.2026.07.24.11.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 11:29:19 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sumit Garg , Neil Armstrong Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha , Konrad Dybcio , Dmitry Baryshkov Subject: [PATCH v5 3/6] remoteproc: qcom: pas: Fix the PAS context creation placement Date: Fri, 24 Jul 2026 23:58:55 +0530 Message-ID: <20260724182858.1868271-4-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> References: <20260724182858.1868271-1-mukesh.ojha@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-Authority-Analysis: v=2.4 cv=GJE41ONK c=1 sm=1 tr=0 ts=6a63af01 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=vHqpxYNXqBXYHKvWcGcA:9 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfXxE7UPUGluDpe fEC7E0PGHc+KawdfIk8TTlRGQujoLSGfSIgDpztzlMYTabbXpmQ08PYKwYDL1uO4hxumePJo5Vf v+ZwfPC/UuDA4u+/8eOU9Qf7t+XnOkHYhNKkmbX75E1H6f8mceEB/a8mHbhGsWmFHds1vCR/GIp 5YI9Sk/FEhfTlQnIoVBpUYN3IwXuOZBcYWDcxA/KS8ulKsPh9EZzb9crW/rR780g15k52oBFDJ3 sw0400FVsCAu1r6PqxVqEXpgeelc/3rB2lOEhuao9DVE7rbkQtCjDx9Sw+VtxjndkYzXezm4TSX 7qskc+vfKMxqUF6LwgWJ5xmLfQBB3cBsou+CbusKMldxQtYSI9KCErrxblV0rbze0UgGX740/JZ yUwyvwOOtKioCH2OWPxvC49tK48j1qAYC/S8GFG+G7FT/8yIcW2/e6UJYHbH08hYNYg6kLgD2ol At0P7/iZ269O+9Jmmqg== X-Proofpoint-ORIG-GUID: ZV9Qr4T-1G2aHSMGomhp3WnADX-I1xHX X-Proofpoint-GUID: ZV9Qr4T-1G2aHSMGomhp3WnADX-I1xHX X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX8g1JCyoXlkE/ qnjkO/jvd6V/RBWWG3wMYWDDRDPS+h3atWrLfaOhfdhtML9X+k/fSYhTGaQakC5MkiP2oEaWECu pLcEGyQxke2srM17UZGph64o+PeCYiM= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-24_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 priorityscore=1501 spamscore=0 impostorscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607240166 Content-Type: text/plain; charset="utf-8" DTB PAS context creation should be done only for subsystems that support a DTB firmware binary; otherwise, memory is wasted. Move the context creation to the appropriate location. Reviewed-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov Signed-off-by: Mukesh Ojha --- drivers/remoteproc/qcom_q6v5_pas.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index f70836cc382d..997b3a7ce672 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -702,6 +702,11 @@ static int qcom_pas_alloc_memory_region(struct qcom_pa= s *pas) return PTR_ERR(pas->mem_region); } =20 + pas->pas_ctx =3D devm_qcom_pas_context_alloc(pas->dev, pas->pas_id, + pas->mem_phys, pas->mem_size); + if (IS_ERR(pas->pas_ctx)) + return PTR_ERR(pas->pas_ctx); + if (!pas->dtb_pas_id) return 0; =20 @@ -719,6 +724,12 @@ static int qcom_pas_alloc_memory_region(struct qcom_pa= s *pas) return PTR_ERR(pas->dtb_mem_region); } =20 + pas->dtb_pas_ctx =3D devm_qcom_pas_context_alloc(pas->dev, pas->dtb_pas_i= d, + pas->dtb_mem_phys, + pas->dtb_mem_size); + if (IS_ERR(pas->dtb_pas_ctx)) + return PTR_ERR(pas->dtb_pas_ctx); + return 0; } =20 @@ -901,23 +912,9 @@ static int qcom_pas_probe(struct platform_device *pdev) =20 qcom_add_ssr_subdev(rproc, &pas->ssr_subdev, desc->ssr_name); =20 - pas->pas_ctx =3D devm_qcom_pas_context_alloc(pas->dev, pas->pas_id, - pas->mem_phys, pas->mem_size); - if (IS_ERR(pas->pas_ctx)) { - ret =3D PTR_ERR(pas->pas_ctx); - goto remove_ssr_sysmon; - } - - pas->dtb_pas_ctx =3D devm_qcom_pas_context_alloc(pas->dev, pas->dtb_pas_i= d, - pas->dtb_mem_phys, - pas->dtb_mem_size); - if (IS_ERR(pas->dtb_pas_ctx)) { - ret =3D PTR_ERR(pas->dtb_pas_ctx); - goto remove_ssr_sysmon; - } - pas->pas_ctx->use_tzmem =3D desc->needs_tzmem || rproc->has_iommu; - pas->dtb_pas_ctx->use_tzmem =3D desc->needs_tzmem || rproc->has_iommu; + if (pas->dtb_pas_id) + pas->dtb_pas_ctx->use_tzmem =3D desc->needs_tzmem || rproc->has_iommu; =20 if (desc->early_boot) pas->rproc->state =3D RPROC_DETACHED; --=20 2.53.0 From nobody Fri Jul 24 20:48:45 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 1B8A137107E for ; Fri, 24 Jul 2026 18:29:26 +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=1784917768; cv=none; b=MD4StavVlhOFdsv6AOnFvzroIX1vwHyuo+HAbZdORoW6vchVhG3IMgW2aKz3o1+HJJ4z3EoVJpwZeDw8BRZQ6UMveax6T6WibTG2deTvWJ88pq6rOA4GvqpEyXX4RRFMWc59jaD6UPY//LvBNshOjxKoHKN7gvgQT9vKAM/P1oU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784917768; c=relaxed/simple; bh=milOFmWGURAJNSSi4R2QpUG8T/VDU+8+DlqPQR/oqk8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mfiCp8tV7xz5xxIKkdjMxCltJ8+RPEp985ef6kS5q/dD2UuzCMHyGvrJJOj2CVgvLBKR0E7q3QZ8AEHvMsuMDCblrT1G61hUoYg3oCfWOG/UXwskULEPl7oL+mk91AMNcdxZ3Uz2Guf7sce02NeVdgMaA7QlJv13sp454gs/88I= 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=OGBZbYcH; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=i7lqY0VF; 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="OGBZbYcH"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="i7lqY0VF" 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 66OGqOR73377631 for ; Fri, 24 Jul 2026 18:29:26 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=5O12LMg4XAF mIxgX1qOeWfAhbvIHdzCMm5DeiKIJXow=; b=OGBZbYcHfIlDVgzt9FrXE8zANJk Y9nDv6CwrOOgyRT8PayxXMlUGQGAIRKn+RKYx7iG23LuaUuMvv5N+6+hV+b42R9Q KLlpFT4rLC9MBj+fKqRi/6lJ7y9CziknZUsqLFawANUhD7ts6taqocQkwJ57Rc8G HS6998287LILUeH0MMce4/dgU74G/8a0PEb3zqQ3gD75wBH6BFVexKVpZbEVSWKK 8gVgtWZlMfgL9XX4cghl1p30geKX8DIy8SUDgvYd7kEeCg2Si3jnlE3hXZ1sxiEX C9SIymDgVSdgRXWW18G+xh7gPgqxKLNX4jRgoYdBaz01PF4LwcT9cRGfJBQ== Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fm8cj97ds-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Jul 2026 18:29:26 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cb5bdd8450dso424422a12.0 for ; Fri, 24 Jul 2026 11:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784917766; x=1785522566; 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=5O12LMg4XAFmIxgX1qOeWfAhbvIHdzCMm5DeiKIJXow=; b=i7lqY0VFGGQbxv96w8jzRPOl+BXD5/Tt7JTupwrYDdsE8t225JZF3NIH2piFqzgZzv NAwjTBvkUzh5d16g9JH47Eo5FP9Ffja0h1pPNBtE0Tme689SJSMOl6hiuKazFJK6dnhK 5g7CiGniV3JJVQsR2SdX2/PUsEdYdIpJCpMzD2NDy35PiYnvaG1nF0UAQFoP5l/u0DMj VT3MY3ndwS2pGVqTxqXa3WEs1do30Is5c/HLLU+woZjaKFGimmqb4kqj/mO4qVF/UouY NkC8Ul4ZZi6UFjCxwD5OrCk7HjptMhYeNsodRvG0mMXQLkJ667s87AY/va6TaXJzfILk H07A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784917766; x=1785522566; 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=5O12LMg4XAFmIxgX1qOeWfAhbvIHdzCMm5DeiKIJXow=; b=InMFMa6P4RbWWigwy2KzEXb4UHeVM9fwl20KjApNYYb7Psu0L+4gXScCLmGxojzcGa 9gweQcyYXcYW3fPBEQDepOYUyxxnMXpytX+rB6C32eX46yOvVwxewCegsx6BIRdtFbAx ancA/HV/+4annNfovZ9UIGzTfw22MR0Ex3qjv0T4ozLT62x49pJLPD1izX2DPXoglCFU tokYSs4YpgNsKpaY/766qXjqSD+F11E8sHdyrN6oMyP8UpN3u6vw56g/YoFuAp0p0oIM MDqSuXBdiyV99WlM95lXUsAwmfg4+85cmeO3ZXpJqndp2B/FtsokKnb0CmGEmZQNPA4F 6gPw== X-Forwarded-Encrypted: i=1; AHgh+RojH7kkzBr0UikrU//jplYHbXqU2Yyk+Smlp2jBZc8UU2hE2RX2YYJe3i9pH67hjUwbXRtYeCuPtTy96A0=@vger.kernel.org X-Gm-Message-State: AOJu0YxyAYwSZw6U+6kpNl+c7PUYcVxWE7SFaGrnv0W6H48Y1mVzk7dl BZSyt7HnmgduURZkd4rz11Hfoonmy93vP3vjG+PLCGjFNym+7jOLeTAXbmvpnPTQXELsTzRhhXP nxv50qEZTRo9SpR7xLbhQXjUnBCb4Z6D2B57zerRjxhCLMS/klahUMO9Jn+Tmm7nykC4= X-Gm-Gg: AR+sD11qjY/+4nlorGTidw8HTn5mt9KU6o3RugV9FwKEnw0XF1iTYDpSrbAzrMQ2p8u 9aw/7wX4YpK8lZpgUwgJMFn3WQcq+j+fGbcboHUPHrbsbaRZNMu9ulf6q7D9wFJcYvDQ4pA9eUq oMshAZ9nTD+76s0S+7KK6V5bgq6AtdaD3zUuyeYGzHhK+Up0eM1YcHlACy9JLyrJ38ZoqcpBGvO ppcZdcPBAT5d1HDggsx68Z1dBB//k8Ns5bmzT737UHQhuYrH1aoQWQA/Z3oYAsDnHAam4FcequN k1FsFpMR5iA55HpMQiL6Y/HN7Zdgr24XI5GzTxzoXg5t4r0bilEROOw2ZCUg9LrezxtwMO5/N7D XlUN5/xS5urMoHJnhWl/+dRejPLQ= X-Received: by 2002:a05:6a21:748e:b0:3bf:9e25:1a18 with SMTP id adf61e73a8af0-3c44b2440b1mr9523937637.52.1784917765417; Fri, 24 Jul 2026 11:29:25 -0700 (PDT) X-Received: by 2002:a05:6a21:748e:b0:3bf:9e25:1a18 with SMTP id adf61e73a8af0-3c44b2440b1mr9523896637.52.1784917764831; Fri, 24 Jul 2026 11:29:24 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5c53f3sm1341510eec.30.2026.07.24.11.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 11:29:24 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sumit Garg , Neil Armstrong Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha , Dmitry Baryshkov , Konrad Dybcio Subject: [PATCH v5 4/6] remoteproc: qcom: pas: Map/unmap subsystem region before auth_and_reset Date: Fri, 24 Jul 2026 23:58:56 +0530 Message-ID: <20260724182858.1868271-5-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> References: <20260724182858.1868271-1-mukesh.ojha@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-Authority-Analysis: v=2.4 cv=GJE41ONK c=1 sm=1 tr=0 ts=6a63af06 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=TfPgvF6n5GBQfkPxsSAA:9 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfXy6eNBoZ6XebU 13Fb5CyGOCDSJb1YEPuZCW1Cl6IMwgnPf8rDtaHvpmNqIGTjvXfEnpTNnljLQ8gA5lFjYAAliY5 6e6p+kwoXu9zGl515mazYbomSUjhmCBlaPGcb/npMAJbez7IL4BqMQRfbDhbUkpQREAro/WYHoR QO412a6ljzef2jdsw2FtsP5ESMaBIQdIEkeN8kx4AOuzmZRy9Sfe+JOKcPHoR7/Yl34sw5dCFXi bSIRUyl0X+WfzwmZd4HI7vjdOUsuqXx5xwc12d/Ye3cL+ZssjaFy6Q/nQXhQwykVR70A3g21mvI OSzWJ2MZffZC4JkxtL+/k4wio90oS66HjDv8wHNYg3qtbEjtDyBcfCNrLNwrLRcIUC5Jdof2TeQ S2/7l+BuiHmToEh+3Ej03Jwx3fN6hEmRBoXGw8Po5rjG+QJWRjQKWjrbnCp32pGjuHuhWLqDwzP sHVoc6HIm0aJFzeIaRw== X-Proofpoint-ORIG-GUID: VT-7k9Yt3-KbTLE3zeHtF2nU-V2QpTup X-Proofpoint-GUID: VT-7k9Yt3-KbTLE3zeHtF2nU-V2QpTup X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfXzLY7/axsF85V uwsmnIgW7qsoLNPD6hrGW/SNGfJtqj3wq6khvkg6UpYdrlXDg2fvfKJ+El1dom25RYNl6e5hsQQ cIjdxupYiZvN2v2Bb6Tbde3rR5FZbwE= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-24_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 priorityscore=1501 spamscore=0 impostorscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607240166 Content-Type: text/plain; charset="utf-8" Qualcomm remoteproc drivers such as qcom_q6v5_mss, which do not use the Peripheral Authentication Service (PAS), always map the MBA region before use and unmap it once the usage is complete. This behavior was introduced to avoid issues seen in the past where speculative accesses from the application processor to the MBA region after it was assigned to the remote Q6 led to an XPU violation. The issue was mitigated by unmapping the region before handing control to the remote Q6. Currently, most Qualcomm SoCs using the PAS driver run either with a standalone QHEE or the Gunyah hypervisor. In these environments, the hypervisor unmaps the Q6 memory from HLOS Stage-2 and remaps it into the Q6 Stage-2 page table. As a result, speculative accesses from HLOS cannot reach the region even if it remains mapped in HLOS Stage-1; therefore, XPU violations cannot occur. However, when the same SoC runs Linux at EL2, Linux itself must perform the unmapping to avoid such issues. It is still correct to apply this mapping/ unmapping sequence even for SoCs that run under Gunyah, so this behavior should not be conditional. Introduce qcom_pas_ctx_map() in qcom_pas.h to centralise the ioremap_wc pattern used by both qcom_q6v5_pas and qcom_mdt_pas_load, and use it in both places. Reviewed-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio Signed-off-by: Mukesh Ojha --- drivers/remoteproc/qcom_q6v5_pas.c | 35 ++++++++++++++++---------- drivers/soc/qcom/mdt_loader.c | 15 ++++++++--- include/linux/firmware/qcom/qcom_pas.h | 12 +++++++++ include/linux/soc/qcom/mdt_loader.h | 4 +-- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 997b3a7ce672..5cd34086ccac 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -150,7 +150,13 @@ static void qcom_pas_minidump(struct rproc *rproc) if (rproc->dump_conf =3D=3D RPROC_COREDUMP_DISABLED) return; =20 + pas->mem_region =3D qcom_pas_ctx_map(pas->pas_ctx); + if (!pas->mem_region) + return; + qcom_minidump(rproc, pas->minidump_id, qcom_pas_segment_dump); + iounmap(pas->mem_region); + pas->mem_region =3D NULL; } =20 static int qcom_pas_pds_enable(struct qcom_pas *pas, struct device **pds, @@ -243,8 +249,7 @@ static int qcom_pas_load(struct rproc *rproc, const str= uct firmware *fw) } =20 ret =3D qcom_mdt_pas_load(pas->dtb_pas_ctx, pas->dtb_firmware, - pas->dtb_firmware_name, (__force void *)pas->dtb_mem_region, - &pas->dtb_mem_reloc); + pas->dtb_firmware_name, &pas->dtb_mem_reloc); if (ret) { qcom_pas_metadata_release(pas->dtb_pas_ctx); release_firmware(pas->dtb_firmware); @@ -318,7 +323,7 @@ static int qcom_pas_start(struct rproc *rproc) } =20 ret =3D qcom_mdt_pas_load(pas->pas_ctx, pas->firmware, rproc->firmware, - (__force void *)pas->mem_region, &pas->mem_reloc); + &pas->mem_reloc); if (ret) goto release_pas_metadata; =20 @@ -570,6 +575,19 @@ static int qcom_pas_attach(struct rproc *rproc) return ret; } =20 +static void qcom_pas_coredump(struct rproc *rproc) +{ + struct qcom_pas *pas =3D rproc->priv; + + pas->mem_region =3D qcom_pas_ctx_map(pas->pas_ctx); + if (!pas->mem_region) + return; + + rproc_coredump(rproc); + iounmap(pas->mem_region); + pas->mem_region =3D NULL; +} + static const struct rproc_ops qcom_pas_ops =3D { .unprepare =3D qcom_pas_unprepare, .start =3D qcom_pas_start, @@ -579,6 +597,7 @@ static const struct rproc_ops qcom_pas_ops =3D { .load =3D qcom_pas_load, .panic =3D qcom_pas_panic, .attach =3D qcom_pas_attach, + .coredump =3D qcom_pas_coredump, }; =20 static const struct rproc_ops qcom_pas_minidump_ops =3D { @@ -696,11 +715,6 @@ static int qcom_pas_alloc_memory_region(struct qcom_pa= s *pas) =20 pas->mem_phys =3D pas->mem_reloc =3D res.start; pas->mem_size =3D resource_size(&res); - pas->mem_region =3D devm_ioremap_resource_wc(pas->dev, &res); - if (IS_ERR(pas->mem_region)) { - dev_err(pas->dev, "unable to map memory region: %pR\n", &res); - return PTR_ERR(pas->mem_region); - } =20 pas->pas_ctx =3D devm_qcom_pas_context_alloc(pas->dev, pas->pas_id, pas->mem_phys, pas->mem_size); @@ -718,11 +732,6 @@ static int qcom_pas_alloc_memory_region(struct qcom_pa= s *pas) =20 pas->dtb_mem_phys =3D pas->dtb_mem_reloc =3D res.start; pas->dtb_mem_size =3D resource_size(&res); - pas->dtb_mem_region =3D devm_ioremap_resource_wc(pas->dev, &res); - if (IS_ERR(pas->dtb_mem_region)) { - dev_err(pas->dev, "unable to map dtb memory region: %pR\n", &res); - return PTR_ERR(pas->dtb_mem_region); - } =20 pas->dtb_pas_ctx =3D devm_qcom_pas_context_alloc(pas->dev, pas->dtb_pas_i= d, pas->dtb_mem_phys, diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index 137992456b71..002100fe2d32 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -478,22 +479,28 @@ EXPORT_SYMBOL_GPL(qcom_mdt_load); * @ctx: Pointer to the PAS (Peripheral Authentication Service) con= text * @fw: Firmware object representing the .mdt file * @firmware: Name of the firmware used to construct segment file names - * @mem_region: Memory region allocated for loading the firmware * @reloc_base: Physical address adjusted after relocation * * Return: 0 on success or a negative error code on failure. */ int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware = *fw, - const char *firmware, void *mem_region, phys_addr_t *reloc_base) + const char *firmware, phys_addr_t *reloc_base) { + void __iomem *mem_region; int ret; =20 ret =3D __qcom_mdt_pas_init(ctx->dev, fw, firmware, ctx->pas_id, ctx->mem= _phys, ctx); if (ret) return ret; =20 - return qcom_mdt_load_no_init(ctx->dev, fw, firmware, mem_region, ctx->mem= _phys, - ctx->mem_size, reloc_base); + mem_region =3D qcom_pas_ctx_map(ctx); + if (!mem_region) + return -ENOMEM; + + ret =3D qcom_mdt_load_no_init(ctx->dev, fw, firmware, (__force void *)mem= _region, + ctx->mem_phys, ctx->mem_size, reloc_base); + iounmap(mem_region); + return ret; } EXPORT_SYMBOL_GPL(qcom_mdt_pas_load); =20 diff --git a/include/linux/firmware/qcom/qcom_pas.h b/include/linux/firmwar= e/qcom/qcom_pas.h index 65b1c9564458..fb2ec3be6a16 100644 --- a/include/linux/firmware/qcom/qcom_pas.h +++ b/include/linux/firmware/qcom/qcom_pas.h @@ -8,7 +8,9 @@ #ifndef __QCOM_PAS_H #define __QCOM_PAS_H =20 +#include #include +#include #include =20 struct qcom_pas_context { @@ -22,6 +24,16 @@ struct qcom_pas_context { bool use_tzmem; }; =20 +static inline void __iomem *qcom_pas_ctx_map(struct qcom_pas_context *ctx) +{ + void __iomem *ptr =3D ioremap_wc(ctx->mem_phys, ctx->mem_size); + + if (!ptr) + dev_err(ctx->dev, "unable to map memory region: %pa+%zx\n", + &ctx->mem_phys, ctx->mem_size); + return ptr; +} + bool qcom_pas_is_available(void); struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev, u32 pas_id, diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/m= dt_loader.h index 142409555425..74886f772d46 100644 --- a/include/linux/soc/qcom/mdt_loader.h +++ b/include/linux/soc/qcom/mdt_loader.h @@ -21,7 +21,7 @@ int qcom_mdt_load(struct device *dev, const struct firmwa= re *fw, phys_addr_t *reloc_base); =20 int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware = *fw, - const char *firmware, void *mem_region, phys_addr_t *reloc_base); + const char *firmware, phys_addr_t *reloc_base); =20 int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw, const char *fw_name, void *mem_region, @@ -47,7 +47,7 @@ static inline int qcom_mdt_load(struct device *dev, const= struct firmware *fw, =20 static inline int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware *fw, const char *firmware, - void *mem_region, phys_addr_t *reloc_base) + phys_addr_t *reloc_base) { return -ENODEV; } --=20 2.53.0 From nobody Fri Jul 24 20:48:45 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 3A6643D9553 for ; Fri, 24 Jul 2026 18:29:31 +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=1784917772; cv=none; b=PC9ETWzRrni6HCk0a4F+/+VyJFpRhKdGZlQuJRS6pgUKNfVEC8xasbhYGzGeYoZ8j+f5KDCoWcIUexideu8KUDa+r08Tu4kjArlbGj2q6Pw59TjjgS6ka9ES5UZLhHNMJRoaHGp6asFznd5eXL4CyKCsNdqeWslzlkMVznrJI8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784917772; c=relaxed/simple; bh=Rd08ZYH+g7lm0KkA458fZcsV5EcdJIBQIovcvHvcM20=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tkes5dRJa4p2sSMSCWW3M7fW6CcHHiVH6K1/2DceQJj8Bb2oKq/VlQYU+nq676hClGR+sdlrNQpNwh7hbfGgiGpjMSb5QYJLvHRpc1pa98Zhky6nxIJaijtinLbqABS6Wlcevxno9phIbI2cyqqu3c0vYEIJjsGcOgvyeStHqIM= 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=H6/g7qHn; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=E1h8wtVm; 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="H6/g7qHn"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="E1h8wtVm" 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 66OGqhuq3378172 for ; Fri, 24 Jul 2026 18:29: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=Fa5SBdOmTAH 7sHy3pw/Dk2Y3Rqwllq27Y/6IQIjOoqg=; b=H6/g7qHnTzKsMDWWrH+TbVECPoM C05ZqF+Y7DKu8pvuHwHLXJDlkT5j/WRqtQIBvLwsAhy7CJ0KQUjMZCjvvW8vLzeA uK+gbHVJ3KopYSGRs+KasFKhZK6xSjZkyfY123LvNnudfVDacEavanjO/qKVPIXh ZzlU27Cgqhkc9yPt2ybmeVdHGsH65CxQHGWi0yku77UStshovgRJDqskhY7cK3qK BHjI3ayFDQZT53KSQEtUBD7x/7AzeM3JVgAUbISd0yItB90AqUm2nhVUrOM3C9KB jOjL5k0ZaJNBsRLk3+O86vY8IUFnoLyK1cf4A5yITDTJ6TDpjSBd0+uYNcg== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fm8cj97e0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Jul 2026 18:29:30 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2ccd1958e8fso8848105ad.2 for ; Fri, 24 Jul 2026 11:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784917769; x=1785522569; 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=Fa5SBdOmTAH7sHy3pw/Dk2Y3Rqwllq27Y/6IQIjOoqg=; b=E1h8wtVmuUE1XnUThh9dIYiQxia9rKP6afe5fdIqCy2jcQYsCPWD2dzXDJwLhEDLFg 2/AcgyFJKv52vFIzkcw5dhj6BIsJtRGeHVflnO6RMqoMEDwQE9lp5v+eJlfvNxnsdTau lvXkFqURlbno5Yvq9t53fgmJpwdM6DSC8rDAiQ1YGkJj3qXBR4ezdTa5BLIG9c484qw7 TOuQQchQ6V98fntDHDKC4A4qIaXCthgxo7yvteraEkLfXWfjSNrcXYuIyDnX8vwDfdmE rXjcNJn+AwgVYE5Dw5DWbwMRN8gd6+IusntPTMW3xWsYzK7PPcCDDDr4ijyZvJDsZQXi 8b2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784917769; x=1785522569; 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=Fa5SBdOmTAH7sHy3pw/Dk2Y3Rqwllq27Y/6IQIjOoqg=; b=GD0s2FJ44ihxZNrL+GKfDMwd4qSgHUo6s4RZoYCegttmZU1W3/Pfyu/+zl6P/FkTVN 1tSonEUj2Orce2GJnitnhgYHIB6CaOMfFyD32ORSyvdolGcMbRBXHSGrbIJMerV3yhAi wmEnuJYECATnSc4vmlrnDvBiKv23AxJTp8aT5kT99+jhI87w261j8abyAQ0C7Yetce4V vZtg6rGWZO1ULXnXIp/IFKz4zrQhwbL9qihV56i4guti6kngl1AwKf51gwJ+WNwhGb23 QyJAQ/Q42i54han2T2HYE7crCKY1r5vBOatC/gb01Ok8oCqwCpcagSOkTFcf2H9nhgRe GUrw== X-Forwarded-Encrypted: i=1; AHgh+RpGl/vwO7eX9bF3ax1gBY5JI8z2PizkGZj6+2apBx0BAmm0hYZzNJYzvEOVoZVYrctO1clW9kyOJU+Zwso=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4iR8oI2oiPzyZKXph71ElZ1vAYRvUL8aD4CZtBVIpKTv7p/AY 2v2mCen5u+y/wB2LdkiaV3QtrkMZzNjLI/4XLpn1sw1/fzOUO3VZ1Rth7KyiAELZtHYJXwKYZ/H brNrG7acFJodTfMmmb29ADOz7MZkFxc0ejzC4Qw+n22lDQXlw0gD9Na15rUXXkki9qjQ= X-Gm-Gg: AR+sD10myuiMfsExFmk4uKep9rhs/WO8r3HJaI6oUvmfO37H8i2hHIOQu5wCZROcjq2 wPY1v9naaO8cJr0R4n2tiQn7ZW8gdsXuT65SjxKgAZNXEWBLVL2OqxIEvd9Iiel5rlSCJlPjWdk HcTV8zVgvI+eqm1CT1GLwKX55YitqEiH38LAWXHcOhFCrKy2wGY0OmrY1lbISLoKs+li4JcFZWX hG8yiCPTJxsfCGbBZhYi5qJPna0svIAMP4aSbAOKp0GVebZXSLZaqpq2fZNDRQH7FEYRWcS98Vy kk6d0VAv6MRzSNUKsb422rcRTl42OReofUNeCqYJv8ITF6kr3Oos/ylZlDk/NFxRgT53eUjWHOr 2lUaMfRicoLgK4AnwvPvnC5F9aHk= X-Received: by 2002:a17:902:f642:b0:2c9:c517:d078 with SMTP id d9443c01a7336-2cfa6c7884bmr95900395ad.36.1784917769465; Fri, 24 Jul 2026 11:29:29 -0700 (PDT) X-Received: by 2002:a17:902:f642:b0:2c9:c517:d078 with SMTP id d9443c01a7336-2cfa6c7884bmr95900235ad.36.1784917769035; Fri, 24 Jul 2026 11:29:29 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5c53f3sm1341510eec.30.2026.07.24.11.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 11:29:28 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sumit Garg , Neil Armstrong Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha , Dmitry Baryshkov , Konrad Dybcio Subject: [PATCH v5 5/6] remoteproc: qcom: pas: Drop unused dtb_mem_region field Date: Fri, 24 Jul 2026 23:58:57 +0530 Message-ID: <20260724182858.1868271-6-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> References: <20260724182858.1868271-1-mukesh.ojha@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-Authority-Analysis: v=2.4 cv=GJE41ONK c=1 sm=1 tr=0 ts=6a63af0a cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=Lqr_36QtIFBVL_bOULEA:9 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX/PR11jQgpGMv ALv6ySohkGCLIftt4N7AdljWMXNcofYA8OAMfNnQXTZjO9QL0qW0DvbpndsA9nAmBGwZEOlWhry bU1ozmNO83FHYRbUpr4PF1kWugZzc0q1NRQgrmhQVgwyOMVcT5psmhZJLiAzRswaUZoCa4xm4Ww R/DIYcStnPhuNR2OhnrWeOaKR+Y93gCcRE1wgP26JpecBD6C0bBug+Lw5sO1p49IsQmMT6pk23e /1t0E052r47h4hEJp6ekDRveatGzvHU7u745zXXi0pd+WxfZfyRcSs0W1nWX4vhtzESerhYIqzG NZFzw55HpvvIjxBD6PMcEJTHz7uSunBpgmeRp1aqw39LMsNOpPI6wj4JB3LKYJHVIjtOgXAJeUk qxoSNP4ADNh66JsJ6ZUy/jpMfz/TLPH6RyDw8lU79tS6MGmyNQ+5PzHj4JNTG+9GeF+aKb1RzQ8 OeRKsCQv7PwnHzxD2jw== X-Proofpoint-ORIG-GUID: _UWI8AweGgaoBnqoNSZ6fPR3GJXlRUjs X-Proofpoint-GUID: _UWI8AweGgaoBnqoNSZ6fPR3GJXlRUjs X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX01c0x21V3bvn ckV/FqwZe1Wu2xIIMfLNXjwxdc1dqbZxYMoks0qpi3JoCA1H9WK8rSHNLWXSdg4vdYdG5bTf44i tsYM5cSHgLxMh+V8SutprCzN6U+o2EM= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-24_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 priorityscore=1501 spamscore=0 impostorscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607240166 Content-Type: text/plain; charset="utf-8" dtb_mem_region is no longer referenced after the ioremap was moved to respective places where mapping is required. Remove it from struct qcom_pas. Reviewed-by: Dmitry Baryshkov Reviewed-by: Konrad Dybcio Signed-off-by: Mukesh Ojha --- drivers/remoteproc/qcom_q6v5_pas.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 5cd34086ccac..0391e30f42ba 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -101,8 +101,9 @@ struct qcom_pas { phys_addr_t mem_reloc; phys_addr_t dtb_mem_reloc; phys_addr_t region_assign_phys[MAX_ASSIGN_COUNT]; + void __iomem *mem_region; - void __iomem *dtb_mem_region; + size_t mem_size; size_t dtb_mem_size; size_t region_assign_size[MAX_ASSIGN_COUNT]; --=20 2.53.0 From nobody Fri Jul 24 20:48:45 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 4FDB544CAE0 for ; Fri, 24 Jul 2026 18:29: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=1784917777; cv=none; b=CLndCkdi/KvGBveFHuDbWJzItkdCOF6trET8IDSOR+VK+LCNWhM1BtKQd/ZzubZPFFSI62sFGb1JqZWFdPb4qjEgmHk68CMlWfH1nI2j3Z2GWP/JAb/McUG5vqPisfNeAbDGotezox3VJbtK0wL2DztLrKayQw3D/MFmBju5Rjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784917777; c=relaxed/simple; bh=GkHfHDQxq6kcXRftPPAVs8KKYHLSKlMYMaUrhFTu88g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=r7201qbMAuFd7+kYtTaaHf2dnVA7EgPKFdaB7WtsxnvksjU1yT/R7MozgOw1TEcw+JfQvYD815BJjf3Whdc+mz/Q9ZTeDUvKOKfyFVnVHN18ZJPU01Fyrv9cVvh26hpsjr4Yx6Ot5c5xRS5wLWiMv8jPjvwhQy8x2Zn7GBp3+WE= 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=PiG+F52h; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PVcG+fM8; 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="PiG+F52h"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PVcG+fM8" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66OGrKsa3940377 for ; Fri, 24 Jul 2026 18:29:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lFaAYGbV+xSMPR84AyNeauaa+2DTFZJgYrd5KO4zgn8=; b=PiG+F52hk+NVIPPl 1vlXjFxesj5mQgq0z1X0A/p/Mgi8E3d+vuwRN9kWT4ozhfvCy4mjQCVz1sirXRgj gm0BVwpVZeHtSDGOxoSK7T2xYPtZdL/ZradLs0surDzeOfttmEfVN4AfXG7d+nvJ 8HdzWmNqtTn/aQZcgOGMsJx/YaaHP3u3Xt/jzbXYxkFtFs4WYSWbsuRJvWuM/gF6 jPDDA/60dFSioLk+tUdefQ/fztwxgQX/MaFvB7nA4YoPOdJjCZWLDteny6ZzxfHP 4EO+kLnh0SUvp2s4uumZj82ekQoFObZZA/KehabLNgGfJBNBModJe/TQmFKuk8gW vxijvQ== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fmb6p8h51-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 24 Jul 2026 18:29:34 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cbb92868263so834790a12.2 for ; Fri, 24 Jul 2026 11:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784917773; x=1785522573; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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=lFaAYGbV+xSMPR84AyNeauaa+2DTFZJgYrd5KO4zgn8=; b=PVcG+fM8/NunPIpfi7NPNEgDB450ippw1vFWwNNWxj+p1k1dzXQmVbDZ8W/X56kYJW Meyy2XiPTfUTT71IzLc5iEtkn7CAWttdRcygJ7ymGLU5PbGANthYDi3VDv+rElYv/6lS Mmd/9JeiiabrqNBt4Pg+MmPC29Zs27v+JEuV5su8vn02ysmgKtZJvhhINynRucDILvnX gxwfSd9p2xz6iUsTWcGN/6u2mcIQhu2tQqZEDNIIzQ2Xyk5iW4K2s+meBj0kT+wvpuew cKj/Z3DfVbBR4gtNx6Sh5nXdrTsISWn8Jgz2EqAA85aeUFFu7BYSkEC4cKKOYR/HsyYK wQnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784917773; x=1785522573; h=content-transfer-encoding:content-type: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=lFaAYGbV+xSMPR84AyNeauaa+2DTFZJgYrd5KO4zgn8=; b=G/pHZzqh7nkgVViyXGFyp2F44v2UKpjyrTVGCdmEAXRgqlRPVkx0fXqAndb6BHDIEr 2gwvFzOIpAq6QiWZ+IP0o2XYEQD8VmpZZugzwKa53xeRf+t5lCgv/rzmZeTV0gPNeWSc v1WvtqZ0c7XKRcw+zguF4rlX1ZtIHLqSRjcrG1hD7RQGqCliwpuwEHalogcKEIgKRr67 hYV71F28+cz2kdp4a9on6KANwbfcvZrmOa4lUkJ4TniPHtuFoswzOLB+EZYpx+Ey0UVt WCdsSlhDb9Ds2K/gCRSOCogz+KXZ1kduSROxi9dOwZ/yonNL4XqNI41MfPR1hs55pq3T nadw== X-Forwarded-Encrypted: i=1; AHgh+Rp06oGANF6CgDdyiHjjdzdbXOoEB+0glcOqGePfYykh9cIWGbxPJnIFTirIHr6Sv2aTQ6KHPM35pe88dpo=@vger.kernel.org X-Gm-Message-State: AOJu0YzoRw9U4aZ1bt5J++dIbgZTo3L1TN67K97VUyp3g1AI/oyqKVVR +zqiJ3ZJbJ7Ykj6OFh9+4I6uOWq+hS9zA1Rr2OA4Js8XbdypUeSjOgXnZq0d8H1MbCKeWL9t5Tr y6kGd6Qy3bvra97TIZHR8Vg592RZFYWRBE2RCGLTDWB/84bp++4e4vpts4E6DNRc0/os= X-Gm-Gg: AR+sD13AXVj7rmSzQtGEVIqTxTZ8fLFeRX76+eJ8+fh3jgXeBfezs6jX2Em1hw7L8ra 349r8HlYd4OvHrQ/lBl7RJdj3mwITnED7p8QBvuR8lV0yDWPIdkOuw6KbIA2Z9JF+3GybVdpBr2 vELPNAwZeSZh3gjiR+1EJSfRK2K3ijmSO5gALmVhZFv1E0Jgit/TbkVVqOqWPdJ0YgJ2HTweVDE XZO2dS5IdRbzOcLn26ch+AI/uGIsnifbd3FMyvLRmXzCD18BXznEtKV+vmuyK+g6HIzWqijuhYh w9feRywO112YzYipsOd+y9CbG26t/p2bFrq1yrjFA5GP04JqDbfzpIxHLmfYVhrjnNCESgbxBnQ wfQK9MWirwx+DkvOlrMI/feR99w4= X-Received: by 2002:a05:6a20:a11b:b0:3bc:5284:4859 with SMTP id adf61e73a8af0-3c44afb4d8amr9788769637.13.1784917773199; Fri, 24 Jul 2026 11:29:33 -0700 (PDT) X-Received: by 2002:a05:6a20:a11b:b0:3bc:5284:4859 with SMTP id adf61e73a8af0-3c44afb4d8amr9788723637.13.1784917772646; Fri, 24 Jul 2026 11:29:32 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5c53f3sm1341510eec.30.2026.07.24.11.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 11:29:32 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Sumit Garg , Neil Armstrong Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Mukesh Ojha Subject: [PATCH v5 6/6] firmware: qcom: scm: introduce keep_mdt_buf flag in PAS context Date: Fri, 24 Jul 2026 23:58:58 +0530 Message-ID: <20260724182858.1868271-7-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> References: <20260724182858.1868271-1-mukesh.ojha@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=AureGu9P c=1 sm=1 tr=0 ts=6a63af0e cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=g7xFvzIaMl2GvowGQBkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX2XQsnQdbzDao a9izp+l50LfjLGd8eKisk+K0kGXOyktQEwF4blh3I4DAy+PKEuBTAmyrPEzPJ5FUIlA6n+u5FEg 0AIRk036FQm3GCV04TW3UfbUzbQaPvQ= X-Proofpoint-GUID: j4YzxYIiNEwEqsrbfdAcCRH2vkH6EGgq X-Proofpoint-ORIG-GUID: j4YzxYIiNEwEqsrbfdAcCRH2vkH6EGgq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI0MDE2NiBTYWx0ZWRfX2J/GNkyycv/1 BkPQ8GExiutCogkkQN7YwJf8pZ6AE2/5D1B/JCZ8v0gt65By6SdfpdxUSC/sTxqqDFsf8Km8EXv L4Ok8eOjsfDMTsCphYMBdgxMmSXJFt4yGRNuDdIh0nAawjc6MMqBzC997p+/5NSEItsTQb+3qqI AnW1h/iidTAQV8f9yJUsv7KjefurTAKmZAy/6jkD1Yez3x675ymdGhbWG4ZaWsJf1otQXbJmrqK +fHJFeIa8jbzacpe1DZgcGDcM7NN7sbOB4m25VQSyzAKEpEdllsdsqCwrOc3m3lyOS+XdVH/0HE /6gKV8BR7q9Bdmy87UnHh6ZuYyDQ6dfkTBtZBbsG3qU2p6CKS/+xJsSshZtAUjObrDukZ4Yg7pY kRDagDyEMFJ0MMG7kYPnc90FJjKP9Nn4gtw4L9xIqMF8bYSC61Y+nGO/klPuC6MnOChe+Q05Gcq Ai878M6eO/aNSKFGrgA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-24_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607240166 The PAS image initialization path always retains the metadata buffer when a valid qcom_scm_pas_context is provided, even if the caller does not require it. This implicit behavior leads to unclear buffer ownership and forces new users of qcom_mdt_pas_load() to manually release metadata, which is error=E2=80=91 prone and incorrect. Add a keep_mdt_buf flag to struct qcom_scm_pas_context to make metadata retention explicit. Metadata buffers are now freed by default and are only preserved when this flag is set. qcom_q6v5_pas enables this during probe for contexts that require retained metadata for subsequent PAS operations, while existing callers continue to work unchanged. Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_scm.c | 18 +++++++++++++++--- drivers/remoteproc/qcom_q6v5_pas.c | 3 +++ include/linux/firmware/qcom/qcom_pas.h | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_= scm.c index 16ae42e6c434..54ffec97cc26 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -625,7 +625,7 @@ static int qcom_scm_pas_prep_and_init_image(struct devi= ce *dev, mdata_phys =3D qcom_tzmem_to_phys(mdata_buf); =20 ret =3D __qcom_scm_pas_init_image(dev, ctx->pas_id, mdata_phys, &res); - if (ret < 0) + if (ret < 0 || !ctx->keep_mdt_buf) qcom_tzmem_free(mdata_buf); else ctx->ptr =3D mdata_buf; @@ -664,9 +664,21 @@ static int qcom_scm_pas_init_image(struct device *dev,= u32 pas_id, memcpy(mdata_buf, metadata, size); =20 ret =3D __qcom_scm_pas_init_image(dev, pas_id, mdata_phys, &res); - if (ret < 0 || !ctx) { + + /* + * Some clients still pass the PAS context as NULL. Until all clients + * switch to qcom_mdt_pas_load() and provide a valid PAS context, check + * for NULL before dereferencing it. + * + * When a valid context is provided, keep_mdt_buf controls whether the + * metadata buffer is retained after PAS_INIT. PAS remoteproc subsystems + * set this flag so metadata persists until auth_and_reset() completes, + * as TrustZone keeps the buffers locked until then. Other callers leave + * it unset and metadata is freed immediately after the PAS_INIT call. + */ + if (ret < 0 || !ctx || !ctx->keep_mdt_buf) { dma_free_coherent(dev, size, mdata_buf, mdata_phys); - } else if (ctx) { + } else { ctx->ptr =3D mdata_buf; ctx->phys =3D mdata_phys; ctx->size =3D size; diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 0391e30f42ba..38e6f6019825 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -722,6 +722,7 @@ static int qcom_pas_alloc_memory_region(struct qcom_pas= *pas) if (IS_ERR(pas->pas_ctx)) return PTR_ERR(pas->pas_ctx); =20 + pas->pas_ctx->keep_mdt_buf =3D true; if (!pas->dtb_pas_id) return 0; =20 @@ -740,6 +741,8 @@ static int qcom_pas_alloc_memory_region(struct qcom_pas= *pas) if (IS_ERR(pas->dtb_pas_ctx)) return PTR_ERR(pas->dtb_pas_ctx); =20 + pas->dtb_pas_ctx->keep_mdt_buf =3D true; + return 0; } =20 diff --git a/include/linux/firmware/qcom/qcom_pas.h b/include/linux/firmwar= e/qcom/qcom_pas.h index fb2ec3be6a16..1d132e89536e 100644 --- a/include/linux/firmware/qcom/qcom_pas.h +++ b/include/linux/firmware/qcom/qcom_pas.h @@ -22,6 +22,7 @@ struct qcom_pas_context { dma_addr_t phys; ssize_t size; bool use_tzmem; + bool keep_mdt_buf; }; =20 static inline void __iomem *qcom_pas_ctx_map(struct qcom_pas_context *ctx) --=20 2.53.0