Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2735956rdb; Wed, 4 Oct 2023 09:52:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFag/j3WMgRNW+xye1ULkPulgJfMnaBN7LLM5Jn5mYW5/n++WfyCUgGJ04FN49ArcBqmEI+ X-Received: by 2002:a05:6a21:328b:b0:15e:986:d92b with SMTP id yt11-20020a056a21328b00b0015e0986d92bmr3222399pzb.16.1696438327498; Wed, 04 Oct 2023 09:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696438327; cv=none; d=google.com; s=arc-20160816; b=YgK/A8GPDVyECyCAfbssAgVmwex6NW0HWSEjRgehKq/5OautuuIkMt5ym3l8/Q7Wj6 cTZD8s+TJ6FKSsavrNN9NQRpEC7wBKJanfhjxakWV5/1ttLJ2R9z+hGFcDOsdeJsaTeV dRFEUoJz9Rx2VGjVB7MT5VtnUTwTCEboj5QzDdaVGF47M8vebo6AL1trB9i59y08qR3e ervhTEzQ5L4eRZTdEzns+mWliHRQl9q7IVGtbqC/uArrBkHJ5uSvV6ObHI3nm18J78JW fEadczQufsEVgtLiKN3WfE0+JrjQcSJ5+Jy7atrs+4OOUUNZUQ+P3o9f13rbDu6HvrCx AMQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=Dg0gXcHJL2cZO6En5XC9LuGztjBjBD7+IjaCwkk5jxo=; fh=eOziKcNq06JwcHeIsHUzECVtKTDzbs0glotKcUnQVv4=; b=fULdQ+b1tEu5HSiMRee2elVN+sXM+kcA4szSdUgtfi7CbC7RGuzzPEXRT+5l+JToCL +NzZE1i23d/G+XKO7As125pecuhU9OoouokpnCU8ZRhiYwv5Q0rOLGw3nb0n2prqLIW5 7dAu9jUz+g3yhiTY6DYhHb8Ro7L20D5IIgffMgWsrwr55/FK1nCSMXa+OUPgG/A5Mkqr VSWtTT8s7f9TivoYj4YGkV+KrWUeI7oOkumS3DmIPJfask1BFKFFiPOpvGe3a4J63w64 /kYr1LfCcuoG6TLLIxLHlQCaNBtqVgXTRqP5NeARpnc46jJCMCeaQP1gxn3ZfdVdxqD2 leWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=av2hGOlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id w8-20020a170902e88800b001c746b986e2si4212317plg.346.2023.10.04.09.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 09:52:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=av2hGOlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1873483731AA; Wed, 4 Oct 2023 09:52:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243410AbjJDQv4 (ORCPT + 99 others); Wed, 4 Oct 2023 12:51:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233485AbjJDQvz (ORCPT ); Wed, 4 Oct 2023 12:51:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29819B for ; Wed, 4 Oct 2023 09:51:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B86C433C8; Wed, 4 Oct 2023 16:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696438311; bh=8Q4QopUgWo8aKbA+HXXLKdUEg6EbLI8JyQNYO6KZYoE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=av2hGOlj3qAsSnrueTTJhKBE6PxCl//Zeuh3VoO/XfdvnzQf4ElpbWiVioyKym912 2wNq2wRpALOw0C4+aFyLNXq1+E5/t5PjmVOWgYZUYqHxnWdx3OlItAMIbZPzcxnayy i+s7LRfYPiJM/UtUqeO2b0ZhixyI/nUolKM0t6Oyw61eAHZ900r7+sXn2I7lny412q PsyaDz/Ey6ecMa6rWEmf0UkUTrpFiWMkbVf8U8ITB4ErYK5MrXNkii0ZiUX7aCNfQL rpMrDNVxi09+zgmQJUObmc/ljp6wvb34uzkDksZOfi+m38zyudH5I/EmRuhmdaegEW b6o8l7E2kjLGA== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: =?utf-8?Q?Cl=C3=A9ment_L=C3=A9ger?= , Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: =?utf-8?Q?Cl=C3=A9ment_L=C3=A9ger?= , Atish Patra , Andrew Jones , Evan Green , =?utf-8?Q?Bj=C3=B6rn?= Topel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Ron Minnich , Daniel Maslowski , Conor Dooley Subject: Re: [PATCH v2 1/8] riscv: remove unused functions in traps_misaligned.c In-Reply-To: <20231004151405.521596-2-cleger@rivosinc.com> References: <20231004151405.521596-1-cleger@rivosinc.com> <20231004151405.521596-2-cleger@rivosinc.com> Date: Wed, 04 Oct 2023 18:51:48 +0200 Message-ID: <877co2gwkb.fsf@all.your.base.are.belong.to.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 09:52:06 -0700 (PDT) Cl=C3=A9ment L=C3=A9ger writes: > Replace macros by the only two function calls that are done from this > file, store_u8() and load_u8(). > > Signed-off-by: Cl=C3=A9ment L=C3=A9ger > --- > arch/riscv/kernel/traps_misaligned.c | 46 +++++----------------------- > 1 file changed, 7 insertions(+), 39 deletions(-) > > diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/tra= ps_misaligned.c > index 378f5b151443..e7bfb33089c1 100644 > --- a/arch/riscv/kernel/traps_misaligned.c > +++ b/arch/riscv/kernel/traps_misaligned.c > @@ -151,51 +151,19 @@ > #define PRECISION_S 0 > #define PRECISION_D 1 >=20=20 > -#define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type, insn) \ > -static inline type load_##type(const type *addr) \ > -{ \ > - type val; \ > - asm (#insn " %0, %1" \ > - : "=3D&r" (val) : "m" (*addr)); \ > - return val; \ > -} > +static inline u8 load_u8(const u8 *addr) Really a nit, and applies to the whole file: "static inline" in a .c file is just useless. > +{ > + u8 val; >=20=20 > -#define DECLARE_UNPRIVILEGED_STORE_FUNCTION(type, insn) \ > -static inline void store_##type(type *addr, type val) \ > -{ \ > - asm volatile (#insn " %0, %1\n" \ > - : : "r" (val), "m" (*addr)); \ > -} > + asm volatile("lbu %0, %1" : "=3D&r" (val) : "m" (*addr)); Why do you need early clobber here? Bj=C3=B6rn