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 804FFCA5FA5 for ; Thu, 1 Oct 2026 09:11:49 +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-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=L7TnZSTs1JU3qWXRO9syH405YVN6kk4t/lEfXU9Fcks=; b=DPUAvTWHV0aUmkxNHzA3bu0m64 unCkTqlGvjQs1G+JVttl+kfX8ibeq/IvK0LOgT5V6zikTN184e/WyvK52OCcXhE/ot3Ep9CaEGRC4 tS0JERgUTlZaP+Iu2tYxV9VDkIeE1905KlRzmoct4l09KA5YKzqc5O5WwV70ZmHmEC8pxnndioL2H 9bC7X+kdiAT/3ORjhrCZwbvOZGJ6UD5vdWzCNmR9C95mo8v0hKRodW0JfZMxLyCSEKuwudeyAjrvI vW/26mWJdGnkAeweyPgoSmMrfsGHQCxD8qqyUFG+ZuI2DE6UuArrH+s8F9tjfaFh6mlYXY4tBS62m ALqNQtGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCCpK-00000008KFf-3NFD; Thu, 01 Oct 2026 09:11:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xCCpH-00000008KF3-2Oe3 for linux-arm-kernel@lists.infradead.org; Thu, 01 Oct 2026 09:11:41 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9757D497; Thu, 1 Oct 2026 02:11:34 -0700 (PDT) Received: from [10.57.9.178] (unknown [10.57.9.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BDB343F86F; Thu, 1 Oct 2026 02:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790845898; bh=GQrDMdfMqZNswkZK5dFyWnVceo9e29aWWhkScXVyzjw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ufUYSCruKSsgdz5AQlNPK4y4LK9KHDsv7nd6GemQeqNp+/bgncE9xD3ttBnyyqxgp yW4GsFqAV2/s/ErFu2GT4lpgVd14g+qe52yHiioiQYjTtr0gr/tzyth1sfw1THT4mY 19QyBDeyP+mJwuEAStC3anS0gKSFObEQ79Qw93a0= Message-ID: Date: Thu, 1 Oct 2026 10:11:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v21 8/9] firmware: arm_rmm: Add wrappers for Realm related RMI commands Content-Language: en-GB To: sashiko-reviews@lists.linux.dev Cc: Marc Zyngier , kvm@vger.kernel.org, kvmarm@lists.linux.dev, Oliver Upton , Catalin Marinas , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Will Deacon References: <20261001084555.1456543-1-suzuki.poulose@arm.com> <20261001084555.1456543-9-suzuki.poulose@arm.com> <20261001090450.C1CBB1F0089A@smtp.kernel.org> From: Suzuki K Poulose In-Reply-To: <20261001090450.C1CBB1F0089A@smtp.kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261001_021140_249922_DEC0A0A8 X-CRM114-Status: GOOD ( 15.92 ) 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 01/10/2026 10:04, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > - [High] arm_rmm: dropped out_top on RMI_ERROR_RTT for range commands > -- > > commit 68e63e1b38f1af07d69bbc2eee9306e4bedb8efa > Author: Steven Price > > firmware: arm_rmm: Add wrappers for Realm related RMI commands > > This commit introduces wrappers for the RMI calls used to create and > manage realm guests. These inline functions map the standard KVM realm > operations to their underlying SMCCC interfaces. > >> diff --git a/include/linux/arm-rmi-cmds.h b/include/linux/arm-rmi-cmds.h >> index 5d005054f3c6c..e3503aba646e2 100644 >> --- a/include/linux/arm-rmi-cmds.h >> +++ b/include/linux/arm-rmi-cmds.h > [ ... ] >> +static inline long rmi_rtt_data_map(unsigned long rd, >> + unsigned long base, >> + unsigned long top, >> + unsigned long flags, >> + unsigned long oaddr, >> + unsigned long *out_top) >> +{ >> + struct arm_smccc_1_2_regs regs = { >> + SMC_RMI_RTT_DATA_MAP, rd, base, top, flags, oaddr >> + }; >> + long ret; >> + >> + ret = rmi_sro_execute(®s); >> + >> + if (ret == RMI_SUCCESS && out_top) >> + *out_top = regs.a1; > > [Severity: High] > If this operation encounters an RTT state conflict midway through processing > the range, the RMM terminates early and returns RMI_ERROR_RTT. > Nope, see below. > When that happens, the RMM writes the failing IPA to out_top (register x1) > so the caller knows which pages were successfully processed before the error. > > By restricting the out_top assignment strictly to ret == RMI_SUCCESS, doesn't > this silently discard the partial progress indicator on RMI_ERROR_RTT, causing > KVM to lose track of the modified pages? > >> + >> + return ret; >> +} > [ ... ] >> +static inline long rmi_rtt_data_unmap(unsigned long rd, >> + unsigned long base, >> + unsigned long top, >> + unsigned long flags, >> + unsigned long oaddr, >> + unsigned long *out_top, >> + unsigned long *out_range, >> + unsigned long *out_count) >> +{ >> + struct arm_smccc_1_2_regs regs = { >> + SMC_RMI_RTT_DATA_UNMAP, rd, base, top, flags, oaddr >> + }; >> + long ret; >> + >> + ret = rmi_sro_execute(®s); >> + >> + if (ret != RMI_SUCCESS) >> + return ret; >> + >> + if (out_top) >> + *out_top = regs.a1; > > [Severity: High] > Similarly, if rmi_rtt_data_unmap() encounters an RMI_ERROR_RTT, it returns > early here without populating out_top. As explained earlier, out_top is invalid when result != RMI_SUCCESS for all cases except RMI_RTT_DESTROY. Suzuki