]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.125/parisc-use-implicit-space-register-selection-for-loading-the-coherence-index-of-i-o-pdirs.patch
Linux 4.19.50
[thirdparty/kernel/stable-queue.git] / releases / 4.14.125 / parisc-use-implicit-space-register-selection-for-loading-the-coherence-index-of-i-o-pdirs.patch
1 From 63923d2c3800919774f5c651d503d1dd2adaddd5 Mon Sep 17 00:00:00 2001
2 From: John David Anglin <dave.anglin@bell.net>
3 Date: Mon, 27 May 2019 20:15:14 -0400
4 Subject: parisc: Use implicit space register selection for loading the coherence index of I/O pdirs
5
6 From: John David Anglin <dave.anglin@bell.net>
7
8 commit 63923d2c3800919774f5c651d503d1dd2adaddd5 upstream.
9
10 We only support I/O to kernel space. Using %sr1 to load the coherence
11 index may be racy unless interrupts are disabled. This patch changes the
12 code used to load the coherence index to use implicit space register
13 selection. This saves one instruction and eliminates the race.
14
15 Tested on rp3440, c8000 and c3750.
16
17 Signed-off-by: John David Anglin <dave.anglin@bell.net>
18 Cc: stable@vger.kernel.org
19 Signed-off-by: Helge Deller <deller@gmx.de>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 drivers/parisc/ccio-dma.c | 4 +---
24 drivers/parisc/sba_iommu.c | 3 +--
25 2 files changed, 2 insertions(+), 5 deletions(-)
26
27 --- a/drivers/parisc/ccio-dma.c
28 +++ b/drivers/parisc/ccio-dma.c
29 @@ -565,8 +565,6 @@ ccio_io_pdir_entry(u64 *pdir_ptr, space_
30 /* We currently only support kernel addresses */
31 BUG_ON(sid != KERNEL_SPACE);
32
33 - mtsp(sid,1);
34 -
35 /*
36 ** WORD 1 - low order word
37 ** "hints" parm includes the VALID bit!
38 @@ -597,7 +595,7 @@ ccio_io_pdir_entry(u64 *pdir_ptr, space_
39 ** Grab virtual index [0:11]
40 ** Deposit virt_idx bits into I/O PDIR word
41 */
42 - asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba));
43 + asm volatile ("lci %%r0(%1), %0" : "=r" (ci) : "r" (vba));
44 asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci));
45 asm volatile ("depw %1,15,12,%0" : "+r" (pa) : "r" (ci));
46
47 --- a/drivers/parisc/sba_iommu.c
48 +++ b/drivers/parisc/sba_iommu.c
49 @@ -575,8 +575,7 @@ sba_io_pdir_entry(u64 *pdir_ptr, space_t
50 pa = virt_to_phys(vba);
51 pa &= IOVP_MASK;
52
53 - mtsp(sid,1);
54 - asm("lci 0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba));
55 + asm("lci 0(%1), %0" : "=r" (ci) : "r" (vba));
56 pa |= (ci >> PAGE_SHIFT) & 0xff; /* move CI (8 bits) into lowest byte */
57
58 pa |= SBA_PDIR_VALID_BIT; /* set "valid" bit */