Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp681241pxb; Thu, 21 Oct 2021 07:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsg0/WWsn8gn+S163Vw/XmmmETN1fEi7b+ct5XqzOFKzT18inbc81uKJ6/aBelCVvwbQDH X-Received: by 2002:a17:90b:3910:: with SMTP id ob16mr7045908pjb.234.1634826673848; Thu, 21 Oct 2021 07:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634826673; cv=none; d=google.com; s=arc-20160816; b=QcjilvI75eFvUL5oKUziQ05IvjxtzEPVg7xn+YnVZNnXE6/YLep9lOzqytmyLa8FnF zyzgOw/BwIdjQTrleuoX6D3NQ7luRxVhDhZx6fUhN0I0d4bP4S2DgcKDZmYYQJ4LVJ3/ CrjIQq+KaGHVJ08i+XCe9XLWgrSw0ytFy8xuQ/LWJyrOb306cuoiLrOYlDyORa3cCdn7 T//y7Evk5zojxM+hdio3c+ijXwoC3dfletcF648djQABLzgCdJZkLQPnH7ItsYq9CpMB VC+7oQO0xwkIikHTU4spv+JaY0P5AVWcCqIL9KkKnTyjonHCAlHdmkiDBPzMwg0Be0ua ggWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rcU9vPUUzI5swHp7U/1X5pUaXTmEfV+1ihJzmOdAcOM=; b=d+RP/06St5kfv8mzRGTCzrpIKQ8I6ASsSbHiQNDOZ3HeaaOVOemI7GyKLC4vMWyC4l tEv+zcZYng310ZI8q3b7UeUxUG3504sv5+FAyXfycnYCElGBXSfwYkFJScYQBNB5Gd7Q EqDIxY4ZFASN8DadjCdVS5bhG4U/vdQ/pi9ZNoDvyz1B1LyC+iXPF6GKV+IbjcS9RqHm XkexAtuQsA9S8wd9g1+1FDzsiSSSvWx3PMW5eLJEqdYiyW+LvxKZzshZBwo7TLLkNgXZ AgPRm5C1ou65cPIspFNhxdECTkemnIb3wU2Hv5fa7NgKhuq6lqwvxIh4ysPNRfW9kHUL XutA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=qMTa8TKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si7691841pgk.528.2021.10.21.07.31.00; Thu, 21 Oct 2021 07:31:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=qMTa8TKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbhJUOa0 (ORCPT + 99 others); Thu, 21 Oct 2021 10:30:26 -0400 Received: from mail.skyhub.de ([5.9.137.197]:55022 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbhJUOaZ (ORCPT ); Thu, 21 Oct 2021 10:30:25 -0400 Received: from zn.tnic (p200300ec2f1912003b8abe7004197216.dip0.t-ipconnect.de [IPv6:2003:ec:2f19:1200:3b8a:be70:419:7216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id CD0101EC0554; Thu, 21 Oct 2021 16:28:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1634826487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=rcU9vPUUzI5swHp7U/1X5pUaXTmEfV+1ihJzmOdAcOM=; b=qMTa8TKwojdJWcWHU4iWnSB3q3yU5q61pMpG8GDVfyoMftwa8AJp8ju65Ond55BqBrHHZr FaxndF/cbJqIyuqXkmPXxt8wD/vwcy/4fnPFK5VBwgfOiZMy6w8afPcPqpDhCVTNOfExBW fnUfImp1INRySM74yPeOVphMoiw8cy0= Date: Thu, 21 Oct 2021 16:28:07 +0200 From: Borislav Petkov To: Michael Roth Cc: Brijesh Singh , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH v6 08/42] x86/sev-es: initialize sev_status/features within #VC handler Message-ID: References: <20211008180453.462291-1-brijesh.singh@amd.com> <20211008180453.462291-9-brijesh.singh@amd.com> <20211018184003.3ob2uxcpd2rpee3s@amd.com> <20211020161023.hzbj53ehmzjrt4xd@amd.com> <20211021003535.ic35p6nnxdmavw35@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211021003535.ic35p6nnxdmavw35@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 07:35:35PM -0500, Michael Roth wrote: > Fortunately, all the code makes use of sev_status to get at the SEV MSR > bits, so breaking the appropriate bits out of sme_enable() into an earlier > sev_init() routine that's the exclusive writer of sev_status sounds like a > promising approach. Ack. > It makes sense to do it immediately after the first #VC handler is set > up, so CPUID is available, and since that's where SNP CPUID table > initialization would need to happen if it's to be made available in > #VC handler. Right, and you can do all your init/CPUID prep there. > It may even be similar enough between boot/compressed and run-time kernel > that it could be a shared routine in sev-shared.c. Uuh, bonus points! :-) > But then again it also sounds like the appropriate place to move the > snp_cpuid_init*() calls, and locating the cc_blob, and since there's > differences there it might make sense to keep the boot/compressed and > kernel proper sev_init() routines separate to avoid #ifdeffery). > > Not to get ahead of myself though. Just seems like a good starting point > for how to consolidate the various users. I like how you're thinking. :) > Got it, and my apologies if I've given you that impression as it's > certainly not my intent. (though I'm sure you've heard that before.) Nothing to apologize - all good. > Agreed, if we need to check SEV MSR early for the purposes of SNP it makes > sense to move the overall SEV feature detection code earlier as well. I > should have looked into that aspect more closely before introducing the > changes. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette