mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bin Meng" <bmeng@tinylab.org>
To: "Jiri Slaby" <jirislaby@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	linux-serial <linux-serial@vger.kernel.org>
Cc: "catalin.marinas" <catalin.marinas@arm.com>,
	gregkh <gregkh@linuxfoundation.org>,
	linux <linux@armlinux.org.uk>, will <will@kernel.org>,
	linux-arm-kernel <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, 08 Dec 2022 09:32:48 +0000	[thread overview]
Message-ID: <em14380c7e-ee2b-45d5-8879-dde687f03b2b@eea79fc7.com> (raw)
In-Reply-To: <0443d5e9-b2ce-7e6b-c69b-708d67a5bf97@kernel.org>

On 2022/12/8 14:08:33, "Jiri Slaby" <jirislaby@kernel.org> wrote:

>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.

Oops, will add in v3.

>
>
>>+#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?

The smh_putc function signature is defined by the uart_console_write 
helper. I don't think we can change it.

>
>>+{
>>+	asm volatile("mov  r1, %0\n"
>>+		     "mov  r0, #3\n"
>>+		     "svc  " SEMIHOST_SWI "\n"
>>+		     : : "r" (&c) : "r0", "r1", "memory");
>>+}

Regards,
Bin

  reply	other threads:[~2022-12-08  9:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 13:53 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 ` [PATCH v2 1/3] serial: earlycon-arm-semihost: Move smh_putc() variants in respective arch's semihost.h Jiri Slaby
2022-12-08  9:32   ` Bin Meng [this message]
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=em14380c7e-ee2b-45d5-8879-dde687f03b2b@eea79fc7.com \
    --to=bmeng@tinylab.org \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.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

all inboxes | Powered by JetHome®