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.
This commit is contained in:
Justin Hibbits 2019-12-15 21:20:18 +00:00
parent 1c81a87efd
commit 1223b40eba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355783
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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);