mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: sgi: ioc3-eth: two changes for the IOC3 on SGI IP35 machines
@ 2026-11-11  9:51 Imre Kaloz
  2026-11-11  9:51 ` [PATCH net-next 1/2] net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses Imre Kaloz
  2026-11-11  9:51 ` [PATCH net-next 2/2] net: sgi: ioc3-eth: fall back to the platform MAC address Imre Kaloz
  0 siblings, 2 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-11-11  9:51 UTC (permalink / raw)
  To: Thomas Bogendoerfer, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-mips, linux-kernel

With the IP35 support series [1] posted, these two changes let ioc3-eth
drive the IOC3 of the SGI Fuel, which sits behind an XBridge and has no
MAC PROM.

Patch 1 applies the DMA attributes and the RX barrier's upper address
bits only to 64-bit direct-mapped addresses, so the IOC3 can use a
bridge's 32-bit direct window. Patch 2 asks
eth_platform_get_mac_address() when the 1-wire MAC PROM read fails,
and uses a random address once deferred probing gives up.

Both were posted as 25/53 and 38/53 of the IP35 series v2 [1] and are
reposted on their own for net-next, as Jakub asked [2]. The rest of that
series puts an IOC3 behind an XBridge or PIC on the 32-bit window and
supplies the MAC address from the L1 system controller. There is no
build dependency in either direction, and IOC3 Ethernet on IP35 machines
needs both sides.

Tested on an SGI Fuel.

[1] https://lore.kernel.org/all/cover.1791890466.git.kaloz@kernel.org/
[2] https://lore.kernel.org/all/20261021073921.07632a37@kernel.org/

Imre Kaloz (2):
  net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses
  net: sgi: ioc3-eth: fall back to the platform MAC address

 drivers/net/ethernet/sgi/ioc3-eth.c | 43 ++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 7 deletions(-)


base-commit: 97ced2c090bfc2156db31fca9f52cf253e4bc186
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net-next 1/2] net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses
  2026-11-11  9:51 [PATCH net-next 0/2] net: sgi: ioc3-eth: two changes for the IOC3 on SGI IP35 machines Imre Kaloz
@ 2026-11-11  9:51 ` Imre Kaloz
  2026-11-11  9:51 ` [PATCH net-next 2/2] net: sgi: ioc3-eth: fall back to the platform MAC address Imre Kaloz
  1 sibling, 0 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-11-11  9:51 UTC (permalink / raw)
  To: Thomas Bogendoerfer, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-mips, linux-kernel

A Bridge 64-bit direct-mapped DMA address carries the target widget and
the DMA attributes. An address in the 2GB 32-bit direct window carries
neither, so attributes OR-ed onto one aim it at widget 0, and every
receive raises a PCI error.

Apply them, and the RX barrier's upper address bits, only to 64-bit
addresses. IP27 and IP30 give the IOC3 64-bit addresses; behind an
XBridge or PIC it can use the window.

Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
Previously posted as 25/53 of the IP35 series v2: https://lore.kernel.org/all/cover.1791890466.git.kaloz@kernel.org/

 drivers/net/ethernet/sgi/ioc3-eth.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index 009f37105eaf..25139cf5ff62 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -152,19 +152,37 @@ static inline int ioc3_alloc_skb(struct ioc3_private *ip, struct sk_buff **skb,
 }
 
 #ifdef CONFIG_PCI_XTALK_BRIDGE
+/* A Bridge 64-bit direct-mapped DMA address carries the target widget in
+ * bits 63:60 and the DMA attributes below it.  An address in the 32-bit
+ * direct window carries neither, so attributes OR-ed onto one form a
+ * 64-bit address aimed at widget 0.
+ */
 static inline unsigned long ioc3_map(dma_addr_t addr, unsigned long attr)
 {
+	if (!(addr & PCI64_ATTR_TARG_MASK))
+		return addr;
+
 	return (addr & ~PCI64_ATTR_BAR) | attr;
 }
 
-#define ERBAR_VAL	(ERBAR_BARRIER_BIT << ERBAR_RXBARR_SHIFT)
+/* The RX barrier's upper address bits follow the same form. */
+static inline u32 ioc3_erbar(dma_addr_t addr)
+{
+	if (!(addr & PCI64_ATTR_TARG_MASK))
+		return 0;
+
+	return ERBAR_BARRIER_BIT << ERBAR_RXBARR_SHIFT;
+}
 #else
 static inline unsigned long ioc3_map(dma_addr_t addr, unsigned long attr)
 {
 	return addr;
 }
 
