x86/tdx: Clarify RIP adjustments in #VE handler
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 14 Jun 2022 12:01:34 +0000 (15:01 +0300)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 15 Jun 2022 18:05:16 +0000 (11:05 -0700)
commitcdd85786f4b3b9273e4376e69aa95a2d71722764
treea770af9367b80aba7fce9477b3b48678f1b60d26
parent60428d8bc27f52e8f1540f98e1b6ef0156d43f0d
x86/tdx: Clarify RIP adjustments in #VE handler

After successful #VE handling, tdx_handle_virt_exception() has to move
RIP to the next instruction. The handler needs to know the length of the
instruction.

If the #VE happened due to instruction execution, the GET_VEINFO TDX
module call provides info on the instruction in R10, including its length.

For #VE due to EPT violation, the info in R10 is not populand and the
kernel must decode the instruction manually to find out its length.

Restructure the code to make it explicit that the instruction length
depends on the type of #VE. Make individual #VE handlers return
the instruction length on success or -errno on failure.

[ dhansen: fix up changelog and comments ]

Suggested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lkml.kernel.org/r/20220614120135.14812-3-kirill.shutemov@linux.intel.com
arch/x86/coco/tdx/tdx.c