[PATCHv2 02/12] arm64: smp_plat: add get_logical_index

Mark Rutland mark.rutland at arm.com
Tue May 19 02:10:57 PDT 2015


> > > > +/*
> > > > + * Retrieve logical cpu index corresponding to a given MPIDR.Aff*
> > > > + *  - mpidr: MPIDR.Aff* bits to be used for the look-up
> > > > + *
> > > > + * Returns the cpu logical index or -EINVAL on look-up error
> > > > + */
> > > > +static inline int get_logical_index(u64 mpidr)
> > > > +{
> > > > +	int cpu;
> > > > +	for (cpu = 0; cpu < nr_cpu_ids; cpu++)
> > > > +		if (cpu_logical_map(cpu) == mpidr)
> > > > +			return cpu;
> > > > +	return -EINVAL;
> > > > +}
> > > 
> > > Do we guarantee that mpidr here only contains the affinity bits (i.e. no
> > > masking)?
> > 
> > In the DT and ACPI probe paths we reject IDs with bits other than the
> > aff bits set.
> > 
> > I don't currently have a sanity check in the code handling
> > MIGRATE_INFO_UP_CPU, but I should add one.
> > 
> > Would you like a warning here too?
> 
> Or maybe just the warning if the code paths to this function already
> mask out the non-affinity bits.

Sure; that's what I meant about a sanity check in the code handling
MIGRATE_INFO_UP_CPU (where query a CPU ID from the PSCI implementation).
I'll see about adding a warning there.

In the DT and ACPI parsing cases we already warn if non-affinity bits
are set.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list