OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[]
@ 2024-03-20 14:50 Clément Léger
  2024-03-20 14:57 ` Andreas Schwab
  2024-04-10  5:18 ` Anup Patel
  0 siblings, 2 replies; 4+ messages in thread
From: Clément Léger @ 2024-03-20 14:50 UTC (permalink / raw)
  To: opensbi

The sbi_hart_ext[] array is missing these two extensions ids. It is
expected that this array contains all the extensions declaration at the
same index of the SBI_HART_EXT_* define. Without this, when adding a new
extension, there is a mismatch between ids and extension names and it
can even display corrupted extension names.

Signed-off-by: Cl?ment L?ger <cleger@rivosinc.com>

---
 lib/sbi/sbi_hart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 3d13694..d68e2a0 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -666,6 +666,8 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
 	__SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG),
 	__SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND),
 	__SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
+	__SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND),
+	__SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG),
 };
 
 /**
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[]
  2024-03-20 14:50 [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[] Clément Léger
@ 2024-03-20 14:57 ` Andreas Schwab
  2024-03-20 15:21   ` Clément Léger
  2024-04-10  5:18 ` Anup Patel
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2024-03-20 14:57 UTC (permalink / raw)
  To: opensbi

On M?r 20 2024, Cl?ment L?ger wrote:

> The sbi_hart_ext[] array is missing these two extensions ids. It is
> expected that this array contains all the extensions declaration at the
> same index of the SBI_HART_EXT_* define. Without this, when adding a new
> extension, there is a mismatch between ids and extension names and it
> can even display corrupted extension names.
>
> Signed-off-by: Cl?ment L?ger <cleger@rivosinc.com>
>
> ---
>  lib/sbi/sbi_hart.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index 3d13694..d68e2a0 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -666,6 +666,8 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
>  	__SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG),
>  	__SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND),
>  	__SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
> +	__SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND),
> +	__SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG),
>  };

Please add a static_assert to verify that the size of sbi_hart_ext
agrees with SBI_HART_EXT_MAX.

-- 
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[]
  2024-03-20 14:57 ` Andreas Schwab
@ 2024-03-20 15:21   ` Clément Léger
  0 siblings, 0 replies; 4+ messages in thread
From: Clément Léger @ 2024-03-20 15:21 UTC (permalink / raw)
  To: opensbi



On 20/03/2024 15:57, Andreas Schwab wrote:
> On M?r 20 2024, Cl?ment L?ger wrote:
> 
>> The sbi_hart_ext[] array is missing these two extensions ids. It is
>> expected that this array contains all the extensions declaration at the
>> same index of the SBI_HART_EXT_* define. Without this, when adding a new
>> extension, there is a mismatch between ids and extension names and it
>> can even display corrupted extension names.
>>
>> Signed-off-by: Cl?ment L?ger <cleger@rivosinc.com>
>>
>> ---
>>  lib/sbi/sbi_hart.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
>> index 3d13694..d68e2a0 100644
>> --- a/lib/sbi/sbi_hart.c
>> +++ b/lib/sbi/sbi_hart.c
>> @@ -666,6 +666,8 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
>>  	__SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG),
>>  	__SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND),
>>  	__SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
>> +	__SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND),
>> +	__SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG),
>>  };
> 
> Please add a static_assert to verify that the size of sbi_hart_ext
> agrees with SBI_HART_EXT_MAX.

Yes sure.

Regards,

Cl?ment


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[]
  2024-03-20 14:50 [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[] Clément Léger
  2024-03-20 14:57 ` Andreas Schwab
@ 2024-04-10  5:18 ` Anup Patel
  1 sibling, 0 replies; 4+ messages in thread
From: Anup Patel @ 2024-04-10  5:18 UTC (permalink / raw)
  To: opensbi

On Wed, Mar 20, 2024 at 8:21?PM Cl?ment L?ger <cleger@rivosinc.com> wrote:
>
> The sbi_hart_ext[] array is missing these two extensions ids. It is
> expected that this array contains all the extensions declaration at the
> same index of the SBI_HART_EXT_* define. Without this, when adding a new
> extension, there is a mismatch between ids and extension names and it
> can even display corrupted extension names.
>
> Signed-off-by: Cl?ment L?ger <cleger@rivosinc.com>

I have taken _Static_assert() and Fixes tag from Heinrich's patch.

Reviewed-by: Anup Patel <anup@brainfault.org>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup


>
> ---
>  lib/sbi/sbi_hart.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index 3d13694..d68e2a0 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -666,6 +666,8 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
>         __SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG),
>         __SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND),
>         __SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
> +       __SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND),
> +       __SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG),
>  };
>
>  /**
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-10  5:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20 14:50 [PATCH] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[] Clément Léger
2024-03-20 14:57 ` Andreas Schwab
2024-03-20 15:21   ` Clément Léger
2024-04-10  5:18 ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox