Commit 658f7ecd authored by Naveen Naidu's avatar Naveen Naidu Committed by Bjorn Helgaas

PCI: thunder: Drop error data fabrication when config read fails

If config pci_ops.read() methods return failure, the PCI_OP_READ() and
PCI_USER_READ_CONFIG() wrappers use PCI_SET_ERROR_RESPONSE() to set the
data value, so there's no need to set it in the pci_ops.read() methods
themselves.

Drop the unnecessary data value fabrication when pci_ops.read() fails.

Link: https://lore.kernel.org/r/22f471b638276422926c49f3d42ac41bc7b28b3d.1637243717.git.naveennaidu479@gmail.comSigned-off-by: default avatarNaveen Naidu <naveennaidu479@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 316df706
...@@ -41,10 +41,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, ...@@ -41,10 +41,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
} }
if (where_a == 0x4) { if (where_a == 0x4) {
addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
v = readl(addr); v = readl(addr);
v &= ~0xf; v &= ~0xf;
v |= 2; /* EA entry-1. Base-L */ v |= 2; /* EA entry-1. Base-L */
...@@ -56,10 +55,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, ...@@ -56,10 +55,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
u32 barl_rb; u32 barl_rb;
addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
barl_orig = readl(addr + 0); barl_orig = readl(addr + 0);
writel(0xffffffff, addr + 0); writel(0xffffffff, addr + 0);
barl_rb = readl(addr + 0); barl_rb = readl(addr + 0);
...@@ -72,10 +70,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, ...@@ -72,10 +70,9 @@ static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus,
} }
if (where_a == 0xc) { if (where_a == 0xc) {
addr = bus->ops->map_bus(bus, devfn, bar + 4); /* BAR 1 */ addr = bus->ops->map_bus(bus, devfn, bar + 4); /* BAR 1 */
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
v = readl(addr); /* EA entry-3. Base-H */ v = readl(addr); /* EA entry-3. Base-H */
set_val(v, where, size, val); set_val(v, where, size, val);
return PCIBIOS_SUCCESSFUL; return PCIBIOS_SUCCESSFUL;
...@@ -104,10 +101,8 @@ static int thunder_ecam_p2_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -104,10 +101,8 @@ static int thunder_ecam_p2_config_read(struct pci_bus *bus, unsigned int devfn,
} }
addr = bus->ops->map_bus(bus, devfn, where_a); addr = bus->ops->map_bus(bus, devfn, where_a);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
v = readl(addr); v = readl(addr);
...@@ -135,10 +130,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -135,10 +130,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
int where_a = where & ~3; int where_a = where & ~3;
addr = bus->ops->map_bus(bus, devfn, 0xc); addr = bus->ops->map_bus(bus, devfn, 0xc);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
v = readl(addr); v = readl(addr);
...@@ -146,10 +139,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -146,10 +139,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
cfg_type = (v >> 16) & 0x7f; cfg_type = (v >> 16) & 0x7f;
addr = bus->ops->map_bus(bus, devfn, 8); addr = bus->ops->map_bus(bus, devfn, 8);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
class_rev = readl(addr); class_rev = readl(addr);
if (class_rev == 0xffffffff) if (class_rev == 0xffffffff)
...@@ -176,10 +167,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -176,10 +167,8 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
} }
addr = bus->ops->map_bus(bus, devfn, 0); addr = bus->ops->map_bus(bus, devfn, 0);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
vendor_device = readl(addr); vendor_device = readl(addr);
if (vendor_device == 0xffffffff) if (vendor_device == 0xffffffff)
...@@ -196,10 +185,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -196,10 +185,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
bool is_tns = (vendor_device == 0xa01f177d); bool is_tns = (vendor_device == 0xa01f177d);
addr = bus->ops->map_bus(bus, devfn, 0x70); addr = bus->ops->map_bus(bus, devfn, 0x70);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
/* E_CAP */ /* E_CAP */
v = readl(addr); v = readl(addr);
has_msix = (v & 0xff00) != 0; has_msix = (v & 0xff00) != 0;
...@@ -211,10 +199,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -211,10 +199,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
} }
if (where_a == 0xb0) { if (where_a == 0xb0) {
addr = bus->ops->map_bus(bus, devfn, where_a); addr = bus->ops->map_bus(bus, devfn, where_a);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
v = readl(addr); v = readl(addr);
if (v & 0xff00) if (v & 0xff00)
pr_err("Bad MSIX cap header: %08x\n", v); pr_err("Bad MSIX cap header: %08x\n", v);
...@@ -268,10 +255,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, ...@@ -268,10 +255,9 @@ static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn,
if (where_a == 0x70) { if (where_a == 0x70) {
addr = bus->ops->map_bus(bus, devfn, where_a); addr = bus->ops->map_bus(bus, devfn, where_a);
if (!addr) { if (!addr)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
v = readl(addr); v = readl(addr);
if (v & 0xff00) if (v & 0xff00)
pr_err("Bad PCIe cap header: %08x\n", v); pr_err("Bad PCIe cap header: %08x\n", v);
......
...@@ -41,10 +41,8 @@ static int thunder_pem_bridge_read(struct pci_bus *bus, unsigned int devfn, ...@@ -41,10 +41,8 @@ static int thunder_pem_bridge_read(struct pci_bus *bus, unsigned int devfn,
struct pci_config_window *cfg = bus->sysdata; struct pci_config_window *cfg = bus->sysdata;
struct thunder_pem_pci *pem_pci = (struct thunder_pem_pci *)cfg->priv; struct thunder_pem_pci *pem_pci = (struct thunder_pem_pci *)cfg->priv;
if (devfn != 0 || where >= 2048) { if (devfn != 0 || where >= 2048)
*val = ~0;
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
}
/* /*
* 32-bit accesses only. Write the address to the low order * 32-bit accesses only. Write the address to the low order
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment