From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 B140E22436937 for ; Fri, 23 Feb 2018 07:11:23 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8F1240201A0; Fri, 23 Feb 2018 15:17:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-112.rdu2.redhat.com [10.10.120.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9259810FFE70; Fri, 23 Feb 2018 15:17:23 +0000 (UTC) To: Pankaj Bansal , Udit Kumar , Leif Lindholm Cc: "michael.d.kinney@intel.com" , "edk2-devel@lists.01.org" , "ard.biesheuvel@linaro.org" , Meenakshi Aggarwal References: <1518771035-6733-1-git-send-email-meenakshi.aggarwal@nxp.com> <1518771035-6733-2-git-send-email-meenakshi.aggarwal@nxp.com> <20180221154601.nkbp2xmy3zb2xolm@bivouac.eciton.net> <20180221185818.arwfhombntutnt23@bivouac.eciton.net> <20180222115223.xtfpc7du22drfkju@bivouac.eciton.net> <2a1fa56f-98db-a1c1-d973-7e84cc7dc1fa@redhat.com> <946bd4f7-ed57-018c-00ca-cee154fcb2f0@redhat.com> <046cf3a9-d865-d651-f2a6-e242a4224d33@redhat.com> <5b10f6c6-836c-6e00-0984-a74335b4753b@redhat.com> From: Laszlo Ersek Message-ID: <1a4513ef-f98a-1f0b-93f3-c5403f0a6b78@redhat.com> Date: Fri, 23 Feb 2018 16:17:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 23 Feb 2018 15:17:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 23 Feb 2018 15:17:24 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH edk2-platforms 01/39] Silicon/NXP: Add support for Big Endian Mmio APIs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 15:11:24 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 02/23/18 12:48, Pankaj Bansal wrote: >> -----Original Message----- >> From: Laszlo Ersek [mailto:lersek@redhat.com] >> Sent: Friday, February 23, 2018 4:52 PM >> To: Pankaj Bansal ; Udit Kumar >> ; Leif Lindholm >> Cc: michael.d.kinney@intel.com; edk2-devel@lists.01.org; >> ard.biesheuvel@linaro.org; Meenakshi Aggarwal >> >> Subject: Re: [edk2] [PATCH edk2-platforms 01/39] Silicon/NXP: Add support >> for Big Endian Mmio APIs >> >> On 02/23/18 12:04, Pankaj Bansal wrote: >> >>> However Laszlo, with the method you suggest (using STATIC CONST >>> UINT16 mOne), would it not add delay in each Mmio Operation ? >>> >>> I am concerned about boot delay using this approach. >> The condition can be evaluated at compile time, so I expect optimizing >> compilers to eliminate the dead branch. >> >> Assuming the condition cannot be eliminated at build time, what is your >> concern: the single byte access, or the branch instruction? >> >> I don't think the single byte access matters. (If you tried to replace that with a >> HOB or PCD lookup, it could only be worse.) >> >> I also doubt the branch should be a concern. You could replace the "if" >> (or the ternary operator "?:") with function pointers that you set e.g. >> in a constructor function. But I think an "if" with an invariable >> (constant) controlling expression is at least as friendly towards branch >> predictors as a function pointer variable (through which you might be >> *forced* to make a real function call). >> >> Personally I wouldn't worry. >> > > I think you are right about smart compiler eliminating the branches at build time. > I just pointed this out because we call Mmio/BeMmio APIs when accessing Nor flash for variable read/write. > As these are called so many time during boot, I did not want any delay to be added to these APIs than necessary. > Now that you have pointed it out, I don't think any significant delay will be added to these APIs. In addition to that, physical flash access is likely so slow anyway that a few additional instructions should be lost in the noise, generally speaking. Thanks Laszlo