aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/coco/tdx/tdx.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2022-06-14 15:01:33 +0300
committerDave Hansen <dave.hansen@linux.intel.com>2022-06-15 10:52:59 -0700
commit60428d8bc27f52e8f1540f98e1b6ef0156d43f0d (patch)
tree03dc3962dc51821807a8a911366c884804ebb5af /arch/x86/coco/tdx/tdx.c
parentx86/mm: Fix RESERVE_BRK() for older binutils (diff)
downloadlinux-dev-60428d8bc27f52e8f1540f98e1b6ef0156d43f0d.tar.xz
linux-dev-60428d8bc27f52e8f1540f98e1b6ef0156d43f0d.zip
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: 32e72854fa5f ("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
Diffstat (limited to 'arch/x86/coco/tdx/tdx.c')
-rw-r--r--arch/x86/coco/tdx/tdx.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
index 03deb4d6920d..faae53f8d559 100644
--- a/arch/x86/coco/tdx/tdx.c
+++ b/arch/x86/coco/tdx/tdx.c
@@ -447,13 +447,17 @@ static bool handle_io(struct pt_regs *regs, u32 exit_qual)
__init bool tdx_early_handle_ve(struct pt_regs *regs)
{
struct ve_info ve;
+ bool ret;
tdx_get_ve_info(&ve);
if (ve.exit_reason != EXIT_REASON_IO_INSTRUCTION)
return false;
- return handle_io(regs, ve.exit_qual);
+ ret = handle_io(regs, ve.exit_qual);
+ if (ret)
+ regs->ip += ve.instr_len;
+ return ret;
}
void tdx_get_ve_info(struct ve_info *ve)