]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Clear unplug keys if Active device is not the Vendor device
authorOwen Smith <owen.smith@citrix.com>
Thu, 17 Jun 2021 12:33:51 +0000 (13:33 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 21 Jun 2021 14:05:50 +0000 (15:05 +0100)
When a VM has both Vendor device and the standard device, upgrades can be made
for XenBus on the inactive device. In this case, the driver binaries are
replaced but the coinstaller is not executed for the Active device, leading to
the unplug keys remaining. When the VM is rebooted to complete the driver
installation, both the Active and Inactive devices will use the new driver
binaries, but the Active device will require the child devices rebinding to the
potentially new hardware IDs exposed by the newer binary. This is not possible
during early boot, and the absence of an emulated disk and not being able to
enumerate the PV disk will result in a 0x7B bugcheck.
The Vendor device is designed to be the prefered device, but is not required
to be the active device (this is the case if the VMs configuration is changed
after the drivers have been installed).
It is possible to detect if the Active device is not the Vendor device during
the Active device coinstaller, and clear the Unplug keys to avoid the problem
where the VM will attempt to boot with unplugged emulated disks and PV disks
that require rebinding, which results in a 0x7B bugcheck.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
src/coinst/coinst.c

index b269df089e17e5ac46d8256764e3eee24210380d..c29ce5956d7fc591e033b6509ee762965ec1393d 100644 (file)
@@ -1361,7 +1361,8 @@ static BOOLEAN
 IsActiveDevice(
     IN  HDEVINFO            DeviceInfoSet,
     IN  PSP_DEVINFO_DATA    DeviceInfoData,
-    OUT PBOOLEAN            ActiveDevice
+    OUT PBOOLEAN            ActiveDevice,
+    OUT PBOOLEAN            VendorIsActive
     )
 {
     PTCHAR                  ActiveDeviceID;
@@ -1392,6 +1393,20 @@ IsActiveDevice(
         TRUE :
         FALSE;
 
+#ifdef VENDOR_DEVICE_ID_STR
+
+#define DRIVER_VENDOR_DEVICE_ID "PCI\\VEN_5853&DEV_" ## VENDOR_DEVICE_ID_STR ## "&SUBSYS_C0005853&REV_01"
+
+    *VendorIsActive = (_stricmp(ActiveDeviceID, DRIVER_VENDOR_DEVICE_ID) == 0) ?
+        TRUE :
+        FALSE;
+
+#undef DRIVER_VENDOR_DEVICE_ID
+
+#else
+    *VendorIsActive = FALSE;
+#endif
+
     free(DeviceID);
     free(InstanceID);
 
@@ -1778,6 +1793,7 @@ DifInstallPostProcess(
 {
     BOOLEAN                         NewBinding;
     BOOLEAN                         Active;
+    BOOLEAN                         VendorIsActive;
 
     Log("====>");
 
@@ -1787,12 +1803,13 @@ DifInstallPostProcess(
 
     (VOID) IsActiveDevice(DeviceInfoSet,
                           DeviceInfoData,
-                          &Active);
+                          &Active,
+                          &VendorIsActive);
 
     Log("Active = %s", Active ? "TRUE" : "FALSE");
     Log("NewBinding = %s", NewBinding ? "TRUE" : "FALSE");
 
-    if (Active && NewBinding) {
+    if ((Active && NewBinding) || !VendorIsActive) {
         (VOID) ClearUnplugRequest("DISKS");
         (VOID) ClearUnplugRequest("NICS");
     }