From: sashiko-bot@kernel.org
To: "Suzuki K Poulose" <suzuki.poulose@arm.com>
Cc: "Marc Zyngier" <maz@kernel.org>,
kvm@vger.kernel.org, kvmarm@lists.linux.dev,
"Oliver Upton" <oupton@kernel.org>
Subject: Re: [PATCH v21 8/9] firmware: arm_rmm: Add wrappers for Realm related RMI commands
Date: Thu, 01 Oct 2026 09:04:50 +0000 [thread overview]
Message-ID: <20261001090450.C1CBB1F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20261001084555.1456543-9-suzuki.poulose@arm.com>
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.
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.
Since the RMM handles range commands sequentially, the IPAs prior to the
error were successfully unmapped. Discarding out_top hides this partial
progress from the caller. Can this lead to memory leaks or missing TLB
invalidations because KVM loses sync with the actual RTT state?
This same pattern appears to affect the other range command wrappers
introduced in this patch, such as rmi_rtt_init_ripas(), rmi_rtt_unprot_map(),
rmi_rtt_set_ripas(), and rmi_rtt_unprot_unmap().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001084555.1456543-1-suzuki.poulose@arm.com?part=8
next prev parent reply other threads:[~2026-10-01 9:04 UTC|newest]
Thread overview: 20+ 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 9:01 ` sashiko-bot
2026-10-01 9:14 ` 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
2026-10-01 9:04 ` sashiko-bot [this message]
2026-10-01 9:11 ` Suzuki K Poulose
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=20261001090450.C1CBB1F0089A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=suzuki.poulose@arm.com \
/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