All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>
Cc: <kvm@vger.kernel.org>, <intel-xe@lists.freedesktop.org>,
	alex@shazbot.org, Manish Honap <mhonap@nvidia.com>
Subject: Re: [RFC PATCH 0/4] vfio/pci: Allow hiding BAR ranges from the VFIO user
Date: Thu, 5 Nov 2026 08:50:32 -0700	[thread overview]
Message-ID: <20261105085032.679881ff@shazbot.org> (raw)
In-Reply-To: <20261105153738.1938345-1-piotr.piorkowski@intel.com>

On Thu, 5 Nov 2026 16:37:34 +0100
"Piórkowski, Piotr" <piotr.piorkowski@intel.com> wrote:

> From: Piotr Piórkowski <piotr.piorkowski@intel.com>
> 
> Some devices have BAR ranges which shouldn't be exposed to the VFIO
> user, but vfio-pci exposes the memory BARs as a whole, apart from the
> MSI-X table.
> 
> This series lets the host hide ranges of the memory BARs. Reads of a
> hidden range return ones, writes to it are dropped, the pages containing
> it are never mapped (a sparse mmap capability advertises the rest of the
> BAR), and ioeventfds and dma-bufs covering it are rejected. The ranges
> are fixed while the device is bound and listed in
> /sys/.../vfio-dev/vfioX/hidden_bar_ranges.
> 
> The ranges can be hidden by the driver, with
> vfio_pci_core_hide_bar_ranges(), and by the host administrator, through
> configfs (CONFIG_VFIO_PCI_CONFIGFS). Only drivers which access their
> BARs exclusively through vfio-pci-core can hide ranges; vfio-pci and
> xe-vfio-pci declare it.
> 
> Patch 1 is a preparatory refactor, patch 2 adds the core mechanism,
> patch 3 the configfs interface and patch 4 per-device-ID defaults in
> xe-vfio-pci, with no ranges defined yet.
> 
> Sent as RFC for feedback on the approach and the interfaces.

See Manish's proposal for a generic excluded range interface to
generalize MSI-X table read/write and disable all access to CXL HDM
decoders:

https://lore.kernel.org/all/20261016161839.2765592-9-mhonap@nvidia.com/

Granting users the ability to manipulate excluded ranges through
configfs seems like a terrible idea, frankly.  Thanks,

Alex

> 
> Piotr Piórkowski (4):
>   vfio/pci: Move the excluded range handling out of
>     vfio_pci_core_do_io_rw()
>   vfio/pci: Allow hiding BAR ranges from the VFIO user
>   vfio/pci: Allow configuring hidden BAR ranges through configfs
>   vfio/xe: Hide BAR ranges by default per device ID
> 
>  Documentation/ABI/testing/configfs-vfio-pci   |  49 +++
>  .../ABI/testing/sysfs-devices-vfio-dev        |  13 +
>  drivers/vfio/pci/Kconfig                      |  13 +
>  drivers/vfio/pci/Makefile                     |   4 +-
>  drivers/vfio/pci/nvgrace-gpu/main.c           |   4 +-
>  drivers/vfio/pci/vfio_pci.c                   |   1 +
>  drivers/vfio/pci/vfio_pci_configfs.c          | 312 +++++++++++++++++
>  drivers/vfio/pci/vfio_pci_core.c              |  42 ++-
>  drivers/vfio/pci/vfio_pci_dmabuf.c            |  11 +
>  drivers/vfio/pci/vfio_pci_hidden_bar_ranges.c | 313 ++++++++++++++++++
>  drivers/vfio/pci/vfio_pci_priv.h              |  53 +++
>  drivers/vfio/pci/vfio_pci_rdwr.c              | 156 +++++++--
>  drivers/vfio/pci/xe/main.c                    |  60 +++-
>  include/linux/vfio_pci_core.h                 |  36 +-
>  14 files changed, 1009 insertions(+), 58 deletions(-)
>  create mode 100644 Documentation/ABI/testing/configfs-vfio-pci
>  create mode 100644 drivers/vfio/pci/vfio_pci_configfs.c
>  create mode 100644 drivers/vfio/pci/vfio_pci_hidden_bar_ranges.c
> 


  parent reply	other threads:[~2026-11-05 15:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 15:37 [RFC PATCH 0/4] vfio/pci: Allow hiding BAR ranges from the VFIO user Piórkowski, Piotr
2026-11-05 15:37 ` [RFC PATCH 1/4] vfio/pci: Move the excluded range handling out of vfio_pci_core_do_io_rw() Piórkowski, Piotr
2026-11-05 15:37 ` [RFC PATCH 2/4] vfio/pci: Allow hiding BAR ranges from the VFIO user Piórkowski, Piotr
2026-11-05 16:24   ` sashiko-bot
2026-11-05 15:37 ` [RFC PATCH 3/4] vfio/pci: Allow configuring hidden BAR ranges through configfs Piórkowski, Piotr
2026-11-05 15:37 ` [RFC PATCH 4/4] vfio/xe: Hide BAR ranges by default per device ID Piórkowski, Piotr
2026-11-05 15:55   ` Alex Williamson
2026-11-05 17:50     ` Piotr Piórkowski
2026-11-05 15:50 ` Alex Williamson [this message]
2026-11-05 16:17 ` ✗ CI.checkpatch: warning for vfio/pci: Allow hiding BAR ranges from the VFIO user Patchwork
2026-11-05 16:19 ` ✓ CI.KUnit: success " Patchwork
2026-11-05 16:35 ` ✗ CI.checksparse: warning " Patchwork
2026-11-05 16:55 ` ✓ Xe.CI.BAT: success " Patchwork
2026-11-06 15:52 ` ✗ Xe.CI.FULL: failure " Patchwork

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=20261105085032.679881ff@shazbot.org \
    --to=alex@shazbot.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kvm@vger.kernel.org \
    --cc=mhonap@nvidia.com \
    --cc=piotr.piorkowski@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.