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.web11.5496.1676534831692855953 for ; Thu, 16 Feb 2023 00:07:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=mW7lw5Wo; spf=pass (domain: linux.ibm.com, ip: 148.163.158.5, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31G84LA9015386 for ; Thu, 16 Feb 2023 08:07:11 GMT 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=z3UteUUHP8ehdSgTyrAnfmxEDZ6S/CSHGMpWy7rxN00=; b=mW7lw5WonDdPDWR4x0BQBrVCewayMgihRp3nWYddapH10IcUdu6p3xN+7ieJULrYL93l fdTBQCgASlv+GbGKIi4Ao2t7c5PjDZDbP9KW2+2W+jJCZ4Nqkc/yIJnQ9ZON6Fzh63tO gx/rcUDe4kCTCqHlwGrno1oKqRccHs+ik7puTKoaZlqDTNxzKWwcxwASItrsb0/EOpTe O9P0PmBV11+MSPahvgHMHDBpd/6JZ4LseRXCNMu2rBFUBQoWKMhxJ46RYm++D+HmwI7H 8g7lQLNDmgIlyktiS4Vqnm7JIAVwIf8O4T1XyOtewVB71eUpsRiN/dK9iyz3dRBC/TYW /w== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nsfmnhk7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Feb 2023 08:07:10 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 31G4FjmU020625 for ; Thu, 16 Feb 2023 08:07:10 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3np2n79g53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Feb 2023 08:07:10 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 31G8788r62128626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Feb 2023 08:07:08 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E9755805C; Thu, 16 Feb 2023 08:07:08 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A03958058; Thu, 16 Feb 2023 08:07:08 +0000 (GMT) Received: from amdmilan1.watson.ibm.com (unknown [9.2.130.16]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 16 Feb 2023 08:07:08 +0000 (GMT) From: "Dov Murik" To: devel@edk2.groups.io Cc: Dov Murik Subject: [PATCH v2 2/2] OvmfPkg/ResetVector: Exclude SEV launch secrets page from pre-validation Date: Thu, 16 Feb 2023 08:06:57 +0000 Message-Id: <20230216080657.2120213-3-dovmurik@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230216080657.2120213-1-dovmurik@linux.ibm.com> References: <20230216080657.2120213-1-dovmurik@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: g6uNpOFVOJorCCqA6ZGA-pG78TCo55Au X-Proofpoint-ORIG-GUID: g6uNpOFVOJorCCqA6ZGA-pG78TCo55Au X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-16_06,2023-02-15_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=729 suspectscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302160068 Content-Transfer-Encoding: quoted-printable In order to allow the VMM (such as QEMU) to add a page with hashes of kernel/initrd/cmdline for measured direct boot on SNP, this page must not be part of the SNP metadata list reported to the VMM. Check if that page is defined; if it is, skip it in the metadata list. In such case, VMM should fill the page with the hashes content, or explicitly update it as a zero page (if kernel hashes are not used). Note that for SNP, the launch secret part of the page (lower 3KB) are not relevant and will stay zero. The last 1KB is used for the hashes. This should have no effect on OvmfPkgX64 targets (which don't define PcdSevLaunchSecretBase). Signed-off-by: Dov Murik --- OvmfPkg/ResetVector/ResetVector.nasmb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/Re= setVector.nasmb index 94fbb0a87b37..16f3daf49d82 100644 --- a/OvmfPkg/ResetVector/ResetVector.nasmb +++ b/OvmfPkg/ResetVector/ResetVector.nasmb @@ -75,7 +75,19 @@ ;=0D %define SNP_SEC_MEM_BASE_DESC_2 (GHCB_BASE + 0x1000)=0D %define SNP_SEC_MEM_SIZE_DESC_2 (SEV_SNP_SECRETS_BASE - SNP_SEC_MEM_= BASE_DESC_2)=0D -%define SNP_SEC_MEM_BASE_DESC_3 (CPUID_BASE + CPUID_SIZE)=0D +%if (FixedPcdGet32 (PcdSevLaunchSecretBase) > 0)=0D + ; There's a reserved page for SEV secrets and hashes; the VMM will fill = and=0D + ; validate the page, or mark it as a zero page.=0D + %define EXPECTED_END_OF_LAUNCH_SECRET_PAGE (FixedPcdGet32 (PcdSevLaunchS= ecretBase) + \=0D + FixedPcdGet32 (PcdSevLaunchS= ecretSize) + \=0D + FixedPcdGet32 (PcdQemuHashTa= bleSize))=0D + %if (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) !=3D EXPECTED_END_OF_LAUNC= H_SECRET_PAGE)=0D + %error "PcdOvmfSecPeiTempRamBase must start directly after the SEV Lau= nch Secret page"=0D + %endif=0D + %define SNP_SEC_MEM_BASE_DESC_3 (FixedPcdGet32 (PcdOvmfSecPeiTempRam= Base))=0D +%else=0D + %define SNP_SEC_MEM_BASE_DESC_3 (CPUID_BASE + CPUID_SIZE)=0D +%endif=0D %define SNP_SEC_MEM_SIZE_DESC_3 (FixedPcdGet32 (PcdOvmfPeiMemFvBase)= - SNP_SEC_MEM_BASE_DESC_3)=0D =0D %ifdef ARCH_X64=0D --=20 2.25.1