Skip to contentSkip to conversation

raw/ntb: add PPD status check for SPR

PATCH Superseded Junfeng Guo 3 participants 4 messages Jun 30, 2022 – Jul 5, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 raw/ntb: add PPD status check for SPR

Add PPD (PCIe Port Definition) status check for SPR (Sapphire Rapids).

Note that NTB on SPR has the same device id with that on ICX, while the field offsets of PPD Control Register are different. Here, we use the PCI device revision id to distinguish the HW platform (ICX/SPR) and check the Port Config Status and Port Definition accordingly.

+---------------------------+--------------------+--------------------+
|          Fields           | Bit Range (on ICX) | Bit Range (on SPR) |
+---------------------------+--------------------+--------------------+
| Port Configuration Status | 12                 | 14                 |
| Port Definition           | 9:8                | 10:8               |
+---------------------------+--------------------+--------------------+
---
 drivers/raw/ntb/ntb.h          |  1 +
 drivers/raw/ntb/ntb_hw_intel.c | 60 ++++++++++++++++++++++++++++++----
 drivers/raw/ntb/ntb_hw_intel.h | 13 ++++++++
 3 files changed, 68 insertions(+), 6 deletions(-)
drivers/raw/ntb/ntb.h +1 -0
index c9ff33aa59..a30a6b60c9 100644
@@ -19,6 +19,7 @@ extern int ntb_logtype;
 /* Device IDs */
 #define NTB_INTEL_DEV_ID_B2B_SKX    0x201C
 #define NTB_INTEL_DEV_ID_B2B_ICX    0x347E
+#define NTB_INTEL_DEV_ID_B2B_SPR    0x347E
 
 /* Reserved to app to use. */
 #define NTB_SPAD_USER               "spad_user_"
drivers/raw/ntb/ntb_hw_intel.c +54 -6

79 lines not on this page · raw message

drivers/raw/ntb/ntb_hw_intel.h +13 -0
index c61a2a8a62..9587104f80 100644
@@ -5,6 +5,13 @@
 #ifndef _NTB_HW_INTEL_H_
 #define _NTB_HW_INTEL_H_
 
+/* Supported PCI device revision ID range for ICX */
+#define NTB_PCI_DEV_REVISION_ICX_MIN	0x02
+#define NTB_PCI_DEV_REVISION_ICX_MAX	0x0F
+
+#define NTB_PCI_DEV_REVISION_ID_REG	0x08
+#define NTB_PCI_DEV_REVISION_ID_LEN	1
+
 /* Ntb control and link status */
 #define NTB_CTL_CFG_LOCK		1
 #define NTB_CTL_DISABLE			2
@@ -90,6 +97,12 @@
 #define XEON_GEN4_SLOTSTS		0xb05a
 #define XEON_GEN4_SLOTSTS_DLLSCS	0x100
 
+#define XEON_SPR_PPD_CONN_MASK		0x0700
+#define XEON_SPR_PPD_CONN_B2B		0x0200
+#define XEON_SPR_PPD_DEV_MASK		0x4000
+#define XEON_SPR_PPD_DEV_DSD		0x4000
+#define XEON_SPR_PPD_DEV_USD		0x0000
+
 #define XEON_MW_COUNT			2
 
 #define XEON_DB_COUNT			32
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 raw/ntb: add PPD status check for SPR

Add PPD (PCIe Port Definition) status check for SPR (Sapphire Rapids).

Note that NTB on SPR has the same device id with that on ICX, while the field offsets of PPD Control Register are different. Here, we use the PCI device revision id to distinguish the HW platform (ICX/SPR) and check the Port Config Status and Port Definition accordingly.

+---------------------------+--------------------+--------------------+
|          Fields           | Bit Range (on ICX) | Bit Range (on SPR) |
+---------------------------+--------------------+--------------------+
| Port Configuration Status | 12                 | 14                 |
| Port Definition           | 9:8                | 10:8               |
+---------------------------+--------------------+--------------------+

v2:
fix revision id value check logic.

