1caab277bSThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */ 253631b54SCatalin Marinas/* 353631b54SCatalin Marinas * FP/SIMD state saving and restoring 453631b54SCatalin Marinas * 553631b54SCatalin Marinas * Copyright (C) 2012 ARM Ltd. 653631b54SCatalin Marinas * Author: Catalin Marinas <catalin.marinas@arm.com> 753631b54SCatalin Marinas */ 853631b54SCatalin Marinas 953631b54SCatalin Marinas#include <linux/linkage.h> 1053631b54SCatalin Marinas 1153631b54SCatalin Marinas#include <asm/assembler.h> 12cfc5180eSMarc Zyngier#include <asm/fpsimdmacros.h> 1353631b54SCatalin Marinas 1453631b54SCatalin Marinas/* 1553631b54SCatalin Marinas * Save the FP registers. 1653631b54SCatalin Marinas * 1753631b54SCatalin Marinas * x0 - pointer to struct fpsimd_state 1853631b54SCatalin Marinas */ 190343a7e4SMark BrownSYM_FUNC_START(fpsimd_save_state) 20cfc5180eSMarc Zyngier fpsimd_save x0, 8 2153631b54SCatalin Marinas ret 220343a7e4SMark BrownSYM_FUNC_END(fpsimd_save_state) 2353631b54SCatalin Marinas 2453631b54SCatalin Marinas/* 2553631b54SCatalin Marinas * Load the FP registers. 2653631b54SCatalin Marinas * 2753631b54SCatalin Marinas * x0 - pointer to struct fpsimd_state 2853631b54SCatalin Marinas */ 290343a7e4SMark BrownSYM_FUNC_START(fpsimd_load_state) 30cfc5180eSMarc Zyngier fpsimd_restore x0, 8 3153631b54SCatalin Marinas ret 320343a7e4SMark BrownSYM_FUNC_END(fpsimd_load_state) 331fc5dce7SDave Martin 341fc5dce7SDave Martin#ifdef CONFIG_ARM64_SVE 35*1e530f13SJulien Grall 360343a7e4SMark BrownSYM_FUNC_START(sve_save_state) 371fc5dce7SDave Martin sve_save 0, x1, 2 381fc5dce7SDave Martin ret 390343a7e4SMark BrownSYM_FUNC_END(sve_save_state) 401fc5dce7SDave Martin 410343a7e4SMark BrownSYM_FUNC_START(sve_load_state) 42159fd7b8SDave Martin sve_load 0, x1, x2, 3, x4 431fc5dce7SDave Martin ret 440343a7e4SMark BrownSYM_FUNC_END(sve_load_state) 451fc5dce7SDave Martin 460343a7e4SMark BrownSYM_FUNC_START(sve_get_vl) 471fc5dce7SDave Martin _sve_rdvl 0, 1 481fc5dce7SDave Martin ret 490343a7e4SMark BrownSYM_FUNC_END(sve_get_vl) 50*1e530f13SJulien Grall 51*1e530f13SJulien Grall/* Zero all SVE registers but the first 128-bits of each vector */ 52*1e530f13SJulien GrallSYM_FUNC_START(sve_flush_live) 53*1e530f13SJulien Grall sve_flush 54*1e530f13SJulien Grall ret 55*1e530f13SJulien GrallSYM_FUNC_END(sve_flush_live) 56*1e530f13SJulien Grall 571fc5dce7SDave Martin#endif /* CONFIG_ARM64_SVE */ 58