From owner-svn-src-head@freebsd.org Sun Dec 15 21:20:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70DED1CF9F5; Sun, 15 Dec 2019 21:20:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47bckW2MvYz3yfP; Sun, 15 Dec 2019 21:20:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CA2A1B0C1; Sun, 15 Dec 2019 21:20:19 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBFLKJg0031841; Sun, 15 Dec 2019 21:20:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBFLKIaV031839; Sun, 15 Dec 2019 21:20:18 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912152120.xBFLKIaV031839@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 15 Dec 2019 21:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355783 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 355783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Dec 2019 21:20:19 -0000 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);