From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11E4DC0032E for ; Fri, 20 Oct 2023 18:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/d3j0mXYanoS9OoxIQH+iSZ2pAnWrevAP2wlOhCljyo=; b=0f14kWDhOHIMMH vUo7lUwoFEApWC0RnP4cuuhdEU6jSdNtyoAjUlGvpj4FncbX7bUkgivHI4xk4pRV/+8A5k6fMtlx4 Sv/omTa+TnZTn6uj/CozMmH9warrq7PNzraOwIV5OxqXljzutDp6Bwbehciwbhr1UsTOhpH/QqpWL f/IoJkbz72YSjiktCEwJenm6RJNWqkS1H/7xa2KQIAtVJHxADqjAJgRthv+DE8yVYnuAjOwlA1mgF yeFLnBNqSwY0ICeaCeot56drCAqs4FZaAZkfa+74QyZtQTwWe6JbpcxR8nUHHhobJaCzvsX1HscCy yG56iVsTnhb3knwpH/RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtuJe-002rWi-17; Fri, 20 Oct 2023 18:33:46 +0000 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtuJb-002rWH-25 for linux-arm-kernel@lists.infradead.org; Fri, 20 Oct 2023 18:33:45 +0000 Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-66d12b3b479so6655436d6.1 for ; Fri, 20 Oct 2023 11:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697826820; x=1698431620; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=8cj7GMM7RLClKlHfnFK4kXZdb0+sWcPsNsBicOEASd0=; b=EHF2RxOv0oaPr/teIU/he+f49uPWmqMU7v86OWwp9s/P8ocxI+KznnJkHuh4m+zayT peB9fs0nATi4QWZ+11z0d4AexO+bTla6NXHxxdKSrjFZ804+ulsNry8QasOZXEnTtOqv AxO8VL02TsN5tXPGlwY5q0wXJjrfHUtH/URmXxFyXLEkWlaAQLhrxgcEVu9DozJmXBtu arJADOXq8DW6DN5+2rA37eT1IiXplGG8Iv6jCjIQNebnpJZVv4Y8IMMK71pa1wr23DfQ DqAFV4q4FbGuCR0DFRJymrkxYIw1h43gnaRmJtxrVVhXTf45Lao9wZELo9mT0LSAvP6U G5GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697826820; x=1698431620; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8cj7GMM7RLClKlHfnFK4kXZdb0+sWcPsNsBicOEASd0=; b=EYxB9hq5mlm5qcD7zLOTrLjHk0D30tJE8p7qkvb92JiqY6/kNgbFk6Sainqr89x7Pu utZAvJovp0WbMBI/TvEwq19dwbwVcetRr4b22knPRgTxGTWL3saUbR+vW/qXbvGTm6iT cQ/EF+a39rifb6qvbffkgzIogYsbEsEX1LMQWFzAjVWrKgNBpYScBjx+rvjKYdGJuMMm FVmTHCctsxMcgKrjF01geoYzm2H7Rgw+521wFtkSNSFjAL89OpuZbdK/CWmncJ75HOWw TyQVb4DtvhdFCVmBx9EHoKBpvjDKflr8R/LbUNiG6h/LhaHQcbMAkSMCMXg2oMU1X8HO LxAg== X-Gm-Message-State: AOJu0YxyzfLiBCMEe9QwFj9JTWwDNubKlEEFr9rC9llybnjOEtSJQ230 YG1yggNWt32OhtNYVpGXFV8= X-Google-Smtp-Source: AGHT+IHmKRqg3V73KQWHnpwBwu3Z6Fm3ew8wL9QAJvTqJVm2nI/O6b3sx8HX+C8Hm6WnPkMj+GgV5Q== X-Received: by 2002:a05:6214:2aa6:b0:64f:92af:9080 with SMTP id js6-20020a0562142aa600b0064f92af9080mr2653671qvb.21.1697826820229; Fri, 20 Oct 2023 11:33:40 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id w5-20020a0cf705000000b0066d1d2242desm873943qvn.120.2023.10.20.11.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 11:33:39 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 4DC6427C0054; Fri, 20 Oct 2023 14:33:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 20 Oct 2023 14:33:39 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjeekgdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeehudfgudffffetuedtvdehueevledvhfelleeivedtgeeuhfegueeviedu ffeivdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdei gedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfih igmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Oct 2023 14:33:38 -0400 (EDT) Date: Fri, 20 Oct 2023 11:33:10 -0700 From: Boqun Feng To: Andrew Lunn Cc: Jamie Cunliffe , linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org, Miguel Ojeda , Catalin Marinas , Will Deacon , steve.capper@arm.com, Asahi Lina , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: Re: [PATCH v4 2/2] arm64: rust: Enable Rust support for AArch64 Message-ID: References: <20231020155056.3495121-1-Jamie.Cunliffe@arm.com> <20231020155056.3495121-3-Jamie.Cunliffe@arm.com> <3cc3b66d-7190-477c-af04-a5d06a0d50fe@lunn.ch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3cc3b66d-7190-477c-af04-a5d06a0d50fe@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_113343_727185_2571179B X-CRM114-Status: GOOD ( 17.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 20, 2023 at 07:21:08PM +0200, Andrew Lunn wrote: > > +``arm64`` Maintained Little Endian only. > > This question is just out of curiosity, not the patchset itself. > > What is missing to make big endian work? > FWIW, I tried the following: diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8784284988e5..b697c2d7da68 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -227,7 +227,7 @@ config ARM64 select HAVE_FUNCTION_ARG_ACCESS_API select MMU_GATHER_RCU_TABLE_FREE select HAVE_RSEQ - select HAVE_RUST if CPU_LITTLE_ENDIAN + select HAVE_RUST select HAVE_STACKPROTECTOR select HAVE_SYSCALL_TRACEPOINTS select HAVE_KPROBES diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 4562a8173e90..4621f1e00e06 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -41,7 +41,11 @@ KBUILD_CFLAGS += -mgeneral-regs-only \ KBUILD_CFLAGS += $(call cc-disable-warning, psabi) KBUILD_AFLAGS += $(compat_vdso) +ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) +KBUILD_RUSTFLAGS += --target aarch64_be-unknown-linux-gnu -C target-feature="-neon" +else KBUILD_RUSTFLAGS += --target aarch64-unknown-none -C target-feature="-neon" +endif KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) and ran the following kunit command (it will run a few tests in a qemu emulated VM): ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch arm64 --kconfig_add CONFIG_RUST=y --kconfig_add CONFIG_CPU_BIG_ENDIAN=y The kernel was built successfully, and all Rust related tests passed. Of course this doesn't mean a lot, we still need people with deep Rust compiler knowledge to confirm whether the support is completed or not. But I think if people want to do experiments, the tool is there. P.S. An unrelated topic: I found a few clk related tests (in drivers/clk/clk-gate_test.c IIUC) don't pass (mostly due to that the expected values don't handle big endian), a sample failure output: [11:13:26] # clk_gate_test_enable: EXPECTATION FAILED at drivers/clk/clk-gate_test.c:169 [11:13:26] Expected enable_val == ctx->fake_reg, but [11:13:26] enable_val == 32 (0x20) [11:13:26] ctx->fake_reg == 536870912 (0x20000000) [11:13:26] clk_unregister: unregistering prepared clock: test_gate [11:13:26] clk_unregister: unregistering prepared clock: test_parent [11:13:26] [FAILED] clk_gate_test_enable (Cc clk folks) Regards, Boqun > Network developers have expressed an interesting in testing Rust code > on big endian systems, since the code should work on both endians. It > might be easier to get an ARM board running big endian than get access > to an S390x machine. > > Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel