Skip to contentSkip to conversation

pseries: asm/pci-bridge.h CONFIG_ minor cleanup

PATCH In review Linas Vepstas 2 participants 6 messages May 21, 2007 – May 23, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pseries: asm/pci-bridge.h CONFIG_ minor cleanup

Use the correct CONFIG_ option to mark off the EEH bits. Move the EEH bits to the bottom of the struct.

----

 include/asm-powerpc/pci-bridge.h |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
include/asm-powerpc/pci-bridge.h +8 -7
Index: linux-2.6.22-rc1/include/asm-powerpc/pci-bridge.h
===================================================================
@@ -70,19 +70,20 @@ struct pci_dn {
 	int	devfn;			/* pci device and function number */
 	int	class_code;		/* pci device class */
 
-#ifdef CONFIG_PPC_PSERIES
-	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
-	int	eeh_config_addr;
-	int	eeh_pe_config_addr; /* new-style partition endpoint address */
-	int 	eeh_check_count;	/* # times driver ignored error */
-	int 	eeh_freeze_count;	/* # times this device froze up. */
-#endif
 	int	pci_ext_config_space;	/* for pci devices */
 	struct  pci_controller *phb;	/* for pci devices */
 	struct	iommu_table *iommu_table;	/* for phb's or bridges */
 	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
 	struct	device_node *node;	/* back-pointer to the device_node */
+
+#ifdef CONFIG_EEH
+	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
+	int	eeh_config_addr;
+	int	eeh_pe_config_addr; /* new-style partition endpoint address */
+	int 	eeh_check_count;	/* # times driver ignored error */
+	int 	eeh_freeze_count;	/* # times this device froze up. */
 	u32	config_space[16];	/* saved PCI config space */
+#endif
 };
 
 /* Get the pointer to a device_node's pci_dn */
#1 lore raw
Quoted 14 lines · Linas Vepstas

Use the correct CONFIG_ option to mark off the EEH bits. Move the EEH bits to the bottom of the struct.

----

 include/asm-powerpc/pci-bridge.h |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: linux-2.6.22-rc1/include/asm-powerpc/pci-bridge.h
===================================================================

