linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Kelley <mikelley@microsoft.com>
To: Tianyu Lan <ltykernel@gmail.com>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Dexuan Cui <decui@microsoft.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"luto@kernel.org" <luto@kernel.org>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"brijesh.singh@amd.com" <brijesh.singh@amd.com>,
	"jroedel@suse.de" <jroedel@suse.de>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"pgonda@google.com" <pgonda@google.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"rppt@kernel.org" <rppt@kernel.org>,
	"david@redhat.com" <david@redhat.com>,
	"aneesh.kumar@linux.ibm.com" <aneesh.kumar@linux.ibm.com>,
	"saravanand@fb.com" <saravanand@fb.com>,
	"rientjes@google.com" <rientjes@google.com>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	vkuznets <vkuznets@redhat.com>,
	"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	"hch@lst.de" <hch@lst.de>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"parri.andrea@gmail.com" <parri.andrea@gmail.com>,
	"dave.hansen@intel.com" <dave.hansen@intel.com>
Subject: RE: [PATCH V8.1 5/9] x86/sev-es: Expose sev_es_ghcb_hv_call() to call ghcb hv call out of sev code
Date: Fri, 22 Oct 2021 20:58:00 +0000	[thread overview]
Message-ID: <MWHPR21MB1593716CD7DDE1326AC93AD4D7809@MWHPR21MB1593.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20211022133721.2123-1-ltykernel@gmail.com>

From: Tianyu Lan <ltykernel@gmail.com> Sent: Friday, October 22, 2021 6:37 AM
> 
> Hyper-V needs to call ghcb hv call to write/read MSR in Isolation VM.
> So expose sev_es_ghcb_hv_call() to call it in the Hyper-V code.
> 
> Hyper-V Isolation VM is unenlightened guests and run a paravisor in the
> VMPL0 for communicating and GHCB pages are being allocated and set up by
> that paravisor. Linux gets ghcb page pa via MSR_AMD64_SEV_ES_GHCB
> from paravisor and should not change it. Add set_ghcb_msr parameter for
> sev_es_ghcb_hv_call() and not set ghcb page pa when it's false.
> 
> Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
> ---
> Change since v8:
>         Fix commit in the sev_es_ghcb_hv_call().
> 
>  arch/x86/include/asm/sev.h   | 12 ++++++++++++
>  arch/x86/kernel/sev-shared.c | 25 ++++++++++++++++---------
>  arch/x86/kernel/sev.c        | 13 +++++++------
>  3 files changed, 35 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
> index fa5cd05d3b5b..5b7f7e2b81f7 100644
> --- a/arch/x86/include/asm/sev.h
> +++ b/arch/x86/include/asm/sev.h
> @@ -81,12 +81,24 @@ static __always_inline void sev_es_nmi_complete(void)
>  		__sev_es_nmi_complete();
>  }
>  extern int __init sev_es_efi_map_ghcbs(pgd_t *pgd);
> +extern enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,
> +					  bool set_ghcb_msr,
> +					  struct es_em_ctxt *ctxt,
> +					  u64 exit_code, u64 exit_info_1,
> +					  u64 exit_info_2);
>  #else
>  static inline void sev_es_ist_enter(struct pt_regs *regs) { }
>  static inline void sev_es_ist_exit(void) { }
>  static inline int sev_es_setup_ap_jump_table(struct real_mode_header *rmh) { return 0; }
>  static inline void sev_es_nmi_complete(void) { }
>  static inline int sev_es_efi_map_ghcbs(pgd_t *pgd) { return 0; }
> +static inline enum
> +es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,
> +			      bool set_ghcb_msr, u64 exit_code,

The "struct es_em_ctxt *ctxt" argument is missing from this declaration,
which would presumably produce a compile error.

> +			      u64 exit_info_1, u64 exit_info_2)
> +{
> +	return ES_VMM_ERROR;
> +}
>  #endif
> 
>  #endif

  reply	other threads:[~2021-10-22 21:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 15:41 [PATCH V8 0/9] x86/Hyper-V: Add Hyper-V Isolation VM support(First part) Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 1/9] x86/hyperv: Initialize GHCB page in Isolation VM Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 2/9] x86/hyperv: Initialize shared memory boundary in the " Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 3/9] x86/hyperv: Add new hvcall guest address host visibility support Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 4/9] Drivers: hv: vmbus: Mark vmbus ring buffer visible to host in Isolation VM Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 5/9] x86/sev-es: Expose sev_es_ghcb_hv_call() to call ghcb hv call out of sev code Tianyu Lan
2021-10-21 16:22   ` Borislav Petkov
2021-10-22 13:39     ` Tianyu Lan
2021-10-25 11:20       ` Wei Liu
2021-10-25 11:24         ` Borislav Petkov
2021-10-25 12:27           ` Tianyu Lan
2021-10-25 16:37             ` Borislav Petkov
2021-10-25 20:54               ` Wei Liu
2021-10-22 13:37   ` [PATCH V8.1 " Tianyu Lan
2021-10-22 20:58     ` Michael Kelley [this message]
2021-10-23 17:29       ` Borislav Petkov
2021-10-21 15:41 ` [PATCH V8 6/9] x86/hyperv: Add Write/Read MSR registers via ghcb page Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 7/9] x86/hyperv: Add ghcb hvcall support for SNP VM Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 8/9] Drivers: hv: vmbus: Add SNP support for VMbus channel initiate message Tianyu Lan
2021-10-21 15:41 ` [PATCH V8 9/9] Drivers: hv : vmbus: Initialize VMbus ring buffer for Isolation VM Tianyu Lan
2021-10-22 13:47 ` [PATCH V8.1 6/9] x86/hyperv: Add Write/Read MSR registers via ghcb page Tianyu Lan
2021-10-22 21:25 ` [PATCH V8 0/9] x86/Hyper-V: Add Hyper-V Isolation VM support(First part) Michael Kelley

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=MWHPR21MB1593716CD7DDE1326AC93AD4D7809@MWHPR21MB1593.namprd21.prod.outlook.com \
    --to=mikelley@microsoft.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=david@redhat.com \
    --cc=decui@microsoft.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --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=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=parri.andrea@gmail.com \
    --cc=peterz@infradead.org \
    --cc=pgonda@google.com \
    --cc=rientjes@google.com \
    --cc=robin.murphy@arm.com \
    --cc=rppt@kernel.org \
    --cc=saravanand@fb.com \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).