From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796241288; b=xmojNwc8INvesuvx5tpO699uDHOFmlScBSQUMUhRRy9UZxjFOZbZCGjGmYn6SXz3qTAt z8u7OaCoThh8SpFWAojI1jvpz8RW8J9mDWS1bH6suhQAZMpTNOScitf0IRIaKwzo0jB5j IDzxExbx+vAWEisLL1e00rn3f3+4BrzeteaE8/kh4WYKJp/am72nEZweCmh6HHk/YxsSQ 7JRTQziNcLKnWBVKB3FK728Ypj1OFK3zryoJWaAviQ6oaxxvWjgwJiH8v2FhdIKxSXCpG BN2XOQgXtvXPLdaWguGAF71YCDqvEI1s/rE0l7qrVgP8wlr38Nkdq0L/LbecT5xYX2Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796241288; 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:Date:From: To:Cc:Subject:Message-ID:In-Reply-To:References:Organization:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding: X-Proofpoint-Spam-Info:X-Proofpoint-GUID:X-Authority-Analysis: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=u9dDl6dDfHkl3iDhRC+5eIlJ/PY99wEEVgtETV8XrdE=; b=Q2CX0mX0jaXvB/wEallsjo+PP3kpinz6hB0XTHpXAbdyuGdAaimmsBFqirYWCGw4xYMJ mDO0uhsSj0G+KQ8gM1ZWC68OGgbkDKZ364j4mDDvYu7BiNAA/Bt0Q3E82kiYIiN9+NAYO FsrT2kpInaKKgEoFZsGv0nfEN+Wniy/EvgZCXNle3ojHitDSS97OiDO3tUFwV9ihzRcbu qpOgdWZiA0K8tV27+hA/6qYsl42OGvTuRRP8O/sfW4J4uGNF8HtMgSjgniVxrON+LmHVm xYyUq5Cz8mjwn63nDirrTw2i7xMhc+5wLWCQq3u4t84wdnXgic8/uyUIdiAhAJwWiRw== 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=KgTLQcBU; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=aAcwQkeg; 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 437F8606A322 for ; Wed, 2 Dec 2026 19:54:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 437F8606A322 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=KgTLQcBU; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=aAcwQkeg 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 6B2IuUVS1126447 for ; Wed, 2 Dec 2026 19:54:47 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= u9dDl6dDfHkl3iDhRC+5eIlJ/PY99wEEVgtETV8XrdE=; b=KgTLQcBU1MojGgQL Hc1BZjV4Y7AqskLbcSDsV8NW+UtN1HxSp2rvMaGIgvavK1FRUjI8FDiw5+mP/oNI kIKZYhUAavd0rwWrfOusSbg9vEV6YawUF5GtTaGj8d5MuMUd5Wq/f1XGTLWvjmwa VoqupZoOzXMMlK8oIOdOlQ49uDJAh1XII055A3eaRwjmDGO5S8n1tXVV5eXGUzJj Z5XJNB9mTdqAXvn/smJWRas/kGvq9iaoukf8MkUOGJqyxQXqJqDfVeaHAGQLGlV4 MBqdXrDcJi/W7Kk2Qjm3UJ0PbP+koJ2/+MAyvKX7LuXgC+GfuS0dqwwdLEL9NYOv E/JAsg== Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jamyp9dk6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 19:54:47 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-1b592e9841bso14570216c88.1 for ; Wed, 02 Dec 2026 11:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796241286; x=1796846086; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=u9dDl6dDfHkl3iDhRC+5eIlJ/PY99wEEVgtETV8XrdE=; b=aAcwQkeg1+yUSYRPg0zSAsx1v/uFhcLQDzopf+r3/NaLWKjfNHYgxvvyX9x1Ekyklu Q4ULS8G36SE4+wwQVwQidrjGhEg1bqKg0Wu5ippBcLU61ur9q8CzJxFUrEi5A6OqJNcP 8B3Bw17rpdN69l0Quc3vr3NmYm6kphsSJTRkflr+tHEQDfC74AR8/3B2Rg26vF4t6B3y 4p7v8ef09a4sSo2AlGLM2hl2+uXOQ6q8KMdEqlMXoaxnZ10Tpo4ddJBhCkhTdki1AZ+P fP2+oxV3zVEkA3WRCK8nXQk/A6YDtDsInPP16yqzaOWdzS0M/ZfwbMedpNH8eS/sP9kC Zkdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796241286; x=1796846086; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=u9dDl6dDfHkl3iDhRC+5eIlJ/PY99wEEVgtETV8XrdE=; b=nZGiydczbgC82Z70nr31qwwbJN9SAKmmQLkXfBUli9w0g8acJaK4vRIDkwn9fjPM/5 RZoPB7FQtl5wmCJcci+0ytmBTQuKjLZyTtwG/GoN/cLUUbyUDzgKWZJMcGnPdMwihJM1 ao4Ale5FkLMU2DuDaXbvFSnaiOizj0x1EgRGLNc+FfEoI8wJhXzE7+nmQXTX/I9l00dz BE5SeYUr2zOAjkjMQCwIvS3jXk7FUEMZ870pmFLvCbps5b6XYNJkSEJMKPeS9tWDHiJg mc6Lpa40qvqw2xYOLaPZjpJ/GaB79vh8zCsMPg27GqEZdgeTzsCoX6hAo3LNDlCMf4Ug OD8Q== X-Forwarded-Encrypted: i=1; AL+hErG9IxG4YnENstL1NnnnZNwkLOLHD0QUa0dN+LE15fF/ZROAJ1aJoMJlk6CnEbymSrKN4If9Dv+ARW4FCSaTMhs=@vger.kernel.org X-Gm-Message-State: APuU4Z9hgiEQxYtpAxdH14LUQ1BCCIsNFZDAVr4U/F1ZSvO4edLAiOiz 0xtLpO9b4XKrLbp8ZjZ1QwDn60t5OHK+8MF3smCsq0Pce9C9YsScOFrWBvBaZxdfvF6BYLoK/SE lFgsGTwyUIHXtKJBrKnqXSLqEcrjXhChPGJHnDgkEAmwAdRDeN6IEzueBWEFmAt1OOEZrw1w= X-Gm-Gg: AZFdTZfwP+9hYP3PXqFmpuMnBowxZlLDqNj8biQfYSoiTc5s37h/K4oTsDeg5Hcqimq cNMV46BPa6D3Hjenfr937pjQ2Ir1xwZhFrn0nyVXJIg5caO+Uprbyb/uQrkkninrohtmeGXMaVf uqMmHpmAX3MSjN3nrr9EiCKJ6i3c7uq3wEgL+feABWGnsTLCcCvh99FojUcqfTQjsYGgqFsqcuM d9t567qSBZwNCnGIHDyPH6qQsYGf+GwCiJgbKXr+SVfp4vZp2wEhPZQx8NRjJDZ8K2QNVPv/dUR bBhAlEUd0hLTN+CgI8xyWTgbEPtIfXyriEqaupgfZ7DZP9P0Q9oRqFKguEtIc/uVbHuO5K1bRkR W2BfmOvfffokkVXzkLbTO8yfARtCdAMoK2J3FrK4KwARxjoc04Ztf3UzAGY4ByRGA8F5bZ2cd/A Fw3whzFy0AEwzmTfUTbT1f4ZDlTGI= X-Received: by 2002:a05:701a:ccc8:20b0:196:e254:db24 with SMTP id a92af1059eb24-1b5568d32bdmr41046111c88.21.1796241280933; Wed, 02 Dec 2026 11:54:40 -0800 (PST) X-Received: by 2002:a05:701a:ccc8:20b0:196:e254:db24 with SMTP id a92af1059eb24-1b5568d32bdmr41046067c88.21.1796241280113; Wed, 02 Dec 2026 11:54:40 -0800 (PST) Received: from localhost (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b55684c85fsm150370677c88.14.2026.12.02.11.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 11:54:39 -0800 (PST) Date: Wed, 2 Dec 2026 11:54:35 -0800 From: Jonathan Cameron To: Jason Gunthorpe Cc: Alexandre Ghiti , Albert Ou , Ard Biesheuvel , Catalin Marinas , Jonathan Corbet , Ilias Apalodimas , Justin Stitt , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, Mark Rutland , Bill Wendling , Nathan Chancellor , Nick Desaulniers , Palmer Dabbelt , Paul Walmsley , Randy Dunlap , Shuah Khan , Will Deacon , linux-integrity@vger.kernel.org, patches@lists.linux.dev, Piotr =?ISO-8859-1?Q?Kr=F3l?= , Ross Philipson Subject: Re: [PATCH v3 09/11] arm64: drtm: Call UNPROTECT_MEMORY Message-ID: <20261202115435.0000430c@oss.qualcomm.com> In-Reply-To: <9-v3-22d1a1eb7d2e+17de-arm64_drtm_jgg@nvidia.com> References: <0-v3-22d1a1eb7d2e+17de-arm64_drtm_jgg@nvidia.com> <9-v3-22d1a1eb7d2e+17de-arm64_drtm_jgg@nvidia.com> Organization: Qualcomm X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) X-Mailing-List: linux-integrity@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA3OSBTYWx0ZWRfX88zY753EBd2f z9JL5+RxHFZXQKeG1dw1DpvqD1id1hDymgAzDQml/5JZ1Gic226Rkelza2He6lCFIaDnQxoPmrb HePUqvnAfBPtPQ0gIe5rj2vNdsi0omc= X-Proofpoint-GUID: KUxy7Dna6IQBDh2mbElhk_iIzTRDcGxt X-Authority-Analysis: v=2.4 cv=U/8Hnuru c=1 sm=1 tr=0 ts=6b107787 cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=kj9zAlcOel0A:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=Ikd4Dj_1AAAA:8 a=EUspDBNiAAAA:8 a=mMb7A8rjthaqvPkL_QoA:9 a=CjuIK1q_8ugA:10 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-ORIG-GUID: KUxy7Dna6IQBDh2mbElhk_iIzTRDcGxt X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA3OSBTYWx0ZWRfX/OeOHB8sQaFA Np0Rm75fNgIPHjqGGc27CvUz7I6Sg+qltDwlLRSSRo+9tHFpd9lhn+SXQbT5vKUiYk9xWIjJTqB zMzYJRM7CxrI7uqOF98lfOK6HbthuS7RlnGexTxWiuc+9+t+a/byot58sWEpJnIuPCpbHlqBkFB /qQU52jyq8LoDWY8Y1KJfB3d6FCq/cUbFdps0HNcaujE++dAV9JOw5hU27SrqDbq4BgtUXRy3Oq hyo9YAJoQfxHdROJ3uzZx2DueAYuijTyWytXPWxGu4VuEw4Lu7LownshkVPRpGeUSjKIfebLD2k shazEwOE1XZx1LPgS67j1aJzni1E5KK/AswPFfkXPowJeQHuMrwNc5JWw4bK1rdXIakxgwZcaAC b0avWSbW33EGeT4ixGHmW8yN1Hlf0XQ41yhcwpUjMYAGni0FrpFF6V7ZoH9i2lvex9jrfq4zlG5 QnNtjUmTU8pORT7mx7g== 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_05,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 adultscore=0 spamscore=0 phishscore=0 clxscore=1011 malwarescore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020079 On Fri, 20 Nov 2026 13:52:02 -0400 Jason Gunthorpe wrote: > The stub always requests ARM_DRTM_LAUNCH_DMA_COMPLETE. On a system > with an SMMU the COMPLETE option is sanely implemented using the SMMU > global abort register. DMA_COMPLETE should be mostly a no-op. It > seems to be designed for the region protection mode that Linux does > not use. > > However, the FW can still do something interesting under it and we > should call it. Choose late_initcall as we know the SMMU drivers are > loaded by then. If some platform does actually block DMA beyond the > SMMU, then this would result in a noisy failure of built-in driver > DMA, not a silent security gap. > > The platforms I'm aware of are OK with this placement, and it is a > reasonable place to start. > > Signed-off-by: Jason Gunthorpe I didn't comment on 4-8. Whilst they look fine to me, they sit out of my normal playground so I don't feel tagging would be appropriate. Given the essay below on when this works and when it doesn't this seems as good as it can be for now. Reviewed-by: Jonathan Cameron > --- > drivers/firmware/drtm/arm64.c | 39 +++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/drivers/firmware/drtm/arm64.c b/drivers/firmware/drtm/arm64.c > index bf736ceb7f0368..07783d55275fd0 100644 > --- a/drivers/firmware/drtm/arm64.c > +++ b/drivers/firmware/drtm/arm64.c > @@ -3,8 +3,47 @@ > * > * Support functions for ARM DEN 0113 "DRTM Architecture for Arm" > */ > +#include > #include > +#include > +#include > > #include > > struct arm64_drtm_handoff drtm_handoff __efi_data_handoff; > + > +static int __init arm64_drtm_unprotect_memory(void) > +{ > + s64 status; > + > + if (!drtm_handoff.drtm_enabled) > + return 0; > + > + /* > + * Currently Linux can only fully support a DRTM implementation that > + * relies only on the SMMU. This should be called directly after > + * attaching a driver to every SMMU but before binding any drivers that > + * want to use devices attached to the SMMU. Our boot flow does not have > + * a way to do that, so for now call it here. > + * > + * For SMMU based implementations their UNPROTECT_MEMORY is probably a > + * NOP since touching the SMMU here is forbidden by spec, but they may > + * still do something interesting so be sure to still call it. > + * > + * The stub excludes the most likely case of non-SMMU by only using > + * ARM_DRTM_DMA_PROTECTION_COMPLETE, which is defined as: > + * Complete DMA protection is hardware-based enforcement at the SMMU > + * that blocks all DMA from Non- secure devices." > + * > + * For now if people have such systems they cannot include built-in > + * drivers for any DMA devices, those have to be modules to be ordered > + * after this. > + */ > + status = arm_drtm_unprotect_memory(); > + WARN(status != ARM_DRTM_SUCCESS, > + "DRTM: failed to unprotect memory (x0=%lld)", status); > + if (status == ARM_DRTM_SUCCESS) > + pr_info("DRTM: launch completed\n"); > + return 0; > +} > +late_initcall_sync(arm64_drtm_unprotect_memory);