u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Sean Anderson <sean.anderson@seco.com>
To: Tom Rini <trini@konsulko.com>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Liviu Dudau" <liviu.dudau@foss.arm.com>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Simon Glass" <sjg@chromium.org>,
	u-boot@lists.denx.de, "Sean Anderson" <sean.anderson@seco.com>,
	"Mingkai Hu" <mingkai.hu@nxp.com>,
	"Pierre-Clément Tosi" <ptosi@google.com>,
	"Priyanka Jain" <priyanka.jain@nxp.com>,
	"Rajesh Bhagat" <rajesh.bhagat@nxp.com>
Subject: [PATCH v3 00/29] arm: semihosting: Cleanups and new features
Date: Tue, 22 Mar 2022 16:59:08 -0400	[thread overview]
Message-ID: <20220322205938.1721846-1-sean.anderson@seco.com> (raw)

This cleans up the semihosting code and adds the following new features:

- hostfs support (like sandbox)
- support for being used as a SPL boot device
- serial device support
- falling back to normal drivers if semihosting is disabled

The main device affected by these changes is vexpress64, so I'd appreciate
if Andre (or anyone else) could try booting.

These changes are motivated by bringup for ls1046a. When forcing JTAG
boot, this device disables most communication peripherals, including
serial and ethernet devices. This appears to be fixed in later
generation devices, but we are stuck with it for now. Semihosting
provides an easy way to run a few console commands.

The patches in this series are organized as follows:

0-4: rST conversions and other documentation updates
5-9: Semihosting cleanups
10-14: Filesystem support (including SPL boot device)
15-16: Serial support
16: Documentation update
17: JTAG boot support for LS1046A
19-25: Semihosting fallback
26-29: DM puts support

The last two groups of patches are "bonus;" the first 17 patches stand
on their own. The last two groups could be broken out as separate
series, but I have kept them in this one to help with my sanity (and not
have to deal with too many outstanding series).

Patch 14 depends on [1] to apply cleanly. Patch 17 depends on [2] for
correctness. This series should be applied to u-boot/next (in
particular, the EROFS series must have been applied).

[1] https://lore.kernel.org/u-boot/CACRpkdZ+9fmNjC_mvrbPa9-iuTQVd8UkJ7Zpe7cL0c5vZygsVw@mail.gmail.com/T/
[2] https://lore.kernel.org/u-boot/20220222183840.1355337-2-sean.anderson@seco.com/

Changes in v3:
- Add a config for puts to reduce the impact on the (vast majority) of
  boards which don't need it.
- Add additional documentation for QEMU and OpenOCD
- Add dummy device number for hostfs
- Add test for putc/puts
- Fix loading the wrong EL's SPSR
- Fix null pointer dereference in _serial_puts caused by a missing
  return.
- Make FALLBACK depend on ARM64
- Make puts return the number of characters written on success, instead
  of reusing the len parameter.
- Reorder Kconfigs to group SEMIHOSTING_FALLBACK after SEMIHOSTING
  (instead of after SPL_SEMIHOSTING_FALLBACK)
- Update commit message to describe an alternate implementation
- Use SYS_ERRNO instead of SYS_ISERROR, since the latter is not
  implemented in older QEMUs.

Changes in v2:
- Add implementation of puts for DM
- Add migration instructions for smhload
- Add myself as a reviewer
- Add semihosting fallback implementation
- Compile arch/arm/lib/semihosting.o in SPL
- Document debug uart
- Fix baud numbers being off by 10
- Fix typos in commit message
- Make CONFIG_SPL_SEMIHOSTING depend on SPL
- Rebase on Andre's series
- Rename non-DM driver struct to match format of other drivers

