From nobody Tue Apr 23 10:19:25 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+100998+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+100998+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678452537; cv=none; d=zohomail.com; s=zohoarc; b=mfznU+mDx8EIC5p/oO+wmAGJak28ZOSvpueD+ExAgw1X94lC82wdOcWGKhPC13I+ZNMbOyVV4hTIArbXMK4KtEg04uIPDyWTLKeGRdahk26Cb1DBkH/bRpNCw4TGPOQ7dfMSmhUlxDN1s9dZh11EZfQquiEu9j23P0AVO4sksKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678452537; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=npVKlvnwfHjiPnu8/n66ck3MnebS6Vn9fqDase7qfxk=; b=NFtTFoI0qe3pgiBFfIGQbIAXdBEX90R8SViRFtcQdW55uCqwMDeb3jFA4SkOJbVJmEZpeSyrH8ltfuSRG/ZHy2pRyR8zFLd57GgqSXYVT65VPsOZ3B9jb5ZwsraVCYJHyxlCfm/Hhui22ad+sszD00nDIpp5TMfqCOlslT5W9xg= ARC-Authentication-Results: i=1; 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+100998+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1678452537424497.84883147845574; Fri, 10 Mar 2023 04:48:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id IDeGYY1788612xsYZveACDqy; Fri, 10 Mar 2023 04:48:57 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.18151.1678452535604830889 for ; Fri, 10 Mar 2023 04:48:56 -0800 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-8JQmEPNXOni_LTY-aIjaCw-1; Fri, 10 Mar 2023 07:48:51 -0500 X-MC-Unique: 8JQmEPNXOni_LTY-aIjaCw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F4D880D0F9; Fri, 10 Mar 2023 12:48:51 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.56]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D89FD2166B26; Fri, 10 Mar 2023 12:48:50 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 83B3F1800986; Fri, 10 Mar 2023 13:48:49 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ray Ni , Oliver Steffen , Gerd Hoffmann , Rahul Kumar , Pawel Polawski , Eric Dong Subject: [edk2-devel] [PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: drop support for obsolete processors Date: Fri, 10 Mar 2023 13:48:48 +0100 Message-Id: <20230310124849.831839-2-kraxel@redhat.com> In-Reply-To: <20230310124849.831839-1-kraxel@redhat.com> References: <20230310124849.831839-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,kraxel@redhat.com X-Gm-Message-State: UK5wDk9E3UY4P9bGq0JShvzyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1678452537; bh=gDx4bPqUmtY+WABHELMv0o5bA94q5Rjbqj3atByo5VY=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=JFZJNxRkzPPFG2Wj2Oi84AmN4dMaXqUa0+HJn4SEoCmx7COMy9t1dN6zeyXj/LiRfum RssPVhQ+HsaNwSDRshcWylb3JWlOjxQDtdu2PhU3C65XgojvOoX5OpY16MGhs9drNHrOk h18Fa0GplG0uweCKcBzVbIdTg2oBsJAP5d0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1678452539338100003 Content-Type: text/plain; charset="utf-8"; x-default="true" It's highly unlikely the code ever runs on processors which are almost 30 years old. Drop the code handling them. Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4345 Signed-off-by: Gerd Hoffmann Reviewed-by: Ray Ni --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index d2d0950f3b42..55a9f79da8eb 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -871,24 +871,14 @@ PiCpuSmmEntry ( // DEBUG ((DEBUG_INFO, "PiCpuSmmEntry: gSmmBaseHobGuid not found!\n")); // + // very old processors (i486 + pentium) need 32k not 4k alignment, exc= lude them. + // + ASSERT (FamilyId >=3D 6); + // // Allocate buffer for all of the tiles. // - // Intel(R) 64 and IA-32 Architectures Software Developer's Manual - // Volume 3C, Section 34.11 SMBASE Relocation - // For Pentium and Intel486 processors, the SMBASE values must be - // aligned on a 32-KByte boundary or the processor will enter shutdo= wn - // state during the execution of a RSM instruction. - // - // Intel486 processors: FamilyId is 4 - // Pentium processors : FamilyId is 5 - // BufferPages =3D EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberO= fCpus - 1)); - if ((FamilyId =3D=3D 4) || (FamilyId =3D=3D 5)) { - Buffer =3D AllocateAlignedCodePages (BufferPages, SIZE_32KB); - } else { - Buffer =3D AllocateAlignedCodePages (BufferPages, SIZE_4KB); - } - + Buffer =3D AllocateAlignedCodePages (BufferPages, SIZE_4KB); ASSERT (Buffer !=3D NULL); DEBUG ((DEBUG_INFO, "New Allcoated SMRAM SaveState Buffer (0x%08x, 0x%= 08x)\n", Buffer, EFI_PAGES_TO_SIZE (BufferPages))); } --=20 2.39.2 -=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 (#100998): https://edk2.groups.io/g/devel/message/100998 Mute This Topic: https://groups.io/mt/97518446/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 Tue Apr 23 10:19:25 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+101000+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+101000+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678452540; cv=none; d=zohomail.com; s=zohoarc; b=aZi4gWUvg4JQM5Di3a1RvPeWU0K5xcXlnvRII9uzdpowOIrQBtkDIEcRSa9iZLbOLajdlKenkiw/pyJlgd2JRIu9Ak+0gJJL9UOufYUGE7LDOPrhNB/Ze1Rb9gfYRY1JgjvxJPNly0G0aQRc7WQ/BfpKcG2yQRmSr4tb7ftXZTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678452540; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Qhvgf72DXdUgMWFNa8UfqXOmgXNGFcrSVk09kwpsCdQ=; b=b7LMCcZGZ6U/O4AO7DGmwlye5d3GgxW3RH1izhcezS4eHtv+bPGOGw/O4r3jmaJh8qQ6gh7Bc1IqrfiGsywWdDhqW8H1pL9nmzzT7/4hpD5VGGqzLK4eSFV5n2lsMfqhwXH2JwhlxJIehZpX0mbHKz8+xiSpnAyAQRelSdaB5UA= ARC-Authentication-Results: i=1; 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+101000+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1678452540892190.3329994114389; Fri, 10 Mar 2023 04:49:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UQSYYY1788612xpKk1SY6jCv; Fri, 10 Mar 2023 04:49:00 -0800 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.18112.1678452537284029869 for ; Fri, 10 Mar 2023 04:49:00 -0800 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-170-2JQWdm4hMK6WNpkRdqFLAg-1; Fri, 10 Mar 2023 07:48:53 -0500 X-MC-Unique: 2JQWdm4hMK6WNpkRdqFLAg-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5F2A299E752; Fri, 10 Mar 2023 12:48:52 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.56]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75D5C492C3E; Fri, 10 Mar 2023 12:48:52 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 892EB1800990; Fri, 10 Mar 2023 13:48:49 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ray Ni , Oliver Steffen , Gerd Hoffmann , Rahul Kumar , Pawel Polawski , Eric Dong Subject: [edk2-devel] [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling Date: Fri, 10 Mar 2023 13:48:49 +0100 Message-Id: <20230310124849.831839-3-kraxel@redhat.com> In-Reply-To: <20230310124849.831839-1-kraxel@redhat.com> References: <20230310124849.831839-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,kraxel@redhat.com X-Gm-Message-State: UAfp6g5RMxK48XktmMcNS85ex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1678452540; bh=AxvokrwpR10RecQAsDCdM0FXEuFaxlDu5Kucy8p0K0Y=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=lRAtOhI1hDozW9OYD8v9+BWvNy2zMxelT7dN8/5J6WtNb6EotTr9DfEUS2xKG47UOeh h9MiglICMLcFI9nNSy94YrPJgmFZlL360Vb+QRVhsgmOE89R2lhmsQCO51qeBku9DPf2K tnlGt3S0Ve8BdhPwZedcSHoUGQ3bKt5UcXc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1678452541333100009 Content-Type: text/plain; charset="utf-8"; x-default="true" ASSERT() is not proper handling of allocation failures, it gets compiled out on RELEASE builds. Print a message and enter dead loop instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Ray Ni --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index 55a9f79da8eb..2e41df1f1074 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -879,6 +879,12 @@ PiCpuSmmEntry ( // BufferPages =3D EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberO= fCpus - 1)); Buffer =3D AllocateAlignedCodePages (BufferPages, SIZE_4KB); + if (!Buffer) { + DEBUG ((DEBUG_ERROR, "Failed to allocate %d pages.\n", BufferPages)); + CpuDeadLoop (); + return EFI_OUT_OF_RESOURCES; + } + ASSERT (Buffer !=3D NULL); DEBUG ((DEBUG_INFO, "New Allcoated SMRAM SaveState Buffer (0x%08x, 0x%= 08x)\n", Buffer, EFI_PAGES_TO_SIZE (BufferPages))); } --=20 2.39.2 -=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 (#101000): https://edk2.groups.io/g/devel/message/101000 Mute This Topic: https://groups.io/mt/97518449/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-