From: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Kai Huang <kai.huang@intel.com>,
peterz@infradead.org, kirill.shutemov@linux.intel.com,
linux-kernel@vger.kernel.org
Cc: dave.hansen@intel.com, tglx@linutronix.de, bp@alien8.de,
mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
seanjc@google.com, pbonzini@redhat.com, isaku.yamahata@intel.com,
n.borisov.lkml@gmail.com
Subject: Re: [PATCH v3 03/12] x86/tdx: Make macros of TDCALLs consistent with the spec
Date: Thu, 27 Jul 2023 18:54:59 -0700 [thread overview]
Message-ID: <b9fbbbb7-f855-5744-d6ad-c650b10ce135@linux.intel.com> (raw)
In-Reply-To: <b3f5a25e72094a11add22e1a7c5dda3ea91d0e98.1690369495.git.kai.huang@intel.com>
On 7/26/23 4:25 AM, Kai Huang wrote:
> The TDX spec names all TDCALLs with prefix "TDG". Currently, the kernel
> doesn't follow such convention for the macros of those TDCALLs but uses
> prefix "TDX_" for all of them. Although it's arguable whether the TDX
> spec names those TDCALLs properly, it's better for the kernel to follow
> the spec when naming those macros.
>
> Change all macros of TDCALLs to make them consistent with the spec. As
> a bonus, they get distinguished easily from the host-side SEAMCALLs,
> which all have prefix "TDH".
>
> No functional change intended.
>
When upstreaming the TDX guest patches, there was a discussion about using
TDG vs TDX. Final agreement is to use TDX_ prefix. I think it makes sense
to align with the spec, but it is up to the maintainer.
What about the function name prefix? Are you planning to change them to tdg_*?
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> Signed-off-by: Kai Huang <kai.huang@intel.com>
> ---
>
> v2 -> v3:
> - No change.
>
> v1 -> v2:
> - Rebase to 6.5-rc2.
>
> ---
> arch/x86/coco/tdx/tdx-shared.c | 4 ++--
> arch/x86/coco/tdx/tdx.c | 8 ++++----
> arch/x86/include/asm/shared/tdx.h | 10 +++++-----
> 3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/coco/tdx/tdx-shared.c b/arch/x86/coco/tdx/tdx-shared.c
> index ef20ddc37b58..f10cd3e4a04e 100644
> --- a/arch/x86/coco/tdx/tdx-shared.c
> +++ b/arch/x86/coco/tdx/tdx-shared.c
> @@ -35,7 +35,7 @@ static unsigned long try_accept_one(phys_addr_t start, unsigned long len,
> }
>
> tdcall_rcx = start | page_size;
> - if (__tdx_module_call(TDX_ACCEPT_PAGE, tdcall_rcx, 0, 0, 0, NULL))
> + if (__tdx_module_call(TDG_MEM_PAGE_ACCEPT, tdcall_rcx, 0, 0, 0, NULL))
> return 0;
>
> return accept_size;
> @@ -45,7 +45,7 @@ bool tdx_accept_memory(phys_addr_t start, phys_addr_t end)
> {
> /*
> * For shared->private conversion, accept the page using
> - * TDX_ACCEPT_PAGE TDX module call.
> + * TDG_MEM_PAGE_ACCEPT TDX module call.
> */
> while (start < end) {
> unsigned long len = end - start;
> diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> index 1d6b863c42b0..05785df66b1c 100644
> --- a/arch/x86/coco/tdx/tdx.c
> +++ b/arch/x86/coco/tdx/tdx.c
> @@ -91,7 +91,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)
> {
> u64 ret;
>
> - ret = __tdx_module_call(TDX_GET_REPORT, virt_to_phys(tdreport),
> + ret = __tdx_module_call(TDG_MR_REPORT, virt_to_phys(tdreport),
> virt_to_phys(reportdata), TDREPORT_SUBTYPE_0,
> 0, NULL);
> if (ret) {
> @@ -152,7 +152,7 @@ static void tdx_parse_tdinfo(u64 *cc_mask)
> * Guest-Host-Communication Interface (GHCI), section 2.4.2 TDCALL
> * [TDG.VP.INFO].
> */
> - tdx_module_call(TDX_GET_INFO, 0, 0, 0, 0, &out);
> + tdx_module_call(TDG_VP_INFO, 0, 0, 0, 0, &out);
>
> /*
> * The highest bit of a guest physical address is the "sharing" bit.
> @@ -594,7 +594,7 @@ void tdx_get_ve_info(struct ve_info *ve)
> * Note, the TDX module treats virtual NMIs as inhibited if the #VE
> * valid flag is set. It means that NMI=>#VE will not result in a #DF.
> */
> - tdx_module_call(TDX_GET_VEINFO, 0, 0, 0, 0, &out);
> + tdx_module_call(TDG_VP_VEINFO_GET, 0, 0, 0, 0, &out);
>
> /* Transfer the output parameters */
> ve->exit_reason = out.rcx;
> @@ -774,7 +774,7 @@ void __init tdx_early_init(void)
> cc_set_mask(cc_mask);
>
> /* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */
> - tdx_module_call(TDX_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL);
> + tdx_module_call(TDG_VM_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL);
>
> /*
> * All bits above GPA width are reserved and kernel treats shared bit
> diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h
> index 7513b3bb69b7..78f109446da6 100644
> --- a/arch/x86/include/asm/shared/tdx.h
> +++ b/arch/x86/include/asm/shared/tdx.h
> @@ -11,11 +11,11 @@
> #define TDX_IDENT "IntelTDX "
>
> /* TDX module Call Leaf IDs */
> -#define TDX_GET_INFO 1
> -#define TDX_GET_VEINFO 3
> -#define TDX_GET_REPORT 4
> -#define TDX_ACCEPT_PAGE 6
> -#define TDX_WR 8
> +#define TDG_VP_INFO 1
> +#define TDG_VP_VEINFO_GET 3
> +#define TDG_MR_REPORT 4
> +#define TDG_MEM_PAGE_ACCEPT 6
> +#define TDG_VM_WR 8
>
> /* TDCS fields. To be used by TDG.VM.WR and TDG.VM.RD module calls */
> #define TDCS_NOTIFY_ENABLES 0x9100000000000010
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
next prev parent reply other threads:[~2023-07-28 1:55 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 11:25 [PATCH v3 00/12] Unify TDCALL/SEAMCALL and TDVMCALL assembly Kai Huang
2023-07-26 11:25 ` [PATCH v3 01/12] x86/tdx: Zero out the missing RSI in TDX_HYPERCALL macro Kai Huang
2023-07-27 12:48 ` kirill.shutemov
2023-07-26 11:25 ` [PATCH v3 02/12] x86/tdx: Skip saving output regs when SEAMCALL fails with VMFailInvalid Kai Huang
2023-07-27 12:52 ` kirill.shutemov
2023-07-27 22:55 ` Huang, Kai
2023-07-26 11:25 ` [PATCH v3 03/12] x86/tdx: Make macros of TDCALLs consistent with the spec Kai Huang
2023-07-27 13:00 ` kirill.shutemov
2023-07-28 1:54 ` Sathyanarayanan Kuppuswamy [this message]
2023-07-28 2:45 ` Huang, Kai
2023-07-26 11:25 ` [PATCH v3 04/12] x86/tdx: Rename __tdx_module_call() to __tdcall() Kai Huang
2023-07-27 13:02 ` kirill.shutemov
2023-07-28 15:33 ` Sathyanarayanan Kuppuswamy
2023-07-26 11:25 ` [PATCH v3 05/12] x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure Kai Huang
2023-07-27 16:36 ` kirill.shutemov
2023-07-27 22:54 ` Huang, Kai
2023-08-03 10:58 ` kirill.shutemov
2023-08-03 11:35 ` Huang, Kai
2023-08-03 11:47 ` kirill.shutemov
2023-07-26 11:25 ` [PATCH v3 06/12] x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs Kai Huang
2023-07-27 16:50 ` kirill.shutemov
2023-07-27 22:58 ` Huang, Kai
2023-07-26 11:25 ` [PATCH v3 07/12] x86/tdx: Make TDX_HYPERCALL asm similar to TDX_MODULE_CALL Kai Huang
2023-07-27 17:10 ` kirill.shutemov
2023-07-27 23:05 ` Huang, Kai
2023-08-03 11:45 ` kirill.shutemov
2023-08-03 11:56 ` Huang, Kai
2023-08-03 12:12 ` kirill.shutemov
2023-08-03 12:41 ` Huang, Kai
2023-08-03 13:47 ` kirill.shutemov
2023-08-03 22:41 ` Huang, Kai
2023-07-26 11:25 ` [PATCH v3 08/12] x86/tdx: Reimplement __tdx_hypercall() using TDX_MODULE_CALL asm Kai Huang
2023-08-06 11:25 ` kirill.shutemov
2023-07-26 11:25 ` [PATCH v3 09/12] x86/tdx: Remove 'struct tdx_hypercall_args' Kai Huang
2023-08-06 11:29 ` kirill.shutemov
2023-07-26 11:25 ` [PATCH v3 10/12] x86/virt/tdx: Wire up basic SEAMCALL functions Kai Huang
2023-08-06 11:36 ` kirill.shutemov
2023-08-07 1:40 ` Huang, Kai
2023-08-07 14:30 ` Sean Christopherson
2023-08-07 23:51 ` Huang, Kai
2023-07-26 11:25 ` [PATCH v3 11/12] x86/virt/tdx: Allow SEAMCALL to handle #UD and #GP Kai Huang
2023-08-06 11:41 ` kirill.shutemov
2023-08-07 2:14 ` Huang, Kai
2023-08-07 9:53 ` kirill.shutemov
2023-08-07 12:41 ` Huang, Kai
2023-08-07 14:27 ` kirill.shutemov
2023-08-07 14:46 ` Dave Hansen
2023-07-26 11:25 ` [PATCH v3 12/12] x86/virt/tdx: Adjust 'struct tdx_module_args' to use x86 "register index" layout Kai Huang
2023-08-02 21:32 ` Isaku Yamahata
2023-08-02 23:20 ` Huang, Kai
2023-08-02 21:39 ` Isaku Yamahata
2023-08-06 11:50 ` kirill.shutemov
2023-08-07 2:16 ` Huang, Kai
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=b9fbbbb7-f855-5744-d6ad-c650b10ce135@linux.intel.com \
--to=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=isaku.yamahata@intel.com \
--cc=kai.huang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=n.borisov.lkml@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--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
Powered by JetHome