All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Frank Chang <frank.chang@sifive.com>,
	"open list:RISC-V" <qemu-riscv@nongnu.org>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection
Date: Mon, 27 Sep 2021 21:14:32 +0800	[thread overview]
Message-ID: <CAEUhbmU+N65N7NB=AO3O10Y_k0Hu9wnESk6AZ6r2PT4XH+AJAQ@mail.gmail.com> (raw)
In-Reply-To: <3e1507b8-81a4-aa98-5079-e07021be5a73@amsat.org>

Hi Philippe,

On Mon, Sep 27, 2021 at 8:56 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> On 9/27/21 09:21, Bin Meng 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.
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Maybe worth adding:
>
> Reported using GCC 9.3.0 on Ubuntu 20.04:
>
>   suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’
> to ‘~’ [-Werror=parentheses]

Actually GCC does not report this as CONTROL_CLAIM happens to be 1 in
this case, as I wrote in the v1 commit message. :)

Regards,
Bin


WARNING: multiple messages have this Message-ID (diff)
From: Bin Meng <bmeng.cn@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Alistair Francis <Alistair.Francis@wdc.com>,
	 "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"open list:RISC-V" <qemu-riscv@nongnu.org>,
	 Frank Chang <frank.chang@sifive.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection
Date: Mon, 27 Sep 2021 21:14:32 +0800	[thread overview]
Message-ID: <CAEUhbmU+N65N7NB=AO3O10Y_k0Hu9wnESk6AZ6r2PT4XH+AJAQ@mail.gmail.com> (raw)
In-Reply-To: <3e1507b8-81a4-aa98-5079-e07021be5a73@amsat.org>

Hi Philippe,

On Mon, Sep 27, 2021 at 8:56 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> On 9/27/21 09:21, Bin Meng 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.
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Maybe worth adding:
>
> Reported using GCC 9.3.0 on Ubuntu 20.04:
>
>   suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’
> to ‘~’ [-Werror=parentheses]

Actually GCC does not report this as CONTROL_CLAIM happens to be 1 in
this case, as I wrote in the v1 commit message. :)

Regards,
Bin


  reply	other threads:[~2021-09-27 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27  7:21 [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection Bin Meng
2021-09-27  7:21 ` [PATCH v2 2/2] hw/dma: sifive_pdma: Don't run DMA when channel is disclaimed Bin Meng
2021-09-28 22:46   ` Alistair Francis
2021-09-28 22:46     ` Alistair Francis
2021-09-28 23:15   ` Alistair Francis
2021-09-28 23:15     ` Alistair Francis
2021-09-27 12:56 ` [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection Philippe Mathieu-Daudé
2021-09-27 13:14   ` Bin Meng [this message]
2021-09-27 13:14     ` Bin Meng
2021-09-28 22:45 ` Alistair Francis
2021-09-28 22:45   ` Alistair Francis

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='CAEUhbmU+N65N7NB=AO3O10Y_k0Hu9wnESk6AZ6r2PT4XH+AJAQ@mail.gmail.com' \
    --to=bmeng.cn@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=frank.chang@sifive.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.