int arch_domain_teardown(struct domain *d)
{
+ int ret = 0;
+
+ 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_tee,
+ PROG_done,
+ };
+
+ case PROG_none:
+ BUILD_BUG_ON(PROG_none != 0);
+
+ PROGRESS(tee):
+ ret = tee_domain_teardown(d);
+ if ( ret )
+ return ret;
+
+ PROGRESS(done):
+ break;
+
+#undef PROGRESS
+
+ default:
+ BUG();
+ }
+
return 0;
}
* guest and create own structures for the new domain.
*/
int (*domain_init)(struct domain *d);
+ int (*domain_teardown)(struct domain *d);
/*
* Called during domain destruction to relinquish resources used
bool tee_handle_call(struct cpu_user_regs *regs);
int tee_domain_init(struct domain *d, uint16_t tee_type);
+int tee_domain_teardown(struct domain *d);
int tee_relinquish_resources(struct domain *d);
uint16_t tee_get_type(void);
return 0;
}
+static inline int tee_domain_teardown(struct domain *d)
+{
+ return 0;
+}
+
static inline uint16_t tee_get_type(void)
{
return XEN_DOMCTL_CONFIG_TEE_NONE;
return 0;
}
+static int optee_domain_teardown(struct domain *d)
+{
+ return 0;
+}
+
static uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
{
return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
{
.probe = optee_probe,
.domain_init = optee_domain_init,
+ .domain_teardown = optee_domain_teardown,
.relinquish_resources = optee_relinquish_resources,
.handle_call = optee_handle_call,
};
return cur_mediator->ops->domain_init(d);
}
+int tee_domain_teardown(struct domain *d)
+{
+ if ( !cur_mediator )
+ return 0;
+
+ return cur_mediator->ops->domain_teardown(d);
+}
+
int tee_relinquish_resources(struct domain *d)
{
if ( !cur_mediator )