ACK/Cmnt: [PATCH][Hirsute] PCI: xgene: Fix cfg resource mapping

dann frazier dann.frazier at canonical.com
Fri Apr 9 16:53:07 UTC 2021


On Fri, Apr 9, 2021 at 5:42 AM Tim Gardner <tim.gardner at canonical.com> wrote:
>
> Acked-by: Tim Gardner <tim.gardner at canonical.com>
>
> It looks like we'll get this fix from upstream stable which should take
> precedence over this patch. In the meantime, its simple, self contained,
> and only impacts the one driver.

Yeah, I waited to submit hoping it might land in mainline at least
first, but ran up against kernel freeze.

> Dann - has upstream root caused why
> devm_platform_ioremap_resource_byname() can't figure out that the
> resource is a memory BAR ? This seems like its a pattern likely used in
> other PCI drivers.

If they did, I didn't see that explanation on the list.

  -dann

> rtg
>
> On 4/8/21 3:36 PM, dann frazier wrote:
> > From: Dejin Zheng <zhengdejin5 at gmail.com>
> >
> > BugLink: https://bugs.launchpad.net/bugs/1918793
> >
> > In commit e2dcd20b1645 a change was made to use
> > devm_platform_ioremap_resource_byname() to simplify code and remove
> > the res variable; this was wrong since the res variable is still needed
> > and as an outcome the port->cfg_addr gets an erroneous address.
> >
> > Revert the change going back to original behaviour.
> >
> > Link: https://lore.kernel.org/r/20210328144118.305074-1-zhengdejin5@gmail.com
> > Fixes: e2dcd20b1645a ("PCI: controller: Convert to devm_platform_ioremap_resource_byname()")
> > Reported-by: dann.frazier at canonical.com
> > Tested-by: dann frazier <dann.frazier at canonical.com>
> > Signed-off-by: Dejin Zheng <zhengdejin5 at gmail.com>
> > Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
> > Cc: stable at vger.kernel.org    # v5.9+
> > (cherry picked from commit d4707d79fae08c8996a1ba45965a491045a22dda linux-next)
> > Signed-off-by: dann frazier <dann.frazier at canonical.com>
> > ---
> >   drivers/pci/controller/pci-xgene.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
> > index 85e7c98265e8..20be246cd4d4 100644
> > --- a/drivers/pci/controller/pci-xgene.c
> > +++ b/drivers/pci/controller/pci-xgene.c
> > @@ -353,7 +353,8 @@ static int xgene_pcie_map_reg(struct xgene_pcie_port *port,
> >       if (IS_ERR(port->csr_base))
> >               return PTR_ERR(port->csr_base);
> >
> > -     port->cfg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> > +     res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
> > +     port->cfg_base = devm_ioremap_resource(dev, res);
> >       if (IS_ERR(port->cfg_base))
> >               return PTR_ERR(port->cfg_base);
> >       port->cfg_addr = res->start;
> >
>
> --
> -----------
> Tim Gardner
> Canonical, Inc



More information about the kernel-team mailing list