mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Magnus Lindholm <linmag7@gmail.com>
To: davem@davemloft.net, andreas@gaisler.com
Cc: sam@ravnborg.org, sparclinux@vger.kernel.org,
	linux-kernel@vger.kernel.org, linmag7@gmail.com
Subject: [PATCH 00/18] sparc32: LEON SMP, timer accounting and legacy board support
Date: Thu, 26 Nov 2026 10:30:05 +0100	[thread overview]
Message-ID: <20261126093106.1345825-1-linmag7@gmail.com> (raw)

This series fixes four problems on LEON SMP and restores Linux boot
on the dual-CPU GR-LEON4-ITX with its factory U-Boot. Patches 1-4 can
be merged separately from the firmware and board support. Patch 1
gives cross-call IRQ15 highest priority so a lower-numbered interrupt
cannot block it at the controller. Patches 2 and 3 fix stale TLB and
I-cache entries on remote CPUs. Patch 4 fixes nested timer IRQ
accounting that made idle CPUs appear fully busy.

Thanks to Sam for providing me with a LEON4 board for testing, and to
Andreas for helping make that possible. This work grew out of my
ongoing efforts to fix similar issues on legacy Sun systems with
SuperSPARC and HyperSPARC CPUs.

Base and prerequisites
----------------------
The base is Andreas Larsson's for-next at c95443b98771, plus two posted
patches from "sparc32: repair cache hooks, mappings and TLB tracking".

  [PATCH 8/9] sparc32: retain mm_cpumask across TLB shootdowns
  Message-ID: 20261108223516.1125534-9-linmag7@gmail.com

  [PATCH 9/9] sparc32: enroll and order CPUs before switching address spaces
  Message-ID: 20261108223516.1125534-10-linmag7@gmail.com

Patch 2 needs both. The generic SMP flush uses mm_cpumask to find CPUs
that may hold a translation. The prerequisites keep CPUs in that mask
across shootdowns and record each CPU before it enters an address space.

  https://lore.kernel.org/sparclinux/20261108223516.1125534-1-linmag7@gmail.com/

Factory U-Boot and memory
-------------------------
Patches 5-14 handle the legacy PROM console and machine identification,
preserve the Linux IRQ14 vector during startup and discover the AMBA
and I2C devices missing from the firmware tree. On this board, cached
LDSTUB lock acquisitions can stall. Patch 10 selects ASI 1 for kernel
and module locks when the GRLIB system ID matches 0x01020db4. Patch 11
restores the header offsets that factory U-Boot checks, at a cost of
32 KiB in LEON-enabled images.

Patches 15-16 recover 62 MiB of upper SDRAM. The factory PROM reports
only the lower 192 MiB minus 8 KiB. With the upper banks enabled,
importing U-Boot's SDRAM mappings leaves aliases in the kernel's I/O
and vmalloc areas. Linux skips that import on this board and checks the
PROM map, DDR2 geometry and active scanout before adding RAM. The 8 KiB
PROM and 2 MiB framebuffer reservation stay outside the page allocator.
Mapping and unmapping a HIGHMEM page incurs cache and TLB flushes on
both CPUs. The workload cost is unmeasured. Booting with mem=192M
keeps the original memory limit for comparison.

Patch 17 joins the APB control registers and AHB windows into the
single device expected by the GRPCI1 host driver. Patch 18 describes
the DS1672 at address 0x68 on I2CM0. The LEON4-ASIC-DEMO was also
sold as a standalone chip. System ID 0x01020db4 identifies the ASIC,
and I2CM0 is at 0xc0000700 on that chip.

Andreas, did any other carrier ship with this ASIC and the factory
GR-LEON4-ITX U-Boot? If so, is there a firmware property or board ID
we can use to tell which carriers have the DS1672? Patches 1-17 can
proceed while we confirm the match for patch 18.

Testing
-------
Hardware testing used a dual-CPU GR-LEON4-ITX with PREEMPT_VOLUNTARY.
The TLB, I-cache, timer and cross-CPU memory tests used integration
kernels with other pending sparc32 work, including earlier revisions of
the LEON changes. The module-reload comparisons used for-next and both
posted prerequisites, with the TLB fix as the only source difference
within each pair.

