Skip to contentSkip to conversation

PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros

PATCH In review Pali Rohár 2 participants 5 messages Apr 12, 2021 – Apr 14, 2021 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Add PCI_EXP_DEVCTL_PAYLOAD_* macros

Define new PCI_EXP_DEVCTL_PAYLOAD_* macros in linux/pci_regs.h header file for Max Payload Size. Macros are defined in the same style as existing macros PCI_EXP_DEVCTL_READRQ_* macros.

---
 include/uapi/linux/pci_regs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +6 -0
index e709ae8235e7..8f1b15eea53e 100644
@@ -504,6 +504,12 @@
 #define  PCI_EXP_DEVCTL_URRE	0x0008	/* Unsupported Request Reporting En. */
 #define  PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
 #define  PCI_EXP_DEVCTL_PAYLOAD	0x00e0	/* Max_Payload_Size */
+#define  PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00A0 /* 4096 Bytes */
 #define  PCI_EXP_DEVCTL_EXT_TAG	0x0100	/* Extended Tag Field Enable */
 #define  PCI_EXP_DEVCTL_PHANTOM	0x0200	/* Phantom Functions Enable */
 #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
Signature · 1 line
2.20.1
#1 lore raw
Quoted 14 lines · Pali Rohár

Define new PCI_EXP_DEVCTL_PAYLOAD_* macros in linux/pci_regs.h header file for Max Payload Size. Macros are defined in the same style as existing macros PCI_EXP_DEVCTL_READRQ_* macros.

---
 include/uapi/linux/pci_regs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +0 -0
index e709ae8235e7..8f1b15eea53e 100644

include/uapi/linux/pci_regs.h line 512

Quoted 9 lines
include/uapi/linux/pci_regs.h +6 -0
@@ -504,6 +504,12 @@
 #define  PCI_EXP_DEVCTL_URRE	0x0008	/* Unsupported Request Reporting En. */
 #define  PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
 #define  PCI_EXP_DEVCTL_PAYLOAD	0x00e0	/* Max_Payload_Size */
+#define  PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00A0 /* 4096 Bytes */

This is fine if we're going to use them, but we generally don't add definitions purely for documentation.

5929b8a38ce0 ("PCI: Add defines for PCIe Max_Read_Request_Size") added the PCI_EXP_DEVCTL_READRQ_* definitions and we do have a few (very few) uses in drivers.

If we do need to add these, please follow the local use of lower-case in the hex bitmasks. The file is a mixture, but the closest examples are lower-case.

Quoted 6 lines
include/uapi/linux/pci_regs.h +0 -0
 #define  PCI_EXP_DEVCTL_EXT_TAG	0x0100	/* Extended Tag Field Enable */
 #define  PCI_EXP_DEVCTL_PHANTOM	0x0200	/* Phantom Functions Enable */
 #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
Signature · 1 line
2.20.1
#2 lore raw
Quoted 28 lines · On Monday 12 April 2021 14:27:40 Bjorn Helgaas wrote:
Quoted 14 lines · Pali Rohár

Define new PCI_EXP_DEVCTL_PAYLOAD_* macros in linux/pci_regs.h header file for Max Payload Size. Macros are defined in the same style as existing macros PCI_EXP_DEVCTL_READRQ_* macros.

---
 include/uapi/linux/pci_regs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +0 -0
index e709ae8235e7..8f1b15eea53e 100644

include/uapi/linux/pci_regs.h line 512

Quoted 9 lines
include/uapi/linux/pci_regs.h +6 -0
@@ -504,6 +504,12 @@
 #define  PCI_EXP_DEVCTL_URRE	0x0008	/* Unsupported Request Reporting En. */
 #define  PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
 #define  PCI_EXP_DEVCTL_PAYLOAD	0x00e0	/* Max_Payload_Size */
+#define  PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00A0 /* 4096 Bytes */

This is fine if we're going to use them, but we generally don't add definitions purely for documentation.

Quoted 3 lines

5929b8a38ce0 ("PCI: Add defines for PCIe Max_Read_Request_Size") added the PCI_EXP_DEVCTL_READRQ_* definitions and we do have a few (very few) uses in drivers.

I'm planning to use this constant to fix pci-aardvark.c driver. Aardvark changes are not ready yet, but I'm preparing them in my git tree
https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark
(commit PCI: aardvark: Fix PCIe Max Payload Size setting)

