linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* VFIO (PCI) and write combine mapping of BARs
@ 2023-07-14  2:32 Benjamin Herrenschmidt
  2023-07-14  7:13 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2023-07-14  2:32 UTC (permalink / raw)
  To: kvm; +Cc: linux-kernel, alex.williamson, osamaabb, linux-pci, Clint Sbisa

Hi Folks !

I'd like to revive an old discussion as we (Amazon Linux) have been
getting asks for it.

What's the best interface to provide the option of write combine mmap's
of BARs via VFIO ?

The problem isn't so much the low level implementation, we just have to
play with the pgprot, the question is more around what API to present
to control this.

One trivial way would be to have an ioctl to set a flag for a given
region/BAR that cause subsequent mmap's to use write-combine. We would
have to keep a bitmap for the "legacy" regions, and use a flag in
struct vfio_pci_region for the others.

One potentially better way is to make it strictly an attribute of
vfio_pci_region, along with an ioctl that creates a "subregion". The
idea here is that we would have an ioctl to create a region from an
existing region dynamically, which represents a subset of the original
region (typically a BAR), with potentially different attributes (or we
keep the attribute get/set separate).

I like the latter more because it will allow to more easily define that
portions of a BAR can need different attributes without causing
state/race issues between setting the attribute and mmap.

This will also enable other attributes than write-combine if/when the
need arises.

Any better idea ? thoughs ? objections ?

This is still quite specific to PCI, but so is the entire regions
mechanism, so I don't see an easy path to something more generic at
this stage.

Cheers,
Ben.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-26  1:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-14  2:32 VFIO (PCI) and write combine mapping of BARs Benjamin Herrenschmidt
2023-07-14  7:13 ` Lorenzo Pieralisi
2023-07-14 12:37   ` Jason Gunthorpe
2023-07-25  6:15     ` Benjamin Herrenschmidt
2023-07-25 11:39       ` Jason Gunthorpe
2023-07-26  1:19         ` Benjamin Herrenschmidt

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).