Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp465975lqr; Wed, 5 Jun 2024 11:00:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzSv49Dz1Tz2rr98IINiRSkGlwDFaG3/xk47AU0yA7JQxjytVXqPquEaHOGhAAEMooVp494ZUXTk9zDqU3dGRayORzzHWeXYP6KooAgg== X-Google-Smtp-Source: AGHT+IHa30QfJ3JORcSNPpy1sJvq/444kjbGkTtIjwVPX6LqLBMU/OQ7mnHTjFPy9Lb36tQKCyHO X-Received: by 2002:a05:6808:4cc:b0:3c7:498c:6b0e with SMTP id 5614622812f47-3d20425c830mr3358165b6e.1.1717610400244; Wed, 05 Jun 2024 11:00:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717610400; cv=pass; d=google.com; s=arc-20160816; b=ZZ91V8PirzN6En/p43R4UH8xWub6cEjctKPNh4qzN8tQZuV66TB8Gyyh3v2YFzhb92 UngMsZyoUVi4cq0rWJwfvoVlb5tTiJqmruSAlYKDPeL11MpoP3Q3+RT4Ci9v8cMyrJ2K OW983AKZV0i+3AgIpbKahQS/qppfsTlnozCvqCUCTJa3yCafoTs6nUO51sMbndf2JAvg 7zD9GXdwzOF8r+7EjeUTIpkLRJdQiuEIJY/yP/BdEf/eaqxW+YaUDStBefN7yHxRe18e mvfh3dSV6QqR3our1OQXGkAbFVOFeatqsjnpoqbKaI30LTV9zT3uFxRd7E290JV++izK 7VgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=eQbNsyJiikEHg1WAvMk51avkm7xFjcGfWfmf/iI4yfE=; fh=QIQjepsDV3bQFshYOuj323/HdL5kd5Pb3N9gU3djfMs=; b=iJDWU1HAuzuC5pitm3eBo+wPsuL1rJzz9mnhjduNIMpNViaM0z9VjgLRGpRvkm/j5G uREsfsqfJiAYVEuOCuEQCsfqc4nL4r0fHRAGhnaxC/ZwWwBCTGQG4He5tPbkqRo/OZIR bhNhxRdm99N84MTYO8sD5gxj7dRD77wCNE58wsMQjPuBBCAlCttsKZ1RFPW9UTAjAHj7 aEQJCVl4qO6yUNgsV5FDS8nvoVQ3dbCB7096L4oCf7jRnGYTTxqhdTxmhukGVYEEhLeh xJ0HQVG5KB1iaU47Qb/s1SjCq4mn0BRpTXVEaJ1Ztn5zonVsvPQp6gO9Ox47vpJcSHnZ uwbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g0dwlGsg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203002-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-79524ef7be2si71662985a.100.2024.06.05.11.00.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 11:00:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203002-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g0dwlGsg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203002-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203002-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E9A8D1C21740 for ; Wed, 5 Jun 2024 17:59:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F087195397; Wed, 5 Jun 2024 17:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g0dwlGsg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90DAA1A291; Wed, 5 Jun 2024 17:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610390; cv=none; b=C/TPo5kxFN7lBow6b0vjJcrSP6A407oQJoFLTg3b5wjU/zXHr9OK9+wu2LvVHklPkKu3hjtXvmoKmCTiEVPgyi+kM0pd6VOYiRZaHRdLJmF1nVdsV+y3eKQwJGlGjh1Ke5vQ90Kb7SL4Ms1IF7O/Md9SUaEF2yMFPdCUOK9cqEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610390; c=relaxed/simple; bh=yw1xSaxn6SgH1smEJJVuV2PYZu8dfMQrURfJ9oM9Uw4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XMcLg/Gn3sqN3s3CjTH+Xt7ayTifJ0CPz73cVx7FdPS/oRTVqjyP68Tfr/p7m1ZioQUbbkdx51UxUcUywlTlGo0OrNpx4qXsyf4RoPKwDIW+8RtkFTtbl7B/qOT3H96CZs7nGaV6FbQAKJrxwFcwBYssvRQd4yDq1jRPxbhQvlg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g0dwlGsg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 384DEC4AF14; Wed, 5 Jun 2024 17:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717610390; bh=yw1xSaxn6SgH1smEJJVuV2PYZu8dfMQrURfJ9oM9Uw4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=g0dwlGsgP0RR33Xs1FRfDlQdXQ80HHsGV9fi89xOToyKjifhEB2XNqE2zJ0PKnq1o TTfrY8IGrAinvQzVHqYIh9OC4XrlHB394ar51+IydvSV6VcAUtRfaL1KYkMgWQA+Zi 77AlIof90PBZqrHU1JO4UYdiBhC4+AhjhhqWWGWBJysWp++wXIjMiHwvQw/DQSxIc6 iotfxeKJBJniLVdy8Mri15mfZ5k9+O+ADb7eHqzy5AgdSsXB5pI2+0CAX2lbhpEiEs RyBCS4EgD24lGQUBNMBpttirmeQw14rrRReRedjyfj7YxhsbPQX/3+ycxEb65sB5y3 3VFaGxRpylD6g== Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2eaa80cb550so1463651fa.0; Wed, 05 Jun 2024 10:59:50 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVHlKNuQOh9be2duawM1mj5wgnOEYNY300o7DpTfTCi+IQDzjkK8Sv5jMfWA+/hBVb5OedqK+exHA2U5oh5d+lhckPXJ38pJAzbNnJc12Fk0BhuOwgFzThH4gL308ewtzVYaGSBU/jojrJRD2zfOfeY56HA6dOzMSxvxYMlSLtxwjSlMPw7rRjRlqv7S5xGIg4UCjg7mrgfGDZVXU7NuG+emWeAN1Q= X-Gm-Message-State: AOJu0Yz8vXPQSYYBdcEIgvuM+QNvGknztpeXxtNm+4xx3gciYR8K1mky rb1FrS35Fm1NDX0C3z4ZcDpE13l5xIrF7Fwd3wDuUZrPdBm9AKfb/lxyAjhaIbo2DozWSthS+48 6s0TjMCyktb7RGIzPrjn3QAuKQUE= X-Received: by 2002:a2e:3509:0:b0:2ea:8d54:4530 with SMTP id 38308e7fff4ca-2eac7a22291mr18413131fa.28.1717610388337; Wed, 05 Jun 2024 10:59:48 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240604224052.3138504-1-davidgow@google.com> <20240605062234.GE279426@thelio-3990X> In-Reply-To: <20240605062234.GE279426@thelio-3990X> From: Ard Biesheuvel Date: Wed, 5 Jun 2024 19:59:37 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] arch: um: rust: Add i386 support for Rust To: Nathan Chancellor Cc: David Gow , Brendan Higgins , Rae Moar , Thomas Gleixner , Ingo Molnar , Miguel Ojeda , "H . Peter Anvin" , Masahiro Yamada , Richard Weinberger , Anton Ivanov , Johannes Berg , kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-um@lists.infradead.org, rust-for-linux@vger.kernel.org, x86@kernel.org, Wedson Almeida Filho , Borislav Petkov , Dave Hansen , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" On Wed, 5 Jun 2024 at 08:22, Nathan Chancellor wrote: > > Hi David, > > Just a fly by comment on style, I don't have much to say content :) > > On Wed, Jun 05, 2024 at 06:40:50AM +0800, David Gow wrote: > > At present, Rust in the kernel only supports 64-bit x86, so UML has > > followed suit. However, it's significantly easier to support 32-bit i386 > > on UML than on bare metal, as UML does not use the -mregparm option > > (which alters the ABI), which is not yet supported by rustc[1]. > > > > Add support for CONFIG_RUST on um/i386, by adding a new target config to > > generate_rust_target, and replacing various checks on CONFIG_X86_64 to > > also probably like support CONFIG_X86_32. > > > > We still use generate_rust_target, rather than a built-in rustc target, > > in oPrder to match x86_64, provide a future place for -mregparm, and more > > easily disable floating point instructions. > > > > With these changes, the KUnit tests pass with: > > kunit.py run --make_options LLVM=1 --kconfig_add CONFIG_RUST=y > > --kconfig_add CONFIG_64BIT=n --kconfig_add CONFIG_FORTIFY_SOURCE=n > > > > An earlier version of these changes was proposed on the Rust-for-Linux > > github[2]. > > > > [1]: https://github.com/rust-lang/rust/issues/116972 > > [2]: https://github.com/Rust-for-Linux/linux/pull/966 > > > > Signed-off-by: David Gow > ... > > -ifdef CONFIG_X86_64 > > +ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),) > > These configurations are mutually exclusive, so would it look more > readable to have it be: > > > ifeq ($(CONFIG_X86_32)$(CONFIG_X86_64),y) > Or simply ifdef CONFIG_X86