[RFC PATCH 08/13] powerpc/vas: Print CRB and FIFO values

Haren Myneni haren at linux.vnet.ibm.com
Sat Oct 19 16:58:21 AEDT 2019


Dump FIFO values if could not find send window and print CRB for
debugging.

Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
Signed-off-by: Haren Myneni <haren at us.ibm.com>
---
 arch/powerpc/platforms/powernv/vas-fault.c | 40 ++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/vas-fault.c b/arch/powerpc/platforms/powernv/vas-fault.c
index 7aacce9..1ce85b5 100644
--- a/arch/powerpc/platforms/powernv/vas-fault.c
+++ b/arch/powerpc/platforms/powernv/vas-fault.c
@@ -39,6 +39,27 @@ void vas_wakeup_fault_handler(int virq, void *arg)
 	wake_up(&vinst->fault_wq);
 }
 
+static void dump_crb(struct coprocessor_request_block *crb)
+{
+	struct data_descriptor_entry *dde;
+	struct nx_fault_stamp *nx;
+
+	dde = &crb->source;
+	pr_devel("SrcDDE: addr 0x%llx, len %d, count %d, idx %d, flags %d\n",
+		be64_to_cpu(dde->address), be32_to_cpu(dde->length),
+		dde->count, dde->index, dde->flags);
+
+	dde = &crb->target;
+	pr_devel("TgtDDE: addr 0x%llx, len %d, count %d, idx %d, flags %d\n",
+		be64_to_cpu(dde->address), be32_to_cpu(dde->length),
+		dde->count, dde->index, dde->flags);
+
+	nx = &crb->stamp.nx;
+	pr_devel("NX Stamp: PSWID 0x%x, FSA 0x%llx, flags 0x%x, FS 0x%x\n",
+		be32_to_cpu(nx->pswid), crb_nx_fault_addr(crb),
+		nx->flags, be32_to_cpu(nx->fault_status));
+}
+
 /*
  * Check if the fault occurred in the CSB itself. Return true if so, false
  */
@@ -153,6 +174,23 @@ static void update_csb(int pid, struct coprocessor_request_block *crb)
 	notify_process(pid, crb_nx_fault_addr(crb));
 }
 
+static void dump_fifo(struct vas_instance *vinst)
+{
+	int i;
+	unsigned long *fifo = vinst->fault_fifo;
+
+	pr_err("Fault fifo size %d, max crbs %d, crb size %lu\n",
+			vinst->fault_fifo_size,
+			vinst->fault_fifo_size / CRB_SIZE,
+			sizeof(struct coprocessor_request_block));
+
+	pr_err("Fault FIFO Dump:\n");
+	for (i = 0; i < 64; i+=4, fifo+=4) {
+		pr_err("[%.3d, %p]: 0x%.16lx 0x%.16lx 0x%.16lx 0x%.16lx\n",
+			i, fifo, *fifo, *(fifo+1), *(fifo+2), *(fifo+3));
+	}
+}
+
 /*
  * Process CRBs that we receive on the fault window.
  */
@@ -210,6 +248,7 @@ static void process_fault_crbs(struct vas_instance *vinst)
 				vinst->fault_fifo, fifo, vinst->fault_crbs,
 				atomic_read(&vinst->pending_fault));
 
+		dump_crb(crb);
 		window = vas_pswid_to_window(vinst, crb_nx_pswid(crb));
 
 		if (IS_ERR(window)) {
@@ -219,6 +258,7 @@ static void process_fault_crbs(struct vas_instance *vinst)
 			 * even clean it up (return credit).
 			 * But we should not get here.
 			 */
+			dump_fifo(vinst);
 			pr_err("VAS[%d] fault_fifo %p, fifo %p, pswid 0x%x, "
 				"fault_crbs %d, pending %d bad CRB?\n",
 				vinst->vas_id,
-- 
1.8.3.1





More information about the Linuxppc-dev mailing list