From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.9860.1594685816936121668 for ; Mon, 13 Jul 2020 17:16:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=mXnwfoVz; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: eric.dong@intel.com) IronPort-SDR: rgS4BGpemoVqXMBl6ECd0sKVfEd4mhl7j+OtW6DjHnPu4us/KEZDB35PMLsJGDJ6rPHjy8U225 YtjcFiogWj7Q== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="150194120" X-IronPort-AV: E=Sophos;i="5.75,349,1589266800"; d="scan'208";a="150194120" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2020 17:16:55 -0700 IronPort-SDR: rShUbGY+FhYsJnDmatb0b6eCCGJo//ZVmeeidUULADXEzWkHXlRU+Sk2Pt3pTsVpmDa5QyURfh stTeRF1VPqQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,349,1589266800"; d="scan'208";a="299360631" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by orsmga002.jf.intel.com with ESMTP; 13 Jul 2020 17:16:55 -0700 Received: from orsmsx163.amr.corp.intel.com (10.22.240.88) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jul 2020 17:16:55 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by ORSMSX163.amr.corp.intel.com (10.22.240.88) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jul 2020 17:16:55 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.177) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 13 Jul 2020 17:16:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E4ff9VKf7k4pO5blXmF8qcIlPu9oXT2EU97F7HYP5RYH2/d/3WkURz7niIUP5YSu0q/qmQBUskdeRIjztFXvtdAWwzNOMRwivs+CFiKnNX/TGXZVpJ6Ko3Ki5EY4hzWnLHjsUWCpyikBnhNBbpynYGzvs1i89mYXHsuF8Jp6DbLw1UVc/AI9xxZTt6HjM8HwyyRge0l8D0i9G1QxUignffvxO7pYKaH4sowAhEVkgHH+jCIUaNIqwOEjLp78U5Ll15tRnUno+yEZDdY1Uv5jmcPBh9TdzhP3ONPN9eXMBx4v40fEJulp09a0VUimuP9pneFoNJT8jwQAUlcqSbL0aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pLFHZ2zRe5CyqjxdX1P+t3ZbLMSgCCiBiopCTlGrFeg=; b=HaQkz8CcGG50aGWwSM1RpLdmI8HZ5kkCYeZ7CFziC4U8tbf9PwH9fJU/zHZnPAPl1C7/d+qbNkMPKUhXVA26v72FTe5YDKR8zaHIW4G8j0Tn3kOc1oJcivzKgbwPN1H72C1pUC4OV9B3yU+AJsFl15x7BP4T4WMJGW+xCMHmd0Y6idMW9N306RIRsbL6BO6zuY//zSGPAqpQAISCe8Alj0KJSpHpt1+YkguE2rjkHknINagF3leBusVH5p3tJNhGWPu1zrc3533QtbyCvF4ua6fIQSXia3lSsqjymIEoRdHAPnnuYvL2zADtkcGdtHHrcdFhnhMNvKH1cnmrR+3/5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pLFHZ2zRe5CyqjxdX1P+t3ZbLMSgCCiBiopCTlGrFeg=; b=mXnwfoVzuvubEZbITzQdAJNZV0K7aJ5QF3sVtazfez41ZEXANfhx+8dyv8ujFHhpAL3iP2CESVBcHsKHRFLOvo696TSnzCa2+IQPbUzb93l2012g82B/SXAqGRBqUBc/j55Gi7DwZygRYZghRJBUlDXOWu6+ZIJ+i7RQnSsOMbg= Received: from DM6PR11MB3274.namprd11.prod.outlook.com (2603:10b6:5:b::26) by DM6PR11MB4532.namprd11.prod.outlook.com (2603:10b6:5:2aa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.23; Tue, 14 Jul 2020 00:16:53 +0000 Received: from DM6PR11MB3274.namprd11.prod.outlook.com ([fe80::cc01:6f05:1402:e7d7]) by DM6PR11MB3274.namprd11.prod.outlook.com ([fe80::cc01:6f05:1402:e7d7%6]) with mapi id 15.20.3174.025; Tue, 14 Jul 2020 00:16:53 +0000 From: "Dong, Eric" To: "devel@edk2.groups.io" , "oleksiyy@ami.com" CC: "Gao, Liming" , "Kinney, Michael D" , "Bi, Dandan" , "Ni, Ray" , "lersek@redhat.com" , "Kumar, Rahul1" , "Felixp@ami.com" Subject: Re: [edk2-devel] [PATCH V3 4/4] UefiCpuPkg: Add New Memory Attributes Thread-Topic: [edk2-devel] [PATCH V3 4/4] UefiCpuPkg: Add New Memory Attributes Thread-Index: AQHWULK7kx5H0KmsTUCa0PaKGxxpoakGRqmQ Date: Tue, 14 Jul 2020 00:16:53 +0000 Message-ID: References: <20200702205039.52400-1-oleksiyy@ami.com> <20200702205039.52400-5-oleksiyy@ami.com> In-Reply-To: <20200702205039.52400-5-oleksiyy@ami.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 96eecccf-1278-4633-1f97-08d8278b35fd x-ms-traffictypediagnostic: DM6PR11MB4532: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1247; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WW4mYSJ5qE90okGnEuu1m2H4CGkoE4uwc67pdc9E7UDRCoGNpB4r1VWtHgRVbl8WlpgT1cLmUIJFFfkm4hL7ViUQ2MwE4BZyTTRMrjQxGMB9BoGOmRbC7Vvuwo6w9uFHAJu8mszbiQCWCzaoA8l+u5NBAytAxgsXzLf5bgVs1v9y+1W4EQ2H77ZkYEIzwDw+pnDJNMmXk5lRGD3YP8GxrmoLyZou/wjLe5tQrwwhN/Oc9AK3olMTexbnU+L5Kt26KoKY+t3VteCZjpMmHfV5ksC+9YEiDtrYRFOtXrsAmaIkT4w/Jib1KnrdfdwGCS1dZCYvMJGvfSW00mUmB4Vyi2NlYPS7SWHSNvO5vtUTrG8pOkiwTMvo5AAdUGcy4YDH+bpfHzkFGaSqXAVqPhYvXw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB3274.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(39860400002)(366004)(136003)(376002)(396003)(346002)(8676002)(4326008)(55016002)(54906003)(9686003)(316002)(110136005)(26005)(966005)(7696005)(53546011)(6506007)(83380400001)(478600001)(8936002)(186003)(71200400001)(52536014)(66946007)(66556008)(64756008)(66446008)(66476007)(33656002)(2906002)(76116006)(5660300002)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: a3DUJmhHxYPcfaOtsFMsUQ+CRKLRbZFRoBFsFc0JJjwJW4m35Xf53gbJ56BSiVv0rNeKtIeTWO9DnoZOGS/153mb+0vu9XxrBFmbOtNuegsvUdioqpsjiEV11TTwTg7qG9YY0EcE7M8Us4hVYsq7NabkjkT9xhdR6f2XqKjMFnQjA2e0t8lnweiU5n0/JRmAJ5iX6cUdIy4Fq/7i0V71cyqhuiv1lgWUDIcrd5BtbRH3hSS9C6ECERPYcG8CKQPa2Ldj382QBHIWKsJXTBgVwxEBG50JW/OdUJVsNkvK4OtWWOHgLYxM1Oo5EzLRW0x4i6ops+g8QThJWSOjWqU5i3k0HIT01euEYvAvmcPyFHDuehyh8VUIQYqUQCmeVLtupwneaFIKKwbL8XDdwyzcbzUxn8v7Qg4xco1WKfE5t5aMNhCJDZe97YjePqw/Oo1gCj75CFMQSGanRZFEGUG/fvtPidQb/RdwfLCLG45DCEz0AW7vP+g+/keHhnnt2T6O MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3274.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96eecccf-1278-4633-1f97-08d8278b35fd X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jul 2020 00:16:53.2134 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RJizmpv0Ew2HXGLjPJ9Cc959shlUTg1yxGOpBCO6nzMNMTcxkes57InF1ThskMipCvYvCWprJF3908mU0vThDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4532 Return-Path: eric.dong@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Oleksiy > Yakovlev > Sent: Friday, July 3, 2020 4:51 AM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Kinney, Michael D > ; Bi, Dandan ; Ni, Ray > ; lersek@redhat.com; Kumar, Rahul1 > ; Felixp@ami.com; oleksiyy@ami.com > Subject: [edk2-devel] [PATCH V3 4/4] UefiCpuPkg: Add New Memory > Attributes >=20 > Add usage of EFI_MEMORY_SP and EFI_MEMORY_CPU_CRYPTO attributes > introduced in UEFI 2.8. > (UEFI 2.8, mantis 1919 and 1872). > Use attributes bitmasks, defined in MdePkg. >=20 > Signed-off-by: Oleksiy Yakovlev > Reviewed-by: Laszlo Ersek > --- > UefiCpuPkg/CpuDxe/CpuDxe.c | 11 ++++------- > UefiCpuPkg/CpuDxe/CpuDxe.h | 13 ------------- > UefiCpuPkg/CpuDxe/CpuPageTable.c | 6 +++--- > UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 2 +- > 4 files changed, 8 insertions(+), 24 deletions(-) >=20 > diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c > index a571fc3..52cc26e 100644 > --- a/UefiCpuPkg/CpuDxe/CpuDxe.c > +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c > @@ -10,9 +10,6 @@ > #include "CpuMp.h" > #include "CpuPageTable.h" >=20 > -#define CACHE_ATTRIBUTE_MASK (EFI_MEMORY_UC | EFI_MEMORY_WC > | EFI_MEMORY_WT | EFI_MEMORY_WB | EFI_MEMORY_UCE | > EFI_MEMORY_WP) > -#define MEMORY_ATTRIBUTE_MASK (EFI_MEMORY_RP | > EFI_MEMORY_XP | EFI_MEMORY_RO) > - > // > // Global Variables > // > @@ -417,8 +414,8 @@ CpuSetMemoryAttributes ( > return EFI_SUCCESS; > } >=20 > - CacheAttributes =3D Attributes & CACHE_ATTRIBUTE_MASK; > - MemoryAttributes =3D Attributes & MEMORY_ATTRIBUTE_MASK; > + CacheAttributes =3D Attributes & EFI_CACHE_ATTRIBUTE_MASK; > + MemoryAttributes =3D Attributes & EFI_MEMORY_ATTRIBUTE_MASK; >=20 > if (Attributes !=3D (CacheAttributes | MemoryAttributes)) { > return EFI_INVALID_PARAMETER; > @@ -677,7 +674,7 @@ SetGcdMemorySpaceAttributes ( > gDS->SetMemorySpaceAttributes ( > RegionStart, > RegionLength, > - (MemorySpaceMap[Index].Attributes & > ~EFI_MEMORY_CACHETYPE_MASK) | > (MemorySpaceMap[Index].Capabilities & Attributes) > + (MemorySpaceMap[Index].Attributes & > + ~EFI_CACHE_ATTRIBUTE_MASK) | (MemorySpaceMap[Index].Capabilities > & > + Attributes) > ); > } >=20 > @@ -754,7 +751,7 @@ RefreshMemoryAttributesFromMtrr ( > gDS->SetMemorySpaceAttributes ( > MemorySpaceMap[Index].BaseAddress, > MemorySpaceMap[Index].Length, > - (MemorySpaceMap[Index].Attributes & > ~EFI_MEMORY_CACHETYPE_MASK) | > + (MemorySpaceMap[Index].Attributes & > + ~EFI_CACHE_ATTRIBUTE_MASK) | > (MemorySpaceMap[Index].Capabilities & DefaultAttributes) > ); > } > diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h > index b30a896..9771ec8 100644 > --- a/UefiCpuPkg/CpuDxe/CpuDxe.h > +++ b/UefiCpuPkg/CpuDxe/CpuDxe.h > @@ -39,19 +39,6 @@ > #include > #include >=20 > -#define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \ > - EFI_MEMORY_WC | \ > - EFI_MEMORY_WT | \ > - EFI_MEMORY_WB | \ > - EFI_MEMORY_UCE | \ > - EFI_MEMORY_WP \ > - ) > - > -#define EFI_MEMORY_PAGETYPE_MASK (EFI_MEMORY_RP | \ > - EFI_MEMORY_XP | \ > - EFI_MEMORY_RO \ > - ) > - > #define HEAP_GUARD_NONSTOP_MODE \ > ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT6|BIT4|BIT1|BIT0)) > > BIT6) >=20 > diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c > b/UefiCpuPkg/CpuDxe/CpuPageTable.c > index 0a02cb3..06ee1b8 100644 > --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c > +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c > @@ -717,7 +717,7 @@ ConvertMemoryPageAttributes ( > return RETURN_INVALID_PARAMETER; > } >=20 > - if ((Attributes & ~(EFI_MEMORY_RP | EFI_MEMORY_RO | > EFI_MEMORY_XP)) !=3D 0) { > + if ((Attributes & ~EFI_MEMORY_ATTRIBUTE_MASK) !=3D 0) { > DEBUG ((DEBUG_ERROR, "Attributes(0x%lx) has unsupported bit\n", > Attributes)); > return EFI_UNSUPPORTED; > } > @@ -1018,9 +1018,9 @@ RefreshGcdMemoryAttributesFromPaging ( >=20 > Length =3D MIN (PageLength, MemorySpaceLength); > if (Attributes !=3D (MemorySpaceMap[Index].Attributes & > - EFI_MEMORY_PAGETYPE_MASK)) { > + EFI_MEMORY_ATTRIBUTE_MASK)) { > NewAttributes =3D (MemorySpaceMap[Index].Attributes & > - ~EFI_MEMORY_PAGETYPE_MASK) | Attributes; > + ~EFI_MEMORY_ATTRIBUTE_MASK) | Attributes; > Status =3D gDS->SetMemorySpaceAttributes ( > BaseAddress, > Length, > diff --git > a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > index 9c5a92a..ebfc46a 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > @@ -435,7 +435,7 @@ ConvertMemoryPageAttributes ( > EFI_PHYSICAL_ADDRESS MaximumSupportMemAddress; >=20 > ASSERT (Attributes !=3D 0); > - ASSERT ((Attributes & ~(EFI_MEMORY_RP | EFI_MEMORY_RO | > EFI_MEMORY_XP)) =3D=3D 0); > + ASSERT ((Attributes & ~EFI_MEMORY_ATTRIBUTE_MASK) =3D=3D 0); >=20 > ASSERT ((BaseAddress & (SIZE_4KB - 1)) =3D=3D 0); > ASSERT ((Length & (SIZE_4KB - 1)) =3D=3D 0); > -- > 2.9.0.windows.1 >=20 >=20 > Please consider the environment before printing this email. >=20 > The information contained in this message may be confidential and > proprietary to American Megatrends (AMI). This communication is intende= d > to be read only by the individual or entity to whom it is addressed or b= y their > designee. If the reader of this message is not the intended recipient, y= ou are > on notice that any distribution of this message, in any form, is strictl= y > prohibited. Please promptly notify the sender by reply e-mail or by > telephone at 770-246-8600, and then delete or destroy all copies of the > transmission. >=20 >=20