public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Henz, Patrick" <patrick.henz@hpe.com>
Cc: "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Non-zero start/stop values in XhcGetElapsedTicks
Date: Wed, 1 Nov 2023 02:25:55 +0000	[thread overview]
Message-ID: <DM6PR11MB4025C5A609FDEAF4407B3BA8CAA7A@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <c3038878c4d30c54e60cce7192cf1aa60c30ad2e.1698770394.git.patrick.henz@hpe.com>

Acked-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Henz,
> Patrick
> Sent: Wednesday, November 1, 2023 12:51 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Henz,
> Patrick <patrick.henz@hpe.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Non-zero start/stop
> values in XhcGetElapsedTicks
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4578
> 
> The implementation of XhcGetElapsedTicks did not account for
> non-zero start and stop values for the performance counter
> timer, potentially resulting in an incorrect elapsed tick
> count getting returned to the caller. Account for non-zero
> start and stop values when calculating the elapsed tick
> count.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Patrick Henz <patrick.henz@hpe.com>
> Reviewed-by:
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 7a2e32a9dd..6cb97b7452 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -2389,7 +2389,7 @@ XhcGetElapsedTicks (
>      // Counter counts upwards, check for an overflow condition
> 
>      //
> 
>      if (*PreviousTick > CurrentTick) {
> 
> -      Delta = (mPerformanceCounterEndValue - *PreviousTick) + CurrentTick;
> 
> +      Delta = (CurrentTick - mPerformanceCounterStartValue) +
> (mPerformanceCounterEndValue - *PreviousTick);
> 
>      } else {
> 
>        Delta = CurrentTick - *PreviousTick;
> 
>      }
> 
> @@ -2398,7 +2398,7 @@ XhcGetElapsedTicks (
>      // Counter counts downwards, check for an underflow condition
> 
>      //
> 
>      if (*PreviousTick < CurrentTick) {
> 
> -      Delta = (mPerformanceCounterStartValue - CurrentTick) + *PreviousTick;
> 
> +      Delta = (mPerformanceCounterStartValue - CurrentTick) + (*PreviousTick
> - mPerformanceCounterEndValue);
> 
>      } else {
> 
>        Delta = *PreviousTick - CurrentTick;
> 
>      }
> 
> --
> 2.34.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#110434):
> https://edk2.groups.io/g/devel/message/110434
> Mute This Topic: https://groups.io/mt/102301510/1768737
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110463): https://edk2.groups.io/g/devel/message/110463
Mute This Topic: https://groups.io/mt/102301510/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      parent reply	other threads:[~2023-11-01  2:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 16:51 [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Non-zero start/stop values in XhcGetElapsedTicks Henz, Patrick
2023-10-31 20:51 ` Laszlo Ersek
2023-11-01  1:12 ` Mike Maslenkin
2023-11-02 11:28   ` Laszlo Ersek
2023-11-02 13:06     ` Pedro Falcato
2023-11-03  6:40       ` Laszlo Ersek
2023-11-02 23:01     ` Henz, Patrick
2023-11-01  2:25 ` Wu, Hao A [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR11MB4025C5A609FDEAF4407B3BA8CAA7A@DM6PR11MB4025.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox