From: Saurabh Singh Sengar <ssengar@microsoft.com>
To: Tianyu Lan <ltykernel@gmail.com>,
"luto@kernel.org" <luto@kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"seanjc@google.com" <seanjc@google.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"jgross@suse.com" <jgross@suse.com>,
Tianyu Lan <Tianyu.Lan@microsoft.com>,
"kirill@shutemov.name" <kirill@shutemov.name>,
"jiangshan.ljs@antgroup.com" <jiangshan.ljs@antgroup.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"ashish.kalra@amd.com" <ashish.kalra@amd.com>,
"srutherford@google.com" <srutherford@google.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"anshuman.khandual@arm.com" <anshuman.khandual@arm.com>,
"pawan.kumar.gupta@linux.intel.com"
<pawan.kumar.gupta@linux.intel.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"daniel.sneddon@linux.intel.com" <daniel.sneddon@linux.intel.com>,
"alexander.shishkin@linux.intel.com"
<alexander.shishkin@linux.intel.com>,
"sandipan.das@amd.com" <sandipan.das@amd.com>,
"ray.huang@amd.com" <ray.huang@amd.com>,
"brijesh.singh@amd.com" <brijesh.singh@amd.com>,
"michael.roth@amd.com" <michael.roth@amd.com>,
"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
"venu.busireddy@oracle.com" <venu.busireddy@oracle.com>,
"sterritt@google.com" <sterritt@google.com>,
"tony.luck@intel.com" <tony.luck@intel.com>,
"samitolvanen@google.com" <samitolvanen@google.com>,
"fenghua.yu@intel.com" <fenghua.yu@intel.com>
Cc: "pangupta@amd.com" <pangupta@amd.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>
Subject: RE: [EXTERNAL] [RFC PATCH V5 09/15] x86/hyperv: Add smp support for sev-snp guest
Date: Mon, 1 May 2023 10:32:26 +0000 [thread overview]
Message-ID: <PUZP153MB07496A03FF7B1FDEEEBE0520BE6E9@PUZP153MB0749.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20230501085726.544209-10-ltykernel@gmail.com>
> -----Original Message-----
> From: Tianyu Lan <ltykernel@gmail.com>
> Sent: Monday, May 1, 2023 2:27 PM
> To: luto@kernel.org; tglx@linutronix.de; mingo@redhat.com; bp@alien8.de;
> dave.hansen@linux.intel.com; x86@kernel.org; hpa@zytor.com;
> seanjc@google.com; pbonzini@redhat.com; jgross@suse.com; Tianyu Lan
> <Tianyu.Lan@microsoft.com>; kirill@shutemov.name;
> jiangshan.ljs@antgroup.com; peterz@infradead.org; ashish.kalra@amd.com;
> srutherford@google.com; akpm@linux-foundation.org;
> anshuman.khandual@arm.com; pawan.kumar.gupta@linux.intel.com;
> adrian.hunter@intel.com; daniel.sneddon@linux.intel.com;
> alexander.shishkin@linux.intel.com; sandipan.das@amd.com;
> ray.huang@amd.com; brijesh.singh@amd.com; michael.roth@amd.com;
> thomas.lendacky@amd.com; venu.busireddy@oracle.com;
> sterritt@google.com; tony.luck@intel.com; samitolvanen@google.com;
> fenghua.yu@intel.com
> Cc: pangupta@amd.com; linux-kernel@vger.kernel.org; kvm@vger.kernel.org;
> linux-hyperv@vger.kernel.org; linux-arch@vger.kernel.org
> Subject: [EXTERNAL] [RFC PATCH V5 09/15] x86/hyperv: Add smp support for
> sev-snp guest
>
> From: Tianyu Lan <tiala@microsoft.com>
>
> The wakeup_secondary_cpu callback was populated with wakeup_
> cpu_via_vmgexit() which doesn't work for Hyper-V and Hyper-V requires to
> call Hyper-V specific hvcall to start APs. So override it with Hyper-V specific
> hook to start AP sev_es_save_area data structure.
>
> Signed-off-by: Tianyu Lan <tiala@microsoft.com>
> ---
> Change sicne RFC v3:
> * Replace struct sev_es_save_area with struct
> vmcb_save_area
> * Move code from mshyperv.c to ivm.c
>
> Change since RFC v2:
> * Add helper function to initialize segment
> * Fix some coding style
> ---
> arch/x86/hyperv/ivm.c | 89 +++++++++++++++++++++++++++++++
> arch/x86/include/asm/mshyperv.h | 18 +++++++
> arch/x86/include/asm/sev.h | 13 +++++
> arch/x86/include/asm/svm.h | 15 +++++-
> arch/x86/kernel/cpu/mshyperv.c | 13 ++++-
> arch/x86/kernel/sev.c | 4 +-
> include/asm-generic/hyperv-tlfs.h | 19 +++++++
> 7 files changed, 166 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index
> 522eab55c0dd..0ef46f1874e6 100644
> --- a/arch/x86/hyperv/ivm.c
> +++ b/arch/x86/hyperv/ivm.c
> @@ -22,11 +22,15 @@
> #include <asm/sev.h>
> #include <asm/realmode.h>
> #include <asm/e820/api.h>
> +#include <asm/desc.h>
>
> #ifdef CONFIG_AMD_MEM_ENCRYPT
>
> #define GHCB_USAGE_HYPERV_CALL 1
>
> +static u8 ap_start_input_arg[PAGE_SIZE] __bss_decrypted
> +__aligned(PAGE_SIZE); static u8 ap_start_stack[PAGE_SIZE]
> +__aligned(PAGE_SIZE);
> +
> union hv_ghcb {
> struct ghcb ghcb;
> struct {
> @@ -442,6 +446,91 @@ __init void hv_sev_init_mem_and_cpu(void)
> }
> }
>
> +#define hv_populate_vmcb_seg(seg, gdtr_base) \
> +do { \
> + if (seg.selector) { \
> + seg.base = 0; \
> + seg.limit = HV_AP_SEGMENT_LIMIT; \
> + seg.attrib = *(u16 *)(gdtr_base + seg.selector + 5); \
<snip>
> generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h
> index f4e4cc4f965f..959b075591b2 100644
> --- a/include/asm-generic/hyperv-tlfs.h
> +++ b/include/asm-generic/hyperv-tlfs.h
> @@ -149,6 +149,7 @@ union hv_reference_tsc_msr {
> #define HVCALL_ENABLE_VP_VTL 0x000f
> #define HVCALL_NOTIFY_LONG_SPIN_WAIT 0x0008
> #define HVCALL_SEND_IPI 0x000b
> +#define HVCALL_ENABLE_VP_VTL 0x000f
HVCALL_ENABLE_VP_VTL is already defined.
> #define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013
> #define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX 0x0014
> #define HVCALL_SEND_IPI_EX 0x0015
> @@ -168,6 +169,7 @@ union hv_reference_tsc_msr {
> #define HVCALL_RETARGET_INTERRUPT 0x007e
> #define HVCALL_START_VP 0x0099
> #define HVCALL_GET_VP_ID_FROM_APIC_ID 0x009a
> +#define HVCALL_START_VIRTUAL_PROCESSOR 0x0099
We already have HVCALL_START_VP no need of defining HVCALL_START_VIRTUAL_PROCESSOR.
- Saurabh
> #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af #define
> HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0 #define
> HVCALL_MODIFY_SPARSE_GPA_PAGE_HOST_VISIBILITY 0x00db @@ -223,6
> +225,7 @@ enum HV_GENERIC_SET_FORMAT {
> #define HV_STATUS_INVALID_PORT_ID 17
> #define HV_STATUS_INVALID_CONNECTION_ID 18
> #define HV_STATUS_INSUFFICIENT_BUFFERS 19
> +#define HV_STATUS_TIME_OUT 120
> #define HV_STATUS_VTL_ALREADY_ENABLED 134
>
> /*
> @@ -783,6 +786,22 @@ struct hv_input_unmap_device_interrupt {
> struct hv_interrupt_entry interrupt_entry; } __packed;
>
> +struct hv_enable_vp_vtl_input {
> + u64 partitionid;
> + u32 vpindex;
> + u8 targetvtl;
> + u8 padding[3];
> + u8 context[0xe0];
> +} __packed;
> +
> +struct hv_start_virtual_processor_input {
> + u64 partitionid;
> + u32 vpindex;
> + u8 targetvtl;
> + u8 padding[3];
> + u8 context[0xe0];
> +} __packed;
> +
> #define HV_SOURCE_SHADOW_NONE 0x0
> #define HV_SOURCE_SHADOW_BRIDGE_BUS_RANGE 0x1
>
> --
> 2.25.1
next prev parent reply other threads:[~2023-05-01 10:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-01 8:57 [RFC PATCH V5 00/15] x86/hyperv/sev: Add AMD sev-snp enlightened guest support on hyperv Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 01/15] x86/hyperv: Add sev-snp enlightened guest static key Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 02/15] x86/hyperv: Decrypt hv vp assist page in sev-snp enlightened guest Tianyu Lan
2023-05-01 15:10 ` Tom Lendacky
2023-05-01 8:57 ` [RFC PATCH V5 03/15] x86/hyperv: Set Virtual Trust Level in VMBus init message Tianyu Lan
2023-05-02 19:30 ` Zhi Wang
2023-05-04 15:38 ` Tianyu Lan
2023-05-04 15:58 ` Zhi Wang
2023-05-01 8:57 ` [RFC PATCH V5 04/15] x86/hyperv: Use vmmcall to implement Hyper-V hypercall in sev-snp enlightened guest Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 05/15] clocksource/drivers/hyper-v: decrypt hyperv tsc page " Tianyu Lan
2023-05-04 16:54 ` Zhi Wang
2023-05-01 8:57 ` [RFC PATCH V5 06/15] hv: vmbus: decrypt VMBus pages for " Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 07/15] drivers: hv: Decrypt percpu hvcall input arg page in " Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 08/15] x86/hyperv: Initialize cpu and memory for " Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 09/15] x86/hyperv: Add smp support for sev-snp guest Tianyu Lan
2023-05-01 10:20 ` [EXTERNAL] " Saurabh Singh Sengar
2023-05-04 15:55 ` Tianyu Lan
2023-05-01 10:32 ` Saurabh Singh Sengar [this message]
2023-05-01 15:46 ` Tom Lendacky
2023-05-04 15:51 ` Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 10/15] x86/hyperv: Add hyperv-specific handling for VMMCALL under SEV-ES Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 11/15] x86/sev: Add a #HV exception handler Tianyu Lan
2023-05-05 10:59 ` Gupta, Pankaj
2023-05-11 13:25 ` Gupta, Pankaj
2023-05-01 8:57 ` [RFC PATCH V5 12/15] x86/sev: Add Check of #HV event in path Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 13/15] x86/sev: Add AMD sev-snp enlightened guest support on hyperv Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 14/15] x86/sev: optimize system vector processing invoked from #HV exception Tianyu Lan
2023-05-01 8:57 ` [RFC PATCH V5 15/15] x86/sev: Fix interrupt exit code paths " Tianyu Lan
2023-05-01 16:02 ` Tom Lendacky
2023-05-04 22:41 ` Tianyu Lan
2023-05-01 16:05 ` [RFC PATCH V5 00/15] x86/hyperv/sev: Add AMD sev-snp enlightened guest support on hyperv Tom Lendacky
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=PUZP153MB07496A03FF7B1FDEEEBE0520BE6E9@PUZP153MB0749.APCP153.PROD.OUTLOOK.COM \
--to=ssengar@microsoft.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=adrian.hunter@intel.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=brijesh.singh@amd.com \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=jiangshan.ljs@antgroup.com \
--cc=kirill@shutemov.name \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltykernel@gmail.com \
--cc=luto@kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=pangupta@amd.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=ray.huang@amd.com \
--cc=samitolvanen@google.com \
--cc=sandipan.das@amd.com \
--cc=seanjc@google.com \
--cc=srutherford@google.com \
--cc=sterritt@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=tony.luck@intel.com \
--cc=venu.busireddy@oracle.com \
--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®