acrn-hypervisor/hypervisor/include/arch/x86/asm/guest/optee.h
Jie Deng e97b171ca2 hv: tee: x86_tee interrupt support
Secure interrupt (interrupt belongs to TEE) comes
when TEE vcpu is running, the interrupt will be
injected to TEE directly. But when REE vcpu is running
at that time, we need to switch to TEE for handling.

Non-Secure interrupt (interrupt belongs to REE) comes
when REE vcpu is running, the interrupt will be injected
to REE directly. But when TEE vcpu is running at that time,
we need to inject a predefined vector to TEE for notification
and continue to switch back to TEE for running.

To sum up, when secure interrupt comes, switch to TEE
immediately regardless of whether REE is running or not;
when non-Secure interrupt comes and TEE is running,
just notify the TEE and keep it running, TEE will switch
to REE on its own initiative after completing its work.

Tracked-On: projectacrn#6571
Signed-off-by: Jie Deng <jie.deng@intel.com>
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Acked-by: Eddie Dong <eddie.dong@Intel.com>
2021-11-17 15:25:14 +08:00

26 lines
683 B
C

/*
* Copyright (C) 2021 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef TEE_H_
#define TEE_H_
#include <asm/guest/vm.h>
#include <asm/vm_config.h>
#include <ptdev.h>
#define TEE_NOTIFICATION_VECTOR 0x29U
/* If the RDI equals to this value, then this is a RETURN after FIQ DONE */
#define OPTEE_RETURN_FIQ_DONE 0xBE000006UL
/* This value tells OPTEE that this switch to TEE is due to secure interrupt */
#define OPTEE_FIQ_ENTRY 0xB20000FFUL
void prepare_tee_vm_memmap(struct acrn_vm *vm, const struct acrn_vm_config *vm_config);
void handle_x86_tee_int(struct ptirq_remapping_info *entry, uint16_t pcpu_id);
#endif /* TEE_H_ */