From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935192AbcCJHq2 (ORCPT ); Thu, 10 Mar 2016 02:46:28 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:65207 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932742AbcCJHqT (ORCPT ); Thu, 10 Mar 2016 02:46:19 -0500 From: Arnd Bergmann To: Vineet Gupta Subject: Re: [PATCH] arc: use little endian accesses Date: Thu, 10 Mar 2016 08:45:30 +0100 User-Agent: KMail/1.12.2 (Linux/3.19.0-54-generic; KDE/4.3.2; x86_64; ; ) Cc: Lada Trimasova , "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , Alexey Brodkin , Noam Camus References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201603100845.30602.arnd@arndb.de> X-Provags-ID: V03:K0:SquWhaQ5TMlVvLTmCN9DtAeY9y0oIyga3Hc5PrhAN/ZVECE2vrg W6y+w0ofuLJukjoP3kC1eqDQySnpWk3QxFWuwrej3BX3kcbr6bgVOsWRXk65nAnwU3QzRB4 jSxyIMBVy+KePZlZkGiNYC5Y1OzXEv14CPGmXFdtCRgqoEA847CvdDhgMh+HKRrbWHxwpNa qbsI/JzULQOr+nFbGYCzQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:WSQpdm3M9ME=:Whq9jPN/iQpy6S1H0b1yhU ttOO0VAGiKAMdgTz9FMVSZ38OLXMp07BmtpOmMX9VgNPpcFCyTAqZz13UIAWQzsDXUmZFCJ2Y 2aN1NdFlEyG/2qAngr1oTQDCyvdEUDRmKzBnKQgcIGSyld+8aL6rrA+6u2ppG3xHTqeQK/cyE aHJyEECbRwpYyrAxyWNeBFKGalRICZf+ReGOF0ZDugienpReQiXwFjFs8iVMNZwsfbb/PDL/m C3Siqra/L5iYVvehu1DMoyCF0sHZekR1/02JuDPIwv88Ce6t9FKM8qNjjYmpwYbMpdOLvABkq QdBydAD2wgmJ2mruIvalFtNhNe01R0DobMjX0EE0xrlu4tvOWC0eN5E49A5/rCZcPJ4X1+qj/ PxYUKNHzISseM3TsKpbOpF3ABBHv8Y311WcV6o73yJGKzl0tQZ3hMthFjTAbKif8vKrQxwLGE /ybzJqXnHJ3eNOVdM4zFMCiS91DcwebV7N5D3vY1gcoyEwaSl2lpiszow64pQuygyWRcepuJA ZV4DjUSsHZl63p7zsHKSXIJxO7hijkn1klEU4UY0nZcunqXvpqCDJW1TFVeQLEyXPrBWlRPaz t/SGTzo7VoquTFQSz4LqPbGmYiOMiSLUTXLNXaqrR+L0fC25aEKA1wKim+shYCbX9kEwYnsSD bYjDPRILKKSXRIv+WW86u8wxnhWko+GZz9DSWSeQKhn45h2ovNPXsa4jCo0QjFmn10AFIgzoM otE1dFnOGfA35HqO Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 10 March 2016, Vineet Gupta wrote: > On Wednesday 09 March 2016 10:51 PM, Lada Trimasova wrote: > > Memory access primitives should use cpu_to_le16, cpu_to_le32, le16_to_cpu > > and le32_to_cpu because it is not really guaranteed that drivers handles > > any ordering themselves. > > That is the driver issue. readxx as API simply returns data in native endianness. > We've had EZChip running big endian and so far and they didn't need this change. Most drivers using readl() or readl_relaxed() expect those to perform byte swaps on big-endian architectures, as the registers tend to be fixed endian, so the change seems reasonable. It depends a little bit on how endian mode is implemented in the CPU: do you follow the normal model of swapping byte order in the load/store instructions of the CPU when running big-endian, or is the CPU always running little-endian but the bus addresses get mangled on byte accesses to give the illusion of a big-endian system? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH] arc: use little endian accesses Date: Thu, 10 Mar 2016 08:45:30 +0100 Message-ID: <201603100845.30602.arnd@arndb.de> References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+gla-linux-snps-arc=m.gmane.org@lists.infradead.org To: Vineet Gupta Cc: "linux-arch@vger.kernel.org" , Lada Trimasova , Alexey Brodkin , "linux-kernel@vger.kernel.org" , Noam Camus , "linux-snps-arc@lists.infradead.org" List-Id: linux-arch.vger.kernel.org On Thursday 10 March 2016, Vineet Gupta wrote: > On Wednesday 09 March 2016 10:51 PM, Lada Trimasova wrote: > > Memory access primitives should use cpu_to_le16, cpu_to_le32, le16_to_cpu > > and le32_to_cpu because it is not really guaranteed that drivers handles > > any ordering themselves. > > That is the driver issue. readxx as API simply returns data in native endianness. > We've had EZChip running big endian and so far and they didn't need this change. Most drivers using readl() or readl_relaxed() expect those to perform byte swaps on big-endian architectures, as the registers tend to be fixed endian, so the change seems reasonable. It depends a little bit on how endian mode is implemented in the CPU: do you follow the normal model of swapping byte order in the load/store instructions of the CPU when running big-endian, or is the CPU always running little-endian but the bus addresses get mangled on byte accesses to give the illusion of a big-endian system? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de ([212.227.17.24]:65207 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932742AbcCJHqT (ORCPT ); Thu, 10 Mar 2016 02:46:19 -0500 From: Arnd Bergmann Subject: Re: [PATCH] arc: use little endian accesses Date: Thu, 10 Mar 2016 08:45:30 +0100 References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-ID: <201603100845.30602.arnd@arndb.de> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Vineet Gupta Cc: Lada Trimasova , "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , Alexey Brodkin , Noam Camus Message-ID: <20160310074530.k0q3Vq-jwJ3fz76rgpjyg0IyYEPcoqw0ufsSRYDeMQQ@z> On Thursday 10 March 2016, Vineet Gupta wrote: > On Wednesday 09 March 2016 10:51 PM, Lada Trimasova wrote: > > Memory access primitives should use cpu_to_le16, cpu_to_le32, le16_to_cpu > > and le32_to_cpu because it is not really guaranteed that drivers handles > > any ordering themselves. > > That is the driver issue. readxx as API simply returns data in native endianness. > We've had EZChip running big endian and so far and they didn't need this change. Most drivers using readl() or readl_relaxed() expect those to perform byte swaps on big-endian architectures, as the registers tend to be fixed endian, so the change seems reasonable. It depends a little bit on how endian mode is implemented in the CPU: do you follow the normal model of swapping byte order in the load/store instructions of the CPU when running big-endian, or is the CPU always running little-endian but the bus addresses get mangled on byte accesses to give the illusion of a big-endian system? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Thu, 10 Mar 2016 08:45:30 +0100 Subject: [PATCH] arc: use little endian accesses In-Reply-To: References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> List-ID: Message-ID: <201603100845.30602.arnd@arndb.de> To: linux-snps-arc@lists.infradead.org On Thursday 10 March 2016, Vineet Gupta wrote: > On Wednesday 09 March 2016 10:51 PM, Lada Trimasova wrote: > > Memory access primitives should use cpu_to_le16, cpu_to_le32, le16_to_cpu > > and le32_to_cpu because it is not really guaranteed that drivers handles > > any ordering themselves. > > That is the driver issue. readxx as API simply returns data in native endianness. > We've had EZChip running big endian and so far and they didn't need this change. Most drivers using readl() or readl_relaxed() expect those to perform byte swaps on big-endian architectures, as the registers tend to be fixed endian, so the change seems reasonable. It depends a little bit on how endian mode is implemented in the CPU: do you follow the normal model of swapping byte order in the load/store instructions of the CPU when running big-endian, or is the CPU always running little-endian but the bus addresses get mangled on byte accesses to give the illusion of a big-endian system? Arnd