Linux PCI subsystem development
 help / color / mirror / Atom feed
* Wrong LTR-related check in nbif_v6_3_1_program_ltr()
@ 2025-02-22 17:41 Heiner Kallweit
  0 siblings, 0 replies; only message in thread
From: Heiner Kallweit @ 2025-02-22 17:41 UTC (permalink / raw)
  To: Frank Min, Kenneth Feng, Alex Deucher, Christian König,
	Xinhui Pan
  Cc: linux-pci@vger.kernel.org,
	open list:RADEON and AMDGPU DRM DRIVERS

In nbif_v6_3_1_program_ltr() (and maybe other functions as well) you have
the following:

pcie_capability_read_word(adev->pdev, PCI_EXP_DEVCTL2, &devctl2);

if (adev->pdev->ltr_path == (devctl2 & PCI_EXP_DEVCTL2_LTR_EN))
	return;

if (adev->pdev->ltr_path)
	pcie_capability_set_word(adev->pdev, PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_LTR_EN);
else
	pcie_capability_clear_word(adev->pdev, PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_LTR_EN);

The comparison to (devctl2 & PCI_EXP_DEVCTL2_LTR_EN) looks wrong, as this expression
can only be 0 or 0x400. I think what you want is
if (adev->pdev->ltr_path == !!(devctl2 & PCI_EXP_DEVCTL2_LTR_EN))

In general I wonder whether the code part is needed and why pci_configure_ltr()
in PCI core isn't sufficient for you.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-22 17:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-22 17:41 Wrong LTR-related check in nbif_v6_3_1_program_ltr() Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox