lkml.org 
[lkml]   [2023]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v12 20/22] x86/virt/tdx: Allow SEAMCALL to handle #UD and #GP
    On Tue, Jun 27, 2023 at 02:12:50AM +1200, Kai Huang wrote:
    > On the platform with the "partial write machine check" erratum, a kernel
    > partial write to TDX private memory may cause unexpected machine check.
    > It would be nice if the #MC handler could print additional information
    > to show the #MC was TDX private memory error due to possible kernel bug.
    >
    > To do that, the machine check handler needs to use SEAMCALL to query
    > page type of the error memory from the TDX module, because there's no
    > existing infrastructure to track TDX private pages.
    >
    > SEAMCALL instruction causes #UD if CPU isn't in VMX operation. In #MC
    > handler, it is legal that CPU isn't in VMX operation when making this
    > SEAMCALL. Extend the TDX_MODULE_CALL macro to handle #UD so the
    > SEAMCALL can return error code instead of Oops in the #MC handler.
    > Opportunistically handles #GP too since they share the same code.
    >
    > A bonus is when kernel mistakenly calls SEAMCALL when CPU isn't in VMX
    > operation, or when TDX isn't enabled by the BIOS, or when the BIOS is
    > buggy, the kernel can get a nicer error message rather than a less
    > understandable Oops.
    >
    > Signed-off-by: Kai Huang <kai.huang@intel.com>

    Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

    --
    Kiryl Shutsemau / Kirill A. Shutemov

    \
     
     \ /
      Last update: 2023-06-28 14:33    [W:2.059 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site