From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=40.107.68.58; helo=nam04-bn3-obe.outbound.protection.outlook.com; envelope-from=brijesh.singh@amd.com; receiver=edk2-devel@lists.01.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680058.outbound.protection.outlook.com [40.107.68.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5AE3B210ED791 for ; Mon, 2 Jul 2018 20:24:14 -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=9H5HwFZ9ayeF+jZpArnTiuIWidJze8bA5KPFcwpQIYY=; b=dIQZB2mT2ha9+qSvJveFI3wKC2tVUERy9zamPcW61XksKW4QMd5WgtRWOGaEqyIz9qI9qfRvzS+b1Q+oxA+q3IbkQok+7suyTBi7HZCQjhKPe8VWU3vucsKL03+NFiOIWGrl62Pue898hwtTKTVsb5vHlSsIsS3VFPeujvFokQg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from Brijeshs-MacBook-Pro.local (165.204.77.1) by DM5PR12MB2453.namprd12.prod.outlook.com (2603:10b6:4:b4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Tue, 3 Jul 2018 03:24:12 +0000 Cc: brijesh.singh@amd.com, Tom Lendacky , "Dong, Eric" , "Justen, Jordan L" , Laszlo Ersek , "Bi, Dandan" To: "Zeng, Star" , "edk2-devel@lists.01.org" References: <1530587467-19571-1-git-send-email-brijesh.singh@amd.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BB60D45@shsmsx102.ccr.corp.intel.com> From: Brijesh Singh Message-ID: <81ff2248-3212-7e6c-3fa1-db83d51b156d@amd.com> Date: Mon, 2 Jul 2018 22:24:08 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BB60D45@shsmsx102.ccr.corp.intel.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0201CA0063.namprd02.prod.outlook.com (2603:10b6:803:20::25) To DM5PR12MB2453.namprd12.prod.outlook.com (2603:10b6:4:b4::34) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19033c98-9963-4f3b-c833-08d5e09472fa 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:DM5PR12MB2453; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB2453; 3:nPRInV9++ev7qK/App1a6OgLO5c/T0rXXHfKuAecyYxBjSBQCf+eKQTSlp2ys8U4Jv+51+6Sj5TYTFG1sR5Lh9AWvGw5Y+Zsx1drkYVLk4zPxjuM/Ni71C6CzoquRyp3RiWu84i2sCW/B0d6Oqt6NEZmW2Pc5308HsFESv7moeW0xrFGAMKHKzirKgDRcCRk1fqrnz4ZLp5rtiWramp52ePmoaUh2Lx73X9Okd7EWglj9bnJvAS1DvfZXDULZX+4; 25:UcalK+wdWyaQSO4u7nZVg6aAL7rGohPUOeO1/HHqIrZx8+0uZTlx1SfiJeO7XoSWnnYsmODdlzKTsOiLL9joULGQHvDNfR8d+FHj0LDRbvEmVacP1ayH8o4H1UalLGgW+5HDktfCtm/8yr234lKpZTy+oyNTAQYE0PiGinuvZD7pLRZsS9dqB78PfaKzFsdQgDIKqJhQQuC+jfkVTrQsR7qChRwjGVjr0m/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XmTXOxly4b31xr2GsZCQ+g8ISAB617POjDdbwOfDDxo2eT2I6tGIawk508EU76ucRqOMQ6AFWkSPoliu7qT0zYk3Dz1YkqV3aEJWVU0v4DyeSWptMdoXTeGDemMNPfYDwMPBl9stEIa7ALGXT1ZJzbOAwNwSQQqtDIe0R09Z9onE+0SSWP+mzBsOvFkjtS6FsmeQMlIQD1kPm3gEcTn8MaIGSn1HMkuGvrbJvAJ7I81sqZqctRBkVLD6C2k+q X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(162533806227266)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DM5PR12MB2453; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB2453; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(396003)(366004)(346002)(13464003)(189003)(199004)(3846002)(65806001)(47776003)(65956001)(6116002)(229853002)(66066001)(6486002)(68736007)(97736004)(2906002)(478600001)(53936002)(64126003)(4326008)(36756003)(966005)(6246003)(6512007)(14444005)(2501003)(6306002)(230700001)(5660300001)(50466002)(6666003)(25786009)(65826007)(105586002)(305945005)(31686004)(7736002)(186003)(31696002)(16526019)(26005)(106356001)(44832011)(81156014)(81166006)(8676002)(8936002)(76176011)(316002)(58126008)(110136005)(54906003)(52116002)(86362001)(23676004)(386003)(52146003)(2486003)(2616005)(446003)(11346002)(6506007)(956004)(486006)(53546011)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB2453; H:Brijeshs-MacBook-Pro.local; 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: =?utf-8?B?MTtETTVQUjEyTUIyNDUzOzIzOmMwVjFtaGxoc09UM2MxdEJyNFp5eCtua0tF?= =?utf-8?B?N0JyNUQ1blJMdWQ4RUErY0FLaUdyTWlBSFRvSjlpVTUwWW81VnpKMWZ0NDEr?= =?utf-8?B?K3VRYkdNZjZKRGQ1YTNpU2dFeGZYSnFuLzU3S3VpV1djTkc3SWw3aEZYRURV?= =?utf-8?B?THlOcWFFQUNrTStEVGJ4d1F1NmdGRWlaN09JZFdHRTZ4eGpBeVdMck0yN1hO?= =?utf-8?B?SmVpNDRvVGRGRGlBMUpSd05mRzF1by9jeXprUmV3cGNmVkVKdG9nbXZEYXlL?= =?utf-8?B?Y0NkdGhhMUN4VEYvNTl4bnhuU294eG1wTmdWMGxINzU3aGdHTW1JNDlVQjNj?= =?utf-8?B?UFFVRHVnNEpCdmdNUzNYMndUbXhFMlpSeVliQzMvbnFFb2FQY20rLzloMm1z?= =?utf-8?B?MUZNRzFQNFBkOGhqLzJ6bHpBcms1bnBqcVczUVdzSkVrSXdYZEhNTFVuMXR1?= =?utf-8?B?V3MyUi9iUUZKbnMyb1VTK3ZPY3hFTVhTUFVIUlM2Y2kxZ1Y3NVlFMko4dWFF?= =?utf-8?B?MDgyYW1NTXYrOFlPMlhpZVZHeHNyaVllQUN5MW93alR6UUk5aTlQajZiY3FP?= =?utf-8?B?UmpyYTJRMTVTeU05QVlZS1NIdWFMNFVRM2M0Y1ZJTzE0c0t5aUdwKy9CVjhh?= =?utf-8?B?VUZxcFgrYVArSTM2dS95b2ZXdjlXS21UbHIwc2piK1hCdHc1c0RiWG8vN1Rp?= =?utf-8?B?b0dMYi9zNkVUb0YxU1grYUpYYVFhVFRlbjNlZG0yZXJhdGsvZGRVNzF4UkJo?= =?utf-8?B?N0FyclRtTXJ4YkpaWEp5SW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Zm2yh4TfGK6GdSLg9e0fDnOg0Gg8FNLyycHBa36acXVxbMMMewb0mD75/78OGikr8QL8MVA/6O4jKRHX/WJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 03:24:12.3307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19033c98-9963-4f3b-c833-08d5e09472fa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2453 Subject: Re: [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:24:16 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US On 7/2/18 10:21 PM, Zeng, Star wrote: > Please use > if ((GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME) == 0) { > instead of > if (!(GcdDescriptor.Attributes & EFI_MEMORY_RUNTIME)) { > > There is coding style and ECC tool check about it. See https://edk2-docs.gitbooks.io/edk-ii-c-coding-standards-specification/content/5_source_files/57_c_programming.html#table-10-predicate-expression-examples. thanks for quick feedback, I will update the patch with coding style fix in next rev. > > With the change above, Reviewed-by: Star Zeng > > > Thanks, > Star > -----Original Message----- > From: Brijesh Singh [mailto:brijesh.singh@amd.com] > Sent: Tuesday, July 3, 2018 11:11 AM > To: edk2-devel@lists.01.org > Cc: Tom Lendacky ; Brijesh Singh ; Dong, Eric ; Justen, Jordan L ; Zeng, Star ; Laszlo Ersek > Subject: [PATCH 1/2] MdeModulePkg/Variable: Check EFI_MEMORY_RUNTIME attribute before setting it > > 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 >