[PATCH] lib: sbi: dbtr: Fix shared memory layout

Himanshu Chauhan hchauhan at ventanamicro.com
Tue May 27 21:17:20 PDT 2025


Thanks! I will take care of that.

On Wed, May 28, 2025 at 8:45 AM Charlie Jenkins <charlie at rivosinc.com> wrote:
>
> On Tue, May 27, 2025 at 11:27:13AM -0700, Jesse Taube wrote:
> > The existing sbi_dbtr_shmem_entry has a size of 5 * XLEN with the final
> > entry being idx. This is in contrast to the SBI v3.0-rc7 Chapter 19.
> > Debug Triggers Extension [0] where idx and trig_state share the same
> > offset (0) in shared memory, with a total size of 4 * XLEN for all the
> > SBI calls.
> >
> > Add union to match memory layout described in SBI.
> >
> > [0] https://github.com/riscv-non-isa/riscv-sbi-doc/tree/v3.0-rc7/src/ext-debug-triggers.adoc
> >
> > Fixes: 97f234f15c96 ("lib: sbi: Introduce the SBI debug triggers extension support")
> > Signed-off-by: Jesse Taube <jesse at rivosinc.com>
>
> Thanks!
>
> This will need to be reflected in the linux patch as well.
>
> Tested-by: Charlie Jenkins <charlie at rivosinc.com>
> Reviewed-by: Charlie Jenkins <charlie at rivosinc.com>
>
> [1] https://lore.kernel.org/all/20240222125059.13331-3-hchauhan@ventanamicro.com/
>
> > ---
> >  include/sbi/sbi_dbtr.h | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/sbi/sbi_dbtr.h b/include/sbi/sbi_dbtr.h
> > index a8b3a02..8cb776c 100644
> > --- a/include/sbi/sbi_dbtr.h
> > +++ b/include/sbi/sbi_dbtr.h
> > @@ -91,8 +91,10 @@ struct sbi_dbtr_hart_triggers_state {
> >
> >  /** SBI shared mem messages layout */
> >  struct sbi_dbtr_shmem_entry {
> > -     struct sbi_dbtr_data_msg data;
> > -     struct sbi_dbtr_id_msg id;
> > +     union {
> > +             struct sbi_dbtr_data_msg data;
> > +             struct sbi_dbtr_id_msg id;
> > +     };
> >  };
> >
> >  #define SBI_DBTR_SHMEM_ALIGN_MASK    ((__riscv_xlen / 8) - 1)
> > --
> > 2.43.0
> >



More information about the opensbi mailing list