All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Atish Patra <atish.patra@wdc.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>,
	Alan Kao <alankao@andestech.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Anup Patel <anup@brainfault.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	linux-kernel@vger.kernel.org, Mike Rapoport <rppt@linux.ibm.com>,
	Alexios Zavras <alexios.zavras@intel.com>,
	Gary Guo <gary@garyguo.net>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	linux-riscv@lists.infradead.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH 1/2] RISC-V: Mark existing SBI as legacy SBI.
Date: Tue, 27 Aug 2019 07:03:04 -0700	[thread overview]
Message-ID: <20190827140304.GA21855@infradead.org> (raw)
In-Reply-To: <20190826233256.32383-2-atish.patra@wdc.com>

> +#define SBI_EXT_LEGACY_SET_TIMER 0x0
> +#define SBI_EXT_LEGACY_CONSOLE_PUTCHAR 0x1
> +#define SBI_EXT_LEGACY_CONSOLE_GETCHAR 0x2
> +#define SBI_EXT_LEGACY_CLEAR_IPI 0x3
> +#define SBI_EXT_LEGACY_SEND_IPI 0x4
> +#define SBI_EXT_LEGACY_REMOTE_FENCE_I 0x5
> +#define SBI_EXT_LEGACY_REMOTE_SFENCE_VMA 0x6
> +#define SBI_EXT_LEGACY_REMOTE_SFENCE_VMA_ASID 0x7
> +#define SBI_EXT_LEGACY_SHUTDOWN 0x8

As Mike said legacy is a bit of a weird name.  I think this should
be SBI01_* or so.  And pleae align the numeric values and maybe use
an enum.

> +
> +#define SBI_CALL_LEGACY(which, arg0, arg1, arg2, arg3) ({             \
>  	register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0);	\
>  	register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1);	\
>  	register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2);	\

Instead of the weird inline assembly with forced register allocation,
why not move this to pure assembly?  AFAICs this is the whole assembly
code we'd need:

ENTRY(sbi01_call)
        ecall
END(sbi01_call)

>  /* Lazy implementations until SBI is finalized */
> -#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0, 0)
> -#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0, 0)
> -#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0, 0)
> -#define SBI_CALL_3(which, arg0, arg1, arg2) \
> -		SBI_CALL(which, arg0, arg1, arg2, 0)
> -#define SBI_CALL_4(which, arg0, arg1, arg2, arg3) \
> -		SBI_CALL(which, arg0, arg1, arg2, arg3)
> +#define SBI_CALL_LEGACY_0(which) SBI_CALL_LEGACY(which, 0, 0, 0, 0)
> +#define SBI_CALL_LEGACY_1(which, arg0) SBI_CALL_LEGACY(which, arg0, 0, 0, 0)
> +#define SBI_CALL_LEGACY_2(which, arg0, arg1) \
> +		SBI_CALL_LEGACY(which, arg0, arg1, 0, 0)
> +#define SBI_CALL_LEGACY_3(which, arg0, arg1, arg2) \
> +		SBI_CALL_LEGACY(which, arg0, arg1, arg2, 0)
> +#define SBI_CALL_LEGACY_4(which, arg0, arg1, arg2, arg3) \
> +		SBI_CALL_LEGACY(which, arg0, arg1, arg2, arg3)

When you touch this anyway I'd suggest you kill these rather
pointless wrappers as well as the comment above them.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@infradead.org>
To: Atish Patra <atish.patra@wdc.com>
Cc: linux-kernel@vger.kernel.org, Albert Ou <aou@eecs.berkeley.edu>,
	Alan Kao <alankao@andestech.com>,
	Alexios Zavras <alexios.zavras@intel.com>,
	Anup Patel <anup@brainfault.org>,
	Palmer Dabbelt <palmer@sifive.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Gary Guo <gary@garyguo.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-riscv@lists.infradead.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH 1/2] RISC-V: Mark existing SBI as legacy SBI.
Date: Tue, 27 Aug 2019 07:03:04 -0700	[thread overview]
Message-ID: <20190827140304.GA21855@infradead.org> (raw)
In-Reply-To: <20190826233256.32383-2-atish.patra@wdc.com>

> +#define SBI_EXT_LEGACY_SET_TIMER 0x0
> +#define SBI_EXT_LEGACY_CONSOLE_PUTCHAR 0x1
> +#define SBI_EXT_LEGACY_CONSOLE_GETCHAR 0x2
> +#define SBI_EXT_LEGACY_CLEAR_IPI 0x3
> +#define SBI_EXT_LEGACY_SEND_IPI 0x4
> +#define SBI_EXT_LEGACY_REMOTE_FENCE_I 0x5
> +#define SBI_EXT_LEGACY_REMOTE_SFENCE_VMA 0x6
> +#define SBI_EXT_LEGACY_REMOTE_SFENCE_VMA_ASID 0x7
> +#define SBI_EXT_LEGACY_SHUTDOWN 0x8

As Mike said legacy is a bit of a weird name.  I think this should
be SBI01_* or so.  And pleae align the numeric values and maybe use
an enum.

> +
> +#define SBI_CALL_LEGACY(which, arg0, arg1, arg2, arg3) ({             \
>  	register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0);	\
>  	register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1);	\
>  	register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2);	\

Instead of the weird inline assembly with forced register allocation,
why not move this to pure assembly?  AFAICs this is the whole assembly
code we'd need:

ENTRY(sbi01_call)
        ecall
END(sbi01_call)

>  /* Lazy implementations until SBI is finalized */
> -#define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0, 0)
> -#define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0, 0)
> -#define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0, 0)
> -#define SBI_CALL_3(which, arg0, arg1, arg2) \
> -		SBI_CALL(which, arg0, arg1, arg2, 0)
> -#define SBI_CALL_4(which, arg0, arg1, arg2, arg3) \
> -		SBI_CALL(which, arg0, arg1, arg2, arg3)
> +#define SBI_CALL_LEGACY_0(which) SBI_CALL_LEGACY(which, 0, 0, 0, 0)
> +#define SBI_CALL_LEGACY_1(which, arg0) SBI_CALL_LEGACY(which, arg0, 0, 0, 0)
> +#define SBI_CALL_LEGACY_2(which, arg0, arg1) \
> +		SBI_CALL_LEGACY(which, arg0, arg1, 0, 0)
> +#define SBI_CALL_LEGACY_3(which, arg0, arg1, arg2) \
> +		SBI_CALL_LEGACY(which, arg0, arg1, arg2, 0)
> +#define SBI_CALL_LEGACY_4(which, arg0, arg1, arg2, arg3) \
> +		SBI_CALL_LEGACY(which, arg0, arg1, arg2, arg3)

When you touch this anyway I'd suggest you kill these rather
pointless wrappers as well as the comment above them.

  parent reply	other threads:[~2019-08-27 14:03 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 23:32 [RFC PATCH 0/2] Add support for SBI version to 0.2 Atish Patra
2019-08-26 23:32 ` Atish Patra
2019-08-26 23:32 ` [RFC PATCH 1/2] RISC-V: Mark existing SBI as legacy SBI Atish Patra
2019-08-26 23:32   ` Atish Patra
2019-08-27  7:51   ` Mike Rapoport
2019-08-27  7:51     ` Mike Rapoport
2019-08-27  8:28     ` Anup Patel
2019-08-27  8:28       ` Anup Patel
2019-08-27  8:37       ` Mike Rapoport
2019-08-27  8:37         ` Mike Rapoport
2019-08-28 21:37         ` Palmer Dabbelt
2019-08-28 21:37           ` Palmer Dabbelt
2019-08-27 20:34     ` Atish Patra
2019-08-27 20:34       ` Atish Patra
2019-08-27 14:03   ` Christoph Hellwig [this message]
2019-08-27 14:03     ` Christoph Hellwig
2019-08-27 14:04     ` Christoph Hellwig
2019-08-27 14:04       ` Christoph Hellwig
2019-08-27 20:37     ` Atish Patra
2019-08-27 20:37       ` Atish Patra
2019-08-29 10:56       ` hch
2019-08-29 10:56         ` hch
2019-08-26 23:32 ` [RFC PATCH 2/2] RISC-V: Add basic support for SBI v0.2 Atish Patra
2019-08-26 23:32   ` Atish Patra
2019-08-27  7:58   ` Mike Rapoport
2019-08-27  7:58     ` Mike Rapoport
2019-08-27  8:23     ` Anup Patel
2019-08-27  8:23       ` Anup Patel
2019-08-27  8:39       ` Mike Rapoport
2019-08-27  8:39         ` Mike Rapoport
2019-08-27  9:28         ` Anup Patel
2019-08-27  9:28           ` Anup Patel
2019-08-27 20:30         ` Atish Patra
2019-08-27 20:30           ` Atish Patra
2019-08-27  9:36   ` Anup Patel
2019-08-27  9:36     ` Anup Patel
2019-08-27 20:43     ` Atish Patra
2019-08-27 20:43       ` Atish Patra
2019-08-27 14:11   ` Christoph Hellwig
2019-08-27 14:11     ` Christoph Hellwig
2019-08-27 14:46 ` [RFC PATCH 0/2] Add support for SBI version to 0.2 Christoph Hellwig
2019-08-27 14:46   ` Christoph Hellwig
2019-08-27 22:19   ` Atish Patra
2019-08-27 22:19     ` Atish Patra
2019-08-29 10:59     ` hch
2019-08-29 10:59       ` hch
2019-08-30 23:13       ` Atish Patra
2019-08-30 23:13         ` Atish Patra
2019-09-03  7:38         ` hch
2019-09-03  7:38           ` hch
     [not found]           ` <CANs6eMmcbtJ5KTU00LpfTtXszsdi1Jem_5j6GWO+8Yo3JnvTqg@mail.gmail.com>
2019-09-16  6:54             ` hch
2019-09-16  6:54               ` hch
2019-09-16 16:12               ` Palmer Dabbelt
2019-09-16 16:12                 ` Palmer Dabbelt

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=20190827140304.GA21855@infradead.org \
    --to=hch@infradead.org \
    --cc=alankao@andestech.com \
    --cc=alexios.zavras@intel.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@wdc.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rppt@linux.ibm.com \
    --cc=tglx@linutronix.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 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.