From: Jiri Slaby <jirislaby@kernel.org>
To: Bin Meng <bmeng@tinylab.org>,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-serial@vger.kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Russell King <linux@armlinux.org.uk>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/3] serial: earlycon-arm-semihost: Move smh_putc() variants in respective arch's semihost.h
Date: Thu, 8 Dec 2022 07:08:33 +0100 [thread overview]
Message-ID: <0443d5e9-b2ce-7e6b-c69b-708d67a5bf97@kernel.org> (raw)
In-Reply-To: <20221207135352.592556-1-bmeng@tinylab.org>
On 07. 12. 22, 14:53, Bin Meng wrote:
> Move smh_putc() variants in respective arch/*/include/asm/semihost.h,
> in preparation to add RISC-V support.
>
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
...
> --- /dev/null
> +++ b/arch/arm/include/asm/semihost.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2012 ARM Ltd.
> + * Author: Marc Zyngier <marc.zyngier@arm.com>
> + *
> + * Adapted for ARM and earlycon:
> + * Copyright (C) 2014 Linaro Ltd.
> + * Author: Rob Herring <robh@kernel.org>
> + */
Much better. There are three minor issues:
1) protection against multiple #include-s is missing here.
> +#ifdef CONFIG_THUMB2_KERNEL
> +#define SEMIHOST_SWI "0xab"
> +#else
> +#define SEMIHOST_SWI "0x123456"
> +#endif
> +
> +static inline void smh_putc(struct uart_port *port, unsigned char c)
2) port is unused in all implementations. So it should be dropped.
3) can you make "c" an explicit u8?
> +{
> + asm volatile("mov r1, %0\n"
> + "mov r0, #3\n"
> + "svc " SEMIHOST_SWI "\n"
> + : : "r" (&c) : "r0", "r1", "memory");
> +}
thanks,
--
js
suse labs
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2022-12-08 6:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 13:53 [PATCH v2 1/3] serial: earlycon-arm-semihost: Move smh_putc() variants in respective arch's semihost.h Bin Meng
2022-12-07 13:53 ` [PATCH v2 2/3] riscv: Implement semihost.h for earlycon semihost driver Bin Meng
2022-12-07 16:40 ` Conor Dooley
2022-12-07 13:53 ` [PATCH v2 3/3] serial: Rename " Bin Meng
2022-12-08 6:08 ` Jiri Slaby [this message]
2022-12-08 9:32 ` [PATCH v2 1/3] serial: earlycon-arm-semihost: Move smh_putc() variants in respective arch's semihost.h Bin Meng
2022-12-08 9:37 ` Jiri Slaby
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=0443d5e9-b2ce-7e6b-c69b-708d67a5bf97@kernel.org \
--to=jirislaby@kernel.org \
--cc=bmeng@tinylab.org \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=will@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