From owner-svn-src-head@freebsd.org Mon Jul 30 17:03:16 2018 Return-Path: Delivered-To: svn-src-head@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 3292A105BA76; Mon, 30 Jul 2018 17:03:16 +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 D7F067A87C; Mon, 30 Jul 2018 17:03:15 +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 B9B352734D; Mon, 30 Jul 2018 17:03:15 +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 w6UH3Fva061121; Mon, 30 Jul 2018 17:03:15 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6UH3FJf061119; Mon, 30 Jul 2018 17:03:15 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201807301703.w6UH3FJf061119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 30 Jul 2018 17:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336918 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 336918 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.27 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: Mon, 30 Jul 2018 17:03:16 -0000 Author: jhibbits Date: Mon Jul 30 17:03:15 2018 New Revision: 336918 URL: https://svnweb.freebsd.org/changeset/base/336918 Log: powerpcspe: Unconditionally save an restore SPEFSCR on task switch The SPEFSCR is not guarded by the SPV bit in MSR, it's just another SPR. Protect processes from other tasks setting the SPEFSCR for their own needs. Modified: head/sys/powerpc/powerpc/genassym.c head/sys/powerpc/powerpc/swtch32.S Modified: head/sys/powerpc/powerpc/genassym.c ============================================================================== --- head/sys/powerpc/powerpc/genassym.c Mon Jul 30 16:54:51 2018 (r336917) +++ head/sys/powerpc/powerpc/genassym.c Mon Jul 30 17:03:15 2018 (r336918) @@ -208,6 +208,8 @@ ASSYM(PCB_CDSCR, PCB_CDSCR); ASSYM(PCB_AIM_USR_VSID, offsetof(struct pcb, pcb_cpu.aim.usr_vsid)); ASSYM(PCB_BOOKE_DBCR0, offsetof(struct pcb, pcb_cpu.booke.dbcr0)); +ASSYM(PCB_VSCR, offsetof(struct pcb, pcb_vec.vscr)); + ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); Modified: head/sys/powerpc/powerpc/swtch32.S ============================================================================== --- head/sys/powerpc/powerpc/swtch32.S Mon Jul 30 16:54:51 2018 (r336917) +++ head/sys/powerpc/powerpc/swtch32.S Mon Jul 30 17:03:15 2018 (r336918) @@ -113,6 +113,10 @@ ENTRY(cpu_switch) bl save_vec .L2: +#if defined(__SPE__) + mfspr %r3,SPR_SPEFSCR + stw %r3,PCB_VSCR(%r17) +#endif mr %r3,%r14 /* restore old thread ptr */ bl pmap_deactivate /* Deactivate the current pmap */ @@ -163,6 +167,10 @@ blocked_loop: bl enable_vec .L4: +#if defined(__SPE__) + lwz %r3,PCB_VSCR(%r17) + mtspr SPR_SPEFSCR,%r3 +#endif /* thread to restore is in r3 */ mr %r3,%r17 /* Recover PCB ptr */ lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */