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

[PATCH] plat/arm64: Fix extregs allocation on Arm



Implement the extregs (currently only fpsimd registers) allocation
related helpers. Otherwise, Unikraft can be built on Arm kvm plat
due to the missing of several helpers.

Signed-off-by: Jia He <justin.he@xxxxxxx>
---
 plat/common/include/arm/arm64/cpu.h | 31 ++++++++++-------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/plat/common/include/arm/arm64/cpu.h 
b/plat/common/include/arm/arm64/cpu.h
index a3fb730..804a34b 100644
--- a/plat/common/include/arm/arm64/cpu.h
+++ b/plat/common/include/arm/arm64/cpu.h
@@ -175,24 +175,19 @@ static inline void restore_extregs(struct sw_ctx *ctx)
        isb();
 }
 
-static inline struct sw_ctx *arch_alloc_sw_ctx(struct uk_alloc *allocator)
+static inline void arch_init_extregs(struct sw_ctx *ctx __unused)
 {
-       struct sw_ctx *ctx;
-
-       ctx = (struct sw_ctx *)uk_malloc(allocator,
-                       sizeof(struct sw_ctx) + sizeof(struct fpsimd_state));
        if (ctx)
-               ctx->extregs = (uintptr_t)((void *)ctx + sizeof(struct sw_ctx));
+               ctx->extregs = (uintptr_t)ctx->_extregs;
 
        uk_pr_debug("Allocating %lu + %lu bytes for sw ctx at %p, extregs at 
%p\n",
                        sizeof(struct sw_ctx), sizeof(struct fpsimd_state),
                        ctx, (void *)ctx->extregs);
-
-       return ctx;
 }
 
-static inline void arch_init_extregs(struct sw_ctx *ctx __unused)
+static inline __sz arch_extregs_size(void)
 {
+       return sizeof(struct fpsimd_state);
 }
 
 #else /* !CONFIG_FPSIMD */
@@ -204,21 +199,17 @@ static inline void restore_extregs(struct sw_ctx *ctx 
__unused)
 {
 }
 
-static inline struct sw_ctx *arch_alloc_sw_ctx(struct uk_alloc *allocator)
+static inline void arch_init_extregs(struct sw_ctx *ctx)
 {
-       struct sw_ctx *ctx;
-
-       ctx = (struct sw_ctx *)uk_malloc(allocator, sizeof(struct sw_ctx));
-       uk_pr_debug("Allocating %lu bytes for sw ctx at %p\n",
-               sizeof(struct sw_ctx), ctx);
-
-       return ctx;
+       if (ctx)
+               ctx->extregs = (uintptr_t)ctx->_extregs;
 }
 
-static inline void arch_init_extregs(struct sw_ctx *ctx)
+static inline __sz arch_extregs_size(void)
 {
-       ctx->extregs = (uintptr_t)ctx + sizeof(struct sw_ctx);
+       return 0;
 }
-
 #endif /* CONFIG_FPSIMD */
+
+
 #endif /* __PLAT_COMMON_ARM64_CPU_H__ */
-- 
2.17.1




 


Rackspace

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