Re: [PATCH V2 4/9] PCI/TPH: Implement a command line option to force No ST Mode

Jonathan Cameron
2024-06-07T16:32:53Z

On Fri, 31 May 2024 16:38:36 -0500
Wei Huang <wei.huang2@amd.com> wrote:

> When "No ST mode" is enabled, end-point devices can generate TPH headers
> but with all steering tags treated as zero. A steering tag of zero is
> interpreted as "using the default policy" by the root complex. This is
> essential to quantify the benefit of steering tags for some given
> workloads.

This is a good explanation. Need similar in the previous patch to
justify the disable TPH entirely.

> diff --git a/drivers/pci/pcie/tph.c b/drivers/pci/pcie/tph.c
> index 5dc533b89a33..d5f7309fdf52 100644
> --- a/drivers/pci/pcie/tph.c
> +++ b/drivers/pci/pcie/tph.c
> @@ -43,6 +43,27 @@ static int tph_set_reg_field_u32(struct pci_dev *dev, u8 offset, u32 mask,
> return ret;
> }
>
> +int tph_set_dev_nostmode(struct pci_dev *dev)
> +{
> + int ret;
> +
> + /* set ST Mode Select to "No ST Mode" */
> + ret = tph_set_reg_field_u32(dev, PCI_TPH_CTRL,
> + PCI_TPH_CTRL_MODE_SEL_MASK,
> + PCI_TPH_CTRL_MODE_SEL_SHIFT,
> + PCI_TPH_NO_ST_MODE);
> + if (ret)
> + return ret;
> +
> + /* set "TPH Requester Enable" to "TPH only" */
> + ret = tph_set_reg_field_u32(dev, PCI_TPH_CTRL,
> + PCI_TPH_CTRL_REQ_EN_MASK,
> + PCI_TPH_CTRL_REQ_EN_SHIFT,
> + PCI_TPH_REQ_TPH_ONLY);

Unless these have to be two RMW operations. (if they do add a spec reference)
then this is a good example of why a field update function may not be
the right option. We probably want to RMW once.

return tph_set_reg_field_u32()

> +
> + return ret;
> +}
> +
> int pcie_tph_disable(struct pci_dev *dev)
> {
> return tph_set_reg_field_u32(dev, PCI_TPH_CTRL,