From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.158.5]) by mx.groups.io with SMTP id smtpd.web10.109.1605897940655196945 for ; Fri, 20 Nov 2020 10:45:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=FiLDk+TY; spf=pass (domain: linux.ibm.com, ip: 148.163.158.5, mailfrom: jejb@linux.ibm.com) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AKIY3YU159847; Fri, 20 Nov 2020 13:45:38 -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=a3nIvkP1Xao19Mo4wg48VrhUpyX7OvHHHsRYPYFh6I8=; b=FiLDk+TYSSG2UX79gcQUK2MB6QUGpWYjBLoO/MlY1eghM97TuuOzLVqsPBWs3GArEHfH 2f/jjvFfiC11S0U/moPYaSMQy+XI2BiIQFJMySjhPNsTypvJRqYGvGQLwjzTGebjC+nj yp6iLrIU5Ybyto4c2jc6UCzUEDrYwhBRzXfHEAihEHidUN21vIjWNZKMkrpEaXWUsS4O aQuuI7sJy110kHyZXFN/Oajyu8J1d6iPIIzywoAsMN4Znfri6QsvPcOo4XhLGMUkZeZ0 USEYE9J2JRhntsUxqb2pfmPmoAhg6b/hEC/6wducJ/zy499H4IeHfUnItvLYBval4MKM Gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 34x0jpdvft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Nov 2020 13:45:38 -0500 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0AKIeJfM187611; Fri, 20 Nov 2020 13:45:37 -0500 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 34x0jpdvfn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Nov 2020 13:45:37 -0500 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AKIRKV9012803; Fri, 20 Nov 2020 18:45:37 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma05wdc.us.ibm.com with ESMTP id 34t6v9rje6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Nov 2020 18:45:37 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AKIjOJ764029176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Nov 2020 18:45:24 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8B8E6A04F; Fri, 20 Nov 2020 18:45:33 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F67D6A051; Fri, 20 Nov 2020 18:45:31 +0000 (GMT) Received: from jarvis.int.hansenpartnership.com (unknown [9.80.207.206]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 20 Nov 2020 18:45:31 +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 Subject: [PATCH v2 3/6] OvmfPkg: convert ES Reset Block structure to be guided Date: Fri, 20 Nov 2020 10:45:18 -0800 Message-Id: <20201120184521.19437-4-jejb@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201120184521.19437-1-jejb@linux.ibm.com> References: <20201120184521.19437-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-20_12:2020-11-20,2020-11-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 impostorscore=0 adultscore=0 spamscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011200124 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 --- OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm | 49 +++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm b/OvmfPkg/ResetVector/Ia16/ResetVectorVtf0.asm index 980e0138e7fe..baf9d09f3625 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 (32 - ((guidedStructureEnd - guidedStructureStart) % 32)) DB 0 + +; Guided structure. To traverse this you should first verify the +; presence of the table header 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 guid to end of data (2 bytes) +; guid (16 bytes) +; +; so work back from the header using the length to traverse until you +; either find the guid you're looking for or run off the end 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] +; +; SEV-ES reset block GUID: 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,16 @@ sevEsResetBlockStart: DB 0x89, 0x0E, 0x68, 0xC7, 0x7E, 0x2F, 0xB4, 0x4E sevEsResetBlockEnd: +; +; Table header: length of whole table followed by table header +; guid: 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