Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, alex@shazbot.org
Subject: Re: [PATCH v7] vfio/pci: expose ACPI _ROM through a device region
Date: Fri, 4 Dec 2026 09:38:44 -0700	[thread overview]
Message-ID: <20261204093844.101c3a52@shazbot.org> (raw)
In-Reply-To: <20261204102624-mutt-send-email-mst@kernel.org>

On Fri, 4 Dec 2026 10:41:06 -0500
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Fri, Dec 04, 2026 at 08:03:33AM -0700, Alex Williamson wrote:
> > On Fri, 4 Dec 2026 06:19:54 -0500
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >   
> > > Some GPUs provide their option ROM through the ACPI _ROM method.
> > > According to the spec, _ROM, if present, must supercede the
> > > PCI ROM BAR, but VFIO currently provides no means to access its
> > > contents.
> > > 
> > > Let's report it through a new VFIO_REGION_TYPE_ACPI subtype:
> > > VFIO_REGION_SUBTYPE_ACPI_ROM.
> > > 
> > > Note that _ROM size is not provided by the firmware and has to be parsed
> > > from the image. Let's leave this to userspace.  
> > 
> > Nak.  This doesn't align with existing semantics that define other zero
> > sized regions as not present.  It also makes it non-deterministic which
> > region a user is trying to access based on offset.  The fixed region
> > spacing is implementation, not API.  The API is to use region offset
> > and size from the region-info ioctl.  We'll eventually be more densely
> > packing regions to account for BARs and device memory that exceed the
> > current 40 bit segmentation.  Thanks,
> > 
> > Alex  
> 
> Well exactly. And _ROM is not in device memory at all. It's offset is
> wholly artificial. Isn't it? So wouldn't packing a zero sized one be
> easier, going forward?
> 
> I don't insist, I can code up the parser, just making sure you are sure
> this is what you want.

Maybe there's a gap that isn't clear; all regions are offsets into the
device fd.  All region offsets are arbitrary.  We provide introspection
via the region-info ioctl.

The "push the problem to the user" solution here only works when each
region is sufficiently large and evenly segmented that we can use fixed
bits in the offset to determine the region handler.  Aside from
breaking existing semantics of regions with zero size, this breaks down
when we want to densely pack regions and we need to know how much space
each region requires to lay out the offset to region handler mappings.

Therefore, we eventually need to do the same ROM image sizing
internally, and an interim solution like this requires that the
algorithm is compatible with whatever results the user got from their
own algorithm previously.  I don't want to support that.

The ROM image walk internally to generate a cached size is really the
same approach I've been endorsing since my v1 reply.  Thanks,

Alex

      reply	other threads:[~2026-12-04 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:19 [PATCH v7] vfio/pci: expose ACPI _ROM through a device region Michael S. Tsirkin
2026-12-04 11:54 ` sashiko-bot
2026-12-04 15:03 ` Alex Williamson
2026-12-04 15:41   ` Michael S. Tsirkin
2026-12-04 16:38     ` Alex Williamson [this message]

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=20261204093844.101c3a52@shazbot.org \
    --to=alex@shazbot.org \
    --cc=kvm@vger.kernel.org \
    --cc=mst@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