Author: jhibbits
Date: Sun Dec 15 21:20:18 2019
New Revision: 355783
URL: https://svnweb.freebsd.org/changeset/base/355783

Log:
  powerpc/powernv: Set the PTCR for the Nest MMU
  
  The Nest MMU manages address translation for accelerators on the POWER9.  To
  do so, it needs a page table, so export the system page table to the Nest
  MMU.  This will quietly fail on pre-POWER9 systems that do not have a NMMU.
  
  The NMMU is currently unused, so this change is currently effectively a NOP,
  but the NMMU and VAS will eventually be used.

Modified:
  head/sys/powerpc/powernv/opal.h
  head/sys/powerpc/powernv/platform_powernv.c

Modified: head/sys/powerpc/powernv/opal.h
==============================================================================
--- head/sys/powerpc/powernv/opal.h     Sun Dec 15 21:19:41 2019        
(r355782)
+++ head/sys/powerpc/powernv/opal.h     Sun Dec 15 21:20:18 2019        
(r355783)
@@ -91,6 +91,7 @@ int opal_call(uint64_t token, ...);
 #define        OPAL_INT_EOI                    124
 #define        OPAL_INT_SET_MFRR               125
 #define        OPAL_PCI_TCE_KILL               126
+#define        OPAL_NMMU_SET_PTCR              127
 #define        OPAL_XIVE_RESET                 128
 #define        OPAL_XIVE_GET_IRQ_INFO          129
 #define        OPAL_XIVE_GET_IRQ_CONFIG        130

Modified: head/sys/powerpc/powernv/platform_powernv.c
==============================================================================
--- head/sys/powerpc/powernv/platform_powernv.c Sun Dec 15 21:19:41 2019        
(r355782)
+++ head/sys/powerpc/powernv/platform_powernv.c Sun Dec 15 21:20:18 2019        
(r355783)
@@ -494,3 +494,14 @@ static void
 powernv_cpu_idle(sbintime_t sbt)
 {
 }
+
+/* Set up the Nest MMU on POWER9 relatively early, but after pmap is setup. */
+static void
+powernv_setup_nmmu(void *unused)
+{
+       if (opal_check() != 0)
+               return;
+       opal_call(OPAL_NMMU_SET_PTCR, -1, mfspr(SPR_PTCR));
+}
+
+SYSINIT(powernv_setup_nmmu, SI_SUB_CPU, SI_ORDER_ANY, powernv_setup_nmmu, 
NULL);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to