1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7#include <mode/machine.h> 8#include <arch/machine/fpu.h> 9#include <mode/model/statedata.h> 10 11bool_t isFPUEnabledCached[CONFIG_MAX_NUM_NODES]; 12 13#ifdef CONFIG_HAVE_FPU 14/* Initialise the FP/SIMD for this machine. */ 15BOOT_CODE bool_t fpsimd_init(void) 16{ 17 /* Set the FPU to lazy switch mode */ 18 disableFpu(); 19 if (config_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) { 20 enableFpuEL01(); 21 } 22 23 return true; 24} 25#endif /* CONFIG_HAVE_FPU */ 26 27BOOT_CODE bool_t fpsimd_HWCapTest(void) 28{ 29 word_t id_aa64pfr0; 30 31 /* Check if the hardware has FP and ASIMD support... */ 32 MRS("id_aa64pfr0_el1", id_aa64pfr0); 33 if (((id_aa64pfr0 >> ID_AA64PFR0_EL1_FP) & MASK(4)) == MASK(4) || 34 ((id_aa64pfr0 >> ID_AA64PFR0_EL1_ASIMD) & MASK(4)) == MASK(4)) { 35 return false; 36 } 37 38 return true; 39} 40