Skip to content

Commit 033e0e2

Browse files
Mr-Bossmanavpatel
authored andcommitted
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: 97f234f ("lib: sbi: Introduce the SBI debug triggers extension support") Signed-off-by: Jesse Taube <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Tested-by: Charlie Jenkins <[email protected]> Reviewed-by: Himanshu Chauhan <[email protected]> Tested-by: Himanshu Chauhan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
1 parent 9f64f06 commit 033e0e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/sbi/sbi_dbtr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct sbi_dbtr_hart_triggers_state {
9090
}while (0);
9191

9292
/** SBI shared mem messages layout */
93-
struct sbi_dbtr_shmem_entry {
93+
union sbi_dbtr_shmem_entry {
9494
struct sbi_dbtr_data_msg data;
9595
struct sbi_dbtr_id_msg id;
9696
};

lib/sbi/sbi_dbtr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ int sbi_dbtr_read_trig(unsigned long smode,
506506
{
507507
struct sbi_dbtr_data_msg *xmit;
508508
struct sbi_dbtr_trigger *trig;
509-
struct sbi_dbtr_shmem_entry *entry;
509+
union sbi_dbtr_shmem_entry *entry;
510510
void *shmem_base = NULL;
511511
struct sbi_dbtr_hart_triggers_state *hs = NULL;
512512

@@ -541,7 +541,7 @@ int sbi_dbtr_install_trig(unsigned long smode,
541541
unsigned long trig_count, unsigned long *out)
542542
{
543543
void *shmem_base = NULL;
544-
struct sbi_dbtr_shmem_entry *entry;
544+
union sbi_dbtr_shmem_entry *entry;
545545
struct sbi_dbtr_data_msg *recv;
546546
struct sbi_dbtr_id_msg *xmit;
547547
unsigned long ctrl;
@@ -659,7 +659,7 @@ int sbi_dbtr_update_trig(unsigned long smode,
659659
struct sbi_dbtr_data_msg *recv;
660660
unsigned long uidx = 0;
661661
struct sbi_dbtr_trigger *trig;
662-
struct sbi_dbtr_shmem_entry *entry;
662+
union sbi_dbtr_shmem_entry *entry;
663663
void *shmem_base = NULL;
664664
struct sbi_dbtr_hart_triggers_state *hs = NULL;
665665

0 commit comments

Comments
 (0)