lkml.org 
[lkml]   [2021]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v5 04/12] x86/tdx: Add protected guest support for TDX guest
    From
    Date


    On 8/20/21 7:28 AM, Borislav Petkov wrote:
    > On Thu, Aug 12, 2021 at 10:18:39AM -0700, Kuppuswamy, Sathyanarayanan wrote:
    >> I can implement intel_prot_guest_has() in arch/x86/kernel/cpu/intel.c.
    >> And call tdx_prot_guest_has() from it.
    >
    > No, you should simply implement intel_prot_guest_has() or whatever we
    > end up calling it and have the generic routine call it. Not two routines
    > - tdx_* and intel_*
    >

    Reason for suggesting seperate function for tdx_* specific protected guest
    check is, we will be adding some exceptions for TDX features (like command
    line option used to override the default flags or when device filter
    support is disabled). Our current final version looks like below. Such
    customization are not good in generic intel_* function right?

    bool tdx_prot_guest_has(unsigned long flag)
    {
    bool tdx_guest_enabled = cpu_feature_enabled(X86_FEATURE_TDX_GUEST);

    if (flag == tdg_disable_prot)
    return false;

    switch (flag) {
    case PATTR_GUEST_TDX:
    case PATTR_GUEST_UNROLL_STRING_IO:
    case PATTR_GUEST_MEM_ENCRYPT:
    case PATTR_GUEST_SHARED_MAPPING_INIT:
    case PATTR_MEM_ENCRYPT:
    case PATTR_GUEST_SECURE_TIME:
    case PATTR_GUEST_CPUID_FILTER:
    case PATTR_GUEST_RAND_LOOP:
    return tdx_guest_enabled;
    case PATTR_GUEST_DRIVER_FILTER:
    return tdg_filter_enabled() && tdx_guest_enabled;
    }

    return false;
    }


    --
    Sathyanarayanan Kuppuswamy
    Linux Kernel Developer

    \
     
     \ /
      Last update: 2021-08-20 18:43    [W:4.100 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site