qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection


From: Alistair Francis
Subject: Re: [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection
Date: Wed, 29 Sep 2021 08:45:12 +1000

On Mon, Sep 27, 2021 at 5:21 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> At present the codes detect whether the DMA channel is claimed by:
>
>   claimed = !!s->chan[ch].control & CONTROL_CLAIM;
>
> As ! has higher precedence over & (bitwise and), this is essentially
>
>   claimed = (!!s->chan[ch].control) & CONTROL_CLAIM;
>
> which is wrong, as any non-zero bit set in the control register will
> produce a result of a claimed channel.
>
> Fixes: de7c7988d25d ("hw/dma: sifive_pdma: reset Next* registers when 
> Control.claim is set")
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

>
> ---
>
> Changes in v2:
> - reword the commit message
>
>  hw/dma/sifive_pdma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/dma/sifive_pdma.c b/hw/dma/sifive_pdma.c
> index b4fd40573a..b8ec7621f3 100644
> --- a/hw/dma/sifive_pdma.c
> +++ b/hw/dma/sifive_pdma.c
> @@ -243,7 +243,7 @@ static void sifive_pdma_write(void *opaque, hwaddr offset,
>      offset &= 0xfff;
>      switch (offset) {
>      case DMA_CONTROL:
> -        claimed = !!s->chan[ch].control & CONTROL_CLAIM;
> +        claimed = !!(s->chan[ch].control & CONTROL_CLAIM);
>
>          if (!claimed && (value & CONTROL_CLAIM)) {
>              /* reset Next* registers */
> --
> 2.25.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]