From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 93B56139360 for ; Fri, 13 Aug 2021 05:56:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 52E6BE0845; Fri, 13 Aug 2021 05:56:24 +0000 (UTC) Received: from mailbox.box.xen0n.name (unknown [115.28.160.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6A843E0821 for ; Fri, 13 Aug 2021 05:56:21 +0000 (UTC) Received: from [100.100.32.84] (unknown [58.33.27.210]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 9560E600FF for ; Fri, 13 Aug 2021 13:56:17 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xen0n.name; s=mail; t=1628834177; bh=nF+2/u7tEaEmb8ieyA5AOOnsTn/EG7kWX6xGGl6PUPQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=oJw9fIaEgxqdhhcxRhI5MrWGBnPpnJs79wxB/3M1Z0oPr0tV3XWd0iWeeOHFy3Ofm IaDLcC+G+Wk76UQqEWDqN/sPOcYLsHQozk/ngDoUxKA5ODE0bWHIEBGQJ2m7JFb0Sy 7Snl86lASN41EC9CliK4xlWNCM/xj0mN1uEBOZeE= Message-ID: <332257f1-9c4e-89e7-50ad-746d8ff6eab2@xen0n.name> Date: Fri, 13 Aug 2021 13:56:17 +0800 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:93.0) Gecko/20100101 Thunderbird/93.0a1 Subject: Re: [gentoo-dev] [RFC] Plans for a Gentoo/LoongArch port Content-Language: en-US To: gentoo-dev@lists.gentoo.org References: From: WANG Xuerui In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: c6591ebc-4c72-4666-ac66-9aab9c5758ef X-Archives-Hash: da46eecfc566987305f4aa783aa580e5 Hi Yixun, On 2021/8/12 17:55, Yixun Lan wrote: > HI Xuerui: > > This must be a *HUGE* project and gonna put lots of effort in to it! > So, first, good luck to you with all my best wishes!~ Thanks for your kindness! > > On 00:39 Thu 12 Aug , WANG Xuerui wrote: >> Hi everyone, >> >> I'm your average Gentoo user who obviously thought his sleeping time is more >> than enough, and just decided to start porting Gentoo to LoongArch. As this >> is such a niche architecture with no upstreamed support so far, I'm posting >> this to announce my intent and gather advice on how to best push this. >> >> I'll first give some background material to help people gain context, then >> describe my porting plan. This is going to be a bit long; apologizes for >> that. >> >> >> Note: I'm not affiliated with Loongson in any way; I'm just doing this in my >> spare time (once meant for some quality sleep). >> >> >> ## A bit of introduction on the LoongArch >> >> LoongArch, as its name implies, is the brand-new ISA developed by the >> Loongson Corporation, incompatible with MIPS which was implemented by >> all previous Loongson processors. Currently only the base ISA specification >> is publicly available; it has fixed-length 32-bit instructions, vastly more >> instruction formats (39 distinct formats in the base ISA alone!), and its >> instruction semantics mostly resemble RISC-V, with a bit of MIPS R6 here and >> there. It is capable of 64-bit operations, obviously. >> >> ISA documentation: https://github.com/loongson/LoongArch-Documentation >> ELF psABI draft: https://github.com/loongson/LoongArch-Documentation/pull/3 >> >> The draft ABI is undergoing fierce review, and is subject to change, >> especially the relocation types. Other parts like the register >> convention and >> data layout is unlikely to change much, though. >> >> There is little code upstreamed for basic software (GNU toolchain, QEMU, >> Linux and the like), but many are open-sourced already. Nevertheless, the >> code quality is still very much inferior, and much of it is obviously based >> on respective MIPS support. There is continuous debate inside and outside >> Loongson on this matter, too. >> > Didn't do any investigation, but if I read correctly, also see here [1] > > The fundamental pieces of softwares are open-sourced but *NOT* yet upstreamed > So, I'd say, let's wait till it's actually accepted by upstream, > before pushing to downsteam (Gentoo here). Sure, you're free to send > a pull-request for review/comment, but collect peices under your own overlay > would be a good idea ( in my humble opition ). Sure; that's basic etiquette. However there are some parts that definitely need upstreaming, otherwise complexity could explode; for example, the multilib_env function and tc-ninja_magic_to_arch function. Without fixing multilib_env we could only use the "default" ABI, and without adapting tc-ninja_magic_to_arch even linux-headers is unable to build. If we don't touch the upstream repo, a full fork is needed, and that's going to be painful. Additionally, I've already seen adaptations for experimental arches in repo; so I thought upstreaming these minimal bits would be acceptable. If that's deemed too early (and I totally understand the reasoning behind that), doing work in forks is okay from my side.