From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796205474; b=GVoq8riLTdi3xk8aNs/AQE5I3U96iIUx3A7w6ntoYiIcQ6Ul6CHTZkSeA33bQTTiGLWB EH+HCAg3iJu3WIqclm4hQ4l2A2Fd7YLnFBt7YQa3kvLvRWer1jfloL2ccSAnH2lPa1t0y Zov/OlXTISKJcGk4ODXH433uywZg5bcT+Rox4qdo9ByJNFCLjbmemlcynGhChtFFW7V9T IGWPVLVXRGiurQPnqSVHaCYyKxcxlESpPZvZRDa9dkQ2Eh0oC9T+eVQLr61Xwbak2fgAr 6SwtUbucEUeve3Kj5449Nv7zFWMZaCIh7+5CYDz9UxKRUH6HNvmVH755UCzHr9oRVWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796205474; 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:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Authority-Analysis:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=PNoeJaozSokhamviWUox89gQmhIMNBmMdshVm1xuzug=; b=LI3zqI3tBPhBJIUV1SwfqJDw7HyutOe7kHChhMfPRsl+wan2T/AUzW9yjhCMHitpArFD gEshSSyit7+DuFYDuHbjILHQmHlSMK+kAnxz6c26OdGSVWHLxvj58xrYCSc1dCm7qYVMA 4Xpy1MkqOP7c6Zp8BMBlAzP8JMm3yuwxuitAsQe/bz75zk17rsirUX7MPpeoSWA/OJfQt 7izcd8HronC9iNbusIOY83yKq36vsVfGZF8W2jyDyqRq2gtMhAv74MNxL2vFW6c1X2xzH a4MqG87oOmW+pxVwQB1JmQ/nUVyCigg1wIyIBeTH3kP805ZuFPRHx8x8HsPJDPaSaPw== 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=E+de8K2Z; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Lx+eC7ND; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 3ECB5606A334 for ; Wed, 2 Dec 2026 09:57:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3ECB5606A334 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=E+de8K2Z; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=Lx+eC7ND 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 6B26p2Mo854620 for ; Wed, 2 Dec 2026 09:57:53 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= PNoeJaozSokhamviWUox89gQmhIMNBmMdshVm1xuzug=; b=E+de8K2Znybn7CNF fUWZvT7krp5ViSc4tNYSamH/JBosuweKzkLkKzfLfY03xYGYaf3grvoXdUP879B7 MGoiU3SIIgY8aDnyKTydR79+oM6577gL/ImdjOksqVMnTWbhiE2zvG4eAaeaY/m1 bpOlCZvKHJqDfVhWUH3ZGkcJ45lTJQrd+XuRVMaSJxckE2NIsDUXsnacMGy0irgX 63NGIVm1tWV6fEDyTYvy71F6Q+6FaMkCxRihGMX8AgjGrtyREJF+WRHT0qno+Fnq aBhdiAFyBC5xVx6d9kl5kQZxx5MNbM2VyFEzmr7w7E4DYmsyTKAf7lyJdwljcacg 7t368g== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ja4kyb15x-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 09:57:53 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2efa9aea3c0so173028865ad.1 for ; Wed, 02 Dec 2026 01:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796205473; x=1796810273; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=PNoeJaozSokhamviWUox89gQmhIMNBmMdshVm1xuzug=; b=Lx+eC7NDj/ZStrf/PGzf7FrMvWg9m80jT/qeSHqtxI0rmo83mXKw7aqlu1J/lJjl2g dCUpAf9sEbthKJbOq9lBRU0hW0Dt+jJt0Pq2uYa+jsXPHh/En6eFhrE9QGtKUWmjRlMr IMpm5cQrXA5boZ9dBEznWq0WZMrfroMTMjlNY5siWowgOmgE3sGT8c/sogMLWA70dyl5 vtNWSkHfSRmvW1u+/e2HKYstXACfXFPpqg1BpJa01UA0BF+vVv3VVu4tW761/bF7vDF4 ngwb/qEkS+g5U05xzzQ5A4/c2Bv5OFoOeXBdelXZ6DQJonbEPltDRSf/FY/h/Ls1cwi9 ywbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796205473; x=1796810273; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=PNoeJaozSokhamviWUox89gQmhIMNBmMdshVm1xuzug=; b=yrYtMnuDezPHo3fWCCi4f3gTc9Yga0oCNOXO+IdwP4wjab7OpmrhMirn8TqBJRc8Oa AgS1I3m+bspdIoUUmfVfSPGvjgfR+3G+ZXXHw7QyCY5qRCVqrMVq1yGKi6NGS6VXRKGb HUNOq98uedMW27I+2721TPFoD1b4wk3gtqIPFuUmnF2viTkL1Ee0L7ceH82do5BqtBa8 fqUnLLMXrWgB4JYGr/wptUmNhkXH4K/O3XUYVFvtp4k9fYBmMctACLkcsr8SpPuoGUy3 KQthBVrZe3HqLSGPE9P2wEw4myjUpieyUY8VOyR1fDtyc49i2jpO+R3a7L6TDJMgMXBD bLOQ== X-Forwarded-Encrypted: i=1; AL+hErFYzXmsq5ZnTJMnGMdyNJRsoTPn8rxZ+XsqR4ELWsOwskLVxb7/TotNBPd7K/mgeq2SXEZV+qAcamHHfMg=@vger.kernel.org X-Gm-Message-State: APuU4Z9vtlnDWkSJnUxMeVlpiW41ZTKmfUgY4g/WLM+YjqWWbsAxHeGL WmWjGI1Bi6Egca2bsyYNpvwqFx1MxtF5Mrs9QU0PGGOKeb2p73VvOeR7/couhI/qKipWIFe3ye1 vYSGOhZiwt0k3ck/z5NuPCjpACx2BlByGl+aVQ4XtOHZka5RYMoQnAQus/4dVBGAmSNU= X-Gm-Gg: AZFdTZdotkBv0rhkcIWNPROQSGepy22Xw1obrlBw2r9BVW3DTGJ9W5E1BJOyDb9lyZi 4Zpy4IExNY0jku4+pr3jdYD8lN+c4ky/kmFL3els8JILzF/EA6A8P6aIDHu2TqkMoQAXBnHSAwE nh8ajjUGS66baAbfZtRcx3u0+twq701fdSaCQ93vnpum+pdMK5YyqYr/KOHS5BMsa1BcTVwH64f CbT6IBRI7Qi94WFP8x+9Lt9aoDnkOzE0f8tE86qVuZXsBjkYPXxEKQ/1bT1o1moeZDtKmAL7TB/ qECkgkuEiG2+WwBfPdfeH5hC4T2Kzp3cxz9BIws8gUpQ5dc8wSGfj0//e7KZbtA6Iy8njOk/JRx uatl2gC52gFCEaC9G3ZkWf4lXIFMLyVeQd3b2AspgjRiGxxzd/csSO3x2FSJ/D35r3AJXOe3e/r HxaM8= X-Received: by 2002:a17:902:e5c5:b0:2f0:345a:25ab with SMTP id d9443c01a7336-2f03f18dbf9mr426211005ad.59.1796205472680; Wed, 02 Dec 2026 01:57:52 -0800 (PST) X-Received: by 2002:a17:902:e5c5:b0:2f0:345a:25ab with SMTP id d9443c01a7336-2f03f18dbf9mr426210755ad.59.1796205472206; Wed, 02 Dec 2026 01:57:52 -0800 (PST) Received: from [10.218.0.115] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03f0dc0ebsm194169615ad.33.2026.12.02.01.57.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 01:57:51 -0800 (PST) Message-ID: Date: Wed, 2 Dec 2026 15:27:46 +0530 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 2/2] remoteproc: qcom_q6v5_pas: map SOCCP carveout privileged-only To: Shawn Guo Cc: Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jingyi Wang , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Bibek Kumar Patro References: <20261113-nord_embedded_el2-v1-0-48f717e97066@oss.qualcomm.com> <20261113-nord_embedded_el2-v1-2-48f717e97066@oss.qualcomm.com> Content-Language: en-US From: Anurag Pateriya In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=O8ysLx9W c=1 sm=1 tr=0 ts=6b0feba1 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=s56EoA9XyD98DdRESF8A:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDAzOSBTYWx0ZWRfX5KqxjvEH2s9l gsjubc51xPAmhrqr7ypIaxWbyAZFWRY7L4WJ0TpwI0m26RddOLnzSc5kegjUe8riIBPjegdBYAO GM0GGw7OLLQ4+04vJQY5nb7/yK6BtX0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDAzOSBTYWx0ZWRfX7V1iaXrIWDFO ZeN49HcjdK0xj/vwWbKSxHMyVBh7dC9YVM054TLNRw+Cxm3Hsr/+EdK9uPZ2WOSO11QlWQW4FQx pL/1fkTMthUk7c7DEA5ZNArkGjlopd7lqduVf8cuwxg5kMZ8ny5fUjyH5sRy3Y7vFWFbSCU4OSJ Jv4pV62Uyl7viq9hu2S6FzSGmmrD9YmAMJeGdLezPowYgIPPdJfMygqFSads3tbC+Cl4tVXwnR2 qRoTyVYP5jh+d3xduv9ugbhrkXV5NFNPjjJQ96akJ8vSseXsZ/sdKc3v/hW0CA7PdwlP2z8R7v1 CScQqSpjw2hzp0YTiHu62ascJiHyH8fuzPnp7ZFeIvbld7Z1278XitLK21+kdLpTukOFC2LZmjy /QTibzCKT0ooxit9p0yi78xittS+VdR/mhvQ7VR4AhBLxZ3u1aP4d9hWzHy4kiAXZRVfWEQXIDl bBuW7liqPMRkGJbwvYA== X-Proofpoint-ORIG-GUID: 8QN6w0gmalUN13Il95aoy7gGUEdBTIlj X-Proofpoint-GUID: 8QN6w0gmalUN13Il95aoy7gGUEdBTIlj 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-12-02_02,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020039 On 11/14/2026 9:58 AM, Shawn Guo wrote: > On Fri, Nov 13, 2026 at 05:54:13PM +0530, Anurag Pateriya wrote: >> From: Bibek Kumar Patro >> >> SOCCP is a RISC-V core whose instruction fetches go through the >> SMMU in privilege mode >> >> The memory region is mapped with IOMMU_READ | IOMMU_WRITE, which results >> in permission fault when SOCCP fetches instruction, append IOMMU_PRIV to >> mapping to allow it to fetch instructions. > > This says what fails and what makes it go away, but not why. A reader > can't tell from this why an RW mapping is fine for a data access but > faults on an instruction fetch, or why IOMMU_PRIV fixes it. > > As I understand it, the chain is: > > - Without IOMMU_PRIV, io-pgtable-arm sets AP[1] in the stage-1 PTE, > so the carveout ends up AP[2:1] = 0b01, i.e. writable at the > unprivileged level. > > - In the VMSAv8-64 stage-1 permission model, memory writable at the > unprivileged level is implicitly privileged-execute-never, > regardless of PXN. > > - SoCCP fetches arrive as privileged instruction transactions, so > the first fetch takes a stage-1 permission fault (FSR.PF, > FSYNR0.IND=1). > > - IOMMU_PRIV clears AP[1] (AP[2:1] = 0b00, privileged RW only), > which removes the implicit PXN. > > Something along these lines: > > On Nord, when Linux runs at EL2 it owns the SoCCP stream and the > remoteproc core maps the firmware carveout through a stage-1 SMMU > context bank. qcom_pas_map_carveout() uses IOMMU_READ | IOMMU_WRITE > without IOMMU_PRIV, so io-pgtable-arm builds stage-1 PTEs with > AP[2:1] = 0b01: read/write at both privileged and unprivileged > level. > > SoCCP is a RISC-V core whose instruction fetches reach the SMMU as > privileged transactions. In the VMSAv8-64 stage-1 permission model, > memory that is writable at the unprivileged level is implicitly > privileged-execute-never, regardless of the PXN bit in the PTE. The > first SoCCP instruction fetch after PAS authentication therefore > takes a stage-1 permission fault (FSR.PF, FSYNR0.IND=1). > > Map the SoCCP carveout with IOMMU_PRIV, so the stage-1 PTEs are > privileged read/write only (AP[2:1] = 0b00). This removes the > implicit privileged-execute-never and lets SoCCP fetch from the > carveout. > > Other PIL subsystems (e.g. Hexagon Q6) are not affected as their > instruction fetches do not go through the SMMU in privileged mode. > > Another nit: please use SoCCP (instead of SOCCP) everywhere, e.g. patch > subject, for sake of consistency. > > Shawn Thanks for the review comments. I will add this in next version. Anurag Pateriya