From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 10:18:37 2022 Received: (at 55283) by debbugs.gnu.org; 9 May 2022 14:18:37 +0000 Received: from localhost ([127.0.0.1]:59003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4Dc-0005rI-Ks for submit@debbugs.gnu.org; Mon, 09 May 2022 10:18:36 -0400 Received: from flashner.co.il ([178.62.234.194]:55840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4Da-0005r4-Se for 55283@debbugs.gnu.org; Mon, 09 May 2022 10:18:35 -0400 Received: from localhost (unknown [37.46.46.12]) by flashner.co.il (Postfix) with ESMTPSA id AD1A7402DB; Mon, 9 May 2022 14:18:28 +0000 (UTC) Date: Mon, 9 May 2022 17:17:55 +0300 From: Efraim Flashner To: Maxime Devos Subject: Re: bug#55283: =?utf-8?B?4oCYdGVzdHMvZ3Vp?= =?utf-8?Q?x-shell-export-manifest=2Esh=E2=80=99?= fails on aarch64-linux Message-ID: Mail-Followup-To: Efraim Flashner , Maxime Devos , Ludovic =?utf-8?Q?Court=C3=A8s?= , Vagrant Cascadian , 55283@debbugs.gnu.org, raingloom References: <87ee1761ci.fsf@inria.fr> <20220506022826.5089eb2c@riseup.net> <5d219586c7a9a5ed2d89b12db73385d9d55adeb9.camel@telenet.be> <871qx68g33.fsf@contorta> <87wney6vwq.fsf@contorta> <87wnevu0x1.fsf@gnu.org> <4d2747729262ac3e3f27d7e75f1dfb50da4c7fed.camel@telenet.be> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="f2H24mQDkd8g4ZH5" Content-Disposition: inline In-Reply-To: <4d2747729262ac3e3f27d7e75f1dfb50da4c7fed.camel@telenet.be> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55283 Cc: Vagrant Cascadian , 55283@debbugs.gnu.org, Ludovic =?utf-8?Q?Court=C3=A8s?= , raingloom X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --f2H24mQDkd8g4ZH5 Content-Type: multipart/mixed; boundary="hACWaNCdaGFaTVH4" Content-Disposition: inline --hACWaNCdaGFaTVH4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 09, 2022 at 12:03:46PM +0200, Maxime Devos wrote: > Efraim Flashner schreef op ma 09-05-2022 om 11:44 [+0300]: > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (loop vendor family (string->number (string-append > > "#x" (string-drop model 2))))) >=20 > #x is for hexadecimal, right? If so, this can be simplified by using > the second argument of=C2=A0string->number: (string->number (string-drop > model 2) 16). I hadn't realized that. I took the chance to take another look at it and now it actually works, not just fills in each field with #f. I also added more chips based on gcc-12 and fixed the fallback case. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --hACWaNCdaGFaTVH4 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="guix-cpu-aarch64.diff" Content-Transfer-Encoding: quoted-printable diff --git a/guix/cpu.scm b/guix/cpu.scm index a44cd082f1..37ed6f0a18 100644 --- a/guix/cpu.scm +++ b/guix/cpu.scm @@ -62,31 +62,51 @@ (define (prefix? prefix) (lambda (port) (let loop ((vendor #f) (family #f) - (model #f)) + (model #f) + (flags (list->set '()))) (match (read-line port) ((? eof-object?) - #f) + (cpu (utsname:machine (uname)) + vendor family model flags)) + ;; vendor for x86_64 and i686 ((? (prefix? "vendor_id") str) (match (string-tokenize str) (("vendor_id" ":" vendor) - (loop vendor family model)))) + (loop vendor family model flags)))) + ;; vendor for aarch64 and armhf + ((? (prefix? "CPU implementer") str) + (match (string-tokenize str) + (("CPU" "implementer" ":" vendor) + (loop vendor family model flags)))) + ;; family for x86_64 and i686 ((? (prefix? "cpu family") str) (match (string-tokenize str) (("cpu" "family" ":" family) - (loop vendor (string->number family) model)))) + (loop vendor (string->number family) model flags)))) + ;; model for x86_64 and i686 ((? (prefix? "model") str) (match (string-tokenize str) (("model" ":" model) - (loop vendor family (string->number model))) + (loop vendor family (string->number model flags))) (_ - (loop vendor family model)))) + (loop vendor family model flags)))) + ;; model for aarch64 and armhf + ((? (prefix? "CPU part") str) + (match (string-tokenize str) + (("CPU" "part" ":" model) + (loop vendor family (string->number (string-drop model 2) = 16) flags)))) + ;; flags for x86_64 and i686 ((? (prefix? "flags") str) (match (string-tokenize str) (("flags" ":" flags ...) - (cpu (utsname:machine (uname)) - vendor family model (list->set flags))))) + (loop vendor family model (list->set flags))))) + ;; flags for aarch64 and armhf + ((? (prefix? "Features") str) + (match (string-tokenize str) + (("Features" ":" flags ...) + (loop vendor family model (list->set flags))))) (_ - (loop vendor family model)))))))) + (loop vendor family model flags)))))))) =20 (define (cpu->gcc-architecture cpu) "Return the architecture name, suitable for GCC's '-march' flag, that @@ -191,6 +211,57 @@ (define (cpu->gcc-architecture cpu) ;; TODO: Recognize CENTAUR/CYRIX/NSC? =20 "x86_64")) + ("aarch64" + ;; Transcribed from GCC's list of aarch64 processors in aarch64-cores= =2Edef + ;; What to do with big.LITTLE cores? + (match (cpu-vendor cpu) + ("0x41" + (match (cpu-model cpu) + ((or #xd02 #xd04 #xd03 #xd07 #xd08 #xd09) + "armv8-a") + ((or #xd05 #xd0a #xd0b #xd0e #xd0d #xd41 #xd42 #xd4b #xd46 #xd43= #xd44 #xd41 #xd0c #xd4a) + "armv8.2-a") + (#xd40 + "armv8.4-a") + (#xd15 + "armv8-r") + ((or #xd46 #xd47 #xd48 #xd49 #xd4f) + "armv9-a"))) + ("0x42" + "armv8.1-a") + ("0x43" + (match (cpu-model cpu) + ((or #x0a0 #x0a1 #x0a2 #x0a3) + "armv8-a") + (#x0af + "armv8.1-a") + ((or #x0b0 #x0b1 #x0b2 #x0b3 #x0b4 #x0b5) + "armv8.2-a") + (#x0b8 + "armv8.3-a"))) + ("0x46" + "armv8.2-a") + ("0x48" + "armv8.2-a") + ("0x50" + "armv8-a") + ("0x51" + (match (cpu-model cpu) + (#xC00 + "armv8-a") + (#x516 + "armv8.1-a") + (#xC01 + "armv8.4-a"))) + ("0x53" + "armv8-a") + ("0x68" + "armv8-a") + ("0xC0" + "armv8.6-a") + (_ + "armv8-a")) + "armv8-a") (architecture - ;; TODO: AArch64. - architecture))) + ;; TODO: More architectures + (utsname:machine (uname))))) --hACWaNCdaGFaTVH4-- --f2H24mQDkd8g4ZH5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmJ5IpEACgkQQarn3Mo9 g1Frzw//SdUQiTrvGcFDeJqqVWDhzx2lJrcx15t2AJK+/RvsGQBA5fGGthZahiMJ Q1kXIqfaMTTiwqL6UjqYce6Bg1BunDKVYvIx1LUNGgKv5zOIge9doUOLTKrgzTp8 Bhi3U0uPRopAXwIE/BisOuAdmA+0OOEFwq9K0rpW4uy04R4UecomDH7eG4+G2Xf8 4jqFbQJjsCLruFi8bpQhHhYGCMlK5KYrFUBHzdZh9lOVieShfnj8kYRx4E+XUFSO w+FiSU1/qGhdkLeZI0n08fJelXhTbwuHZUpP+nOwMBtthig4Qbgg3zeC7mSwc3ON h2WgzdGSuU4Ig/wlYVfh/SRU5R+KQJDb/2UiTLSX/CiLhLo0vY5wHA9ApdDNCg2l YOd2OvXsrfnPozubRZ2qpoxhcwCtFmG6EI6tWBA3mmH/9Mo7RtKR4/3AX3C4PC/w OKww4KxMSegaOIRtJjwG6MCUOTZaJ3T+36pu+LJkZkaNir0jDV4Z5a3TFriNUEaE 5nkJDbsIuHp48AzizMAH8GyGve3aPwO5hLwC7k1v9ddGyHS6T7Rtpf+u6e5ssFkb 1QDw1HNIek2lzRuRcxcNAgMJSnFLdP/GfX/1nmCXRQ+xS+ZiyfUxuObSS5Kdlzaz zv+PyxiSnB77GjYRgTYjbJMVQGPT/k7t3mMQzNZ5m3M7yxvK9FE= =O+x1 -----END PGP SIGNATURE----- --f2H24mQDkd8g4ZH5--