| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 RE: [PATCH V3 02/13] x86/HV: Initialize shared memory boundary in the Isolation VM.
 
To: Tianyu Lan <ltykernel@xxxxxxxxx>, KY Srinivasan <kys@xxxxxxxxxxxxx>,	Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Stephen Hemminger	<sthemmin@xxxxxxxxxxxxx>, "wei.liu@xxxxxxxxxx" <wei.liu@xxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, "tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>,	"mingo@xxxxxxxxxx" <mingo@xxxxxxxxxx>, "bp@xxxxxxxxx" <bp@xxxxxxxxx>,	"x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, "hpa@xxxxxxxxx" <hpa@xxxxxxxxx>,	"dave.hansen@xxxxxxxxxxxxxxx" <dave.hansen@xxxxxxxxxxxxxxx>,	"luto@xxxxxxxxxx" <luto@xxxxxxxxxx>, "peterz@xxxxxxxxxxxxx"	<peterz@xxxxxxxxxxxxx>, "konrad.wilk@xxxxxxxxxx" <konrad.wilk@xxxxxxxxxx>,	"boris.ostrovsky@xxxxxxxxxx" <boris.ostrovsky@xxxxxxxxxx>, "jgross@xxxxxxxx"	<jgross@xxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>,	"joro@xxxxxxxxxx" <joro@xxxxxxxxxx>, "will@xxxxxxxxxx" <will@xxxxxxxxxx>,	"davem@xxxxxxxxxxxxx" <davem@xxxxxxxxxxxxx>, "kuba@xxxxxxxxxx"	<kuba@xxxxxxxxxx>, "jejb@xxxxxxxxxxxxx" <jejb@xxxxxxxxxxxxx>,	"martin.petersen@xxxxxxxxxx" <martin.petersen@xxxxxxxxxx>, "arnd@xxxxxxxx"	<arnd@xxxxxxxx>, "hch@xxxxxx" <hch@xxxxxx>, "m.szyprowski@xxxxxxxxxxx"	<m.szyprowski@xxxxxxxxxxx>, "robin.murphy@xxxxxxx" <robin.murphy@xxxxxxx>,	"thomas.lendacky@xxxxxxx" <thomas.lendacky@xxxxxxx>, "brijesh.singh@xxxxxxx"	<brijesh.singh@xxxxxxx>, "ardb@xxxxxxxxxx" <ardb@xxxxxxxxxx>, Tianyu Lan	<Tianyu.Lan@xxxxxxxxxxxxx>, "pgonda@xxxxxxxxxx" <pgonda@xxxxxxxxxx>,	"martin.b.radev@xxxxxxxxx" <martin.b.radev@xxxxxxxxx>,	"akpm@xxxxxxxxxxxxxxxxxxxx" <akpm@xxxxxxxxxxxxxxxxxxxx>,	"kirill.shutemov@xxxxxxxxxxxxxxx" <kirill.shutemov@xxxxxxxxxxxxxxx>,	"rppt@xxxxxxxxxx" <rppt@xxxxxxxxxx>, "sfr@xxxxxxxxxxxxxxxx"	<sfr@xxxxxxxxxxxxxxxx>, "saravanand@xxxxxx" <saravanand@xxxxxx>,	"krish.sadhukhan@xxxxxxxxxx" <krish.sadhukhan@xxxxxxxxxx>,	"aneesh.kumar@xxxxxxxxxxxxx" <aneesh.kumar@xxxxxxxxxxxxx>,	"xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>,	"rientjes@xxxxxxxxxx" <rientjes@xxxxxxxxxx>, "hannes@xxxxxxxxxxx"	<hannes@xxxxxxxxxxx>, "tj@xxxxxxxxxx" <tj@xxxxxxxxxx>From: Michael Kelley <mikelley@xxxxxxxxxxxxx>Date: Thu, 12 Aug 2021 19:18:30 +0000Accept-language: en-USArc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=noneArc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7Ml/pDsLQ8y9j5HouSL5yGOSfNnF2kN6EzPfxU2Kbf0=; b=fKE0T92NgibawBd7zdFhAmADACvbJp5B5f7RxbwKKZ5dVLNZkYGUfi/nMIFvcleBzc28Vy26U58SIja/RfW7XNnGTuCvf92+G5FZ3OfpZEXhigPB9z9XYrDFw8FYsJopkGVlSozWjogYBs34p/+Xv28XpX6Yc8ioditCNg9UYBdcoGm9dOlNcQ1w5M1g0TrfjltxLbhlkGGgHttPYCzYeMyIgRvIitgF8bj4AfsdWNZsbWiTnkMhsOcCROBd+siv9p1f88LALWKa5ARBENUGFwsHqw/HlX/88pt29d+u5DV8Aq2vAwz6U4tMgM3gz5Ahras6xy45le2WtfeEBSri7Q==Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ftWryGqzH6vvqKzIYFd1fo9gg3tixhYCixF+Wr005TEepGPCCaqMX17CkaongcoLbZtmUtp3fnXqwJY+bYdNwoeja6RgxMyoSxBnT8ChOq4JDvojC0Q65bHSO6g+gQ8HatzxFkVN+W9eNhvRL7WMhQWhefavo6o56IAAo6942aPQ5NlZIa7n2Cs2S4HHdTyfJnYKS9+QgdAo9Gaqsw5UPOpguubmZHzAu2QE5XSdUnzgTS5ZcqVG+i6KmvojsfAXxLCktwroNYdYRDze8zYsK+MrYHtIoGsJDiCbkRi4Qi0NsqfOMlbqg6K6Cvw+iG1kMQoEpEWCGuM80XLAMByNqQ==Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com;Cc: "iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx" <iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx>,	"linux-arch@xxxxxxxxxxxxxxx" <linux-arch@xxxxxxxxxxxxxxx>,	"linux-hyperv@xxxxxxxxxxxxxxx" <linux-hyperv@xxxxxxxxxxxxxxx>,	"linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>,	"linux-scsi@xxxxxxxxxxxxxxx" <linux-scsi@xxxxxxxxxxxxxxx>,	"netdev@xxxxxxxxxxxxxxx" <netdev@xxxxxxxxxxxxxxx>, vkuznets	<vkuznets@xxxxxxxxxx>, "parri.andrea@xxxxxxxxx" <parri.andrea@xxxxxxxxx>,	"dave.hansen@xxxxxxxxx" <dave.hansen@xxxxxxxxx>Delivery-date: Thu, 12 Aug 2021 19:18:36 +0000List-id: Xen developer discussion <xen-devel.lists.xenproject.org>Msip_labels:  MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=554cbf34-fbb7-44b9-8159-933acafadcb9;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-08-12T19:15:02Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;Thread-index: AQHXjUfnHZ9QYgRpj0m0r+snbnmZg6twQiTQThread-topic: [PATCH V3 02/13] x86/HV: Initialize shared memory boundary in the Isolation VM. 
 From: Tianyu Lan <ltykernel@xxxxxxxxx> Sent: Monday, August 9, 2021 10:56 AM
