From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A6B7C606A32D for ; Wed, 2 Dec 2026 19:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=aMK5uD69; 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=AKaj4eTu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=u9dDl6dDfHkl3iDhRC+5eIlJ/PY99wEEVgtETV8XrdE=; b=aMK5uD69oianUp 7KD5ADRrU8bc4mcR1hfFKwlH7IZoqNrQgwCvfThxinQJCUAILaEkDTcXgn/XHNDz+o7KQjB//+c3w Pg5xA4GyJzofSLau2TasoTMH4i2Ng6kK5z+/ga4V/gaQu9hr9oab0Sq+JOksPd2jHX++JRIxyWMez NP9ZG5xU4PUuXLXYVVxqHcLJ78RAW3RdExHozlBiFkE6NlugNODl0OGkLzCqDGA8/s3E49wTpSW8B kR2l9MoLPTIUFrz9EP74YMrUnv3uJdpywdcP7B+r+I0MCZbGJqzx0OpYjQnVMdRZmVwXH458lhyiT qPq1G/HgUAtVHR486AmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYqPd-0000000CfNh-2w2J; Wed, 02 Dec 2026 19:54:45 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYqPa-0000000CfNL-2prz for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 19:54:43 +0000 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2ItsRS1025209 for ; Wed, 2 Dec 2026 19:54:42 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-f70.google.com (mail-dl1-f70.google.com [74.125.82.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jaj5a23af-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Dec 2026 19:54:42 +0000 (GMT) Received: by mail-dl1-f70.google.com with SMTP id a92af1059eb24-139b62317d0so20825799c88.0 for ; Wed, 02 Dec 2026 11:54:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796241281; x=1796846081; darn=lists.infradead.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=AKaj4eTuRO/RPuzhmDTHYlPzypoUA6QtycaLSXkS0eQ7SbtG6gH0tJtnTiU2ytOeUY kU4cPJclBvQGDWCniOvgKE0bx6B4hIivxhdxOzQNPaBXjDFd7ipNwhDIASrVFeF0u62m 4GP+pDrkEkbYTOi4IDuNt9jEMqZryuW8wDKXIKhyAt7MWA7/hLgaOxHGY+Yy0nIiFiT5 Qj6sn3zpX7f42oJGl9N0QmPJka3g/wTFH3zOhwiMFlMVR5VJgrQRwfy409CZ/c9BntTR /KWyoV2kwpwYRvZWWvbf1JT37stCF9/o5qFcTiYiX56njCBEn4LKpA4ezG4NFyGEisp2 3R6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796241281; x=1796846081; 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=Xbnb0d8Ew5zIUAKoHjg1AkVOB1+w17bmtRP9GFt9cyZVxAadsYdlWN3lCIV0Kaz+JL 7iSaSgNKbRYsbsDXKRjMsEjzyZqowE0HXOQSM27pCZCiNL6FwBahRzYj1iYe3rMijWrK qDpqRP7NJE09eZqm74L12oLdIagW91FxWwaRVS/Z9kppwtSu6M4R5wlSASE4ecwZp0i0 Xv88oMcWBkhsvgxNogKIGnzI9WebzoH/I78B29x2t2MrrCK5gIn9LbY2bNojQpme9O6w xlJ9tL3S3AqFAJJ5s5+BXgv/Du9Gu1m2NkQ4+XbB5EeAVqui6wRYz0ecTVl+JJ0uOpYx UCkg== X-Forwarded-Encrypted: i=1; AL+hErHiXe2bHfx0/kAKET6e+4iSe+Gs3jOaRJkmQql53zydiZYKuISnMphxcFJWsi/bBD1fpyz8kzp0hMe9TGymK/ju@lists.infradead.org X-Gm-Message-State: APuU4Z9XKeh57N2inHLoJ6V2UljIgbi4P2fPJrmIxTdzhwXbN2NT9r94 Jr9B35yQlZCE9Tl7w5OgQdUKpjygLDTH74IejoxWZI2PRmhYy1edG9bmFCzBPWJlJ+H01L9jfD7 wE2OBEvi6wbRS8C0lZORr2lM3TLudbq/mTjtydADaAxctfBNI9wJJcfepf5DjQ2K6LsR7dXz2qL zvHw== X-Gm-Gg: AZFdTZeFc4FmfwwAZEt/4PC9fIG0wc36ib+ZZTHh0tKFBsA4XZ8cw4prWLHQp65T1Ip GkpFwpAeY3C7Rfvgu4XPaLa2X/+vvEp9g0i+fD2Lu9/pssgEMVIM/czjdIE3yzVjDEerf7giH/9 kQcYpLHPbV2eg0EbTXD39QclruCz4kekbR5tryS4s7B8Bn3qkpj4O6xYRs6/KStCF+ZiaaeVeBB xN7pz9iTt0Z0RhqMHgqFt4+zW8KGuuXJM49ZlqKrhh/DzpyDTH+b50jVxO/t6lcp8o5519LI8WV ZV3PnKx6p4wmx6l32SEk4tgqmT3WDa5lXhnmn1yAiQRpU62/L8Fr7LwB5f2nNuvsfjywFm+wHdf AWB5Z6dpItCgolkNGbPoIwPysndQxppD+tkWsbCpapYZE+F9Qtz9NceScORpxy6XP/RTKTHc7Gw SQLNvWifTV7URv0Ey6UNbKyZfAF3Y= X-Received: by 2002:a05:701a:ccc8:20b0:196:e254:db24 with SMTP id a92af1059eb24-1b5568d32bdmr41046123c88.21.1796241280959; 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: 9UgZnrJbPI6aOIehpmho30EjtoSix3EL X-Authority-Analysis: v=2.4 cv=TYYDJhQh c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= 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 bulkscore=0 impostorscore=0 priorityscore=1501 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020079 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_115442_724371_CF29F5D6 X-CRM114-Status: GOOD ( 36.50 ) X-Spam-Score: -2.8 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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);