Thread (23 messages) flat view 23 messages, 5 authors, 2017-08-09

[PATCH v9 2/4] PCI: Disable PCIe Relaxed Ordering if unsupported

From: Ding Tianhong <hidden>
Date: 2017-08-09 13:31:20
Also in: linux-pci, lkml, netdev

Hi Bjorn:

On 2017/8/9 10:22, Bjorn Helgaas wrote:
On Sat, Aug 05, 2017 at 03:15:11PM +0800, Ding Tianhong wrote:
quoted
When bit4 is set in the PCIe Device Control register, it indicates
whether the device is permitted to use relaxed ordering.
On some platforms using relaxed ordering can have performance issues or
due to erratum can cause data-corruption. In such cases devices must avoid
using relaxed ordering.

This patch checks if there is any node in the hierarchy that indicates that
using relaxed ordering is not safe. 
I think you only check the devices between the root port and the
target device.  For example, you don't check siblings or cousins of
the target device.
OK, update the description.
quoted
In such cases the patch turns off the
relaxed ordering by clearing the eapability for this device.
s/eapability/capability/
quoted
And if the
device is probably running in a guest machine, we should do nothing.
I don't know what this sentence means.  "Probably running in a guest
machine" doesn't really make sense, and there's nothing in your patch
that explicitly checks for being in a guest machine.
Alex noticed that we should do nothing if in the virtual machine because
the Root Complex is NULL at that time, so I think this word should be more
clearly here.
quoted
Signed-off-by: Ding Tianhong <redacted>
Acked-by: Alexander Duyck <redacted>
Acked-by: Ashok Raj <redacted>
---
 drivers/pci/pci.c   | 29 +++++++++++++++++++++++++++++
 drivers/pci/probe.c | 37 +++++++++++++++++++++++++++++++++++++
 include/linux/pci.h |  2 ++
 3 files changed, 68 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index af0cc34..4f9d7c1 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4854,6 +4854,35 @@ int pcie_set_mps(struct pci_dev *dev, int mps)
 EXPORT_SYMBOL(pcie_set_mps);
 
 /**
+ * pcie_clear_relaxed_ordering - clear PCI Express relaxed ordering bit
+ * @dev: PCI device to query
+ *
+ * If possible clear relaxed ordering
Why "If possible"?  The bit is required to be RW or hardwired to zero,
so PCI_EXP_DEVCTL_RELAX_EN should *always* be zero when this returns.
OK
quoted
+ */
+int pcie_clear_relaxed_ordering(struct pci_dev *dev)
+{
...
quoted
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help