[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240904194052.GA344429@bhelgaas>
Date: Wed, 4 Sep 2024 14:40:52 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Wei Huang <wei.huang2@....com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, netdev@...r.kernel.org,
Jonathan.Cameron@...wei.com, corbet@....net, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
alex.williamson@...hat.com, gospo@...adcom.com,
michael.chan@...adcom.com, ajit.khaparde@...adcom.com,
somnath.kotur@...adcom.com, andrew.gospodarek@...adcom.com,
manoj.panicker2@....com, Eric.VanTassell@....com,
vadim.fedorenko@...ux.dev, horms@...nel.org, bagasdotme@...il.com,
bhelgaas@...gle.com, lukas@...ner.de, paul.e.luse@...el.com,
jing2.liu@...el.com
Subject: Re: [PATCH V4 03/12] PCI/TPH: Add pcie_tph_modes() to query TPH modes
On Thu, Aug 22, 2024 at 03:41:11PM -0500, Wei Huang wrote:
> Add pcie_tph_modes() to allow drivers to query the TPH modes supported
> by an endpoint device, as reported in the TPH Requester Capability
> register. The modes are reported as a bitmask and current supported
> modes include:
>
> - PCI_TPH_CAP_NO_ST: NO ST Mode Supported
> - PCI_TPH_CAP_INT_VEC: Interrupt Vector Mode Supported
> - PCI_TPH_CAP_DEV_SPEC: Device Specific Mode Supported
> + * pcie_tph_modes - Get the ST modes supported by device
> + * @pdev: PCI device
> + *
> + * Returns a bitmask with all TPH modes supported by a device as shown in the
> + * TPH capability register. Current supported modes include:
> + * PCI_TPH_CAP_NO_ST - NO ST Mode Supported
> + * PCI_TPH_CAP_INT_VEC - Interrupt Vector Mode Supported
> + * PCI_TPH_CAP_DEV_SPEC - Device Specific Mode Supported
> + *
> + * Return: 0 when TPH is not supported, otherwise bitmask of supported modes
> + */
> +int pcie_tph_modes(struct pci_dev *pdev)
> +{
> + if (!pdev->tph_cap)
> + return 0;
> +
> + return get_st_modes(pdev);
> +}
> +EXPORT_SYMBOL(pcie_tph_modes);
I'm not sure I see the need for pcie_tph_modes(). The new bnxt code
looks like this:
bnxt_request_irq
if (pcie_tph_modes(bp->pdev) & PCI_TPH_CAP_INT_VEC)
rc = pcie_enable_tph(bp->pdev, PCI_TPH_CAP_INT_VEC);
What is the advantage of this over just this?
bnxt_request_irq
rc = pcie_enable_tph(bp->pdev, PCI_TPH_CAP_INT_VEC);
It seems like drivers could just ask for what they want since
pcie_enable_tph() has to verify support for it anyway. If that fails,
the driver can fall back to another mode.
Returning a bitmask of supported modes might be useful if the driver
could combine them, but IIUC the modes are all mutually exclusive, so
the driver can't request a combination of them.
Bjorn
Powered by blists - more mailing lists