From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.67380.1680520862782285202 for ; Mon, 03 Apr 2023 04:21:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fQmmTk8n; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680520861; 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: in-reply-to:in-reply-to:references:references; bh=e9MMYTAF2iML+uydaWs2meqsv4HEqxR94wTI+pOP9Jo=; b=fQmmTk8nFtchBaghmE0rnGbgYkAAknx4twHo94AHAbtp1rkuywf2K156XNN6hbLcW+EJyk L9xN+MG1o3hPLz9gmQzAGKA2HULEK4KvKhW2eYvgDBY4A8jHobr9d2QlFf+HofQ35v4Igj 9WHBL8y7b70WUYnl+FvWgqDkV7rALQg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-244-7WVK9wPLOFCspQOerlXgMQ-1; Mon, 03 Apr 2023 07:20:56 -0400 X-MC-Unique: 7WVK9wPLOFCspQOerlXgMQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2968E85530E; Mon, 3 Apr 2023 11:20:56 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC46E202701E; Mon, 3 Apr 2023 11:20:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 247321800393; Mon, 3 Apr 2023 13:20:53 +0200 (CEST) Date: Mon, 3 Apr 2023 13:20:53 +0200 From: "Gerd Hoffmann" To: "Xu, Min M" Cc: joeyli , Tom Lendacky , "devel@edk2.groups.io" , "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Michael Roth Subject: Re: [PATCH V1 1/1] OvmfPkg/PlatformPei: Skip PlatformInitEmuVariableNvStore in SEV guest Message-ID: References: <20230329052310.27-1-min.m.xu@intel.com> <4tmi32c3kevecoc3y7mb6jlv7d7ygmctt6bgwflvjybqwphjqk@gnnertcj5kz2> <20230331075956.GJ8569@linux-l9pv.suse> <20230331144834.GK8569@linux-l9pv.suse> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, > > I agree that the efi variable store is not secure without smm. But after > > 58eb8517ad7b be introduced, the -D SECURE_BOOT_ENABLE doesn't work > > with SEV. System just hangs in "NvVarStore FV headers were invalid." > Hi, Joeyli > ASSERT is triggered in DEBUG version. In RELEASE version ASSERT is skipped and an error code is returned. So system will not hang. > So another solution is simply remove the ASSERT. Then an error message is dumped out and system continues. > > @Gerd Hoffmann @Tom Lendacky @joeyli What's your thought? Maybe we just need to call ReserveEmuVariableNvStore a bit later? take care, Gerd diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 148240342b4b..99d40636431f 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -377,10 +377,6 @@ InitializePlatform ( InitializeRamRegions (PlatformInfoHob); if (PlatformInfoHob->BootMode != BOOT_ON_S3_RESUME) { - if (!PlatformInfoHob->SmmSmramRequire) { - ReserveEmuVariableNvStore (); - } - PeiFvInitialization (PlatformInfoHob); MemTypeInfoInitialization (PlatformInfoHob); MemMapInitialization (PlatformInfoHob); @@ -389,6 +385,12 @@ InitializePlatform ( InstallClearCacheCallback (); AmdSevInitialize (PlatformInfoHob); + + if (PlatformInfoHob->BootMode != BOOT_ON_S3_RESUME && + !PlatformInfoHob->SmmSmramRequire) { + ReserveEmuVariableNvStore (); + } + if (PlatformInfoHob->HostBridgeDevId == 0xffff) { MiscInitializationForMicrovm (PlatformInfoHob); } else {