From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web12.2952.1606768178089639257 for ; Mon, 30 Nov 2020 12:29:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=HoMPiMBw; spf=pass (domain: linux.ibm.com, ip: 148.163.158.5, mailfrom: jejb@linux.ibm.com) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AUK39CH143830; Mon, 30 Nov 2020 15:29:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=D8tRiCOVh9z/PXsBPBSHzmq8UxZYJJC9FyDmX1znBtg=; b=HoMPiMBwNjrEPvEvFJNfXqDAJYh1vNuXL5WvMEwfkKETrem0MBSzG4US49ehOZ87tb6P G2tzDAp7uzIAyfIhan5jjqAXoHCmwSJ4RtXCkStSqLRva6GlZ+6FKMcY7TMIwNjFVflP AGFn7o5sFl3QoNgO1Sh7ugKpiF7rD51nTv2km79LSbdWUaEhExWKLA4wEp8X7HCudVGT ICb9/PmOfnFpaahHG4d7y3syFC4oa3SytxHdFY3dTGz+UDg2wytD4uij8V6PnnI2yWlY kil7gN74DGGbS4TlEIAQkd7mLRAfE6V8gsfXRUsu9GCbOM+buhXqYH0jYQnb9CJtKNPu qQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 35551sdb85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Nov 2020 15:29:32 -0500 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0AUK37Ks143563; Mon, 30 Nov 2020 15:29:32 -0500 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 35551sdb7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Nov 2020 15:29:32 -0500 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AUKMbVx007998; Mon, 30 Nov 2020 20:29:31 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma04dal.us.ibm.com with ESMTP id 353e68y455-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Nov 2020 20:29:31 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AUKTTb459703670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Nov 2020 20:29:29 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41B12124053; Mon, 30 Nov 2020 20:29:29 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 643A5124052; Mon, 30 Nov 2020 20:29:27 +0000 (GMT) Received: from jarvis.int.hansenpartnership.com (unknown [9.80.201.242]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 30 Nov 2020 20:29:27 +0000 (GMT) From: "James Bottomley" 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" , Laszlo Ersek , Jordan Justen , Ard Biesheuvel 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 Message-Id: <20201130202819.3910-2-jejb@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201130202819.3910-1-jejb@linux.ibm.com> References: <20201130202819.3910-1-jejb@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-30_08:2020-11-30,2020-11-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011300128 Content-Transfer-Encoding: 8bit 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 --- 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