From 3524d0742e6dd4e8ed9e7a11d8268a9ea2f42c6a Mon Sep 17 00:00:00 2001 From: Madhukar Pappireddy Date: Mon, 17 Jun 2024 15:28:33 -0500 Subject: [PATCH] feat(simd): add rules to rationalize simd ctxt mgmt Illegal combinations of build flags associated with SIMD context management are flagged by the build system. Change-Id: I3192af3889e1e864c7875778616e167ba6894195 Signed-off-by: Madhukar Pappireddy --- Makefile | 59 +++++++++++++++++++++++++--------- plat/arm/board/fvp/platform.mk | 4 +++ 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index c99b4bb83..f7737e350 100644 --- a/Makefile +++ b/Makefile @@ -975,25 +975,52 @@ ifeq (${ENABLE_SME_FOR_SWD},1) endif endif #(ENABLE_SME_FOR_SWD) +# Enabling SVE for SWD requires enabling SVE for NWD due to ENABLE_FEAT +# mechanism. ifeq (${ENABLE_SVE_FOR_SWD},1) - ifeq (${ENABLE_SVE_FOR_NS},0) - $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") - endif -endif #(ENABLE_SVE_FOR_SWD) + ifeq (${ENABLE_SVE_FOR_NS},0) + $(error "ENABLE_SVE_FOR_SWD requires ENABLE_SVE_FOR_NS") + endif +endif -# SVE and SME cannot be used with CTX_INCLUDE_FPREGS since secure manager does -# its own context management including FPU registers. +# Enabling SVE for both the worlds typically requires the context +# management of SVE registers. The only exception being SPMC at S-EL2. +ifeq (${ENABLE_SVE_FOR_SWD}, 1) + ifneq (${ENABLE_SVE_FOR_NS}, 0) + ifeq (${CTX_INCLUDE_SVE_REGS}-$(SPMD_SPM_AT_SEL2),0-0) + $(warning "ENABLE_SVE_FOR_SWD and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS") + endif + endif +endif + +# Enabling SVE in either world while enabling CTX_INCLUDE_FPREGS requires +# CTX_INCLUDE_SVE_REGS to be enabled due to architectural dependency between FP +# and SVE registers. +ifeq (${CTX_INCLUDE_FPREGS}, 1) + ifneq (${ENABLE_SVE_FOR_NS},0) + ifeq (${CTX_INCLUDE_SVE_REGS},0) + # Warning instead of error due to CI dependency on this + $(warning "CTX_INCLUDE_FPREGS and ENABLE_SVE_FOR_NS together require CTX_INCLUDE_SVE_REGS") + $(warning "Forced ENABLE_SVE_FOR_NS=0") + override ENABLE_SVE_FOR_NS := 0 + endif + endif +endif #(CTX_INCLUDE_FPREGS) + +# SVE context management is only required if secure world has access to SVE/FP +# functionality. +ifeq (${CTX_INCLUDE_SVE_REGS},1) + ifeq (${ENABLE_SVE_FOR_SWD},0) + $(error "CTX_INCLUDE_SVE_REGS requires ENABLE_SVE_FOR_SWD to also be enabled") + endif +endif + +# SME cannot be used with CTX_INCLUDE_FPREGS since SPM does its own context +# management including FPU registers. ifeq (${CTX_INCLUDE_FPREGS},1) - ifneq (${ENABLE_SME_FOR_NS},0) - $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") - endif - - ifeq (${ENABLE_SVE_FOR_NS},1) - # Warning instead of error due to CI dependency on this - $(warning "ENABLE_SVE_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") - $(warning "Forced ENABLE_SVE_FOR_NS=0") - override ENABLE_SVE_FOR_NS := 0 - endif + ifneq (${ENABLE_SME_FOR_NS},0) + $(error "ENABLE_SME_FOR_NS cannot be used with CTX_INCLUDE_FPREGS") + endif endif #(CTX_INCLUDE_FPREGS) ifeq ($(DRTM_SUPPORT),1) diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk index cef7bdfcc..340eb3829 100644 --- a/plat/arm/board/fvp/platform.mk +++ b/plat/arm/board/fvp/platform.mk @@ -47,6 +47,10 @@ ifeq (${SPM_MM}, 0) ifeq (${CTX_INCLUDE_FPREGS}, 0) ENABLE_SME_FOR_NS := 2 ENABLE_SME2_FOR_NS := 2 +else + ENABLE_SVE_FOR_NS := 0 + ENABLE_SME_FOR_NS := 0 + ENABLE_SME2_FOR_NS := 0 endif endif