Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1632902ybi; Thu, 20 Jun 2019 00:54:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJ2HObMg01mzeMyv/SNR6P0JKXzUZsKeaIUovI+Xix+VEnNs44WSrIIz4eLCrXqEQsUK3f X-Received: by 2002:a17:90a:9f0b:: with SMTP id n11mr1685244pjp.98.1561017250228; Thu, 20 Jun 2019 00:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561017250; cv=none; d=google.com; s=arc-20160816; b=tH+5ynL/pFCp+b7no9DpUc8Te23e2GNZL4jj38QCAMcEZA88q5Y4tdTXDwvf2KajW2 sVDlTkEwFIK9hM6Ff0C+NaGvoRAd8knI2iUwOSf/uGmzIOE0gKMeu3XIXtCe3SKLPXtm 3uNFhzIUzxO0N7wMKe/LdBpBRVwwQ5pHmnsNC27yAdkB3jN4+olWB+Get355S4Tjto8s wV1hnadV8sdoq5aMNLzdlIUryrg11dbGddWBKTsHWDZLOfQjBOKdbwSW3PnDVrs2ee8B rAgff5EMs5Ar6Vrt74tycFjUEprb3WywY5SfH3/OxEpsej6N5vNPEMIl2BGnaU3XY0Mj gmwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=z9K4JaOfCly2PGAOEjcdrFWJOAtSuxbb4GvB+cSG2jg=; b=i5Z4IP7Eavv9fvzGYNuF6KsxiGmYlaFtNq1Ayp36eGJJCUfXD48g3TQcTXqOFSesJD xw0EocHFMvEbYzNCj/7pKNMcuOL74M62qUQhY1anT0rcvvEegOFU5xgHpKKsTWbz6EGo vqe7lrDZGguq3AykoZ9+wpwjZzSZQjPjutHcLK1R1BmE+phkgtQBs9L1X7L4SjzXNSYS kmkNlqjBXpBpHU+x2cM0oHLASEu+QYxZpEnbO6lJhFipERBthbdWl5LFkAE0ZL3KzDwT GfB+yZFl5NOjRP2IMfy3jWelsiIwHFSU86fdfLMGecwa76UBmntGDJSXfXpXXpUXt6LE P91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DIsQphDQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a129si19648824pfa.200.2019.06.20.00.53.54; Thu, 20 Jun 2019 00:54:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DIsQphDQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726122AbfFTHwa (ORCPT + 99 others); Thu, 20 Jun 2019 03:52:30 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47288 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbfFTHwa (ORCPT ); Thu, 20 Jun 2019 03:52:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=z9K4JaOfCly2PGAOEjcdrFWJOAtSuxbb4GvB+cSG2jg=; b=DIsQphDQ16khJezTqsw/oNAiR 5sjLrKDs+Rngi0tKkBKh1rYK17HMeexsoBlVFQPTmmF/gFKgXehYIYRYdsC/E14t8+Ay0Gzl9Bvyo gnby4u0dNTmHjAE6Hmyo9Jtah0SG1RUKaXfhv3AfBlkmw/dG5rSIjPYOol+cLPbU00S21gyCiS6rH F2Gw2SDPp0N7iae6G7o9J5omXNRknXeGYLs2RpMDxuDpKoPyk5r12Exk87b8nc4yy1waOTIwkW4UM tXVt56CiOBmYi+ee/3Gyb/MDDzmFtGmnk8KhtDfDFudtAaXYjZW6WOb7MJlYTlFqRG1xkcBRM38eI 0ILa6qk7Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hdrru-0008Ll-8o; Thu, 20 Jun 2019 07:52:26 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 73A8120098587; Thu, 20 Jun 2019 09:52:24 +0200 (CEST) Date: Thu, 20 Jun 2019 09:52:24 +0200 From: Peter Zijlstra To: Vineet Gupta Cc: Eugeniy Paltsev , "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Alexey Brodkin , Jason Baron , Paolo Bonzini , Ard Biesheuvel , "linux-arch@vger.kernel.org" Subject: Re: [PATCH] ARC: ARCv2: jump label: implement jump label patching Message-ID: <20190620075224.GT3419@hirez.programming.kicks-ass.net> References: <20190614164049.31626-1-Eugeniy.Paltsev@synopsys.com> <20190619081227.GL3419@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 19, 2019 at 11:55:41PM +0000, Vineet Gupta wrote: > On 6/19/19 1:12 AM, Peter Zijlstra wrote: > >>> +static inline u32 arc_gen_nop(void) > >>> +{ > >>> + /* 1x 32bit NOP in middle endian */ > > I dare not ask... > > :-) The public PRM is being worked on for *real* so this will be remedied in a few > months at best. > > Short answer is it specifies how instruction stream is laid out in code memory for > efficient next PC decoding given that ARC can freely intermix 2, 4, 6, 8 byte > instruction fragments w/o any restrictions. > > Consier SWI insn encoding: per PRM is > > 31 0 > -------------------------------------------------------------- > 00100 010 01 101111 0 000 000000 111111 > -------------------------------------------------------------- > > In regular little endian notation, in memory it would have looked as > > 31 0 > 0x22 0x6F 0x00 0x3F > b3 b2 b1 b0 > > However in middle endian format, the 2 short words are flipped > > 31 0 > 0x00 0x3F 0x22 0x6F > b1 b0 b3 b2 I'm probably missing something here. I understand the I-fetch likes 2 byte chunks, but I'm not sure I understand how you end up with middle endian. With everything little endian, everything seems just fine. If you load the first 2 byte at offset 0, you get the first 2 bytes of the instruction. If OTOH your arch big endian, and you were to load the first two bytes at offset 0, you get the top two. So this middle endian scheme, only seems to make sense if you're otherwise big endian. But AFAICT ARC is bi-endian and the jump-label patch under condsideration is explicitly !CPU_ENDIAN_BE32 -- which suggests the instruction stream is sensitive to the endian selection. Anyway, I was just 'surprised' at seeing middle endian mentioned, curiosity killed the cat and all that :-)