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.web12.6096.1645794059676788122 for ; Fri, 25 Feb 2022 05:01:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jC/TMelJ; 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=1645794058; 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=ZuByNFGkHi+4lFhTtK0+p2WXc1E3bxhnberLTrWFo1w=; b=jC/TMelJqCggtFz4jtkr7OO2UWBQRT07ntpJ4rQMVVIcW7o01BOY1TDsq+Z7eRaNiv0kcy bj6kIbXKnOnTBI5ys2qLWEbZrDG1/3A4NZu9VNSviK3+nVFXgeZ9tD6gxdWf2pT1tk6Hq9 LNM0Y9ZC15D5lqADkW+JftG/8zPOdT0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-341-KflUFClePoaGSOhMPwobCw-1; Fri, 25 Feb 2022 08:00:57 -0500 X-MC-Unique: KflUFClePoaGSOhMPwobCw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06203FC81; Fri, 25 Feb 2022 13:00:56 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B161C7A531; Fri, 25 Feb 2022 13:00:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E6B8A18003BE; Fri, 25 Feb 2022 14:00:53 +0100 (CET) Date: Fri, 25 Feb 2022 14:00:53 +0100 From: "Gerd Hoffmann" To: sebastien.boeuf@intel.com Cc: devel@edk2.groups.io, jiewen.yao@intel.com, jordan.l.justen@intel.com Subject: Re: [PATCH v4 4/7] OvmfPkg: Generate CloudHv as a PVH ELF binary Message-ID: <20220225130053.oizxc47lhvyr5cim@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 > +++ b/OvmfPkg/CloudHv/CloudHvX64.fdf > @@ -14,8 +14,8 @@ > !include OvmfPkg/OvmfPkgDefines.fdf.inc > > # > -# Build the variable store and the firmware code as one unified flash device > -# image. > +# This will allow the flash device image to be recognize as an ELF, with first > +# an ELF headers, then the firmware code. > # > [FD.CLOUDHV] > BaseAddress = $(FW_BASE_ADDRESS) > @@ -24,7 +24,9 @@ ErasePolarity = 1 > BlockSize = $(BLOCK_SIZE) > NumBlocks = $(FW_BLOCKS) > > +DEFINE PVH_HEADER_CLOUDHV = TRUE I'd place the define in CloudHvX64.dsc, in the [Defines] section, where all the other DEFINE statements are too. > !include OvmfPkg/VarStore.fdf.inc > +DEFINE PVH_HEADER_CLOUDHV = FALSE No need to flip that back to FALSE. > +!if $(PVH_HEADER_CLOUDHV) == TRUE > +!include OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc > +!else > DATA = { > ## This is the EFI_FIRMWARE_VOLUME_HEADER > # ZeroVector [] > @@ -79,6 +83,7 @@ DATA = { > # FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32 > 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > } > +!endif Oh. So the ELF header *replaces* the firmware volume header. Didn't notice that before. Hmm. With that the varstore initialization most likely fails. There is a fallback path though, with ovmf storing variables elsewhere (in normal ram instead of firmware flash I think). Persistent variables don't work in that case. When the persistent varstore doesn't work anyway (and you are ok with that) you probably can drop the space reserved for it from the firmware image and use just a single page for the pvh elf header (and sharing VarStore.fdf doesn't make sense then). take care, Gerd