From nobody Sat May 4 09:21:04 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1503568058924907.3314711406587; Thu, 24 Aug 2017 02:47:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EF5CD21D2E63B; Thu, 24 Aug 2017 02:45:01 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3C8A52095B9C6 for ; Thu, 24 Aug 2017 02:45:01 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2017 02:47:34 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.15]) by orsmga003.jf.intel.com with ESMTP; 24 Aug 2017 02:47:32 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,420,1498546800"; d="scan'208";a="1007172892" From: Star Zeng To: edk2-devel@lists.01.org Date: Thu, 24 Aug 2017 17:47:28 +0800 Message-Id: <1503568048-157864-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg XhciDxe: Fix Map and Unmap inconsistency X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Jiewen Yao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We found there are loops of *2* Maps and only *1* Unmap and the DMA buffer address is decreasing. It is caused by the below code flow. XhcAsyncInterruptTransfer -> XhcCreateUrb -> XhcCreateTransferTrb -> Map Urb->DataMap (1) Timer: loops of *2* Maps and only *1* Unmap XhcMonitorAsyncRequests -> XhcFlushAsyncIntMap -> Unmap and Map Urb->DataMap (2) XhcUpdateAsyncRequest -> XhcCreateTransferTrb -> Map Urb->DataMap (3) This patch is to eliminate (3). Cc: Ruiyu Ni Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Ruiyu Ni --- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciSched.c index 6013d7620fe5..21fdcf130a50 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -259,8 +259,11 @@ XhcCreateTransferTrb ( } else { EPType =3D (UINT8) ((DEVICE_CONTEXT_64 *)OutputContext)->EP[Dci-1].EP= Type; } - =20 - if (Urb->Data !=3D NULL) { + + // + // No need to remap. + // + if ((Urb->Data !=3D NULL) && (Urb->DataMap =3D=3D NULL)) { if (((UINT8) (Urb->Ep.Direction)) =3D=3D EfiUsbDataIn) { MapOp =3D EfiPciIoOperationBusMasterWrite; } else { --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel