From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=40.107.72.76; helo=nam05-co1-obe.outbound.protection.outlook.com; envelope-from=brijesh.singh@amd.com; receiver=edk2-devel@lists.01.org Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720076.outbound.protection.outlook.com [40.107.72.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CE73C209884D9 for ; Tue, 3 Jul 2018 19:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rSA5A5DPbqYY4HN84PTDzPK1CxP9WePHL3FBD9MN1pQ=; b=nJJWgj3yAvDEJa916XeUucLG/N8hvnxDsNH239AB3GOTQBmUTH/9vdURyDBkoW4Zn6GXij41roCE1tUWhve7ywUu/hvdHvC5QfcKFsGCZzjBo+IvnYX/XW+RVsUSfAVfg098HowiCCili7F0d1qKA0F9A1i+d3NCrFQH1WbX4pE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SN1PR12MB2463.namprd12.prod.outlook.com (2603:10b6:802:29::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Wed, 4 Jul 2018 02:02:27 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Tom Lendacky , Brijesh Singh , Dong Eric , Justen Jordan L , Zeng Star , Laszlo Ersek Date: Tue, 3 Jul 2018 21:02:16 -0500 Message-Id: <1530669736-6941-1-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR21CA0050.namprd21.prod.outlook.com (2603:10b6:3:129::12) To SN1PR12MB2463.namprd12.prod.outlook.com (2603:10b6:802:29::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06504c7e-09e2-4466-fa6e-08d5e15231ce X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB2463; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2463; 3:W1nE8AM8OKZWwvYyI3yftU0lM4dnFR584xeiEFm7YTFLWprUPPGRiqupg8aBxM2GXZrptXd7ATS0mXFyFXnH2Zq6KkQ08b1TdDWDf9jEYzF1Z7ktgBjxP2Moqh2i1DJa7zVXZXvfjXIcxNmOWt0e5pHtkyHLibwvlvuYojzdGFACmC6KFagEAItw+NrIWXGYNchgBIyIEIgLFyRvrHDbMC17Ga2tKoqiPMJcwA+f4flzCXMiQcUfu/x6tdMREfmZ; 25:mBhvHcTHR3NmC9Eh2XuZn97dsOvWudM27vQfCrc7GXqwVG/WEx4A1SK1z4ziI/p4V/03UiHYDNuK4BsFzLVfwWs9QA3PgGrXUymvXRgKe9p8C1NSxC1U9DOh5hQ92QxRmnM7Q4EwmPqYh3d2yB7KhLpJYExi9ShzR7NVs7SoSMlC40cnxxb1BOOiUCIj898ejOe62+cm540JasrhJCMfnEXcOB8U9W7g1uZdSbKGX/HzakSjumnWNihonRZ1T70pd7FB6poHjePeFf77ZEqdO5jpSrubuM/oF46FlCKJE5KH+V+l26FMqBG9uz5c5gfAX7p/2L3Z8iIFRd98lqOoIw==; 31:Qic9bT4Nabd1Gu1UhVos2BDoV/AurUnfM/qRSm1evR6edOnK+DIV9oKfeNsIf0pmSdzUkieG1KN796GrtBz0C2P4RalrCGj6o2j2pQAwm8byTucd7Ryil3keiHfwH7pXjp++1VKBBQGECBhWu5ck2N11MjFS1wS0aMhdpMIlPi3Ak8af9Nkvg+rojIwjxGaG9N1NqKPuo4cGjirNGqwN4AbsfGM/E9laH3Hu2dDjumo= X-MS-TrafficTypeDiagnostic: SN1PR12MB2463: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2463; 20:xzDsZ3a/Kyw4FzWhJUNh+nk2vjJHX6WE/gzlKVRVrJT38NtMNWGqAQjrievuXILjd8W4X92VJGiz9UQT13ALbd36/deZcIDW1bcs4ycuAG/ayq7YKps8atRqCOt2QLS68mvUcND3ShWso6xsNvTmDvCk/afZLDIH4enVDg65ySYnDx4ZInwYGDQ/s0eKYcaRTlPm4x6x8cKcLuI68qh/bcQZUiHgPF4VA0HZ8hNSQf/1XVv/WBAPO9fR+D1fgvIlljCL7vybKf5rDdV7nZgUnz6lVMrBBuSVpXe80BB6wfJA2AFDHX6JUv04ohe9Gez1d97rA6S+5DocS/8Z4oCewpsnEtNrmG8sYBrNvZ0NmipxAxsNj/S6dyZJFoGC1f13UDDVq/aXlZh667tNz8c4hkSDloE2oNUVHorSsIgTJ6sl7g+pHz88pdMXdCb11bidWrWgpKSNR/+Mp4RZK/gCIQVhuxxqU758H22cilTHOkGNcU+LCUOj7O2wBxMBFSha; 4:p6C0pnTt22ko2BoPpQtjdW+pwZjoaBRgMh2fCCpY13gaY57o3Zm+9TJqylknfQf1BqPjip1OjKvQmx375qirLdFKDc8vQAJE8s5OLd0YGVpIBNxi4Lg8ETvwWc3e3hrqX6k2pQOefF2Ud/LrQntIRxz0kJsoiD8R3LBdls2RLxo8P4ODBJz7uI3l5GXCIWZBWj7sSGthU32kHTln3qLSTIgM0091EdatDNtoUMJllyLEE9zz3UPDtF0f8QtPr94k+f2pPTE35iWtD5MWy26WZSgGSUC0euM7zT1zoSZHKR0X4RlpwEPcCAC0MqGH7JzTANedMAwU2JdfT9HoOBSsSA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:SN1PR12MB2463; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2463; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(376002)(366004)(396003)(39860400002)(346002)(189003)(199004)(105586002)(36756003)(2361001)(106356001)(86362001)(6116002)(53416004)(476003)(3846002)(2616005)(2906002)(956004)(486006)(54906003)(316002)(16586007)(44832011)(186003)(8936002)(26005)(16526019)(386003)(6486002)(8676002)(25786009)(81156014)(478600001)(81166006)(53936002)(4326008)(7736002)(305945005)(48376002)(6916009)(47776003)(52116002)(50226002)(66066001)(97736004)(2351001)(7696005)(68736007)(5660300001)(6666003)(50466002)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2463; H:sbrijesh-desktop.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB2463; 23:hjEh6v+gLrqSC5fwW3Gbx9BCxNbz0oIY1WO3nx69q?= =?us-ascii?Q?WasKAUHqGb1BKG0ChwMRTBthQQSZcCrkdPVsxsuexX3PJw+yZbBqBj5iAGt4?= =?us-ascii?Q?ueQb70V3ouSHx4SfcE9nRMoz3OZ6zsJRHoNc9T0fsqkm11uHt7I16/V3e+GG?= =?us-ascii?Q?5clwhkyK/E1K/xR1PSSXUS4+KjpIT1Ltz5+iOMp+Z4Wq38E/SCxxewKnB7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lojsYaec/JiBTDJ0ybwOZUBZSfPBNeHBTB0aidfUHyUm714eHwqg5Y1gGzfmGGvX2qk4NcWINPBytCL29/KxuwmYR1ndHS19xCsSMH3/5yjI0sVLekAv2y++NM4fm8G4noRnPUzhiFXJHaH278=; 24:EOhBQaTcOAl43mM4m4gry+I6klxdleOXsE9JM/bcIxRTpQAPeKjskQIT/7lDp2pCQadqFtTdUIeH9dzWMBD710bEPx/+w24vLDN8ZORLC38= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2463; 7:IqXiEr3KssVum4mvLevVEUvxqkufzXlleLZrgQKAg0XKXB2qG2S9l4+s4+p6kGwp9Ts50hewWAkPRsONyhP0HZDCJj5r6L9PD6IxlmytlDieqk0xK6reSJxSSrovS049aqBt+nUmad+AzFO9LIeCup6aXBDAll3lKHNd0kpmeRSbF5kl7HCAS0BQiQEMsPzpKHZsroorAt3cJk/PNvOH/zifvmraeF/30pLm0HEwPBaPv0ritA8fLuCKU7tTlPt3; 20:2B5f/qOLVlN7SFyjBwerpwkz5jLOst4v7bEbHY46dOSO6tVX/rpa+HRs8+nEMuFRKZrZBX+UubG8VzHrzpBSxjqseqVQ/Wb/0GX3aAX7G5oXQWCZR8awMKutsdwqeEm64Ux16CVSR0oKWr1ub+thQklD3cPdnJOxvVfykPpTspAfNpamq2ZPoX+7GmQIJWPDQL0aPaDlYJnelzobSiPCBB+WXLDGFsqcdNyVdTgEo1V2ITOKET6afadIgR1EPLH/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 02:02:27.6855 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 06504c7e-09e2-4466-fa6e-08d5e15231ce X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2463 Subject: [PATCH v2 1/1] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 02:02:31 -0000 Content-Type: text/plain Set the EFI_MEMORY_RUNTIME attribute in FtwNotificationEvent() only if the attribute is not already present. This will ensure that the attributes set by the platform drivers (e.g Ovmf pflash) is not lost. Cc: Dong Eric Cc: Justen Jordan L Cc: Zeng Star Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Star Zeng Signed-off-by: Brijesh Singh --- Change since v1: - fix coding style MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c index 6b04f4f7b394..23186176be75 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c @@ -412,13 +412,15 @@ FtwNotificationEvent ( if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "Variable driver failed to get flash memory attribute.\n")); } else { - Status = gDS->SetMemorySpaceAttributes ( - BaseAddress, - Length, - GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n")); + if ((GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME) == 0) { + Status = gDS->SetMemorySpaceAttributes ( + BaseAddress, + Length, + GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n")); + } } } -- 2.7.4