* During a HIGHMEM unmap, the Ethernet debug link (EDCL) showed CPU0
  spinning on the cross-call lock held by CPU1. CPU1 was waiting for
  CPU0 to acknowledge IRQ15. With patch 1, the board booted from the
  Maxtor and EDCL confirmed ILEVEL=0x800e with both CPUs online.
* In the TLB and I-cache tests, one CPU changed a mapping or rewrote
  an instruction. The other CPU read the page or executed the code. The
  baseline returned stale results. Each fix made the corresponding
  remote test pass. Repeated module loads also faulted without the TLB
  fix. With it, the corrected harness completed 74 load/unload cycles.
* In an earlier boot with patches 2-16 and both CPUs online, EDCL and
  a test module confirmed ASI 1 at kernel and module lock sites.
  The module's lock tests passed. In
  Gentoo, we checked per-CPU accounting at rest and with a workload
  pinned to one CPU. The idle CPU continued to report idle time.
* The CPUs took turns writing and verifying page patterns in both
  HIGHMEM banks. An EDCL page-table walk confirmed coverage above 98%
  in each bank, with all tested pages outside the reserved ranges
  and the 800x600 framebuffer active. A second walk found no inherited
  U-Boot SDRAM mappings in the PROM-import window.
* Gentoo booted from the Maxtor on a PCI 53C895 with sym53c8xx.burst=0.
  The stage3 install with bursts enabled logged 15 PCI master aborts
  (status 0x2000), each followed by a SCSI bus reset. The install with
  bursts disabled logged no master aborts. The cause is unknown.
  The DS1672 registered as rtc0 at boot, set the system clock and
  returned advancing times in two hwclock reads.

Before the IRQ15 change, an integration kernel with patches 2-18 booted
Gentoo on a dual HyperSPARC SS-20 with both CPUs online. Those patches
also built at each step with modules for LEON and generic sparc32,
both UP and SMP, without warnings or errors. That tip also built with
sparc64_defconfig. Host tests covered the U-Boot header, firmware
discovery, lock selection, framebuffer conflicts and GRPCI1 pairing.
Full-preemption and context-exhaustion testing remain open.

OpenAI Codex assisted with implementation, board-capture analysis and
validation tooling.

Magnus Lindholm (18):
  sparc32,leon: give the cross-call IRQ highest priority
  sparc32,leon: retain SMP TLB shootdowns
  sparc32,leon: publish instruction updates across CPUs
  sparc32,leon: avoid nested IRQ accounting in the timer handler
  sparc32: preserve both LEON PROM character-output conventions
  sparc32: tolerate firmware nodes without a name property
  sparc32: skip unavailable PROM V0 console metadata
  sparc32,leon: identify LEON before the firmware model lookup
  sparc32,leon: preserve the Linux IRQ14 vector during startup
  sparc32,leon: use ASI 1 for locks on the GR-LEON4-ITX
  sparc32,leon: restore the kernel header offsets used by U-Boot
  sparc32: recognize the legacy LEON firmware machine ID
  sparc32,leon: discover AMBA devices for legacy U-Boot PROMs
  sparc32,leon: describe legacy AMBA I2C controllers
  sparc32,leon: skip the GR-LEON4-ITX PROM mapping import
  sparc32,leon: use the upper SDRAM on the GR-LEON4-ITX
  sparc32,leon: combine legacy GRPCI1 plug-and-play resources
  sparc32,leon: describe the DS1672 on the GR-LEON4-ITX

 arch/sparc/include/asm/cacheflush_32.h |   2 +-
 arch/sparc/include/asm/ldstub.h        |  46 +++
 arch/sparc/include/asm/leon.h          |   3 +
 arch/sparc/include/asm/leon_amba.h     |   2 +
 arch/sparc/include/asm/machines.h      |   1 +
 arch/sparc/include/asm/oplib_32.h      |   2 +
 arch/sparc/include/asm/sections.h      |   2 +
 arch/sparc/include/asm/spinlock_32.h   |  32 +-
 arch/sparc/kernel/Makefile             |   1 +
 arch/sparc/kernel/head_32.S            |  46 ++-
 arch/sparc/kernel/idprom.c             |   2 +
 arch/sparc/kernel/leon_kernel.c        |   2 -
 arch/sparc/kernel/leon_legacy.c        | 487 +++++++++++++++++++++++++
 arch/sparc/kernel/leon_smp.c           |   9 +
 arch/sparc/kernel/module.c             |  25 ++
 arch/sparc/kernel/prom.h               |   5 +
 arch/sparc/kernel/prom_32.c            |  16 +
 arch/sparc/kernel/prom_common.c        |   1 +
 arch/sparc/kernel/setup_32.c           |  57 ++-
 arch/sparc/kernel/vmlinux.lds.S        |   5 +
 arch/sparc/lib/locks.S                 |  24 +-
 arch/sparc/mm/leon_mm.c                |   3 +-
 arch/sparc/mm/srmmu.c                  |  21 +-
 arch/sparc/prom/console_32.c           |   5 +-
 arch/sparc/prom/init_32.c              |  23 ++
 drivers/of/pdt.c                       |   9 +-
 include/linux/of_pdt.h                 |   5 +
 27 files changed, 793 insertions(+), 43 deletions(-)
 create mode 100644 arch/sparc/include/asm/ldstub.h
 create mode 100644 arch/sparc/kernel/leon_legacy.c


