qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Klaus Jensen <its@irrelevant.dk>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Keith Busch <kbusch@kernel.org>,
	Jinhao Fan <fanjinhao21s@ict.ac.cn>,
	Guenter Roeck <linux@roeck-us.net>,
	Klaus Jensen <k.jensen@samsung.com>,
	qemu-stable@nongnu.org, qemu-riscv@nongnu.org
Subject: Re: [PATCH v3 4/4] hw/nvme: fix missing cq eventidx update
Date: Mon, 12 Dec 2022 12:37:05 +0100	[thread overview]
Message-ID: <93658dff-fcba-590e-ba53-e5fdb3d841c1@linaro.org> (raw)
In-Reply-To: <20221212113215.33135-5-its@irrelevant.dk>

On 12/12/22 12:32, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Prior to reading the shadow doorbell cq head, we have to update the
> eventidx. Otherwise, we risk that the driver will skip an mmio doorbell
> write. This happens on riscv64, as reported by Guenter.
> 
> Adding the missing update to the cq eventidx fixes the issue.
> 
> Fixes: 3f7fe8de3d49 ("hw/nvme: Implement shadow doorbell buffer support")
> Cc: qemu-stable@nongnu.org
> Cc: qemu-riscv@nongnu.org
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
>   hw/nvme/ctrl.c | 17 +++++++++++++++--
>   1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 8af70f0216f0..3df29ea68b2f 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -1334,10 +1334,22 @@ static inline void nvme_blk_write(BlockBackend *blk, int64_t offset,
>       }
>   }


>   static void nvme_update_cq_head(NvmeCQueue *cq)
>   {
> -    pci_dma_read(PCI_DEVICE(cq->ctrl), cq->db_addr, &cq->head,
> -                 sizeof(cq->head));
> +    uint32_t v;
> +
> +    pci_dma_read(PCI_DEVICE(cq->ctrl), cq->db_addr, &v, sizeof(v));
> +
> +    cq->head = le32_to_cpu(v);
>   

Isn't this be part of the previous patch?

>       trace_pci_nvme_update_cq_head(cq->cqid, cq->head);
>   }



  reply	other threads:[~2022-12-12 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 11:32 [PATCH v3 0/4] hw/nvme: fix broken shadow doorbells on some platforms Klaus Jensen
2022-12-12 11:32 ` [PATCH v3 1/4] hw/nvme: use QOM accessors Klaus Jensen
2022-12-12 11:32 ` [PATCH v3 2/4] hw/nvme: rename shadow doorbell related trace events Klaus Jensen
2022-12-12 11:32 ` [PATCH v3 3/4] hw/nvme: fix missing endian conversions for doorbell buffers Klaus Jensen
2022-12-12 11:35   ` Philippe Mathieu-Daudé
2022-12-12 11:32 ` [PATCH v3 4/4] hw/nvme: fix missing cq eventidx update Klaus Jensen
2022-12-12 11:37   ` Philippe Mathieu-Daudé [this message]
2022-12-12 11:39     ` Klaus Jensen

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=93658dff-fcba-590e-ba53-e5fdb3d841c1@linaro.org \
    --to=philmd@linaro.org \
    --cc=fanjinhao21s@ict.ac.cn \
    --cc=its@irrelevant.dk \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=linux@roeck-us.net \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-stable@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 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).