[PATCH 2/4] Enable LTR before device is used by driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable LTR(Latency tolerance reporting) in pci_enable_device(),
make sure this feature is enabled before the device is used by driver.

Signed-off-by: Xudong Hao <xudong.hao@xxxxxxxxx>
---
 drivers/pci/pci.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a70093b..5e5e3ad 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1136,6 +1136,21 @@ int pci_load_and_free_saved_state(struct pci_dev *dev,
 }
 EXPORT_SYMBOL_GPL(pci_load_and_free_saved_state);
 
+static void pci_enable_dev_caps(struct pci_dev *dev)
+{
+	/* 
+	 * LTR(Latency tolerance reporting) allows devices to send
+	 * messages to the root complex indicating their latency
+	 * tolerance for snooped & unsnooped memory transactions.
+	 */
+	pci_enable_ltr(dev);
+}
+
+static void pci_disable_dev_caps(struct pci_dev *dev)
+{
+	pci_disable_ltr(dev);
+}
+
 static int do_pci_enable_device(struct pci_dev *dev, int bars)
 {
 	int err;
@@ -1148,6 +1163,9 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars)
 		return err;
 	pci_fixup_device(pci_fixup_enable, dev);
 
+	/* Enable some device capibility before it's used by driver. */
+	pci_enable_dev_caps(dev);
+
 	return 0;
 }
 
@@ -1363,6 +1381,7 @@ static void do_pci_disable_device(struct pci_dev *dev)
 	}
 
 	pcibios_disable_device(dev);
+	pci_disable_dev_caps(dev);
 }
 
 /**
-- 
1.5.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux