All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: "David Laight" <david.laight.linux@gmail.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Atish Patra" <atishp@rivosinc.com>,
	"Andrew Jones" <ajones@ventanamicro.com>,
	"Clément Léger" <cleger@rivosinc.com>,
	"Anup Patel" <apatel@ventanamicro.com>
Subject: Re: [PATCH 2/2] RISC-V: make use of variadic sbi_ecall
Date: Fri, 13 Jun 2025 19:08:17 +0200	[thread overview]
Message-ID: <DALKK6MHWD7D.3ZFXSS6YNLHL@ventanamicro.com> (raw)
In-Reply-To: <20250613165226.751541c6@pumpkin>

2025-06-13T16:52:26+01:00, David Laight <david.laight.linux@gmail.com>:
> On Fri, 13 Jun 2025 16:10:52 +0200
> Radim Krčmář <rkrcmar@ventanamicro.com> wrote:
>
> ...
>> The macro will result in the same arguments as before, and it is what
>> the sbi_ecall actually should do.
>
> Ugg...
> Are you using pre-processor 'magic' to add a pile of zeros and then
> select the first 'n' arguments?

Sadly, yes.  The zeros should have never been introduced in the code, so
I'm hiding them for the moment.
I planned to remove the useless zeros in future patches.

> That ought to be banned as error prone.

Sounds reasonable to me.  I will try to fix the insane tracepoint bloat,
and send a v2 that fills only the correct amount of registers for the
ecall instruction.

> I think the one for strncpy() removes the immediate compile error for:
> 	strncpy(dest, src, 1, 2);

I would have preferred if sbi.h had a wrapper function for each SBI
function, and we never allowed direct invocation of the ecall
instruction outside of the library.

_______________________________________________
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: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: "David Laight" <david.laight.linux@gmail.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Atish Patra" <atishp@rivosinc.com>,
	"Andrew Jones" <ajones@ventanamicro.com>,
	"Clément Léger" <cleger@rivosinc.com>,
	"Anup Patel" <apatel@ventanamicro.com>
Subject: Re: [PATCH 2/2] RISC-V: make use of variadic sbi_ecall
Date: Fri, 13 Jun 2025 19:08:17 +0200	[thread overview]
Message-ID: <DALKK6MHWD7D.3ZFXSS6YNLHL@ventanamicro.com> (raw)
In-Reply-To: <20250613165226.751541c6@pumpkin>

2025-06-13T16:52:26+01:00, David Laight <david.laight.linux@gmail.com>:
> On Fri, 13 Jun 2025 16:10:52 +0200
> Radim Krčmář <rkrcmar@ventanamicro.com> wrote:
>
> ...
>> The macro will result in the same arguments as before, and it is what
>> the sbi_ecall actually should do.
>
> Ugg...
> Are you using pre-processor 'magic' to add a pile of zeros and then
> select the first 'n' arguments?

Sadly, yes.  The zeros should have never been introduced in the code, so
I'm hiding them for the moment.
I planned to remove the useless zeros in future patches.

> That ought to be banned as error prone.

Sounds reasonable to me.  I will try to fix the insane tracepoint bloat,
and send a v2 that fills only the correct amount of registers for the
ecall instruction.

> I think the one for strncpy() removes the immediate compile error for:
> 	strncpy(dest, src, 1, 2);

I would have preferred if sbi.h had a wrapper function for each SBI
function, and we never allowed direct invocation of the ecall
instruction outside of the library.

  reply	other threads:[~2025-06-13 18:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 14:57 [PATCH 0/2] RISC-V: turn sbi_ecall into a variadic macro Radim Krčmář
2025-06-12 14:57 ` Radim Krčmář
2025-06-12 14:57 ` [PATCH 1/2] RISC-V: sbi: turn sbi_ecall into " Radim Krčmář
2025-06-12 14:57   ` Radim Krčmář
2025-06-12 15:14   ` Thomas Weißschuh
2025-06-12 15:14     ` Thomas Weißschuh
2025-06-12 15:35     ` Radim Krčmář
2025-06-12 15:35       ` Radim Krčmář
2025-06-12 14:57 ` [PATCH 2/2] RISC-V: make use of variadic sbi_ecall Radim Krčmář
2025-06-12 14:57   ` Radim Krčmář
2025-06-13 10:54   ` David Laight
2025-06-13 10:54     ` David Laight
2025-06-13 14:10     ` Radim Krčmář
2025-06-13 14:10       ` Radim Krčmář
2025-06-13 15:52       ` David Laight
2025-06-13 15:52         ` David Laight
2025-06-13 17:08         ` Radim Krčmář [this message]
2025-06-13 17:08           ` Radim Krčmář

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=DALKK6MHWD7D.3ZFXSS6YNLHL@ventanamicro.com \
    --to=rkrcmar@ventanamicro.com \
    --cc=ajones@ventanamicro.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=atishp@rivosinc.com \
    --cc=cleger@rivosinc.com \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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.