From 5f56c674e449f5707147f977888ef80debf4cde7 Mon Sep 17 00:00:00 2001 From: Nithin Dabilpuram Date: Fri, 1 Oct 2021 19:10:03 +0530 Subject: [PATCH] common/cnxk: dump CPT LF registers on error interrupt Dump CPT LF registers on error interrupt for debugging purpose. Signed-off-by: Nithin Dabilpuram Acked-by: Jerin Jacob --- drivers/common/cnxk/roc_cpt.c | 5 ++++- drivers/common/cnxk/roc_cpt_debug.c | 32 +++++++++++++++++++++++++++-- drivers/common/cnxk/roc_cpt_priv.h | 1 + 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index 48a378b7f5..6ddbaa2e22 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -51,6 +51,9 @@ cpt_lf_misc_irq(void *param) plt_err("Err_irq=0x%" PRIx64 " pf=%d, vf=%d", intr, dev->pf, dev->vf); + /* Dump lf registers */ + cpt_lf_print(lf); + /* Clear interrupt */ plt_write64(intr, lf->rbase + CPT_LF_MISC_INT); } @@ -203,7 +206,7 @@ cpt_lf_dump(struct roc_cpt_lf *lf) plt_cpt_dbg("CPT LF REG:"); plt_cpt_dbg("LF_CTL[0x%016llx]: 0x%016" PRIx64, CPT_LF_CTL, plt_read64(lf->rbase + CPT_LF_CTL)); - plt_cpt_dbg("Q_SIZE[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG, + plt_cpt_dbg("LF_INPROG[0x%016llx]: 0x%016" PRIx64, CPT_LF_INPROG, plt_read64(lf->rbase + CPT_LF_INPROG)); plt_cpt_dbg("Q_BASE[0x%016llx]: 0x%016" PRIx64, CPT_LF_Q_BASE, diff --git a/drivers/common/cnxk/roc_cpt_debug.c b/drivers/common/cnxk/roc_cpt_debug.c index a6c9004cb1..847d969268 100644 --- a/drivers/common/cnxk/roc_cpt_debug.c +++ b/drivers/common/cnxk/roc_cpt_debug.c @@ -157,11 +157,40 @@ roc_cpt_afs_print(struct roc_cpt *roc_cpt) return 0; } -static void +void cpt_lf_print(struct roc_cpt_lf *lf) { uint64_t reg_val; + reg_val = plt_read64(lf->rbase + CPT_LF_Q_BASE); + plt_print(" CPT_LF_Q_BASE:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_Q_SIZE); + plt_print(" CPT_LF_Q_SIZE:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_Q_INST_PTR); + plt_print(" CPT_LF_Q_INST_PTR:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR); + plt_print(" CPT_LF_Q_GRP_PTR:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_CTL); + plt_print(" CPT_LF_CTL:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT_ENA_W1S); + plt_print(" CPT_LF_MISC_INT_ENA_W1S:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_MISC_INT); + plt_print(" CPT_LF_MISC_INT:\t%016lx", reg_val); + + reg_val = plt_read64(lf->rbase + CPT_LF_INPROG); + plt_print(" CPT_LF_INPROG:\t%016lx", reg_val); + + if (roc_model_is_cn9k()) + return; + + plt_print("Count registers for CPT LF%d:", lf->lf_id); + reg_val = plt_read64(lf->rbase + CPT_LF_CTX_ENC_BYTE_CNT); plt_print(" Encrypted byte count:\t%" PRIu64, reg_val); @@ -190,7 +219,6 @@ roc_cpt_lfs_print(struct roc_cpt *roc_cpt) if (lf == NULL) continue; - plt_print("Count registers for CPT LF%d:", lf_id); cpt_lf_print(lf); } diff --git a/drivers/common/cnxk/roc_cpt_priv.h b/drivers/common/cnxk/roc_cpt_priv.h index 21911e5d79..61dec9a168 100644 --- a/drivers/common/cnxk/roc_cpt_priv.h +++ b/drivers/common/cnxk/roc_cpt_priv.h @@ -31,5 +31,6 @@ int cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func, uint8_t lf_id, bool ena); int cpt_get_msix_offset(struct dev *dev, struct msix_offset_rsp **msix_rsp); uint64_t cpt_get_blkaddr(struct dev *dev); +void cpt_lf_print(struct roc_cpt_lf *lf); #endif /* _ROC_CPT_PRIV_H_ */ -- 2.20.1