Received: by 10.192.165.148 with SMTP id m20csp1132743imm; Wed, 2 May 2018 14:52:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr8zYe1uRsICajyHMDvXHPxAHvNCroX/r9/6TZSHckwTKPKplqVDx+jhisZC6mXsXmSbyFQ X-Received: by 10.167.129.154 with SMTP id g26mr8154150pfi.210.1525297929976; Wed, 02 May 2018 14:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525297929; cv=none; d=google.com; s=arc-20160816; b=qofBJEfAlN11ARrFy5AAPm7LXofuNJEiwQmdoz+m2ChrRK5BWo8cE3CMnEdLOcmgip x4cYegomNgCWKbkzOQFTf4BfPpS6vqdTA5Ytn3Q68AaMdVDdMXxts9NL+fRtPwYZedoT G1HpxL3GcScO4wpt/CYHNum7qKuifmML/nmeWRSxLmgADJlBosQ8+Mrm0/+2Wzw6Mx9f WrFYuLWDABBmVLRVGSsIRJKSh3dEbgT1JWvm5hUpSPctCQf0YEss46U3ykIgW9auvWOv Em+VyVEif/rEE+mH4EeXDufQqH/3FRPYqEjugvApgPKtY/RQu0M11KFD9nQRmJxXfl7S AWKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=dk8eY1ykd3bfbhp/piEI22k4X3ZQMe204IJGb4xfdVQ=; b=m9CmI93TNHg8gKr1qQPQ3ZTLbfQ2sB8jJUY78yI8ccwD53FSue4n3+hHgujyKCkjvC Tnccf3qmESuHAwVPcq1w45puG4SzIfX8LXcgUu8SPtfHbCRPI0Ecrn1UZSElT+yMcLom YUvlRMR+Jk9nFZl0rnFA9OEfDrTFs/AuFWlkGxhFbfoci/vjLwPrKdONcW+9VmTdtCxv 4jLUiyR1/1Bna4SIPtev8roeK2Dlln/bc7t+gwUamVCIpIgCHOZOWHl1/TtCZLLfgtZd p2LgraMcX3ydbSJyUWgx+rF06gTkNie6tCTzyt+5FPHqA1U0pwHnnjKdqp9jN69yT4am L8kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q5mG8fc+; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15-v6si10210532pgc.383.2018.05.02.14.51.55; Wed, 02 May 2018 14:52:09 -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=pass header.i=@kernel.org header.s=default header.b=Q5mG8fc+; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751875AbeEBVvR (ORCPT + 99 others); Wed, 2 May 2018 17:51:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:55182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbeEBVvO (ORCPT ); Wed, 2 May 2018 17:51:14 -0400 Received: from saruman (jahogan.plus.com [212.159.75.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1ACCD214EE; Wed, 2 May 2018 21:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525297874; bh=hOL7w9EHgQ39p8aG+bQ0CXh86n787/W4l2d8/dzpMHY=; h=Date:From:To:Cc:Subject:From; b=Q5mG8fc+7/WOwtSyWCVrkNmYcjctrJ1w2Gj2hUGiwiJxv2dgWrBWcUiNIc5gCsnDs HUxeRH5oiEe9SFy4Xu1GJLO273dWwkia4s6EUSZorJsk8nf36DiXNCZiROvLV7yg/g zopeC4b+u8xRLh07Wrap1xSi9HZamzHCR83UoYuo= Date: Wed, 2 May 2018 22:51:08 +0100 From: James Hogan To: Ralf Baechle , Arnd Bergmann , linux-mips@linux-mips.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paul Burton , James Hogan , Matt Redfearn , Marcin Nowakowski , Matthew Fortune Subject: Introducing a nanoMIPS port for Linux Message-ID: <20180502215107.GA9884@saruman> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jI8keyz6grp/JLjh" Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jI8keyz6grp/JLjh Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Yesterday MIPS Tech announced the latest generation of the MIPS family of architectures called nanoMIPS [1]. As part of the development we have been designing all the open source tools necessary to support the architecture and, thanks to the speed with which we were able to prototype, we have also been using these tools to shape the architecture along the way. This has led to some really interesting improvements in the tools, which MIPS would like to contribute back to the community. While doing this work many of us have been unable to contribute to the community as actively as we would have liked, we are therefore very grateful for the community support given to the MIPS architecture over the last 18 months. This announcement has a general introduction at the start, so if you have already read it for one of the other tools, you can skip down to the information specific to Linux. For anyone who knows the MIPS architecture you may well wonder why we are introducing another major variant and the question is perfectly valid. We do admittedly have quite a few: MIPS I through MIPS IV, MIPS32 and MIPS64 through to MIPS32R6 and MIPS64R6, MIPS16e, MIPS16e2, microMIPSR3 and microMIPSR6. Each of these serves (or served) a purpose and there is a high level of synergy between all of them. In general, they build upon the previous and there is a high level of compatibility, even when switching to a new encoding like moving from MIPS to microMIPS. The switch to MIPS32R6/MIPS64R6 was a major shift in the way the architecture innovated and drew more on the original theory of the architecture, where evolution was not expected to be limited by binary compatibility. MIPS Release 6 removed instructions and did create some very minor incompatibility but is also much cleaner to implement from a micro-architecture perspective. We have taken this idea much further with nanoMIPS and reimagined the instruction set, by drawing on all the experience gained from previous designs. Hopefully others will find it as interesting as we do. The major driving force behind the nanoMIPS architecture was to achieve outstanding code density, while also balancing out hardware and software design cost. As background MIPS has two compressed ISA variants: MIPS16e, which cannot exist without also implementing MIPS32, and microMIPS, which can exist on its own. Since MIPS16e has specific limits that cannot be engineered around, we chose to use an approach similar to the microMIPS design. nanoMIPS has a variable-length compressed instruction set that is completely standalone from the other MIPS ISAs. It is designed to compress the highest frequency instructions to 16-bits, and use 48-bit instructions to efficiently encode 32-bit constants into the instruction stream. There is also a wider range of 32-bit instructions, which merge carefully chosen high frequency instruction sequences into single operations creating more flexible addressing modes such as indexed and scaled indexed addressing, branch compare with immediate and macro style instructions. The macro like instructions compress prologue and epilogue sequences, as well as a small number of high frequency instruction pairs like two move instructions or a move and function call. nanoMIPS also totally eliminates branch delay slots which follows a precedent set by microMIPSR6. To get the best from a new ISA we also re-engineered the ABI and created a new symbiotic relationship between the ISA and ABI that pushes code density and performance further still. The ABI creates a fully link time relaxable model, which enables us to squeeze every last byte out of the code image even when deferring final addressing mode and layout decisions to link time. We have been mindful of MIPS heritage and ensured that while open to any possible change, we also have minimal impact when porting code from MIPS to nanoMIPS, and have plenty of support to achieve source compatibility between the two. The net effect of these changes leads to an average code size reduction of 20% relative to microMIPSR6. This compression could well be one of the best achieved by GNU tools for any RISC ISA. Comparing the ISA in terms of number of instructions to issue vs microMIPS we also see a reduction of between 8% and 11% of dynamic instruction count. Below we dig into some technical specifics for Linux; we welcome any feedback and questions as we start to look at rebasing this work to the trunk/master and formally submitting it. nanoMIPS pre-built toolchains and source code tarballs are available at: http://codescape.mips.com/components/toolchain/nanomips/2018.04-02/ Linux specific details ====================== The intial port of the Linux kernel is available at: git://git.linux-mips.org/pub/scm/linux-mti.git nanomips-v4.15 You can also view the changes online here: https://git.linux-mips.org/cgit/linux-mti.git/commit/?h=nanomips-v4.15 This single patch is being released as the most expedient path to releasing this work into the wild, but is of course not intended to be submitted or merged upstream as is. This work will be prepared & submitted as series of smaller patches. Due to the binary incompatibility between previous MIPS architecture generations and nanoMIPS, and the significantly revamped compiler ABI, where for the first time, a single Linux kernel would not be expected to handle both old and new ABIs, we have decided to also take the opportunity to modernise the Linux user ABI for nanoMIPS, making as much use of generic interfaces as possible and modernising the true architecture specific parts. This is similar to what a whole new kernel architecture would be expected to adopt, but has been done within the existing MIPS architecture port to allow reuse of the existing MIPS code, most of which does not depend on these ABI specifics. Details of the proposed Linux user ABI changes for nanoMIPS can be found here: https://www.linux-mips.org/wiki/P32_Linux_ABI Contributors: Paul Burton, James Hogan, Matt Redfearn, Marcin Nowakowski [1] https://www.mips.com/press/new-mips-i7200-processor-core-delivers-unmatched-performance-and-efficiency-for-advanced-lte5g-communications-and-networking-ic-designs/ --jI8keyz6grp/JLjh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQS7lRNBWUYtqfDOVL41zuSGKxAj8gUCWuoyuwAKCRA1zuSGKxAj 8iNCAP9NY04kV6wYl8m0EuHHB2t92jJ/lA8Gosjy8Tiyt/CeFAD/V30AyNGUBiY+ E0mJ/qzkqukf4VMkF/VnYGCuStjz2QE= =+byj -----END PGP SIGNATURE----- --jI8keyz6grp/JLjh--