---
 drivers/raw/ntb/ntb.h          |  1 +
 drivers/raw/ntb/ntb_hw_intel.c | 64 ++++++++++++++++++++++++++++++----
 drivers/raw/ntb/ntb_hw_intel.h | 13 +++++++
 3 files changed, 72 insertions(+), 6 deletions(-)
drivers/raw/ntb/ntb.h +1 -0
index c9ff33aa59..a30a6b60c9 100644
@@ -19,6 +19,7 @@ extern int ntb_logtype;
 /* Device IDs */
 #define NTB_INTEL_DEV_ID_B2B_SKX    0x201C
 #define NTB_INTEL_DEV_ID_B2B_ICX    0x347E
+#define NTB_INTEL_DEV_ID_B2B_SPR    0x347E
 
 /* Reserved to app to use. */
 #define NTB_SPAD_USER               "spad_user_"
drivers/raw/ntb/ntb_hw_intel.c +58 -6

83 lines not on this page · raw message

drivers/raw/ntb/ntb_hw_intel.h +13 -0
index c61a2a8a62..9587104f80 100644
@@ -5,6 +5,13 @@
 #ifndef _NTB_HW_INTEL_H_
 #define _NTB_HW_INTEL_H_
 
+/* Supported PCI device revision ID range for ICX */
+#define NTB_PCI_DEV_REVISION_ICX_MIN	0x02
+#define NTB_PCI_DEV_REVISION_ICX_MAX	0x0F
+
+#define NTB_PCI_DEV_REVISION_ID_REG	0x08
+#define NTB_PCI_DEV_REVISION_ID_LEN	1
+
 /* Ntb control and link status */
 #define NTB_CTL_CFG_LOCK		1
 #define NTB_CTL_DISABLE			2
@@ -90,6 +97,12 @@
 #define XEON_GEN4_SLOTSTS		0xb05a
 #define XEON_GEN4_SLOTSTS_DLLSCS	0x100
 
+#define XEON_SPR_PPD_CONN_MASK		0x0700
+#define XEON_SPR_PPD_CONN_B2B		0x0200
+#define XEON_SPR_PPD_DEV_MASK		0x4000
+#define XEON_SPR_PPD_DEV_DSD		0x4000
+#define XEON_SPR_PPD_DEV_USD		0x0000
+
 #define XEON_MW_COUNT			2
 
 #define XEON_DB_COUNT			32
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#2 lore raw
Quoted 23 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, June 30, 2022 4:56 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; Guo, Junfeng <[email protected]>
Subject: [PATCH v2] raw/ntb: add PPD status check for SPR

Add PPD (PCIe Port Definition) status check for SPR (Sapphire Rapids).

Note that NTB on SPR has the same device id with that on ICX, while the field offsets of PPD Control Register are different. Here, we use the PCI device revision id to distinguish the HW platform (ICX/SPR) and check the Port Config Status and Port Definition accordingly.

+---------------------------+--------------------+--------------------+
|          Fields           | Bit Range (on ICX) | Bit Range (on SPR) |
+---------------------------+--------------------+--------------------+
| Port Configuration Status | 12                 | 14                 |
| Port Definition           | 9:8                | 10:8               |
+---------------------------+--------------------+--------------------+
Quoted 4 lines

v2:
fix revision id value check logic.

#3 lore raw
Quoted 14 lines
Quoted 14 lines

Add PPD (PCIe Port Definition) status check for SPR (Sapphire Rapids).

Note that NTB on SPR has the same device id with that on ICX, while the field offsets of PPD Control Register are different. Here, we use the PCI device revision id to distinguish the HW platform (ICX/SPR) and check the Port Config Status and Port Definition accordingly.

+---------------------------+--------------------+--------------------+
|          Fields           | Bit Range (on ICX) | Bit Range (on SPR) |
+---------------------------+--------------------+--------------------+
| Port Configuration Status | 12                 | 14                 |
| Port Definition           | 9:8                | 10:8               |
+---------------------------+--------------------+--------------------+
Quoted 5 lines
Quoted 4 lines

v2:
fix revision id value check logic.

Not sure it is urgent, anyway
Applied, thanks.