mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@intel.com
Cc: hpa@zytor.com, seanjc@google.com, ele.reshetova@intel.com,
	rick.p.edgecombe@intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] x86/tdx: Rename tdx_parse_tdinfo() to tdx_setup()
Date: Sat, 9 Mar 2024 18:49:45 -0800	[thread overview]
Message-ID: <7c8e8216-cb49-4b5a-a547-5e807fa96214@linux.intel.com> (raw)
In-Reply-To: <20240309210230.239045-3-kirill.shutemov@linux.intel.com>


On 3/9/24 1:02 PM, Kirill A. Shutemov wrote:
> Rename tdx_parse_tdinfo() to tdx_setup() and move setting NOTIFY_ENABLES
> there.
>
> The function will be extended to adjust TD configuration.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---

Looks good to me.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

>  arch/x86/coco/tdx/tdx.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> index 5ffe5ef99536..afdaf46cabb9 100644
> --- a/arch/x86/coco/tdx/tdx.c
> +++ b/arch/x86/coco/tdx/tdx.c
> @@ -181,7 +181,7 @@ static void __noreturn tdx_panic(const char *msg)
>  		__tdx_hypercall(&args);
>  }
>  
> -static void tdx_parse_tdinfo(u64 *cc_mask)
> +static void tdx_setup(u64 *cc_mask)
>  {
>  	struct tdx_module_args args = {};
>  	unsigned int gpa_width;
> @@ -206,6 +206,9 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
>  	gpa_width = args.rcx & GENMASK(5, 0);
>  	*cc_mask = BIT_ULL(gpa_width - 1);
>  
> +	/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
> +	tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL);
> +
>  	/*
>  	 * The kernel can not handle #VE's when accessing normal kernel
>  	 * memory.  Ensure that no #VE will be delivered for accesses to
> @@ -930,11 +933,11 @@ void __init tdx_early_init(void)
>  	setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE);
>  
>  	cc_vendor = CC_VENDOR_INTEL;
> -	tdx_parse_tdinfo(&cc_mask);
> -	cc_set_mask(cc_mask);
>  
> -	/* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
> -	tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL);
> +	/* Configure the TD */
> +	tdx_setup(&cc_mask);
> +
> +	cc_set_mask(cc_mask);
>  
>  	/*
>  	 * All bits above GPA width are reserved and kernel treats shared bit

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  reply	other threads:[~2024-03-10  2:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 21:02 [PATCH 0/4] Adjust TD settings on boot Kirill A. Shutemov
2024-03-09 21:02 ` [PATCH 1/4] x86/tdx: Introduce tdg_vm_wr() Kirill A. Shutemov
2024-03-10  0:02   ` Kuppuswamy Sathyanarayanan
2024-03-11 12:00     ` Kirill A. Shutemov
2024-03-09 21:02 ` [PATCH 2/4] x86/tdx: Rename tdx_parse_tdinfo() to tdx_setup() Kirill A. Shutemov
2024-03-10  2:49   ` Kuppuswamy Sathyanarayanan [this message]
2024-03-09 21:02 ` [PATCH 3/4] x86/tdx: Handle PENDING_EPT_VIOLATION_V2 Kirill A. Shutemov
2024-03-09 21:02 ` [PATCH 4/4] x86/tdx: Enable ENUM_TOPOLOGY Kirill A. Shutemov
2024-03-10  3:56   ` Kuppuswamy Sathyanarayanan
2024-03-11 12:05     ` Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c8e8216-cb49-4b5a-a547-5e807fa96214@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=ele.reshetova@intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®