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.web09.28847.1655722890986304301 for ; Mon, 20 Jun 2022 04:01:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RDfGVMCw; 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=1655722890; 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=5Tc32iX6zH3xSVrBYg/B9nRWQbdQWXs7jtJ3HCpTcf8=; b=RDfGVMCwaxv6GtIhra7htMoIUOv6mbNroK/ke0lSqO7eO2mbXxvX7ElSgt9Fe4fMOexn6Y SY28BAD5/CICxRLNNYYRZ/ZKKfY2/wWNlOKecXTS9+DL/Z/aD6raHVBe7K4jW9sbm2hp1X YiEYMhfxToKYco75cyIvUJ8yZlE/CqA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-164-su79PSsbPBSR_fh73uY0-A-1; Mon, 20 Jun 2022 07:01:27 -0400 X-MC-Unique: su79PSsbPBSR_fh73uY0-A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DF5B299E750; Mon, 20 Jun 2022 11:01:26 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55F804010E4C; Mon, 20 Jun 2022 11:01:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BFB7C1800084; Mon, 20 Jun 2022 13:01:24 +0200 (CEST) Date: Mon, 20 Jun 2022 13:01:24 +0200 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [PATCH 3/3] OvmfPkg: Initialize NvVarStore with Configuration FV in Td guest Message-ID: <20220620110124.s4sutzqnsvlmvdg5@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > + UINT8 *CfvBase; > + UINT32 CfvSize; > > DEBUG ((DEBUG_INFO, "EMU Variable FVB Started\n")); > > @@ -774,6 +776,23 @@ FvbInitialize ( > > mEmuVarsFvb.BufferPtr = Ptr; > > + // > + // In Tdx guest the VarNvStore content should be initialized by the Configuration FV (CFV). > + // Integrity of the CFV has been validated by TdxValidateCfv (@PlatformInitLib) > + // > + if (TdIsEnabled ()) { > + CfvBase = (UINT8 *)(UINTN)PcdGet32 (PcdCfvBase); > + CfvSize = (UINT32)PcdGet32 (PcdCfvRawDataSize); > + > + if (CfvSize > mEmuVarsFvb.Size) { > + DEBUG ((DEBUG_ERROR, "Size of CFV is larger than the EMU Variable FVB.\n")); > + ASSERT (FALSE); > + } else { > + CopyMem (Ptr, CfvBase, CfvSize); > + Initialize = FALSE; > + } > + } There is PcdEmuVariableNvStoreReserved for that. How about just copying the store to ram, then set PcdEmuVariableNvStoreReserved to the location and let the existing logic handle it? Also why limit this to tdx? take care, Gerd