]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
parisc: Use implicit space register selection for loading the coherence index of...
authorJohn David Anglin <dave.anglin@bell.net>
Tue, 28 May 2019 00:15:14 +0000 (20:15 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:24:13 +0000 (12:24 +0200)
commit 63923d2c3800919774f5c651d503d1dd2adaddd5 upstream.

We only support I/O to kernel space. Using %sr1 to load the coherence
index may be racy unless interrupts are disabled. This patch changes the
code used to load the coherence index to use implicit space register
selection. This saves one instruction and eliminates the race.

Tested on rp3440, c8000 and c3750.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/parisc/ccio-dma.c
drivers/parisc/sba_iommu.c

index 34f1d6b41fb9069f826d8bfad35cf69cf15a88ac..cc3708ea8084af7aa4bed6459731302fbfc6c9c1 100644 (file)
@@ -563,8 +563,6 @@ ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
        /* We currently only support kernel addresses */
        BUG_ON(sid != KERNEL_SPACE);
 
-       mtsp(sid,1);
-
        /*
        ** WORD 1 - low order word
        ** "hints" parm includes the VALID bit!
@@ -595,7 +593,7 @@ ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
        ** Grab virtual index [0:11]
        ** Deposit virt_idx bits into I/O PDIR word
        */
-       asm volatile ("lci %%r0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba));
+       asm volatile ("lci %%r0(%1), %0" : "=r" (ci) : "r" (vba));
        asm volatile ("extru %1,19,12,%0" : "+r" (ci) : "r" (ci));
        asm volatile ("depw  %1,15,12,%0" : "+r" (pa) : "r" (ci));
 
index d6326144ce01e1d1eed7c399914f1005f6624faf..f3b9746157f81bda07364e0683cee2b86a252ab3 100644 (file)
@@ -573,8 +573,7 @@ sba_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
        pa = virt_to_phys(vba);
        pa &= IOVP_MASK;
 
-       mtsp(sid,1);
-       asm("lci 0(%%sr1, %1), %0" : "=r" (ci) : "r" (vba));
+       asm("lci 0(%1), %0" : "=r" (ci) : "r" (vba));
        pa |= (ci >> PAGE_SHIFT) & 0xff;  /* move CI (8 bits) into lowest byte */
 
        pa |= SBA_PDIR_VALID_BIT;       /* set "valid" bit */