[PATCH 10/14] powerpc/vas: Print CRB and FIFO values

Haren Myneni haren at linux.vnet.ibm.com
Wed Nov 27 12:12: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 dd27649..ad594c8 100644
--- a/arch/powerpc/platforms/powernv/vas-fault.c
+++ b/arch/powerpc/platforms/powernv/vas-fault.c
@@ -36,6 +36,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));
+}
+
 static void notify_process(pid_t pid, u64 fault_addr)
 {
 	int rc;
@@ -154,6 +175,23 @@ static void update_csb(struct vas_window *window,
 	}
 }
 
+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.
  */
@@ -211,6 +249,7 @@ static void process_fault_crbs(struct vas_instance *vinst)
 				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)) {
@@ -220,6 +259,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, vinst->fault_fifo, fifo,
 				crb_nx_pswid(crb), vinst->fault_crbs,
-- 
1.8.3.1





More information about the Linuxppc-dev mailing list