mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-01 18:24:23 +08:00
PCI/ATS: Disable PF/VF ATS service independently
Previously we didn't disable the PF ATS until all associated VFs had disabled it. But per PCIe spec r5.0, sec 9.3.7.8, the ATS Capability in VFs and associated PFs may be enabled independently. Leaving ATS enabled in the PF unnecessarily may have power and performance impacts. Remove this dependency logic in the ATS enable/disable code. [bhelgaas: commit log] Suggested-by: Ashok Raj <ashok.raj@intel.com> Link: https://lore.kernel.org/r/8163ab8fa66afd2cba514ae95d29ab12104781aa.1567029860.git.sathyanarayanan.kuppuswamy@linux.intel.com Link: https://lore.kernel.org/r/20190905193146.90250-4-helgaas@kernel.org Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Ashok Raj <ashok.raj@intel.com> Cc: Keith Busch <keith.busch@intel.com>
This commit is contained in:
parent
2b0ae7cc3b
commit
3ad6219209
@ -60,8 +60,6 @@ int pci_enable_ats(struct pci_dev *dev, int ps)
|
||||
pdev = pci_physfn(dev);
|
||||
if (pdev->ats_stu != ps)
|
||||
return -EINVAL;
|
||||
|
||||
atomic_inc(&pdev->ats_ref_cnt); /* count enabled VFs */
|
||||
} else {
|
||||
dev->ats_stu = ps;
|
||||
ctrl |= PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
|
||||
@ -79,20 +77,11 @@ EXPORT_SYMBOL_GPL(pci_enable_ats);
|
||||
*/
|
||||
void pci_disable_ats(struct pci_dev *dev)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
u16 ctrl;
|
||||
|
||||
if (WARN_ON(!dev->ats_enabled))
|
||||
return;
|
||||
|
||||
if (atomic_read(&dev->ats_ref_cnt))
|
||||
return; /* VFs still enabled */
|
||||
|
||||
if (dev->is_virtfn) {
|
||||
pdev = pci_physfn(dev);
|
||||
atomic_dec(&pdev->ats_ref_cnt);
|
||||
}
|
||||
|
||||
pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, &ctrl);
|
||||
ctrl &= ~PCI_ATS_CTRL_ENABLE;
|
||||
pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl);
|
||||
|
@ -452,7 +452,6 @@ struct pci_dev {
|
||||
};
|
||||
u16 ats_cap; /* ATS Capability offset */
|
||||
u8 ats_stu; /* ATS Smallest Translation Unit */
|
||||
atomic_t ats_ref_cnt; /* Number of VFs with ATS enabled */
|
||||
#endif
|
||||
#ifdef CONFIG_PCI_PRI
|
||||
u32 pri_reqs_alloc; /* Number of PRI requests allocated */
|
||||
|
Loading…
Reference in New Issue
Block a user