Skip to contentSkip to conversation

powernv/pci: Print an error when device enable is blocked

PATCH Applied Oliver O'Halloran 3 participants 4 messages Apr 9, 2020 – Dec 10, 2020 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powernv/pci: Print an error when device enable is blocked

If the platform decides to block enabling the device nothing is printed currently. This can lead to some confusion since the dmesg output will usually print an error with no context e.g.

	e1000e: probe of 0022:01:00.0 failed with error -22

This shouldn't be spammy since pci_enable_device() already prints a messages when it succeeds.

---
 arch/powerpc/platforms/powernv/pci-ioda.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/powernv/pci-ioda.c +3 -1
index cda0933..17fdf46 100644
@@ -3296,8 +3296,10 @@ static bool pnv_pci_enable_device_hook(struct pci_dev *dev)
 		return true;
 
 	pdn = pci_get_pdn(dev);
-	if (!pdn || pdn->pe_number == IODA_INVALID_PE)
+	if (!pdn || pdn->pe_number == IODA_INVALID_PE) {
+		pci_err("pci_enable_device() blocked, no PE assigned.\n");
 		return false;
+	}
 
 	return true;
 }
Signature · 1 line
2.9.5
#1 lore raw
Quoted 20 lines · Oliver O'Halloran

If the platform decides to block enabling the device nothing is printed currently. This can lead to some confusion since the dmesg output will usually print an error with no context e.g.

        e1000e: probe of 0022:01:00.0 failed with error -22

This shouldn't be spammy since pci_enable_device() already prints a messages when it succeeds.

---
 arch/powerpc/platforms/powernv/pci-ioda.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/powernv/pci-ioda.c +0 -0
index cda0933..17fdf46 100644

arch/powerpc/platforms/powernv/pci-ioda.c static bool pnv_pci_enable_device_hook(struct pci_dev *dev) · line 3300

Quoted 6 lines
arch/powerpc/platforms/powernv/pci-ioda.c +2 -1
@@ -3296,8 +3296,10 @@ static bool pnv_pci_enable_device_hook(struct pci_dev *dev)
                return true;
 
        pdn = pci_get_pdn(dev);
-       if (!pdn || pdn->pe_number == IODA_INVALID_PE)
+       if (!pdn || pdn->pe_number == IODA_INVALID_PE) {
+               pci_err("pci_enable_device() blocked, no PE assigned.\n");

Maybe I should start compiling my code before I sent it out. Maybe.

Quoted 8 lines
arch/powerpc/platforms/powernv/pci-ioda.c +1 -1
                return false;
+       }
 
        return true;
 }
--

2.9.5

#2 lore raw
In reply to Oliver O'Halloran
I love your patch! Yet something to improve:

Hi Oliver,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v5.6 next-20200409]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Oliver-O-Halloran/powernv-pci-Print-an-error-when-device-enable-is-blocked/20200409-144145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allmodconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

arch/powerpc/platforms/powernv/pci-ioda.c: In function 'pnv_pci_enable_device_hook':

>> arch/powerpc/platforms/powernv/pci-ioda.c:3446:59: error: macro "pci_err" requires 3 arguments, but only 1 given
    3446 |   pci_err("pci_enable_device() blocked, no PE assigned.\n");
         |                                                           ^
   In file included from arch/powerpc/platforms/powernv/pci-ioda.c:11:
   include/linux/pci.h:2380: note: macro "pci_err" defined here
    2380 | #define pci_err(pdev, fmt, arg...) dev_err(&(pdev)->dev, fmt, ##arg)
         | 
>> arch/powerpc/platforms/powernv/pci-ioda.c:3446:3: error: 'pci_err' undeclared (first use in this function)
    3446 |   pci_err("pci_enable_device() blocked, no PE assigned.\n");
         |   ^~~~~~~

arch/powerpc/platforms/powernv/pci-ioda.c:3446:3: note: each undeclared identifier is reported only once for each function it appears in

vim +/pci_err +3446 arch/powerpc/platforms/powernv/pci-ioda.c

3426
3427 /* Prevent enabling devices for which we couldn't properly
3428 * assign a PE
3429 */
3430 static bool pnv_pci_enable_device_hook(struct pci_dev *dev)
3431 {
3432 struct pci_controller *hose = pci_bus_to_host(dev->bus);
3433 struct pnv_phb *phb = hose->private_data;
3434 struct pci_dn *pdn;
3435
3436 /* The function is probably called while the PEs have
3437 * not be created yet. For example, resource reassignment
3438 * during PCI probe period. We just skip the check if
3439 * PEs isn't ready.
3440 */
3441 if (!phb->initialized)
3442 return true;
3443
3444 pdn = pci_get_pdn(dev);
3445 if (!pdn || pdn->pe_number == IODA_INVALID_PE) {

> 3446			pci_err("pci_enable_device() blocked, no PE assigned.\n");

3447 return false;
3448 }
3449
3450 return true;
3451 }
3452

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw
In reply to Oliver O'Halloran
Quoted 8 lines · Oliver O'Halloran

If the platform decides to block enabling the device nothing is printed currently. This can lead to some confusion since the dmesg output will usually print an error with no context e.g.

	e1000e: probe of 0022:01:00.0 failed with error -22

This shouldn't be spammy since pci_enable_device() already prints a messages when it succeeds.

Applied to powerpc/next.

[1/1] powernv/pci: Print an error when device enable is blocked

      https://git.kernel.org/powerpc/c/6c58b1b41b19c00099e4771ee55e21eb9aa245c1

cheers