PCI: Fix comment syntax
PATCH v9 1/2 PCI: Fix comment syntax
From: Jon Mason <[email protected]>
Correct minor wording issue in MPS Peer-to-peer comment.
Noticed by Don Dutile
--- drivers/pci/probe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/probe.c +1 -1
@@ -1625,7 +1625,7 @@ void pcie_bus_configure_settings(struct pci_bus *bus)return ;/* FIXME - Peer to peer DMA is possible, though the endpoint would need -* to be aware to the MPS of the destination. To work around this, +* to be aware of the MPS of the destination. To work around this, * simply force the MPS of the entire system to the smallest possible. */ if (pcie_bus_config ==PCIE_BUS_PEER2PEER )
Signature · 1 line
1.7.1
PATCH v9 2/2 PCI: Print warning message if unsafe mps detected
Some broken BIOS configures incorrect mps for devices, eg. bridge mps larger than connected Endpoint device mps. So TLP packets maybe discarded by Endpoint device. These devices may not work normally. Joe Jin reported these problems, reference:
http://lkml.kernel.org/r/[email protected]
http://lkml.kernel.org/r/[email protected]
For easy detect this issue, try to detect the unsafe mps (unequal mps between device and its bridge device) setting. If unsafe mps setting found, print warning message.
--- drivers/pci/probe.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)
drivers/pci/probe.c +22 -3
@@ -1587,6 +1587,23 @@ static void pcie_write_mrrs(struct pci_dev *dev) "with pci=pcie_bus_safe.\n"); } +static void pcie_bus_detect_mps (struct pci_dev *dev) +{ +int mps, p_mps; + +if (!dev->bus->self) +return ; + + mps =pcie_get_mps (dev); + p_mps =pcie_get_mps (dev->bus->self); + +if (mps != p_mps) +dev_warn (&dev->dev,"Non-optimal MPS value of %d being used. " +"If problems are experienced, try running with " +"pci=pcie_bus_safe.\n" , mps); +return ; +} +static int pcie_bus_configure_set (struct pci_dev *dev,void *data) {int mps, orig_mps;
@@ -1594,6 +1611,11 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)if (!pci_is_pcie (dev))return 0 ; +if (pcie_bus_config ==PCIE_BUS_TUNE_OFF ) { +pcie_bus_detect_mps (dev); +return 0 ; + } + mps =128 << *(u8 *)data; orig_mps =pcie_get_mps (dev);
@@ -1621,9 +1643,6 @@ void pcie_bus_configure_settings(struct pci_bus *bus)if (!pci_is_pcie (bus->self))return ; -if (pcie_bus_config ==PCIE_BUS_TUNE_OFF ) -return ; -/* FIXME - Peer to peer DMA is possible, though the endpoint would need * to be aware of the MPS of the destination. To work around this, * simply force the MPS of the entire system to the smallest possible.
Signature · 1 line
1.7.1
Bjorn Helgaas
maintainerRe: [PATCH v9 2/2] PCI: Print warning message if unsafe mps detected
Quoted 11 lines · Yijing Wang
Some broken BIOS configures incorrect mps for devices, eg. bridge mps larger than connected Endpoint device mps. So TLP packets maybe discarded by Endpoint device. These devices may not work normally. Joe Jin reported these problems, reference:
http://lkml.kernel.org/r/[email protected]
http://lkml.kernel.org/r/[email protected]
For easy detect this issue, try to detect the unsafe mps (unequal mps between device and its bridge device) setting. If unsafe mps setting found, print warning message.
Quoted 3 lines
Reported-by Joe Jin <[email protected]>Signed-off-by Yijing Wang <[email protected]>Cc Jon Mason <[email protected]>
Applied with minor tweaks to pci/yijing-mps-v8
Quoted 58 lines
--- drivers/pci/probe.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-)drivers/pci/probe.c +22
-4@@ -1587,6 +1587,23 @@ static void pcie_write_mrrs(struct pci_dev *dev) "with pci=pcie_bus_safe.\n"); } +static void pcie_bus_detect_mps (struct pci_dev *dev) +{ +int mps, p_mps; + +if (!dev->bus->self) +return ; + + mps =pcie_get_mps (dev); + p_mps =pcie_get_mps (dev->bus->self); + +if (mps != p_mps) +dev_warn (&dev->dev,"Non-optimal MPS value of %d being used. " +"If problems are experienced, try running with " +"pci=pcie_bus_safe.\n" , mps); +return ; +} +static int pcie_bus_configure_set (struct pci_dev *dev,void *data) {int mps, orig_mps;@@ -1594,6 +1611,11 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)if (!pci_is_pcie (dev))return 0 ; +if (pcie_bus_config ==PCIE_BUS_TUNE_OFF ) { +pcie_bus_detect_mps (dev); +return 0 ; + } + mps =128 << *(u8 *)data; orig_mps =pcie_get_mps (dev);@@ -1621,9 +1643,6 @@ void pcie_bus_configure_settings(struct pci_bus *bus)if (!pci_is_pcie (bus->self))return ; -if (pcie_bus_config ==PCIE_BUS_TUNE_OFF ) -return ; -/* FIXME - Peer to peer DMA is possible, though the endpoint would need * to be aware of the MPS of the destination. To work around this, * simply force the MPS of the entire system to the smallest possible. -- 1.7.1
Quoted 7 lines · Yijing Wang
From: Jon Mason <[email protected]>
Correct minor wording issue in MPS Peer-to-peer comment.
Noticed by Don Dutile
Signed-off-by Jon Mason <[email protected]>
Applied to pci/yijing-mps-v8
Quoted 21 lines
--- drivers/pci/probe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/pci/probe.c +1
-2@@ -1625,7 +1625,7 @@ void pcie_bus_configure_settings(struct pci_bus *bus)return ;/* FIXME - Peer to peer DMA is possible, though the endpoint would need -* to be aware to the MPS of the destination. To work around this, +* to be aware of the MPS of the destination. To work around this, * simply force the MPS of the entire system to the smallest possible. */ if (pcie_bus_config ==PCIE_BUS_PEER2PEER ) --1.7.1