All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Tianyu Lan <ltykernel@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>, Wei Liu <wei.liu@kernel.org>,
	tglx@linutronix.de, mingo@redhat.com, dave.hansen@intel.com,
	luto@kernel.org, peterz@infradead.org,
	sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com,
	ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com,
	hpa@zytor.com, jmattson@google.com, seanjc@google.com,
	thomas.lendacky@amd.com, brijesh.singh@amd.com, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>
Subject: Re: [PATCH 1/4] x86/hyperv: Add missing ARCH_HAS_CC_PLATFORM dependency
Date: Wed, 23 Feb 2022 18:46:27 +0300	[thread overview]
Message-ID: <20220223154627.mssem3vgqdw6eecn@black.fi.intel.com> (raw)
In-Reply-To: <a34587e5-a144-c4a5-56f0-235da22ebce5@gmail.com>

On Wed, Feb 23, 2022 at 10:09:19PM +0800, Tianyu Lan wrote:
> 
> 
> On 2/23/2022 7:47 PM, Kirill A. Shutemov wrote:
> > On Wed, Feb 23, 2022 at 07:02:49PM +0800, Tianyu Lan wrote:
> > > On 2/23/2022 6:56 PM, Borislav Petkov wrote:
> > > > On Wed, Feb 23, 2022 at 06:43:40PM +0800, Tianyu Lan wrote:
> > > > > Hyper-V code check cpuid during runtime and there is no Hyper-V
> > > > > isolation VM option.
> > > > 
> > > > So how does "Current Hyper-V Isolation VM requires AMD_MEM_ENCRYPT" work
> > > > exactly?
> > > > 
> > > > Please explain in detail and not in piecemeal sentences.
> > > > 
> > > The kernel in the image needs to select AMD_MEM_ENCRYPT option
> > > otherwise the kernel can't boot up due to missing SEV support and
> > > sev_es_ghcb_hv_call() always return error.
> > 
> > If kernel boots under SEV, doesn't it mean we have 'sme_me_mask'
> > initialized? If it is non zero hv_is_isolation_supported() check in
> > cc_platform_has() has zero effect as it checked after 'sme_me_mask'.
> > 
> > I still have no idea what is going on.
> > 
> > How SEV related to HyperV isolation? How detection happens? Could you
> > give full picture?
> > 
> 
> Hi Kriil:
>      Current Hyper-V Isolation VM is unenlightened VM design. Hyper-V hides
> SEV capability from Linux guest and expose Hyper-V cpuid to show Hyper-V
> isolation VM capability. So sme_me_mask is zero in this case because SEV
> capability cpuid returns not-support.
>      Hyper-V Isolation VM code uses some SEV API sev_es_ghcb_hv_call() to
> share code and so it's necessary to select AMD_MEM_ENCRYPT option for
> Hyper-V Isolation VM.

Borislav, let's drop 1/4 and fold following fixup in 3/4.

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index c1c0123859b9..f9df31421d8c 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -345,7 +345,8 @@ static void __init ms_hyperv_init_platform(void)
 		 */
 		swiotlb_force = SWIOTLB_FORCE;
 #endif
-		if (hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE)
+		if (hv_get_isolation_type() != HV_ISOLATION_TYPE_NONE &&
+		    IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT))
 			cc_set_vendor(CC_VENDOR_HYPERV);
 	}
 
-- 
 Kirill A. Shutemov

  reply	other threads:[~2022-02-23 15:46 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 18:57 [PATCH 0/4] x86: Cleanup and extend computing computing API Kirill A. Shutemov
2022-02-22 18:57 ` [PATCH 1/4] x86/hyperv: Add missing ARCH_HAS_CC_PLATFORM dependency Kirill A. Shutemov
2022-02-22 20:08   ` Borislav Petkov
2022-02-23  7:04     ` Tianyu Lan
2022-02-23 10:41       ` Borislav Petkov
2022-02-23 10:43         ` Tianyu Lan
2022-02-23 10:56           ` Borislav Petkov
2022-02-23 11:02             ` Tianyu Lan
2022-02-23 11:47               ` Kirill A. Shutemov
2022-02-23 14:09                 ` Tianyu Lan
2022-02-23 15:46                   ` Kirill A. Shutemov [this message]
2022-02-22 18:57 ` [PATCH 2/4] x86: Rename cc_platform.c to arch/x86/coco/core.c Kirill A. Shutemov
2022-02-22 20:52   ` Borislav Petkov
2022-02-24 11:59   ` [tip: x86/cc] x86/cc: Move arch/x86/{kernel/cc_platform.c => coco/core.c} tip-bot2 for Kirill A. Shutemov
2022-02-22 18:57 ` [PATCH 3/4] x86/coco: Explicitly declare type of confidential computing platform Kirill A. Shutemov
2022-02-24 11:59   ` [tip: x86/cc] " tip-bot2 for Kirill A. Shutemov
2022-02-22 18:57 ` [PATCH 4/4] x86/coco: Add API to handle encryption mask Kirill A. Shutemov
2022-02-24 11:59   ` [tip: x86/cc] " tip-bot2 for Kirill A. Shutemov
2022-02-22 21:56 ` [PATCH 0/4] x86: Cleanup and extend computing computing API Tom Lendacky
2022-02-23  4:35 ` [PATCH] x86/mm/cpa: Generalize __set_memory_enc_pgtable() Brijesh Singh
2022-02-23 11:31   ` Borislav Petkov
2022-02-23 11:55     ` Kirill A. Shutemov
2022-02-23 12:13       ` Borislav Petkov
2022-02-23 12:25         ` Kirill A. Shutemov
2022-02-23 12:38           ` Borislav Petkov
2022-02-23 12:54             ` Kirill A. Shutemov
2022-02-23 14:33             ` Brijesh Singh
2022-02-24 11:59   ` [tip: x86/cc] " tip-bot2 for Brijesh Singh
2022-02-23 19:10 ` [PATCH 0/4] x86: Cleanup and extend computing computing API Borislav Petkov
2022-02-23 19:17   ` [PATCH 1/4] x86/cc: Move arch/x86/{kernel/cc_platform.c => coco/core.c} Borislav Petkov
2022-02-23 19:17   ` [PATCH 2/4] x86/coco: Explicitly declare type of confidential computing platform Borislav Petkov
2022-02-23 19:17   ` [PATCH 3/4] x86/coco: Add API to handle encryption mask Borislav Petkov
2022-02-23 19:17   ` [PATCH 4/4] x86/mm/cpa: Generalize __set_memory_enc_pgtable() Borislav Petkov

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=20220223154627.mssem3vgqdw6eecn@black.fi.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltykernel@gmail.com \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.