From owner-svn-src-all@freebsd.org Sat May 26 00:41:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FCB5EF8E54; Sat, 26 May 2018 00:41:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CE087B384; Sat, 26 May 2018 00:41:51 +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 F34645B9; Sat, 26 May 2018 00:41:50 +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 w4Q0foo9097995; Sat, 26 May 2018 00:41:50 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4Q0foJ7097994; Sat, 26 May 2018 00:41:50 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805260041.w4Q0foJ7097994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 26 May 2018 00:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334230 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 334230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 May 2018 00:41:51 -0000 Author: jhibbits Date: Sat May 26 00:41:50 2018 New Revision: 334230 URL: https://svnweb.freebsd.org/changeset/base/334230 Log: Only crop the VPN on POWER4 and derivatives for TLBIE operations Summary: PowerISA 2.03 and later require bits 14:65 in the RB register argument, which is the full value of the vpn argument post-shift. Only POWER4, POWER4+, and PPC970* need the upper 16 bits cropped. With this change FreeBSD can boot to multi-user on POWER9. Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D15581 Modified: head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Fri May 25 23:18:06 2018 (r334229) +++ head/sys/powerpc/aim/moea64_native.c Sat May 26 00:41:50 2018 (r334230) @@ -133,6 +133,8 @@ __FBSDID("$FreeBSD$"); /* POWER9 only permits a 64k partition table size. */ #define PART_SIZE 0x10000 +static int moea64_crop_tlbie; + static __inline void TLBIE(uint64_t vpn) { #ifndef __powerpc64__ @@ -144,12 +146,14 @@ TLBIE(uint64_t vpn) { static volatile u_int tlbie_lock = 0; vpn <<= ADDR_PIDX_SHFT; - vpn &= ~(0xffffULL << 48); /* Hobo spinlock: we need stronger guarantees than mutexes provide */ while (!atomic_cmpset_int(&tlbie_lock, 0, 1)); isync(); /* Flush instruction queue once lock acquired */ + if (moea64_crop_tlbie) + vpn &= ~(0xffffULL << 48); + #ifdef __powerpc64__ __asm __volatile("tlbie %0" :: "r"(vpn) : "memory"); __asm __volatile("eieio; tlbsync; ptesync" ::: "memory"); @@ -428,6 +432,15 @@ moea64_bootstrap_native(mmu_t mmup, vm_offset_t kernel moea64_early_bootstrap(mmup, kernelstart, kernelend); + switch (mfpvr() >> 16) { + case IBMPOWER4: + case IBMPOWER4PLUS: + case IBM970: + case IBM970FX: + case IBM970GX: + case IBM970MP: + moea64_crop_tlbie = true; + } /* * Allocate PTEG table. */