Use a uint64_t to store the arm64 mpidr

Use a single uint64_t to hole the mpidr register as we can break the
KBI on 14. Keep the macro so code can still be MFCd to 13.

Sponsored by:	Arm Ltd
This commit is contained in:
Andrew Turner 2023-04-24 11:24:13 +01:00
parent c9a05c0722
commit 078a69abcb
3 changed files with 6 additions and 11 deletions

View File

@ -315,8 +315,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{
pcpu->pc_acpi_id = 0xffffffff;
pcpu->pc_mpidr_low = 0xffffffff;
pcpu->pc_mpidr_high = 0xffffffff;
pcpu->pc_mpidr = UINT64_MAX;
}
void

View File

@ -558,8 +558,7 @@ start_cpu(u_int cpuid, uint64_t target_cpu, int domain, vm_paddr_t release_addr)
M_WAITOK | M_ZERO);
pmap_disable_promotion((vm_offset_t)pcpup, size);
pcpu_init(pcpup, cpuid, sizeof(struct pcpu));
pcpup->pc_mpidr_low = target_cpu & CPU_AFF_MASK;
pcpup->pc_mpidr_high = (target_cpu & CPU_AFF_MASK) >> 32;
pcpup->pc_mpidr = target_cpu & CPU_AFF_MASK;
dpcpu[cpuid - 1] = (void *)(pcpup + 1);
dpcpu_init(dpcpu[cpuid - 1], cpuid);
@ -780,8 +779,7 @@ cpu_mp_start(void)
/* CPU 0 is always boot CPU. */
CPU_SET(0, &all_cpus);
mpidr = READ_SPECIALREG(mpidr_el1) & CPU_AFF_MASK;
cpuid_to_pcpu[0]->pc_mpidr_low = mpidr;
cpuid_to_pcpu[0]->pc_mpidr_high = mpidr >> 32;
cpuid_to_pcpu[0]->pc_mpidr = mpidr;
switch(arm64_bus_method) {
#ifdef DEV_ACPI

View File

@ -47,10 +47,9 @@ struct debug_monitor_state;
pcpu_ssbd pc_ssbd; \
struct pmap *pc_curpmap; \
struct pmap *pc_curvmpmap; \
u_int pc_bcast_tlbi_workaround; \
/* Store as two u_int values to preserve KBI */ \
u_int pc_mpidr_low; /* lower MPIDR 32 bits */ \
u_int pc_mpidr_high; /* upper MPIDR 32 bits */ \
uint64_t pc_mpidr; \
u_int pc_bcast_tlbi_workaround; \
char __pad[197]
#ifdef _KERNEL
@ -85,8 +84,7 @@ get_curthread(void)
#define PCPU_PTR(member) (&pcpup->pc_ ## member)
#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value))
#define PCPU_GET_MPIDR(pc) \
((((uint64_t)((pc)->pc_mpidr_high)) << 32) | ((pc)->pc_mpidr_low))
#define PCPU_GET_MPIDR(pc) ((pc)->pc_mpidr)
#endif /* _KERNEL */