Re: [PATCH 03/18] dbtr: Fix endian conversion in trigger install handler

Himanshu Chauhan <[email protected]>
Newsgroups org.infradead.lists.opensbi
Message-ID <[email protected]>
On Fri, Mar 13, 2026 at 03:19:32PM +1000, Nicholas Piggin wrote:
> An endian conversion was missed loading tdata1 from shm. Add the
> conversion and change the variable name from ctrl to tdata1 while here.
> 
> Signed-off-by: Nicholas Piggin <[email protected]>
> ---
>  lib/sbi/sbi_dbtr.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
> index 8f59e407..10ed6b3e 100644
> --- a/lib/sbi/sbi_dbtr.c
> +++ b/lib/sbi/sbi_dbtr.c
> @@ -589,7 +589,6 @@ int sbi_dbtr_install_trig(unsigned long smode,
>  	union sbi_dbtr_shmem_entry *entry;
>  	struct sbi_dbtr_data_msg *recv;
>  	struct sbi_dbtr_id_msg *xmit;
> -	unsigned long ctrl;
>  	struct sbi_dbtr_trigger *trig;
>  	struct sbi_dbtr_hart_triggers_state *hs = NULL;
>  
> @@ -609,17 +608,19 @@ int sbi_dbtr_install_trig(unsigned long smode,
>  
>  	/* Check requested triggers configuration */
>  	for_each_trig_entry(shmem_base, trig_count, typeof(*entry), entry) {
> +		unsigned long tdata1;
> +
>  		recv = (struct sbi_dbtr_data_msg *)(&entry->data);
> -		ctrl = recv->tdata1;
> +		tdata1 = lle_to_cpu(recv->tdata1);
>  
> -		if (!dbtr_trigger_supported(TDATA1_GET_TYPE(ctrl))) {
> +		if (!dbtr_trigger_supported(TDATA1_GET_TYPE(tdata1))) {
>  			*out = _idx;
>  			sbi_hart_protection_unmap_range((unsigned long)shmem_base,
>  							trig_count * sizeof(*entry));
>  			return SBI_ERR_FAILED;
>  		}
>  
> -		if (!dbtr_trigger_valid(TDATA1_GET_TYPE(ctrl), ctrl)) {
> +		if (!dbtr_trigger_valid(TDATA1_GET_TYPE(tdata1), tdata1)) {
>  			*out = _idx;
>  			sbi_hart_protection_unmap_range((unsigned long)shmem_base,
>  							trig_count * sizeof(*entry));

Looks good.

Reviewed-by: Himanshu Chauhan <[email protected]>

Thanks
Himanshu

> -- 
> 2.51.0
> 
> 
> -- 
> opensbi mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/opensbi

-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.