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 BA653AC145C for ; Wed, 22 Nov 2023 16:51:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=iQ2iLsgRY2Nw337vEqUQtMBkRjgPyI7TSyJYLWQoHHA=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700671901; v=1; b=rasjNrdMdmj/c2yfyTwWD0rnSkkzJs7xTYrwIP6L0R/DUCgXTFhboFdmNG0oJsKC8ExruDzv Z2wQ+dFB+FxNzyjD2oKyA+N7nQE3WR5ZxrU/P/216b4JuyJXlxWZON/6NjpWX/GJ65VKKailfWW OnIK2rb/QIC8tmB9m2v83XLA= X-Received: by 127.0.0.2 with SMTP id SLYGYY7687511xCxtP8ZOMY6; Wed, 22 Nov 2023 08:51:41 -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.24768.1700671900591948231 for ; Wed, 22 Nov 2023 08:51:40 -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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-zIq7MdVrPiq6fZiXZYcT_A-1; Wed, 22 Nov 2023 11:51:33 -0500 X-MC-Unique: zIq7MdVrPiq6fZiXZYcT_A-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 0F52D101A481; Wed, 22 Nov 2023 16:51:33 +0000 (UTC) X-Received: from [10.39.193.187] (unknown [10.39.193.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7D2B1121306; Wed, 22 Nov 2023 16:51:31 +0000 (UTC) Message-ID: <2a3ae2a2-3274-4a80-8d35-cacebb55eeeb@redhat.com> Date: Wed, 22 Nov 2023 17:51:30 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v6 1/6] MdePkg: Add macro definitions for CET feature for NASM files. To: devel@edk2.groups.io, ray.ni@intel.com, "Sheng, W" Cc: "Dong, Eric" , "Wu, Jiaxin" , "Tan, Dun" References: <20231121070246.505-1-w.sheng@intel.com> <20231121070246.505-2-w.sheng@intel.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 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 Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: P9DCkOiymr9Ih3d2iYSPZsKox7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=rasjNrdM; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 11/21/23 08:53, Ni, Ray wrote: > You might need to drop Reviewed-by from Laszlo as the patch content is so= different than the reviewed version. >=20 > Reviewed-by: Ray Ni >=20 >=20 >=20 > Thanks, > Ray >> -----Original Message----- >> From: Sheng, W >> Sent: Tuesday, November 21, 2023 3:03 PM >> To: devel@edk2.groups.io >> Cc: Dong, Eric ; Ni, Ray ; Laszlo >> Ersek ; Wu, Jiaxin ; Tan, Dun >> >> Subject: [PATCH v6 1/6] MdePkg: Add macro definitions for CET feature fo= r >> NASM files. >> >> Signed-off-by: Sheng Wei >> Cc: Eric Dong >> Cc: Ray Ni >> Cc: Laszlo Ersek >> Cc: Wu Jiaxin >> Cc: Tan Dun >> Reviewed-by: Laszlo Ersek >> --- >> MdePkg/Include/Ia32/Cet.inc | 26 ++++++++++++++++++++++++++ >> MdePkg/Include/X64/Cet.inc | 26 ++++++++++++++++++++++++++ >> 2 files changed, 52 insertions(+) >> create mode 100644 MdePkg/Include/Ia32/Cet.inc >> create mode 100644 MdePkg/Include/X64/Cet.inc Referring back to Ray's v5 comments here -- because v6 was posted before I could have reacted to v5 --, I have the following opinion: I agree with all observations except the code duplication under Ia32 and X64. Ray himself noted that the duplication would be questionable. How about this: unify the macro definitions in a single file, but call that file: MdePkg/Include/X86Cet.inc This eliminates the code duplication and also clearly shows that the include is only for IA32 and X64 -- for *both* of them, actually. I have to reasons for thinking that the "X86" prefix should work fine: - the X86 prefix is already used in the filenames MdePkg/Library/BaseCacheMaintenanceLib/X86* MdePkg/Library/BaseCpuLib/X86* MdePkg/Library/BaseLib/X86* MdePkg/Library/SecPeiDxeTimerLibCpu/X86* - in BaseLib.h, we have identifiers such as X86_ASSEMBLY_PATCH_LABEL and PatchInstructionX86(). All of these apply to both Ia32 and X64. If there will be no *other* changes in *v7* 1/6 than this file unification, then you can add, at once, to v7 1/6: Reviewed-by: Laszlo Ersek (Of course the %include references will have to be updated in the other patches, but that doesn't invalidate my R-b's on those patches.) Thanks! Laszlo >> >> diff --git a/MdePkg/Include/Ia32/Cet.inc b/MdePkg/Include/Ia32/Cet.inc >> new file mode 100644 >> index 0000000000..41c99988c9 >> --- /dev/null >> +++ b/MdePkg/Include/Ia32/Cet.inc >> @@ -0,0 +1,26 @@ >> +;----------------------------------------------------------------------= -------- >> >> +; >> >> +; Copyright (c) 2023, Intel Corporation. All rights reserved.
>> >> +; SPDX-License-Identifier: BSD-2-Clause-Patent >> >> +; >> >> +; Abstract: >> >> +; >> >> +; This file provides macro definitions for CET feature for NASM files= . >> >> +; >> >> +;----------------------------------------------------------------------= -------- >> >> + >> >> +%define MSR_IA32_U_CET 0x6A0 >> >> +%define MSR_IA32_S_CET 0x6A2 >> >> +%define MSR_IA32_CET_SH_STK_EN (1<<0) >> >> +%define MSR_IA32_CET_WR_SHSTK_EN (1<<1) >> >> +%define MSR_IA32_CET_ENDBR_EN (1<<2) >> >> +%define MSR_IA32_CET_LEG_IW_EN (1<<3) >> >> +%define MSR_IA32_CET_NO_TRACK_EN (1<<4) >> >> +%define MSR_IA32_CET_SUPPRESS_DIS (1<<5) >> >> +%define MSR_IA32_CET_SUPPRESS (1<<10) >> >> +%define MSR_IA32_CET_TRACKER (1<<11) >> >> +%define MSR_IA32_PL0_SSP 0x6A4 >> >> +%define MSR_IA32_INTERRUPT_SSP_TABLE_ADDR 0x6A8 >> >> + >> >> +%define CR4_CET_BIT 23 >> >> +%define CR4_CET (1<> >> diff --git a/MdePkg/Include/X64/Cet.inc b/MdePkg/Include/X64/Cet.inc >> new file mode 100644 >> index 0000000000..41c99988c9 >> --- /dev/null >> +++ b/MdePkg/Include/X64/Cet.inc >> @@ -0,0 +1,26 @@ >> +;----------------------------------------------------------------------= -------- >> >> +; >> >> +; Copyright (c) 2023, Intel Corporation. All rights reserved.
>> >> +; SPDX-License-Identifier: BSD-2-Clause-Patent >> >> +; >> >> +; Abstract: >> >> +; >> >> +; This file provides macro definitions for CET feature for NASM files= . >> >> +; >> >> +;----------------------------------------------------------------------= -------- >> >> + >> >> +%define MSR_IA32_U_CET 0x6A0 >> >> +%define MSR_IA32_S_CET 0x6A2 >> >> +%define MSR_IA32_CET_SH_STK_EN (1<<0) >> >> +%define MSR_IA32_CET_WR_SHSTK_EN (1<<1) >> >> +%define MSR_IA32_CET_ENDBR_EN (1<<2) >> >> +%define MSR_IA32_CET_LEG_IW_EN (1<<3) >> >> +%define MSR_IA32_CET_NO_TRACK_EN (1<<4) >> >> +%define MSR_IA32_CET_SUPPRESS_DIS (1<<5) >> >> +%define MSR_IA32_CET_SUPPRESS (1<<10) >> >> +%define MSR_IA32_CET_TRACKER (1<<11) >> >> +%define MSR_IA32_PL0_SSP 0x6A4 >> >> +%define MSR_IA32_INTERRUPT_SSP_TABLE_ADDR 0x6A8 >> >> + >> >> +%define CR4_CET_BIT 23 >> >> +%define CR4_CET (1<> >> -- >> 2.26.2.windows.1 >=20 >=20 >=20 >=20 >=20 >=20 -=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 (#111616): https://edk2.groups.io/g/devel/message/111616 Mute This Topic: https://groups.io/mt/102724272/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-