[PATCH v18 7/7] firmware: arm_rmm: Add wrappers for Realm related RMI commands

Alper Gun alpergun at google.com
Tue Sep 15 12:35:22 PDT 2026


On Sat, Sep 12, 2026 at 1:37 AM Suzuki K Poulose <suzuki.poulose at arm.com> wrote:
[...]
> +/**
> + * rmi_rtt_destroy() - Destroy an RTT
> + * @rd: PA of the RD
> + * @ipa: Base of the IPA range described by the RTT
> + * @level: RTT level
> + * @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, 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: 0 on success, positive RMI result code or negative Linux error code.
> + */
> +static inline long rmi_rtt_destroy(unsigned long rd,
> +                                  unsigned long ipa,
> +                                  long level,
> +                                  unsigned long *out_rtt,
> +                                  unsigned long *out_top)
> +{
> +       struct arm_smccc_1_2_regs regs = {
> +               SMC_RMI_RTT_DESTROY, rd, ipa, level
> +       };
> +       long ret = rmi_sro_execute(&regs);
> +
> +       if (ret != RMI_SUCCESS)
> +               return ret;
> +
> +       if (out_rtt)
> +               *out_rtt = regs.a1;
> +       if (out_top)
> +               *out_top = regs.a2;
> +
> +       return RMI_SUCCESS;
> +}

Doesn't out_top (regs.a2) need to be populated on RMI_ERROR_RTT as well?
realm_tear_down_rtt_level() checks next_addr > addr under case
RMI_ERROR_RTT: to determine whether the RTT is missing or has child tables
that need recursive teardown.

Thanks,
Alper



More information about the linux-arm-kernel mailing list