Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp474144rwb; Thu, 18 Aug 2022 07:06:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR7OEGYg8NZSGVRBaOS+2Bv2GOD56BizHTVP+Sco6bVVRLdRPjYmuUqBmUAaRWm6lAsBE/sE X-Received: by 2002:a65:6d13:0:b0:41d:7380:e9cc with SMTP id bf19-20020a656d13000000b0041d7380e9ccmr2574250pgb.153.1660831588972; Thu, 18 Aug 2022 07:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660831588; cv=none; d=google.com; s=arc-20160816; b=bUirhxH0mERTl7OxodV8Xu2VGchf5yi4PDgEkmTcqYN4ldMjXNxgoFIaKIcYkA4CZb r6viz70smRS2paZTWjGb8MdJe4NdjJQpLHdfSvnhEQ1z//NdnLexzeeKmXTsue6romPn wkQprne4y3kFRRQsJ+PjE5GvX466wE/CQSriqakBd/vCbEdvRuy2aEiT+5Yl1NUti/i+ FdnJzZiAtTbgLwzuPwC0u5CyLXZL95zWchsUmdx1Y9qhrMoyB8IfRa/Uglemz11f66rv 6HpIXmgh1F3asUMAl+uhbiNWi60EXuO6pjnNMxYP46Whst8upzDu8i1vbyzxQs5q6Zeq Us4A== 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=zwPlC5rl838F3z1Af5qijAM7dgfF+8E3ih+zEH2G/fc=; b=bfsgE1G2JBK3b22WOab28IXPzf1HZ+Gr6Hp1h6LNNZgXHBosmsLyaQrsebYhPs0RHK Q5qQvrjrZQNH7uWjffM7kwmxALleVlEUUN2fQak/prbHili2yzVSFYj906+u0Gs1K8aX ILInOPbLnBWY9Oj3OupCygSRyfFh7qJ6E7Gb4FKsVloNtW6pEs/TVuVMxagajp5BHSXj OAi88OaTUByGARXo0HuGhWITst4dm2puBt1NZk9+LImgdqTERpTTTdRZ3gq5kYT5qDDq v/1YmK+rPNElpzvAXxHX7VM8P7UG5aK+wikmD9r7WQ/YYyyBbExmnBaB+kGP6FlfUeKc yJNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=hh2VA3um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls12-20020a17090b350c00b001dc7b989160si1676647pjb.130.2022.08.18.07.06.16; Thu, 18 Aug 2022 07:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=hh2VA3um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S245238AbiHRNlW (ORCPT + 99 others); Thu, 18 Aug 2022 09:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245342AbiHRNkl (ORCPT ); Thu, 18 Aug 2022 09:40:41 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C5EA6C0F for ; Thu, 18 Aug 2022 06:40:05 -0700 (PDT) Received: from zn.tnic (p200300ea971b98ec329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:971b:98ec:329c:23ff:fea6:a903]) (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 045341EC0629; Thu, 18 Aug 2022 15:39:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1660829999; 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=zwPlC5rl838F3z1Af5qijAM7dgfF+8E3ih+zEH2G/fc=; b=hh2VA3um5AUKWqT+5TojJMSAm2qQPvZQhWSkGSVFiL64dVvVRAlof5c46Yi8vIql5atOrj EUes+8eLbXmDv3Yohj3AHoPJOHC/yfmiiAzwxCVSxbbggYCl9WgVmvHRHOvCpsUCjL2KDE 7OLG9TVuyTwA7NROu4qsrctiuF50dlQ= Date: Thu, 18 Aug 2022 15:39:54 +0200 From: Borislav Petkov To: Tom Lendacky Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , "Kirill A. Shutemov" , "H. Peter Anvin" , Michael Roth , Joerg Roedel , Andy Lutomirski , Peter Zijlstra Subject: Re: [PATCH v3 2/2] x86/sev: Add SNP-specific unaccepted memory support Message-ID: References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> <202f4e1ed9fc585f503da57cb8a8dd35e83758d1.1660579062.git.thomas.lendacky@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202f4e1ed9fc585f503da57cb8a8dd35e83758d1.1660579062.git.thomas.lendacky@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2022 at 10:57:43AM -0500, Tom Lendacky wrote: > Add SNP-specific hooks to the unaccepted memory support in the boot > path (__accept_memory()) and the core kernel (accept_memory()) in order > to support booting SNP guests when unaccepted memory is present. Without > this support, SNP guests will fail to boot and/or panic() when unaccepted > memory is present in the EFI memory map. > > The process of accepting memory under SNP involves invoking the hypervisor > to perform a page state change for the page to private memory and then > issuing a PVALIDATE instruction to accept the page. > > Create the new header file arch/x86/boot/compressed/sev.h because adding > the function declaration to any of the existing SEV related header files > pulls in too many other header files, causing the build to fail. > > Signed-off-by: Tom Lendacky > --- > arch/x86/Kconfig | 1 + > arch/x86/boot/compressed/mem.c | 3 +++ > arch/x86/boot/compressed/sev.c | 10 +++++++++- > arch/x86/boot/compressed/sev.h | 23 +++++++++++++++++++++++ > arch/x86/include/asm/sev.h | 3 +++ > arch/x86/kernel/sev.c | 16 ++++++++++++++++ > arch/x86/mm/unaccepted_memory.c | 4 ++++ > 7 files changed, 59 insertions(+), 1 deletion(-) > create mode 100644 arch/x86/boot/compressed/sev.h Looks mostly ok to me... > diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c > index 730c4677e9db..d4b06c862094 100644 > --- a/arch/x86/boot/compressed/sev.c > +++ b/arch/x86/boot/compressed/sev.c > @@ -115,7 +115,7 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, > /* Include code for early handlers */ > #include "../../kernel/sev-shared.c" > > -static inline bool sev_snp_enabled(void) > +bool sev_snp_enabled(void) > { > return sev_status & MSR_AMD64_SEV_SNP_ENABLED; > } This is another one of my pet peeves and now it even gets exported but it is the early decompressor crap so I won't even try to mention cc_* helpers... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette