* Re: [PATCH v13 1/5] PCI/TPH: treat reserved 0b10 completer encoding as unsupported
[not found] <20260731211601.3033906-2-zhipingz@meta.com>
@ 2026-09-15 22:19 ` Bjorn Helgaas
2026-09-15 23:14 ` Zhiping Zhang
0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Helgaas @ 2026-09-15 22:19 UTC (permalink / raw)
To: Zhiping Zhang
Cc: Jason Gunthorpe, Leon Romanovsky, Michael Guralnik, Sumit Semwal,
Christian Konig, Alex Williamson, Bjorn Helgaas, kvm, linux-rdma,
linux-pci, dri-devel, Chengwen Feng
On Fri, Jul 31, 2026 at 02:15:48PM -0700, Zhiping Zhang wrote:
> get_rp_completer_type() returns the Root Port's "TPH Completer
> Supported" field (bits 13:12 of Device Capabilities 2) verbatim. The
> 0b10 encoding is reserved, but pcie_enable_tph() feeds the raw value
> into the requester type:
>
> pdev->tph_req_type = min(pdev->tph_req_type, rp_req_type);
>
> and later writes tph_req_type to the TPH Requester Enable field, which
> only defines 0b00 (disable), 0b01 (TPH only) and 0b11 (extended TPH).
>
> No known hardware presents the reserved 0b10 in this field, so this is
> defensive hardening rather than a fix for observed silicon: fold the
> reserved encoding into "not supported" so only the three architected
> values can ever reach the Requester Enable field.
>
> Signed-off-by: Zhiping Zhang <zhipingz@meta.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
In subject, to match history of the file:
PCI/TPH: Treat reserved 0b10 completer encoding as unsupported
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/tph.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> index 655ffd60e62f..5cbb381e2a02 100644
> --- a/drivers/pci/tph.c
> +++ b/drivers/pci/tph.c
> @@ -200,6 +200,7 @@ EXPORT_SYMBOL(pcie_tph_get_st_table_size);
> static u8 get_rp_completer_type(struct pci_dev *pdev)
> {
> struct pci_dev *rp;
> + u8 tph_comp;
> u32 reg;
> int ret;
>
> @@ -211,7 +212,15 @@ static u8 get_rp_completer_type(struct pci_dev *pdev)
> if (ret)
> return 0;
>
> - return FIELD_GET(PCI_EXP_DEVCAP2_TPH_COMP_MASK, reg);
> + /*
> + * 0b10 is reserved; treat it as "not supported" so only the
> + * architected encodings reach the Requester Enable field.
> + */
> + tph_comp = FIELD_GET(PCI_EXP_DEVCAP2_TPH_COMP_MASK, reg);
> + if (tph_comp == PCI_EXP_DEVCAP2_TPH_COMP_TPH_ONLY ||
> + tph_comp == PCI_EXP_DEVCAP2_TPH_COMP_EXT_TPH)
> + return tph_comp;
> + return PCI_EXP_DEVCAP2_TPH_COMP_NONE;
> }
>
> /* Write tag to ST table - Return 0 if OK, otherwise -errno */
> --
> 2.53.0-Meta
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v13 1/5] PCI/TPH: treat reserved 0b10 completer encoding as unsupported
2026-09-15 22:19 ` [PATCH v13 1/5] PCI/TPH: treat reserved 0b10 completer encoding as unsupported Bjorn Helgaas
@ 2026-09-15 23:14 ` Zhiping Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Zhiping Zhang @ 2026-09-15 23:14 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Jason Gunthorpe, Leon Romanovsky, Michael Guralnik, Sumit Semwal,
Christian Konig, Alex Williamson, Bjorn Helgaas, kvm, linux-rdma,
linux-pci, dri-devel, Chengwen Feng
On Tue, Sep 15, 2026 at 3:19 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> >
> On Fri, Jul 31, 2026 at 02:15:48PM -0700, Zhiping Zhang wrote:
> > get_rp_completer_type() returns the Root Port's "TPH Completer
> > Supported" field (bits 13:12 of Device Capabilities 2) verbatim. The
> > 0b10 encoding is reserved, but pcie_enable_tph() feeds the raw value
> > into the requester type:
> >
> > pdev->tph_req_type = min(pdev->tph_req_type, rp_req_type);
> >
> > and later writes tph_req_type to the TPH Requester Enable field, which
> > only defines 0b00 (disable), 0b01 (TPH only) and 0b11 (extended TPH).
> >
> > No known hardware presents the reserved 0b10 in this field, so this is
> > defensive hardening rather than a fix for observed silicon: fold the
> > reserved encoding into "not supported" so only the three architected
> > values can ever reach the Requester Enable field.
> >
> > Signed-off-by: Zhiping Zhang <zhipingz@meta.com>
> > Acked-by: Chengwen Feng <fengchengwen@huawei.com>
>
> In subject, to match history of the file:
>
> PCI/TPH: Treat reserved 0b10 completer encoding as unsupported
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>
Thanks Bjorn! I'll fix the subject to match the file's history and
carry your Acked-by in v14, which will otherwise just be a rebase of
v13 onto 7.3.
Thanks,
Zhiping
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 23:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260731211601.3033906-2-zhipingz@meta.com>
2026-09-15 22:19 ` [PATCH v13 1/5] PCI/TPH: treat reserved 0b10 completer encoding as unsupported Bjorn Helgaas
2026-09-15 23:14 ` Zhiping Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox