Skip to contentSkip to conversation

pciutils: Add decode support for Data Object Exchange Extended Capability

PATCH Superseded Jonathan Cameron 2 participants 2 messages Jan 18, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pciutils: Add decode support for Data Object Exchange Extended Capability

PCI Data Object Exchange [1] provides a mailbox interface used as the transport for various protocols defined by PCI-SIG and others. Make the limited information in config space available. Note the Read/Write Mailbox registers themselves are not currently parsed as the usefulness of accessing one dword of a protocol is probably limited.

In future, operating systems may provide means to safely query the supported protocols, but those have not yet been defined.

Example output:

Capabilities: [190 v1] Data Object Exchange
DOECap: IntSup:+
Interrupt Message Number: 001
DOECtl: IntEn:-
DOESta: Busy:- IntSta:- Error:- ObjectReady:-

[1] Data Object Exchange (DOE) ECN, approved 12 March 2020

---

 lib/header.h  |  15 +++
 ls-ecaps.c    |  38 +++++++
 tests/cap-doe | 302 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 355 insertions(+)
lib/header.h +15 -0
index d4b40aa..85414bc 100644
@@ -252,6 +252,7 @@
 #define PCI_EXT_CAP_ID_LMR	0x27	/* Lane Margining at Receiver */
 #define PCI_EXT_CAP_ID_HIER_ID	0x28	/* Hierarchy ID */
 #define PCI_EXT_CAP_ID_NPEM	0x29	/* Native PCIe Enclosure Management */
+#define PCI_EXT_CAP_ID_DOE	0x2e	/* Data Object Exchange */
 
 /*** Definitions of capabilities ***/
 
@@ -1253,6 +1254,20 @@
 #define  PCI_L1PM_SUBSTAT_CTL1_ASPM_L11	0x8	/* ASPM L1.1 Enable */
 #define PCI_L1PM_SUBSTAT_CTL2	0xC	/* L1 PM Substate Control 2 */
 
+/* Data Object Exchange Extended Capability */
+#define PCI_DOE_CAP		0x4	/* DOE Capabilities Register */
+#define  PCI_DOE_CAP_INT_SUPP		0x1	/* Interrupt Support */
+#define  PCI_DOE_CAP_INT_MSG(x) (((x) >> 1) & 0x7ff) /* DOE Interrupt Message Number */
+#define PCI_DOE_CTL		0x8	/* DOE Control Register */
+#define  PCI_DOE_CTL_ABORT		0x1	/* DOE Abort */
+#define  PCI_DOE_CTL_INT		0x2	/* DOE Interrupt Enable */
+#define  PCI_DOE_CTL_GO			0x80000000 /* DOE Go */
+#define PCI_DOE_STS		0xC	/* DOE Status Register */
+#define  PCI_DOE_STS_BUSY		0x1	/* DOE Busy */
+#define  PCI_DOE_STS_INT		0x2	/* DOE Interrupt Status */
+#define  PCI_DOE_STS_ERROR		0x3	/* DOE Error */
+#define  PCI_DOE_STS_OBJECT_READY	0x80000000 /* Data Object Ready */
+
 /*
  * The PCI interface treats multi-function devices as independent
  * devices.  The slot/function address of each device is encoded
ls-ecaps.c +38 -0
index 99c55ff..dd328c3 100644
@@ -992,6 +992,41 @@ cap_rebar(struct device *d, int where, int virtual)
     }
 }
 
+static void
+cap_doe(struct device *d, int where)
+{
+  u32 l;
+
+  printf("Data Object Exchange\n");
+
+  if (verbose < 2)
+    return;
+
+  if (!config_fetch(d, where + PCI_DOE_CAP, 0x14))
+    {
+      printf("\t\t<unreadable>\n");
+      return;
+    }
+
+  l = get_conf_long(d, where + PCI_DOE_CAP);
+  printf("\t\tDOECap: IntSup:%c\n",
+	 FLAG(l, PCI_DOE_CAP_INT_SUPP));
+  if (l & PCI_DOE_CAP_INT_SUPP)
+    printf("\t\t\tInterrupt Message Number: %03x\n",
+	   PCI_DOE_CAP_INT_MSG(l));
+
+  l = get_conf_long(d, where + PCI_DOE_CTL);
+  printf("\t\tDOECtl: IntEn:%c\n",
+	 FLAG(l, PCI_DOE_CTL_INT));
+
+  l = get_conf_long(d, where + PCI_DOE_STS);
+  printf("\t\tDOESta: Busy:%c IntSta:%c Error:%c ObjectReady:%c\n",
+	 FLAG(l, PCI_DOE_STS_BUSY),
+	 FLAG(l, PCI_DOE_STS_INT),
+	 FLAG(l, PCI_DOE_STS_ERROR),
+	 FLAG(l, PCI_DOE_STS_OBJECT_READY));
+}
+
 void
 show_ext_caps(struct device *d, int type)
 {
@@ -1139,6 +1174,9 @@ show_ext_caps(struct device *d, int type)
 	  case PCI_EXT_CAP_ID_NPEM:
 	    printf("Native PCIe Enclosure Management <?>\n");
 	    break;
+	  case PCI_EXT_CAP_ID_DOE:
+	    cap_doe(d, where);
+	    break;
 	  default:
 	    printf("Extended Capability ID %#02x\n", id);
 	    break;
tests/cap-doe new file +302 -0

302 lines not on this page · raw message

Signature · 1 line
2.19.1
#1 lore raw
Quoted 9 lines · Jonathan Cameron

PCI Data Object Exchange [1] provides a mailbox interface used as the transport for various protocols defined by PCI-SIG and others. Make the limited information in config space available. Note the Read/Write Mailbox registers themselves are not currently parsed as the usefulness of accessing one dword of a protocol is probably limited.

In future, operating systems may provide means to safely query the supported protocols, but those have not yet been defined.

Quoted 7 lines

Example output:

Capabilities: [190 v1] Data Object Exchange
DOECap: IntSup:+
Interrupt Message Number: 001
DOECtl: IntEn:-
DOESta: Busy:- IntSta:- Error:- ObjectReady:-

Typical lspci output omits the ":" for each field, e.g., from your test:

Quoted 4 lines
tests/cap-doe new file +2 -0
+             DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq-
+                     RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-

[1] Data Object Exchange (DOE) ECN, approved 12 March 2020

DOE is included in the just-released PCIe r6.0 base spec, so we should cite that (PCIe r6.0, sec 6.30, 7.9.24).

Bjorn