From: Sebastien Boeuf <sebastien.boeuf@intel.com>
Following the model from the Xen target, CloudHv is generated as a PVH
ELF binary to take advantage of the PVH specification.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
---
OvmfPkg/CloudHv/CloudHvX64.dsc | 2 +-
OvmfPkg/CloudHv/CloudHvX64.fdf | 94 +++++++++++++++++++++++++++++++++-
2 files changed, 93 insertions(+), 3 deletions(-)
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index 3172100310..b4d855d80f 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -631,7 +631,7 @@
#
################################################################################
[Components]
- OvmfPkg/ResetVector/ResetVector.inf
+ OvmfPkg/XenResetVector/XenResetVector.inf
#
# SEC Phase modules
diff --git a/OvmfPkg/CloudHv/CloudHvX64.fdf b/OvmfPkg/CloudHv/CloudHvX64.fdf
index ce3302c6d6..8eeaaaabcf 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.fdf
+++ b/OvmfPkg/CloudHv/CloudHvX64.fdf
@@ -24,7 +24,97 @@ ErasePolarity = 1
BlockSize = $(BLOCK_SIZE)
NumBlocks = $(FW_BLOCKS)
-!include OvmfPkg/VarStore.fdf.inc
+!if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
+0x00000000|0x0000e000
+!endif
+!if $(FD_SIZE_IN_KB) == 4096
+0x00000000|0x00040000
+!endif
+DATA = {
+ #
+ # This hex array have been generated by OvmfPkg/OvmfXenElfHeaderGenerator.c
+ # and copied manually.
+ # Built with "gcc -D PVH64 -o elf_gen OvmfPkg/OvmfXenElfHeaderGenerator.c"
+ # and run with "./elf_gen 4194304".
+ #
+ # ELF file header
+ 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xd0, 0xff, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, # hdr.e_entry
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+ # ELF Program segment headers
+ # - Load segment
+ 0x01, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ # - ELFNOTE segment
+ 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00,
+ 0xb0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0xb0, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0xb0, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ # XEN_ELFNOTE_PHYS32_ENTRY
+ 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0x00, 0x00,
+ 0x58, 0x65, 0x6e, 0x00,
+ 0xd0, 0xff, 0x4f, 0x00
+}
+
+!if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
+0x0000e000|0x00001000
+!endif
+!if $(FD_SIZE_IN_KB) == 4096
+0x00040000|0x00001000
+!endif
+#NV_EVENT_LOG
+
+!if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
+0x0000f000|0x00001000
+!endif
+!if $(FD_SIZE_IN_KB) == 4096
+0x00041000|0x00001000
+!endif
+#NV_FTW_WORKING
+DATA = {
+ # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEdkiiWorkingBlockSignatureGuid =
+ # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95 }}
+ 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49,
+ 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95,
+ # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
+ 0x2c, 0xaf, 0x2c, 0x64, 0xFE, 0xFF, 0xFF, 0xFF,
+ # WriteQueueSize: UINT64
+ 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+}
+
+!if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
+0x00010000|0x00010000
+!endif
+!if $(FD_SIZE_IN_KB) == 4096
+0x00042000|0x00042000
+!endif
+#NV_FTW_SPARE
$(VARS_SIZE)|$(FVMAIN_SIZE)
FV = FVMAIN_COMPACT
@@ -142,7 +232,7 @@ READ_LOCK_STATUS = TRUE
#
INF OvmfPkg/Sec/SecMain.inf
-INF RuleOverride=RESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf
+INF RuleOverride=RESET_VECTOR OvmfPkg/XenResetVector/XenResetVector.inf
################################################################################
[FV.PEIFV]
--
2.32.0
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86916): https://edk2.groups.io/g/devel/message/86916
Mute This Topic: https://groups.io/mt/89345268/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Hi, > -!include OvmfPkg/VarStore.fdf.inc > +!if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048) > +0x00000000|0x0000e000 > +!endif > +!if $(FD_SIZE_IN_KB) == 4096 > +0x00000000|0x00040000 > +!endif Hmm, VarStore.fdf.inc reduces duplication, and now you revert this. Maybe add this to VarStore.fdf.inc instead, and add a PVH_HEADER_ENABLE option to turn it on and off? Also: With this in place the start of the vars firmware volume moves because it's prefixed by the elf header. Does that work without code changes? take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86960): https://edk2.groups.io/g/devel/message/86960 Mute This Topic: https://groups.io/mt/89345268/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
On Thu, 2022-02-24 at 09:16 +0100, Gerd Hoffmann wrote: > Hi, > > > -!include OvmfPkg/VarStore.fdf.inc > > +!if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048) > > +0x00000000|0x0000e000 > > +!endif > > +!if $(FD_SIZE_IN_KB) == 4096 > > +0x00000000|0x00040000 > > +!endif > > Hmm, VarStore.fdf.inc reduces duplication, and now you revert this. > Maybe add this to VarStore.fdf.inc instead, and add a > PVH_HEADER_ENABLE > option to turn it on and off? It's quite hard to use VarStore.fdf.inc since I would need to replace only the first DATA section. And I can't include something specific like OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc inside VarStore.fdf.inc. Should I create something like OvmfPkg/CloudHv/CloudHvVarStore.fdf.inc so that it makes sense to include OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc based on a PVH_HEADER_ENABLE variable? > > Also: With this in place the start of the vars firmware volume moves > because it's prefixed by the elf header. Does that work without code > changes? TBH, I'm not sure. I've been testing CLOUDHV.fd and it works fine. > > take care, > Gerd > > > > > > --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86987): https://edk2.groups.io/g/devel/message/86987 Mute This Topic: https://groups.io/mt/89345268/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi, > > Hmm, VarStore.fdf.inc reduces duplication, and now you revert this. > > Maybe add this to VarStore.fdf.inc instead, and add a > > PVH_HEADER_ENABLE > > option to turn it on and off? > > It's quite hard to use VarStore.fdf.inc since I would need to replace > only the first DATA section. And I can't include something specific > like OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc inside VarStore.fdf.inc. > Should I create something like OvmfPkg/CloudHv/CloudHvVarStore.fdf.inc > so that it makes sense to include > OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc based on a PVH_HEADER_ENABLE > variable? Yes, that was the idea, only include the file in case PVH_HEADER_ENABLE=TRUE. Maybe name it "PVH_HEADER_CLOUDHW" so the xen guys can add PVH_HEADER_XEN variable for the simliar but not identical xen case. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86998): https://edk2.groups.io/g/devel/message/86998 Mute This Topic: https://groups.io/mt/89345268/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
On Fri, 2022-02-25 at 10:29 +0100, kraxel@redhat.com wrote: > Hi, > > > > Hmm, VarStore.fdf.inc reduces duplication, and now you revert > > > this. > > > Maybe add this to VarStore.fdf.inc instead, and add a > > > PVH_HEADER_ENABLE > > > option to turn it on and off? > > > > It's quite hard to use VarStore.fdf.inc since I would need to > > replace > > only the first DATA section. And I can't include something specific > > like OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc inside > > VarStore.fdf.inc. > > Should I create something like > > OvmfPkg/CloudHv/CloudHvVarStore.fdf.inc > > so that it makes sense to include > > OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc based on a > > PVH_HEADER_ENABLE > > variable? > > Yes, that was the idea, only include the file in case > PVH_HEADER_ENABLE=TRUE. Maybe name it "PVH_HEADER_CLOUDHW" so the > xen > guys can add PVH_HEADER_XEN variable for the simliar but not > identical > xen case. I took care of it on the 4th patch through the v4 I've just sent. Let me know if that's what you were expecting. Thanks, Seb > > take care, > Gerd > --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87016): https://edk2.groups.io/g/devel/message/87016 Mute This Topic: https://groups.io/mt/89345268/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.