aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorHao, Xudong <xudong.hao@intel.com>2011-12-17 08:24:40 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-01-06 15:11:18 -0500
commit1900ca132f53c3d51e6e6b94ea8912530223c63a (patch)
tree01f7e215f1ba735e54f30c27c3fd91dd747b2c5a /drivers/pci
parent424eb391596a38ddf422bee1617e4b9dea60126f (diff)
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')
-rw-r--r--drivers/pci/ats.c17
-rw-r--r--drivers/pci/pci.c1
-rw-r--r--drivers/pci/pci.h8
3 files changed, 26 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)
128} 128}
129EXPORT_SYMBOL_GPL(pci_disable_ats); 129EXPORT_SYMBOL_GPL(pci_disable_ats);
130 130
131void pci_restore_ats_state(struct pci_dev *dev)
132{
133 u16 ctrl;
134
135 if (!pci_ats_enabled(dev))
136 return;
137 if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS))
138 BUG();
139
140 ctrl = PCI_ATS_CTRL_ENABLE;
141 if (!dev->is_virtfn)
142 ctrl |= PCI_ATS_CTRL_STU(dev->ats->stu - PCI_ATS_MIN_STU);
143
144 pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl);
145}
146EXPORT_SYMBOL_GPL(pci_restore_ats_state);
147
131/** 148/**
132 * pci_ats_queue_depth - query the ATS Invalidate Queue Depth 149 * pci_ats_queue_depth - query the ATS Invalidate Queue Depth
133 * @dev: the PCI device 150 * @dev: the PCI device
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 54343aa5b30a..97fff785e97e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -965,6 +965,7 @@ void pci_restore_state(struct pci_dev *dev)
965 965
966 /* PCI Express register must be restored first */ 966 /* PCI Express register must be restored first */
967 pci_restore_pcie_state(dev); 967 pci_restore_pcie_state(dev);
968 pci_restore_ats_state(dev);
968 969
969 /* 970 /*
970 * The Base Address register should be programmed before the command 971 * The Base Address register should be programmed before the command
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 3b6e4ed306b6..1009a5e88e53 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -251,6 +251,14 @@ struct pci_sriov {
251 u8 __iomem *mstate; /* VF Migration State Array */ 251 u8 __iomem *mstate; /* VF Migration State Array */
252}; 252};
253 253
254#ifdef CONFIG_PCI_ATS
255extern void pci_restore_ats_state(struct pci_dev *dev);
256#else
257static inline void pci_restore_ats_state(struct pci_dev *dev)
258{
259}
260#endif /* CONFIG_PCI_ATS */
261
254#ifdef CONFIG_PCI_IOV 262#ifdef CONFIG_PCI_IOV
255extern int pci_iov_init(struct pci_dev *dev); 263extern int pci_iov_init(struct pci_dev *dev);
256extern void pci_iov_release(struct pci_dev *dev); 264extern void pci_iov_release(struct pci_dev *dev);