arm: flush vcpu when setting domain of a thread
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
This commit is contained in:
parent
e558631c73
commit
01c3487efd
7 changed files with 30 additions and 2 deletions
|
|
@ -124,6 +124,7 @@ exception_t decodeARMVCPUInvocation(
|
|||
void vcpu_restore(vcpu_t *cpu);
|
||||
void vcpu_switch(vcpu_t *cpu);
|
||||
void vcpu_flush(void);
|
||||
void vcpu_flush_if_current(tcb_t *tptr);
|
||||
#ifdef ENABLE_SMP_SUPPORT
|
||||
void handleVCPUInjectInterruptIPI(vcpu_t *vcpu, unsigned long index, virq_t virq);
|
||||
#endif /* ENABLE_SMP_SUPPORT */
|
||||
|
|
@ -208,6 +209,7 @@ static inline VPPIEventIRQ_t irqVPPIEventIndex(irq_t irq)
|
|||
#define vcpu_boot_init() do {} while(0)
|
||||
#define vcpu_switch(x) do {} while(0)
|
||||
#define vcpu_flush() do {} while(0)
|
||||
#define vcpu_flush_if_current(x) do {} while(0)
|
||||
static inline void VGICMaintenance(void) {}
|
||||
|
||||
#endif /* end of !CONFIG_ARM_HYPERVISOR_SUPPORT */
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ void Arch_switchToIdleThread(void);
|
|||
void Arch_configureIdleThread(tcb_t *tcb);
|
||||
void Arch_activateIdleThread(tcb_t *tcb);
|
||||
void Arch_prepareNextDomain(void);
|
||||
void Arch_prepareSetDomain(tcb_t *tcb, dom_t dom);
|
||||
|
||||
void NORETURN idle_thread(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,3 +17,10 @@ void Arch_prepareNextDomain(void)
|
|||
vcpu_flush();
|
||||
}
|
||||
}
|
||||
|
||||
void Arch_prepareSetDomain(tcb_t *tptr, dom_t dom)
|
||||
{
|
||||
if (config_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) {
|
||||
vcpu_flush_if_current(tptr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,6 +272,13 @@ void vcpu_flush(void)
|
|||
}
|
||||
}
|
||||
|
||||
void vcpu_flush_if_current(tcb_t *tptr)
|
||||
{
|
||||
if (tptr->tcbArch.tcbVCPU == ARCH_NODE_STATE(armHSCurVCPU)) {
|
||||
vcpu_flush();
|
||||
}
|
||||
}
|
||||
|
||||
void vcpu_finalise(vcpu_t *vcpu)
|
||||
{
|
||||
if (vcpu->vcpuTCB) {
|
||||
|
|
|
|||
|
|
@ -60,3 +60,8 @@ void Arch_prepareNextDomain(void)
|
|||
{
|
||||
/* Don't need to do anything */
|
||||
}
|
||||
|
||||
void Arch_prepareSetDomain(tcb_t *tptr, dom_t dom)
|
||||
{
|
||||
/* Don't need to do anything */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,3 +16,8 @@ void Arch_prepareNextDomain(void)
|
|||
{
|
||||
/* Don't need to do anything */
|
||||
}
|
||||
|
||||
void Arch_prepareSetDomain(tcb_t *tptr, dom_t dom)
|
||||
{
|
||||
/* Don't need to do anything */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,12 +304,13 @@ void doNBRecvFailedTransfer(tcb_t *thread)
|
|||
|
||||
void prepareSetDomain(tcb_t *tptr, dom_t dom)
|
||||
{
|
||||
#ifdef CONFIG_HAVE_FPU
|
||||
if (ksCurDomain != dom) {
|
||||
Arch_prepareSetDomain(tptr, dom);
|
||||
#ifdef CONFIG_HAVE_FPU
|
||||
/* Save FPU state now to avoid touching cross-domain state later */
|
||||
fpuRelease(tptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void prepareNextDomain(void)
|
||||
|
|
|
|||
Loading…
Reference in a new issue