From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32BD044A71E for ; Sun, 11 Oct 2026 19:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791748669; cv=none; b=jxiAD26OXE2c158ESoUoTw+Lbb+8I1VogVu1UAGnonOnPnGbvve2ks1ws8S7RQCwPXkbreW3Z0D1qPSYKk6fQXpqiPOjZlufrjbb/uoB+3eeSfES2c2qW1kCttS23U97bhnfg7Xp8UfDFPFEtqrO5HjVODGGa4PJJWav6aKKPlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791748669; c=relaxed/simple; bh=kXot8RBIFwxlA/+fw9UjNqSx52fBPKCc3YvC/GH92U8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ruYTimT5Lj7fMzK9nDPKd134qsiVwQszRulVKbHi0HH0WSu3ZWbuhwHBsXWZSNY8emQmeYzSMFkagQHz2AFzl1eGXnrjE90FA0YYBgx2/KMHhL8MP8GsNkSz8ExVBmct04QLk55VoWchWaWhXkfRrTuENQIbbXfajJsucIWW3DU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N1AScMRE; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N1AScMRE" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-c2dc63f8d8aso210240266b.0 for ; Sun, 11 Oct 2026 12:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791748666; x=1792353466; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=1nsk2mdhFsso8ym6DQn4vGnG7ZKpsogWBUPuZQB9l70=; b=N1AScMREVuB2viFgS51ELyz4plAWkkn8fLHKzEXF39RZ7FWREYyxXKckyloEq/jIzU zbg2rZRgzpMTs9a4cHzZFmbzNiip6f06uDu9EqmpNfBDQgrUO0FIbqRVip5Q8003dluX ltWnvCe84OCTGkdXyZ2tqhUb1ttuJbXQ6OXAb3uFN0EA0Ql4QFb65kmlaT/hSTUbGvOu /tifmALes8e5f4xRp7upOpFADc0luylUwKh6ZCAn29mwgwPu1lfi8F1HFFyfR4jXMGXx EqT5mg+Zvnl4kz/HVsLMsrNr7jrGvBbtBNidPMfT+0hVa1/6DG30fcWQSIO48iS3rSrU Khvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791748666; x=1792353466; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1nsk2mdhFsso8ym6DQn4vGnG7ZKpsogWBUPuZQB9l70=; b=g0hFMsSZMIGPK5GVYnkWfTWVo+SIqid+TF80UFEQfkE9K8MSQ9ZuAOMAFbZcHiiljx R4b9i6pnoR8b7hwwZSTO7yNEUuOm4yrPqVU5k+x6TjDmxCdPiCcPMqlwzM4q9d/0F8+d J/U0NPYgToFhGijmkIeKKZLKYA7XxhTqQxkWyKr4TlXzMsOU2fUA19I2r1PHNq8At26V zjga5UZHbVAq0xbhtlv5pExTPuDKfGwVfQHLUJ9+58NRg22MWJr1VOI4wrYDjA5FPO8k ZJgu3BJmTUwk3hZhQauqQ+0tqfBWr9+tjHkFDwRCK6J21swqfLG0E6pFIKYon3Gkexs+ D6Ag== X-Gm-Message-State: AFq9FYI8Sji5x1mYXDz97X+FX3nXp8ecyRi1aFuffT8jCmq2HCWiLvNQ xxJnbkU8cIujqCCTtqhrOFS6whnsLCv3M1QQ0eg4GtXDMuCXfhDpp+zg X-Gm-Gg: AYBFou0o7S1PJlhNgVvbVCqonOlGJ7WvDIzMooaZx2rerZlZTFfIjHZugfCt+vPwAlk g674NTbrHUjc1WEGW09N6jotDynAxBo+TPD1+chxwMKHJ1A7ihD5bwubQ7EacbxlrxKKjP3vbDq uu8PhCawLYlPMsCXPFtS8OuY0tW4QUo4wbz1cDgasUsQmzgStuRyeKEYpukzIddmYXrD7r4UQt2 RPUF4jMwMugsg5aEm5ZfwLRS5yQth8ynThwN9XeUqpUjqTgbhT98H/QQR/m2CfBYWE46ip8wbBM 1IBOtNPXqiwfgjwkFFZueVTB1lx3zsIsoJ4a1ugw+8rPcyriFUurOLt69l5rEXlphqCC5tw6qJv +qgWlvN95mSmlSyHuchjmYpVWZCwX6MqZAP78+hJdVAx+JHQ3tUG5GZ6KMSCnsjsyrc3rciZZ4g vNt62FGEUH2BGQsbAmgmhKQTLTTueAATq4ctOPXDHP+5ayX8pDKaPITw4Bp3qZed9c2W0V1i8Uu s/hOHsRrUZcJHz5HZIxVwAPO165CLK7YBTsMI0z X-Received: by 2002:a17:907:3d09:b0:c31:8cfe:9a25 with SMTP id a640c23a62f3a-c31a9fd33dcmr813951666b.9.1791748666339; Sun, 11 Oct 2026 12:57:46 -0700 (PDT) Received: from buildhost.darklands.se ([2001:9b1:ff:d701:51eb:176f:63d9:53f8]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c31a9a3ae9fsm381315566b.26.2026.10.11.12.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2026 12:57:45 -0700 (PDT) From: Magnus Lindholm To: davem@davemloft.net, andreas@gaisler.com, sparclinux@vger.kernel.org Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, krzk@kernel.org, oleg@redhat.com, linmag7@gmail.com Subject: [PATCH v2 0/6] sparc64: add Fujitsu M3000 support Date: Sun, 11 Oct 2026 21:55:52 +0200 Message-ID: <20261011195729.981243-1-linmag7@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Several years ago I salvaged an M3000 SPARC Enterprise box being decommissioned at work. The box has been sitting ever since, as it did not run Linux. It did not seem impossible to get Linux running, but my earlier attempts failed. I recently found some documentation: "SPARC JPS2: Common Specification" and the "Fujitsu SPARC64 VII Extensions", which gave me some of the missing pieces. Getting this up and running required extensive testing, some kernel instrumentation, debug printouts and many reboot iterations. For this, Codex proved very helpful. Along the way, I stumbled upon some generic sparc and driver bugs that this series addresses as well. This series adds support for the Fujitsu SPARC Enterprise M3000, with SPARC64 VII+, Oberon PCIe and a firmware hvc console. Based on Linux v7.3-rc1, commit cee9395acd8043be0644b25c34bfa86623f2b935. Patches 1-3 fix existing sparc64 defects in generic clear_page, secondary queued-spinlock acquisition and sun4u kernel huge-PUD mappings. Each has a Fixes tag. Patches 4-6 add the CPU/MMU/SMP path, PCIe bridge and firmware console. Changes since v1: - Split the tg3 firmware byte-order fix into a standalone netdev patch, as requested by Jakub. It has no code dependency on this series. - Address Krzysztof's topology review: replace the root-model check and adjacent-CPU assumption with compatible core nodes and cpu/core/cmp ancestry. Unknown ancestry produces no inferred sibling groups; hardware CPU IDs are unchanged. This uses the observed firmware tree, without claiming that the root model is a documented binding. - Address Greg's console-state review: group state by HVC term number. Retain static storage for early console use and firmware-visible locked mappings; the M3000 exposes one /chosen stdin/stdout pair. - Replace READ_ONCE/WRITE_ONCE polling-state access with explicit locking. A spinlock protects active state and timer rearming; a mutex serializes open, last close and hangup while close waits for the timer callback. - Remove the arbitrary eight-attempt write loop. No progress returns zero: HVC retries buffered TTY output but drops stalled console chunks. A firmware call that never returns remains unbounded. - Retain the raw buffer lock because console writes can run in atomic contexts. The PROM lock protects firmware entry, not the buffer copies before and after it. Panic/NMI and recursive console safety remain unverified. - Retain the service-name pointer cast: p1275_cmd_direct() takes unsigned long argument cells, as used by the existing prom_console_write_buf(). - Remove stale "experimental" wording and the console success message; add copyright, use min(), and fix the Makefile spacing and blank line. - Retain CONFIG_SPARC64_VII and its HugeTLB/THP exclusions. Removing the option requires runtime feature gating and further MMU work. Retain separate VII demap routines: similar Cheetah assembly does not establish the same hardware synchronization requirement there. Onboard BCM5718 networking also needs the standalone patch "tg3: normalize inherited M3000 register byte order". Apply it alongside this series for complete M3000 testing; it is not a build dependency. The two submissions can be taken through their respective trees. The six-patch SPARC series also applies and builds without the tg3 fix. The tg3 patch applies and its driver builds independently on v7.3-rc1. Applying both submissions in either order reproduces the tested tree. The combined v2 tree, including the standalone tg3 fix, cross-built with GCC 13.3 in SMP, true CONFIG_SMP=n and non-VII Ultra45 configurations. Each prefix of that seven-patch tree applied and built. The combined, uninstrumented SMP kernel booted from disk with eight threads; true UP also booted from disk. Both reached Gentoo/OpenRC with hvc0. SMP topology reports four cores, two threads per core and one package with reciprocal sibling masks. Bounded SMP fork/COW and remap/protection tests passed, as did UP COW. Console testing covered login, 100 paired-open/last-close cycles, hangup/reopen, paced input, idle input and concurrent output. Rapid pasted input still loses characters. Mocked firmware tests exercised partial writes, no progress, errors and invalid return counts; topology fixtures covered sparse IDs, package separation and missing ancestry. The Ultra45 configuration was compile-tested only for this revision; topology fixtures do not establish multi-package hardware support. Oberon MSI and native bridge error recovery, VII CPU offlining and complete RAS recovery remain unimplemented. ECC recovery was not fault-injected; urgent errors stop with a raw record. Raw-IPI page lifetime and Oberon ordering remain audit topics. Link to v1: https://lore.kernel.org/sparclinux/20261002161515.932316-1-linmag7@gmail.com/ Link to tg3 patch (v3): https://lore.kernel.org/sparclinux/20261011194228.981141-1-linmag7@gmail.com/ Magnus Lindholm (6): sparc64: return from the generic clear_page implementation sparc64: honor queued spinlock layout in secondary startup sparc64: avoid huge kernel PUD mappings on sun4u sparc64: add SPARC64 VII CPU, MMU and SMP support sparc64: add M3000 Oberon PCIe support hvc: add an M3000 firmware console backend MAINTAINERS | 6 + arch/sparc/Kconfig | 20 +++ arch/sparc/include/asm/head_64.h | 15 ++ arch/sparc/include/asm/iommu_64.h | 1 + arch/sparc/include/asm/irq_64.h | 1 + arch/sparc/include/asm/setup.h | 5 + arch/sparc/include/asm/smp_64.h | 4 + arch/sparc/include/asm/spitfire.h | 1 + arch/sparc/include/asm/trap_block.h | 6 + arch/sparc/kernel/cpu.c | 3 + arch/sparc/kernel/entry.h | 2 + arch/sparc/kernel/head_64.S | 18 +++ arch/sparc/kernel/helpers.S | 41 +++++ arch/sparc/kernel/iommu.c | 44 ++++++ arch/sparc/kernel/irq_64.c | 50 ++++-- arch/sparc/kernel/pci_fire.c | 31 +++- arch/sparc/kernel/pci_impl.h | 1 + arch/sparc/kernel/prom_64.c | 27 ++++ arch/sparc/kernel/prom_irqtrans.c | 7 + arch/sparc/kernel/ptrace_64.c | 7 + arch/sparc/kernel/setup_64.c | 55 +++++++ arch/sparc/kernel/smp_64.c | 89 ++++++++++- arch/sparc/kernel/trampoline_64.S | 53 ++++++- arch/sparc/kernel/traps_64.c | 27 ++++ arch/sparc/lib/GENpage.S | 3 + arch/sparc/mm/init_64.c | 110 ++++++++++++- arch/sparc/mm/tsb.c | 19 ++- arch/sparc/mm/ultra.S | 236 ++++++++++++++++++++++++++++ drivers/tty/hvc/Kconfig | 10 ++ drivers/tty/hvc/Makefile | 1 + drivers/tty/hvc/hvc_m3000.c | 205 ++++++++++++++++++++++++ 31 files changed, 1064 insertions(+), 34 deletions(-) create mode 100644 drivers/tty/hvc/hvc_m3000.c base-commit: cee9395acd8043be0644b25c34bfa86623f2b935 -- 2.43.0