Sean Anderson (29):
  doc: Convert semihosting readme to rST
  nxp: ls1046ardb: Convert README to rST
  doc: ls1046ardb: Expand boot mode section
  doc: ls1046ardb: Document debug uart
  arm: smh: Add semihosting entry to MAINTAINERS
  arm: smh: Export semihosting functions
  arm: smh: Use numeric modes for smh_open
  arm: smh: Return errno on error
  arm: smh: Document functions in header
  arm: smh: Add some file manipulation commands
  spl: Add semihosting boot method
  fs: Add semihosting filesystem
  cmd: fdt: Use start/size for chosen instead of start/end
  arm: smh: Remove smhload command
  arm: smh: Add some functions for working with the host console
  serial: Add semihosting driver
  doc: smh: Update semihosting documentation
  ls1046ardb: Add support for JTAG boot
  arm64: Save esr in pt_regs
  arm64: Save spsr in pt_regs
  arm64: Import some ESR and SPSR defines from Linux
  arm: smh: Add option to detect semihosting
  arm64: Catch non-emulated semihosting calls
  serial: smh: Initialize serial only if semihosting is enabled
  arm64: ls1046a: Support semihosting fallback
  serial: dm: Add support for puts
  serial: sandbox: Implement puts
  test: serial: Add test for putc/puts
  serial: smh: Implement puts for DM

 MAINTAINERS                             |   5 +
 arch/arm/Kconfig                        |  47 +++-
 arch/arm/cpu/armv8/exceptions.S         |   9 +-
 arch/arm/cpu/armv8/fsl-layerscape/spl.c |   3 +
 arch/arm/include/asm/esr.h              | 343 ++++++++++++++++++++++++
 arch/arm/include/asm/proc-armv/ptrace.h |  75 ++++++
 arch/arm/include/asm/spl.h              |   1 +
 arch/arm/include/asm/u-boot-arm.h       |   7 +-
 arch/arm/lib/Makefile                   |   2 +-
 arch/arm/lib/interrupts_64.c            |  80 ++++--
 arch/arm/lib/semihosting.c              | 230 ++++++++--------
 arch/arm/mach-imx/imx8m/soc.c           |   4 +-
 arch/sandbox/include/asm/serial.h       |   6 +
 board/freescale/ls1046ardb/MAINTAINERS  |   1 +
 board/freescale/ls1046ardb/README       |  76 ------
 board/freescale/ls1046ardb/ls1046ardb.c |  11 +
 cmd/fdt.c                               |   6 +-
 common/spl/Makefile                     |   1 +
 common/spl/spl_semihosting.c            |  71 +++++
 disk/part.c                             |   4 +-
 doc/README.semihosting                  |  38 ---
 doc/board/nxp/index.rst                 |   1 +
 doc/board/nxp/ls1046ardb.rst            | 191 +++++++++++++
 doc/usage/index.rst                     |   1 +
 doc/usage/semihosting.rst               | 107 ++++++++
 drivers/serial/Kconfig                  |  37 +++
 drivers/serial/Makefile                 |   1 +
 drivers/serial/sandbox.c                |  38 ++-
 drivers/serial/serial-uclass.c          |  26 +-
 drivers/serial/serial.c                 |   2 +
 drivers/serial/serial_semihosting.c     | 187 +++++++++++++
 fs/Makefile                             |   1 +
 fs/fs.c                                 |  20 ++
 fs/semihostingfs.c                      | 115 ++++++++
 include/configs/ls1046ardb.h            |   2 +
 include/configs/vexpress_aemv8.h        |  10 +-
 include/fs.h                            |   1 +
 include/semihosting.h                   | 149 ++++++++++
 include/semihostingfs.h                 |  21 ++
 include/serial.h                        |  19 ++
 test/dm/serial.c                        |  19 ++
 41 files changed, 1689 insertions(+), 279 deletions(-)
 create mode 100644 arch/arm/include/asm/esr.h
 delete mode 100644 board/freescale/ls1046ardb/README
 create mode 100644 common/spl/spl_semihosting.c
 delete mode 100644 doc/README.semihosting
 create mode 100644 doc/board/nxp/ls1046ardb.rst
 create mode 100644 doc/usage/semihosting.rst
 create mode 100644 drivers/serial/serial_semihosting.c
 create mode 100644 fs/semihostingfs.c
 create mode 100644 include/semihosting.h
 create mode 100644 include/semihostingfs.h

