public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "James Bottomley" <jejb@linux.ibm.com>
To: devel@edk2.groups.io
Cc: dovmurik@linux.vnet.ibm.com, Dov.Murik1@il.ibm.com,
	ashish.kalra@amd.com, brijesh.singh@amd.com, tobin@ibm.com,
	david.kaplan@amd.com, jon.grimm@amd.com, thomas.lendacky@amd.com,
	jejb@linux.ibm.com, frankeh@us.ibm.com,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [PATCH v3 1/6] OvmfPkg/ResetVector: convert SEV-ES Reset Block structure to be GUIDed
Date: Mon, 30 Nov 2020 12:28:14 -0800	[thread overview]
Message-ID: <20201130202819.3910-2-jejb@linux.ibm.com> (raw)
In-Reply-To: <20201130202819.3910-1-jejb@linux.ibm.com>

Convert the current ES reset block structure to an extensible guid
based structure by appending a header and length, which allow for
multiple guid based data packets to be inserted.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3077
Signed-off-by: James Bottomley <jejb@linux.ibm.com>

---

v2: added
v3: reworked
---
 OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm | 51 +++++++++++++++-----
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
index 980e0138e7fe..9e0a74fddfc1 100644
--- a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
+++ b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm
@@ -25,21 +25,40 @@ ALIGN   16
     TIMES (0x1000 - ($ - EndOfPageTables) - 0x20) DB 0
 %endif
 
+;
+; Padding to ensure first guid starts at 0xffffffd0
+;
+TIMES (15 - ((guidedStructureEnd - guidedStructureStart + 15) % 16)) DB 0
+
+; GUIDed structure.  To traverse this you should first verify the
+; presence of the table footer guid
+; (96b582de-1fb2-45f7-baea-a366c55a082d) at 0xffffffd0.  If that
+; is found, the two bytes at 0xffffffce are the entire table length.
+;
+; The table is composed of structures with the form:
+;
+; Data (arbitrary bytes identified by guid)
+; length from start of data to end of guid (2 bytes)
+; guid (16 bytes)
+;
+; so work back from the footer using the length to traverse until you
+; either find the guid you're looking for or run off the beginning of
+; the table.
+;
+guidedStructureStart:
+
 ;
 ; SEV-ES Processor Reset support
 ;
 ; sevEsResetBlock:
 ;   For the initial boot of an AP under SEV-ES, the "reset" RIP must be
-;   programmed to the RAM area defined by SEV_ES_AP_RESET_IP. A known offset
-;   and GUID will be used to locate this block in the firmware and extract
-;   the build time RIP value. The GUID must always be 48 bytes from the
-;   end of the firmware.
+;   programmed to the RAM area defined by SEV_ES_AP_RESET_IP. The data
+;   format is:
 ;
-;   0xffffffca (-0x36) - IP value
-;   0xffffffcc (-0x34) - CS segment base [31:16]
-;   0xffffffce (-0x32) - Size of the SEV-ES reset block
-;   0xffffffd0 (-0x30) - SEV-ES reset block GUID
-;                        (00f771de-1a7e-4fcb-890e-68c77e2fb44e)
+;   IP value [0:15]
+;   CS segment base [31:16]
+;
+;   GUID (SEV-ES reset block): 00f771de-1a7e-4fcb-890e-68c77e2fb44e
 ;
 ;   A hypervisor reads the CS segement base and IP value. The CS segment base
 ;   value represents the high order 16-bits of the CS segment base, so the
@@ -48,8 +67,6 @@ ALIGN   16
 ;   program the EIP register with the IP value as read.
 ;
 
-TIMES (32 - (sevEsResetBlockEnd - sevEsResetBlockStart)) DB 0
-
 sevEsResetBlockStart:
     DD      SEV_ES_AP_RESET_IP
     DW      sevEsResetBlockEnd - sevEsResetBlockStart
@@ -57,6 +74,18 @@ sevEsResetBlockStart:
     DB      0x89, 0x0E, 0x68, 0xC7, 0x7E, 0x2F, 0xB4, 0x4E
 sevEsResetBlockEnd:
 
+;
+; Table footer:
+;
+; length of whole table (16 bit word)
+; GUID (table footer): 96b582de-1fb2-45f7-baea-a366c55a082d
+;
+    DW      guidedStructureEnd - guidedStructureStart
+    DB      0xDE, 0x82, 0xB5, 0x96, 0xB2, 0x1F, 0xF7, 0x45
+    DB      0xBA, 0xEA, 0xA3, 0x66, 0xC5, 0x5A, 0x08, 0x2D
+
+guidedStructureEnd:
+
 ALIGN   16
 
 applicationProcessorEntryPoint:
-- 
2.26.2


  reply	other threads:[~2020-11-30 20:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 20:28 [PATCH v3 0/6] SEV Encrypted Boot for Ovmf James Bottomley
2020-11-30 20:28 ` James Bottomley [this message]
2020-12-03  8:10   ` [edk2-devel] [PATCH v3 1/6] OvmfPkg/ResetVector: convert SEV-ES Reset Block structure to be GUIDed Laszlo Ersek
2020-11-30 20:28 ` [PATCH v3 2/6] OvmfPkg/Amdsev: Base commit to build encrypted boot specific OVMF James Bottomley
2020-12-03  8:20   ` [edk2-devel] " Laszlo Ersek
2020-11-30 20:28 ` [PATCH v3 3/6] OvmfPkg/AmdSev: add Grub Firmware Volume Package James Bottomley
2020-12-03  8:39   ` [edk2-devel] " Laszlo Ersek
2020-11-30 20:28 ` [PATCH v3 4/6] OvmfPkg: create a SEV secret area in the AmdSev memfd James Bottomley
2020-12-03  8:42   ` [edk2-devel] " Laszlo Ersek
2020-11-30 20:28 ` [PATCH v3 5/6] OvmfPkg/AmdSev: assign and protect the Sev Secret area James Bottomley
2020-12-01  7:54   ` Ard Biesheuvel
2020-12-01 18:36     ` [edk2-devel] " James Bottomley
2020-11-30 20:28 ` [PATCH v3 6/6] OvmfPkg/AmdSev: Expose the Sev Secret area using a configuration table James Bottomley
2020-12-03  8:46   ` [edk2-devel] " Laszlo Ersek
2020-12-09 12:02   ` Yao, Jiewen
2020-12-09 15:46     ` James Bottomley
2020-12-09 15:54       ` James Bottomley
2020-12-09 16:33       ` Yao, Jiewen
2020-12-09 16:38         ` James Bottomley
2020-12-09 16:51           ` Yao, Jiewen
2020-12-09 17:04             ` James Bottomley
2020-12-10  9:12     ` Laszlo Ersek
2020-12-10  9:27       ` Yao, Jiewen
2020-12-01  8:05 ` [PATCH v3 0/6] SEV Encrypted Boot for Ovmf Ard Biesheuvel
2020-12-01  8:13   ` Laszlo Ersek
2020-12-01 15:26   ` James Bottomley
2020-12-01  8:05 ` Laszlo Ersek
2020-12-03 12:26 ` [edk2-devel] " Laszlo Ersek
2020-12-03 14:27   ` James Bottomley
2020-12-04  0:46     ` Laszlo Ersek
2020-12-04  1:05       ` James Bottomley
2020-12-04  1:55         ` Laszlo Ersek
2020-12-04  2:01           ` Laszlo Ersek
2020-12-14 19:57             ` Laszlo Ersek
2020-12-21 15:00               ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201130202819.3910-2-jejb@linux.ibm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox