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 2C64C606A319 for ; Wed, 21 Oct 2026 17:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=kOZhhUy9; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=p0wY614O; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=eoyi9og8; dkim=neutral header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=WwJ3lMxD 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-Owner; bh=vilmZRHHMNfnexi+YGDujqWXf83C8yeE3BqzopJL6bY=; b=kOZhhUy9LtczOw6HggG78h9Edn PrSgKN3V84O7du0Zqxi2RVH3LolYvKXKMyvfBgThWLhPxJ3PvAzbEcq9Mu31Nf8V2LCPdGeKBRY4P tpyLmPt196bgD7bRororI7SYCmSGGyxqrqm28YjX5EoShvKxCWbPXUwwGhHb1ViUVK1VUOM3KGIhE FVE6KgFmO3IV5c6SC98jgXip+SWCVqci05D07sNQaeLGsJsw5IT0k8wxgGYG61P5Nw/hvAA/50WHa +RBrTcZ+mVLk7Ozo0TcwXn2WgFT7/qQ731VI2x3ogXCt7TVoDetHJkaAcQkzctA5Cmxx3reqKv/+K mjch+YUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xJaLu-0000000Ca2K-1ppz; Wed, 21 Oct 2026 17:43:50 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xJaLs-0000000Ca1L-3Qpu for linux-arm-kernel@bombadil.infradead.org; Wed, 21 Oct 2026 17:43:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=vilmZRHHMNfnexi+YGDujqWXf83C8yeE3BqzopJL6bY=; b=p0wY614O35WMHi+Ylw9iys+Bca oDvKPPctWkmsA5V6zBz/u3oHISaJHoxS3IP8R+azHh5gscVJ+utYL8wELNksjRYa8dHgcncIbnl6r Q5NIfXxNxmr2Z2mwuRJIzxTbP6s2MDOl/7ScM4UEbk9OotKieiGVHxem5gYlP56Qui+uMLkkoxPFo C1bg86RF2BHDQ1UekXBJsafdTTCLp2NWLxiYqFQlqP7VDsu7YEcm16MLdCje1hPRKZWl3C+Evb1Uy TikCOzEpyDlRItmaRkTSLqT/6fmHCvxs42CeGcYGj8p0pIQPqtVnt0L67nU7wQKHUQ/+mNmSWcRG3 D4Mj2mZw==; Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by desiato.infradead.org with esmtps (Exim 4.99.5 #2 (Red Hat Linux)) id 1xJaLp-000000065e7-3UFr for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2026 17:43:47 +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 69LFoFvL524244 for ; Wed, 21 Oct 2026 17:43:43 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= vilmZRHHMNfnexi+YGDujqWXf83C8yeE3BqzopJL6bY=; b=eoyi9og8lE7X7gFs 6zN8p4jNwkyfCNTayV/KpLYTog8YiPf09MNrJZcVJnd8ebBGnM3y90AF6J6wPsgu KIHm6p3JiNc6RZfwNDa4t1fGBEFrTEmAppjPtFmqqXsDcs6gCeSuRZZlb5bNDOS9 ImS1uhcDnN727Uzxw2NojUhBmpaItcPZUTIJpC/20W36NsqozA/ILY/A7RqOC8Fa fp6nVz6bC6n4qpaiLw/MFEox+9rhuaWmCR3mtKA8Cekf76hFS10V2nlLwjUarK9d b3wbMfLBTWZOussj3TRqDPdEihPsXKcxNsCG7ejdilg63VQy4NSwejKyn6ahUKZG iSFgwA== Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4hf0cv0hb5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 21 Oct 2026 17:43:43 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-36803927a49so1551680eec.1 for ; Wed, 21 Oct 2026 10:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1792604623; x=1793209423; 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=vilmZRHHMNfnexi+YGDujqWXf83C8yeE3BqzopJL6bY=; b=WwJ3lMxDtzB2mK2BOuHaOOElrXV/j4XHvFvD7q1GWtUNSTk7VhOyUYK0JU+Rqb0fQz jbXDMncxRHr1P+W3BV5ZmHdHwxGsRuPxlM72S3AJ0Q/sM3xECHxFH0WDSi16Be0G9Nz5 VfzeI9fREPHAOnCRgQb08BZrUFigptn2EVHKWi5sqH4V5ERdGctyq24hnN9Mg8ucQfBi Ox9MJIqi2YSYbDTcS94YuYclwOV/qsWW1WhTtkfjwNs1ixqs1yijjtTbjbt1342xkFZH dzb3Ar9ZNw981/5RSCpKihrBpnIDJ9qic+H7GCZ88EDr2F7uR+0mXPZ+qppvBLLnTB9z fLyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792604623; x=1793209423; 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=vilmZRHHMNfnexi+YGDujqWXf83C8yeE3BqzopJL6bY=; b=l+E4pEN8B2saW7SJ8JpGWZNuKAuEWrXSMH6mVPdvsVrSBohFQE7PULshvbQuh4pZmc 3+Pzq0Dby2FXrcTqbJIf69FqqFK69dZRMNay9JVWQ+FOzxOSiq/toM8KMGuT2hMjUx3j lVK4xdhuy8UIJaK0aWlsmmyOs/IBjbQ9KKNFLC1oTfsw55nPNe+10q1Z+raOtHLNj964 9oBa5GSoqekmJ6aRpA6ks18Yfw6X5XYU+H9BRCFlNPPdKuIuzokqR0dy+gO+q2jo+Lzt CBVVFVhAbud799TfQ24ENsKnqQ9QHRRQnGXMUDO2UWjGS4wjU/BejYADTAen9ZJG5XR7 ltsw== X-Forwarded-Encrypted: i=1; AKwUvBwNnhPtSXo7JOTc1whPRICQusxJLlES9vlr7mp+2futJKVqKreMxkGUJDOcWrkHEt0mjnNsZJ54Wpd4B73SnFj9@lists.infradead.org X-Gm-Message-State: AFq9FYJpUPbHUyqE7hYH/0LR1jg1gAZC5FesCZvvFMOGxb4tK5LKphMo S+7vFZepKZdpUYePqxNVMQdZQff6Jd3vecQASuucin5YjgPV+IxItkgE1D1S4Jd2noarX0PfoRB Y/YP8cqcSJsYTptSF/E0yAMPBBypvis5tzwiYWL1TDpkD8DnaHcGecpwU3arki9ACd8s+ujYJiD 2s9w== X-Gm-Gg: AYBFou3TbiLkXp5oJXCfZe16uTT8VeJN9qAvg8u/pzTTPXGStYgJ2u097eLesGFuXQ7 A3HasOT0ViTlIsvVtMDkIDC+3GmCEoviPG8pQ+uUp71/3IOqY7nHI3RcS72VZGRF+rxfbzRTWw9 9oJUmGheqKzcIlIBPNrKkguga1T42n3E7yV8OLtkr2ODoCW9cF+evWl+JCHfoqqhw+hJco9kOyA TPxJoONP+UWEjQou0W29xgiMdHzlFsQkZhiQlywktxMvyFUEMoHEMtk9l1KJ6Xj1Xc15Fxr5a3E KWhxdQ4cfqzzPiGg8VgeJH5VmuvnApDJqVV+4ARBZ8fAdW49HnuZdGzMFhBbwp5KTsJJ+1XXG8i 9eRzU9OHnxtZO++rlsIj/EzZ7sAVbJKy1yDVGtUKxcQ== X-Received: by 2002:a05:693c:65db:b0:366:8efb:bab9 with SMTP id 5a478bee46e88-3674e450f24mr4349184eec.11.1792604622317; Wed, 21 Oct 2026 10:43:42 -0700 (PDT) X-Received: by 2002:a05:693c:65db:b0:366:8efb:bab9 with SMTP id 5a478bee46e88-3674e450f24mr4349127eec.11.1792604621677; Wed, 21 Oct 2026 10:43:41 -0700 (PDT) Received: from localhost (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-36741f753f7sm8840346eec.27.2026.10.21.10.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2026 10:43:41 -0700 (PDT) Date: Wed, 21 Oct 2026 10:43:36 -0700 From: Jonathan Cameron To: Jason Gunthorpe Cc: Alexandre Ghiti , Albert Ou , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Jonathan Corbet , David Sterba , Ilias Apalodimas , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paul Walmsley , Randy Dunlap , Simon Glass , Shuah Khan , Nick Terrell , Will Deacon , Alexandre Ghiti , Conor Dooley , linux-integrity@vger.kernel.org, Palmer Dabbelt , patches@lists.linux.dev, Piotr =?ISO-8859-1?Q?Kr=F3l?= , Ross Philipson , Sami Tolvanen , Song Shuai Subject: Re: [PATCH v2 11/15] arm64: drtm: Add macro definitions for DEN0113 Message-ID: <20261021104336.00000437@oss.qualcomm.com> In-Reply-To: <11-v2-989a18390eb1+486-arm64_drtm_jgg@nvidia.com> References: <0-v2-989a18390eb1+486-arm64_drtm_jgg@nvidia.com> <11-v2-989a18390eb1+486-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-Authority-Analysis: v=2.4 cv=NrRE4MdJ c=1 sm=1 tr=0 ts=6ad8f9cf cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=kj9zAlcOel0A:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=Ikd4Dj_1AAAA:8 a=EUspDBNiAAAA:8 a=cBdanpMcOxUnX1AP4g8A:9 a=CjuIK1q_8ugA:10 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-ORIG-GUID: hT_lf8VdSYEC1FNCZyA3jM2BbQtkF_VP X-Proofpoint-Spam-Info: AW1haW4tMjYxMDIxMDA3MCBTYWx0ZWRfX/TjQGmJ0oLK+ WW+R7zMFCzPwzWqnN7ul0lOK4dW36ofEewX0qNznvMCRcA9jZNk+fWDWNmFKdrhyNEVevCk0fmF aFF1on9oTvacILR9SI+66zb9sE3Ey54= X-Proofpoint-GUID: hT_lf8VdSYEC1FNCZyA3jM2BbQtkF_VP X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDIxMDA3MCBTYWx0ZWRfX5slKjmIx6xhi U28pvqwcXcf1xyCN9lfAN167pPxCWPaxcRORBbWcQgGsdUHus99KJYHykw7OD3FhXJHcndKeEwb VUm1oVX9ER33ztViN7Nmz6C08PxqGiEwGlOry+p0JuSJPjyiWVXOy4Mx11MgD73Ym1iaN3nhh/p m13/sIFrywJUaAjqB9DPtMV0frMH5xpLtHEyzDxcp6AgdKuaQYd5UYSw8U1hH0yzHHC4+3X+HdJ 2duS4yUTyk9betBJYTgI4ZyzDq/uBhitNS9QSNabTLAuRrQJMV7tDxCillNkW27cvN7D9OHhsWo e06zmZPS3txQRDSqrcYqZR47pPBovVQ1wGGgidXCPIm8slsFEoGor4Z8QLyENxvVVIiYAFRblY4 FDVpu6pCAKjuHLdc/FBbTGfi5zgJx4qolWFJtPBais/RkV8lrgkOpQxmvJuGb04/xfbYTSchc6f hARY9r1TEhj0A6COgRA== 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-10-21_04,2026-10-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610190000 definitions=main-2610210070 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261021_184346_278617_5B50B875 X-CRM114-Status: GOOD ( 31.83 ) X-Spam-Score: -0.9 (/) 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.7 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, 2 Oct 2026 20:31:48 -0300 Jason Gunthorpe wrote: > Taken from rev 1.4b of the spec, following the SMCC register layout and > constant names. > > Signed-off-by: Jason Gunthorpe Nice - appreciated the spec references as saved a bunch of searching. A few really small comments inline. Either way Reviewed-by: Jonathan Cameron > --- > arch/arm64/include/asm/drtm.h | 304 ++++++++++++++++++++++++++++++++++ > 1 file changed, 304 insertions(+) > create mode 100644 arch/arm64/include/asm/drtm.h > > diff --git a/arch/arm64/include/asm/drtm.h b/arch/arm64/include/asm/drtm.h > new file mode 100644 > index 00000000000000..8188af1b582bb3 > --- /dev/null > +++ b/arch/arm64/include/asm/drtm.h > +/* > + * The spec uses 4KB pages for sizes and alignment throughout, see v1.4B > + * sections 3.3, 3.13, 3.14 and 3.15. > + */ > +#define ARM_DRTM_PAGE_SIZE 4096 Maybe use SZ_4K from linux/sizes.h > +/* v1.4B section 3.3 "DRTM_FEATURES" */ > +#define ARM_DRTM_SMC_FEATURES (ARM_DRTM_SMC_FN_BASE + 0x01) > +/* X1 input parameter */ > +#define ARM_DRTM_FEATURE_SELECTOR BIT_U64(63) Maybe define the alternate masking for function ID - for completeness if nothing else. > +#define ARM_DRTM_FEATURE_ID_MASK GENMASK_U64(7, 0) > +/* > + * PCR schema numbers. ARM_DRTM_PCR_SCHEMA_MASK is a bitmap indexed by these, > + * and the Launch Features ARM_DRTM_LAUNCH_PCR_SCHEMA_MASK field holds one. > + */ Similar to below. Maybe this dual use is a bit fragile. > +#define ARM_DRTM_PCR_SCHEMA_DEFAULT 0 > +#define ARM_DRTM_PCR_SCHEMA_AUTHORITIES 1 > +/* v1.4B Table 6 "DMA protection features" */ > +#define ARM_DRTM_FEATURE_DMA_PROTECTION 0x03 > +#define ARM_DRTM_DMA_PROTECTION_MASK GENMASK_U64(7, 0) > +/* Only valid if ARM_DRTM_DMA_PROTECTION_REGION is supported */ > +#define ARM_DRTM_MAX_REGIONS_MASK GENMASK_U64(23, 8) > + > +/* > + * DMA protection types. ARM_DRTM_DMA_PROTECTION_MASK is a bitmap indexed by > + * these, and the Launch Features ARM_DRTM_LAUNCH_DMA_PROTECTION_MASK field > + * holds one. > + */ > +#define ARM_DRTM_DMA_PROTECTION_COMPLETE 0 > +#define ARM_DRTM_DMA_PROTECTION_REGION 1 The dual use of these for bitmap indexes in one place and values in another seems fragile. Maybe it is better to have different naming for the two even though the values match? > +/* v1.4B section 3.4 "DRTM_DYNAMIC_LAUNCH" */ > +#define ARM_DRTM_SMC_DYNAMIC_LAUNCH (ARM_DRTM_SMC_FN_BASE + 0x04) > + > +/* v1.4B section 3.5 "DRTM_UNPROTECT_MEMORY" */ > +#define ARM_DRTM_SMC_UNPROTECT_MEMORY (ARM_DRTM_SMC_FN_BASE + 0x03) > + > +/* v1.4B section 3.6 "DRTM_CLOSE_LOCALITY" */ > +#define ARM_DRTM_SMC_CLOSE_LOCALITY (ARM_DRTM_SMC_FN_BASE + 0x05) > + > +/* v1.4B section 3.7 "DRTM_GET_ERROR" */ > +#define ARM_DRTM_SMC_GET_ERROR (ARM_DRTM_SMC_FN_BASE + 0x06) > + > +/* v1.4B section 3.8 "DRTM_SET_ERROR" */ I know I'm the one who asks for references, but maybe the SMC numbers are obvious enough without given the name matches the spec section? The table references etc below are excellent! The do no harm beyond a bit of bloat though so I don't mind if you want to keep them. > +#define ARM_DRTM_SMC_SET_ERROR (ARM_DRTM_SMC_FN_BASE + 0x07) > + > +/* v1.4B Table 8 "Definition for error IDs (Bits[10:3])" */ > +#define ARM_DRTM_ERROR_ID_NONE 0x0 > +#define ARM_DRTM_ERROR_ID_PARAMETERS 0x2 > +#define ARM_DRTM_ERROR_ID_SECURE_EXCEPTION 0x3 > +#define ARM_DRTM_ERROR_ID_TCB_HASH_UNLOCKED 0x4 I'd use NOT_LOCKED to align with spec. Maybe it makes a subtle difference somewhere? UNLOCKED might imply a transition to that state, where as NOT_LOCKED doesn't. Meh, doesn't really matter as I'm probably over thinking this. > +#define ARM_DRTM_ERROR_ID_TPM 0x5 > +#define ARM_DRTM_ERROR_ID_SIGNATURE 0x6 > +#define ARM_DRTM_ERROR_ID_IMAGE_FORMAT 0x7 > +#define ARM_DRTM_ERROR_ID_VENDOR 0xFF > +/* > + * v1.4b Section 3.3.1 says: > + * A return value of greater than 0 means the feature ID is > + * implemented, and there are other feature-specific > + * feature or capability bits available in other return value > + * registers. I'd wrap to 80 chars. > + * And for FEATURE_SELECTOR all defined features return data in other > + * registers, so 0 is not an allowed return. > + */ > +static inline s64 arm_drtm_query_feature(u64 feature, u64 *value) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_smc(ARM_DRTM_SMC_FEATURES, > + ARM_DRTM_FEATURE_SELECTOR | > + FIELD_PREP(ARM_DRTM_FEATURE_ID_MASK, feature), > + 0, 0, 0, 0, 0, 0, &res); > + *value = res.a1; > + return res.a0; > +} > + > +#endif /* !__ASSEMBLY__ */ > +#endif /* __ASM_DRTM_H */