[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <HE1PR0402MB3371A9E1DDC8C6F2CFE71968845E0@HE1PR0402MB3371.eurprd04.prod.outlook.com>
Date: Sun, 16 Aug 2020 16:35:44 +0000
From: "Z.q. Hou" <zhiqiang.hou@....com>
To: Rob Herring <robh@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
PCI <linux-pci@...r.kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Andrew Murray <amurray@...goodpenguin.co.uk>,
Jingoo Han <jingoohan1@...il.com>,
Gustavo Pimentel <gustavo.pimentel@...opsys.com>
Subject: RE: [PATCH] PCI: designware-ep: Fix the Header Type check
Hi Rob,
Thanks a lot for your comments!
> -----Original Message-----
> From: Rob Herring [mailto:robh@...nel.org]
> Sent: 2020年8月14日 23:51
> To: Z.q. Hou <zhiqiang.hou@....com>
> Cc: linux-kernel@...r.kernel.org; PCI <linux-pci@...r.kernel.org>; Lorenzo
> Pieralisi <lorenzo.pieralisi@....com>; Bjorn Helgaas
> <bhelgaas@...gle.com>; Andrew Murray <amurray@...goodpenguin.co.uk>;
> Jingoo Han <jingoohan1@...il.com>; Gustavo Pimentel
> <gustavo.pimentel@...opsys.com>
> Subject: Re: [PATCH] PCI: designware-ep: Fix the Header Type check
>
> On Fri, Aug 14, 2020 at 2:15 AM Zhiqiang Hou <Zhiqiang.Hou@....com>
> wrote:
> >
> > From: Hou Zhiqiang <Zhiqiang.Hou@....com>
> >
> > The current check will result in the multiple function device fails to
> > initialize. So fix the check by masking out the multiple function bit.
> >
> > Fixes: 0b24134f7888 ("PCI: dwc: Add validation that PCIe core is set
> > to correct mode")
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@....com>
> > ---
> > drivers/pci/controller/dwc/pcie-designware-ep.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c
> > b/drivers/pci/controller/dwc/pcie-designware-ep.c
> > index 4680a51c49c0..4b7abfb1e669 100644
> > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c
> > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> > @@ -654,7 +654,7 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep
> *ep)
> > int i;
> >
> > hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE);
> > - if (hdr_type != PCI_HEADER_TYPE_NORMAL) {
> > + if (hdr_type & 0x7f != PCI_HEADER_TYPE_NORMAL) {
>
> Should have () around 'hdr_type & 0x7f'.
>
> > dev_err(pci->dev,
> > "PCIe controller is not set to EP mode
> (hdr_type:0x%x)!\n",
> > hdr_type);
>
> However, shouldn't the printed value be masked too? I'd just do:
>
> hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE) & 0x7f;
>
> Perhaps add a #define too. '0x7f' is used in several places.
All these are good suggestions, will make it in next version.
Thanks,
Zhiqiang
>
> Rob
Powered by blists - more mailing lists