Skip to contentSkip to conversation

powerpc/powernv/pci: remove dead code from !CONFIG_EEH

PATCH In review Nick Desaulniers 6 participants 8 messages Apr 22, 2021 – Jun 6, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/powernv/pci: remove dead code from !CONFIG_EEH

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled.

---
 arch/powerpc/platforms/powernv/pci.c | 7 -------
 1 file changed, 7 deletions(-)
arch/powerpc/platforms/powernv/pci.c +0 -7
index 9b9bca169275..591480a37b05 100644
@@ -711,7 +711,6 @@ int pnv_pci_cfg_write(struct pci_dn *pdn,
 	return PCIBIOS_SUCCESSFUL;
 }
 
-#if CONFIG_EEH
 static bool pnv_pci_cfg_check(struct pci_dn *pdn)
 {
 	struct eeh_dev *edev = NULL;
@@ -734,12 +733,6 @@ static bool pnv_pci_cfg_check(struct pci_dn *pdn)
 
 	return true;
 }
-#else
-static inline pnv_pci_cfg_check(struct pci_dn *pdn)
-{
-	return true;
-}
-#endif /* CONFIG_EEH */
 
 static int pnv_pci_read_config(struct pci_bus *bus,
 			       unsigned int devfn,

base-commit: 16fc44d6387e260f4932e9248b985837324705d8
prerequisite-patch-id: 950233069fb22099a8ff8990f620f5c3586a3cbd

Signature · 1 line
2.31.1.498.g6c1eba8ee3d-goog
#1 lore raw

Hi Nick,

Quoted 4 lines

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled.

This seemed odd to me, but I think you're right:

arch/powerpc/platforms/Kconfig contains:

config EEH

	bool
	depends on (PPC_POWERNV || PPC_PSERIES) && PCI
	default y

It's not configurable from e.g. make menuconfig because there's no prompt. You can attempt to explicitly disable it with e.g. scripts/config -d EEH but then something like make oldconfig will silently re-enable it for you.

It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") in 2012 which fixed it for pseries. That moved out from pseries to pseries + powernv later on.

There are other cleanups in the same vein that could be made, from the Makefile (which has files only built with CONFIG_EEH) through to other source files. It looks like there's one #ifdef CONFIG_EEH in arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for example.

I think it's probably worth trying to rip out all of those in one patch?

Kind regards,
Daniel

#2 lore raw
Quoted 26 lines · Daniel Axtens

Hi Nick,

Quoted 4 lines

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled.

This seemed odd to me, but I think you're right:

arch/powerpc/platforms/Kconfig contains:

config EEH

        bool
        depends on (PPC_POWERNV || PPC_PSERIES) && PCI
        default y

It's not configurable from e.g. make menuconfig because there's no prompt. You can attempt to explicitly disable it with e.g. scripts/config -d EEH but then something like make oldconfig will silently re-enable it for you.

It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") in 2012 which fixed it for pseries. That moved out from pseries to pseries + powernv later on.

Quoted 7 lines

There are other cleanups in the same vein that could be made, from the Makefile (which has files only built with CONFIG_EEH) through to other source files. It looks like there's one #ifdef CONFIG_EEH in arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for example.

I think it's probably worth trying to rip out all of those in one patch?

The change in commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") never should have been made.

There's no inherent reason why EEH needs to be enabled and forcing it on is (IMO) a large part of why EEH support is the byzantine clusterfuck that it is. One of the things I was working towards was allowing pseries and powernv to be built with !CONFIG_EEH since that would help define a clearer boundary between what is "eeh support" and what is required to support PCI on the platform. Pseries is particularly bad for this since PAPR says the RTAS calls needed to do a PCI bus reset are part of the EEH extension, but there's non-EEH reasons why you might want to use those RTAS calls. The PHB reset that we do when entering a kdump kernel is a good example since that uses the same RTAS calls, but it has nothing to do with the EEH recovery machinery enabled by CONFIG_EEH.

I was looking into that largely because people were considering using OPAL for microwatt platforms. Breaking the assumption that powernv==EEH support is one of the few bits of work required to enable that, but even if you don't go down that road I think everyone would be better off if you kept a degree of separation between the two.

#3 lore raw
Quoted 34 lines · Oliver O'Halloran
Quoted 32 lines · Daniel Axtens

Hi Nick,

Quoted 4 lines

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled.

This seemed odd to me, but I think you're right:

arch/powerpc/platforms/Kconfig contains:

config EEH

        bool
        depends on (PPC_POWERNV || PPC_PSERIES) && PCI
        default y

It's not configurable from e.g. make menuconfig because there's no prompt. You can attempt to explicitly disable it with e.g. scripts/config -d EEH but then something like make oldconfig will silently re-enable it for you.

It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") in 2012 which fixed it for pseries. That moved out from pseries to pseries + powernv later on.

There are other cleanups in the same vein that could be made, from the Makefile (which has files only built with CONFIG_EEH) through to other source files. It looks like there's one #ifdef CONFIG_EEH in arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for example.

Quoted 4 lines
Quoted 1 line

I think it's probably worth trying to rip out all of those in one patch?

The change in commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") never should have been made.

I'll change my patch to keep the conditionals, but use #ifdef instead of #if then?

Quoted 19 lines

There's no inherent reason why EEH needs to be enabled and forcing it on is (IMO) a large part of why EEH support is the byzantine clusterfuck that it is. One of the things I was working towards was allowing pseries and powernv to be built with !CONFIG_EEH since that would help define a clearer boundary between what is "eeh support" and what is required to support PCI on the platform. Pseries is particularly bad for this since PAPR says the RTAS calls needed to do a PCI bus reset are part of the EEH extension, but there's non-EEH reasons why you might want to use those RTAS calls. The PHB reset that we do when entering a kdump kernel is a good example since that uses the same RTAS calls, but it has nothing to do with the EEH recovery machinery enabled by CONFIG_EEH.

I was looking into that largely because people were considering using OPAL for microwatt platforms. Breaking the assumption that powernv==EEH support is one of the few bits of work required to enable that, but even if you don't go down that road I think everyone would be better off if you kept a degree of separation between the two.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#4 lore raw
Quoted 35 lines · Nick Desaulniers
Quoted 34 lines · Oliver O'Halloran
Quoted 32 lines · Daniel Axtens

Hi Nick,

Quoted 4 lines

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled.

This seemed odd to me, but I think you're right:

arch/powerpc/platforms/Kconfig contains:

config EEH

        bool
        depends on (PPC_POWERNV || PPC_PSERIES) && PCI
        default y

It's not configurable from e.g. make menuconfig because there's no prompt. You can attempt to explicitly disable it with e.g. scripts/config -d EEH but then something like make oldconfig will silently re-enable it for you.

It's been forced on since commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") in 2012 which fixed it for pseries. That moved out from pseries to pseries + powernv later on.

There are other cleanups in the same vein that could be made, from the Makefile (which has files only built with CONFIG_EEH) through to other source files. It looks like there's one #ifdef CONFIG_EEH in arch/powerpc/platforms/powernv/pci-ioda.c that could be pulled out, for example.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I think it's probably worth trying to rip out all of those in one patch?

The change in commit e49f7a9997c6 ("powerpc/pseries: Rivet CONFIG_EEH for pSeries platform") never should have been made.

I'll change my patch to keep the conditionals, but use #ifdef instead of #if then?

Yeah, please.

I'm not sure I agree with oohal that untangling pseries/powernv from EEH is something we should do, but let's kick that can down the road by just fixing up the ifdef.

cheers

#5 lore raw

PATCH v2 1/1 powerpc/powernv/pci: fix header guard

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH.

It seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled, but based on upstream discussion, it's not clear yet that CONFIG_EEH should be enabled by default.

For now, simply fix the -Wundef warning.

---
 arch/powerpc/platforms/powernv/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/pci.c +1 -1
index b18468dc31ff..6bb3c52633fb 100644
@@ -711,7 +711,7 @@ int pnv_pci_cfg_write(struct pci_dn *pdn,
 	return PCIBIOS_SUCCESSFUL;
 }
 
-#if CONFIG_EEH
+#ifdef CONFIG_EEH
 static bool pnv_pci_cfg_check(struct pci_dn *pdn)
 {
 	struct eeh_dev *edev = NULL;
Signature · 1 line
2.31.1.751.gd2f1c929bd-goog
Reviewed-by on v2 1/1
#6 lore raw

Re: [PATCH v2] powerpc/powernv/pci: fix header guard

Quoted 7 lines · Nick Desaulniers

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH.

It seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled, but based on upstream discussion, it's not clear yet that CONFIG_EEH should be enabled by default.

Quoted 8 lines

For now, simply fix the -Wundef warning.

Makes sense, thanks for the patch!

Quoted 18 lines
---
  arch/powerpc/platforms/powernv/pci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/pci.c +1 -1
index b18468dc31ff..6bb3c52633fb 100644
@@ -711,7 +711,7 @@ int pnv_pci_cfg_write(struct pci_dn *pdn,
  	return PCIBIOS_SUCCESSFUL;
  }
 
-#if CONFIG_EEH
+#ifdef CONFIG_EEH
  static bool pnv_pci_cfg_check(struct pci_dn *pdn)
  {
  	struct eeh_dev *edev = NULL;
#7 lore raw

Re: [PATCH v2] powerpc/powernv/pci: fix header guard

In reply to Nick Desaulniers
Quoted 8 lines · Nick Desaulniers

While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH.

It seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled, but based on upstream discussion, it's not clear yet that CONFIG_EEH should be enabled by default.

[...]

Applied to powerpc/next.

[1/1] powerpc/powernv/pci: fix header guard

      https://git.kernel.org/powerpc/c/73e6e4e01134c9ee97433ad1f470c71b0748b08f

cheers