Skip to content

[PW_SID:976535] Support the Cadence MACB/GEM instances on Mobileye EyeQ5 SoCs#584

Closed
linux-riscv-bot wants to merge 19 commits into
workflow__riscv__fixesfrom
pw976535
Closed

[PW_SID:976535] Support the Cadence MACB/GEM instances on Mobileye EyeQ5 SoCs#584
linux-riscv-bot wants to merge 19 commits into
workflow__riscv__fixesfrom
pw976535

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 976535 applied to workflow__riscv__fixes

Name: Support the Cadence MACB/GEM instances on Mobileye EyeQ5 SoCs
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=976535
Version: 2

Linux RISC-V bot and others added 19 commits June 24, 2025 01:05
Compatibles inside this enum are sorted-ish. Make it sorted.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add cdns,eyeq5-gem as compatible for the integrated GEM block inside
Mobileye EyeQ5 SoCs. Add a phandle (and two offset arguments) for
accessing syscon registers.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Allow providing tsu_clk without a tx_clk as both are optional.

This is about relaxing unneeded constraints. It so happened that in the
past HW that needed a tsu_clk always needed a tx_clk.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
On EyeQ5, the GEM DMA controller is coherent with the CPU;
allow specifying the information.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace all capabilities values by calls to the BIT() macro.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Remove local variables clk_init and init. Those function pointers are
always equivalent to macb_config->clk_init and macb_config->init.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Remove NULL checks on macb_config as it is always valid:
 - either it is its default value &default_gem_config,
 - or it got overridden using match data.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Introduce macb_dma_is_64b() and macb_dma_is_ptp() helper functions.
Many codepaths are made simpler by dropping conditional compilation.

This implies three changes:
 - Always compile related structure definitions inside <macb.h>.
 - Make the field hw_dma_cap in struct macb always present.
 - MACB_EXT_DESC can be dropped as it is useless now.

The common case is:

	#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
		struct macb_dma_desc_64 *desc_64;
		if (bp->hw_dma_cap & HW_DMA_CAP_64B) {
			desc_64 = macb_64b_desc(bp, desc);
			// ...
		}
	#endif

And replaced by:

	struct macb_dma_desc_64 *desc_64;
	if (macb_dma_is_64b(bp)) {
		desc_64 = macb_64b_desc(bp, desc);
		// ...
	}

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Sort #include preprocessor directives.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The MACB driver acts as if TBQPH/RBQPH are configurable on a per queue
basis; this is a lie. A single register configures the upper 32 bits of
each DMA descriptor buffers for all queues.

Concrete actions:

 - Drop GEM_TBQPH/GEM_RBQPH macros which have a queue index argument.
   Only use MACB_TBQPH/MACB_RBQPH constants.

 - Drop struct macb_queue->TBQPH/RBQPH fields.

 - In macb_init_buffers(): do a single write to TBQPH and RBQPH for all
   queues instead of a write per queue.

 - In macb_tx_error_task(): drop the write to TBQPH.

 - In macb_alloc_consistent(): if allocations give different upper
   32-bits, fail. Previously, it would have lead to silent memory
   corruption as queues would have used the upper 32 bits of the alloc
   from queue 0 and their own low 32 bits.

 - In macb_suspend(): if we use the tie off descriptor for suspend, do
   the write once for all queues instead of once per queue.

Fixes: fff8019 ("net: macb: Add 64 bit addressing support for GEM")
Fixes: ae1f2a5 ("net: macb: Added support for many RX queues")
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move from two (Tx/Rx) dma_alloc_coherent() for DMA descriptor rings *per
queue* to two dma_alloc_coherent() overall.

Issue is with how all queues share the same register for configuring the
upper 32-bits of Tx/Rx descriptor rings. For example, with Tx, notice
how TBQPH does *not* depend on the queue index:

	#define GEM_TBQP(hw_q)		(0x0440 + ((hw_q) << 2))
	#define GEM_TBQPH(hw_q)		(0x04C8)

	queue_writel(queue, TBQP, lower_32_bits(queue->tx_ring_dma));
	#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
	if (bp->hw_dma_cap & HW_DMA_CAP_64B)
		queue_writel(queue, TBQPH, upper_32_bits(queue->tx_ring_dma));
	#endif

To maxime our chances of getting valid DMA addresses, we do a single
dma_alloc_coherent() across queues. This improves the odds because
alloc_pages() guarantees natural alignment. It cannot ensure valid DMA
addresses because of IOMMU or codepaths that don't go through
alloc_pages().

