From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.76]) by mx.groups.io with SMTP id smtpd.web10.463.1609968216894440102 for ; Wed, 06 Jan 2021 13:23:37 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=khGWeqAG; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.94.76, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6LXg88EviSUwoB/dtWJfInUcnQwwGULdtkjUfIrB6u2TUpoMDiBlLqa1UCfmke396o5jNxLaGWeaAa8y+KZa1PFsSSe3C8ORVgliKc74SUrhn+HKOM3w/WXvdiEAMVp7m8m9SZf8BdUYPB+cwmCdVD+KP8ryhZXAZlnbcyf3eIe3cLN8vIO0dKFi4aX2VoSN3dCDAL8gDWNA3wzcAA0xACVR4w18aLJ544Aug21GAg+7Re9hhpDlxn6qxlt7YgHyjmXtp16oSfJbbXtLhu4C07HGHD8uFrzkdBH5tJ8cfqo6xEMJQh4h51mw/Y+OfYPdAaKC5kfHLlyYDIyVCKxrg== 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=D3jFqtVqC8sQxaMIgLJ6Kv4Q2EyY8jCxAdWex4olu1c=; b=jyTY1tTmrdbx3DcA3QylkN6WaCmoMeKfyQvINOyWEgAo0QUVpsfpd4OCBcj3UdePIpP8Fa3v14r22JjWCGFY7HDII7pr+IG0otnJ+wrz9UNU0wDmJ8HWcfZ69A7KuijqXhSrhVp7IfNZ4BFIZF2lKickQHX+Gw08Dc1wnUSjf3y9p8PLMZBGLVP08RlLfNsI1+9fEHZRm34/ATXyjGXWFqxksh2RUzrCuDOz02PCQ4ihFqaPAkLW1aQwuR9ZX2+Wa7S5MqvcR/AvtEZgFsCBrJk54giMWip5od8l/aRejKVB1nZsjBr4iw6aw0ACtYz8zbOITL20/ZdrO61G+T6PzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D3jFqtVqC8sQxaMIgLJ6Kv4Q2EyY8jCxAdWex4olu1c=; b=khGWeqAG59heHjzTs7dxU9n9JDGKyeAEFfGZU/kDLfHu+tNMOGAGdyAfhHrlvMfyufrV45BvLYVUKlvhw4RILhiRwZ+g6HI4u2v6wNoQ2Bn9w/T3XPpLUp+TIipkUUftQlOQEC/hqAMYWwM3ZPh55yH//rrW/S0W6ypCN9wztLo= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR12MB1259.namprd12.prod.outlook.com (2603:10b6:3:75::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Wed, 6 Jan 2021 21:23:35 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::d95e:b9d:1d6a:e845]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::d95e:b9d:1d6a:e845%12]) with mapi id 15.20.3721.024; Wed, 6 Jan 2021 21:23:35 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , James Bottomley , Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [PATCH v2 10/15] OvmfPkg/MemEncryptSevLib: Coding style fixes in prep for SEC library Date: Wed, 6 Jan 2021 15:21:36 -0600 Message-ID: <47e8a4edf59761c1052631487276d4ac04bea561.1609968101.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN6PR05CA0003.namprd05.prod.outlook.com (2603:10b6:805:de::16) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SN6PR05CA0003.namprd05.prod.outlook.com (2603:10b6:805:de::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.2 via Frontend Transport; Wed, 6 Jan 2021 21:23:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f0591923-2b44-4802-a3ae-08d8b28953b3 X-MS-TrafficTypeDiagnostic: DM5PR12MB1259: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: egmJmiwzJYFrZ5CcczMU81PQhpbZ18E6JDfL4yoCQCwp6r9AkEAOdwMZDxnwMUrhchTwiBDG9NqF8fVWVOdJYTJqSRfnqzw/UGvrr52pfArRU+BT32kpRlziUqB1X7ey+068vcRsl1no/hmFp0BRwyef/e+RiKse1SBlCHbTqbmrC8E41ANXHz6wmP5ZXoqVWRQUinO1n0eO9HK2CiMRe1nwa4Yo/f8lPH01VrKT4k89oDUpV9Sft1hsAruQ64NvytVNp5B3u3R5wtQAD6SDZTZ2KG49YkpbA0aqkoGAqQSRIWuNttX+NOkHGP01lLejsjqmnMi8ov02/VrivagPiBGcL5XLh96KTquD8kc/VESZUuIGE9CYXipQXKyl5aKlwFNZilPfqI1OjbI8MtXiGUDFTNrqTouyFPRMid8cKVWE3DMiJF7tPoEf67ZQ70GHWsI63EjROOzcggcd723lZw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(366004)(346002)(39860400002)(396003)(316002)(83380400001)(5660300002)(2906002)(52116002)(7696005)(36756003)(8676002)(8936002)(478600001)(54906003)(966005)(66946007)(86362001)(2616005)(186003)(16526019)(4326008)(66476007)(26005)(6486002)(956004)(6916009)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?84nIE9o8CiS6X1cUk+UgckQHbem9qlb3dRxcsjTz7X1m+ukP4TxhC8I9HSIT?= =?us-ascii?Q?WE+00wq5asYTnHA5rZ+5yDFzEpvCE55Se8xNq5xK4s6Y9FkxA2+UvptoOuPz?= =?us-ascii?Q?v/Sx67gr+OuDeHRct+ngqYBFp9Vt/BtX74gRMkd06nqJgWdE/DlQ+qss/1he?= =?us-ascii?Q?ox0t2MKsKQWx4VUz/bGaHpEgCm3cbbf8ml33u3u1moV0/JHxu+nVwXKnv3th?= =?us-ascii?Q?fd4conbNmyxMwj6jWKxNIwcw+AX+LPwkpEEnlFbvGFlATt/wkdCfWmc4TDXA?= =?us-ascii?Q?9dKkQlDB8SbCyB7s/ZJyKHiB4YpHpzGkmuTvec09OQecxkZuhCZBO0Tpv6lP?= =?us-ascii?Q?Rf2bnpRl9OqlYuLaQ16/8fma4hvyzmXAGWKfIfqxFI6n3FYLzecfEZcKHCt5?= =?us-ascii?Q?4N0EAj1AJikJxAyWN6foJ1YKznEq4t9igrZxbZH+JCt5sA2BuKdDAbXCUeXo?= =?us-ascii?Q?kmxHCTwKy3X4eQiJ3OEBit33vyDpYb470z6/V04n42IArAcjq3Ynp2GyRvAm?= =?us-ascii?Q?MZUtNAVI5GynDgJnIXF6MWn1wwHH8IDKt4UoVBcC6psvH7n4+thgCvnYa45e?= =?us-ascii?Q?vWPSTZsJIAB2V1uFpznTTJoCcoKYatJr3knOYOG9o/BtS0e+WWHHRsd2zqhy?= =?us-ascii?Q?PKRq/RzzQGsuqfz+63DYcJkm8BnbbrDYT/PHBRTjUFQGxvNflyf8pib8bGbS?= =?us-ascii?Q?v2zz4suC001msDD746ZDv37HuXJQdyr3WBjk8Xh3SfwnJoAD+UfFWDcfqh1L?= =?us-ascii?Q?+4kjUROJQ4WSv0Y11IT1tWk7CXDJ72ewL7OHDF4+Nr0cNsOxU6jb9QpPrcG6?= =?us-ascii?Q?MN6Bg0ss19jdubVR9q0XZYL8DwCOnRUP5a7XrUC2Ax/0blkAgVgoObNpv3xe?= =?us-ascii?Q?PYS1vX5boeamiFjFMuQ5ZUgA7mCNmDIO+FArQlRdCO3puDW5+fyrhBVUQzGn?= =?us-ascii?Q?Et/482ZcjPqsu5/CTJrCunBDTUyfi92Z8ogcQhMBhf/nnhH0i6q2rZC6Fb2e?= =?us-ascii?Q?OXoP?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2021 21:23:35.6720 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: f0591923-2b44-4802-a3ae-08d8b28953b3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NbAOsOBzb6xMpHBhTLvJ0jrepKcvEt1b5HHpNDGF2gt8FShzNkSEPeVhnkdZiaK8I7EziZvNGq6zNebspZrT1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1259 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3108 Creating an SEC version of the library requires renaming an existing file which will result in the existing code failing ECC. Prior to renaming the existing file, fix the coding style to avoid the ECC failure. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Cc: Brijesh Singh Signed-off-by: Tom Lendacky --- OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c b/Ovm= fPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c index 6422bc53bd5d..3a5bab657bd7 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c @@ -192,7 +192,8 @@ Split2MPageTo4K ( { PHYSICAL_ADDRESS PhysicalAddress4K; UINTN IndexOfPageTableEntries; - PAGE_TABLE_4K_ENTRY *PageTableEntry, *PageTableEntry1; + PAGE_TABLE_4K_ENTRY *PageTableEntry; + PAGE_TABLE_4K_ENTRY *PageTableEntry1; UINT64 AddressEncMask; =20 PageTableEntry =3D AllocatePageTableMemory(1); @@ -472,7 +473,7 @@ Split1GPageTo2M ( /** Set or Clear the memory encryption bit =20 - @param[in] PagetablePoint Page table entry pointer (PTE). + @param[in, out] PageTablePointer Page table entry pointer (PTE). @param[in] Mode Set or Clear encryption bit =20 **/ @@ -562,7 +563,6 @@ EnableReadOnlyPageWriteProtect ( @retval RETURN_UNSUPPORTED Setting the memory encyrption attrib= ute is not supported **/ - STATIC RETURN_STATUS EFIAPI @@ -635,7 +635,7 @@ SetMemoryEncDec ( =20 Status =3D EFI_SUCCESS; =20 - while (Length) + while (Length !=3D 0) { // // If Cr3BaseAddress is not specified then read the current CR3 @@ -683,7 +683,7 @@ SetMemoryEncDec ( // Valid 1GB page // If we have at least 1GB to go, we can just update this entry // - if (!(PhysicalAddress & (BIT30 - 1)) && Length >=3D BIT30) { + if ((PhysicalAddress & (BIT30 - 1)) =3D=3D 0 && Length >=3D BIT30) { SetOrClearCBit(&PageDirectory1GEntry->Uint64, Mode); DEBUG (( DEBUG_VERBOSE, @@ -744,7 +744,7 @@ SetMemoryEncDec ( // Valid 2MB page // If we have at least 2MB left to go, we can just update this ent= ry // - if (!(PhysicalAddress & (BIT21-1)) && Length >=3D BIT21) { + if ((PhysicalAddress & (BIT21-1)) =3D=3D 0 && Length >=3D BIT21) { SetOrClearCBit (&PageDirectory2MEntry->Uint64, Mode); PhysicalAddress +=3D BIT21; Length -=3D BIT21; --=20 2.30.0