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

[win-pv-devel] [PATCH 13/14 v2] Ensure D0 <-> D3 transitions occur from the correct state only.



From: Owen Smith <owen.smith@xxxxxxxxxx>

Attempting to set D0 when already at D0 will trigger an ASSERT
and overwrite several variables.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xencons/pdo.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/xencons/pdo.c b/src/xencons/pdo.c
index 935b6ca..6a41934 100755
--- a/src/xencons/pdo.c
+++ b/src/xencons/pdo.c
@@ -445,6 +445,8 @@ PdoD3ToD0(
     Trace("(%s) ====>\n", __PdoGetName(Pdo));
 
     ASSERT3U(KeGetCurrentIrql(), == , PASSIVE_LEVEL);
+    if (__PdoGetDevicePowerState(Pdo) == PowerDeviceD0)
+        goto done;
 
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
 
@@ -471,6 +473,7 @@ PdoD3ToD0(
     if (!NT_SUCCESS(status))
         goto fail4;
 
+done:
 #pragma prefast(suppress:28123)
     (VOID) IoSetDeviceInterfaceState(&Pdo->Dx->Link, TRUE);
 
@@ -521,6 +524,9 @@ PdoD0ToD3(
 #pragma prefast(suppress:28123)
     (VOID) IoSetDeviceInterfaceState(&Pdo->Dx->Link, FALSE);
 
+    if (__PdoGetDevicePowerState(Pdo) == PowerDeviceD3)
+        goto done;
+
     XENCONS_CONSOLE_ABI(D0ToD3, &Pdo->ConsoleAbi);
 
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
@@ -536,6 +542,7 @@ PdoD0ToD3(
 
     KeLowerIrql(Irql);
 
+done:
     Trace("(%s) <====\n", __PdoGetName(Pdo));
 }
 
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

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