[Skiboot] [PATCH v2 1/2] npu2: Print bdfn in NPU2DEV* logging macros

Reza Arbab arbab at linux.vnet.ibm.com
Wed Nov 22 10:42:45 AEDT 2017


Revise the NPU2DEV{DBG,INF,ERR} logging macros to include the device's
bdfn. It's useful to know exactly which link we're referring to.

For instance, instead of
  [  234.044921238,6] NPU6: Starting procedure reset_ntl
  [  234.048578101,6] NPU6: Starting procedure reset_ntl
  [  234.051049676,6] NPU6: Starting procedure reset_ntl
  [  234.053503542,6] NPU6: Starting procedure reset_ntl
  [  234.057182864,6] NPU6: Starting procedure reset_ntl
  [  234.059666137,6] NPU6: Starting procedure reset_ntl

we'll get
  [  234.044921238,6] NPU6:0:0.0 Starting procedure reset_ntl
  [  234.048578101,6] NPU6:0:0.1 Starting procedure reset_ntl
  [  234.051049676,6] NPU6:0:0.2 Starting procedure reset_ntl
  [  234.053503542,6] NPU6:0:1.0 Starting procedure reset_ntl
  [  234.057182864,6] NPU6:0:1.1 Starting procedure reset_ntl
  [  234.059666137,6] NPU6:0:1.2 Starting procedure reset_ntl

Signed-off-by: Reza Arbab <arbab at linux.vnet.ibm.com>
---
 include/npu2.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/npu2.h b/include/npu2.h
index 9563869..fa078df 100644
--- a/include/npu2.h
+++ b/include/npu2.h
@@ -27,9 +27,14 @@
 #define NPU2ERR(p, fmt, a...)	prlog(PR_ERR,   "NPU%d: " fmt, \
 				      (p)->phb.opal_id, ##a)
 
-#define NPU2DEVDBG(p, fmt, a...)	NPU2DBG((p)->npu, fmt, ##a)
-#define NPU2DEVINF(p, fmt, a...)	NPU2INF((p)->npu, fmt, ##a)
-#define NPU2DEVERR(p, fmt, a...)	NPU2ERR((p)->npu, fmt, ##a)
+#define NPU2DEVLOG(l, p, fmt, a...)	prlog(l, "NPU%d:%d:%d.%d " fmt, \
+					      (p)->npu->phb.opal_id, \
+					      ((p)->bdfn >> 8) & 0xff, \
+					      ((p)->bdfn >> 3) & 0x1f, \
+					      (p)->bdfn & 0x7, ##a)
+#define NPU2DEVDBG(p, fmt, a...)	NPU2DEVLOG(PR_DEBUG, p, fmt, ##a)
+#define NPU2DEVINF(p, fmt, a...)	NPU2DEVLOG(PR_INFO, p, fmt, ##a)
+#define NPU2DEVERR(p, fmt, a...)	NPU2DEVLOG(PR_ERR, p, fmt, ##a)
 
 /* Number of PEs supported */
 #define NPU2_MAX_PE_NUM		16
-- 
1.8.3.1



More information about the Skiboot mailing list