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 C5A5AAC12B0 for ; Mon, 29 Jan 2024 18:25:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+VZIBvNZ2RqpEIYqIlNWirNHBiieOOPhLSYa9qCgU2I=; 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=1706552741; v=1; b=eUXU+a7w4WHaKmaeKGWv6ERz0+COnL6eZ0fLsWfT7X+f8JJ7In3T2AA7Jnx6Ez9pCmoHmM97 TJInlTgzcoqrAteG/UIoR9DMtWHrfrQHXyryetAJKWOT94TAuC5XsONcDU36PD10759Vm3IOAlV 9WB+QTZK6zuG/k7CXszHi+bM= X-Received: by 127.0.0.2 with SMTP id 1DZPYY7687511xuU42xmEYwd; Mon, 29 Jan 2024 10:25:41 -0800 X-Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.100]) by mx.groups.io with SMTP id smtpd.web11.2501.1706552740109349493 for ; Mon, 29 Jan 2024 10:25:40 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSO+I1+k5Xp23kDbIGHslcHe8PokIXDIo1fzL3NANlpXIcTIf4rN124QKG9rj5i2NmQZ9SX5oeql0bAxUZWzy0YNbLms5rdkoRIA7LtBHY76MoivtDp1xNaSzp3xV/Ng1G740CuLJCNRj1FlrRQvwNrDJXJkf7sfzTgoj6FOg3r85XMnOZtgny4b+RHrRUqKkH0YEMa/lWO00OoBUuTc+qjHgpKSBFI66i4cGPb9696SdbmZ2fV1j8+w1yk0fhuchQhuyn0Gxpj0nD9q6jh1WhTxu0B3QytprIIDvutCo/+Lu/mOpuITNb86MOvNbvjiR5J7kZ6BPi17cKD5lk4ZmA== 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=6jUrhRbwEdM1hv7TkHXNpRO/zVAj46G2SjC48Pa+30Q=; b=RrVFOMgCdlFyHVOu5bMoRr2X6xVOVnrQHM1kkwq3SZDcMQpC9TTOxkOhAgNOjJylSEK6b4Xgh1wzwy77VkVIGV5+ucr+ATLQCLGLaRC0wB+K5PdFLjfyhGMCXJIWjLV+hX7myiWgshRSoUHhxTpI1xI034CYvRh6EGOEzqWoKO1ZZVADnF6LuvTvoHdxrPC2+8pZtzqQgFMzbt47Wkos0IVXxuttHKxLggb2UhmdF851Bcu+hNAbdBPX7JUlIK499+zjZBI+F63/0tADKbdtgqTPRVjoI1jS8Kyub3LNVFQGSDubAju5GI5BX3kbdquwNGVF/3TK6scLjRgiKqXoeQ== 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 PH7PR01MB8495.prod.exchangelabs.com (2603:10b6:510:2ef::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.32; Mon, 29 Jan 2024 18:25:37 +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.7228.029; Mon, 29 Jan 2024 18:25:37 +0000 From: "Rebecca Cran via groups.io" To: Leif Lindholm , Ard Biesheuvel , Sami Mujawar , devel@edk2.groups.io CC: Rebecca Cran Subject: [edk2-devel] [PATCH v5 3/3] ArmPkg: Disable watchdog interaction after exiting boot services Date: Mon, 29 Jan 2024 11:25:13 -0700 Message-ID: <20240129182514.1375466-4-rebecca@os.amperecomputing.com> In-Reply-To: <20240129182514.1375466-1-rebecca@os.amperecomputing.com> References: <20240129182514.1375466-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR10CA0002.namprd10.prod.outlook.com (2603:10b6:610:4c::12) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|PH7PR01MB8495:EE_ X-MS-Office365-Filtering-Correlation-Id: b8c13c1a-f200-4f4e-704f-08dc20f7b078 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: W8ny2cp4poam67oR6qgC3ujjUAPPZ0lrs9dwwZyTfxUNdXkBt6s3/u7ZX+AUxeLKxQjUR4PodrT0ZZA3UF06ZTU4P/NuB124mzDbvmw4PyysxdIAz5iD0m62ZrwAIURAkWJMuGbmNIBIG6daiSIqKO/XwT8klVoPcWpO8HFwtYR+OLtHbNzv8k12Lo6BbWOxZ4UnpP94IlyfY0uppeoI+SaItiuAGykc0BznMhRMx1slb436vjtWPMWpwLGNmqBjuoBMJ5neoC5V/+NRK6hTdw6hdm04BjyD6qpZp/M+3g2NEMs1mm8KSU5PtdGGmnd9HDIGEmEJmH9dZepj2Sq+zlzK/ebYst2TqBXE19jl4WxxquEurl8sxlapyWxDRvv+yzRBbg1P8pnhr3jnL0m6JQDKrVD4KYvukwrBuGYJp2ht3Q/PM0ugeFbZB45iewPMfVUVRjXRtLC1ylb5yMkZ8u/F+JKBI9qRXVQoJVspKiYy37EcRD3SEdGz9uqIn/IXL8NJcg8Q+17sr0uT9nxBcZWjuSShYeiY4g4nrCbxPCO6thNWh71h3wgxiOaMMYeSXP+7xg7b/q+5T4im6Wtq3ZsCBc+4NCGZw1yPdbLxYw7+Q4+S7HfJuBwHGgHGSvue X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?a2eb03AZjADMzeLKhXQph0ZCf2WubZEa6WH6Mprcym+qoLAsjSngyW4cJnDr?= =?us-ascii?Q?kwPPXUkqBRNqxwSvP5ee3u4huNPjLs/YuJqvF9/oRfJwwr7V4nhOYr/sqyBS?= =?us-ascii?Q?UcClX7pS/3N101Pln0wVorpgsbB3vJ2iHe3UZCzrfbgxbkz9a46CSOjlADxe?= =?us-ascii?Q?MBgOPbc1fwWQAWGC0CKpTsuMopwae376362syydYUSzeyTctcjR15Uc9QnyK?= =?us-ascii?Q?d3aUzTJvBb5YpRfBX0EoeGDcgmcYNIDa9Scu+4MXoStUtROvrqAbN/ZE/O+I?= =?us-ascii?Q?6h8O1E/q8LsrPnAa8Pfz0KgjssImtr9og1NiFretdxs3JpG0dSwQYeb+6uYJ?= =?us-ascii?Q?EkeNe3HvgqMebAvJqnzE9kFbtEKB+wf9qKRmxongmlHhOi8ryrLpfKWqXtD+?= =?us-ascii?Q?BclqHQ3Kcko8PHDL+LHO9qW4HAdX0usfAufFKKFhG9g8RDbXExgXrJZ45rRm?= =?us-ascii?Q?xUKCRb4VvwLAo9ylIo0qJ7+KfycVVPd9h/lwb20D0DGgWTzvsTyTxjhJz9Oq?= =?us-ascii?Q?44mQrZrm7MXPPqncrAs7U/nMtyHQ+bSw5yhio7XszhbenblzfdyaQwOOC3G+?= =?us-ascii?Q?cpdqI39mLyjeBmenr+e3zL7sqsCo9+cp1fKxa9G5rbDWYh4e8mBbYMuPDId5?= =?us-ascii?Q?xSvWqeeyGmwA4Vpqutw7BgK/LRlqlZo/krrcwyOgag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OUKe2frHXzwCqM+/Z4rtfefME4gZJQdlF+98Lq9RsTFlgq5aHcow9EQcAyc?= =?us-ascii?Q?LMZkeFxq53AKdfIE0Ixr+gc=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8c13c1a-f200-4f4e-704f-08dc20f7b078 X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2024 18:25:37.0683 (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: Ff3fGGUUIom8GPW/dOyTPsbkXyKivsNIVyDyehZh3B23BJeZXQU6t4ShTdZ4IqyZBkVQ+2ooB/8czW9wCYUi/Wj1qPHu1G0yO/404gbjQny+d0KHltHJ5XD1wxhqZ0fU X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR01MB8495 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: GhWbqZG8IlXIm6z2QKpHrp89x7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=eUXU+a7w; 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 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 | 18 ++++++++++++++= ---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPk= g/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c index d4f9fe6f4ece..51ff9bdf8cd3 100644 --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c @@ -40,6 +40,7 @@ STATIC BOOLEAN mExitedBootServices =3D FALSE; =20 STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol; STATIC EFI_WATCHDOG_TIMER_NOTIFY mWatchdogNotify; +STATIC EFI_EVENT mEfiExitBootServicesEvent; =20 /** This function returns the maximum watchdog offset register value. @@ -122,7 +123,8 @@ WatchdogExitBootServicesEvent ( ) { WatchdogDisable (); - mTimerPeriod =3D 0; + mTimerPeriod =3D 0; + mExitedBootServices =3D TRUE; } =20 /* This function is called when the watchdog's first signal (WS0) goes hig= h. @@ -219,6 +221,8 @@ WatchdogRegisterHandler ( =20 @retval EFI_SUCCESS The watchdog timer has been programmed to = fire in TimerPeriod 100ns units. + @retval EFI_DEVICE_ERROR Boot Services has been exited but TimerPer= iod + is not zero. =20 **/ STATIC @@ -233,7 +237,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 (); @@ -337,8 +349,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 (#114727): https://edk2.groups.io/g/devel/message/114727 Mute This Topic: https://groups.io/mt/104037317/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-