From: Alex Williamson <alex.williamson@redhat.com>
To: Farhan Ali <alifm@linux.ibm.com>
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
"Niklas Schnelle" <schnelle@linux.ibm.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org,
qemu-s390x@nongnu.org, fam@euphon.net, philmd@linaro.org,
kwolf@redhat.com, hreitz@redhat.com, thuth@redhat.com,
mjrosato@linux.ibm.com, "Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x
Date: Thu, 3 Apr 2025 12:05:04 -0600 [thread overview]
Message-ID: <20250403120504.2f660171.alex.williamson@redhat.com> (raw)
In-Reply-To: <2c244588-b37b-4e86-863e-ef462343edad@linux.ibm.com>
On Thu, 3 Apr 2025 10:33:52 -0700
Farhan Ali <alifm@linux.ibm.com> wrote:
> On 4/3/2025 9:27 AM, Alex Williamson wrote:
> > On Thu, 3 Apr 2025 11:44:42 -0400
> > Stefan Hajnoczi <stefanha@redhat.com> wrote:
> >
> >> On Thu, Apr 03, 2025 at 09:47:26AM +0200, Niklas Schnelle wrote:
> >>> On Wed, 2025-04-02 at 11:51 -0400, Stefan Hajnoczi wrote:
> >>>> On Tue, Apr 01, 2025 at 10:22:43AM -0700, Farhan Ali wrote:
> >>>>> Hi,
> >>>>>
> >>>>> Recently on s390x we have enabled mmap support for vfio-pci devices [1].
> >>>> Hi Alex,
> >>>> I wanted to bring this to your attention. Feel free to merge it through
> >>>> the VFIO tree, otherwise I will merge it once you have taken a look.
> >>>>
> >>>> Thanks,
> >>>> Stefan
> >>>>
> >>>>> This allows us to take advantage and use userspace drivers on s390x. However,
> >>>>> on s390x we have special instructions for MMIO access. Starting with z15
> >>>>> (and newer platforms) we have new PCI Memory I/O (MIO) instructions which
> >>>>> operate on virtually mapped PCI memory spaces, and can be used from userspace.
> >>>>> On older platforms we would fallback to using existing system calls for MMIO access.
> >>>>>
> >>>>> This patch series introduces support the PCI MIO instructions, and enables s390x
> >>>>> support for the userspace NVMe driver on s390x. I would appreciate any review/feedback
> >>>>> on the patches.
> >>>>>
> >>>>> Thanks
> >>>>> Farhan
> >>> Hi Stefan,
> >>>
> >>> the kernel patch actually made it into Linus' tree for v6.15 already as
> >>> commit aa9f168d55dc ("s390/pci: Support mmap() of PCI resources except
> >>> for ISM devices") plus prerequisites. This went via the PCI tree
> >>> because they included a change to struct pci_dev and also enabled
> >>> mmap() on PCI resource files. Alex reviewed an earlier version and was
> >>> the one who suggested to also enable mmap() on PCI resources.
> >> The introduction of a new QEMU API for accessing MMIO BARs in this
> >> series is something Alex might be interested in as QEMU VFIO maintainer.
> >> That wouldn't have been part of the kernel patch review.
> >>
> >> If he's aware of the new API he can encourage other VFIO users to use it
> >> in the future so that you won't need to convert them to work on s390x
> >> again.
> > I don't claim any jurisdiction over the vfio-nvme driver. In general
> > vfio users should be using either vfio_region_ops, ram_device_mem_ops,
> > or directly mapping MMIO into the VM address space. The first uses
> > pread/write through the region offset, irrespective of the type of
> > memory, the second provides the type of access used here where we're
> > dereferencing into an mmap, and the last if of course the preferred
> > mechanism where available.
> >
> > It is curious that the proposal here doesn't include any changes to
> > ram_device_mem_ops for more generically enabling MMIO access on s390x.
> > Thanks,
> >
> > Alex
>
>
> Hi Alex,
> From my understanding the ram_device_mem_ops sets up the BAR access for
> a guest passthrough device. Unfortunately today an s390x KVM guest
> doesn't use and have support for these MIO instructions. We wanted to
> use this series as an initial test vehicle of the mmap support.
Right, ram_device_mem_ops is what we'll use to access a BAR that
supports mmap but for whatever reason we're accessing it directly
through the mmap. For instance if an overlapping quirk prevents the
page from being mapped to the VM or we have some back channel mechanism
where the VMM is interacting with the BAR.
I bring it up here because it's effectively the same kind of access
you're adding with these helpers and would need to be addressed if this
were generically enabling vfio mmap access on s390x.
Prior to commit 2b8fe81b3c2e ("system/memory: use ldn_he_p/stn_he_p")
the mmio helpers here might have been a drop-in replacement for the
dereferencing of mmap offsets, but something would need to be done
about the explicit PCI assumption introduced here and the possibility
of unaligned accesses that the noted commit tries to resolve. Thanks,
Alex
next prev parent reply other threads:[~2025-04-03 18:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 17:22 [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x Farhan Ali
2025-04-01 17:22 ` [PATCH v3 1/3] util: Add functions for s390x mmio read/write Farhan Ali
2025-04-01 17:22 ` [PATCH v3 2/3] include: Add a header to define host PCI MMIO functions Farhan Ali
2025-04-02 14:09 ` Stefan Hajnoczi
2025-04-01 17:22 ` [PATCH v3 3/3] block/nvme: Use host PCI MMIO API Farhan Ali
2025-04-02 15:51 ` [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x Stefan Hajnoczi
2025-04-03 7:47 ` Niklas Schnelle
2025-04-03 15:44 ` Stefan Hajnoczi
2025-04-03 16:27 ` Alex Williamson
2025-04-03 17:33 ` Farhan Ali
2025-04-03 18:05 ` Alex Williamson [this message]
2025-04-03 20:33 ` Farhan Ali
2025-04-03 21:24 ` Alex Williamson
2025-04-10 16:07 ` Farhan Ali
2025-04-11 22:28 ` Alex Williamson
2025-04-11 23:28 ` Farhan Ali
2025-04-15 7:28 ` Niklas Schnelle
2025-04-04 7:05 ` Cédric Le Goater
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=20250403120504.2f660171.alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=alifm@linux.ibm.com \
--cc=clg@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=philmd@linaro.org \
--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).