From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>,
kvm@vger.kernel.org, kvmarm@lists.linux.dev,
Oliver Upton <oupton@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH v21 8/9] firmware: arm_rmm: Add wrappers for Realm related RMI commands
Date: Thu, 1 Oct 2026 10:11:35 +0100 [thread overview]
Message-ID: <ea458644-d723-46e2-bd7d-7746e56d7a08@arm.com> (raw)
In-Reply-To: <20261001090450.C1CBB1F0089A@smtp.kernel.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 <steven.price@arm.com>
>
> 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
next prev parent reply other threads:[~2026-10-01 9:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 8:45 [PATCH v21 0/9] firmware: arm_rmm: Add RMM v2.0 base RMI support Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 1/9] firmware: arm_rmm: Add SMC definitions for calling the RMM Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 2/9] firmware: arm_rmm: Check for RMI support at init Suzuki K Poulose
2026-10-01 10:50 ` Catalin Marinas
2026-10-01 8:45 ` [PATCH v21 3/9] firmware: arm_rmm: Configure the RMM with the host's page size Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 4/9] firmware: arm_rmm: Add support for SRO Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 5/9] firmware: arm_rmm: Activate the RMM Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 6/9] firmware: arm_rmm: Ensure the RMM has GPT entries for memory Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 7/9] arm64: Block hibernate and kexec while RMM is active Suzuki K Poulose
2026-10-01 11:05 ` Catalin Marinas
2026-10-01 11:39 ` Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 8/9] firmware: arm_rmm: Add wrappers for Realm related RMI commands Suzuki K Poulose
[not found] ` <20261001090450.C1CBB1F0089A@smtp.kernel.org>
2026-10-01 9:11 ` Suzuki K Poulose [this message]
2026-10-01 12:58 ` Catalin Marinas
2026-10-01 13:31 ` Suzuki K Poulose
2026-10-01 8:45 ` [PATCH v21 9/9] firmware: arm_rmm: hotplug: Skip memory added to ZONE_MOVABLE Suzuki K Poulose
2026-10-01 13:10 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea458644-d723-46e2-bd7d-7746e56d7a08@arm.com \
--to=suzuki.poulose@arm.com \
--cc=catalin.marinas@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®