Store MPIDR register in pcpu.

MPIDR represents physical locality of given core and it should be used as
the only viable/robust connection between cpuid (which have zero relation to
cores topology) and external description (for example  in FDT).  It can be
used for determining which interrupt is associated to given per-CPU PMU
or by scheduler for determining big/little core or cluster topology.

MFC after: 3 weeks
This commit is contained in:
Michal Meloun 2020-11-29 18:59:01 +00:00
parent f2f1a2a0a0
commit bd89101586
3 changed files with 6 additions and 1 deletions

View file

@ -302,6 +302,8 @@ DELAY(int usec)
void
cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{
pcpu->pc_mpidr = 0xffffffff;
}
void
@ -684,6 +686,7 @@ pcpu0_init(void)
{
set_curthread(&thread0);
pcpu_init(pcpup, 0, sizeof(struct pcpu));
pcpup->pc_mpidr = cp15_mpidr_get() & 0xFFFFFF;
PCPU_SET(curthread, &thread0);
}

View file

@ -162,6 +162,7 @@ init_secondary(int cpu)
;
pcpu_init(pc, cpu, sizeof(struct pcpu));
pc->pc_mpidr = cp15_mpidr_get() & 0xFFFFFF;
dpcpu_init(dpcpu[cpu - 1], cpu);
#if defined(DDB)
dbg_monitor_init_secondary();

View file

@ -65,7 +65,8 @@ struct vmspace;
int pc_bp_harden_kind; \
uint32_t pc_original_actlr; \
uint64_t pc_clock; \
char __pad[139]
uint32_t pc_mpidr; \
char __pad[135]
#ifdef _KERNEL