From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 6BF26AC0F47 for ; Thu, 21 Sep 2023 07:42:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=EzyJzv5ZmpmOqkDrfxgT33DGIOURvYojmp7uaPKpkx8=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Message-ID:Date:User-Agent:Subject:To:CC:References:From:In-Reply-To:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1695282129; v=1; b=PnY0BNelJMhPzIgH8Pc6wzalW5dqmJrYu7VDM5CYfA+6Wh25GZNUO+yU9QUjfRaWdtJsnZcG J4rYSI7Eaj0POuLZuUtVGucV+odmwbON+1gP8A1Tk+zIVrRNYiVJjmemRC8Y3OCPYNRjdXlLzV+ hNBu5+3gz8R16R++usevcsGA= X-Received: by 127.0.0.2 with SMTP id JlGUYY7687511xPAyuUtgPMh; Thu, 21 Sep 2023 00:42:09 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.107]) by mx.groups.io with SMTP id smtpd.web10.10776.1695282128104658470 for ; Thu, 21 Sep 2023 00:42:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h+0BjWs8/Udg8JXOzEcK6hqR/Rz6ouGxLPbjdRQzUYfcy8JuPzCb2QxcW8G4fhq8R1wWM5A/zpvDeAeFxdl5oyOtngdhlhrGiOGTPn+ksuYTvQa72JFl33yJ9i2dBM3qbTzlrVr1Bblu6oUyBQ/WWGVTVm0NU9K9kEkL95KD2opXKW8I4LQeFLlaQ6oca1nTsGhV9lthiAJksnycLNwxsbQFn+ZohTEE/yw0/+QwkHPxg3LrVlvcrVWyKebc9SDUETOSkl3qkXCVe0SruthA6JeU8pVJhue6XkONFjXbUOcGctzkl9/q1XhlebM8r7pWjof1TMGgMuIcqgFJ9RfK5A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ipaboEQM0o3XAmyuFk8koLWMqt0qzN3DeUcH1hC3Eeg=; b=K11tJ2OzSiHVl6Pjb+kV1fVOKDsm96xu05nQq1O1W4OzVYWnzlBiWd7dGOo7JSoMbmkTH5DovV8Pwl3txYIBu2HlHhXQ3NQSN7/sf5j0owlQfb2iE5W7xdR1oxa0KNo2rVAY8SDzGtaXVKeMB2CZGRIAo9Yb5OVblam3bFE43izln/OfsYP9Tww+R07icDgWbMz5ltzhso/S2C3ngwjth+w80q7Ueri1BRzD+wdwfKHkvrRfaCB3NGU9m2Tht8kk9WNk+k8DDxiGSr7EKfvswCPXNQ2zYBfWdm938+HHcnKMvcFNwDj67z9GDKnLzLjzi4+HaXtIjns4Lj2KXgXFQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by BL3PR01MB7194.prod.exchangelabs.com (2603:10b6:208:345::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28; Thu, 21 Sep 2023 07:42:04 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::dc7b:d4c5:71cf:1ea0]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::dc7b:d4c5:71cf:1ea0%4]) with mapi id 15.20.6792.026; Thu, 21 Sep 2023 07:42:03 +0000 Message-ID: <88377069-1f77-41a6-8fc0-a92ac2204ae7@os.amperecomputing.com> Date: Thu, 21 Sep 2023 14:41:51 +0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [edk2-devel] RFC: SetVariable callbacks To: devel@edk2.groups.io, gmahadevan@nvidia.com, Hao A Wu , Liming Gao CC: Jeff Brasen , Ashish Singhal References: From: "Nhi Pham via groups.io" In-Reply-To: X-ClientProxiedBy: SGXP274CA0020.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::32) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7287:EE_|BL3PR01MB7194:EE_ X-MS-Office365-Filtering-Correlation-Id: cf1720b4-5507-482e-6332-08dbba763f38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: wW3p8RvcbpHvxr5JWcbeW4YC5Wd0leC/LjN6qGAZ3T39B3thJ4jrEfJiWiJzxiReNFrF69jwWungzU5jZL+3K+bsENKhE/WD+IPK3gZl4dCyO5Te8uXlP800rlBpBPSNKMdBbc5fSephK3xMGNyP9d+JMmg6uepgbChZPhWhAlHA3pPY9la2abQaQY2JzzClObe1eMduAHLkou401vsrp10FeulD6Iu1iydM55aQubHwTmkCyA2iSNIwOacxZiQAhgwl9BrVqgbnOwCJRi2p9w8vguXHVLhLtTyTl6cig98dGQa/gRANPB14hSUxqOxulr5u73dKWXsutHRFtMT//vTajHfPH2ggh9kF4HjNwnWcUpYr6GhKjWI/+fyLyff9OKzCiNgy4uH4FH63ndaKJG7UDkpfrd8QmkBCrd6Xd5mrkwU6YRMzhdQWTWYFx/V1tP3CE5DntaqnSRsO+P0JVCsfeZQRb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fCk1tqlSk9N+ydaRZvRSigJGhfdohKR/?= =?us-ascii?Q?1pDvJFj4JmVWMYT7CcV4J2TPzRB91M7H36lEivc78zYpz2Ojgcvmhe8YP+zY?= =?us-ascii?Q?IQ=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf1720b4-5507-482e-6332-08dbba763f38 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2023 07:42:03.5241 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KVZDfPHRF2NskG+13jUxCrIBEtW1FK/9qaaKxARh3fAOpibjp8DTaswjBnptAMwJ3G5IqUSgkOJy0QMGvAXHiJ94GMapFRe64AKFj88fE54= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR01MB7194 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: BfTZhnkWSsANH20r9XyxfFfEx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=PnY0BNel; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Can we write a DXE_RUNTIME driver to override the pointers of UEFI=20 Runtime Get/SetVariable() services? Then, we can add platform specific=20 or custom implementation before/after calling the original=20 Get/SetVariable()? Regards, Nhi On 9/21/2023 3:27 AM, Girish Mahadevan via groups.io wrote: > Hello >=20 > We have a requirement to monitor setVariable calls, we'd like to get a=20 > callback before and after the variable update. >=20 > Similar to VarCheckLib, except that VarCheckLib's set callbacks are=20 > called after endOfDxe. >=20 > We were thinking of doing something like: >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -2853,6 +2853,11 @@ VariableServiceSetVariable ( > =C2=A0=C2=A0=C2=A0=C2=A0 return Status; > =C2=A0=C2=A0 } >=20 > +=C2=A0 Status =3D VarPreSetVariableCallback (VariableName, VendorGuid,= =20 > Attributes, PayloadSize, (VOID *)((UINTN)Data + DataSize - PayloadSize),= =20 > mRequestSource);^M > +=C2=A0 if (EFI_ERROR (Status)) {^M > +=C2=A0=C2=A0=C2=A0 return Status;^M > +=C2=A0 }^M > +^M > =C2=A0=C2=A0 AcquireLockOnlyAtBootTime=20 > (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock); >=20 > =C2=A0=C2=A0 // > @@ -2917,6 +2922,8 @@ Done: > =C2=A0=C2=A0 InterlockedDecrement=20 > (&mVariableModuleGlobal->VariableGlobal.ReentrantState); > =C2=A0=C2=A0 ReleaseLockOnlyAtBootTime=20 > (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock); >=20 > +=C2=A0 Status =3D VarPostSetVariableCallback (VariableName, VendorGuid,= =20 > Attributes, PayloadSize, (VOID *)((UINTN)Data + DataSize - PayloadSize),= =20 > mRequestSource);^M > +^M >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D >=20 >=20 > We were thinking of 4 options: > 1. A new Library, platforms can include the Null implementation if they= =20 > don't need this. > 2. A new protocol that is called from the Variable driver (similar to=20 > the Fvb protocol, we let the Smm/Dxe Variable drivers get this protocol) > 3. Expand the existing VarCheckLib to include these new callbacks.=20 > (which can be called before end of dxe) > 4. Something we don't know about (please let us know) >=20 > We are leaning toward option 1. Let us know your thoughts. >=20 > Best Regards > Girish >=20 >=20 >=20 >=20 >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108936): https://edk2.groups.io/g/devel/message/108936 Mute This Topic: https://groups.io/mt/101487036/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-