arm: Configure traps on vcpu WFE/WFI calls

Configure the ability to trap on vcpu WFE/WFI calls. If enabled,
user-level would need to schedule a future interrupt when a given
vcpu invokes a WFE/WFI instruction. This otherwise leaving the
vcpu in a disabled state. An application can choose to
disable the trap if it doesn't want to handle the instruction and
schedule a future interrupt.
This commit is contained in:
Alison Felizzi 2019-06-24 10:57:17 +10:00 committed by Kent Mcleod
parent 531d61215e
commit 0e05f416ae
4 changed files with 19 additions and 0 deletions

View file

@ -111,6 +111,7 @@ Upcoming release: BINARY COMPATIBLE
* Virtualise Arm VTimer and Vtimer interrupts to support sharing across VCPUs.
- A VCPU will now save and restore VTimer registers for the generic timer and also deliver a VTimer IRQ via a
seL4_Fault_VPPIEvent fault. This enables multiple VCPUs bound to the same physical core to share this device.
* Build config option for whether WFE/WFI traps on VCPUs when running in Arm hypervisor mode
## Upgrade Notes

View file

@ -20,9 +20,15 @@
#include <arch/object/vcpu.h>
#include <drivers/timer/arm_generic.h>
#ifdef CONFIG_DISABLE_WFI_WFE_TRAPS
/* Trap SMC and override CPSR.AIF */
#define HCR_COMMON ( HCR_TSC | HCR_AMO | HCR_IMO \
| HCR_FMO | HCR_DC | HCR_VM)
#else
/* Trap WFI/WFE/SMC and override CPSR.AIF */
#define HCR_COMMON ( HCR_TSC | HCR_TWE | HCR_TWI | HCR_AMO | HCR_IMO \
| HCR_FMO | HCR_DC | HCR_VM)
#endif
/* Allow native tasks to run at PL1, but restrict access */
#define HCR_NATIVE ( HCR_COMMON | HCR_TGE | HCR_TVM | HCR_TTLB | HCR_TCACHE \
| HCR_TAC | HCR_SWIO)

View file

@ -21,8 +21,13 @@
#include <drivers/timer/arm_generic.h>
/* Note that the HCR_DC for ARMv8 disables S1 translation if enabled */
#ifdef CONFIG_DISABLE_WFI_WFE_TRAPS
/* Trap SMC and override CPSR.AIF */
#define HCR_COMMON ( HCR_VM | HCR_RW | HCR_AMO | HCR_IMO | HCR_FMO )
#else
/* Trap WFI/WFE/SMC and override CPSR.AIF */
#define HCR_COMMON ( HCR_TWI | HCR_TWE | HCR_VM | HCR_RW | HCR_AMO | HCR_IMO | HCR_FMO )
#endif
/* Allow native tasks to run at EL0, but restrict access */
#define HCR_NATIVE ( HCR_COMMON | HCR_TGE | HCR_TVM | HCR_TTLB | HCR_DC \

View file

@ -144,6 +144,13 @@ config_option(
DEPENDS "KernelArchArmV7a OR KernelArchArmV8a;NOT KernelArmCortexA8"
)
config_option(
KernelArmDisableWFIWFETraps DISABLE_WFI_WFE_TRAPS "Disable the trapping of WFI \
and WFE instructions when configuring the \
Hyp Configuration Registor (HCR) of a VCPU"
DEFAULT OFF
DEPENDS "KernelArchArmV7a OR KernelArchArmV8a;KernelArmHypervisorSupport"
)
config_option(KernelARMSMMUInterruptEnable SMMU_INTERRUPT_ENABLE "Enable SMMU interrupts. \
SMMU interrupts currently only serve a debug purpose as \
they are not forwarded to user level. Enabling this will \