public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Sean Anderson <sean.anderson@seco.com>
Cc: Simon Glass <sjg@chromium.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Liviu Dudau <liviu.dudau@foss.arm.com>,
	Andre Przywara <andre.przywara@arm.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v3 16/29] serial: Add semihosting driver
Date: Mon, 28 Mar 2022 12:03:44 -0400	[thread overview]
Message-ID: <20220328160344.GA14476@bill-the-cat> (raw)
In-Reply-To: <e8177565-67fe-009f-34d0-d136b629fcc8@seco.com>

[-- Attachment #1: Type: text/plain, Size: 3758 bytes --]

On Mon, Mar 28, 2022 at 11:36:46AM -0400, Sean Anderson wrote:
> 
> 
> On 3/28/22 2:35 AM, Simon Glass wrote:
> > Hi Sean,
> > 
> > On Tue, 22 Mar 2022 at 15:00, Sean Anderson <sean.anderson@seco.com> wrote:
> >>
> >> This adds a serial driver which uses semihosting calls to read and write
> >> to the host's console. For convenience, if CONFIG_DM_SERIAL is enabled,
> >> we will instantiate a serial driver. This allows users to enable this
> >> driver (which has no physical device) without modifying their device
> >> trees or board files. We also implement a non-DM driver for SPL, or for
> >> much faster output in U-Boot proper.
> >>
> >> There are three ways to print to the console:
> >>
> >> Method              Baud
> >> ================== =====
> >> smh_putc in a loop   170
> >> smh_puts            1600
> >> smh_write with :tt 20000
> >> ================== =====
> >>
> >> These speeds were measured using a 175 character message with a J-Link
> >> adapter. For reference, U-Boot typically prints around 2700 characters
> >> during boot on this board. There are two major factors affecting the
> >> speed of these functions. First, each breakpoint incurs a delay. Second,
> >> each debugger memory transaction incurs a delay. smh_putc has a
> >> breakpoint and memory transaction for every character. smh_puts has one
> >> breakpoint, but still has to use a transaction for every character. This
> >> is because we don't know the length up front, so OpenOCD has to check if
> >> each character is nul. smh_write has only one breakpoint and one memory
> >> transfer.
> >>
> >> DM serial drivers can only implement a putc interface, so we are stuck
> >> with the slowest API. Non-DM drivers can implement puts, which is vastly
> >> more efficient. When the driver starts up, we try to open :tt. Since
> >> this is an extension, this may fail. If it does, we fall back to
> >> smh_puts. We don't check :semihosting-features, since there are
> >> nonconforming implementations (OpenOCD) which don't implement it (but
> >> *do* implement :tt).
> >>
> >> Some semihosting implementations (QEMU) don't handle READC properly. To
> >> work around this, we try to use open/read (much like for stdin) if
> >> possible.
> >>
> >> There is no non-blocking I/O available, so we don't implement pending.
> >> This will cause __serial_tstc to always return true. If
> >> CONFIG_SERIAL_RX_BUFFER is enabled, _serial_tstc will try and read
> >> characters forever. To avoid this, we depend on this config being
> >> disabled.
> >>
> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> >> ---
> >>
> >> (no changes since v2)
> >>
> >> Changes in v2:
> >> - Fix baud numbers being off by 10
> >> - Fix typos in commit message
> >> - Rename non-DM driver struct to match format of other drivers
> >>
> >>  drivers/serial/Kconfig              |  22 +++++
> >>  drivers/serial/Makefile             |   1 +
> >>  drivers/serial/serial.c             |   2 +
> >>  drivers/serial/serial_semihosting.c | 147 ++++++++++++++++++++++++++++
> >>  include/serial.h                    |   1 +
> >>  5 files changed, 173 insertions(+)
> >>  create mode 100644 drivers/serial/serial_semihosting.c
> >>
> > 
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > 
> > But please can we drop the non-DM support?
> 
> Unfortunately, Layerscape does not support DM serial. I tried converting
> it, but I ran into some unusual aborts. At the moment, I don't have time
> to debug things further. And I thought that non-DM serial was ok for
> SPL?

It is OK for SPL, and it needs migration for non-SPL.  Can you make
another thread with your conversion-that-fails for layerscape please?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2022-03-28 16:04 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 20:59 [PATCH v3 00/29] arm: semihosting: Cleanups and new features Sean Anderson
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 [this message]
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=20220328160344.GA14476@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=andre.przywara@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=liviu.dudau@foss.arm.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --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