From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175AbcCJS6D (ORCPT ); Thu, 10 Mar 2016 13:58:03 -0500 Received: from smtprelay2.synopsys.com ([198.182.60.111]:51894 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752340AbcCJS5y (ORCPT ); Thu, 10 Mar 2016 13:57:54 -0500 From: Lada Trimasova To: Vineet Gupta CC: "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "noamc@ezchip.com" , Alexey Brodkin , "linux-snps-arc@lists.infradead.org" Subject: Re: [PATCH] arc: use little endian accesses Thread-Topic: [PATCH] arc: use little endian accesses Thread-Index: AQHReigg+s+cGrWG60yWXENL9ihXTZ9S+GYA Date: Thu, 10 Mar 2016 18:57:48 +0000 Message-ID: <1457636268.457.34.camel@synopsys.com> References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> <1457595846.2868.10.camel@synopsys.com> In-Reply-To: Reply-To: Lada Trimasova Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.149] Content-Type: text/plain; charset="utf-8" Content-ID: <16A1B0FC5D995546B381FA5659684CC9@internal.synopsys.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u2AIw7u2010615 Hi Vineet, Alexey, Arnd, On Thu, 2016-03-10 at 09:55 +0000, Vineet Gupta wrote: Can you or Lada provide more details as to exactly what is not working - what driver to be precise 8250 or dw-8250. And where exactly the failure shows up. I want to understand this more Noam told me off list that he has no issues with both big endian ARC + 8250 in systemc model or silicon. -Vineet Driver is 8250, kernel is built for BE arc, nsim option in model "nsim_isa_big_endian = 1". With current "readl" and "writel" implementation for ARC we read word from memory without any endianess manipulation. So in case of little endian architecture we get what we want: the first memory byte is the low byte in the word. But in case of big endian architecture the word endianess is swapped: the first memory byte is the high word byte. And for example, let's see what happens when we use "readl" in function "serial8250_early_in" in driver/tty/serial/8250. Take a look to one line from memory dump: 0xf0000010: 0x0b 0x00 0x00 0x00 0x60 0x00 0x00 0x00 When kernel is built for little endian architecture, we read this data in status register in function "serial_putc" using "readl" function in driver/tty/serial/8250 as: r0: 0x0000006 The low byte is 0x0b, so the condition "if ((status & BOTH_EMPTY) == BOTH_EMPTY)" is true, as BOTH_EMPTY is some mask with low bytes set. When kernel is built with "CPU_BIG_ENDIAN" and model nsim option is "nsim_isa_big_endian=1", we read this data as: r0: 0x6000000 So as you can see the low byte is 0x00 and above mentioned condition never becomes true, we can't continue initialization. Regards, Lada From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lada Trimasova Subject: Re: [PATCH] arc: use little endian accesses Date: Thu, 10 Mar 2016 18:57:48 +0000 Message-ID: <1457636268.457.34.camel@synopsys.com> References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> <1457595846.2868.10.camel@synopsys.com> Reply-To: Lada Trimasova Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: In-Reply-To: Content-Language: en-US Content-ID: <16A1B0FC5D995546B381FA5659684CC9@internal.synopsys.com> Sender: linux-kernel-owner@vger.kernel.org To: Vineet Gupta Cc: "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "noamc@ezchip.com" , Alexey Brodkin , "linux-snps-arc@lists.infradead.org" List-Id: linux-arch.vger.kernel.org SGkgVmluZWV0LCBBbGV4ZXksIEFybmQsDQpPbiBUaHUsIDIwMTYtMDMtMTAgYXQgMDk6NTUgKzAw MDAsIFZpbmVldCBHdXB0YSB3cm90ZToNCg0KQ2FuIHlvdSBvciBMYWRhIHByb3ZpZGUgbW9yZSBk ZXRhaWxzIGFzIHRvIGV4YWN0bHkgd2hhdCBpcyBub3Qgd29ya2luZyAtIHdoYXQ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u, 10 Mar 2016 18:57:48 +0000 Subject: [PATCH] arc: use little endian accesses In-Reply-To: References: <1457544064-16167-1-git-send-email-ltrimas@synopsys.com> <1457595846.2868.10.camel@synopsys.com> List-ID: Message-ID: <1457636268.457.34.camel@synopsys.com> To: linux-snps-arc@lists.infradead.org Hi Vineet, Alexey, Arnd, On Thu, 2016-03-10@09:55 +0000, Vineet Gupta wrote: Can you or Lada provide more details as to exactly what is not working - what driver to be precise 8250 or dw-8250. And where exactly the failure shows up. I want to understand this more Noam told me off list that he has no issues with both big endian ARC + 8250 in systemc model or silicon. -Vineet Driver is 8250, kernel is built for BE arc, nsim option in model "nsim_isa_big_endian = 1". With current "readl" and "writel" implementation for ARC we read word from memory without any endianess manipulation. So in case of little endian architecture we get what we want: the first memory byte is the low byte in the word. But in case of big endian architecture the word endianess is swapped: the first memory byte is the high word byte. And for example, let's see what happens when we use "readl" in function "serial8250_early_in" in driver/tty/serial/8250. Take a look to one line from memory dump: 0xf0000010: 0x0b 0x00 0x00 0x00 0x60 0x00 0x00 0x00 When kernel is built for little endian architecture, we read this data in status register in function "serial_putc" using "readl" function in driver/tty/serial/8250 as: r0: 0x0000006 The low byte is 0x0b, so the condition "if ((status & BOTH_EMPTY) == BOTH_EMPTY)" is true, as BOTH_EMPTY is some mask with low bytes set. When kernel is built with "CPU_BIG_ENDIAN" and model nsim option is "nsim_isa_big_endian=1", we read this data as: r0: 0x6000000 So as you can see the low byte is 0x00 and above mentioned condition never becomes true, we can't continue initialization. Regards, Lada