Skip to contentSkip to conversation

PCI: Add defines for max read requests sizes

PATCH In review Rafał Miłecki 2 participants 4 messages Jan 26, 2015 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Add defines for max read requests sizes

There are few drivers using magic numbers when operating with PCIe capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow cleaning their code a bit.

---
Hi,

I'm new to the PCI subsystem, so let me know if there is anything wrong with my patch. I hope you find these bits worth defining and that my coding style matches rest of the file.

---
 include/uapi/linux/pci_regs.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/pci_regs.h +4 -0
index 4a1d0cc..efe3443 100644
@@ -451,6 +451,10 @@
 #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
 #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
 #define  PCI_EXP_DEVCTL_READRQ	0x7000	/* Max_Read_Request_Size */
+#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
 #define PCI_EXP_DEVSTA		10	/* Device Status */
 #define  PCI_EXP_DEVSTA_CED	0x0001	/* Correctable Error Detected */
Signature · 1 line
1.8.4.5
maintainer
#1 lore raw
Quoted 20 lines · Rafał Miłecki

There are few drivers using magic numbers when operating with PCIe capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow cleaning their code a bit.

---
Hi,

I'm new to the PCI subsystem, so let me know if there is anything wrong with my patch. I hope you find these bits worth defining and that my coding style matches rest of the file.

---
 include/uapi/linux/pci_regs.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/pci_regs.h +0 -0
index 4a1d0cc..efe3443 100644

include/uapi/linux/pci_regs.h line 460

Quoted 10 lines
include/uapi/linux/pci_regs.h +4 -0
@@ -451,6 +451,10 @@
 #define  PCI_EXP_DEVCTL_AUX_PME        0x0400  /* Auxiliary Power PM Enable */
 #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
 #define  PCI_EXP_DEVCTL_READRQ 0x7000  /* Max_Read_Request_Size */
+#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
 #define PCI_EXP_DEVSTA         10      /* Device Status */
 #define  PCI_EXP_DEVSTA_CED    0x0001  /* Correctable Error Detected */

This seems reasonable. Can you include patches for the drivers to actually use these new symbols? It's ideal if we can do them at the same time because we try to avoid adding new symbols unless they're going to actually be used.

Bjorn

#2 lore raw
Quoted 28 lines · Bjorn Helgaas
Quoted 27 lines · Rafał Miłecki

There are few drivers using magic numbers when operating with PCIe capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow cleaning their code a bit.

---
Hi,

I'm new to the PCI subsystem, so let me know if there is anything wrong with my patch. I hope you find these bits worth defining and that my coding style matches rest of the file.

---
 include/uapi/linux/pci_regs.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/pci_regs.h +4 -0
index 4a1d0cc..efe3443 100644
@@ -451,6 +451,10 @@
 #define  PCI_EXP_DEVCTL_AUX_PME        0x0400  /* Auxiliary Power PM Enable */
 #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
 #define  PCI_EXP_DEVCTL_READRQ 0x7000  /* Max_Read_Request_Size */
+#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
Quoted 8 lines

include/uapi/linux/pci_regs.h line 460

Quoted 3 lines
include/uapi/linux/pci_regs.h +0 -0
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
 #define PCI_EXP_DEVSTA         10      /* Device Status */
 #define  PCI_EXP_DEVSTA_CED    0x0001  /* Correctable Error Detected */

This seems reasonable. Can you include patches for the drivers to actually use these new symbols? It's ideal if we can do them at the same time because we try to avoid adding new symbols unless they're going to actually be used.

Sure, but how to send them? Could the go through your (PCI) tree?

Signature · 1 line
Rafał
maintainer
#3 lore raw
Quoted 38 lines · Rafał Miłecki
Quoted 28 lines · Bjorn Helgaas
Quoted 27 lines · Rafał Miłecki

There are few drivers using magic numbers when operating with PCIe capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow cleaning their code a bit.

---
Hi,

I'm new to the PCI subsystem, so let me know if there is anything wrong with my patch. I hope you find these bits worth defining and that my coding style matches rest of the file.

---
 include/uapi/linux/pci_regs.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/pci_regs.h +4 -0
index 4a1d0cc..efe3443 100644
@@ -451,6 +451,10 @@
 #define  PCI_EXP_DEVCTL_AUX_PME        0x0400  /* Auxiliary Power PM Enable */
 #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
 #define  PCI_EXP_DEVCTL_READRQ 0x7000  /* Max_Read_Request_Size */
+#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
Quoted 8 lines

include/uapi/linux/pci_regs.h line 460

Quoted 3 lines
include/uapi/linux/pci_regs.h +0 -0
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
 #define PCI_EXP_DEVSTA         10      /* Device Status */
 #define  PCI_EXP_DEVSTA_CED    0x0001  /* Correctable Error Detected */

This seems reasonable. Can you include patches for the drivers to actually use these new symbols? It's ideal if we can do them at the same time because we try to avoid adding new symbols unless they're going to actually be used.

Quoted 1 line

Sure, but how to send them? Could the go through your (PCI) tree?

I think so. Something like is probably trivial, obviously-correct patches, and we can probably get acks from the driver maintainers, then merge them all at once via my tree.

Bjorn