From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org 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 3E16A2034CF7C for ; Sun, 5 Nov 2017 17:08:50 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2017 17:12:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,350,1505804400"; d="scan'208";a="917889556" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 05 Nov 2017 17:12:47 -0800 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 5 Nov 2017 17:12:47 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 5 Nov 2017 17:12:47 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Mon, 6 Nov 2017 09:12:45 +0800 From: "Wu, Hao A" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Dong, Eric" , "Zeng, Star" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation Thread-Index: AQHTVhjY3PGDrjaEw0i1aVnCgCTFnKMGjFtA Date: Mon, 6 Nov 2017 01:12:44 +0000 Message-ID: References: <20171105093054.22349-1-ard.biesheuvel@linaro.org> In-Reply-To: <20171105093054.22349-1-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation 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: , X-List-Received-Date: Mon, 06 Nov 2017 01:08:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ar= d > Biesheuvel > Sent: Sunday, November 05, 2017 5:31 PM > To: edk2-devel@lists.01.org > Cc: Tian, Feng; Dong, Eric; Zeng, Star; Ard Biesheuvel > Subject: [edk2] [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call > SdMmcFreeTrb() to complete sync operation >=20 > Currently, we complete a synchronous operation without unmapping the > DMA mappings, and free the pages using FreePages () rather than calling > EFI_PCI_IO_PROTOCOL::FreeBuffer. This is simply incorrecnt, but it also > breaks non-coherent DMA as well as DMA protection and/or memory > encryption > so let's do it correctly and call SdMmcFreeTrb() instead. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > index 23faec5e2be0..0be8828abfcc 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > @@ -1008,13 +1008,7 @@ SdMmcPassThruPassThru ( > } >=20 > Done: > - if ((Trb !=3D NULL) && (Trb->AdmaDesc !=3D NULL)) { > - FreePages (Trb->AdmaDesc, Trb->AdmaPages); > - } > - > - if (Trb !=3D NULL) { > - FreePool (Trb); > - } > + SdMmcFreeTrb (Trb); >=20 > return Status; > } > -- > 2.11.0 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel