Skip to content

Commit

Permalink
parisc: Use implicit space register selection for loading the coheren…
Browse files Browse the repository at this point in the history
…ce index of I/O pdirs

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 <[email protected]>
Cc: [email protected]
Signed-off-by: Helge Deller <[email protected]>
  • Loading branch information
danglin44 authored and hdeller committed Jun 6, 2019
1 parent 6b98d91 commit 63923d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions drivers/parisc/ccio-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,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!
Expand Down Expand Up @@ -597,7 +595,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));

Expand Down
3 changes: 1 addition & 2 deletions drivers/parisc/sba_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,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 */
Expand Down

0 comments on commit 63923d2

Please sign in to comment.