Skip to content

Commit 44af269

Browse files
JasonChenCJlijinxia
authored andcommitted
add triple fault request support
if vcpu meet triple fault, the vcpu should exit. Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Tian, Kevin <kevin.tian@intel.com>
1 parent 4607177 commit 44af269

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

hypervisor/arch/x86/interrupt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ int acrn_handle_pending_request(struct vcpu *vcpu)
304304
bool intr_pending = false;
305305
uint64_t *pending_req_bits = &vcpu->arch_vcpu.pending_req;
306306

307+
if (bitmap_test_and_clear(ACRN_REQUEST_TRP_FAULT, pending_req_bits)) {
308+
pr_fatal("Triple fault happen -> shutdown!");
309+
return -EFAULT;
310+
}
311+
307312
if (bitmap_test_and_clear(ACRN_REQUEST_TLB_FLUSH, pending_req_bits))
308313
invept(vcpu);
309314

hypervisor/common/hv_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ void vcpu_thread(struct vcpu *vcpu)
6464
CPU_IRQ_DISABLE();
6565

6666
/* Check and process pending requests(including interrupt) */
67-
acrn_handle_pending_request(vcpu);
67+
ret = acrn_handle_pending_request(vcpu);
68+
if (ret < 0) {
69+
pr_fatal("vcpu handling pending request fail");
70+
pause_vcpu(vcpu, VCPU_ZOMBIE);
71+
continue;
72+
}
6873

6974
if (need_rescheduled(vcpu->pcpu_id)) {
7075
/*

hypervisor/include/arch/x86/guest/guest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ int get_req_info(char *str, int str_max);
7070
#define ACRN_REQUEST_GP 3
7171
#define ACRN_REQUEST_TMR_UPDATE 4
7272
#define ACRN_REQUEST_TLB_FLUSH 5
73+
#define ACRN_REQUEST_TRP_FAULT 6
7374

7475
#define E820_MAX_ENTRIES 32
7576

hypervisor/include/lib/errno.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@
4141
#define EIO 4
4242
/** Indicates that target is busy. */
4343
#define EBUSY 5
44+
/** Indicates there is fault. */
45+
#define EFAULT 6
4446

4547
#endif /* ERRNO_H */

0 commit comments

Comments
 (0)