-#define ERBAR_VAL	0
+static inline u32 ioc3_erbar(dma_addr_t addr)
+{
+	return 0;
+}
 #endif
 
 static int ioc3eth_nvmem_match(struct device *dev, const void *data)
@@ -727,7 +745,7 @@ static void ioc3_init(struct net_device *dev)
 	readl(&regs->emcr);
 
 	/* Misc registers  */
-	writel(ERBAR_VAL, &regs->erbar);
+	writel(ioc3_erbar(ip->rxr_dma), &regs->erbar);
 	readl(&regs->etcdc);			/* Clear on read */
 	writel(15, &regs->ercsr);		/* RX low watermark  */
 	writel(0, &regs->ertr);			/* Interrupt immediately */
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net-next 2/2] net: sgi: ioc3-eth: fall back to the platform MAC address
  2026-11-11  9:51 [PATCH net-next 0/2] net: sgi: ioc3-eth: two changes for the IOC3 on SGI IP35 machines Imre Kaloz
  2026-11-11  9:51 ` [PATCH net-next 1/2] net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses Imre Kaloz
@ 2026-11-11  9:51 ` Imre Kaloz
  1 sibling, 0 replies; 3+ messages in thread
From: Imre Kaloz @ 2026-11-11  9:51 UTC (permalink / raw)
  To: Thomas Bogendoerfer, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-mips, linux-kernel

The IOC3 on Fuel's system board has no MAC PROM on its 1-wire bus, so
ioc3eth_get_mac_addr() cannot succeed there and the probe defers for
ever. Ask eth_platform_get_mac_address() before deferring, so a platform
that knows the address can supply it. Once deferred probing gives up
with neither source answering, use a random address.

Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
Previously posted as 38/53 of the IP35 series v2: https://lore.kernel.org/all/cover.1791890466.git.kaloz@kernel.org/

 drivers/net/ethernet/sgi/ioc3-eth.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index 25139cf5ff62..5296614bf3fb 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -847,6 +847,7 @@ static int ioc3eth_probe(struct platform_device *pdev)
 {
 	u32 sw_physid1, sw_physid2, vendor, model, rev;
 	struct ioc3_private *ip;
+	bool random_mac = false;
 	struct net_device *dev;
 	struct resource *regs;
 	u8 mac_addr[6];
@@ -857,9 +858,16 @@ static int ioc3eth_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Invalid resource\n");
 		return -EINVAL;
 	}
-	/* get mac addr from one wire prom */
-	if (ioc3eth_get_mac_addr(regs, mac_addr))
-		return -EPROBE_DEFER; /* not available yet */
+	/* get mac addr from one wire prom, or from the platform */
+	if (ioc3eth_get_mac_addr(regs, mac_addr) &&
+	    eth_platform_get_mac_address(&pdev->dev, mac_addr)) {
+		err = driver_deferred_probe_check_state(&pdev->dev);
+		if (err == -EPROBE_DEFER)
+			return err; /* not available yet */
+
+		dev_warn(&pdev->dev, "no MAC address, using a random one\n");
+		random_mac = true;
+	}
 
 	dev = alloc_etherdev(sizeof(struct ioc3_private));
 	if (!dev)
@@ -938,7 +946,10 @@ static int ioc3eth_probe(struct platform_device *pdev)
 
 	ioc3_mii_start(ip);
 	ioc3_ssram_disc(ip);
-	eth_hw_addr_set(dev, mac_addr);
+	if (random_mac)
+		eth_hw_addr_random(dev);
+	else
+		eth_hw_addr_set(dev, mac_addr);
 
 	/* The IOC3-specific entries in the device structure. */
 	dev->watchdog_timeo	= 5 * HZ;
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-11  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  9:51 [PATCH net-next 0/2] net: sgi: ioc3-eth: two changes for the IOC3 on SGI IP35 machines Imre Kaloz
2026-11-11  9:51 ` [PATCH net-next 1/2] net: sgi: ioc3-eth: apply the DMA attributes only to 64-bit addresses Imre Kaloz
2026-11-11  9:51 ` [PATCH net-next 2/2] net: sgi: ioc3-eth: fall back to the platform MAC address Imre Kaloz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®