From nobody Thu Dec 26 10:47:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114089+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114089+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1705679183063225.5383141308032; Fri, 19 Jan 2024 07:46:23 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=6z4beuS8m5SNeTqF00iYFpNKbGs2TKAWWRWKlO4mpAc=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705679182; v=1; b=EpDmnzMLReZ02F3QEMHWt9NyXqgKWeEP2uN8IwJ+GdX1NwvOFr82WgaAhYPo9K5PLd1jJEIS c7rsy1BKBUSv2LbgcxCtO9D9whXZNalk9zxsj8t9B6BqmbD6jxTAZtaW8hJOgtw2yYPxdF3qGos LiWyNorfuSyXM8vurwVHban8= X-Received: by 127.0.0.2 with SMTP id LHQbYY1788612xzn6e6YCQMu; Fri, 19 Jan 2024 07:46:22 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.106]) by mx.groups.io with SMTP id smtpd.web10.25619.1705679180683156874 for ; Fri, 19 Jan 2024 07:46:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5jqeqh2VEMgwvm4kT16MkuGR+3mytt4kxkOwmQgw6DJDSmfpVEpLWysD7IUMDeAtaEPGgM4CbZPC8r81ycHV7Ix6JR+Rboclk1MWPasGVvB2t6t9NGDoRuwhLzG3mSWdyWsxFAmOBV20bg2z/4xva3/w0O/PemlglfG3BcT2F21IPjmabI43bxy1LOcv/F6ZCKtcTTUeZRGg+Q9m2z5RoW4sLMdCKpf+wtR3411ulKIJ0MS628oA9ZcfF10RIKfjFHRcsxdL82qBmVTXvHbzhb7GJJONQoAt4DLL5AWGtSEczTAIq/BhjfU3CPldKcfI8LRSEDD79VDKtr3L57KCw== 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=Kayzn5O5MqC84Ib5bA+w0DexXB2JEG8lU6R3jv5O2zU=; b=gUVWM6orN3FRC5X49xM8tNtl2do2MDxDotv6ePpp15j30MSNF9QL3I5mMEUtaU3YSNdkJU37jPvu2Flaa4M6XfgpeThHOue/evP+YryUU78ELOjmpYxkcLSME1Z7XezWWCS2bV5CRyS1xIqRCAUYZssrTvNepXzVN8P4p9dXHM419KdSasXJcYsF/B0JmasqAxqPkNuDdhPGLtsJIa0PpLgHATamGV5q9om22hE9gizerK2Mml+8m8W7Sj/q9eZVJPgsztyBi22CHtTUqBwFvj4tzY6NQ2sYr3SbY15WWNeNHGkpKS8Rp362gqdb35+wFmrELsMbmp5ifqdWLTamfg== 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 LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) by MW4PR01MB6482.prod.exchangelabs.com (2603:10b6:303:65::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.26; Fri, 19 Jan 2024 15:46:18 +0000 X-Received: from LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1]) by LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1%6]) with mapi id 15.20.7202.024; Fri, 19 Jan 2024 15:46:18 +0000 From: "Rebecca Cran via groups.io" To: Leif Lindholm , Ard Biesheuvel , Sami Mujawar CC: Rebecca Cran , devel@edk2.groups.io Subject: [edk2-devel] [PATCH v4 3/3] ArmPkg: Disable watchdog interaction after exiting boot services Date: Fri, 19 Jan 2024 08:45:54 -0700 Message-ID: <20240119154554.1052736-4-rebecca@os.amperecomputing.com> In-Reply-To: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> References: <20240119154554.1052736-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR04CA0022.namprd04.prod.outlook.com (2603:10b6:610:52::32) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|MW4PR01MB6482:EE_ X-MS-Office365-Filtering-Correlation-Id: 66560cc7-6201-4c73-2271-08dc1905c6ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: b5yyadEf1wzBthpH5x0jiaM1/hRsnXaPxrrJj6j9VsNS48wA00VFgEXSPbTCvKjIxKvssympVQCznCn5Hoy5BV2VpRDGUzbLS3gv7R9BBNbcfIiC3XKmHS4UyR8D3WESXw4W6/7K/xkv2Ohy1Tz48EFHuMNwrsikMY/+aVGJbPZawSLCVnp+ZMhsuE+M5YwUW15rcKzKx3aF2o8rYBvf9ML6Wj1lEW9FP9zeVeKOXYkjTY5N7YXhV7l3buU3ZiYmAelA89yOYpMds622uTkSnEN7BvqMOILAkzPZ+0DlJoq9c++BZvKiU71sOkB9xJ3gL+1AM/BX+/2KO3vNcAXuTzm/l/ZRFoRAamsw6dM0VhW0nGNw4sPNXSAJs/TrFPww/6VvP5s5EtofHNY3GDRm9AyB3RViGQUUvOzNOO2dxyHy53+I9v/Ytsuh9knS8J9l8XzJ7SzJ52S527LFZxPNrKrOvp8lcnz573URdj5aRGIojQpKAwabvtVfqbxFysJVO2CNDo/hhP/K0PQd9LyUjMSiWIFy7+iPwFuBv9FJ54sqjiPftxyW6svmrPkaBy44igk5fFZ6lJLnH8koyXgvDYwK2in5M4O0QiA8AGMV5gymNDD0qmcXPaGfolOZw+qb X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SsyQM94OnkH0KTAkPSZOjHhmJ3iFzae9BXLdAqrpuR9r33uULRzQ3fV7FcRp?= =?us-ascii?Q?s+dXsCIUJvOcjgFcZb/ERXZlDkaAqj3H2S+Wg6/+SHzNbYbAlgWthG0zpLhi?= =?us-ascii?Q?ZRr+bijGjN6FH3HhaV+flaBJqcV0y95FU4NUNNOztjZ49a6YIfAoOdY2WIzs?= =?us-ascii?Q?xJWb6h24kVh/N1O5ohxHC1p4jOWV5JTT/a057pCFKLM2PlVDmua/QvEEpXvo?= =?us-ascii?Q?5gDZ35cTISwPfdRfpnngG8B3jdKee0/tWJ739teAA8IyoWU4suce6K42xPqL?= =?us-ascii?Q?9K6YGgv1X9z4wSOS0UlPsfjscDfvKl7dRsZzkeZf/EDrLpihaBJ5o+fBCjYp?= =?us-ascii?Q?hdFR2dMmIzjGX4zD+tEsBwet68eyRsRFGVEQV/6hN94aC5TPKMBL7ay3A1Mm?= =?us-ascii?Q?WDel81AzV97dJYUVXfYZnlqS+rH3798VCFKTOOHEJpybwOqpkX/UuxaQk89Q?= =?us-ascii?Q?8RtNddkGl0IC6kT5dUc8gzMgfZ8YQD0uRsmQ8UAokcr5DnI60BE2ju01zmlb?= =?us-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QqP4TMeCk3UMZ5xBuwmW5v1rKzShv8o?= =?us-ascii?Q?kDdvXV86/FqdErhEh2lroyTQNi7mULvAGAIKl/XrcmkfNttepZjAkLxsP1oz?= =?us-ascii?Q?POJubjFnPYat0HU4Kj5+dTswbnljzsh0WiRlQnBgDlsuB5/G21Ak2iImmTWF?= =?us-ascii?Q?Dz0Oq3dxaw+H+1cA96rkv4W/75w6gW711eULGj9eZE/R0AZ+lG81PMxZ85+5?= =?us-ascii?Q?1jgk8n+xDSg4ZTwL5vOIYTI=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66560cc7-6201-4c73-2271-08dc1905c6ee X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 15:46:18.3763 (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: CiNeFotOjN5RZfobyVODI6mkKkqp6HU7jITyxexuwSq77mTHNAzQsEhfF2S0JunxYgmqRfaE9qiGd2AAQIKd5RRIun/nk6sG2gOQ0Z9Ogl5Zh3EFZjFLtUD9oFmrrSad X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR01MB6482 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,rebecca@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: T0N3Zjlkf7bE7DoriZbrgKfNx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1705679184993100015 Content-Type: text/plain; charset="utf-8" Update GenericWatchdogDxe to disable watchdog interaction after exiting boot services. Also, move the mEfiExitBootServicesEvent event to the top of the file with the other static variables. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar --- ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 17 ++++++++++++++= --- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPk= g/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c index 8dd247c44e8f..189194a2b9ee 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c @@ -35,10 +35,14 @@ STATIC UINT64 mTimerPeriod =3D 0; =20 STATIC UINT8 WatchdogRevision; =20 +/* disables watchdog interaction after Exit Boot Services */ +STATIC BOOLEAN mExitedBootServices =3D FALSE; + #define MAX_UINT48 0xFFFFFFFFFFFFULL =20 STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol; STATIC EFI_WATCHDOG_TIMER_NOTIFY mWatchdogNotify; +STATIC EFI_EVENT mEfiExitBootServicesEvent; =20 STATIC VOID @@ -93,6 +97,7 @@ WatchdogExitBootServicesEvent ( { WatchdogDisable (); mTimerPeriod =3D 0; + mExitedBootServices =3D TRUE; } =20 /* This function is called when the watchdog's first signal (WS0) goes hig= h. @@ -203,7 +208,15 @@ WatchdogSetTimerPeriod ( UINT64 TimerFrequencyHz; UINT64 NumTimerTicks; =20 - // if TimerPeriod is 0, this is a request to stop the watchdog. + // If we've exited Boot Services but TimerPeriod isn't zero, this + // indicates that the caller is doing something wrong. + if (mExitedBootServices && (TimerPeriod !=3D 0)) { + mTimerPeriod =3D 0; + WatchdogDisable (); + return EFI_DEVICE_ERROR; + } + + // If TimerPeriod is 0 this is a request to stop the watchdog. if (TimerPeriod =3D=3D 0) { mTimerPeriod =3D 0; WatchdogDisable (); @@ -307,8 +320,6 @@ STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer= =3D { WatchdogGetTimerPeriod }; =20 -STATIC EFI_EVENT mEfiExitBootServicesEvent; - EFI_STATUS EFIAPI GenericWatchdogEntry ( --=20 2.34.1 -=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 (#114089): https://edk2.groups.io/g/devel/message/114089 Mute This Topic: https://groups.io/mt/103832320/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-