From: Xudong Hao <xudong.hao@linux.intel.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, avi@redhat.com, alex.williamson@redhat.com,
xiantao.zhang@intel.com, xudong.hao@intel.com
Subject: [PATCH 1/1] Enable LTR/OBFF before device is used by driver
Date: Mon, 14 May 2012 10:48:16 +0800 [thread overview]
Message-ID: <20120514024816.GA15371@hp-xd.sh.intel.com> (raw)
Enable LTR(Latency tolerance reporting) and OBFF(optimized buffer flush/fill) in
pci_enable_device(), so that they are enabled before the device is used by driver.
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
---
drivers/pci/pci.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 111569c..2369883 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1134,6 +1134,31 @@ 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)
+{
+ /* set default value */
+ unsigned long type = PCI_EXP_OBFF_SIGNAL_ALWAYS;
+
+ /* 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);
+
+ /* OBFF (optimized buffer flush/fill), where supported,
+ * can help improve energy efficiency by giving devices
+ * information about when interrupts and other activity
+ * will have a reduced power impact.
+ */
+ pci_enable_obff(dev, type);
+}
+
+static void pci_disable_dev_caps(struct pci_dev *dev)
+{
+ pci_disable_obff(dev);
+ pci_disable_ltr(dev);
+}
+
static int do_pci_enable_device(struct pci_dev *dev, int bars)
{
int err;
@@ -1146,6 +1171,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;
}
@@ -1361,6 +1389,7 @@ static void do_pci_disable_device(struct pci_dev *dev)
}
pcibios_disable_device(dev);
+ pci_disable_dev_caps(dev);
}
/**
--
1.6.0.rc1
next reply other threads:[~2012-05-14 2:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 2:48 Xudong Hao [this message]
2012-05-19 1:20 ` [PATCH 1/1] Enable LTR/OBFF before device is used by driver Bjorn Helgaas
2012-05-30 11:28 ` Hao, Xudong
2012-05-30 16:13 ` Don Dutile
2012-05-31 2:17 ` Hao, Xudong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120514024816.GA15371@hp-xd.sh.intel.com \
--to=xudong.hao@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=avi@redhat.com \
--cc=bhelgaas@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=xiantao.zhang@intel.com \
--cc=xudong.hao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.