But as this is not change in aardvark driver, I sent it separately and earlier. As it would be dependency for aardvark changes.

Quoted 3 lines

If we do need to add these, please follow the local use of lower-case in the hex bitmasks. The file is a mixture, but the closest examples are lower-case.

Ok, therefore I will change 0x00A0 to 0x00a0.

Quoted 6 lines
Quoted 6 lines
include/uapi/linux/pci_regs.h +0 -0
 #define  PCI_EXP_DEVCTL_EXT_TAG	0x0100	/* Extended Tag Field Enable */
 #define  PCI_EXP_DEVCTL_PHANTOM	0x0200	/* Phantom Functions Enable */
 #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
Signature · 1 line
2.20.1
#3 lore raw
Quoted 33 lines · Pali Rohár
Quoted 28 lines · On Monday 12 April 2021 14:27:40 Bjorn Helgaas wrote:
Quoted 14 lines · Pali Rohár

Define new PCI_EXP_DEVCTL_PAYLOAD_* macros in linux/pci_regs.h header file for Max Payload Size. Macros are defined in the same style as existing macros PCI_EXP_DEVCTL_READRQ_* macros.

---
 include/uapi/linux/pci_regs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +0 -0
index e709ae8235e7..8f1b15eea53e 100644

include/uapi/linux/pci_regs.h line 512

Quoted 9 lines
include/uapi/linux/pci_regs.h +6 -0
@@ -504,6 +504,12 @@
 #define  PCI_EXP_DEVCTL_URRE	0x0008	/* Unsupported Request Reporting En. */
 #define  PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
 #define  PCI_EXP_DEVCTL_PAYLOAD	0x00e0	/* Max_Payload_Size */
+#define  PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00A0 /* 4096 Bytes */

This is fine if we're going to use them, but we generally don't add definitions purely for documentation.

Quoted 3 lines

5929b8a38ce0 ("PCI: Add defines for PCIe Max_Read_Request_Size") added the PCI_EXP_DEVCTL_READRQ_* definitions and we do have a few (very few) uses in drivers.

Quoted 7 lines

I'm planning to use this constant to fix pci-aardvark.c driver. Aardvark changes are not ready yet, but I'm preparing them in my git tree
https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark
(commit PCI: aardvark: Fix PCIe Max Payload Size setting)

But as this is not change in aardvark driver, I sent it separately and earlier. As it would be dependency for aardvark changes.

OK, just include this in that series.

Bjorn

#4 lore raw
Quoted 39 lines · On Wednesday 14 April 2021 15:23:09 Bjorn Helgaas wrote:
Quoted 38 lines · Pali Rohár
Quoted 28 lines · On Monday 12 April 2021 14:27:40 Bjorn Helgaas wrote:
Quoted 14 lines · Pali Rohár

Define new PCI_EXP_DEVCTL_PAYLOAD_* macros in linux/pci_regs.h header file for Max Payload Size. Macros are defined in the same style as existing macros PCI_EXP_DEVCTL_READRQ_* macros.

---
 include/uapi/linux/pci_regs.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/pci_regs.h +0 -0
index e709ae8235e7..8f1b15eea53e 100644

include/uapi/linux/pci_regs.h line 512

Quoted 9 lines
include/uapi/linux/pci_regs.h +6 -0
@@ -504,6 +504,12 @@
 #define  PCI_EXP_DEVCTL_URRE	0x0008	/* Unsupported Request Reporting En. */
 #define  PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
 #define  PCI_EXP_DEVCTL_PAYLOAD	0x00e0	/* Max_Payload_Size */
+#define  PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
+#define  PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00A0 /* 4096 Bytes */

This is fine if we're going to use them, but we generally don't add definitions purely for documentation.

Quoted 3 lines

5929b8a38ce0 ("PCI: Add defines for PCIe Max_Read_Request_Size") added the PCI_EXP_DEVCTL_READRQ_* definitions and we do have a few (very few) uses in drivers.

I'm planning to use this constant to fix pci-aardvark.c driver. Aardvark changes are not ready yet, but I'm preparing them in my git tree
https://git.kernel.org/pub/scm/linux/kernel/git/pali/linux.git/log/?h=pci-aardvark
(commit PCI: aardvark: Fix PCIe Max Payload Size setting)

Quoted 4 lines
Quoted 2 lines

But as this is not change in aardvark driver, I sent it separately and earlier. As it would be dependency for aardvark changes.

OK, just include this in that series.

Ok, fine.