From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: nathaniel.l.desimone@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Thu, 25 Jul 2019 17:24:12 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 17:24:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,308,1559545200"; d="scan'208";a="189494068" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by fmsmga001.fm.intel.com with ESMTP; 25 Jul 2019 17:24:12 -0700 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX102.amr.corp.intel.com (10.22.225.129) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 25 Jul 2019 17:24:11 -0700 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.96]) by ORSMSX159.amr.corp.intel.com ([169.254.11.26]) with mapi id 14.03.0439.000; Thu, 25 Jul 2019 17:24:11 -0700 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "Chiu, Chasel" CC: "Zeng, Star" Subject: Re: [edk2-devel] [PATCH] IntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain Thread-Topic: [edk2-devel] [PATCH] IntelFsp2Pkg: PeiService pointer not reset to 0 in SecMain Thread-Index: AQHVQwDL0IyvFtdQ8kGFzugqc3yXzqbcCsiQ Date: Fri, 26 Jul 2019 00:24:10 +0000 Message-ID: <02A34F284D1DA44BB705E61F7180EF0AAED772C7@ORSMSX114.amr.corp.intel.com> References: <20190725155059.84-1-chasel.chiu@intel.com> In-Reply-To: <20190725155059.84-1-chasel.chiu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzA3NDQwM2EtMzBkNy00OTBkLWIzYmUtYjRmZDM3ZDViMmIyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZGd2VlNYNE85endzRVA5NEZvZDBjUTY4NlVyZCtlQUpmVmhxcVNrUmY1NjQzamQwdWl4bkZcL0ZkUEJKa1wvWGIwIn0= x-ctpclassification: CTP_NT x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Return-Path: nathaniel.l.desimone@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone -----Original Message----- From: devel@edk2.groups.io On Behalf Of Chiu, Chase= l Sent: Thursday, July 25, 2019 8:51 AM To: devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Zeng, Star Subject: [edk2-devel] [PATCH] IntelFsp2Pkg: PeiService pointer not reset t= o 0 in SecMain 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 da= ta from stack, which was not rest to 0 in SecMain. Solution is to align FSP SEC_IDT_TABLE structure to UefiCpuPkg to have UIN= T64 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 --- IntelFsp2Pkg/FspSecCore/SecMain.c | 2 +- IntelFsp2Pkg/FspSecCore/SecMai= n.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/S= ecMain.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/S= ecMain.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=20 + 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=20 + IDT base // address should be 8-byte alignment. + // Note: For IA32, only the 4 bytes immediately preceding IDT is used= =20 + to store // EFI_PEI_SERVICES** // + UINT64 PeiService; UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)]; } SEC_IDT_TABLE; =20 -- 2.13.3.windows.1