-- 
2.25.1


             reply	other threads:[~2022-03-22 21:00 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 20:59 Sean Anderson [this message]
2022-03-22 20:59 ` [PATCH v3 01/29] doc: Convert semihosting readme to rST Sean Anderson
2022-03-22 22:05   ` Heinrich Schuchardt
2022-03-22 23:16     ` Sean Anderson
2022-04-03  0:14   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 02/29] nxp: ls1046ardb: Convert README " Sean Anderson
2022-04-03  0:14   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 03/29] doc: ls1046ardb: Expand boot mode section Sean Anderson
2022-04-03  0:14   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 04/29] doc: ls1046ardb: Document debug uart Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 05/29] arm: smh: Add semihosting entry to MAINTAINERS Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 06/29] arm: smh: Export semihosting functions Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 07/29] arm: smh: Use numeric modes for smh_open Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 08/29] arm: smh: Return errno on error Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 09/29] arm: smh: Document functions in header Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 10/29] arm: smh: Add some file manipulation commands Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 11/29] spl: Add semihosting boot method Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 12/29] fs: Add semihosting filesystem Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 13/29] cmd: fdt: Use start/size for chosen instead of start/end Sean Anderson
2022-04-03  0:15   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 14/29] arm: smh: Remove smhload command Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 15/29] arm: smh: Add some functions for working with the host console Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 16/29] serial: Add semihosting driver Sean Anderson
2022-03-28  6:35   ` Simon Glass
2022-03-28  6:35   ` Simon Glass
2022-03-28 15:36     ` Sean Anderson
2022-03-28 16:03       ` Tom Rini
2022-03-28 16:14         ` Layerscape DM_SERIAL (Was: Re: [PATCH v3 16/29] serial: Add semihosting driver) Sean Anderson
2022-04-03  0:16   ` [PATCH v3 16/29] serial: Add semihosting driver Tom Rini
2022-03-22 20:59 ` [PATCH v3 17/29] doc: smh: Update semihosting documentation Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 20/29] arm64: Save spsr in pt_regs Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 22/29] arm: smh: Add option to detect semihosting Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 23/29] arm64: Catch non-emulated semihosting calls Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 24/29] serial: smh: Initialize serial only if semihosting is enabled Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 25/29] arm64: ls1046a: Support semihosting fallback Sean Anderson
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 26/29] serial: dm: Add support for puts Sean Anderson
2022-03-28  6:35   ` Simon Glass
2022-04-03  0:16   ` Tom Rini
2022-03-22 20:59 ` [PATCH v3 27/29] serial: sandbox: Implement puts Sean Anderson
2022-03-28  6:35   ` Simon Glass
2022-04-01 22:39   ` Tom Rini
2022-04-04 18:26     ` Sean Anderson
2022-03-22 20:59 ` [PATCH v3 29/29] serial: smh: Implement puts for DM Sean Anderson
2022-03-22 21:16 ` [RESEND PATCH v3 18/29] ls1046ardb: Add support for JTAG boot Sean Anderson
2022-04-03  0:17   ` Tom Rini
2022-03-22 21:17 ` [RESEND PATCH v3 19/29] arm64: Save esr in pt_regs Sean Anderson
2022-04-03  0:17   ` Tom Rini
2022-03-22 21:18 ` [RESEND PATCH v3 21/29] arm64: Import some ESR and SPSR defines from Linux Sean Anderson
2022-04-03  0:17   ` Tom Rini
2022-03-22 21:19 ` [RESEND PATCH v3 28/29] test: serial: Add test for putc/puts Sean Anderson
2022-03-22 22:11 ` [PATCH v3 00/29] arm: semihosting: Cleanups and new features Heinrich Schuchardt
2022-03-22 23:21   ` Sean Anderson
     [not found] ` <20220322205938.1721846-29-sean.anderson@seco.com>
2022-03-28  6:35   ` [PATCH v3 28/29] test: serial: Add test for putc/puts Simon Glass
2022-03-28 15:37     ` Sean Anderson

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=20220322205938.1721846-1-sean.anderson@seco.com \
    --to=sean.anderson@seco.com \
    --cc=andre.przywara@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=liviu.dudau@foss.arm.com \
    --cc=mingkai.hu@nxp.com \
    --cc=priyanka.jain@nxp.com \
    --cc=ptosi@google.com \
    --cc=rajesh.bhagat@nxp.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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;
as well as URLs for NNTP newsgroup(s).