From: Peter Maydell <peter.maydell@linaro.org>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: "Klaus Jensen" <its@irrelevant.dk>,
qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Keith Busch" <kbusch@kernel.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Hanna Reitz" <hreitz@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
qemu-block@nongnu.org, "Fam Zheng" <fam@euphon.net>,
"Klaus Jensen" <k.jensen@samsung.com>,
qemu-stable@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PULL 1/1] hw/nvme: fix endianness issue for shadow doorbells
Date: Thu, 20 Jul 2023 09:43:31 +0100 [thread overview]
Message-ID: <CAFEAcA-BwdoxeiFjA8Xce-fX9j8Qf2FcrJBKBhgKbONVfrJ7ew@mail.gmail.com> (raw)
In-Reply-To: <437f0e05-f052-cb78-418f-054378c6ae68@tls.msk.ru>
On Wed, 19 Jul 2023 at 21:13, Michael Tokarev <mjt@tls.msk.ru> wrote:
>
> 19.07.2023 10:36, Klaus Jensen wrote:
> pu(req->cmd.dptr.prp2);
> > + uint32_t v;
>
> > if (sq) {
> > + v = cpu_to_le32(sq->tail);
>
> > - pci_dma_write(pci, sq->db_addr, &sq->tail, sizeof(sq->tail));
> > + pci_dma_write(pci, sq->db_addr, &v, sizeof(sq->tail));
>
> This and similar cases hurts my eyes.
>
> Why we pass address of v here, but use sizeof(sq->tail) ?
>
> Yes, I know both in theory should be of the same size, but heck,
> this is puzzling at best, and confusing in a regular case.
>
> Dunno how it slipped in the review, it instantly catched my eye
> in a row of applied patches..
>
> Also, why v is computed a few lines before it is used, with
> some expressions between the assignment and usage?
>
> How about the following patch:
If you're going to change this, better to take the approach
Philippe suggested in review of using stl_le_pci_dma().
https://lore.kernel.org/qemu-devel/376e5e45-a3e7-0029-603a-b7ad9673fac4@linaro.org/
thanks
-- PMM
next prev parent reply other threads:[~2023-07-20 8:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 7:36 [PULL 0/1] hw/nvme fixes Klaus Jensen
2023-07-19 7:36 ` [PULL 1/1] hw/nvme: fix endianness issue for shadow doorbells Klaus Jensen
2023-07-19 20:13 ` Michael Tokarev
2023-07-20 8:43 ` Peter Maydell [this message]
2023-07-20 8:49 ` Klaus Jensen
2023-07-20 8:51 ` Peter Maydell
2023-07-20 8:55 ` Klaus Jensen
2023-07-19 19:30 ` [PULL 0/1] hw/nvme fixes Peter Maydell
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=CAFEAcA-BwdoxeiFjA8Xce-fX9j8Qf2FcrJBKBhgKbONVfrJ7ew@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=clg@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=its@irrelevant.dk \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).