]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: add and call tee_free_domain_ctx()
authorJens Wiklander <jens.wiklander@linaro.org>
Mon, 10 Jun 2024 06:53:42 +0000 (08:53 +0200)
committerJulien Grall <jgrall@amazon.com>
Thu, 13 Jun 2024 12:43:53 +0000 (13:43 +0100)
Add tee_free_domain_ctx() to the TEE mediator framework.
tee_free_domain_ctx() is called from arch_domain_destroy() to allow late
freeing of the d->arch.tee context. This will simplify access to
d->arch.tee for domains retrieved with rcu_lock_domain_by_id().

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
xen/arch/arm/domain.c
xen/arch/arm/include/asm/tee/tee.h
xen/arch/arm/tee/tee.c

index 8bde2f730dfb540f77cb90463e41473919627b12..7cfcefd279442904b2c5dbbf6742359bd595781d 100644 (file)
@@ -843,6 +843,7 @@ int arch_domain_teardown(struct domain *d)
 
 void arch_domain_destroy(struct domain *d)
 {
+    tee_free_domain_ctx(d);
     /* IOMMU page table is shared with P2M, always call
      * iommu_domain_destroy() before p2m_final_teardown().
      */
index 6bc13da885b68f31cc41147672d7c4dd750d39f7..0169fd746bcd837be6b7a58f0ba8d98878b87466 100644 (file)
@@ -38,6 +38,7 @@ struct tee_mediator_ops {
      */
     int (*domain_init)(struct domain *d);
     int (*domain_teardown)(struct domain *d);
+    void (*free_domain_ctx)(struct domain *d);
 
     /*
      * Called during domain destruction to relinquish resources used
@@ -70,6 +71,7 @@ int tee_domain_teardown(struct domain *d);
 int tee_relinquish_resources(struct domain *d);
 uint16_t tee_get_type(void);
 void init_tee_secondary(void);
+void tee_free_domain_ctx(struct domain *d);
 
 #define REGISTER_TEE_MEDIATOR(_name, _namestr, _type, _ops)         \
 static const struct tee_mediator_desc __tee_desc_##_name __used     \
@@ -113,6 +115,10 @@ static inline void init_tee_secondary(void)
 {
 }
 
+static inline void tee_free_domain_ctx(struct domain *d)
+{
+}
+
 #endif  /* CONFIG_TEE */
 
 #endif /* __ARCH_ARM_TEE_TEE_H__ */
index 9fd1d7495b2ec5a8d6bf4ac57ef1f9068fd9507c..b1cae16c17a1b14f7d66464a62c38c78beee5e01 100644 (file)
@@ -102,6 +102,12 @@ void __init init_tee_secondary(void)
         cur_mediator->ops->init_secondary();
 }
 
+void tee_free_domain_ctx(struct domain *d)
+{
+    if ( cur_mediator && cur_mediator->ops->free_domain_ctx)
+        cur_mediator->ops->free_domain_ctx(d);
+}
+
 /*
  * Local variables:
  * mode: C