Wrong LTR-related check in nbif_v6_3_1_program_ltr()
Heiner Kallweit
hkallweit1 at gmail.com
Sat Feb 22 17:41:30 UTC 2025
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.
More information about the amd-gfx
mailing list