* [PATCH v2 01/53] MIPS: PCI: xtalk-bridge: refuse device numbers past the last slot
[not found] <cover.1791890466.git.kaloz@kernel.org>
@ 2026-10-13 13:16 ` Imre Kaloz
2026-12-05 13:28 ` Thomas Bogendoerfer
2026-10-13 13:16 ` [PATCH v2 03/53] MIPS: PCI: xtalk-bridge: write a type 1 IOC3 through the type 1 window Imre Kaloz
1 sibling, 1 reply; 4+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:16 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: linux-mips, linux-kernel, Lee Jones, stable, linux-pci
Config slots 8 and up alias the type 1 window, so a root bus scan finds
phantom copies of whatever device b_pci_cfg selects. Refuse root bus
accesses past the ASIC's last slot.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
arch/mips/pci/pci-xtalk-bridge.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
index cf115abb54e0..9451b7546068 100644
--- a/arch/mips/pci/pci-xtalk-bridge.c
+++ b/arch/mips/pci/pci-xtalk-bridge.c
@@ -92,6 +92,11 @@ static int ioc3_cfg_wr(void *addr, int where, int size, u32 value)
return PCIBIOS_SUCCESSFUL;
}
+static int bridge_nslots(struct bridge_controller *bc)
+{
+ return BRIDGE_DEV_CNT;
+}
+
static void bridge_disable_swapping(struct pci_dev *dev)
{
struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
@@ -127,6 +132,13 @@ static int pci_conf0_read_config(struct pci_bus *bus, unsigned int devfn,
u32 cf;
int res;
+ /*
+ * Only bridge_nslots() slots exist. Config slots 8 and up alias the
+ * type 1 window and would answer for whatever b_pci_cfg selects.
+ */
+ if (slot >= bridge_nslots(bc))
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
if (get_dbe(cf, (u32 *)addr))
return PCIBIOS_DEVICE_NOT_FOUND;
@@ -212,6 +224,9 @@ static int pci_conf0_write_config(struct pci_bus *bus, unsigned int devfn,
u32 cf;
int res;
+ if (slot >= bridge_nslots(bc))
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID];
if (get_dbe(cf, (u32 *)addr))
return PCIBIOS_DEVICE_NOT_FOUND;
@@ -695,7 +710,7 @@ static int bridge_probe(struct platform_device *pdev)
bridge_write(bc, b_dir_map, (bd->masterwid << 20)); /* DMA */
bridge_write(bc, b_int_enable, 0);
- for (slot = 0; slot < 8; slot++) {
+ for (slot = 0; slot < bridge_nslots(bc); slot++) {
bridge_set(bc, b_device[slot].reg, BRIDGE_DEV_SWAP_DIR);
bc->pci_int[slot][0] = -1;
bc->pci_int[slot][1] = -1;
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 03/53] MIPS: PCI: xtalk-bridge: write a type 1 IOC3 through the type 1 window
[not found] <cover.1791890466.git.kaloz@kernel.org>
2026-10-13 13:16 ` [PATCH v2 01/53] MIPS: PCI: xtalk-bridge: refuse device numbers past the last slot Imre Kaloz
@ 2026-10-13 13:16 ` Imre Kaloz
2026-12-05 13:29 ` Thomas Bogendoerfer
1 sibling, 1 reply; 4+ messages in thread
From: Imre Kaloz @ 2026-10-13 13:16 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: linux-mips, linux-kernel, Lee Jones, stable, linux-pci
The IOC3 case of the type 1 config write goes through the root bus
slot's type 0 window and so writes a different device. Use the type 1
window, as the matching read does.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
arch/mips/pci/pci-xtalk-bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
index 2fa9ac8d0a1c..18251a68fa06 100644
--- a/arch/mips/pci/pci-xtalk-bridge.c
+++ b/arch/mips/pci/pci-xtalk-bridge.c
@@ -277,7 +277,7 @@ static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
* generic PCI code a chance to look at it for real ...
*/
if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) {
- addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
+ addr = &bridge->b_type1_cfg.c[(fn << 8) | (where & ~3)];
return ioc3_cfg_wr(addr, where, size, value);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 01/53] MIPS: PCI: xtalk-bridge: refuse device numbers past the last slot
2026-10-13 13:16 ` [PATCH v2 01/53] MIPS: PCI: xtalk-bridge: refuse device numbers past the last slot Imre Kaloz
@ 2026-12-05 13:28 ` Thomas Bogendoerfer
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2026-12-05 13:28 UTC (permalink / raw)
To: Imre Kaloz; +Cc: linux-mips, linux-kernel, Lee Jones, stable, linux-pci
On Tue, Oct 13, 2026 at 03:16:21PM +0200, Imre Kaloz wrote:
> Config slots 8 and up alias the type 1 window, so a root bus scan finds
> phantom copies of whatever device b_pci_cfg selects. Refuse root bus
> accesses past the ASIC's last slot.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Imre Kaloz <kaloz@kernel.org>
> ---
> arch/mips/pci/pci-xtalk-bridge.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
applied to mips-next
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 03/53] MIPS: PCI: xtalk-bridge: write a type 1 IOC3 through the type 1 window
2026-10-13 13:16 ` [PATCH v2 03/53] MIPS: PCI: xtalk-bridge: write a type 1 IOC3 through the type 1 window Imre Kaloz
@ 2026-12-05 13:29 ` Thomas Bogendoerfer
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2026-12-05 13:29 UTC (permalink / raw)
To: Imre Kaloz; +Cc: linux-mips, linux-kernel, Lee Jones, stable, linux-pci
On Tue, Oct 13, 2026 at 03:16:23PM +0200, Imre Kaloz wrote:
> The IOC3 case of the type 1 config write goes through the root bus
> slot's type 0 window and so writes a different device. Use the type 1
> window, as the matching read does.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Imre Kaloz <kaloz@kernel.org>
> ---
> arch/mips/pci/pci-xtalk-bridge.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
> index 2fa9ac8d0a1c..18251a68fa06 100644
> --- a/arch/mips/pci/pci-xtalk-bridge.c
> +++ b/arch/mips/pci/pci-xtalk-bridge.c
> @@ -277,7 +277,7 @@ static int pci_conf1_write_config(struct pci_bus *bus, unsigned int devfn,
> * generic PCI code a chance to look at it for real ...
> */
> if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) {
> - addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2];
> + addr = &bridge->b_type1_cfg.c[(fn << 8) | (where & ~3)];
> return ioc3_cfg_wr(addr, where, size, value);
> }
>
> --
> 2.47.3
applied to mips-next
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-05 13:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1791890466.git.kaloz@kernel.org>
2026-10-13 13:16 ` [PATCH v2 01/53] MIPS: PCI: xtalk-bridge: refuse device numbers past the last slot Imre Kaloz
2026-12-05 13:28 ` Thomas Bogendoerfer
2026-10-13 13:16 ` [PATCH v2 03/53] MIPS: PCI: xtalk-bridge: write a type 1 IOC3 through the type 1 window Imre Kaloz
2026-12-05 13:29 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox