Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Agustin Santiago Isasmendi <isasmendi.agus@gmail.com>
To: "Stefan Dösinger" <stefandoesinger@gmail.com>
Cc: Navid Ghahremani <ghahramani.navid@gmail.com>,
	linux-arm-kernel@lists.infradead.org, arnd@arndb.de,
	krzk@kernel.org
Subject: Re: [PATCH v2 00/24] ARM: zte: Add support for Sanechips ZX279128S and ZTE ZXHN H3600
Date: Thu, 12 Nov 2026 17:10:56 +0100	[thread overview]
Message-ID: <20261112161056.2278061-1-isasmendi.agus@gmail.com> (raw)
In-Reply-To: <Lv-2l5qpSwW-LGAsxs8loQ@gmail.com>

Hi Stefan,

On Thu, Nov 12, 2026 at 01:02, Stefan Dösinger wrote:
> Is it possible to program PCIe mmio areas as uncached in the level 2 cache or
> tell the cache to ignore a certain address range in some way? If it is
> possible, is it enough to prevent the crash?

The PCIe registers are already uncached.  The problem is that on this
chip every access from the CPUs goes through the L2 cache controller,
cached or not, and that controller is where it gets stuck.  This is how
it looks from my tests (there is no public documentation of the
chip's internals, so the picture is what the experiments show, not a
datasheet):

   CPU0      CPU1
     |         |
   +-------------+
   |     SCU     |   <- filter: can send a range to its 2nd port
   +-------------+
     |         |
   +-------------+
   |     L2C     |   <- both SCU ports end up here
   +-------------+
     |         |      <- filter: RAM on one port, the rest on the other
    RAM     PCIe, switch,
            other devices

How I got the picture:

- L2C filter: read back at boot, RAM goes out of one port and
  everything else out of the other.  Using it for the PCIe range moves
  RAM to the wrong port and the board doesn't boot.
- SCU 2nd port: RAM reads sent through it still show up in the L2C
  counters and return data that was only in the L2, so that port goes
  into the L2C too.  With the PCIe range on it, PCIe works but the
  board still hangs, 3 boots out of 3.

So both filters only change which port an access uses; neither lets it
skip the L2 cache controller.  Test code and logs are available if
anyone wants them.

> Do you have a guess what's special about the PCI address space that it
> triggers the issue? It sounds like it doesn't affect other hardware or RAM,
> otherwise ZTE would have disabled (or just fixed) the cache entirely.

It only hangs when three things happen together:

- one CPU reads a register of the PCIe card,
- the other CPU asks the L2 cache controller to do some work (the
  kernel does this all the time, e.g. on every writel()),
- the PCIe card is busy on its own (WiFi up).

With the WiFi down, 150 million PCIe reads did not hang it, even with
the other CPU keeping the L2 cache controller busy the whole time.
Why exactly these three block each other inside the chip I can't tell
without Sanechips' documentation.

This is a known problem.  Marvell had the same one in 2014, and ARM
(Catalin Marinas) said the rule is simply: don't access the L2 cache
controller and PCIe from the CPUs at the same time.

  https://lore.kernel.org/r/20140407121304.GD3360@arm.com

Marvell could avoid it because on their chip all devices share the
CPU caches, and they also turned off the extra L2 work the kernel does
on every writel(), so the kernel almost never has to talk to the L2
cache controller.  On our chip only the PCIe (and probably USB)
devices can share the caches, after setting a few registers that
ZTE's own kernel sets.  The Ethernet switch can't, so that extra work
on every writel() has to stay, and that alone is enough to hang it: I
ran ZTE's exact setup without its lock and the board hung the same
way.  That is why ZTE needs the lock.  Making PCIe share the caches
may be worth having on its own; I'll measure it and can send it
separately.

> What does "TRM" mean in this context?

Technical Reference Manual, ARM's documentation for the L2 cache
controller.

So my suggestion for the ZX279128S device tree is still to keep the L2
cache off (status = "disabled" on the L2 cache node, with the patch
below).  It is the only option that can't break with whatever drivers
come later, and the cost is acceptable for a router: forwarding with
the hardware offload is unchanged, only memory-heavy work on the CPU
gets slower.  The lock works but was found too invasive, and the
lock-free variants depend on every DMA user being coherent, which the
switch can't be.

The v2 of the patch, with the change Arnd agreed to:
https://lore.kernel.org/r/20261112072953.989664-1-isasmendi.agus@gmail.com

Agustin


      reply	other threads:[~2026-11-12 16:12 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  7:20 [PATCH v2 00/24] ARM: zte: Add support for Sanechips ZX279128S and ZTE ZXHN H3600 Navid Ghahremani
2026-10-14  7:20 ` [PATCH v2 01/24] MAINTAINERS: Consolidate ARM/ZTE ZX SOC SUPPORT with Stefan Doesinger Navid Ghahremani
2026-10-14 20:11   ` Stefan Dösinger
2026-10-14  7:20 ` [PATCH v2 02/24] dt-bindings: arm: Add ZTE ZX279128S platform descriptions Navid Ghahremani
2026-10-27 21:30   ` Rob Herring (Arm)
2026-10-14  7:20 ` [PATCH v2 03/24] ARM: zte: Add ZX279128S platform and CPU hotplug support Navid Ghahremani
2026-10-14  7:20 ` [PATCH v2 04/24] dt-bindings: clock: Add ZTE ZX279128S CRM clock bindings Navid Ghahremani
2026-10-14 21:48   ` Stefan Dösinger
2026-10-15  9:25   ` Krzysztof Kozlowski
2026-10-15  9:26   ` Krzysztof Kozlowski
2026-10-14  7:20 ` [PATCH v2 05/24] dt-bindings: reset: Add ZTE ZX279128S reset controller bindings Navid Ghahremani
2026-10-15  9:27   ` Krzysztof Kozlowski
2026-10-14  7:20 ` [PATCH v2 06/24] clk: zte: Add ZX279128S CRM clock and reset driver Navid Ghahremani
2026-10-14 13:21   ` Philipp Zabel
2026-10-14 19:39   ` Stefan Dösinger
2026-10-14  7:20 ` [PATCH v2 07/24] dt-bindings: gpio: Add ZTE ZX279128S GPIO controller Navid Ghahremani
2026-10-27 21:31   ` Rob Herring (Arm)
2026-10-14  7:20 ` [PATCH v2 08/24] gpio: Add ZTE ZX279128S GPIO driver Navid Ghahremani
2026-10-14 21:11   ` Stefan Dösinger
2026-10-15 12:25   ` Bartosz Golaszewski
2026-10-14  7:20 ` [PATCH v2 09/24] dt-bindings: pinctrl: pinctrl-single: Add ZTE ZX279128S pin mux Navid Ghahremani
2026-10-17 16:20   ` Krzysztof Kozlowski
2026-10-14  7:20 ` [PATCH v2 10/24] dt-bindings: phy: Add ZTE ZX279128S PCIe PHY binding Navid Ghahremani
2026-10-15  9:29   ` Krzysztof Kozlowski
2026-10-14  7:20 ` [PATCH v2 11/24] phy: zte: Add ZTE ZX279128S PCIe PHY driver Navid Ghahremani
2026-11-06 10:13   ` Agustin Santiago Isasmendi
2026-10-14  7:20 ` [PATCH v2 12/24] dt-bindings: PCI: Add ZTE ZX279128S host controller Navid Ghahremani
2026-10-27 21:40   ` Rob Herring
2026-10-14  7:20 ` [PATCH v2 13/24] PCI: dwc: Add ZTE ZX279128S host controller driver Navid Ghahremani
2026-10-14 13:19   ` Bjorn Helgaas
2026-10-14 21:06     ` Stefan Dösinger
2026-10-14  7:20 ` [PATCH v2 14/24] dt-bindings: net: Add ZTE ZX279128S MDIO controller Navid Ghahremani
2026-10-27 21:34   ` Rob Herring (Arm)
2026-10-14  7:20 ` [PATCH v2 15/24] net: mdio: " Navid Ghahremani
2026-10-14 12:13   ` Andrew Lunn
2026-10-14  7:20 ` [PATCH v2 16/24] net: phy: Add Sanechips ZX5201 PHY support Navid Ghahremani
2026-10-14 12:37   ` Andrew Lunn
2026-10-14  7:20 ` [PATCH v2 17/24] dt-bindings: net: Add ZTE ZX279128S Ethernet switch Navid Ghahremani
2026-10-27 21:48   ` Rob Herring
2026-10-14  7:20 ` [PATCH v2 18/24] net: ethernet: zte: Add ZX279128S Ethernet switch driver Navid Ghahremani
2026-10-14  7:20 ` [PATCH v2 19/24] dt-bindings: spi: Add ZTE ZX family SPI flash controller binding Navid Ghahremani
2026-10-14 20:33   ` Stefan Dösinger
2026-10-15  9:35   ` Krzysztof Kozlowski
2026-10-15  9:36   ` Krzysztof Kozlowski
2026-10-14  7:21 ` [PATCH v2 20/24] spi: zx: Add ZTE ZX family SPI flash controller driver Navid Ghahremani
2026-10-14 19:28   ` Stefan Dösinger
2026-10-15  9:34   ` Krzysztof Kozlowski
2026-10-15 14:29   ` kernel test robot
2026-10-19 12:15   ` Stefan Dösinger
2026-10-14  7:21 ` [PATCH v2 21/24] dt-bindings: usb: Add ZTE ZX279128S DWC3 controller Navid Ghahremani
2026-10-14  7:21 ` [PATCH v2 22/24] usb: dwc3: generic-plat: Add ZTE ZX279128S Navid Ghahremani
2026-11-04  0:48   ` Thinh Nguyen
2026-10-14  7:21 ` [PATCH v2 23/24] ARM: dts: zte: Add ZX279128S SoC description Navid Ghahremani
2026-10-14  7:21 ` [PATCH v2 24/24] ARM: dts: zte: Add ZTE ZXHN H3600 board Navid Ghahremani
2026-10-14 12:52   ` Andrew Lunn
2026-11-06 10:13   ` Agustin Santiago Isasmendi
2026-10-14 20:00 ` [PATCH v2 00/24] ARM: zte: Add support for Sanechips ZX279128S and ZTE ZXHN H3600 Stefan Dösinger
2026-11-06 10:11 ` Agustin Santiago Isasmendi
2026-11-06 19:08 ` Agustin Santiago Isasmendi
2026-11-08 11:09   ` Stefan Dösinger
2026-11-10 15:35     ` Agustin Santiago Isasmendi
2026-11-11 22:02       ` Stefan Dösinger
2026-11-12 16:10         ` Agustin Santiago Isasmendi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112161056.2278061-1-isasmendi.agus@gmail.com \
    --to=isasmendi.agus@gmail.com \
    --cc=arnd@arndb.de \
    --cc=ghahramani.navid@gmail.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=stefandoesinger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox