From: Leon Romanovsky <leon@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Chengwen Feng <fengchengwen@huawei.com>,
alex@shazbot.org, jgg@ziepe.ca, wathsala.vithanage@arm.com,
wei.huang2@amd.com, wangzhou1@hisilicon.com,
wangyushan12@huawei.com, liuyonglong@huawei.com,
kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 1/6] PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction
Date: Wed, 13 May 2026 10:01:01 +0300 [thread overview]
Message-ID: <20260513070101.GD15586@unreal> (raw)
In-Reply-To: <20260506155418.GA790442@bhelgaas>
On Wed, May 06, 2026 at 10:54:18AM -0500, Bjorn Helgaas wrote:
> On Wed, May 06, 2026 at 05:46:18PM +0800, Chengwen Feng wrote:
> > pcie_tph_get_st_table_loc() incorrectly uses FIELD_GET(), which shifts the
> > field value to bit 0. But the function is designed to return raw
> > PCI_TPH_LOC_* values as defined in the function comment.
> >
> > This causes incorrect ST table location detection. Fix it by using bitwise
> > AND with PCI_TPH_CAP_LOC_MASK to return the unshifted field value matching
> > the function specification.
> >
> > While this change appears to be a no-op within tph.c, the external caller
> > mlx5_st_create() relies on the documented function behavior, making this
> > fix necessary.
>
> Previously, pcie_tph_get_st_table_loc() returned 0x0 (for
> PCI_TPH_LOC_NONE), 0x2 (for PCI_TPH_LOC_CAP), or 0x4 (for
> PCI_TPH_LOC_MSIX).
>
> mlx5_st_create() is currently the only external caller. It only
> checks for PCI_TPH_LOC_NONE, which is 0 regardless of the FIELD_GET(),
> so I don't think this actually fixes mlx5_st_create().
>
> Probably still worth a stable backport because other drivers may call
> pcie_tph_get_st_table_loc() in the future, and if they depend on
> PCI_TPH_LOC_CAP or PCI_TPH_LOC_MSIX, and are backported to stable
> kernels, they will need this.
>
> I might reword that last paragraph to avoid the implication that this
> actually fixes something in mlx5:
>
> This doesn't make a difference to mlx5_st_create(), the lone
> external caller, because it only checks for PCI_TPH_LOC_NONE (0),
> but will be needed for callers that check for PCI_TPH_LOC_CAP or
> PCI_TPH_LOC_MSIX.
Right, we are running TPH in mlx5 regression and it works perfectly
without "the fix".
Thanks
next prev parent reply other threads:[~2026-05-13 7:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 9:46 [PATCH v6 0/6] vfio/pci: Add PCIe TPH support Chengwen Feng
2026-05-06 9:46 ` [PATCH v6 1/6] PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction Chengwen Feng
2026-05-06 15:54 ` Bjorn Helgaas
2026-05-13 7:01 ` Leon Romanovsky [this message]
2026-05-06 9:46 ` [PATCH v6 2/6] PCI/TPH: Export pcie_tph_get_st_modes() for external use Chengwen Feng
2026-05-06 12:39 ` sashiko-bot
2026-05-06 9:46 ` [PATCH v6 3/6] vfio/pci: Add PCIe TPH interface with capability query Chengwen Feng
2026-05-06 18:48 ` sashiko-bot
2026-05-06 9:46 ` [PATCH v6 4/6] vfio/pci: Add PCIe TPH enable/disable support Chengwen Feng
2026-05-06 19:21 ` sashiko-bot
2026-05-06 9:46 ` [PATCH v6 5/6] vfio/pci: Add PCIe TPH GET_ST interface Chengwen Feng
2026-05-06 19:57 ` sashiko-bot
2026-05-06 9:46 ` [PATCH v6 6/6] vfio/pci: Add PCIe TPH SET_ST interface Chengwen Feng
2026-05-06 20:22 ` sashiko-bot
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=20260513070101.GD15586@unreal \
--to=leon@kernel.org \
--cc=alex@shazbot.org \
--cc=fengchengwen@huawei.com \
--cc=helgaas@kernel.org \
--cc=jgg@ziepe.ca \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=wangyushan12@huawei.com \
--cc=wangzhou1@hisilicon.com \
--cc=wathsala.vithanage@arm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.