[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v6 00/11] Implement forced unplug and forced activation
The goal of these two features is to simplify driver servicing and avoid requiring storing driver state in Registry. Forced unplug, as name implies, forcefully unplugs emulated devices when a driver is present, rather than when it's active. It defines a Registry key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced unplug by creating an appropriate value (DISKS/NICS) in this key. Note that since it's no longer possible to guarantee removal of Registry values during driver uninstallation by Windows, driver uninstallers are expected to remove these values themselves. Forced activation is the companion to forced unplug. It aims to make activation of Xenbus FDOs deterministic and stateless, using a precedence mapping based on device IDs, prioritizing the vendor device over the generic ones. This avoids situations where the wrong FDO is activated, which will prevent Windows Update from working. Like forced unplug, the precedence mapping of forced activation is also expected to be removed by driver uninstallers. With forced activation, Xenfilt is now installed via INF on top of the current installation routines. This means PV drivers can be injected offline without needing another reboot to be reconfigured. Care is taken to keep compatibility with older drivers. The two features are also conditioned behind new build environment variables FORCE_UNPLUG and FORCE_ACTIVATE. Forced activation introduces EMULATED v3 and PDO revision 0x0900000C. Deprecate PDO revisions 0x09000007 and earlier to make room for the new revision. Xenvif 0x09000000 is also removed due to the deprecation of CACHE v1. With forced unplug/activation, the whole boot chain of boot-critical drivers must be available in the driver store to avoid INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware IDs into one INF Models entry. Finally, since forced activation can cause the active device to change without prior notice, such a change will cause old drivers to lose their bindings due to a change in the device instance path. Drop the vendor device ID from DeviceID to make sure that device instance paths remain stable across vendor device changes. The following scenarios have been successfully tested, requiring only one reboot each: * Offline driver installation via DISM * Fresh install, followed by switching from device 0001 to 0002 * Fresh install, followed by toggling vendor device * Xenbus/Xenvbd update Other tested scenarios: * Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling device ID (v4) * Major OS upgrade (Windows 10 22H2 -> Windows 11 24H2) Commit notes: * Patch 1 "Collapse skipped template lines" is for all repos. * These forced-activation commits are linked and cannot be separated: * xenfilt: Add Xenbus device precedence mechanism * Add EMULATED v3 * Use EMULATED v3 to force activate Xenbus FDOs Changes in v6: * Fixed logic in "Collapse skipped template lines" * Moved precedence values to their own key xenfilt\Parameters\Precedence * Changed INFs to promote 0002 device to hardware ID in Models entry if vendor device support is not present to avoid Inf2Cat 22.9.3 warning * Fixed emulated.h still using LONG ForceActivate v5: Ad-hoc patches to v4, see v6 Changes in v4: * Restored interfaces deprecated in v3 to allow old drivers to work with existing binding, while still removing old PDO revisions * Converted IsForceActivated LONG value to a proper enum * Stripped vendor device ID from device ID strings * The same was done for Xencons, Xenvif and Xenvkbd * Fixed mistakenly-left-in DEV_C000 in forced-activation Xenbus.inf * Moved PdoGetPrecedence to driver.c and merged into DriverGetPrecedence * Refactored EmulatedIsDevicePresent condition checking * Removed Xenvif revision 0x09000000 due to the deprecation of CACHE v1 v3: https://lists.xenproject.org/archives/html/win-pv-devel/2025-08/msg00002.html * Deprecated PDO revisions 0x09000007 and earlier to make room for 0x0900000C * Merged all hardware IDs into one INF Models entry to avoid BSODs when changing platform device IDs and toggling vendor device * Added a note mentioning the role of driver uninstallers in cleanup of forced unplug/activation drivers. v2: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00053.html * Added forced activation v1: https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00012.html Tu Dinh (11): Collapse skipped template lines Merge all hardware IDs into one Models entry Remove vendor device ID from DeviceID Deprecate PDO revisions 0x09000007 and earlier xenbus: Use nonpaged pool in FdoQueryId Add forced unplug support xenfilt: Add Xenbus device precedence mechanism Add EMULATED v3 Use EMULATED v3 to force activate Xenbus FDOs Enable Xenbus precedence Install Xenfilt with INF AddReg include/emulated_interface.h | 61 +++++++++++++--- include/revision.h | 11 +-- scripts/genfiles.ps1 | 15 ++-- src/xen/driver.c | 79 ++++++++++++++++----- src/xen/driver.h | 5 ++ src/xen/unplug.c | 13 +++- src/xenbus.inf | 25 ++++--- src/xenbus/fdo.c | 134 ++++++++++++++++++++++++----------- src/xenbus/pdo.c | 3 +- src/xenfilt/driver.c | 93 ++++++++++++++++++++++-- src/xenfilt/driver.h | 7 ++ src/xenfilt/emulated.c | 115 ++++++++++++++++++++++++------ src/xenfilt/emulated.h | 13 ++-- src/xenfilt/fdo.c | 30 +++++++- src/xenfilt/pdo.c | 63 ++++++++-------- src/xenfilt/pdo.h | 7 +- 16 files changed, 514 insertions(+), 160 deletions(-) -- 2.50.1.windows.1 Ngoc Tu Dinh | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |