Re: [PATCH v21 2/9] firmware: arm_rmm: Check for RMI support at init
From: Catalin Marinas
Date: Thu Oct 01 2026 - 06:51:09 EST
On Thu, Oct 01, 2026 at 09:45:48AM +0100, Suzuki K Poulose wrote:
> +#define RMM_BLOCKED_RETRY_COUNT 2
> +/*
> + * rmi_smccc_invoke: Invoke the RMI call and return the results, retrying the
> + * command when status is RMI_BUSY. If we encounter RMI_BLOCKED, we retry
> + * it one more time before we give up. The caller is supposed to handle the
> + * result and reissue if required.
> + *
> + * We don't expect to see RMI_BLOCKED on a practical system, except when
> + * there are parallel requests that results in long standing operation,
> + * with one blocking the other.
> + *
> + * @regs: Input parameters filled in. Updated with the ouptput results
> + * after the call.
> + */
> +static inline void rmi_smccc_invoke(struct arm_smccc_1_2_regs *regs)
> +{
> + struct arm_smccc_1_2_regs args = *regs;
> + long status;
> + int i = 0;
> +
> + while (i < RMM_BLOCKED_RETRY_COUNT) {
> + arm_smccc_1_2_invoke(&args, regs);
> +
> + status = RMI_RESULT_STATUS(regs->a0);
> + if (status != RMI_BUSY && status != RMI_BLOCKED)
> + break;
> + if (status == RMI_BLOCKED)
> + i++;
> + cpu_relax();
> + }
> +}
With changes around RMI_BUSY to return early in patch 8, I think this is
fine for a brief lock-style retry.
Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>