From owner-svn-src-all@freebsd.org Wed Nov 8 01:24:53 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5392DE6A083; Wed, 8 Nov 2017 01:24:53 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15E747E78E; Wed, 8 Nov 2017 01:24:53 +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 vA81Nb7H081483; Wed, 8 Nov 2017 01:23:37 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA81NbSF081481; Wed, 8 Nov 2017 01:23:37 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201711080123.vA81NbSF081481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 8 Nov 2017 01:23:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325525 - in head/sys/powerpc: booke powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: booke powerpc X-SVN-Commit-Revision: 325525 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.23 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: Wed, 08 Nov 2017 01:24:53 -0000 Author: jhibbits Date: Wed Nov 8 01:23:37 2017 New Revision: 325525 URL: https://svnweb.freebsd.org/changeset/base/325525 Log: Clear the WE bit in C code rather than the asm According to EREF rlwinm is supposed to clear the upper 32 bits of the register of 64-bit cores. However, from experience it seems there's a bug in the e5500 which causes the result to be duplicated in the upper bits of the register. This causes problems when applied to stashed SRR1 accessed to retrieve context, as the upper bits are not masked out, so a set_mcontext() fails. This causes sigreturn() to in turn return with EINVAL, causing make(1) to exit with error. This bit is unused in e500mc derivatives (including e5500), so could just be conditional on non-powerpc64, but there may be other non-Freescale cores which do use it. This is also the same as the POW bit on Book-S, so could be cleared unconditionally with the only penalty being a few clock cycles for these two interrupts. Modified: head/sys/powerpc/booke/trap_subr.S head/sys/powerpc/powerpc/interrupt.c Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Wed Nov 8 01:00:59 2017 (r325524) +++ head/sys/powerpc/booke/trap_subr.S Wed Nov 8 01:23:37 2017 (r325525) @@ -567,7 +567,7 @@ INTERRUPT(int_external_input) addi %r3, %r1, CALLSIZE bl CNAME(powerpc_interrupt) TOC_RESTORE - b clear_we + b trapexit INTERRUPT(int_alignment) @@ -607,7 +607,7 @@ INTERRUPT(int_decrementer) addi %r3, %r1, CALLSIZE bl CNAME(powerpc_interrupt) TOC_RESTORE - b clear_we + b trapexit /***************************************************************************** @@ -1090,12 +1090,6 @@ dbleave: FRAME_LEAVE(SPR_SRR0, SPR_SRR1) rfi #endif /* KDB */ - -clear_we: - LOAD %r3, (FRAME_SRR1+CALLSIZE)(%r1) - rlwinm %r3, %r3, 0, 14, 12 - STORE %r3, (FRAME_SRR1+CALLSIZE)(%r1) - b trapexit #ifdef SMP ENTRY(tlb_lock) Modified: head/sys/powerpc/powerpc/interrupt.c ============================================================================== --- head/sys/powerpc/powerpc/interrupt.c Wed Nov 8 01:00:59 2017 (r325524) +++ head/sys/powerpc/powerpc/interrupt.c Wed Nov 8 01:23:37 2017 (r325525) @@ -89,6 +89,9 @@ powerpc_interrupt(struct trapframe *framep) critical_enter(); PIC_DISPATCH(root_pic, framep); critical_exit(); +#ifdef BOOKE + framep->srr1 &= ~PSL_WE; +#endif break; case EXC_DECR: @@ -100,6 +103,9 @@ powerpc_interrupt(struct trapframe *framep) td->td_intr_frame = oldframe; atomic_subtract_int(&td->td_intr_nesting_level, 1); critical_exit(); +#ifdef BOOKE + framep->srr1 &= ~PSL_WE; +#endif break; #ifdef HWPMC_HOOKS case EXC_PERF: