summaryrefslogtreecommitdiff
path: root/drivers/pci/ats.c
diff options
context:
space:
mode:
authorHao, Xudong <xudong.hao@intel.com>2011-12-17 17:24:40 +0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-01-07 00:11:18 +0400
commit1900ca132f53c3d51e6e6b94ea8912530223c63a (patch)
tree01f7e215f1ba735e54f30c27c3fd91dd747b2c5a /drivers/pci/ats.c
parent424eb391596a38ddf422bee1617e4b9dea60126f (diff)
downloadlinux-1900ca132f53c3d51e6e6b94ea8912530223c63a.tar.xz
PCI: Enable ATS at the device state restore
During S3 or S4 resume or PCI reset, ATS regs aren't restored correctly. This patch enables ATS at the device state restore if PCI device has ATS capability. Signed-off-by: Xudong Hao <xudong.hao@intel.com> Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/ats.c')
-rw-r--r--drivers/pci/ats.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index e11ebafaf774..a4a1b369853b 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -128,6 +128,23 @@ void pci_disable_ats(struct pci_dev *dev)
}
EXPORT_SYMBOL_GPL(pci_disable_ats);
+void pci_restore_ats_state(struct pci_dev *dev)
+{
+ u16 ctrl;
+
+ if (!pci_ats_enabled(dev))
+ return;
+ if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS))
+ BUG();
+
+ ctrl = PCI_ATS_CTRL_ENABLE;
+ if (!dev->is_virtfn)
+ ctrl |= PCI_ATS_CTRL_STU(dev->ats->stu - PCI_ATS_MIN_STU);
+
+ pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl);
+}
+EXPORT_SYMBOL_GPL(pci_restore_ats_state);
+
/**
* pci_ats_queue_depth - query the ATS Invalidate Queue Depth
* @dev: the PCI device