From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=k2T+yC/Z; spf=pass (domain: linaro.org, ip: 209.85.166.196, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-it1-f196.google.com (mail-it1-f196.google.com [209.85.166.196]) by groups.io with SMTP; Fri, 31 May 2019 02:20:07 -0700 Received: by mail-it1-f196.google.com with SMTP id u186so14164132ith.0 for ; Fri, 31 May 2019 02:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/S+pfhheqpZUGpOlK2FhgO7pvYWQubNiGvBXCQyovhU=; b=k2T+yC/ZfsFmiVm96cXQV/96lxVTaXkaB99z17QinIQjQCDKjt2luF49Vywxo20b9Z BDI7UMdeAtEFLxKArGd1SZad+U3l/z0WMy90kMwq6Xo7L08JmaSBH5ff9/0TvTsSTjjJ kCsOD+mOnO988Xm8EZFvMVQ36MEtSgLtBaxDz6rYY0IjOlfFLCOSSXtZk3qUlk7XlmZ2 wOVubriEom7cLYMMPqPoYxkwcff13cTc1QjQDDeAnRkyeL/MKQbaW+moh4vWijTv/PX8 IexM+xlzc9ry7kTwQ/GEUbnYWSQahKBh1ru9rDHBRDU29Kff51IqfWgjsVgpBwSzUh2i JxMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=/S+pfhheqpZUGpOlK2FhgO7pvYWQubNiGvBXCQyovhU=; b=FkSxlvcItR4EYo5GtCHwHq6iWr638SFWacZdFl1nBhfRAEb9aFlha/D0bSEqNUDKZt DpyeuQN7BIwx9+oU2/yz5zQ07lNEcBIx+BK1gG/v9pulK/l2ZU9fmNglwH+BCv0xhDQ7 L6HB+rgtYP7gp7z5LXw0IWfewU4BpOSPsOjD/O3QWdz5rQMCJRPPzrvF18AuML+S1NCw HqTwvoW7EYUpEluYfpweqyxYzWYjGK2QSL/lpy2dkeRDLuQJZAPgFZwUf00N/+PUIFA1 68snhCYGKlovxm3M4LDkR9VUKq5/yL+y8I+ZklPnrF2pjmyTFFbgX9L0kmIHxUVUfRyM P2Ew== X-Gm-Message-State: APjAAAVkSCo/TLecXUf/nXTZ3Ad+ePrkkfz8S8Ig+xhadYrRz2t9Pgnn TPO+Ijiclwl0Jh0YU3ueuz8rWFaZwXxdN4Q9LsVPyg== X-Google-Smtp-Source: APXvYqxkWag8u0Vhf2Iqe63UiAky3jG10CySv85gAR4dwnkBO3JLtj5zwxH3tdv1/ithbdNemA6hLtZC9+S2Wd9jR6g= X-Received: by 2002:a02:a494:: with SMTP id d20mr5554288jam.62.1559294407014; Fri, 31 May 2019 02:20:07 -0700 (PDT) MIME-Version: 1.0 References: <20190508095255.2897-1-tzy.way.ooi@intel.com> <5F1105621EDF844291AF8B109E27C06D34D05FCC@PGSMSX109.gar.corp.intel.com> In-Reply-To: <5F1105621EDF844291AF8B109E27C06D34D05FCC@PGSMSX109.gar.corp.intel.com> From: "Ard Biesheuvel" Date: Fri, 31 May 2019 11:19:53 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH v4 edk2-platforms 1/1] Silicon/DesignWare/Driver: DwEmacSnpDxe: Add DesignWare EMAC driver To: "Ooi, Tzy Way" Cc: edk2-devel-groups-io , "Kinney, Michael D" , "Loh, Tien Hock" , "leif.lindholm@linaro.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 31 May 2019 at 11:14, Ooi, Tzy Way wrote: > > Thanks Biesheuvel. > > I would like to confirm with you on regards of one of the comment. There = is one comment where you mentioned that: > "I am aware that TX is usually the hot path in UEFI, but we should still = try to map a buffer directly rather than copy the contents into uncached me= mory" > > I would like to confirm with you if do you mean I should do the DmaMap he= re instead of doing it at the beginning of the code while DmaAllocate is ex= ecuted? Yes. Each time you receive a buffer, you DmaMap() it with the MapOperationBusMasterRead attribute, and hand it to the device. After the device is finished, you DmaUnmap() it again. This removes the need for uncached memory. On the RX path, you can allocate the buffers via AllocatePages() rather than via DmaAllocateBuffer(), and map the for DMA using DmaMap() with the MapOperationBusMasterWrite attribute. Once the buffer is filled by the hardware, you can DmaUnmap() it and copy the contents back to the caller, after which you can recycle the buffer or free it. > Or do you mean I shouldn=E2=80=99t copy it into a uncached memory region? > DmaAllocateBuffer() gives you an uncached region, so you should only use it for data structures that are accessed and modified by the CPU and the hardware at the same time, e.g., the descriptor rings. The actual data buffers only need directional DMA, so using uncached memory results in an unnecessary performance hit. > Thank you > -----Original Message----- > From: Ard Biesheuvel > Sent: Wednesday, May 22, 2019 3:22 PM > To: edk2-devel-groups-io ; Ooi, Tzy Way > Cc: Kinney, Michael D ; Loh, Tien Hock ; leif.lindholm@linaro.org > Subject: Re: [edk2-devel] [PATCH v4 edk2-platforms 1/1] Silicon/DesignWar= e/Driver: DwEmacSnpDxe: Add DesignWare EMAC driver > > On Wed, 22 May 2019 at 03:37, Ooi, Tzy Way wrote: > > > > Hi Maintainers, > > > > Please could you help to review this patch? Thanks. > > > > I already did, but my email response got rejected twice > > https://edk2.groups.io/g/devel/message/40829?p=3D,,,20,0,0,0::Created,,em= ac,20,2,0,31541649