From: Alejandro Lucero Palau <alucerop@amd.com>
To: Wei Huang <wei.huang2@amd.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, netdev@vger.kernel.org
Cc: Jonathan.Cameron@Huawei.com, helgaas@kernel.org, corbet@lwn.net,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, alex.williamson@redhat.com,
gospo@broadcom.com, michael.chan@broadcom.com,
ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com,
andrew.gospodarek@broadcom.com, manoj.panicker2@amd.com,
Eric.VanTassell@amd.com, vadim.fedorenko@linux.dev,
horms@kernel.org, bagasdotme@gmail.com, bhelgaas@google.com,
lukas@wunner.de, paul.e.luse@intel.com, jing2.liu@intel.com
Subject: Re: [PATCH V5 1/5] PCI: Add TLP Processing Hints (TPH) support
Date: Tue, 24 Sep 2024 15:33:54 +0100 [thread overview]
Message-ID: <26c176a9-aa68-95de-7157-b3669d5bb404@amd.com> (raw)
In-Reply-To: <87111ebf-9cfd-4e14-9c03-05aa65330070@amd.com>
On 9/23/24 21:27, Wei Huang wrote:
>
>
> On 9/23/24 7:07 AM, Alejandro Lucero Palau wrote:
>>
>
> ...
>
>>> +/**
>>> + * pcie_enable_tph - Enable TPH support for device using a specific
>>> ST mode
>>> + * @pdev: PCI device
>>> + * @mode: ST mode to enable. Current supported modes include:
>>> + *
>>> + * - PCI_TPH_ST_NS_MODE: NO ST Mode
>>> + * - PCI_TPH_ST_IV_MODE: Interrupt Vector Mode
>>> + * - PCI_TPH_ST_DS_MODE: Device Specific Mode
>>> + *
>>> + * Checks whether the mode is actually supported by the device
>>> before enabling
>>> + * and returns an error if not. Additionally determines what types
>>> of requests,
>>> + * TPH or extended TPH, can be issued by the device based on its
>>> TPH requester
>>> + * capability and the Root Port's completer capability.
>>> + *
>>> + * Return: 0 on success, otherwise negative value (-errno)
>>> + */
>>> +int pcie_enable_tph(struct pci_dev *pdev, int mode)
>>> +{
>>> + u32 reg;
>>> + u8 dev_modes;
>>> + u8 rp_req_type;
>>> +
>>> + /* Honor "notph" kernel parameter */
>>> + if (pci_tph_disabled)
>>> + return -EINVAL;
>>> +
>>> + if (!pdev->tph_cap)
>>> + return -EINVAL;
>>> +
>>> + if (pdev->tph_enabled)
>>> + return -EBUSY;
>>> +
>>> + /* Sanitize and check ST mode comptability */
>>> + mode &= PCI_TPH_CTRL_MODE_SEL_MASK;
>>> + dev_modes = get_st_modes(pdev);
>>> + if (!((1 << mode) & dev_modes))
>>
>>
>> This is wrong. The mode definition is about the bit on and not about bit
>> position. You got this right in v4 ...
>
> This code is correct. In V5, I changed the "mode" parameter to the
> following values, as defined in TPH Ctrl register. These values are
> defined as bit positions:
>
> PCI_TPH_ST_NS_MODE: NO ST Mode
> PCI_TPH_ST_IV_MODE: Interrupt Vector Mode
> PCI_TPH_ST_DS_MODE: Device Specific Mode
>
OK. I found the issue. I was using PCI_TPH_CAP_ST_DS for the mode
instead of PCI_TPH_ST_DS_MODE.
That change confused me.
Apologies.
> In V4, "mode" is defined as masks of TPH Cap register. I felt that V5
> looks more straightforward:
>
> V4: pcie_enable_tph(dev, PCI_TPH_CAP_ST_IV)
> vs.
> V5: pcie_enable_tph(dev, PCI_TPH_ST_IV_MODE)
>
>>
>>
>>> + return -EINVAL;
>
next prev parent reply other threads:[~2024-09-24 14:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 20:50 [PATCH V5 0/5] PCIe TPH and cache direct injection support Wei Huang
2024-09-16 20:50 ` [PATCH V5 1/5] PCI: Add TLP Processing Hints (TPH) support Wei Huang
2024-09-17 7:38 ` Simon Horman
2024-09-23 7:43 ` Lukas Wunner
2024-09-24 16:34 ` Wei Huang
2024-09-23 12:07 ` Alejandro Lucero Palau
2024-09-23 20:27 ` Wei Huang
2024-09-24 14:33 ` Alejandro Lucero Palau [this message]
2024-09-16 20:51 ` [PATCH V5 2/5] PCI/TPH: Add Steering Tag support Wei Huang
2024-09-17 7:32 ` Simon Horman
2024-09-17 14:31 ` Wei Huang
2024-09-17 16:14 ` Simon Horman
2024-09-17 16:24 ` Simon Horman
2024-09-20 10:38 ` kernel test robot
2024-09-16 20:51 ` [PATCH V5 3/5] PCI/TPH: Add TPH documentation Wei Huang
2024-09-16 20:51 ` [PATCH V5 4/5] bnxt_en: Add TPH support in BNXT driver Wei Huang
2024-09-16 21:25 ` Wei Huang
2024-09-23 7:25 ` Lukas Wunner
2024-09-23 20:16 ` Wei Huang
2024-09-17 7:35 ` Simon Horman
2024-09-20 10:38 ` kernel test robot
2024-09-16 20:51 ` [PATCH V5 5/5] bnxt_en: Pass NQ ID to the FW when allocating RX/RX AGG rings Wei Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26c176a9-aa68-95de-7157-b3669d5bb404@amd.com \
--to=alucerop@amd.com \
--cc=Eric.VanTassell@amd.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=ajit.khaparde@broadcom.com \
--cc=alex.williamson@redhat.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=bagasdotme@gmail.com \
--cc=bhelgaas@google.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gospo@broadcom.com \
--cc=helgaas@kernel.org \
--cc=horms@kernel.org \
--cc=jing2.liu@intel.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=manoj.panicker2@amd.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paul.e.luse@intel.com \
--cc=somnath.kotur@broadcom.com \
--cc=vadim.fedorenko@linux.dev \
--cc=wei.huang2@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®