OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Jesse Taube <jesse@rivosinc.com>
Cc: opensbi@lists.infradead.org,
	Himanshu Chauhan <hchauhan@ventanamicro.com>,
	Anup Patel <anup@brainfault.org>
Subject: Re: [PATCH] lib: sbi: dbtr: Fix shared memory layout
Date: Tue, 27 May 2025 20:15:23 -0700	[thread overview]
Message-ID: <aDZ_y3vX31nCLa30@ghost> (raw)
In-Reply-To: <20250527182713.527202-1-jesse@rivosinc.com>

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@rivosinc.com>

Thanks!

This will need to be reflected in the linux patch as well.

Tested-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@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
> 

-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

  reply	other threads:[~2025-05-28  3:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 18:27 [PATCH] lib: sbi: dbtr: Fix shared memory layout Jesse Taube
2025-05-28  3:15 ` Charlie Jenkins [this message]
2025-05-28  4:17   ` Himanshu Chauhan
2025-06-04  3:35 ` Himanshu Chauhan
2025-06-04 13:37   ` Jesse Taube

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=aDZ_y3vX31nCLa30@ghost \
    --to=charlie@rivosinc.com \
    --cc=anup@brainfault.org \
    --cc=hchauhan@ventanamicro.com \
    --cc=jesse@rivosinc.com \
    --cc=opensbi@lists.infradead.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