Re: [PATCH v4 04/14] irqchip: mips-gic: Support multi-cluster in for_each_online_cpu_gic()

From: Thomas Gleixner
Date: Fri Jun 21 2024 - 16:22:01 EST


On Sat, May 11 2024 at 12:43, Aleksandar Rikalo wrote:
> From: Paul Burton <paulburton@xxxxxxxxxx>
>
> Introduce support for multi-cluster GIC register access in
> __gic_with_next_online_cpu(), and therefore in its user
> for_each_online_cpu_gic(). We access registers in remote clusters
> using the CM's GCR_CL_REDIRECT register, and so here we delegate
> to mips_cm_lock_other() in order to configure this access.

Again: We do nothing. See docs.

> @@ -70,6 +70,20 @@ static int __gic_with_next_online_cpu(int prev)
> {
> unsigned int cpu;
>
> + /*
> + * Unlock access to the previous CPU's GIC local register block.
> + *
> + * Delegate to the CM locking code in the multi-cluster case, since
> + * other clusters can only be accessed using GCR_CL_REDIRECT.
> + *
> + * In the single cluster case we don't need to do anything; the caller
> + * is responsible for maintaining gic_lock & nothing should be
> + * expecting any particular value of GIC_VL_OTHER so we can leave it
> + * as-is.
> + */
> + if ((prev != -1) && mips_cps_multicluster_cpus())
> + mips_cm_unlock_other();

Eew.

static inline void gic_unlock_cluster(void)
{
if (mips_cps_multicluster_cpus())
mips_cm_unlock_other();
}

#define for_each_online_cpu_gic(cpu, gic_lock) \
guard(raw_spinlock_irqsave)(gic_lock); \
for ((cpu) = __gic_with_next_online_cpu(-1); \
(cpu) < nr_cpu_ids; \
gic_unlock_cluster(), \
(cpu) = __gic_with_next_online_cpu(cpu);)

No?

Thanks,

tglx