|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH 7/9] ring: Introduce RingD3ToD0/RingD0ToD3
Add D0 power transition hooks to the ring, called by the frontend at
PASSIVE_LEVEL outside of its state lock, so that the ring can manage
resources that must only exist while in D0.
They do nothing yet.
Assisted-by: LLM
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
src/xenvbd/frontend.c | 34 ++++++++++++++++++++++------------
src/xenvbd/ring.c | 22 ++++++++++++++++++++++
src/xenvbd/ring.h | 13 +++++++++++++
3 files changed, 57 insertions(+), 12 deletions(-)
diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c
index 442e188..20207ba 100644
--- a/src/xenvbd/frontend.c
+++ b/src/xenvbd/frontend.c
@@ -1681,6 +1681,10 @@ FrontendD3ToD0(
GranterD3ToD0(Frontend->Granter);
+ status = RingD3ToD0(Frontend->Ring);
+ if (!NT_SUCCESS(status))
+ goto fail1;
+
KeAcquireSpinLock(&Frontend->StateLock, &Irql);
AdapterGetStoreInterface(Adapter, &Frontend->StoreInterface);
@@ -1689,15 +1693,15 @@ FrontendD3ToD0(
status = XENBUS_STORE(Acquire, &Frontend->StoreInterface);
if (!NT_SUCCESS(status))
- goto fail1;
+ goto fail2;
status = XENBUS_DEBUG(Acquire, &Frontend->DebugInterface);
if (!NT_SUCCESS(status))
- goto fail2;
+ goto fail3;
status = XENBUS_SUSPEND(Acquire, &Frontend->SuspendInterface);
if (!NT_SUCCESS(status))
- goto fail3;
+ goto fail4;
status = XENBUS_SUSPEND(Register,
&Frontend->SuspendInterface,
@@ -1706,7 +1710,7 @@ FrontendD3ToD0(
Frontend,
&Frontend->SuspendCallback);
if (!NT_SUCCESS(status))
- goto fail4;
+ goto fail5;
status = XENBUS_DEBUG(Register,
&Frontend->DebugInterface,
@@ -1715,30 +1719,30 @@ FrontendD3ToD0(
Frontend,
&Frontend->DebugCallback);
if (!NT_SUCCESS(status))
- goto fail5;
+ goto fail6;
Frontend->Active = TRUE;
KeReleaseSpinLock(&Frontend->StateLock, Irql);
return STATUS_SUCCESS;
-fail5:
- Error("fail5\n");
+fail6:
+ Error("fail6\n");
XENBUS_SUSPEND(Deregister,
&Frontend->SuspendInterface,
Frontend->SuspendCallback);
Frontend->SuspendCallback = NULL;
+fail5:
+ Error("fail5\n");
+ XENBUS_SUSPEND(Release, &Frontend->SuspendInterface);
fail4:
Error("fail4\n");
- XENBUS_SUSPEND(Release, &Frontend->SuspendInterface);
+ XENBUS_DEBUG(Release, &Frontend->DebugInterface);
fail3:
Error("fail3\n");
- XENBUS_DEBUG(Release, &Frontend->DebugInterface);
+ XENBUS_STORE(Release, &Frontend->StoreInterface);
fail2:
Error("fail2\n");
- XENBUS_STORE(Release, &Frontend->StoreInterface);
-fail1:
- Error("fail1 (%08x)\n", status);
RtlZeroMemory(&Frontend->SuspendInterface,
sizeof(XENBUS_SUSPEND_INTERFACE));
@@ -1749,6 +1753,11 @@ fail1:
KeReleaseSpinLock(&Frontend->StateLock, Irql);
+ RingD0ToD3(Frontend->Ring);
+
+fail1:
+ Error("fail1 (%08x)\n", status);
+
GranterD0ToD3(Frontend->Granter);
return status;
@@ -1793,6 +1802,7 @@ FrontendD0ToD3(
KeReleaseSpinLock(&Frontend->StateLock, Irql);
+ RingD0ToD3(Frontend->Ring);
GranterD0ToD3(Frontend->Granter);
}
diff --git a/src/xenvbd/ring.c b/src/xenvbd/ring.c
index dae2ca0..3ce3ba5 100644
--- a/src/xenvbd/ring.c
+++ b/src/xenvbd/ring.c
@@ -2594,6 +2594,28 @@ RingDestroy(
__RingFree(Ring);
}
+NTSTATUS
+RingD3ToD0(
+ _Inout_ PXENVBD_RING Ring
+ )
+{
+ UNREFERENCED_PARAMETER(Ring);
+
+ ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
+
+ return STATUS_SUCCESS;
+}
+
+VOID
+RingD0ToD3(
+ _Inout_ PXENVBD_RING Ring
+ )
+{
+ UNREFERENCED_PARAMETER(Ring);
+
+ ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
+}
+
NTSTATUS
RingConnect(
_Inout_ PXENVBD_RING Ring
diff --git a/src/xenvbd/ring.h b/src/xenvbd/ring.h
index 6dfdb74..bd5f322 100644
--- a/src/xenvbd/ring.h
+++ b/src/xenvbd/ring.h
@@ -49,6 +49,19 @@ RingDestroy(
_Inout_ PXENVBD_RING Ring
);
+_Check_return_
+_IRQL_requires_(PASSIVE_LEVEL)
+extern NTSTATUS
+RingD3ToD0(
+ _Inout_ PXENVBD_RING Ring
+ );
+
+_IRQL_requires_(PASSIVE_LEVEL)
+extern VOID
+RingD0ToD3(
+ _Inout_ PXENVBD_RING Ring
+ );
+
extern NTSTATUS
RingConnect(
_Inout_ PXENVBD_RING Ring
--
2.56.0.windows.3
--
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 |