Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/powernv/vas: Assign real address to rx_fifo in vas_rx_win_attr

In init_winctx_regs(), __pa() is called on winctx->rx_fifo and this
function is called to initialize registers for receive and fault
windows. But the real address is passed in winctx->rx_fifo for
receive windows and the virtual address for fault windows which
causes errors with DEBUG_VIRTUAL enabled. Fixes this issue by
assigning only real address to rx_fifo in vas_rx_win_attr struct
for both receive and fault windows.

Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/338e958c7ab8f3b266fa794a1f80f99b9671829e.camel@linux.ibm.com

authored by

Haren Myneni and committed by
Michael Ellerman
c127d130 6bdc81ec

+6 -6
+1 -1
arch/powerpc/include/asm/vas.h
··· 126 126 * Receive window attributes specified by the (in-kernel) owner of window. 127 127 */ 128 128 struct vas_rx_win_attr { 129 - void *rx_fifo; 129 + u64 rx_fifo; 130 130 int rx_fifo_size; 131 131 int wcreds_max; 132 132
+1 -1
arch/powerpc/platforms/powernv/vas-fault.c
··· 216 216 vas_init_rx_win_attr(&attr, VAS_COP_TYPE_FAULT); 217 217 218 218 attr.rx_fifo_size = vinst->fault_fifo_size; 219 - attr.rx_fifo = vinst->fault_fifo; 219 + attr.rx_fifo = __pa(vinst->fault_fifo); 220 220 221 221 /* 222 222 * Max creds is based on number of CRBs can fit in the FIFO.
+2 -2
arch/powerpc/platforms/powernv/vas-window.c
··· 404 404 * 405 405 * See also: Design note in function header. 406 406 */ 407 - val = __pa(winctx->rx_fifo); 407 + val = winctx->rx_fifo; 408 408 val = SET_FIELD(VAS_PAGE_MIGRATION_SELECT, val, 0); 409 409 write_hvwc_reg(window, VREG(LFIFO_BAR), val); 410 410 ··· 739 739 */ 740 740 winctx->fifo_disable = true; 741 741 winctx->intr_disable = true; 742 - winctx->rx_fifo = NULL; 742 + winctx->rx_fifo = 0; 743 743 } 744 744 745 745 winctx->lnotify_lpid = rxattr->lnotify_lpid;
+1 -1
arch/powerpc/platforms/powernv/vas.h
··· 376 376 * is a container for the register fields in the window context. 377 377 */ 378 378 struct vas_winctx { 379 - void *rx_fifo; 379 + u64 rx_fifo; 380 380 int rx_fifo_size; 381 381 int wcreds_max; 382 382 int rsvd_txbuf_count;
+1 -1
drivers/crypto/nx/nx-common-powernv.c
··· 827 827 goto err_out; 828 828 829 829 vas_init_rx_win_attr(&rxattr, coproc->ct); 830 - rxattr.rx_fifo = (void *)rx_fifo; 830 + rxattr.rx_fifo = rx_fifo; 831 831 rxattr.rx_fifo_size = fifo_size; 832 832 rxattr.lnotify_lpid = lpid; 833 833 rxattr.lnotify_pid = pid;