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 37FCB2243692C for ; Fri, 23 Feb 2018 03:16:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5F3BEB6F9; Fri, 23 Feb 2018 11:22:05 +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 6C1129C073; Fri, 23 Feb 2018 11:22:04 +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> From: Laszlo Ersek Message-ID: <5b10f6c6-836c-6e00-0984-a74335b4753b@redhat.com> Date: Fri, 23 Feb 2018 12:22:03 +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.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 23 Feb 2018 11:22:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 23 Feb 2018 11:22:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 11:16:05 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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. Anyway: please do not mistake my willingness / preference to go into such detail for having high stakes at this. If you go an entirely different route, I'm OK with that too. I felt I was asked for my opinion and I tried to express it in detail, that's all. Thanks Laszlo