Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH 0/2] vfio/pci: CXL DVSEC config space fixes
@ 2026-12-02  9:11 mhonap
  2026-12-02  9:11 ` [PATCH 1/2] vfio/pci: Find the start of an abutting extended capability mhonap
  2026-12-02  9:11 ` [PATCH 2/2] vfio/pci: Make the CXL DVSEC read-only mhonap
  0 siblings, 2 replies; 5+ messages in thread
From: mhonap @ 2026-12-02  9:11 UTC (permalink / raw)
  To: alex, ankita, satyanarayana.k.v.p; +Cc: kjaju, mhonap, kvm, linux-cxl

From: Manish Honap <mhonap@nvidia.com>

Since commit 6467d0740a2b ("vfio/pci: Add DVSEC PCI Extended Config
Capability to user visible list."), vfio-pci shows every DVSEC to the
user and passes user writes to the device. The two patches posted in
this series fix two problems this can cause on CXL devices.

Patch 1 fixes how vfio-pci finds the start of an extended capability.
pci_config_map records the capability ID, and every DVSEC has ID 0x23,
so for a DVSEC that directly follows another DVSEC the start comes out
as the start of the first one. The user then reads the Next pointer
from the device and can reach a capability that vfio hid. Patch 1 takes
the start from the capability chain in vconfig.

Patch 2 makes the CXL Device DVSEC read-only on a function that is
CXL.cache and CXL.mem capable. Today the user can set Initiate CXL
Reset, which starts a reset the host does not know about, or set
CONFIG_LOCK, which stays set after the user closes the device. vfio-pci
gives such a user no device memory, so the user has nothing to enable
in the DVSEC. Patch 2 depends on patch 1 for a CXL DVSEC that follows
another DVSEC.

Both patches come from the review of 11/31 of the vfio-cxl v6 series
[1]. Alex asked for the read-only change as a separate patch with a
Fixes: tag [2].

Changes from vfio-cxl v6 11/31:
- Patch 1 is new. v6 worked around the wrong start inside the CXL DVSEC
  code only; patch 1 fixes vfio_find_cap_start() for every extended
  capability (Alex, 11/31).
- Patch 2 replaces the v6 guard map with read-only permissions for the
  whole DVSEC, and adds the Fixes: tag (Alex, 11/31).

[1] https://lore.kernel.org/all/20261016161839.2765592-1-mhonap@nvidia.com/
[2] https://lore.kernel.org/all/20261106151043.4f47679f@shazbot.org/

Testing:
 - Series applies cleanly to v7.4-rc4 (b6a9fa34ce41)
 - Tested with a passthrough guest on VR-NVL72 system with running
   CUDA/UVM workloads in guest.
 - Ran a host function profile of above run to confirm config space
   accesses through vfio_pci_config_rw_single()
 - No vfio selftests, kmemleak or sparse were run.

base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f

Manish Honap (2):
  vfio/pci: Find the start of an abutting extended capability
  vfio/pci: Make the CXL DVSEC read-only

 drivers/vfio/pci/vfio_pci_config.c | 44 ++++++++++++++++++++++++++++++
 include/linux/vfio_pci_core.h      |  1 +
 2 files changed, 45 insertions(+)

-- 
2.53.0


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

end of thread, other threads:[~2026-12-02  9:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  9:11 [PATCH 0/2] vfio/pci: CXL DVSEC config space fixes mhonap
2026-12-02  9:11 ` [PATCH 1/2] vfio/pci: Find the start of an abutting extended capability mhonap
2026-12-02  9:21   ` sashiko-bot
2026-12-02  9:11 ` [PATCH 2/2] vfio/pci: Make the CXL DVSEC read-only mhonap
2026-12-02  9:22   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox