[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v5 0/9] vpci: allow queueing of mapping operations


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Wed, 8 Jul 2026 17:02:15 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Re+/NsS2fHCdtWKJR3e8eS6UfUmnYG0QhSgvKlhrUAw=; b=kOlUj9EZae2C+xc/H2eKbUT+oYXGm2iA/f9sNoMJavMR1LxGEF2GWhdd6EXL+k62GCWUIlqr6zpfeJvs4eEE4wXkYTJBVqrpEfCAGpaT1yG9Jwxur+LE4kNc74lpyQCKxTox2CaxhYdRK3VZjR4pNPzLka9r2n596pD+xIk662v1SIAayleBkATflxE0LYXkuVqvJ+dwR3yTv/cKAbH4iheMyCtux2qJQGw/HOy/zjewmP5yztnZYTw0jvTbG4TJRf264EPoBsTsFeMGYPZ+REaeXFt5j+cqzeRwfe9jMIM0xksVpOrAJsqEp/+Yz9y5P+GaPtHF8oW2mC6P7b4+vQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ds+Jnw6+Y13cP7or4zEp/SX7EBS0nFidmJBUFtYLuYJSuHClAbFlWGtVBofhERrjKgtBPQFQkohFVTNeUbTluBG9MRkj4q7HRCN4OzDJQu+7hJWqUFb4by+VYNVqjuPlEbJINND4QEyWK1vXsZZrsShOyBqZ557PlvYFgdKKeg3vKj3qnb+T14jKe4nn923LRpF+yixi9/mxni4B6m1FHFGOu1aBI5YP2x5F96vIov83Q8WA0nFkfr8s2EOfNRTPE6xkxbcYq8N/SNLBTBTJ721tXCwHfNpxY8yvAfTQz0Dsbmu6hsoEa4qCDRFAWY9k5nBPnY/TsT+0gJlFcriVtw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 08 Jul 2026 21:03:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Introduce the ability to queue p2m mapping operations in vPCI. This is
pre-requisite for both vPCI SR-IOV [2] and the ability to handle BAR writes
with memory decoding enabled [1]. I thought I might wait to submit the BAR-
write-with-memory-decoding-enabled patch until the prerequisite is reviewed
acked/merged, but if you'd find it more helpful for me to submit it right away
I'd be happy to do so (I've already pushed it to the gitlab pipeline [0]).

When multiple operations are queued, there are some non-trivial complexities
with the deferred setting of bar->enabled, header->rom_enabled, and
header->bars_mapped flags. If deferred, these flags wouldn't be updated until
the p2m op queue is processing, but we need to consult them in modify_bars()
at queue time, so they wouldn't be accurate when adding multiple tasks to the
queue. In order to simplify the deferred mapping state, and in particular
avoid complexities with the bar->enabled, header->rom_enabled, and
header->bars_mapped flags, I have picked up Roger's vPCI fixes series [3]. The
overall result is now that _only_ p2m operations are deferred. PCI config
space writes, flag-setting, and everything else is handled at queuing time.

1. vpci: move BAR mapping permissions checks
2. vpci: make BAR mapping more resilient for the hardware domain
3. vpci: only check BAR validity once
4. vpci/msix: move MSI-X hole punching as a result of memory decoding enable
5. vpci: simplify handling of memory decoding and ROM enable writes
6. vpci: create mem local variables
7. vpci: split vpci_process_pending()
8. vpci: allow queueing of mapping operations
9. vpci: don't pass command value to modify_bars()

Patch 1 is code movement, and patch 2 is hardening map_range(). While these
 first 2 are not strictly pre-requisites for queued mapping, they simplify the
 subsequent prepwork.
Patches 3-5 progressively remove modify_decoding().
Patches 6-7 are non-functional changes pulled out from patch 8.
Patch 8 is the core feature: pre-requisite for SR-IOV and BAR-write-with-
 memory-decoding-enabled.
Patch 9 is cleanup I chose to put at the end for lower diffstat.

Patches 2-5 are borrowed from Roger's vPCI fixes series [3]. These patches
have gone directly from v1 to v5, but otherwise revlogs are written assuming
this is a continuation of the BAR-write-with-memory-decoding-enabled series.

v4->v5:
* don't defer anything that's not p2m related
* drop ("vpci: allow 32-bit BAR writes with memory decoding enabled") for now
  to focus on the pre-requisite patches first
* split non-functional changes

v3->v4:
* switch back to dynamically allocated queue elements

v2->v3:
* add ("vpci: Use pervcpu ranges for BAR mapping")
* rework with fixed array of map/unmap slots

v1->v2:
* new approach with queued p2m operations

RFC->v1:
* rework BAR mapping machinery to support unmap-then-map operation

[0] Pipeline: 
https://gitlab.com/xen-project/people/stewarthildebrand/xen/-/pipelines/2662651745

[1] BAR write with memory decoding enabled
v4: 
https://lore.kernel.org/xen-devel/20260406191203.97662-1-stewart.hildebrand@xxxxxxx/T/#t
v3: 
https://lore.kernel.org/xen-devel/20260324030513.700217-1-stewart.hildebrand@xxxxxxx/T/#t
v2: 
https://lore.kernel.org/xen-devel/20250723163744.13095-1-stewart.hildebrand@xxxxxxx/T/#t
v1: 
https://lore.kernel.org/xen-devel/20250531125405.268984-1-stewart.hildebrand@xxxxxxx/T/#t
RFC: 
https://lore.kernel.org/xen-devel/20250312195019.382926-1-stewart.hildebrand@xxxxxxx/T/#t
Gitlab: https://gitlab.com/xen-project/xen/-/issues/197

[2] vPCI SR-IOV
v3: 
https://lore.kernel.org/xen-devel/cover.1775742115.git.mykyta_poturai@xxxxxxxx/T/#t
v2: 
https://lore.kernel.org/xen-devel/cover.1772806036.git.mykyta_poturai@xxxxxxxx/T/#t
v1: 
https://lore.kernel.org/xen-devel/cover.1753450965.git.mykyta_poturai@xxxxxxxx/T/#t
2018 v2 
https://lore.kernel.org/xen-devel/20180717094830.54806-1-roger.pau@xxxxxxxxxx/T/#t

[3] vPCI miscellaneous fixes
https://lore.kernel.org/xen-devel/20250814160358.95543-1-roger.pau@xxxxxxxxxx/T/#t


 xen/common/domain.c        |   5 +
 xen/drivers/vpci/header.c  | 443 +++++++++++++++++++++----------------
 xen/drivers/vpci/private.h |   1 +
 xen/drivers/vpci/vpci.c    |  17 +-
 xen/include/xen/vpci.h     |  15 +-
 5 files changed, 279 insertions(+), 202 deletions(-)


base-commit: 03851197a7b2cd58851b9ec2293bdf4a68c47b66
-- 
2.54.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.