drivers: hv: dxgkrnl: Driver for Hyper-V virtual compute device
Get series with b4
b4 am [email protected]Versions newest first
- v4 Latest55 patches 0 repliesNew
Changes in v4 from the cover letter · 17 lines
- Replace deprecated one-element arrays [1] with C99 flexible arrays []
- Replace %px with %p in trace macros
- Remove unnecessary braces from single-statement if blocks
- Remove LINUX_VERSION_CODE guard for max_pkt_size (added in 5.15, well before any target kernel for this submission)
- Remove linux/version.h include (no longer needed)
- Fix whitespace issues flagged by checkpatch
- Replace non-debug DXG_ERR do{}while(0) macro with direct dev_err call
- Change -EBADE to -ENODEV for global channel duplicate detection (as requested by Greg KH in v3 review)
- Remove MODULE_VERSION (not recommended for in-tree drivers)
- Add explanatory comment to guid_to_luid() cast
- Additional features and fixes developed in the WSL2 fork:
* dxgsyncfile: DMA fence / sync file integration
* D3DKMTEnumProcesses, D3DDKMTIsFeatureEnabled, D3DKMTInvalidateCache
* Compute-only adapter support
* pin_user_pages for DMA-accessible memory
* Retry logic for VMBus ring buffer full condition
* Various synchronization and memory safety fixes
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/55 | drivers: hv: dxgkrnl: Driver initialization and loadingMAINTAINERS drivers/ drivers/ +7 more | +840 | 0 replies | |
| 2/55 | drivers: hv: dxgkrnl: Add VMBus message support, initialize VMBus channels.drivers/ drivers/ drivers/ +4 more | +536 | 0 replies | |
| 3/55 | drivers: hv: dxgkrnl: Creation of dxgadapter objectdrivers/ drivers/ drivers/ +5 more | +844 | 0 replies | |
| 4/55 | drivers: hv: dxgkrnl: Opening of /dev/dxg device and dxgprocess creationdrivers/ drivers/ drivers/ +9 more | +1569 | 0 replies | |
| 5/55 | drivers: hv: dxgkrnl: Enumerate and open dxgadapter objectsdrivers/ drivers/ | +484 | 0 replies | |
| 6/55 | drivers: hv: dxgkrnl: Creation of dxgdevice objectsdrivers/ drivers/ drivers/ +5 more | +604 | 0 replies | |
| 7/55 | drivers: hv: dxgkrnl: Creation of dxgcontext objectsdrivers/ drivers/ drivers/ +5 more | +477 | 0 replies | |
| 8/55 | drivers: hv: dxgkrnl: Creation of compute device allocations and resourcesdrivers/ drivers/ drivers/ +5 more | +2004 | 0 replies | |
| 9/55 | drivers: hv: dxgkrnl: Creation of compute device sync objectsdrivers/ drivers/ drivers/ +5 more | +729 | 0 replies | |
| 10/55 | drivers: hv: dxgkrnl: Operations using sync objectsdrivers/ drivers/ drivers/ +5 more | +1311 | 0 replies | |
| 11/55 | drivers: hv: dxgkrnl: Sharing of dxgresource objectsdrivers/ drivers/ drivers/ +4 more | +1200 | 0 replies | |
| 12/55 | drivers: hv: dxgkrnl: Sharing of sync objectsdrivers/ drivers/ drivers/ +5 more | +1181 | 0 replies | |
| 13/55 | drivers: hv: dxgkrnl: Creation of paging queue objects.drivers/ drivers/ drivers/ +4 more | +418 | 0 replies | |
| 14/55 | drivers: hv: dxgkrnl: Submit execution commands to the compute devicedrivers/ drivers/ drivers/ +2 more | +316 | 0 replies | |
| 15/55 | drivers: hv: dxgkrnl: Share objects with the hostdrivers/ drivers/ drivers/ +2 more | +120 | 0 replies | |
| 16/55 | drivers: hv: dxgkrnl: Query the dxgdevice statedrivers/ drivers/ drivers/ +3 more | +261 | 0 replies | |
| 17/55 | drivers: hv: dxgkrnl: Map(unmap) CPU address to device allocationdrivers/ drivers/ drivers/ +3 more | +339 | 0 replies | |
| 18/55 | drivers: hv: dxgkrnl: Manage device allocation propertiesdrivers/ drivers/ drivers/ +2 more | +708 | 0 replies | |
| 19/55 | drivers: hv: dxgkrnl: Flush heap transitionsdrivers/ drivers/ drivers/ +3 more | +86 | 0 replies | |
| 20/55 | drivers: hv: dxgkrnl: Query video memory informationdrivers/ drivers/ drivers/ +2 more | +145 | 0 replies | |
| 21/55 | drivers: hv: dxgkrnl: The escape ioctldrivers/ drivers/ drivers/ +2 more | +167 | 0 replies | |
| 22/55 | drivers: hv: dxgkrnl: Ioctl to put device to error statedrivers/ drivers/ drivers/ +2 more | +82 | 0 replies | |
| 23/55 | drivers: hv: dxgkrnl: Ioctls to query statistics and clock calibrationdrivers/ drivers/ drivers/ +2 more | +277 | 0 replies | |
| 24/55 | drivers: hv: dxgkrnl: Offer and reclaim allocationsdrivers/ drivers/ drivers/ +2 more | +340 | 0 replies | |
| 25/55 | drivers: hv: dxgkrnl: Ioctls to manage scheduling prioritydrivers/ drivers/ drivers/ +2 more | +294 | 0 replies | |
| 26/55 | drivers: hv: dxgkrnl: Manage residency of allocationsdrivers/ drivers/ drivers/ +2 more | +322 | 0 replies | |
| 27/55 | drivers: hv: dxgkrnl: Manage compute device virtual addressesdrivers/ drivers/ drivers/ +2 more | +548 | 0 replies | |
| 28/55 | drivers: hv: dxgkrnl: Add support to map guest pages by hostdrivers/ drivers/ drivers/ +3 more | +129 | 0 replies | |
| 29/55 | drivers: hv: dxgkrnl: Removed struct vmbus_gpadl, which was defined in the main linux branchdrivers/ | +1 | 0 replies | |
| 30/55 | drivers: hv: dxgkrnl: Remove dxgk_init_ioctlsdrivers/ drivers/ | +8 | 0 replies | |
| 31/55 | drivers: hv: dxgkrnl: Creation of dxgsyncfile objectsdrivers/ drivers/ drivers/ +6 more | +294 | 0 replies | |
| 32/55 | drivers: hv: dxgkrnl: Use tracing instead of dev_dbgdrivers/ drivers/ drivers/ +4 more | +25 | 0 replies | |
| 33/55 | drivers: hv: dxgkrnl: Implement D3DKMTWaitSyncFiledrivers/ drivers/ drivers/ +5 more | +396 | 0 replies | |
| 34/55 | drivers: hv: dxgkrnl: Improve tracing and return values from copy from userdrivers/ drivers/ drivers/ +2 more | +225 | 0 replies | |
| 35/55 | drivers: hv: dxgkrnl: Fix synchronization locksdrivers/ drivers/ drivers/ +4 more | +101 | 0 replies | |
| 36/55 | drivers: hv: dxgkrnl: Close shared file objects in case of a failuredrivers/ | +10 | 0 replies | |
| 37/55 | drivers: hv: dxgkrnl: Added missed NULL check for resource objectdrivers/ | +6 | 0 replies | |
| 38/55 | drivers: hv: dxgkrnl: Fixed dxgkrnl to build for the 6.1 kerneldrivers/ drivers/ drivers/ | +0 | 0 replies | |
| 39/55 | drivers: hv: dxgkrnl: Added support for compute only adaptersdrivers/ drivers/ drivers/ +1 more | +16 | 0 replies | |
| 40/55 | drivers: hv: dxgkrnl: Added implementation for D3DKMTInvalidateCachedrivers/ drivers/ drivers/ +2 more | +97 | 0 replies | |
| 41/55 | drivers: hv: dxgkrnl: Handle process ID in D3DKMTQueryStatisticsdrivers/ drivers/ drivers/ +1 more | +111 | 0 replies | |
| 42/55 | drivers: hv: dxgkrnl: Implement the D3DKMTEnumProcesses APIdrivers/ drivers/ drivers/ +1 more | +96 | 0 replies | |
| 43/55 | drivers: hv: dxgkrnl: Implement D3DDKMTIsFeatureEnabled APIdrivers/ drivers/ drivers/ +2 more | +163 | 0 replies | |
| 44/55 | drivers: hv: dxgkrnl: Implement known escapesdrivers/ drivers/ drivers/ +1 more | +205 | 0 replies | |
| 45/55 | drivers: hv: dxgkrnl: Fixed coding style issuesdrivers/ drivers/ drivers/ +1 more | +15 | 0 replies | |
| 46/55 | drivers: hv: dxgkrnl: Fixed the implementation of D3DKMTQueryClockCalibrationdrivers/ drivers/ | +10 | 0 replies | |
| 47/55 | drivers: hv: dxgkrnl: Retry sending a VM bus packet when there is no place in the ring bufferdrivers/ | +14 | 0 replies | |
| 48/55 | drivers: hv: dxgkrnl: Add support for locking a shared allocation by not the ownerdrivers/ drivers/ drivers/ | +31 | 0 replies | |
| 49/55 | drivers: hv: dxgkrnl: Fix build breaks when switching to 6.6 kernel due to hv_driver remove callback change.drivers/ | +1 | 0 replies | |
| 50/55 | drivers: hv: dxgkrnl: Fix build breaks when switching to 6.6 kernel due to removed uuid_le_cmpdrivers/ | +4 | 0 replies | |
| 51/55 | drivers: hv: dxgkrnl: Implement D3DKMTEnumProcesses to match the Windows implementationdrivers/ drivers/ | +19 | 0 replies | |
| 52/55 | drivers: hv: dxgkrnl: Use pin_user_pages instead of get_user_pages for DMA accessible memorydrivers/ drivers/ | +9 | 0 replies | |
| 53/55 | drivers: hv: dxgkrnl: Do not print error messages when virtual GPU is not presentdrivers/ drivers/ | +5 | 0 replies | |
| 54/55 | drivers: hv: dxgkrnl: Fix crash at hmgrtable_free_handledrivers/ | +7 | 0 replies | |
| 55/55 | drivers: hv: dxgkrnl: Code cleanup for upstream submissionMAINTAINERS drivers/ drivers/ +5 more | +28 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH v4 00/55] drivers: hv: dxgkrnl: Driver for Hyper-V virtual compute device
This patch series introduces the dxgkrnl driver, which provides Linux support for virtual compute devices (vGPUs) paravirtualized by a Windows Hyper-V host. The primary use case is Windows Subsystem for Linux (WSL2), where the driver enables GPU-accelerated workloads inside Linux containers running on Windows.
The driver creates /dev/dxg, a miscdevice that user-space API libraries (such as the open-source libdxg) use to communicate with virtual GPU adapters via IOCTLs implementing a subset of the WDDM/MCDM D3DKMT interface. Physical GPU access is performed entirely on the Windows host; the guest driver communicates over Hyper-V VMBus channels.
Key characteristics:
- Self-contained under drivers/hv/dxgkrnl/
- Depends only on CONFIG_HYPERV, DMA_SHARED_BUFFER, SYNC_FILE
- Supports multiple vGPU adapters per VM
- DMA fence integration via dxgsyncfile (SYNC_FILE)
- Supports compute-only accelerators (AI/ML workloads) as well as full graphics adapters
Changes since v3 (posted March 2022):
- Replace deprecated one-element arrays [1] with C99 flexible arrays []
- Replace %px with %p in trace macros
- Remove unnecessary braces from single-statement if blocks
- Remove LINUX_VERSION_CODE guard for max_pkt_size (added in 5.15, well before any target kernel for this submission)
- Remove linux/version.h include (no longer needed)
- Fix whitespace issues flagged by checkpatch
- Replace non-debug DXG_ERR do{}while(0) macro with direct dev_err call
- Change -EBADE to -ENODEV for global channel duplicate detection (as requested by Greg KH in v3 review)
- Remove MODULE_VERSION (not recommended for in-tree drivers)
- Add explanatory comment to guid_to_luid() cast
- Additional features and fixes developed in the WSL2 fork:
* dxgsyncfile: DMA fence / sync file integration
* D3DKMTEnumProcesses, D3DDKMTIsFeatureEnabled, D3DKMTInvalidateCache
* Compute-only adapter support
* pin_user_pages for DMA-accessible memory
* Retry logic for VMBus ring buffer full condition
* Various synchronization and memory safety fixes
Regarding the dxgglobal singleton raised in v3 review:
The design reflects a host architecture constraint: each Hyper-V VM has exactly one global VMBus channel offered by the host, regardless of how many vGPU adapters are present. The dxgglobal structure encapsulates this VM-level state (global channel, adapter list, process list, host event tracking). Per-adapter state is separately managed in dxgadapter objects. This design was previously explained in the v3 thread; the architecture matches the Hyper-V GPU-PV protocol which is fixed by the host side.
The patches apply on top of v6.6-lts. The user-space library (libdxg) that communicates with this driver is available at:
https://github.com/microsoft/libdxg
The full WDDM compute stack (OpenCL, oneAPI, OpenVINO) is available open-source via Intel's compute-runtime project.
Iouri Tarassov ([email protected]) is the primary author and maintainer of this driver.
Eric Curtin (1):
drivers: hv: dxgkrnl: Fix checkpatch issues and address reviewer
feedback
Hideyuki Nagase (1):
drivers: hv: dxgkrnl: Fix crash at hmgrtable_free_handle
Iouri Tarassov (53):
drivers: hv: dxgkrnl: Driver initialization and loading
drivers: hv: dxgkrnl: Add VMBus message support, initialize VMBus
channels.
drivers: hv: dxgkrnl: Creation of dxgadapter object
drivers: hv: dxgkrnl: Opening of /dev/dxg device and dxgprocess
creation
drivers: hv: dxgkrnl: Enumerate and open dxgadapter objects
drivers: hv: dxgkrnl: Creation of dxgdevice objects
drivers: hv: dxgkrnl: Creation of dxgcontext objects
drivers: hv: dxgkrnl: Creation of compute device allocations and
resources
drivers: hv: dxgkrnl: Creation of compute device sync objects
drivers: hv: dxgkrnl: Operations using sync objects
drivers: hv: dxgkrnl: Sharing of dxgresource objects
drivers: hv: dxgkrnl: Sharing of sync objects
drivers: hv: dxgkrnl: Creation of paging queue objects.
drivers: hv: dxgkrnl: Submit execution commands to the compute device
drivers: hv: dxgkrnl: Share objects with the host
drivers: hv: dxgkrnl: Query the dxgdevice state
drivers: hv: dxgkrnl: Map(unmap) CPU address to device allocation
drivers: hv: dxgkrnl: Manage device allocation properties
drivers: hv: dxgkrnl: Flush heap transitions
drivers: hv: dxgkrnl: Query video memory information
drivers: hv: dxgkrnl: The escape ioctl
drivers: hv: dxgkrnl: Ioctl to put device to error state
drivers: hv: dxgkrnl: Ioctls to query statistics and clock calibration
drivers: hv: dxgkrnl: Offer and reclaim allocations
drivers: hv: dxgkrnl: Ioctls to manage scheduling priority
drivers: hv: dxgkrnl: Manage residency of allocations
drivers: hv: dxgkrnl: Manage compute device virtual addresses
drivers: hv: dxgkrnl: Add support to map guest pages by host
drivers: hv: dxgkrnl: Removed struct vmbus_gpadl, which was defined in
the main linux branch
drivers: hv: dxgkrnl: Remove dxgk_init_ioctls
drivers: hv: dxgkrnl: Creation of dxgsyncfile objects
drivers: hv: dxgkrnl: Use tracing instead of dev_dbg
drivers: hv: dxgkrnl: Implement D3DKMTWaitSyncFile
drivers: hv: dxgkrnl: Improve tracing and return values from copy from
user
drivers: hv: dxgkrnl: Fix synchronization locks
drivers: hv: dxgkrnl: Close shared file objects in case of a failure
drivers: hv: dxgkrnl: Added missed NULL check for resource object
drivers: hv: dxgkrnl: Fixed dxgkrnl to build for the 6.1 kernel
drivers: hv: dxgkrnl: Added support for compute only adapters
drivers: hv: dxgkrnl: Added implementation for D3DKMTInvalidateCache
drivers: hv: dxgkrnl: Handle process ID in D3DKMTQueryStatistics
drivers: hv: dxgkrnl: Implement the D3DKMTEnumProcesses API
drivers: hv: dxgkrnl: Implement D3DDKMTIsFeatureEnabled API
drivers: hv: dxgkrnl: Implement known escapes
drivers: hv: dxgkrnl: Fixed coding style issues
drivers: hv: dxgkrnl: Fixed the implementation of
D3DKMTQueryClockCalibration
drivers: hv: dxgkrnl: Retry sending a VM bus packet when there is no
place in the ring buffer
drivers: hv: dxgkrnl: Add support for locking a shared allocation by
not the owner
drivers: hv: dxgkrnl: Fix build breaks when switching to 6.6 kernel
due to hv_driver remove callback change.
drivers: hv: dxgkrnl: Fix build breaks when switching to 6.6 kernel
due to removed uuid_le_cmp
drivers: hv: dxgkrnl: Implement D3DKMTEnumProcesses to match the
Windows implementation
drivers: hv: dxgkrnl: Use pin_user_pages instead of get_user_pages for
DMA accessible memory
drivers: hv: dxgkrnl: Do not print error messages when virtual GPU is
not present
MAINTAINERS | 7 + drivers/hv/Kconfig | 2 + drivers/hv/Makefile | 1 + drivers/hv/dxgkrnl/Kconfig | 28 + drivers/hv/dxgkrnl/Makefile | 5 + drivers/hv/dxgkrnl/dxgadapter.c | 1367 ++++++++ drivers/hv/dxgkrnl/dxgkrnl.h | 1042 ++++++ drivers/hv/dxgkrnl/dxgmodule.c | 971 +++++ drivers/hv/dxgkrnl/dxgprocess.c | 348 ++ drivers/hv/dxgkrnl/dxgsyncfile.c | 481 +++ drivers/hv/dxgkrnl/dxgsyncfile.h | 33 + drivers/hv/dxgkrnl/dxgvmbus.c | 3992 +++++++++++++++++++++ drivers/hv/dxgkrnl/dxgvmbus.h | 910 +++++ drivers/hv/dxgkrnl/hmgr.c | 567 +++ drivers/hv/dxgkrnl/hmgr.h | 112 + drivers/hv/dxgkrnl/ioctl.c | 5648 ++++++++++++++++++++++++++++++ drivers/hv/dxgkrnl/misc.c | 38 + drivers/hv/dxgkrnl/misc.h | 96 + include/uapi/misc/d3dkmthk.h | 1794 ++++++++++ 19 files changed, 17442 insertions(+) create mode 100644 drivers/hv/dxgkrnl/Kconfig create mode 100644 drivers/hv/dxgkrnl/Makefile create mode 100644 drivers/hv/dxgkrnl/dxgadapter.c create mode 100644 drivers/hv/dxgkrnl/dxgkrnl.h create mode 100644 drivers/hv/dxgkrnl/dxgmodule.c create mode 100644 drivers/hv/dxgkrnl/dxgprocess.c create mode 100644 drivers/hv/dxgkrnl/dxgsyncfile.c create mode 100644 drivers/hv/dxgkrnl/dxgsyncfile.h create mode 100644 drivers/hv/dxgkrnl/dxgvmbus.c create mode 100644 drivers/hv/dxgkrnl/dxgvmbus.h create mode 100644 drivers/hv/dxgkrnl/hmgr.c create mode 100644 drivers/hv/dxgkrnl/hmgr.h create mode 100644 drivers/hv/dxgkrnl/ioctl.c create mode 100644 drivers/hv/dxgkrnl/misc.c create mode 100644 drivers/hv/dxgkrnl/misc.h create mode 100644 include/uapi/misc/d3dkmthk.h