1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7#pragma once 8 9#include <config.h> 10 11/* These are used to force specific outcomes for various combinations of 12 * settings for the state of CONFIG_ARM_HYPERVISOR_SUPPORT, 13 * CONFIG_ARM_HYP_ENABLE_VCPU_CP14_SAVE_AND_RESTORE and 14 * CONFIG_HARDWARE_DEBUG_API. 15 */ 16 17#ifdef CONFIG_ARM_HYPERVISOR_SUPPORT 18#ifdef CONFIG_HARDWARE_DEBUG_API 19/* With the debug-API on, the ARM-hyp kernel will enable HDCR CP14-related 20 * traps whenever it is running a native thread and not a VCPU thread. 21 */ 22#define ARM_HYP_TRAP_CP14_IN_NATIVE_USER_THREADS 23#endif 24 25#ifdef CONFIG_ARM_HYP_ENABLE_VCPU_CP14_SAVE_AND_RESTORE 26/* When this is enabled, the ARM-hyp kernel will enable 27 * CP14 save and restore whenever it is running a VCPU thread. When it's 28 * disabled, the hyp kernel will intercept accesses to the CP14 29 * coprocessor and deliver them as fault messages to the VCPU's fault 30 * handler. 31 */ 32#define ARM_HYP_CP14_SAVE_AND_RESTORE_VCPU_THREADS 33#endif 34#endif 35 36#ifdef CONFIG_HARDWARE_DEBUG_API 37/* If HARDWARE_DEBUG_API is set, then we must save/retore native threads. */ 38#define ARM_CP14_SAVE_AND_RESTORE_NATIVE_THREADS 39#endif 40 41#if defined(ARM_CP14_SAVE_AND_RESTORE_NATIVE_THREADS) || defined(ARM_HYP_CP14_SAVE_AND_RESTORE_VCPU_THREADS) 42#define ARM_BASE_CP14_SAVE_AND_RESTORE 43#endif 44#if defined(ARM_HYP_TRAP_CP14_IN_NATIVE_USER_THREADS) || defined(ARM_HYP_TRAP_CP14_IN_VCPU_THREADS) 45#define ARM_HYP_TRAP_CP14 46#endif 47 48