qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Farhan Ali <alifm@linux.ibm.com>, qemu-devel@nongnu.org
Cc: mjrosato@linux.ibm.com, schnelle@linux.ibm.com,
	qemu-block@nongnu.org, qemu-s390x@nongnu.org,
	stefanha@redhat.com, fam@euphon.net, kwolf@redhat.com,
	hreitz@redhat.com, thuth@redhat.com
Subject: Re: [PATCH v2 3/3] block/nvme: Use QEMU PCI MMIO API
Date: Fri, 28 Mar 2025 21:41:28 +0100	[thread overview]
Message-ID: <43922be5-e1cb-4a57-8341-4a9dea9c6af4@linaro.org> (raw)
In-Reply-To: <20250328190627.3025-4-alifm@linux.ibm.com>

On 28/3/25 20:06, Farhan Ali wrote:
> Use the QEMU PCI MMIO functions to read/write
> to NVMe registers, rather than directly accessing
> them.
> 
> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
> ---
>   block/nvme.c | 37 +++++++++++++++++++++----------------
>   1 file changed, 21 insertions(+), 16 deletions(-)


> @@ -805,16 +807,17 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
>       bs->bl.request_alignment = s->page_size;
>       timeout_ms = MIN(500 * NVME_CAP_TO(cap), 30000);
>   
> -    ver = le32_to_cpu(regs->vs);
> +    ver = qemu_pci_mmio_read_32(&regs->vs);
>       trace_nvme_controller_spec_version(extract32(ver, 16, 16),
>                                          extract32(ver, 8, 8),
>                                          extract32(ver, 0, 8));
>   
>       /* Reset device to get a clean state. */
> -    regs->cc = cpu_to_le32(le32_to_cpu(regs->cc) & 0xFE);
> +    cc = qemu_pci_mmio_read_32(&regs->cc);
> +    qemu_pci_mmio_write_32(&regs->cc, (cc & 0xFE));

Extra parenthesis not needed, otherwise:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2025-03-28 20:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 19:06 [PATCH v2 0/3] Enable QEMU NVMe userspace driver on s390x Farhan Ali
2025-03-28 19:06 ` [PATCH v2 1/3] util: Add functions for s390x mmio read/write Farhan Ali
2025-03-31  7:34   ` Niklas Schnelle
2025-03-28 19:06 ` [PATCH v2 2/3] include: Add a header to define PCI MMIO functions Farhan Ali
2025-03-28 20:38   ` Philippe Mathieu-Daudé
2025-03-29  5:58     ` Farhan Ali
2025-03-28 20:44   ` Philippe Mathieu-Daudé
2025-03-29  6:03     ` Farhan Ali
2025-03-29  6:50       ` Philippe Mathieu-Daudé
2025-03-31 13:46   ` Stefan Hajnoczi
2025-04-01 13:02     ` Farhan Ali
2025-03-28 19:06 ` [PATCH v2 3/3] block/nvme: Use QEMU PCI MMIO API Farhan Ali
2025-03-28 20:41   ` Philippe Mathieu-Daudé [this message]
2025-03-29  6:04     ` Farhan Ali
2025-03-31 16:58   ` Stefan Hajnoczi

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=43922be5-e1cb-4a57-8341-4a9dea9c6af4@linaro.org \
    --to=philmd@linaro.org \
    --cc=alifm@linux.ibm.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=schnelle@linux.ibm.com \
    --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).