mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
Revert "Revert "PCI: loongson: Prevent LS7A MRRS increases""
This reverts commit b923dd1052.
It was perserving the ABI, but that is not needed anymore at this point
in time.
Change-Id: Ib7087614a16570125233f26d582d449fe5ead163
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
committed by
Lee Jones
parent
c96bd2e36f
commit
347b23178a
@@ -60,37 +60,23 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
|
||||
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
|
||||
DEV_LS7A_LPC, system_bus_quirk);
|
||||
|
||||
static void loongson_mrrs_quirk(struct pci_dev *dev)
|
||||
static void loongson_mrrs_quirk(struct pci_dev *pdev)
|
||||
{
|
||||
struct pci_bus *bus = dev->bus;
|
||||
struct pci_dev *bridge;
|
||||
static const struct pci_device_id bridge_devids[] = {
|
||||
{ PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_0) },
|
||||
{ PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_1) },
|
||||
{ PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_2) },
|
||||
{ 0, },
|
||||
};
|
||||
/*
|
||||
* Some Loongson PCIe ports have h/w limitations of maximum read
|
||||
* request size. They can't handle anything larger than this. So
|
||||
* force this limit on any devices attached under these ports.
|
||||
*/
|
||||
struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus);
|
||||
|
||||
/* look for the matching bridge */
|
||||
while (!pci_is_root_bus(bus)) {
|
||||
bridge = bus->self;
|
||||
bus = bus->parent;
|
||||
/*
|
||||
* Some Loongson PCIe ports have a h/w limitation of
|
||||
* 256 bytes maximum read request size. They can't handle
|
||||
* anything larger than this. So force this limit on
|
||||
* any devices attached under these ports.
|
||||
*/
|
||||
if (pci_match_id(bridge_devids, bridge)) {
|
||||
if (pcie_get_readrq(dev) > 256) {
|
||||
pci_info(dev, "limiting MRRS to 256\n");
|
||||
pcie_set_readrq(dev, 256);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
bridge->no_inc_mrrs = 1;
|
||||
}
|
||||
DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, loongson_mrrs_quirk);
|
||||
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
|
||||
DEV_PCIE_PORT_0, loongson_mrrs_quirk);
|
||||
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
|
||||
DEV_PCIE_PORT_1, loongson_mrrs_quirk);
|
||||
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON,
|
||||
DEV_PCIE_PORT_2, loongson_mrrs_quirk);
|
||||
|
||||
static void __iomem *cfg1_map(struct loongson_pci *priv, int bus,
|
||||
unsigned int devfn, int where)
|
||||
|
||||
@@ -5961,6 +5961,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
|
||||
{
|
||||
u16 v;
|
||||
int ret;
|
||||
struct pci_host_bridge *bridge = pci_find_host_bridge(dev->bus);
|
||||
|
||||
if (rq < 128 || rq > 4096 || !is_power_of_2(rq))
|
||||
return -EINVAL;
|
||||
@@ -5979,6 +5980,15 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
|
||||
|
||||
v = (ffs(rq) - 8) << 12;
|
||||
|
||||
if (bridge->no_inc_mrrs) {
|
||||
int max_mrrs = pcie_get_readrq(dev);
|
||||
|
||||
if (rq > max_mrrs) {
|
||||
pci_info(dev, "can't set Max_Read_Request_Size to %d; max is %d\n", rq, max_mrrs);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
ret = pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
|
||||
PCI_EXP_DEVCTL_READRQ, v);
|
||||
|
||||
|
||||
@@ -563,6 +563,7 @@ struct pci_host_bridge {
|
||||
void *release_data;
|
||||
unsigned int ignore_reset_delay:1; /* For entire hierarchy */
|
||||
unsigned int no_ext_tags:1; /* No Extended Tags */
|
||||
unsigned int no_inc_mrrs:1; /* No Increase MRRS */
|
||||
unsigned int native_aer:1; /* OS may use PCIe AER */
|
||||
unsigned int native_pcie_hotplug:1; /* OS may use PCIe hotplug */
|
||||
unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */
|
||||
|
||||
Reference in New Issue
Block a user