> Subject: [PATCH V3 02/13] x86/HV: Initialize shared memory boundary in the 
> Isolation VM.
As with Patch 1, use the "x86/hyperv:" tag in the Subject line.
> 
> From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
> 
> Hyper-V exposes shared memory boundary via cpuid
> HYPERV_CPUID_ISOLATION_CONFIG and store it in the
> shared_gpa_boundary of ms_hyperv struct. This prepares
> to share memory with host for SNP guest.
> 
> Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
> ---
>  arch/x86/kernel/cpu/mshyperv.c |  2 ++
>  include/asm-generic/mshyperv.h | 12 +++++++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 6b5835a087a3..2b7f396ef1a5 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -313,6 +313,8 @@ static void __init ms_hyperv_init_platform(void)
>       if (ms_hyperv.priv_high & HV_ISOLATION) {
>               ms_hyperv.isolation_config_a = 
> cpuid_eax(HYPERV_CPUID_ISOLATION_CONFIG);
>               ms_hyperv.isolation_config_b = 
> cpuid_ebx(HYPERV_CPUID_ISOLATION_CONFIG);
> +             ms_hyperv.shared_gpa_boundary =
> +                     (u64)1 << ms_hyperv.shared_gpa_boundary_bits;
You could use BIT_ULL() here, but it's kind of a shrug.
> 
>               pr_info("Hyper-V: Isolation Config: Group A 0x%x, Group B 
> 0x%x\n",
>                       ms_hyperv.isolation_config_a, 
> ms_hyperv.isolation_config_b);
> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
> index 4269f3174e58..aa26d24a5ca9 100644
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -35,8 +35,18 @@ struct ms_hyperv_info {
>       u32 max_vp_index;
>       u32 max_lp_index;
>       u32 isolation_config_a;
> -     u32 isolation_config_b;
> +     union {
> +             u32 isolation_config_b;
> +             struct {
> +                     u32 cvm_type : 4;
> +                     u32 Reserved11 : 1;
> +                     u32 shared_gpa_boundary_active : 1;
> +                     u32 shared_gpa_boundary_bits : 6;
> +                     u32 Reserved12 : 20;
Any reason to name the reserved fields as "11" and "12"?  It
just looks a bit unusual.  And I'd suggest lowercase "r".
> +             };
> +     };
>       void  __percpu **ghcb_base;
> +     u64 shared_gpa_boundary;
>  };
>  extern struct ms_hyperv_info ms_hyperv;
> 
> --
> 2.25.1
 |