Skip to content

Commit 60428d8

Browse files
kirylhansendc
authored andcommitted
x86/tdx: Fix early #VE handling
tdx_early_handle_ve() does not increment RIP after successfully handling the exception. That leads to infinite loop of exceptions. Move RIP when exceptions are successfully handled. [ dhansen: make problem statement more clear ] Fixes: 32e7285 ("x86/tdx: Port I/O: Add early boot support") Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Link: https://lkml.kernel.org/r/20220614120135.14812-2-kirill.shutemov@linux.intel.com
1 parent e32683c commit 60428d8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/x86/coco/tdx/tdx.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,17 @@ static bool handle_io(struct pt_regs *regs, u32 exit_qual)
447447
__init bool tdx_early_handle_ve(struct pt_regs *regs)
448448
{
449449
struct ve_info ve;
450+
bool ret;
450451

451452
tdx_get_ve_info(&ve);
452453

453454
if (ve.exit_reason != EXIT_REASON_IO_INSTRUCTION)
454455
return false;
455456

456-
return handle_io(regs, ve.exit_qual);
457+
ret = handle_io(regs, ve.exit_qual);
458+
if (ret)
459+
regs->ip += ve.instr_len;
460+
return ret;
457461
}
458462

459463
void tdx_get_ve_info(struct ve_info *ve)

0 commit comments

Comments
 (0)