2022-09-28 12:30:22

by Pali Rohár

[permalink] [raw]
Subject: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
accessing PCI config space.

Signed-off-by: Pali Rohár <[email protected]>
---
drivers/pci/controller/pci-ixp4xx.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/pci-ixp4xx.c b/drivers/pci/controller/pci-ixp4xx.c
index 654ac4a82beb..c83b5ae0b017 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -188,12 +188,13 @@ static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where)
/* Root bus is always 0 in this hardware */
if (bus_num == 0) {
/* type 0 */
- return BIT(32-PCI_SLOT(devfn)) | ((PCI_FUNC(devfn)) << 8) |
- (where & ~3);
+ return (PCI_CONF1_ADDRESS(0, 0, PCI_FUNC(devfn), where) &
+ ~PCI_CONF1_ENABLE) | BIT(32-PCI_SLOT(devfn));
} else {
/* type 1 */
- return (bus_num << 16) | ((PCI_SLOT(devfn)) << 11) |
- ((PCI_FUNC(devfn)) << 8) | (where & ~3) | 1;
+ return (PCI_CONF1_ADDRESS(bus_num, PCI_SLOT(devfn),
+ PCI_FUNC(devfn), where) &
+ ~PCI_CONF1_ENABLE) | 1;
}
}

--
2.20.1


2022-09-29 02:33:25

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

Hi Pali,

I love your patch! Yet something to improve:

[auto build test ERROR on helgaas-pci/next]
[also build test ERROR on linus/master v6.0-rc7 next-20220928]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Pali-Roh-r/PCI-ixp4xx-Use-PCI_CONF1_ADDRESS-macro/20220928-202711
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-allyesconfig
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/956a10e13aa1668f4daae22166ba8da017da9eba
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Pali-Roh-r/PCI-ixp4xx-Use-PCI_CONF1_ADDRESS-macro/20220928-202711
git checkout 956a10e13aa1668f4daae22166ba8da017da9eba
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/pci/controller/pci-ixp4xx.c: In function 'ixp4xx_config_addr':
>> drivers/pci/controller/pci-ixp4xx.c:191:25: error: implicit declaration of function 'PCI_CONF1_ADDRESS'; did you mean 'PCI_ROM_ADDRESS'? [-Werror=implicit-function-declaration]
191 | return (PCI_CONF1_ADDRESS(0, 0, PCI_FUNC(devfn), where) &
| ^~~~~~~~~~~~~~~~~
| PCI_ROM_ADDRESS
>> drivers/pci/controller/pci-ixp4xx.c:192:26: error: 'PCI_CONF1_ENABLE' undeclared (first use in this function); did you mean 'PCI_EA_ENABLE'?
192 | ~PCI_CONF1_ENABLE) | BIT(32-PCI_SLOT(devfn));
| ^~~~~~~~~~~~~~~~
| PCI_EA_ENABLE
drivers/pci/controller/pci-ixp4xx.c:192:26: note: each undeclared identifier is reported only once for each function it appears in
drivers/pci/controller/pci-ixp4xx.c:199:1: error: control reaches end of non-void function [-Werror=return-type]
199 | }
| ^
cc1: some warnings being treated as errors


vim +191 drivers/pci/controller/pci-ixp4xx.c

185
186 static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where)
187 {
188 /* Root bus is always 0 in this hardware */
189 if (bus_num == 0) {
190 /* type 0 */
> 191 return (PCI_CONF1_ADDRESS(0, 0, PCI_FUNC(devfn), where) &
> 192 ~PCI_CONF1_ENABLE) | BIT(32-PCI_SLOT(devfn));
193 } else {
194 /* type 1 */
195 return (PCI_CONF1_ADDRESS(bus_num, PCI_SLOT(devfn),
196 PCI_FUNC(devfn), where) &
197 ~PCI_CONF1_ENABLE) | 1;
198 }
199 }
200

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (3.21 kB)
config (365.25 kB)
Download all attachments

2022-10-04 08:09:48

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <[email protected]> wrote:

> Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> accessing PCI config space.
>
> Signed-off-by: Pali Rohár <[email protected]>

I have no way to evaluate this change in my head, once the kernel test robot is
happy I can test the patch on IXP4xx.

Yours,
Linus Walleij

2022-10-04 09:21:16

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

On Tuesday 04 October 2022 09:56:18 Linus Walleij wrote:
> On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <[email protected]> wrote:
>
> > Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> > accessing PCI config space.
> >
> > Signed-off-by: Pali Rohár <[email protected]>
>
> I have no way to evaluate this change in my head, once the kernel test robot is
> happy I can test the patch on IXP4xx.
>
> Yours,
> Linus Walleij

You just need to apply this change on Lorenzo's pci tree. Or wait until
Lorenzo's changes are propagated into master tree and then robot should
be happy.

2023-03-10 13:57:56

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

On Tue, Oct 04, 2022 at 09:56:18AM +0200, Linus Walleij wrote:
> On Wed, Sep 28, 2022 at 2:25 PM Pali Roh?r <[email protected]> wrote:
>
> > Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> > accessing PCI config space.
> >
> > Signed-off-by: Pali Roh?r <[email protected]>
>
> I have no way to evaluate this change in my head, once the kernel test robot is
> happy I can test the patch on IXP4xx.

If you can manage to test it I can go ahead and merge it.

Thanks,
Lorenzo

> Yours,
> Linus Walleij

2023-03-10 22:38:27

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <[email protected]> wrote:

> Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> accessing PCI config space.
>
> Signed-off-by: Pali Rohár <[email protected]>

This does not compile right off (on kernel v6.3-rc1), I had to add this:

diff --git a/drivers/pci/controller/pci-ixp4xx.c
b/drivers/pci/controller/pci-ixp4xx.c
index c83b5ae0b017..e44252db6085 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -26,6 +26,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/bits.h>
+#include "../pci.h"

/* Register offsets */
#define IXP4XX_PCI_NP_AD 0x00

After this it compiles, boots and mounts root on a PCI-USB-connected
rootfs, so it seems to work fine!
Tested-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2023-03-10 22:39:09

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

On Fri, Mar 10, 2023 at 2:57 PM Lorenzo Pieralisi <[email protected]> wrote:
> On Tue, Oct 04, 2022 at 09:56:18AM +0200, Linus Walleij wrote:
> > On Wed, Sep 28, 2022 at 2:25 PM Pali Rohár <[email protected]> wrote:
> >
> > > Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> > > accessing PCI config space.
> > >
> > > Signed-off-by: Pali Rohár <[email protected]>
> >
> > I have no way to evaluate this change in my head, once the kernel test robot is
> > happy I can test the patch on IXP4xx.
>
> If you can manage to test it I can go ahead and merge it.

I managed to test it with a oneliner to add the right include on top
of v6.3-rc1.

Yours,
Linus Walleij

2023-03-24 16:00:03

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro

On Wed, 28 Sep 2022 14:25:39 +0200, Pali Rohár wrote:
> Simplify pci-ixp4xx.c driver code and use new PCI_CONF1_ADDRESS() macro for
> accessing PCI config space.
>
>

Applied to controller/ixp4xx, thanks!

[1/1] PCI: ixp4xx: Use PCI_CONF1_ADDRESS() macro
https://git.kernel.org/pci/pci/c/6c6fa1f3f771

Thanks,
Lorenzo