include/asm-powerpc/pci-bridge.h struct pci_dn { · line 79

Quoted 10 lines
include/asm-powerpc/pci-bridge.h +0 -7
@@ -70,19 +70,20 @@ struct pci_dn {
 	int	devfn;			/* pci device and function number */
 	int	class_code;		/* pci device class */
 
-#ifdef CONFIG_PPC_PSERIES
-	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
-	int	eeh_config_addr;
-	int	eeh_pe_config_addr; /* new-style partition endpoint address */
-	int 	eeh_check_count;	/* # times driver ignored error */
-	int 	eeh_freeze_count;	/* # times this device froze up. */
-#endif

You're making the struct 4 bytes larger by creating a hole here :(

Quoted 4 lines
include/asm-powerpc/pci-bridge.h +0 -0
 	int	pci_ext_config_space;	/* for pci devices */
 	struct  pci_controller *phb;	/* for pci devices */
 	struct	iommu_table *iommu_table;	/* for phb's or bridges */
 	struct	pci_dev *pcidev;	/* back-pointer to the pci device */

include/asm-powerpc/pci-bridge.h struct pci_dn { · line 86

Quoted 10 lines
include/asm-powerpc/pci-bridge.h +8 -0
 	struct	device_node *node;	/* back-pointer to the device_node */
+
+#ifdef CONFIG_EEH
+	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
+	int	eeh_config_addr;
+	int	eeh_pe_config_addr; /* new-style partition endpoint address */
+	int 	eeh_check_count;	/* # times driver ignored error */
+	int 	eeh_freeze_count;	/* # times this device froze up. */
 	u32	config_space[16];	/* saved PCI config space */
+#endif

It looks correct, but I think it's worth mentioning in the changelog that config_space was previously unconditionally defined, but is now within CONFIG_EEH.

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#2 lore raw
Quoted 4 lines · Michael Ellerman
Quoted 1 line · Linas Vepstas

Use the correct CONFIG_ option to mark off the EEH bits.

You're making the struct 4 bytes larger by creating a hole here :(

Hmm. Perhaps I could shuffle one of the ints down ...

I figured there might be some vague cache-line benefits to getting the eeh stuff out of the way.

Quoted 6 lines

include/asm-powerpc/pci-bridge.h struct pci_dn { · line 86

Quoted 2 lines
include/asm-powerpc/pci-bridge.h +1 -0
 	u32	config_space[16];	/* saved PCI config space */
+#endif

It looks correct, but I think it's worth mentioning in the changelog that config_space was previously unconditionally defined, but is now within CONFIG_EEH.

I could just tell that someone would remark on this; why I didn't mention it, I don't know.

--linas

#3 lore raw

PATCH 1/1 (revised) pseries: asm/pci-bridge.h CONFIG_ minor cleanup

Use the correct CONFIG_ option to mark off the EEH bits. Move the EEH bits to the bottom of the struct. The config_space array is used by EEH only; it does not need to be part of the struct for non-pseries machines.

----
Revised patch, per commments from Michael Ellerman.

 include/asm-powerpc/pci-bridge.h |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
include/asm-powerpc/pci-bridge.h +9 -7
Index: linux-2.6.22-rc1/include/asm-powerpc/pci-bridge.h
===================================================================
@@ -70,19 +70,21 @@ struct pci_dn {
 	int	devfn;			/* pci device and function number */
 	int	class_code;		/* pci device class */
 
-#ifdef CONFIG_PPC_PSERIES
+	struct  pci_controller *phb;	/* for pci devices */
+	struct	iommu_table *iommu_table;	/* for phb's or bridges */
+	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
+	struct	device_node *node;	/* back-pointer to the device_node */
+
+	int	pci_ext_config_space;	/* for pci devices */
+
+#ifdef CONFIG_EEH
 	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
 	int	eeh_config_addr;
 	int	eeh_pe_config_addr; /* new-style partition endpoint address */
 	int 	eeh_check_count;	/* # times driver ignored error */
 	int 	eeh_freeze_count;	/* # times this device froze up. */
-#endif
-	int	pci_ext_config_space;	/* for pci devices */
-	struct  pci_controller *phb;	/* for pci devices */
-	struct	iommu_table *iommu_table;	/* for phb's or bridges */
-	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
-	struct	device_node *node;	/* back-pointer to the device_node */
 	u32	config_space[16];	/* saved PCI config space */
+#endif
 };
 
 /* Get the pointer to a device_node's pci_dn */
#4 lore raw
In reply to Linas Vepstas
Quoted 10 lines · Linas Vepstas
Quoted 4 lines · Michael Ellerman
Quoted 1 line · Linas Vepstas

Use the correct CONFIG_ option to mark off the EEH bits.

You're making the struct 4 bytes larger by creating a hole here :(

Hmm. Perhaps I could shuffle one of the ints down ...

I figured there might be some vague cache-line benefits to getting the eeh stuff out of the way.

Yeah who knows. The hole doesn't really matter unless the struct gets bigger, having the EEH stuff at the bottom makes it read better which is probably more important.

Quoted 9 lines
Quoted 6 lines

include/asm-powerpc/pci-bridge.h struct pci_dn { · line 86

Quoted 2 lines
include/asm-powerpc/pci-bridge.h +1 -0
 	u32	config_space[16];	/* saved PCI config space */
+#endif

It looks correct, but I think it's worth mentioning in the changelog that config_space was previously unconditionally defined, but is now within CONFIG_EEH.

I could just tell that someone would remark on this; why I didn't mention it, I don't know.

Me neither :)

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#5 lore raw
Quoted 4 lines · Michael Ellerman

Yeah who knows. The hole doesn't really matter unless the struct gets bigger, having the EEH stuff at the bottom makes it read better which is probably more important.

Havin become proficient at adding hex addrs in my head, I have also come to appreciate structs which have all the important/hot stuff at the top, instead of large filler holes that one has to skip over during debugging.

--linas