From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 22A1BD80127 for ; Mon, 18 Mar 2024 23:17:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=XkWf01/Ptl6q3rDI6khbEdSs54oXjC9ifiEVl3J+EG4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1710803831; v=1; b=ALKjV9Pxm7R4dXb8RpPMvjoqNJqPA9ZDtcWggFM3VWCZWPR8ssKZUU4F875EHko05BzIya0s 211yHCUckr04qxXh11M8rTFUetdVb1ijB0iMEgQQYLWbc6OQVut5ckCk/AwUrVureFkL72mscDv 8gb+2qoXw1OXT5+MD6EboFKON4wMuFrXiL/6FWEKP8iYuVC+7Js3VVeXigweEktniaCdQ0IhJnv B8/A0a2qodfP1xzEqOYobyp2+kQyozQBAJIPUz6xPaax7VYACLOV3m+LhLLIrA5eLNdVRoLqeEg EamTgPDH59ppm43LaMRBkEgJ6uID9Rurl+xqiOdCYPJLw== X-Received: by 127.0.0.2 with SMTP id WbvuYY7687511xfu46XPbVCR; Mon, 18 Mar 2024 16:17:11 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.9275.1710411897409350681 for ; Thu, 14 Mar 2024 03:24:57 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-I-untgNWPqShuEcLqdJb3A-1; Thu, 14 Mar 2024 06:24:53 -0400 X-MC-Unique: I-untgNWPqShuEcLqdJb3A-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E845185A784; Thu, 14 Mar 2024 10:24:53 +0000 (UTC) X-Received: from srv1.redhat.com (unknown [10.45.225.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB804C041F2; Thu, 14 Mar 2024 10:24:51 +0000 (UTC) From: Konstantin Kostiuk To: devel@edk2.groups.io Cc: Yan Vugenfirer , Ard Biesheuvel , Jiewen Yao , Gerd Hoffmann Subject: [edk2-devel] [PATCH 1/2] OvmfPkg: Add VirtHstiDxe driver Date: Thu, 14 Mar 2024 12:24:46 +0200 Message-ID: <20240314102447.24313-2-kkostiuk@redhat.com> In-Reply-To: <20240314102447.24313-1-kkostiuk@redhat.com> References: <20240314102447.24313-1-kkostiuk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 18 Mar 2024 16:17:11 -0700 Reply-To: devel@edk2.groups.io,kkostiuk@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: LTvkjHvx7fJxtx2qmCtrXILex7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="US-ASCII"; x-default=true X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=ALKjV9Px; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) The driver provides empty HSTI table. Signed-off-by: Konstantin Kostiuk --- OvmfPkg/VirtHstiDxe/VirtHstiDxe.c | 75 +++++++++++++++++++++++++++++ OvmfPkg/VirtHstiDxe/VirtHstiDxe.inf | 64 ++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 OvmfPkg/VirtHstiDxe/VirtHstiDxe.c create mode 100644 OvmfPkg/VirtHstiDxe/VirtHstiDxe.inf diff --git a/OvmfPkg/VirtHstiDxe/VirtHstiDxe.c b/OvmfPkg/VirtHstiDxe/VirtHs= tiDxe.c new file mode 100644 index 0000000000..b9ed189f33 --- /dev/null +++ b/OvmfPkg/VirtHstiDxe/VirtHstiDxe.c @@ -0,0 +1,75 @@ +/** @file + This file contains DXE driver for publishing empty HSTI table + +Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2024, Red Hat. Inc + +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HSTI_PLATFORM_NAME L"Intel(R) 9-Series v1" +#define HSTI_SECURITY_FEATURE_SIZE 1 + +ADAPTER_INFO_PLATFORM_SECURITY mHstiBase =3D { + PLATFORM_SECURITY_VERSION_VNEXTCS, + PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE, + { HSTI_PLATFORM_NAME }, + HSTI_SECURITY_FEATURE_SIZE, +}; + +/** + The driver's entry point. + + @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry poin= t. +**/ +EFI_STATUS +EFIAPI +VirtHstiDxeEntrypoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // Allocate memory for HSTI struct + // 3 * sizeof (UINT8) * HSTI_SECURITY_FEATURE_SIZE is for the 3 arrays + // UINT8 SecurityFeaturesRequired[]; + // UINT8 SecurityFeaturesImplemented[]; + // UINT8 SecurityFeaturesVerified[]; + // sizeof (CHAR16) is for the NULL terminator of ErrorString + // CHAR16 ErrorString[] + UINTN HstiSize =3D sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + + 3 * sizeof (UINT8) * HSTI_SECURITY_FEATURE_SIZE + + sizeof (CHAR16); + VOID *HstiStruct =3D AllocateZeroPool (HstiSize); + + if (HstiStruct =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (HstiStruct, &mHstiBase, sizeof (ADAPTER_INFO_PLATFORM_SECURITY)= ); + + Status =3D HstiLibSetTable (HstiStruct, HstiSize); + if (EFI_ERROR (Status)) { + if (Status !=3D EFI_ALREADY_STARTED) { + ASSERT_EFI_ERROR (Status); + } + } + + return EFI_SUCCESS; +} diff --git a/OvmfPkg/VirtHstiDxe/VirtHstiDxe.inf b/OvmfPkg/VirtHstiDxe/Virt= HstiDxe.inf new file mode 100644 index 0000000000..270aa60026 --- /dev/null +++ b/OvmfPkg/VirtHstiDxe/VirtHstiDxe.inf @@ -0,0 +1,64 @@ +## @file +# Component description file for Virt Hsti Driver +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
+# Copyright (c) 2024, Red Hat. Inc +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D VirtHstiDxe + FILE_GUID =3D 60740CF3-D428-4500-80E6-04A5798241ED + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D VirtHstiDxeEntrypoint + +##########################################################################= ###### +# +# Sources Section - list of files that are required for the build to succe= ed. +# +##########################################################################= ###### + +[Sources] + VirtHstiDxe.c + +##########################################################################= ###### +# +# Package Dependency Section - list of Package files that are required for +# this module. +# +##########################################################################= ###### + +[Packages] + MdePkg/MdePkg.dec + +##########################################################################= ###### +# +# Library Class Section - list of Library Classes that are required for +# this module. +# +##########################################################################= ###### + +[LibraryClasses] + UefiDriverEntryPoint + UefiLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + DebugLib + HstiLib + UefiBootServicesTableLib + +##########################################################################= ###### +# +# Protocol C Name Section - list of Protocol and Protocol Notify C Names +# that this module uses or produces. +# +##########################################################################= ###### + +[Depex] + TRUE --=20 2.44.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116858): https://edk2.groups.io/g/devel/message/116858 Mute This Topic: https://groups.io/mt/105014743/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-