powerpc/vas: Report proper error code for address translation failure
authorHaren Myneni <haren@linux.ibm.com>
Fri, 10 Jul 2020 23:47:19 +0000 (16:47 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 15 Jul 2020 13:09:55 +0000 (23:09 +1000)
P9 DD2 NX workbook (Table 4-36) says DMA controller uses CC=5
internally for translation fault handling. NX reserves CC=250 for
OS to notify user space when NX encounters address translation
failure on the request buffer. Not an issue in earlier releases
as NX does not get faults on kernel addresses.

This patch defines CSB_CC_FAULT_ADDRESS(250) and updates CSB.CC with
this proper error code for user space.

Fixes: c96c4436aba4 ("powerpc/vas: Update CSB and notify process for fault CRBs")
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
[mpe: Added Fixes tag and fix typo in comment]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/019fd53e7538c6f8f332d175df74b1815ef5aa8c.camel@linux.ibm.com
Documentation/powerpc/vas-api.rst
arch/powerpc/include/asm/icswx.h
arch/powerpc/platforms/powernv/vas-fault.c

index 1217c2f1595e8c3c9bfcf568f545ab129dcb6682..788dc8375a0e444ac5928712565421aaa81922ac 100644 (file)
@@ -213,7 +213,7 @@ request buffers are not in memory. The operating system handles the fault by
 updating CSB with the following data:
 
        csb.flags = CSB_V;
-       csb.cc = CSB_CC_TRANSLATION;
+       csb.cc = CSB_CC_FAULT_ADDRESS;
        csb.ce = CSB_CE_TERMINATION;
        csb.address = fault_address;
 
index 965b1f39b2a5f6dccc38ef299a0cd17fd9b51c42..b0c70a35fd0edbd96b14ff7e320a1b357ec5d410 100644 (file)
@@ -77,6 +77,8 @@ struct coprocessor_completion_block {
 #define CSB_CC_CHAIN           (37)
 #define CSB_CC_SEQUENCE                (38)
 #define CSB_CC_HW              (39)
+/* P9 DD2 NX Workbook 3.2 (Table 4-36): Address translation fault */
+#define        CSB_CC_FAULT_ADDRESS    (250)
 
 #define CSB_SIZE               (0x10)
 #define CSB_ALIGN              CSB_SIZE
index 266a6ca5e15e678e8f042f3d30787fdb0e2aead1..3d21fce254b741c3b7bb52edcea631108d42aa9c 100644 (file)
@@ -79,7 +79,7 @@ static void update_csb(struct vas_window *window,
        csb_addr = (void __user *)be64_to_cpu(crb->csb_addr);
 
        memset(&csb, 0, sizeof(csb));
-       csb.cc = CSB_CC_TRANSLATION;
+       csb.cc = CSB_CC_FAULT_ADDRESS;
        csb.ce = CSB_CE_TERMINATION;
        csb.cs = 0;
        csb.count = 0;