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 3EB66AC1C00 for ; Wed, 3 Jan 2024 22:56:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=v1HRACavtRmEaJ5h1LadL0mmIPC6DbnHm1bmp5qmIZw=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1704322617; v=1; b=OJM+Rrj8RTSjT+xo26epjw/uYHzn+2cdHCAlRoeae13coOH7ayaqYTHmUjwcCpysHxunhqJj aMF+OwQ7VEnIrkbu6f6Gamwmj712rhCBPmgAcbtu8eTBZv6P1rPe3ePEdcfGx49RafOeaC7QCSb VET6f0p8ZqiN38Ivk5p3QU04= X-Received: by 127.0.0.2 with SMTP id f1QxYY7687511xe16KvoId0n; Wed, 03 Jan 2024 14:56:57 -0800 X-Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mx.groups.io with SMTP id smtpd.web11.41568.1704322616779366568 for ; Wed, 03 Jan 2024 14:56:57 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C63AACE185D for ; Wed, 3 Jan 2024 22:56:53 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BC03C433C7 for ; Wed, 3 Jan 2024 22:56:53 +0000 (UTC) X-Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-50e7f58c5fbso8661554e87.1 for ; Wed, 03 Jan 2024 14:56:52 -0800 (PST) X-Gm-Message-State: amm7HESyMAKN4GRNNvnvWdEix7686176AA= X-Google-Smtp-Source: AGHT+IEHyznzsVs5q2GOxAZMn8pQqRelrQkDCdWJMRj9wVqeEOb2ED2m6rF8LgOV3wAHoGXPICzhMgixjSqaNdRC81U= X-Received: by 2002:a05:6512:3b8:b0:50e:84ad:d0f7 with SMTP id v24-20020a05651203b800b0050e84add0f7mr5021304lfp.129.1704322611113; Wed, 03 Jan 2024 14:56:51 -0800 (PST) MIME-Version: 1.0 References: <20240103204353.361541-1-rebecca@os.amperecomputing.com> <20240103204353.361541-3-rebecca@os.amperecomputing.com> In-Reply-To: <20240103204353.361541-3-rebecca@os.amperecomputing.com> From: "Ard Biesheuvel" Date: Wed, 3 Jan 2024 23:56:39 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH 2/3] ArmPkg: Fix the calculation of the timer period in GenericWatchdogDxe To: Rebecca Cran Cc: Leif Lindholm , Ard Biesheuvel , Sami Mujawar , devel@edk2.groups.io 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=OJM+Rrj8; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=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 Hi Rebecca, On Wed, 3 Jan 2024 at 21:44, Rebecca Cran wrote: > > Fix the calculation of the timer period in GenericWatchdogDxe: we need > to multiply before dividing to keep the values as integers. > > Signed-off-by: Rebecca Cran > --- > ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c > index 05df101d5f4b..8f02f38c64e3 100644 > --- a/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c > +++ b/ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.c > @@ -119,7 +119,7 @@ WatchdogInterruptHandler ( > // the timer period plus 1. > // > if (mWatchdogNotify != NULL) { > - TimerPeriod = ((TIME_UNITS_PER_SECOND / mTimerFrequencyHz) * mNumTimerTicks); > + TimerPeriod = ((TIME_UNITS_PER_SECOND * mNumTimerTicks) / mTimerFrequencyHz); Could we just store the timer period in a global mTimerPeriod, and get rid of mNumTimerTicks entirely? AFAICT, that would get rid of these calculations as well. > mWatchdogNotify (TimerPeriod + 1); > } > > @@ -260,7 +260,7 @@ WatchdogGetTimerPeriod ( > return EFI_INVALID_PARAMETER; > } > > - *TimerPeriod = ((TIME_UNITS_PER_SECOND / mTimerFrequencyHz) * mNumTimerTicks); > + *TimerPeriod = ((TIME_UNITS_PER_SECOND * mNumTimerTicks) / mTimerFrequencyHz); > > return EFI_SUCCESS; > } > -- > 2.34.1 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113108): https://edk2.groups.io/g/devel/message/113108 Mute This Topic: https://groups.io/mt/103510102/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-