diff mbox series

[2/2] arm: Boilerpate arch_domain_teardown()

Message ID 20230605144331.1819452-3-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen: Arch Teardown | expand

Commit Message

Andrew Cooper June 5, 2023, 2:43 p.m. UTC
XXX to be filled in with TEE teardown.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Jens Wiklander <jens.wiklander@linaro.org>

Jens: In the same was as the previous patch in the common path, you want to
add a PROG_tee(?) here, and rearrange the right function(s).
---
 xen/arch/arm/domain.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index b3981d70a442..b00d0e4f30b7 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -752,6 +752,33 @@  int arch_domain_create(struct domain *d,
 
 int arch_domain_teardown(struct domain *d)
 {
+    BUG_ON(!d->is_dying);
+
+    /* See domain_teardown() for an explanation of all of this magic. */
+    switch ( d->teardown.arch_val )
+    {
+#define PROGRESS(x)                             \
+        d->teardown.arch_val = PROG_ ## x;      \
+        fallthrough;                            \
+    case PROG_ ## x
+
+        enum {
+            PROG_none,
+            PROG_done,
+        };
+
+    case PROG_none:
+        BUILD_BUG_ON(PROG_none != 0);
+
+    PROGRESS(done):
+        break;
+
+#undef PROGRESS
+
+    default:
+        BUG();
+    }
+
     return 0;
 }