From nobody Mon Apr 29 12:32:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90785+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90785+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1656315808191523.6613739712249; Mon, 27 Jun 2022 00:43:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id SsmvYY1788612x6rWudoxga6; Mon, 27 Jun 2022 00:43:27 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web08.39644.1656315805164350899 for ; Mon, 27 Jun 2022 00:43:26 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10390"; a="264430824" X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="264430824" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 00:43:26 -0700 X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="540022953" X-Received: from tedkuo1-win10.gar.corp.intel.com ([10.5.215.13]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 00:43:24 -0700 From: "Kuo, Ted" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Ray Ni , Ashraf Ali S , Debkumar De , Harry Han , Catharine West Subject: [edk2-devel][PATCH v1 1/2] UefiCpuPkg: Update SEC_IDT_TABLE struct Date: Mon, 27 Jun 2022 15:42:58 +0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,ted.kuo@intel.com X-Gm-Message-State: xZDXTa29QqwvhoZMoSaJYCcbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1656315807; bh=0EXIKOifAeWCjC4csxC5TukZ5lKNfKb7UdV5aCpZkqw=; h=Cc:Date:From:Reply-To:Subject:To; b=akJt88sxNfz918NdZnLrgul7s8+TObPN1gb4898hKnTmmSL11TpoD0TmRk4NktS6+lc ZYIyCKrp6Bq9I14GhU9Wep4Va6qb6qWxV/R51kZoO+1jmb1fuuueL08fbE9dxx08YxkvQ LIr9fjVmgzGzslhWQSYNdha4bEMSkJ9pY6A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1656315810320100007 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3957 The reserved IDT table size in SecCore is too small for X64. Changed the ty= pe of IdtTable in SEC_IDT_TABLE from UINT64 to IA32_IDT_GATE_DESCRIPTOR to have sufficient size reserved in IdtTable for X64. dff Cc: Chasel Chiu Cc: Nate DeSimone Cc: Ray Ni Cc: Ashraf Ali S Cc: Debkumar De Cc: Harry Han Cc: Catharine West Signed-off-by: Ted Kuo --- UefiCpuPkg/SecCore/SecMain.c | 1 + UefiCpuPkg/SecCore/SecMain.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index a7526be9dd..d7140c2db3 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -202,6 +202,7 @@ SecStartup ( =20 IdtTableInStack.PeiService =3D 0; for (Index =3D 0; Index < SEC_IDT_ENTRY_COUNT; Index++) { + ZeroMem ((VOID *)&IdtTableInStack.IdtTable[Index], sizeof (IA32_IDT_GA= TE_DESCRIPTOR)); CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&mIdtEntryT= emplate, sizeof (UINT64)); } =20 diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h index 189fcf9326..1be57c2248 100644 --- a/UefiCpuPkg/SecCore/SecMain.h +++ b/UefiCpuPkg/SecCore/SecMain.h @@ -43,8 +43,8 @@ typedef struct _SEC_IDT_TABLE { // Note: For IA32, only the 4 bytes immediately preceding IDT is used to= store // EFI_PEI_SERVICES** // - UINT64 PeiService; - UINT64 IdtTable[SEC_IDT_ENTRY_COUNT]; + UINT64 PeiService; + IA32_IDT_GATE_DESCRIPTOR IdtTable[SEC_IDT_ENTRY_COUNT]; } SEC_IDT_TABLE; =20 /** --=20 2.26.2.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 (#90785): https://edk2.groups.io/g/devel/message/90785 Mute This Topic: https://groups.io/mt/92015981/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- From nobody Mon Apr 29 12:32:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90786+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90786+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 165631580913988.42123988532626; Mon, 27 Jun 2022 00:43:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id B2KTYY1788612xVsTL0Q9WpP; Mon, 27 Jun 2022 00:43:28 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web08.39644.1656315805164350899 for ; Mon, 27 Jun 2022 00:43:28 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10390"; a="264430847" X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="264430847" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 00:43:28 -0700 X-IronPort-AV: E=Sophos;i="5.92,225,1650956400"; d="scan'208";a="540022964" X-Received: from tedkuo1-win10.gar.corp.intel.com ([10.5.215.13]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 00:43:26 -0700 From: "Kuo, Ted" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Star Zeng , Ashraf Ali S Subject: [edk2-devel][PATCH v1 2/2] IntelFsp2Pkg: Update SEC_IDT_TABLE struct Date: Mon, 27 Jun 2022 15:42:59 +0800 Message-Id: <3bdef4bafc5c2436d33133e625f0d9cee357eda5.1656313431.git.ted.kuo@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,ted.kuo@intel.com X-Gm-Message-State: E8giv6ReQjdZDeg3gZKMduDqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1656315808; bh=9zrcL5EENQutNQPmRRARVyx9nol5m9wishZ7XpIRtwg=; h=Cc:Date:From:Reply-To:Subject:To; b=Wa5S4fcZVs4VQ7bzyAGCYtDl/9wTBdq02qh/Y18G6v9liMyShx/bWg+QJuT431iexVF 1re31+BffMYvYFoGq6a5FsqpbjNwGfH0GSwUyac5DsyJvS9+kTPsettH83dowtwV3w0iO Vv1XWpbl5MkSdxyNah5WtxTMyzzmccqtJ40= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1656315810354100008 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3957 The reserved IDT table size in SecCore is too small for X64. Changed the ty= pe of IdtTable in SEC_IDT_TABLE from UINT64 to IA32_IDT_GATE_DESCRIPTOR to have sufficient size reserved in IdtTable for X64. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ashraf Ali S Signed-off-by: Ted Kuo --- IntelFsp2Pkg/FspSecCore/SecMain.c | 19 ++++++++++--------- IntelFsp2Pkg/FspSecCore/SecMain.h | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c b/IntelFsp2Pkg/FspSecCore/Se= cMain.c index 8effe2225c..6a23275afa 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.c +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c @@ -58,13 +58,13 @@ SecStartup ( IN UINT32 ApiIdx ) { - EFI_SEC_PEI_HAND_OFF SecCoreData; - IA32_DESCRIPTOR IdtDescriptor; - SEC_IDT_TABLE IdtTableInStack; - UINT32 Index; - FSP_GLOBAL_DATA PeiFspData; - UINT64 ExceptionHandler; - UINTN IdtSize; + EFI_SEC_PEI_HAND_OFF SecCoreData; + IA32_DESCRIPTOR IdtDescriptor; + SEC_IDT_TABLE IdtTableInStack; + UINT32 Index; + FSP_GLOBAL_DATA PeiFspData; + IA32_IDT_GATE_DESCRIPTOR ExceptionHandler; + UINTN IdtSize; =20 // // Process all libraries constructor function linked to SecCore. @@ -117,9 +117,10 @@ SecStartup ( IdtTableInStack.PeiService =3D 0; AsmReadIdtr (&IdtDescriptor); if (IdtDescriptor.Base =3D=3D 0) { - ExceptionHandler =3D FspGetExceptionHandler (mIdtEntryTemplate); + ZeroMem ((VOID *)&ExceptionHandler, sizeof (IA32_IDT_GATE_DESCRIPTOR)); + *((UINT64 *) &ExceptionHandler) =3D FspGetExceptionHandler (mIdtEntryT= emplate); for (Index =3D 0; Index < FixedPcdGet8 (PcdFspMaxInterruptSupported); = Index++) { - CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&Exceptio= nHandler, sizeof (UINT64)); + CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&Exceptio= nHandler, sizeof (IA32_IDT_GATE_DESCRIPTOR)); } =20 IdtSize =3D sizeof (IdtTableInStack.IdtTable); diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.h b/IntelFsp2Pkg/FspSecCore/Se= cMain.h index 7c2642ad48..1fe7c15aeb 100644 --- a/IntelFsp2Pkg/FspSecCore/SecMain.h +++ b/IntelFsp2Pkg/FspSecCore/SecMain.h @@ -38,8 +38,8 @@ typedef struct _SEC_IDT_TABLE { // Note: For IA32, only the 4 bytes immediately preceding IDT is used to= store // EFI_PEI_SERVICES** // - UINT64 PeiService; - UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)]; + UINT64 PeiService; + IA32_IDT_GATE_DESCRIPTOR IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSuppo= rted)]; } SEC_IDT_TABLE; =20 /** --=20 2.26.2.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 (#90786): https://edk2.groups.io/g/devel/message/90786 Mute This Topic: https://groups.io/mt/92015982/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-