base-commit: c95443b98771a74c6689f5e7bbc56794fe95f550
prerequisite-patch-id: f4142189700ce7c766378c481a47244a7dd13140
prerequisite-patch-id: d2a8aa69c22fd06cbd2dae10f81e1c6db1b95a6d
-- 
2.43.0


             reply	other threads:[~2026-11-26  9:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:30 Magnus Lindholm [this message]
2026-11-26  9:30 ` [PATCH 01/18] sparc32,leon: give the cross-call IRQ highest priority Magnus Lindholm
2026-11-26  9:30 ` [PATCH 02/18] sparc32,leon: retain SMP TLB shootdowns Magnus Lindholm
2026-11-26  9:30 ` [PATCH 03/18] sparc32,leon: publish instruction updates across CPUs Magnus Lindholm
2026-11-26  9:30 ` [PATCH 04/18] sparc32,leon: avoid nested IRQ accounting in the timer handler Magnus Lindholm
2026-11-26  9:30 ` [PATCH 05/18] sparc32: preserve both LEON PROM character-output conventions Magnus Lindholm
2026-11-26  9:30 ` [PATCH 06/18] sparc32: tolerate firmware nodes without a name property Magnus Lindholm
2026-11-26  9:30 ` [PATCH 07/18] sparc32: skip unavailable PROM V0 console metadata Magnus Lindholm
2026-11-26  9:30 ` [PATCH 08/18] sparc32,leon: identify LEON before the firmware model lookup Magnus Lindholm
2026-11-26  9:30 ` [PATCH 09/18] sparc32,leon: preserve the Linux IRQ14 vector during startup Magnus Lindholm
2026-11-26  9:30 ` [PATCH 10/18] sparc32,leon: use ASI 1 for locks on the GR-LEON4-ITX Magnus Lindholm
2026-11-26  9:30 ` [PATCH 11/18] sparc32,leon: restore the kernel header offsets used by U-Boot Magnus Lindholm
2026-11-26  9:30 ` [PATCH 12/18] sparc32: recognize the legacy LEON firmware machine ID Magnus Lindholm
2026-11-26  9:30 ` [PATCH 13/18] sparc32,leon: discover AMBA devices for legacy U-Boot PROMs Magnus Lindholm
2026-11-26  9:30 ` [PATCH 14/18] sparc32,leon: describe legacy AMBA I2C controllers Magnus Lindholm
2026-11-26  9:30 ` [PATCH 15/18] sparc32,leon: skip the GR-LEON4-ITX PROM mapping import Magnus Lindholm
2026-11-26  9:30 ` [PATCH 16/18] sparc32,leon: use the upper SDRAM on the GR-LEON4-ITX Magnus Lindholm
2026-11-26  9:30 ` [PATCH 17/18] sparc32,leon: combine legacy GRPCI1 plug-and-play resources Magnus Lindholm
2026-11-26  9:30 ` [PATCH 18/18] sparc32,leon: describe the DS1672 on the GR-LEON4-ITX Magnus Lindholm

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=20261126093106.1345825-1-linmag7@gmail.com \
    --to=linmag7@gmail.com \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®