svn commit: r348379 - head/sys/arm64/arm64

Jayachandran C. jchandra at FreeBSD.org
Thu May 30 01:32:01 UTC 2019


Author: jchandra
Date: Thu May 30 01:32:00 2019
New Revision: 348379
URL: https://svnweb.freebsd.org/changeset/base/348379

Log:
  gicv3_its: do LPI init only once per CPU
  
  The initialization required for LPIs (setting up pending tables etc.)
  has to be done just once per CPU, even in the case where there are
  multiple ITS blocks associated with the CPU.
  
  Add a flag lpi_enabled in the per-cpu distributor info for this and
  use it to ensure that we call its_init_cpu_lpi() just once.
  
  This enables us to support platforms where multiple GIC ITS blocks
  can generate LPIs to a CPU.
  
  Reviewed by:	andrew
  Differential Revision:	https://reviews.freebsd.org/D19844

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/arm64/arm64/gicv3_its.c

Modified: head/sys/arm64/arm64/gic_v3.c
==============================================================================
--- head/sys/arm64/arm64/gic_v3.c	Thu May 30 01:24:47 2019	(r348378)
+++ head/sys/arm64/arm64/gic_v3.c	Thu May 30 01:32:00 2019	(r348379)
@@ -1185,6 +1185,7 @@ gic_v3_redist_find(struct gic_v3_softc *sc)
 				    ("Invalid pointer to per-CPU redistributor"));
 				/* Copy res contents to its final destination */
 				sc->gic_redists.pcpu[cpuid]->res = r_res;
+				sc->gic_redists.pcpu[cpuid]->lpi_enabled = false;
 				if (bootverbose) {
 					device_printf(sc->dev,
 					    "CPU%u Re-Distributor has been found\n",

Modified: head/sys/arm64/arm64/gic_v3_var.h
==============================================================================
--- head/sys/arm64/arm64/gic_v3_var.h	Thu May 30 01:24:47 2019	(r348378)
+++ head/sys/arm64/arm64/gic_v3_var.h	Thu May 30 01:32:00 2019	(r348379)
@@ -41,8 +41,9 @@ DECLARE_CLASS(gic_v3_driver);
 struct gic_v3_irqsrc;
 
 struct redist_pcpu {
-	struct resource		res;
+	struct resource		res;		/* mem resource for redist */
 	vm_offset_t		pend_base;
+	bool			lpi_enabled;	/* redist LPI configured? */
 };
 
 struct gic_redists {

Modified: head/sys/arm64/arm64/gicv3_its.c
==============================================================================
--- head/sys/arm64/arm64/gicv3_its.c	Thu May 30 01:24:47 2019	(r348378)
+++ head/sys/arm64/arm64/gicv3_its.c	Thu May 30 01:32:00 2019	(r348379)
@@ -672,11 +672,16 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc)
 	if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0)
 		return (ENXIO);
 
-	its_init_cpu_lpi(dev, sc);
+	rpcpu = gicv3_get_redist(dev);
 
+	/* Do per-cpu LPI init once */
+	if (!rpcpu->lpi_enabled) {
+		its_init_cpu_lpi(dev, sc);
+		rpcpu->lpi_enabled = true;
+	}
+
 	if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) {
 		/* This ITS wants the redistributor physical address */
-		rpcpu = gicv3_get_redist(dev);
 		target = vtophys(rman_get_virtual(&rpcpu->res));
 	} else {
 		/* This ITS wants the unique processor number */


More information about the svn-src-all mailing list