From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751251AbdJBMla (ORCPT ); Mon, 2 Oct 2017 08:41:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:41328 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750929AbdJBMl3 (ORCPT ); Mon, 2 Oct 2017 08:41:29 -0400 Date: Mon, 2 Oct 2017 14:41:07 +0200 From: Borislav Petkov To: Brijesh Singh Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/CPU/AMD, mm: Extend with mem_encrypt=sme option Message-ID: <20171002124107.rwn5ww3wkynxwmsa@pd.tnic> References: <20171001171617.uzwfzps7sxowfram@pd.tnic> <20171001194509.4187-1-brijesh.singh@amd.com> <20171001220216.nhwc5momrn7wq3kj@pd.tnic> <6de5cc08-0a0d-cb45-9518-e5b30fd7e276@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6de5cc08-0a0d-cb45-9518-e5b30fd7e276@amd.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 02, 2017 at 06:32:18AM -0500, Brijesh Singh wrote: > Because sev_enabled will always be 'false' when we are booting on bare > metal. Whereas when we are running under hypervisor then this variable > will be true for the SEV guest, please see [1]. Ok, then. This needs absolutely to be documented. Please add a comment over sev_enabled's definition. > Both sev_active() and sme_active() make use of this variable > hence we will not be able to set the sev_enabled variable on bare > metal. Basically none of the SEV cases will be executed on bare > metal -- only thing which we need to take care of is clearing the > X86_FEATURE_SEV flag so that hypervisor will never launch SEV guest > when mem_encrypt=sme option is provided. In that case, you want to disable SEV at the guest loading point, i.e., sev_guest_init() AFAICT is the earliest time we start prepping a SEV guest. You can add a __setup() early param which parses "mem_encrypt=sme", to arch/x86/kernel/cpu/amd.c and which sets a sev_host_enabled bool or so. sev_guest_init() can then check that variable before going any further. No need for any of that early parsing changes. I'll send a patch with the rest of my cleanups ontop of yours later. Thx. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --