From: Yao Zi <ziyao@disroot.org>
To: Uros Stajic <uros.stajic@htecgroup.com>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Cc: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>,
Chao-ying Fu <cfu@mips.com>
Subject: Re: [PATCH v3 08/12] riscv: p8700: Add software emulation for AMO* instructions
Date: Fri, 1 Aug 2025 07:54:17 +0000 [thread overview]
Message-ID: <aIxxeVl7xsQm3QnJ@pie> (raw)
In-Reply-To: <20250729162035.209849-9-uros.stajic@htecgroup.com>
On Tue, Jul 29, 2025 at 04:24:17PM +0000, Uros Stajic wrote:
> From: Chao-ying Fu <cfu@mips.com>
>
> This patch adds software emulation for atomic memory operations (AMO)
> instructions that may not be supported in hardware.
>
> The `emu-amo.s` file provides assembly implementations of the
> aforementioned operations. Corresponding handler logic is integrated
> into the illegal instruction trap to catch and emulate unsupported
> AMO* instructions at runtime.
The main body of U-Boot is executed by only one CPU, so I don't think
there're chances for atomic instructions; disassembly of a U-Boot binary
built with qemu-riscv64_smode_defconfig confirms the idea: the only four
amo instructions locate in arch/riscv/cpu/start.S for picking the HART
to run U-Boot.
I suggest implementing a LR/SC-based codepath for HART lottery logic in
start.S, and introducing a new Kconfig entry (maybe CONFIG_ISA_ZAMMO) to
represent the availability of Zammo extension. We could use the
alternative path for RISC-V platforms that don't implement Zammo and
disable CONFIG_ISA_ZAAMO, which saves a lot of lines and make the code
cleaner.
Regards,
Yao Zi
> Signed-off-by: Chao-ying Fu <cfu@mips.com>
> Signed-off-by: Uros Stajic <uros.stajic@htecgroup.com>
> ---
> arch/riscv/cpu/p8700/Makefile | 1 +
> arch/riscv/cpu/p8700/emu-amo.S | 254 ++++++++++++++++++++++++++++
> arch/riscv/lib/interrupts.c | 299 +++++++++++++++++++++++++++++++++
> include/interrupt.h | 19 +++
> 4 files changed, 573 insertions(+)
> create mode 100644 arch/riscv/cpu/p8700/emu-amo.S
next prev parent reply other threads:[~2025-08-01 7:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 16:21 [PATCH v3 00/12] riscv: Add support for P8700 platform on Boston board Uros Stajic
2025-07-29 16:22 ` [PATCH v3 01/12] riscv: Add initial support for P8700 SoC Uros Stajic
2025-07-29 16:22 ` [PATCH v3 02/12] board: boston-riscv: Add initial support for P8700 Boston board Uros Stajic
2025-07-29 16:22 ` [PATCH v3 03/12] gpio: Add GPIO driver for Intel EG20T Uros Stajic
2025-08-01 8:51 ` Yao Zi
2025-07-29 16:23 ` [PATCH v3 04/12] pci: xilinx: Avoid writing memory base/limit for root bridge Uros Stajic
2025-07-29 16:23 ` [PATCH v3 05/12] riscv: Add support for MIPS GIC syscon on RISC-V SoCs Uros Stajic
2025-07-29 16:23 ` [PATCH v3 06/12] net: pch_gbe: Add PHY reset and MAC address fallback for RISC-V Uros Stajic
2025-07-29 16:24 ` [PATCH v3 07/12] libfdt: Allow non-64b aligned memreserve entries Uros Stajic
2025-07-29 16:24 ` [PATCH v3 08/12] riscv: p8700: Add software emulation for AMO* instructions Uros Stajic
2025-08-01 7:54 ` Yao Zi [this message]
2025-08-19 7:47 ` Uros Stajic
2025-07-29 16:24 ` [PATCH v3 09/12] riscv: p8700: Add Coherence Manager (CM) and IOCU support Uros Stajic
2025-08-01 8:47 ` Yao Zi
2025-08-19 7:55 ` Uros Stajic
2025-07-29 16:24 ` [PATCH v3 10/12] riscv: boston: Add support for LED character display command Uros Stajic
2025-07-29 16:25 ` [PATCH v3 11/12] cmd: riscv: Add 'startharts' command to start multiple harts Uros Stajic
2025-07-29 16:25 ` [PATCH v3 12/12] timer: p8700: Add support for reading time from memory-mapped mtime Uros Stajic
2025-07-31 5:57 ` Yao Zi
2025-08-19 7:59 ` Uros Stajic
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=aIxxeVl7xsQm3QnJ@pie \
--to=ziyao@disroot.org \
--cc=Djordje.Todorovic@htecgroup.com \
--cc=cfu@mips.com \
--cc=u-boot@lists.denx.de \
--cc=uros.stajic@htecgroup.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.