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.129.124]) by mx.groups.io with SMTP id smtpd.web11.4381.1655881294440390716 for ; Wed, 22 Jun 2022 00:01:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f/xR9xPv; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655881293; 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=IideN8WBSC8UdBabHiOqkMeNJPb2jHslQ4V7jhHMSgA=; b=f/xR9xPvOITLAjUjtiM234wky/cNb1qHYcjVgXSREAld/0II/N+jZxTWdz6LRzWXjIwzVZ z3zJd6yVs477xV8HKns/r7CLHD0YXv7skSfsAYzVnUzh2FjxB3k1NXSXprwWYMIkZRmQeM lut/gDHTNFfZUhVorW/6k5O6oOWORic= 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-261-oMOYXAcGML2gAceThiTQ8A-1; Wed, 22 Jun 2022 03:01:29 -0400 X-MC-Unique: oMOYXAcGML2gAceThiTQ8A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 556D938005CE; Wed, 22 Jun 2022 07:01:29 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3C8C2166B26; Wed, 22 Jun 2022 07:01:28 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0E6221800081; Wed, 22 Jun 2022 09:01:27 +0200 (CEST) Date: Wed, 22 Jun 2022 09:01:27 +0200 From: "Gerd Hoffmann" To: "Xu, Min M" Cc: "devel@edk2.groups.io" , "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [PATCH 3/3] OvmfPkg: Initialize NvVarStore with Configuration FV in Td guest Message-ID: <20220622070127.toheatopvja6lrhd@sirius.home.kraxel.org> References: <20220620110124.s4sutzqnsvlmvdg5@sirius.home.kraxel.org> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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 On Wed, Jun 22, 2022 at 02:02:00AM +0000, Xu, Min M wrote: > On June 20, 2022 7:01 PM, Gerd Hoffman wrote: > > > > 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? > There is ReserveEmuVariableNvStore in PlatformPei/Platform.c. This > function is called to allocate storage for NV Variables. > PcdEmuVariableNvStoreReserved is set in that function too. So we can > copy the content to that reserved storage if it is tdx guest. Then we > let the exiting logic to handle it. So I would like to extract > ReserveEmuVariableNvStore to PlatformReserveEmuVariableNvStore (in > PlatformInitLib) and call it in both PlatformPei/Platform.c and > PeilesssStartup.c. Moving the ReserveEmuVariableNvStore() function to PlatformInitLib make sense. Will be a bit more than pure code motion though, we probably need a new variable in the platforminfo struct because PeilesssStartup.c can't set PCDs. Copying over the content in PlatformInitLib makes sense too, probably best as separate function. > > Also why limit this to tdx? > Because I am not sure if other platforms need such operation. So in > current stage it is limit to tdx. I think the code should copy over the varstore in case the SECURE_BOOT_ENABLE option is set. That is the actual use case and it makes sense without TDX too. take care, Gerd