From nobody Mon May 6 18:35:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44397+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44397+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1564069865; cv=none; d=zoho.com; s=zohoarc; b=SXV4Gh28GHFikcIyAcH5nsWSqraVjQtph1P8qRPvtpOD2I45Ww2QWJFJUM/2WuFg8ZMC8F8/JEft7uZYDM7DosNuUSHZgrjSB0NCUQjpFYGZ4bfe7xIQUjDp7FhK8H6CJgOGjVJEtWZj4LC1I1dUNBLJ85zAK6I2xbM0L+56wVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564069865; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=jL2sYX4SlglrwltgLOTO7kEYAN5VgA1gp7Uvymq1iQQ=; b=ogrUpNpmiHmmVsrkjy1mN7km+bgFwPNcx5h9JkP1hYgHmeTQwGlG9DArvCQpYWZK3c0Evs6HFcUxXIlq40Mn7CPJ/JRDLm+2mWRLVwG0az3dERI+rQTJ5OcqsotwUO0+ZgUrawzncvjydef/jGizGD+src64mqNkM+xEApY+WIU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44397+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1564069865100678.4064580072405; Thu, 25 Jul 2019 08:51:05 -0700 (PDT) Return-Path: X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Thu, 25 Jul 2019 08:51:04 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 08:51:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,307,1559545200"; d="scan'208";a="170282574" X-Received: from cchiu4-mobl1.gar.corp.intel.com ([10.252.188.173]) by fmsmga008.fm.intel.com with ESMTP; 25 Jul 2019 08:51:02 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Nate DeSimone , Star Zeng Subject: [edk2-devel] [PATCH] IntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain Date: Thu, 25 Jul 2019 23:50:59 +0800 Message-Id: <20190725155059.84-1-chasel.chiu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1564069864; bh=2E2SSiUi3KiLCL2zmp4Fge0wX2VV2RfNRpFjVRdkTDU=; h=Cc:Date:From:Reply-To:Subject:To; b=mWSX2d6b0ER1CiFxpA5nIoq+3wkJQF7Ajp4LjunaBxXVrUYCDL1b4g7cL+LTkc8sQsi qfe9+N4y8iOG0OU+I6DRyNvqGGkZ+UAc3LxMKvqAZi2DynwGRb+O5zpa8MobyuRIERr7t L2GBaxwgNU5qf6Rv6pq6vTV2qZ+ul3qIKvQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2018 Current FSP SEC_IDT_TABLE structure is not natural aligned: typedef struct _SEC_IDT_TABLE { EFI_PEI_SERVICES *PeiService; UINT64 IdtTable[]; } SEC_IDT_TABLE; Compiler will insert DWORD padding between 2 elements and GetPeiServicesTablePointer() in early phase then always returns padding data from stack, which was not rest to 0 in SecMain. Solution is to align FSP SEC_IDT_TABLE structure to UefiCpuPkg to have UINT64 as PeiService field and rest it to 0. Test: Verified on internal platform and booting successfully with FSP API mode. Cc: Nate DeSimone Cc: Star Zeng Signed-off-by: Chasel Chiu Reviewed-by: Nate DeSimone --- IntelFsp2Pkg/FspSecCore/SecMain.c | 2 +- IntelFsp2Pkg/FspSecCore/SecMain.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/Se= cMain.c index a63d1336e4..7169afc6c7 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.c +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c @@ -114,7 +114,7 @@ SecStartup ( // | | // | | // |-------------------|----> TempRamBase - IdtTableInStack.PeiService =3D NULL; + IdtTableInStack.PeiService =3D 0; AsmReadIdtr (&IdtDescriptor); if (IdtDescriptor.Base =3D=3D 0) { ExceptionHandler =3D FspGetExceptionHandler(mIdtEntryTemplate); diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/Se= cMain.h index 6fb16febab..af7f387960 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.h +++ b/IntelFsp2Pkg/FspSecCore/SecMain.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -29,7 +29,13 @@ typedef VOID (*PEI_CORE_ENTRY) ( \ ); =20 typedef struct _SEC_IDT_TABLE { - EFI_PEI_SERVICES *PeiService; + // + // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT= base + // address should be 8-byte alignment. + // Note: For IA32, only the 4 bytes immediately preceding IDT is used to= store + // EFI_PEI_SERVICES** + // + UINT64 PeiService; UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)]; } SEC_IDT_TABLE; =20 --=20 2.13.3.windows.1 -=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 (#44397): https://edk2.groups.io/g/devel/message/44397 Mute This Topic: https://groups.io/mt/32599362/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-