mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: sbi: dbtr: Fix shared memory layout
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.
Replace struct with 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: 97f234f15c
("lib: sbi: Introduce the SBI debug triggers extension support")
Signed-off-by: Jesse Taube <jesse@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Himanshu Chauhan <hchauhan@ventanamicro.com>
Tested-by: Himanshu Chauhan <hchauhan@ventanamicro.com>
Link: https://lore.kernel.org/r/20250604135225.842241-1-jesse@rivosinc.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -90,7 +90,7 @@ struct sbi_dbtr_hart_triggers_state {
|
|||||||
}while (0);
|
}while (0);
|
||||||
|
|
||||||
/** SBI shared mem messages layout */
|
/** SBI shared mem messages layout */
|
||||||
struct sbi_dbtr_shmem_entry {
|
union sbi_dbtr_shmem_entry {
|
||||||
struct sbi_dbtr_data_msg data;
|
struct sbi_dbtr_data_msg data;
|
||||||
struct sbi_dbtr_id_msg id;
|
struct sbi_dbtr_id_msg id;
|
||||||
};
|
};
|
||||||
|
@@ -506,7 +506,7 @@ int sbi_dbtr_read_trig(unsigned long smode,
|
|||||||
{
|
{
|
||||||
struct sbi_dbtr_data_msg *xmit;
|
struct sbi_dbtr_data_msg *xmit;
|
||||||
struct sbi_dbtr_trigger *trig;
|
struct sbi_dbtr_trigger *trig;
|
||||||
struct sbi_dbtr_shmem_entry *entry;
|
union sbi_dbtr_shmem_entry *entry;
|
||||||
void *shmem_base = NULL;
|
void *shmem_base = NULL;
|
||||||
struct sbi_dbtr_hart_triggers_state *hs = NULL;
|
struct sbi_dbtr_hart_triggers_state *hs = NULL;
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ int sbi_dbtr_install_trig(unsigned long smode,
|
|||||||
unsigned long trig_count, unsigned long *out)
|
unsigned long trig_count, unsigned long *out)
|
||||||
{
|
{
|
||||||
void *shmem_base = NULL;
|
void *shmem_base = NULL;
|
||||||
struct sbi_dbtr_shmem_entry *entry;
|
union sbi_dbtr_shmem_entry *entry;
|
||||||
struct sbi_dbtr_data_msg *recv;
|
struct sbi_dbtr_data_msg *recv;
|
||||||
struct sbi_dbtr_id_msg *xmit;
|
struct sbi_dbtr_id_msg *xmit;
|
||||||
unsigned long ctrl;
|
unsigned long ctrl;
|
||||||
@@ -659,7 +659,7 @@ int sbi_dbtr_update_trig(unsigned long smode,
|
|||||||
struct sbi_dbtr_data_msg *recv;
|
struct sbi_dbtr_data_msg *recv;
|
||||||
unsigned long uidx = 0;
|
unsigned long uidx = 0;
|
||||||
struct sbi_dbtr_trigger *trig;
|
struct sbi_dbtr_trigger *trig;
|
||||||
struct sbi_dbtr_shmem_entry *entry;
|
union sbi_dbtr_shmem_entry *entry;
|
||||||
void *shmem_base = NULL;
|
void *shmem_base = NULL;
|
||||||
struct sbi_dbtr_hart_triggers_state *hs = NULL;
|
struct sbi_dbtr_hart_triggers_state *hs = NULL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user