We error out if all rings don't have the same upper 32 bits, which is
better than the current (theoretical, not reproduced) silent corruption
caused by hardware that accesses invalid addresses.

Two considerations:
 - dma_alloc_coherent() gives us page alignment. Here we remove this
   containst meaning each queue's ring won't be page-aligned anymore.
 - This can save some memory. Less allocations means less overhead
   (constant cost per alloc) and less wasted bytes due to alignment
   constraints.

Fixes: 02c958d ("net/macb: add TX multiqueue support for gem")
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
If HW is RSC capable, it cannot add dummy bytes at the start of IP
packets. Alignment (ie number of dummy bytes) is configured using the
RBOF field inside the NCFGR register.

On the software side, the skb_reserve(skb, NET_IP_ALIGN) call must only
be done if those dummy bytes are added by the hardware; notice the
skb_reserve() is done AFTER writing the address to the device.

We cannot do the skb_reserve() call BEFORE writing the address because
the address field ignores the low 2/3 bits. Conclusion: in some cases,
we risk not being able to respect the NET_IP_ALIGN value (which is
picked based on unaligned CPU access performance).

Fixes: 4df9513 ("net/macb: change RX path for GEM")
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
writel() does a CPU->LE conversion. Drop manual cpu_to_le*() calls.

On little-endian system:
 - cpu_to_le32() is a no-op (LE->LE),
 - writel() is a no-op (LE->LE),
 - dev_addr will therefore not be swapped and written as-is.

On big-endian system:
 - cpu_to_le32() is a swap (BE->LE),
 - writel() is a swap (BE->LE),
 - dev_addr will therefore be swapped twice and written as a BE value.

This was found using sparse:
   ⟩ make C=2 drivers/net/ethernet/cadence/macb_main.o
   warning: incorrect type in assignment (different base types)
      expected unsigned int [usertype] bottom
      got restricted __le32 [usertype]
   warning: incorrect type in assignment (different base types)
      expected unsigned short [usertype] top
      got restricted __le16 [usertype]
   ...

Fixes: 89e5785 ("[PATCH] Atmel MACB ethernet driver")
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
LSO is runtime-detected using the PBUF_LSO field inside register
designcfg_debug6/GEM_DCFG6. Allow disabling that feature if it is
broken by using struct macb_config->caps.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add support for the two GEM instances inside Mobileye EyeQ5 SoCs, using
compatible "mobileye,eyeq5-gem". With it, add a custom init sequence
that accesses two system-controller registers.

Noteworthy: NET_IP_ALIGN=2 on MIPS but the hardware does not align and
low bits aren't configurable, so we cannot respect the requested IP
header alignment.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Both Cadence GEM Ethernet controllers on EyeQ5 are hardwired through CM3
IO Coherency Units (IOCU). For DMA coherent accesses, BIT(36) must be
set in DMA addresses.

Implement that in platform-specific dma_map_ops which get attached to
both instances of `cdns,eyeq5-gem` through a notifier block.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add both MACB/GEM instances found in the Mobileye EyeQ5 SoC.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The Mobileye EyeQ5 eval board (EPM) embeds two MDIO PHYs.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.44 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 919.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1245.64 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.97 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.93 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.71 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 71.93 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
kdoc
Desc: Detects for kdoc errors
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[net-next,v2,01/18] dt-bindings: net: cdns,macb: sort compatibles"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 16: "[net-next,v2,16/18] MIPS: mobileye: add EyeQ5 DMA IOCU support"
module-param
Desc: Detect module_param changes
Duration: 0.36 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 16: "[net-next,v2,16/18] MIPS: mobileye: add EyeQ5 DMA IOCU support"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 16: "[net-next,v2,16/18] MIPS: mobileye: add EyeQ5 DMA IOCU support"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 103.50 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 925.78 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1254.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.57 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.78 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 71.64 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
kdoc
Desc: Detects for kdoc errors
Duration: 0.96 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
module-param
Desc: Detect module_param changes
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 17: "[net-next,v2,17/18] MIPS: mobileye: eyeq5: add two Cadence GEM Ethernet controllers"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.34 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.95 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 925.04 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1249.60 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.94 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.73 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 71.67 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 18: "[net-next,v2,18/18] MIPS: mobileye: eyeq5-epm: add two Cadence GEM Ethernet PHYs"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from a7cb30d to d776861 Compare July 2, 2025 18:46
@linux-riscv-bot linux-riscv-bot deleted the pw976535 branch July 5, 2025 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants