[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zzohn1nGk1-ZpMlc@wunner.de>
Date: Sun, 17 Nov 2024 18:02:23 +0100
From: Lukas Wunner <lukas@...ner.de>
To: "Bowman, Terry" <terry.bowman@....com>
Cc: linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, nifan.cxl@...il.com, ming4.li@...el.com,
dave@...olabs.net, jonathan.cameron@...wei.com,
dave.jiang@...el.com, alison.schofield@...el.com,
vishal.l.verma@...el.com, dan.j.williams@...el.com,
bhelgaas@...gle.com, mahesh@...ux.ibm.com, ira.weiny@...el.com,
oohall@...il.com, Benjamin.Cheatham@....com, rrichter@....com,
nathan.fontenot@....com, Smita.KoralahalliChannabasappa@....com
Subject: Re: [PATCH v3 03/15] cxl/pci: Introduce PCIe helper functions
pcie_is_cxl() and pcie_is_cxl_port()
On Fri, Nov 15, 2024 at 07:54:37AM -0600, Bowman, Terry wrote:
> On 11/15/2024 2:47 AM, Lukas Wunner wrote:
> > On Thu, Nov 14, 2024 at 11:07:26AM -0600, Bowman, Terry wrote:
> > > I will remove the "if (!pcie_is_cxl(dev))" block as you suggested.
> >
> > Ah, this is meant as a speed-up. Actually that makes sense,
> > so feel free to keep it.
> >
> > If you do remove it, I think you'll have to move the cxl_port_dvsec()
> > invocation up in the function, in front of the pci_pcie_type() checks.
> > The latter require that one first checks that the device is PCIe.
> > That's done implicitly by cxl_port_dvsec() because it returns 0 in
> > the non-PCIe case. (Due to the "if (dev->cfg_size <= PCI_CFG_SPACE_SIZE)"
> > check in pci_find_next_ext_capability().)
> >
> > Another idea would be to put a "if (!pcie_is_cxl(dev)) return 0;" speed-up
> > in cxl_port_dvsec() so that the other caller benefits from it as well.
>
> Ok, I'll look at adding the same pcie_is_cxl() call and check in
> cxl_port_devsec().
If you put "if (!pcie_is_cxl(dev)) return 0;" in cxl_port_devsec()
and move the call to cxl_port_devsec() in pcie_is_cxl_port() up in front
of the pci_pcie_type() checks, I think you won't need an additional
"!pcie_is_cxl(dev)" check in pcie_is_cxl_port().
Thanks,
Lukas
Powered by blists - more mailing lists