From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 D62A7223323 for ; Thu, 21 May 2026 00:22:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779322931; cv=none; b=r6Zmi6xmZegONoQBQd25R1LnoWUjRFF1Q//CL0ijWc5sPWZWycJOadeL/jJC6oz3Brb0s/BZDuMYYqEprX9xB5Ngt9g5jPpbv5/tRFBBA9kv1FtWI/qSGN2ggp3xFvXJPlvJHNCHKA2e1B25StfAhoHEOgeZglolM7JUmCkZOVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779322931; c=relaxed/simple; bh=0a4CoVtwwwY0r15ut+sz9UFjuNFI6DOIraemtUxXd9M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=T3oNAocecCHSt/MjRXUvymH9zGGHKz7jSnZHRkZWb9tGgCQwhkICmOck3aq9iacRQh1OPk3v8ultl9oqVbr2SgIDV0ZYtsdmK/sCUIBZ94qXDnsYn4FEb90oR2XFT8yoQnib+WkMQc7AlhI+eBQyYnfQ2uJcmY5KS2rqo2DHK8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QGaL1on4; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=QpJcBc7+; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QGaL1on4"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="QpJcBc7+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779322929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i3i7MRKG6FjVJNfFDsY2mBV0HH5ceLNdSFuRKrXNOfM=; b=QGaL1on4BvRBHDRReZPHjam/OWVcvX9MbfeIJz7JedETqdyDdZ41SNIc2e6WwkhQLGyDXE 6N8sYoeOJemW+x7F221UGGPOYf5vxt0A1xPNAMvMTIPI7rgkNdtxTv2dvmYgrQlbVaei/n ALEt8wRUikz31DNIF/SCI0kXUUGOEVQ= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-BFWLqtTmPCicUM6jpU3p8A-1; Wed, 20 May 2026 20:22:06 -0400 X-MC-Unique: BFWLqtTmPCicUM6jpU3p8A-1 X-Mimecast-MFC-AGG-ID: BFWLqtTmPCicUM6jpU3p8A_1779322925 Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-83836443305so2768656b3a.1 for ; Wed, 20 May 2026 17:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779322925; x=1779927725; darn=vger.kernel.org; h=content-transfer-encoding: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; bh=i3i7MRKG6FjVJNfFDsY2mBV0HH5ceLNdSFuRKrXNOfM=; b=QpJcBc7+7MSQ2hD2iskH5FCBECnw8xRJqq2SJHiVBRBoq+4I4eRrUVFm0lAcCburKf XQlT3dsLW82c9tH7vTLjjfb5Ce0Od9hGtyjBcQoUDGhD4Ik9+4ZFaMa4J70ckb2cIbkO KYLiigjosyhPgJZnlkzSgNb9S+9Qk37GQVjFja6f61qu0RFGdOd3emSgt5PI0tb1LvHO 4R+eyH1uZmZRpPS5NmRNmZ+rDiOOqEyCrF7FPMPLIf518Xu9mT1zfaPx8gksQ8JfXMg8 75jSpFjQ4ntInQDE6WQcE9JGbSQeSDKDuBMPYSMnh/hMSP+pMZ8JS39jHA/tNAlcA0NP yMCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779322925; x=1779927725; h=content-transfer-encoding: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; bh=i3i7MRKG6FjVJNfFDsY2mBV0HH5ceLNdSFuRKrXNOfM=; b=JUOsXNZyy2OPeIQEMph3yrUucB/rxI0b4k5Ef5klN9ae/KAl7IdZcOLortNNlTkfpj NXNACAWTCC2Y602uAJTKU8wB0T2hsDl+i6PzR/bYF5VCzyWy1mevaZ0ZBzK4nTyktZoq 7i6IiMcUZphguh2h/Cu60XKdkEvR4ivJMReEYxqxB3k9FiKLGto/7d2K7EueZMcDyhRE leltCPY0bSR/RmvgyG5ifCiFy1gfm70F/qPmbiqHB7MHq3/ZJUUfh73cFKQJ1dyYhdEk IL9nC4uitV2gb2g27bjNPP17YDd8YAvbLY1xvEXeX4s1WS30MI8qiSrjTtBAvY8VeDap YfXw== X-Forwarded-Encrypted: i=1; AFNElJ/ip4H/sr21gQcRcowaQUwJQnpV0qxp6B87oGbhfWo7iqxGmPwQ49z5dLh1H4TjKZHKmfj/N18WShsnIo0=@vger.kernel.org X-Gm-Message-State: AOJu0YwQDy9kNnb7l0eEE7q/ODYYsY10OKCVTPIvLlS2knwZHcsPyVFh TIDBaOWaW7kDnmqJnXz34k2klbKFEqbs9UR7j/VWEK9yUMLA/QVF470Z5ocD2qHkNlGbZ2/W6VD a1phrjB+UcNOfzzNAbzp6n9RFuMGOwRedEMP0fA70fLRSFz9jyy0wLcPtd1JpYN/gcXOwq76bUw == X-Gm-Gg: Acq92OGN0epbRjFkuhaD1oks+geOW/pJdhJaNmWJkCpK9FW2mmWqgmdI+/ExvDE5KhM fHyiLDkhmqkSwAjgcUFtk45ZIaEfyEkVVK1ykN42jJQ6YSbaorvtH+hH0uV0JuBmeYJ5Jip8QBz fv6nyV6ik+KpBXn9jZPIwKtL1s3h+a4AmUWCtWa7PsCDWGKCU/mM5sR9rRjXZ3bRdzT8jEv9DQo CENqoinL3soy/4QzFJ4b9uOa0juoI0kLe2P8P9qa1rMPYTp+4EzYH6AypPWwzuz+ObwU6tPnMBY BAp0ru7ADn/adMPdcXT7/q/UeLyLzvvb76vX4cZrRBOLPZpYH1IUtGZTvlCFO5roPbb7HXKUx9y gy09GW6kjHlMu+0nXeu/fqjXcsYedJlsq1p8VOQwfhpDr1PLBfCH4P20Gken2m4xK X-Received: by 2002:a05:6a00:3988:b0:838:af72:fb3a with SMTP id d2e1a72fcca58-8414ac7f34amr670241b3a.7.1779322924820; Wed, 20 May 2026 17:22:04 -0700 (PDT) X-Received: by 2002:a05:6a00:3988:b0:838:af72:fb3a with SMTP id d2e1a72fcca58-8414ac7f34amr670212b3a.7.1779322924310; Wed, 20 May 2026 17:22:04 -0700 (PDT) Received: from [192.168.68.51] (n175-34-8-244.mrk21.qld.optusnet.com.au. [175.34.8.244]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83f19794e6esm20725723b3a.25.2026.05.20.17.21.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 May 2026 17:22:03 -0700 (PDT) Message-ID: Date: Thu, 21 May 2026 10:21:51 +1000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v14 05/44] arm64: RMI: Add wrappers for RMI calls To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo.Pieralisi2@arm.com References: <20260513131757.116630-1-steven.price@arm.com> <20260513131757.116630-6-steven.price@arm.com> Content-Language: en-US From: Gavin Shan In-Reply-To: <20260513131757.116630-6-steven.price@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Steven, On 5/13/26 11:17 PM, Steven Price wrote: > The wrappers make the call sites easier to read and deal with the > boiler plate of handling the error codes from the RMM. > > Signed-off-by: Steven Price > --- > Changes from v13: > * Update to RMM v2.0-bet1 spec including some SRO support (there still > some FIXMEs where SRO support is incomplete). > Changes from v12: > * Update to RMM v2.0 specification > Changes from v8: > * Switch from arm_smccc_1_2_smc() to arm_smccc_1_2_invoke() in > rmi_rtt_read_entry() for consistency. > Changes from v7: > * Minor renaming of parameters and updated comments > Changes from v5: > * Further improve comments > Changes from v4: > * Improve comments > Changes from v2: > * Make output arguments optional. > * Mask RIPAS value rmi_rtt_read_entry() > * Drop unused rmi_rtt_get_phys() > --- > arch/arm64/include/asm/rmi_cmds.h | 661 ++++++++++++++++++++++++++++++ > 1 file changed, 661 insertions(+) > create mode 100644 arch/arm64/include/asm/rmi_cmds.h > > diff --git a/arch/arm64/include/asm/rmi_cmds.h b/arch/arm64/include/asm/rmi_cmds.h > new file mode 100644 > index 000000000000..04f7066894e9 > --- /dev/null > +++ b/arch/arm64/include/asm/rmi_cmds.h > @@ -0,0 +1,661 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) 2023 ARM Ltd. > + */ > + > +#ifndef __ASM_RMI_CMDS_H > +#define __ASM_RMI_CMDS_H > + > +#include > + [...] > + > +/** > + * rmi_rtt_destroy() - Destroy an RTT > + * @rd: PA of the RD > + * @ipa: Base of the IPA range described by the RTT > + * @level: Depth of the RTT within the tree > + * @out_rtt: Pointer to write the PA of the RTT which was destroyed > + * @out_top: Pointer to write the top IPA of non-live RTT entries > + * In most cases, the parameters are well explained in RMM-v2.0-bet1 spec, I think it's nice to keep the code and the spec synchronized. For those specific parameters of this function, they're well explained in RMM-v2.0-bet1 spec as below. @rd: PA of the RD for the target realm @ipa: Base of the IPA range described by the RTT @level: RTT level @out_rtt: PA of the RTT which was destroyed @out_top: Top IPA of non-live RTT entries, from entry at which the RTT walk terminated > + * Destroys an RTT. The RTT must be non-live, i.e. none of the entries in the > + * table are in ASSIGNED or TABLE state. > + * > + * Return: RMI return code. > + */ > +static inline int rmi_rtt_destroy(unsigned long rd, > + unsigned long ipa, > + long level, > + unsigned long *out_rtt, > + unsigned long *out_top) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_invoke(SMC_RMI_RTT_DESTROY, rd, ipa, level, &res); > + > + if (out_rtt) > + *out_rtt = res.a1; > + if (out_top) > + *out_top = res.a2; > + > + return res.a0; > +} > + [...] Thanks, Gavin