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 4F224941BC4 for ; Tue, 31 Oct 2023 16:52:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=pEFESXh6cZIrJ51YC9SNWa7cNrjMyiFaHuch+s8e7Us=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698771131; v=1; b=Blzlz9v55rQse8yNyyFkYScRdev54Rt3XKAmabuVJUrLJnYGu89+c60QR+mTl0UuyBto2FfV 05pR8kcr5Eg0OkoLHhW6NBQgO9HLcrLoyjmJ4bxjbPqqtgyd7xxZlK7doFxGKXGFc+uL9dipUYp LnsGWefm+Ha/LWjVYEpWBueA= X-Received: by 127.0.0.2 with SMTP id r2LVYY7687511xUw8nwu2xFw; Tue, 31 Oct 2023 09:52:11 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.644.1698771110473229646 for ; Tue, 31 Oct 2023 09:52:10 -0700 X-Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39VFG6RN010311; Tue, 31 Oct 2023 16:51:40 GMT X-Received: from p1lg14881.it.hpe.com ([16.230.97.202]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3u342n1day-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 31 Oct 2023 16:51:40 +0000 X-Received: from p1lg14886.dc01.its.hpecorp.net (unknown [10.119.18.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id A95BD805643; Tue, 31 Oct 2023 16:51:29 +0000 (UTC) X-Received: from cat.eag.rdlabs.hpecorp.net (unknown [16.231.227.36]) by p1lg14886.dc01.its.hpecorp.net (Postfix) with ESMTP id C133B80DEB0; Tue, 31 Oct 2023 16:51:16 +0000 (UTC) X-Received: by cat.eag.rdlabs.hpecorp.net (Postfix, from userid 178665) id 0F13B221EEC; Tue, 31 Oct 2023 11:51:16 -0500 (CDT) From: "Henz, Patrick" To: devel@edk2.groups.io Cc: hao.a.wu@intel.com, ray.ni@intel.com, Patrick Henz Subject: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Non-zero start/stop values in XhcGetElapsedTicks Date: Tue, 31 Oct 2023 11:51:14 -0500 Message-Id: X-Proofpoint-GUID: PQ0B7XGbI1gfBr1_Lzr_jrQ8fr0WaJlV X-Proofpoint-ORIG-GUID: PQ0B7XGbI1gfBr1_Lzr_jrQ8fr0WaJlV X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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,patrick.henz@hpe.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 0K5xM38LhluhpAafZEol7Akmx7686176AA= 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=Blzlz9v5; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=hpe.com (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 REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D4578 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 Cc: Ray Ni Signed-off-by: Patrick Henz 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/Xhc= iDxe/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=0D //=0D if (*PreviousTick > CurrentTick) {=0D - Delta =3D (mPerformanceCounterEndValue - *PreviousTick) + CurrentTic= k;=0D + Delta =3D (CurrentTick - mPerformanceCounterStartValue) + (mPerforma= nceCounterEndValue - *PreviousTick);=0D } else {=0D Delta =3D CurrentTick - *PreviousTick;=0D }=0D @@ -2398,7 +2398,7 @@ XhcGetElapsedTicks ( // Counter counts downwards, check for an underflow condition=0D //=0D if (*PreviousTick < CurrentTick) {=0D - Delta =3D (mPerformanceCounterStartValue - CurrentTick) + *PreviousT= ick;=0D + Delta =3D (mPerformanceCounterStartValue - CurrentTick) + (*Previous= Tick - mPerformanceCounterEndValue);=0D } else {=0D Delta =3D *PreviousTick - CurrentTick;=0D }=0D --=20 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-