From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::242; helo=mail-it0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 07DCD203555FF for ; Mon, 6 Nov 2017 02:30:39 -0800 (PST) Received: by mail-it0-x242.google.com with SMTP id 72so4525932itk.3 for ; Mon, 06 Nov 2017 02:34:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tVzusi+PR4hfEOEgxNn85HJ3p+PYtRJsjsUpYFx6hhk=; b=gRp7/YDcByP7N6HD/I9ej3tmakNsTHx42mjCLAJ/Em2LPTZW5UuOIwjVHOmikJFPrh ZhnrjXCA5SK1hUFSpJPD9Xf0Hvy3FG9LMGDKfYaqjgWBfOOdgZpcFuitMnh2GuLn7N28 7tMYs/PAx/TsKkzj7s3p+zN1Qw7HWV2Q/qGH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tVzusi+PR4hfEOEgxNn85HJ3p+PYtRJsjsUpYFx6hhk=; b=AqFEm1OfL4C+lDcCDJCfK3Kj6qZjIMRwvqfx7DKojkAB5u5y5MQbJVNGbDz9kpjm6D E7pCHZKJeJjd5wKIoA3d+ABmjXRFjQ8+7SGY4X1xoHJ3fTM6pFm6KrGtz1WVBnJOAoCc 5K7BSTPaW7G1i4GoQQwDpx6Jdp98c/6CnzahGIwdStwYp/RLY6jP9er59NvznHGwgr36 3S2TLHM3rFEFGWY8LQlb8MClj6Ordm3pwZ0A+K5mYzJR7jQHFqvgTkCNb89uj2xDmlmz dPO6SmVQb7mYEopExJ8ROeC2ADdNjWnQPiIU6N8TUFj4iiDOWvm56y4+LZAch6pgpVLj bwzg== X-Gm-Message-State: AJaThX6s0nuZrZAeVirnzghz2r9EplPndZyObDY5tJ08qoKg6vO3fKdg lrBhtIJ057O3FyjugPo0dO9HeGf8C6b9qKrckr1nfw== X-Google-Smtp-Source: ABhQp+Q+Vcgvtrpv0wHZnN/LxVe4Zwnhjwsqx1SJG/iYTcc9xbbEft3EIBpbxbhk15ZAn8+SZDsJ5BLdyYfoHl6ycAc= X-Received: by 10.36.254.140 with SMTP id w134mr8747754ith.73.1509964477165; Mon, 06 Nov 2017 02:34:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.131.167 with HTTP; Mon, 6 Nov 2017 02:34:36 -0800 (PST) In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B9B2080@shsmsx102.ccr.corp.intel.com> References: <20171105093054.22349-1-ard.biesheuvel@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103B9B2080@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Mon, 6 Nov 2017 10:34:36 +0000 Message-ID: To: "Zeng, Star" Cc: "edk2-devel@lists.01.org" , "Tian, Feng" , "Dong, Eric" 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 10:30:40 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 6 November 2017 at 08:56, Zeng, Star wrote: > Except the typo "incorrecnt" needs to be "incorrect" in commit log, other= s are good to me. > > With typo fixed, Reviewed-by: Star Zeng > Thanks Pushed as 6743455e34d1b313d644d9f7ca726b9932effb1f > -----Original Message----- > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] > Sent: Sunday, November 5, 2017 5:31 PM > To: edk2-devel@lists.01.org > Cc: Tian, Feng ; Zeng, Star ; D= ong, Eric ; Ard Biesheuvel > Subject: [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to co= mplete sync operation > > 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 d= o it correctly and call SdMmcFreeTrb() instead. > > 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(-) > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModu= lePkg/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 ( > } > > Done: > - if ((Trb !=3D NULL) && (Trb->AdmaDesc !=3D NULL)) { > - FreePages (Trb->AdmaDesc, Trb->AdmaPages); > - } > - > - if (Trb !=3D NULL) { > - FreePool (Trb); > - } > + SdMmcFreeTrb (Trb); > > return Status; > } > -- > 2.11.0 >