]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64/gcs: Context switch GCS state for EL0
authorMark Brown <broonie@kernel.org>
Tue, 1 Oct 2024 22:59:00 +0000 (23:59 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 4 Oct 2024 11:04:38 +0000 (12:04 +0100)
commitfc84bc5378a8c852308fa022957b8976adb5aa6a
treedf45eb8798a6faf7997e746799623e0c1d0e7162
parentcfad706e8f6ded5cec69f820bceeca9e64394592
arm64/gcs: Context switch GCS state for EL0

There are two registers controlling the GCS state of EL0, GCSPR_EL0 which
is the current GCS pointer and GCSCRE0_EL1 which has enable bits for the
specific GCS functionality enabled for EL0. Manage these on context switch
and process lifetime events, GCS is reset on exec().  Also ensure that
any changes to the GCS memory are visible to other PEs and that changes
from other PEs are visible on this one by issuing a GCSB DSYNC when
moving to or from a thread with GCS.

Since the current GCS configuration of a thread will be visible to
userspace we store the configuration in the format used with userspace
and provide a helper which configures the system register as needed.

On systems that support GCS we always allow access to GCSPR_EL0, this
facilitates reporting of GCS faults if userspace implements disabling of
GCS on error - the GCS can still be discovered and examined even if GCS
has been disabled.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20241001-arm64-gcs-v13-21-222b78d87eee@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/gcs.h
arch/arm64/include/asm/processor.h
arch/arm64/kernel/process.c
arch/arm64/mm/Makefile
arch/arm64/mm/gcs.c [new file with mode: 0644]