From patchwork Wed Dec 21 00:53:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 9482423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 426F7601C0 for ; Wed, 21 Dec 2016 00:53:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 265F928159 for ; Wed, 21 Dec 2016 00:53:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07CDD28306; Wed, 21 Dec 2016 00:53:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6835028159 for ; Wed, 21 Dec 2016 00:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934258AbcLUAxW (ORCPT ); Tue, 20 Dec 2016 19:53:22 -0500 Received: from simcoe208srvr.owm.bell.net ([184.150.200.208]:35253 "EHLO torfep02.bell.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934123AbcLUAxV (ORCPT ); Tue, 20 Dec 2016 19:53:21 -0500 Received: from bell.net torfep02 184.150.200.158 by torfep02.bell.net with ESMTP id <20161221005320.ZRMU478.torfep02.bell.net@torspm02.bell.net> for ; Tue, 20 Dec 2016 19:53:20 -0500 Received: from [192.168.2.10] (really [184.144.120.170]) by torspm02.bell.net with ESMTP id <20161221005320.CMTC3859.torspm02.bell.net@[192.168.2.10]>; Tue, 20 Dec 2016 19:53:20 -0500 From: John David Anglin Mime-Version: 1.0 (Apple Message framework v1085) Date: Tue, 20 Dec 2016 19:53:19 -0500 Subject: [PATCH] parisc: Purge TLB entry used for tmp alias operations on PA 2.0 Cc: Helge Deller , James Bottomley To: "linux-parisc@vger.kernel.org List" Message-Id: X-Mailer: Apple Mail (2.1085) X-Opwv-CommTouchExtSvcRefID: str=0001.0A020203.5859D280.006E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It became apparent with more buildd testing that the previous patch removing the TLB purge after a tmp alias operation (e.g., cache flush) was incorrect on PA 2.0 systems that don't support inequivalent aliases. This patch restores the needed purge on PA 2.0 systems. Essentially, the purge is only needed on systems with PA8800 and PA8900 processors. It uses registers %r24 and %r25 to save the address of the tmp alias pages used for the 'to' and 'from' operations. We don't check whether inequivalent aliases are supported or not as the purge is local and can be done efficiently on all PA 2.0 processors. The patch has been tested for six days on rp3440 and no random segmentation faults have been observed. Signed-off-by: John David Anglin --- John David Anglin dave.anglin@bell.net diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index adf7187f8951..289c57c16f3d 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S @@ -626,6 +626,8 @@ ENTRY_CFI(copy_user_page_asm) /* Purge any old translations */ #ifdef CONFIG_PA20 + copy %r28, %r24 + copy %r29, %r25 pdtlb,l %r0(%r28) pdtlb,l %r0(%r29) #else @@ -743,6 +745,11 @@ ENTRY_CFI(copy_user_page_asm) ldo 64(%r29), %r29 #endif +#ifdef CONFIG_PA20 + pdtlb,l %r0(%r24) + pdtlb,l %r0(%r25) +#endif + bv %r0(%r2) nop .exit @@ -774,6 +781,7 @@ ENTRY_CFI(clear_user_page_asm) /* Purge any old translation */ #ifdef CONFIG_PA20 + copy %r28, %r24 pdtlb,l %r0(%r28) #else tlb_lock %r20,%r21,%r22 @@ -829,6 +837,10 @@ ENTRY_CFI(clear_user_page_asm) ldo 64(%r28), %r28 #endif /* CONFIG_64BIT */ +#ifdef CONFIG_PA20 + pdtlb,l %r0(%r24) +#endif + bv %r0(%r2) nop .exit @@ -855,16 +867,6 @@ ENTRY_CFI(flush_dcache_page_asm) depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ #endif - /* Purge any old translation */ - -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) -#else - tlb_lock %r20,%r21,%r22 - pdtlb %r0(%r28) - tlb_unlock %r20,%r21,%r22 -#endif - ldil L%dcache_stride, %r1 ldw R%dcache_stride(%r1), r31 @@ -876,6 +878,16 @@ ENTRY_CFI(flush_dcache_page_asm) add %r28, %r25, %r25 sub %r25, r31, %r25 + /* Purge any old translation */ + +#ifdef CONFIG_PA20 + copy %r28, %r24 + pdtlb,l %r0(%r28) +#else + tlb_lock %r20,%r21,%r22 + pdtlb %r0(%r28) + tlb_unlock %r20,%r21,%r22 +#endif 1: fdc,m r31(%r28) fdc,m r31(%r28) @@ -896,6 +908,11 @@ ENTRY_CFI(flush_dcache_page_asm) fdc,m r31(%r28) sync + +#ifdef CONFIG_PA20 + pdtlb,l %r0(%r24) +#endif + bv %r0(%r2) nop .exit @@ -922,21 +939,6 @@ ENTRY_CFI(flush_icache_page_asm) depwi 0, 31,PAGE_SHIFT, %r28 /* Clear any offset bits */ #endif - /* Purge any old translation. Note that the FIC instruction - * may use either the instruction or data TLB. Given that we - * have a flat address space, it's not clear which TLB will be - * used. So, we purge both entries. */ - -#ifdef CONFIG_PA20 - pdtlb,l %r0(%r28) - pitlb,l %r0(%sr4,%r28) -#else - tlb_lock %r20,%r21,%r22 - pdtlb %r0(%r28) - pitlb %r0(%sr4,%r28) - tlb_unlock %r20,%r21,%r22 -#endif - ldil L%icache_stride, %r1 ldw R%icache_stride(%r1), %r31 @@ -948,6 +950,20 @@ ENTRY_CFI(flush_icache_page_asm) add %r28, %r25, %r25 sub %r25, %r31, %r25 + /* Purge any old translation. Note that the FIC instruction + * may use either the instruction or data TLB. Given that we + * have a flat address space, it's not clear which TLB will be + * used. So, we purge both entries. */ + +#ifdef CONFIG_PA20 + copy %r28, %r24 + pdtlb,l %r0(%r28) + pitlb,l %r0(%sr4,%r28) +#else + tlb_lock %r20,%r21,%r22 + pdtlb %r0(%r28) + tlb_unlock %r20,%r21,%r22 +#endif /* fic only has the type 26 form on PA1.1, requiring an * explicit space specification, so use %sr4 */ @@ -970,6 +986,12 @@ ENTRY_CFI(flush_icache_page_asm) fic,m %r31(%sr4,%r28) sync + +#ifdef CONFIG_PA20 + pdtlb,l %r0(%r24) + pitlb,l %r0(%sr4,%r24) +#endif + bv %r0(%r2) nop .exit