From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C554BCD5BB1 for ; Thu, 21 May 2026 12:49:16 +0000 (UTC) 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-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Gay789DqOuuDMBG6ufrA9+l88sHJCOMD+TgevxOlQlA=; b=JDvjffYndj9qG0tAJPSHKcgaaW iVogdgjlgWxaQ1HCIoU8SDD9FjnmgzTj8BJrJ0rj2YuyOxBIxVcsF0o2C8qU2GIfPCGyrccLaahYu CIDPA8LqfLHXhAI8pmSZtnOS8I7kwDqBlr1yquOp75WO1IVgFGRFkfPh5NKlxA3NDscgqMgMdsEyI cGWQxUb3z8/ANiXAl00/JyGORKUTAMJE4WpnCcyymdr61ecCIy3FaovNJzUyHEM6WtkBFIC6VEDig D/Z/7wvXvqCQl8tMZAlAbUFo7ezQ3XB5j6/3FKA8FPOE4wocrnOdRN2Q3XXGOqywUtwS7Oe14dpgP nv8T8E+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wQ2pq-00000007lsq-3Enq; Thu, 21 May 2026 12:49:10 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wQ2pp-00000007lsE-1Drt for linux-arm-kernel@lists.infradead.org; Thu, 21 May 2026 12:49:09 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 72AE560212; Thu, 21 May 2026 12:49:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24F871F000E9; Thu, 21 May 2026 12:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779367748; bh=Gay789DqOuuDMBG6ufrA9+l88sHJCOMD+TgevxOlQlA=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=FeWHKF6dczrLRkFyvNfnWdL1BEMe+IW2yMd3n9NlQlG+QX6QEUfx1sS2qFSQ2ahwA c6NjllYJ7bFNmt9unFLcTd2sSI+yFjIHB/F0vxVLWhnE3zutMMzS9DxcjGtdxsIWke QwC+8V8+lCFtyUs1dqYtVTDG9SGRj+MWvTWQjRY04MGIelzDgubivCRcvD8GtRqK9k xirAZ3WAESZF7xHFg7CcMx3qnWaZrbABdAriqpaTHOmTrZ3jENPU84xumwlGQTcSXo 4szDbEBgiCb7ooQ0PVI7JxLRsMMQWFyxroqw6Up6hX8spQRINH9mYg24u715OWONiN JlVuqJSiLCpJg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wQ2pm-00000004owX-0kPM; Thu, 21 May 2026 12:49:06 +0000 Date: Thu, 21 May 2026 13:49:05 +0100 Message-ID: <86cxypvsfy.wl-maz@kernel.org> From: Marc Zyngier To: Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , 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 , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo.Pieralisi2@arm.com Subject: Re: [PATCH v14 05/44] arm64: RMI: Add wrappers for RMI calls In-Reply-To: <20260513131757.116630-6-steven.price@arm.com> References: <20260513131757.116630-1-steven.price@arm.com> <20260513131757.116630-6-steven.price@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: steven.price@arm.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, joey.gouly@arm.com, alexandru.elisei@arm.com, christoffer.dall@arm.com, tabba@google.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, gshan@redhat.com, sdonthineni@nvidia.com, alpergun@google.com, aneesh.kumar@kernel.org, fj0570is@fujitsu.com, vannapurve@google.com, WeiLin.Chang@arm.com, Lorenzo.Pieralisi2@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 13 May 2026 14:17:13 +0100, 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 > + > +#include > + > +struct rtt_entry { > + unsigned long walk_level; > + unsigned long desc; > + int state; > + int ripas; > +}; > + > +#define RMI_MAX_ADDR_LIST 256 > + > +struct rmi_sro_state { > + struct arm_smccc_1_2_regs regs; > + unsigned long addr_count; > + unsigned long addr_list[RMI_MAX_ADDR_LIST]; > +}; > + > +#define rmi_smccc(...) do { \ > + arm_smccc_1_1_invoke(__VA_ARGS__); \ > +} while (RMI_RETURN_STATUS(res.a0) == RMI_BUSY || \ > + RMI_RETURN_STATUS(res.a0) == RMI_BLOCKED) > + > +unsigned long rmi_sro_execute(struct rmi_sro_state *sro, gfp_t gfp); > +void rmi_sro_free(struct rmi_sro_state *sro); > + > +/** > + * rmi_rmm_config_set() - Configure the RMM > + * @cfg_ptr: PA of a struct rmm_config > + * > + * Sets configuration options on the RMM. > + * > + * Return: RMI return code > + */ > +static inline int rmi_rmm_config_set(unsigned long cfg_ptr) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_invoke(SMC_RMI_RMM_CONFIG_SET, cfg_ptr, &res); > + > + return res.a0; > +} > + > +/** > + * rmi_rmm_activate() - Activate the RMM > + * > + * Return: RMI return code > + */ > +static inline int rmi_rmm_activate(void) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_invoke(SMC_RMI_RMM_ACTIVATE, &res); > + > + return res.a0; > +} > + > +/** > + * rmi_granule_tracking_get() - Get configuration of a Granule tracking region > + * @start: Base PA of the tracking region > + * @end: End of the PA region > + * @out_category: Memory category > + * @out_state: Tracking region state > + * @out_top: Top of the memory region > + * > + * Return: RMI return code > + */ > +static inline int rmi_granule_tracking_get(unsigned long start, > + unsigned long end, > + unsigned long *out_category, > + unsigned long *out_state, > + unsigned long *out_top) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_invoke(SMC_RMI_GRANULE_TRACKING_GET, start, end, &res); > + > + if (out_category) > + *out_category = res.a1; > + if (out_state) > + *out_state = res.a2; > + if (out_top) > + *out_top = res.a3; > + > + return res.a0; > +} > + > +/** > + * rmi_gpt_l1_create() - Create a Level 1 GPT > + * @addr: Base of physical address region described by the L1GPT > + * > + * Return: RMI return code > + */ > +static inline int rmi_gpt_l1_create(unsigned long addr) > +{ > + struct arm_smccc_res res; > + > + arm_smccc_1_1_invoke(SMC_RMI_GPT_L1_CREATE, addr, &res); > + > + if (RMI_RETURN_STATUS(res.a0) == RMI_INCOMPLETE) { > + /* FIXME */ Is that part of the SRO stuff you're talking about in the notes? What is the ETA for fixing all these FIXMEs? Thanks, M. -- Without deviation from the norm, progress is not possible.