Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2020 18:59:01 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368161 - in head/sys/arm: arm include
Message-ID:  <202011291859.0ATIx1fs055981@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Sun Nov 29 18:59:01 2020
New Revision: 368161
URL: https://svnweb.freebsd.org/changeset/base/368161

Log:
  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

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/include/pcpu.h

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Sun Nov 29 18:22:14 2020	(r368160)
+++ head/sys/arm/arm/machdep.c	Sun Nov 29 18:59:01 2020	(r368161)
@@ -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);
 }
 

Modified: head/sys/arm/arm/mp_machdep.c
==============================================================================
--- head/sys/arm/arm/mp_machdep.c	Sun Nov 29 18:22:14 2020	(r368160)
+++ head/sys/arm/arm/mp_machdep.c	Sun Nov 29 18:59:01 2020	(r368161)
@@ -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();

Modified: head/sys/arm/include/pcpu.h
==============================================================================
--- head/sys/arm/include/pcpu.h	Sun Nov 29 18:22:14 2020	(r368160)
+++ head/sys/arm/include/pcpu.h	Sun Nov 29 18:59:01 2020	(r368161)
@@ -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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011291859.0ATIx1fs055981>