From patchwork Wed Mar 30 14:42:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 12795953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4849EC433EF for ; Wed, 30 Mar 2022 14:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347306AbiC3OwJ (ORCPT ); Wed, 30 Mar 2022 10:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347335AbiC3OwH (ORCPT ); Wed, 30 Mar 2022 10:52:07 -0400 Received: from cmx-torrgo002.bell.net (mta-tor-002.bell.net [209.71.212.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 672754925A for ; Wed, 30 Mar 2022 07:50:19 -0700 (PDT) X-RG-CM-BuS: 0 X-RG-CM-SC: 0 X-RG-CM: Clean X-Originating-IP: [70.50.7.94] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 6243254D001A98F7 X-CM-Envelope: MS4xfKx8NLN/vGmdja8UPnP5wD84gt6EL7BcKPYYzRkDv55YiYklMbvWis6f3lI29zCUQFWwwpZPrDid2UUnhKUv3J5ldNfokxtqgRpdoDEDVr6whzl6BS7f 2u85Dh2hRsLvYn5puQVRhLWdrM9qUziwoturLi6QviWDG7ZyQlbyeqxiQnOoBVw1ifPOVcyilXYsJ+mIQqj9DAU4GWNZ2VnTEsqF4+NJYEqnSLDDQc+dC6Wu YKSY8tuaUjRxx8TN+R6jIJjSkbT3xXNtJxr5ECvRYiUbQpvlPy3zk60vdcqQHN/oldBuiVHfThLADl9GQTG0x2mCpXSQsrFhK6Nm+qvNf0Wbbh+YRi1RcUcO y/lw+yPologkewJGRQi+Ky4/HUYqbxa/iy9DBdE+UFwzCiU1ul9YnWDc8OaZdxHHgZmlCxBNCddjhGegTTrEwPGv3+lUYEo4EWUTtpn63HsfkvhnYclpFd2N 5LvYGX/3xL3u56sEdt7j6PMfJ769AYsdeeiIVQjmHP55yV6hqdV+ESoC/ZY4YGLhlPThrlWCrFyCtEOek9Toa1htwwEmoIjwAMORdS9ogQ4npVITIqUbtTI9 OiGEgWztBkObKf68o6Go/TEeDAggqAsxzAVtxZ5e0T2O9w== X-CM-Analysis: v=2.4 cv=G99/r/o5 c=1 sm=1 tr=0 ts=62446c57 a=9k1bCY7nR7m1ZFzoCuQ56g==:117 a=9k1bCY7nR7m1ZFzoCuQ56g==:17 a=o8Y5sQTvuykA:10 a=FBHGMhGWAAAA:8 a=pwD9VVs-Zs8JKL4LVKUA:9 a=CjuIK1q_8ugA:10 a=96wnEI4cIE8GtJseiSoA:9 a=FfaGCDsud1wA:10 a=9gvnlMMaQFpL9xblJ6ne:22 Received: from mx3210.localdomain (70.50.7.94) by cmx-torrgo002.bell.net (5.8.807) (authenticated as dave.anglin@bell.net) id 6243254D001A98F7; Wed, 30 Mar 2022 10:42:31 -0400 Received: by mx3210.localdomain (Postfix, from userid 1000) id 7E5C7220116; Wed, 30 Mar 2022 14:42:30 +0000 (UTC) Date: Wed, 30 Mar 2022 14:42:30 +0000 From: John David Anglin To: linux-parisc@vger.kernel.org Cc: Helge Deller , Deller , James Bottomley Subject: [PATCH] parisc: Don't enforce DMA completion order in cache flushes Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org The only place we need to ensure all outstanding cache coherence operations are complete is in invalidate_kernel_vmap_range. All parisc drivers synchronize DMA operations internally and do not call invalidate_kernel_vmap_range. We only need this for non-coherent I/O operations. Signed-off-by: John David Anglin diff --git a/arch/parisc/include/asm/cache.h b/arch/parisc/include/asm/cache.h index 5032e758594e..e23d06b51a20 100644 --- a/arch/parisc/include/asm/cache.h +++ b/arch/parisc/include/asm/cache.h @@ -54,6 +54,7 @@ void parisc_setup_cache_timing(void); #define asm_io_sync() asm volatile("sync" \ ALTERNATIVE(ALT_COND_NO_DCACHE, INSN_NOP) \ ALTERNATIVE(ALT_COND_NO_IOC_FDC, INSN_NOP) :::"memory") +#define asm_syncdma() asm volatile("syncdma" :::"memory") #endif /* ! __ASSEMBLY__ */ diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 533c5643c3fe..7eb3467a0432 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -642,6 +642,9 @@ void invalidate_kernel_vmap_range(void *vaddr, int size) unsigned long start = (unsigned long)vaddr; unsigned long end = start + size; + /* Ensure DMA is complete */ + asm_syncdma(); + if ((!IS_ENABLED(CONFIG_SMP) || !arch_irqs_disabled()) && (unsigned long)size >= parisc_cache_flush_threshold) { flush_tlb_kernel_range(start, end); diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index b4c3f01e2399..8569141e3e67 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S @@ -300,7 +300,6 @@ fdoneloop2: fdce,m %arg1(%sr1, %arg0) /* Fdce for one loop */ fdsync: - syncdma sync mtsm %r22 /* restore I-bit */ 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) @@ -1098,7 +1097,6 @@ ENTRY_CFI(flush_kernel_dcache_range_asm) sync 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) - syncdma bv %r0(%r2) nop ENDPROC_CFI(flush_kernel_dcache_range_asm) @@ -1140,7 +1138,6 @@ ENTRY_CFI(purge_kernel_dcache_range_asm) sync 89: ALTERNATIVE(88b, 89b, ALT_COND_NO_DCACHE, INSN_NOP) - syncdma bv %r0(%r2) nop ENDPROC_CFI(purge_kernel_dcache_range_asm)