From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=40.107.71.68; helo=nam05-by2-obe.outbound.protection.outlook.com; envelope-from=brijesh.singh@amd.com; receiver=edk2-devel@lists.01.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710068.outbound.protection.outlook.com [40.107.71.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A12E8210EE4D0 for ; Mon, 2 Jul 2018 20:11:25 -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=xeLO03dMLI/Q9Mm3MpNDq0m4O6y79p5ABt0+eplkw5s=; b=SICnIeX1yOa3YMhcYUDVC5z1eeJkPkjUr4ymZDXal8oB5XiJa9VkhaL9A9AzRAqFV34LMF1a9CHYEqWZFu5sGOcu0hf9MTs0pOi+b2UY1mCVHdrwFcuw3idmPMcsoDXafOw00veDdVzdwhPB9dlc/c7ENmZZLwlcX4FfBpCWUTk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from sbrijesh-desktop.amd.com (165.204.77.1) by MW2PR12MB2457.namprd12.prod.outlook.com (2603:10b6:907:8::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.26; Tue, 3 Jul 2018 03:11:20 +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: Mon, 2 Jul 2018 22:11:06 -0500 Message-Id: <1530587467-19571-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: SN4PR0501CA0024.namprd05.prod.outlook.com (2603:10b6:803:40::37) To MW2PR12MB2457.namprd12.prod.outlook.com (2603:10b6:907:8::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d8333588-a99c-44fe-eb5d-08d5e092a6ae X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(48565401081)(5600053)(711020)(2017052603328)(7153060)(7193020); SRVR:MW2PR12MB2457; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2457; 3:HpmoMDDwwYq0qYyMz7+7+gOzrTdxjSrdzsS7uoX4kGMrA/tmTBqyzfdtoYyt1J597s5zAU/H66WChl9aETq536pe6qHfO8jf4w1hYHVZ7OptDKFhcSGW6fZski6Q3I0W0tyDu2xvoXfGG5ceLM6vF6HuqbGez668qEhHfYGe7Hay/CtT+dx7n673T+LdLbb/zEujHnMoVX/Nbj4iPA/M1RNH6yp7hpemKHwhLlZfu2aMeEFWbH+WB1y1k+OPi1Un; 25:19CdKmYRR/stxLarc/+8r+dbo+m0FQwnyQrCpQuhEjJRqxJ+9r1Zn3YJh7RXixiwvsdy/imzrakFapJGyQcM0Cz2fT80x9JMpLWauWTMQrNw4S6xn9fq1UrUV52VTSyFzCxAZEyQ8lvpCS1O5CA2dGpTX8+B9Jjm6JmxhGlXk8GpcNws7ss/u+AjFdskdIiqH4H06h/w10nmUng6HS+v3vtYGPet2AjHOeVIUrdpZDMzsWQrENWVjwOKT3IyOPlYfEzN55ZumeoqKRxEAnH3UcvFeHJUeavuGbtgO6TtEv8+gH0eFvNAbw8qELQcwzTYDKrzM7IOo6JxQeaNN9UDkw==; 31:AEBmFvHuBq5KhBphYGKU0DEw0iO04zpdaicK3IGq7jVndVOX5EiNbWfVPqRigWjhuANDwIBjI77pZMSXi0r95/Q8JgAwz1Vc6vnLqNaQg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oft-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)(10201501046)(3231254)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2457; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2457; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(396003)(346002)(136003)(189003)(199004)(50466002)(2906002)(81156014)(386003)(97736004)(305945005)(53416004)(2351001)(7696005)(4326008)(7736002)(51416003)(52116002)(53936002)(48376002)(478600001)(8936002)(81166006)(8676002)(5660300001)(476003)(2616005)(106356001)(44832011)(2361001)(956004)(486006)(6116002)(3846002)(54906003)(86362001)(25786009)(66066001)(316002)(26005)(16586007)(50226002)(105586002)(36756003)(6486002)(47776003)(16526019)(186003)(6916009)(68736007)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2457; 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; MW2PR12MB2457; 23:N93aVGnRdIJGcdM/UrBWhmeCIxGfD5J7WVL5Tp9zd?= =?us-ascii?Q?xdSUROUhXdtPOzJdDtuw4GGQqYw04Jzv6yeFPqyIiB6H2ummh04VkBcuxnUT?= =?us-ascii?Q?JqsEFvYdAzXODA6XtGFWt9k47UlImEp/tFvbfwetTXyhPYQmaxd8ycdb6EKI?= =?us-ascii?Q?qD/EwG7VRXqfHQgU1ksnnds0L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ascii?Q?s1EJiRr9hsd/wAsSqjbt/hiYHhKO/S9L+XIBWf6UpMlqaww7ZKGI8yy8WIsn?= =?us-ascii?Q?nXFTMseZO35VHzzxyHEqMQKzfGnn8u5UAwL0qX41YDYNewFCf2qliXjWxqV5?= =?us-ascii?Q?z7b4LSSRIEaB80=3D?= X-Microsoft-Antispam-Message-Info: ykpGHtd+S5mHYZ6ACEkLxTYMiS2VA8NzdowhAKHZ7n9+Vf/EYEkGoqBYqi97++vgzwXfj2hEBS7Rk4VBE9Xy+reXZSceMPpZqhEZPyXrYjBk65pGOYnBxzfdwlrWGizRFtJxISJzxhEw31IbyvpGZSdWn5zNxQ41DevurGY2z3grvVy8pPFa/cZS4t5i8oCL3PVY8Gxr/wphAs2gTQz+HS0hcgVF19mu0t5lLoxx/i9i56CtLgAdfJXhyqFLd7+k3vo+D8UI2z2jT6qc30XflHTQAld3zwPbNNSekBPAikKTLxkaytB2i8f/JgfVJ0NUwlUTVPwgpEO56lRt0DxHNJKH83W4eeUj6QF4X5fikXI= X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2457; 6:ufR1qMzm5krbZq51ZvHJzqo4JumYrk3OUmrL6fROnRzTkJtFMmsLluvdH3vy+Nu+6otmKV93rNIM+O8UIIYJPP2ZMh6aW1ki17h+dEd85Lm9uKCS10GZ158bo1EH/ak71AJ3+KI5m7OGr1kyAXnK6VGwpL1SmzET6qeB67fxHZyehdCYj6S9lslgCmALPCnaNciKJs+91iLoy487/9yLWzeEHA0t9dY0ejiAmrtzQyOieHxHK8MjPVEZXtDRUQ9QZWkBqZzeWGorKvLhLRDD6Prq4eSJ6orJF5o41KkcfKDAyzffXXHUuqfv7pU4JkUnBFXvk8x5qSAMq0uySiyESOQyy+AX3p/P7svI7IU704ntOsE2BWl75FZMUuZItZye91IueEyq/NHDswQzQAFanRxVNB8eFOaEbqhSs8UuhSCVff651soiuAozYKtwnkzQ8MsS+u0wUoZMmhlyeuWdEA==; 5:kVIzC753y4S3ojMY5kCRsn93sOiXXFNtHepOPH8oLuA8/gKN6eVXFXDMkAzadSSAuounA2IXAjcHJA2ciFqyp19zb5gTikTBXVDZLzMFDe9u328kPKzaeH9KZvlXfAC/keRdPPHKvvvi6qVNYfhEnVN0XcjM+K4s38SAAaeqWX8=; 24:FvAxoJw1u16Z/erXHCVhAbHZPFF1PEUQcMI4ekYcuCyZw41JBfcSsAThGEkGTGGJFO7ze3xDdbQoP5nzq2HmbEh95lErqfoCBjP6xxGJpDw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2457; 7:6S4EyzNj9XgUPjo1KkMBJ5AwMaF2VGr1JtWoFGLTPcPjJQs05qRI1duAfPDqbENWPrqxSKxBalrIe47CF8+ZiXMxI7SMNG50NMai2F38tK/L40LB+iTIn2l9jXdIwGQFRXz61RmsFX0ou4ki18brOcVRFNbnLfywYhbie9A2brq4mJtrnSoXDoDV+HKYVFT/Qt3sFSYX/ISrjMRKlGb4Q3++DA4v6TMe4Sh4Fqdujr5BIhuh7B8S/6r8XwcOSXEH; 20:r/oBgYh47x2EPFacq0AkeHEcgBPVC9FBfFW54se79dhMANy5TXqSoj/QK3isVbs590Ig+KdDCGvcP6VVFcAsd7CNUz3DV3ZMF10KKd3/JLA+H++/EWU6CuAhHG0WtJvt4PKTg4MxqJWSm334thflOa73n71xfzT2UdHUBSCJM9oTANuVL92xkZ/0IoCfDTUlHmfZi8mnTcXXMoBj2oe+Jvea5PhbHwTLEknTQDTga1DBlmpDAwZG+WsITyFoagnm X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 03:11:20.2715 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8333588-a99c-44fe-eb5d-08d5e092a6ae X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2457 Subject: [PATCH 1/2] 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: Tue, 03 Jul 2018 03:11:25 -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 Signed-off-by: Brijesh Singh --- 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..f5ab6641ef28 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)) { + 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