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 DBE8BC43334 for ; Tue, 28 Jun 2022 14:10:45 +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=3faVzxskPAUPWEU44kYkdygmfZck9t7sMl8ZxzXSDXk=; b=HeXhyCUj/pLgp0 RHXo7tCJSdB+dzAWh3SZt5qy7DEdZTvKK4KkIM6/LrZpisODEM/nRCwgVpSh3ptjyIMGSAGNM7ZLZ br0tsFxNYi1D75qqcSFQY96JCEqLWSH2OkYQp5MT1aZOdXTxuyWyFnUofeqs6XVKBp8F0vygdyFZS Lnb888frg12KlSupaTtICvyp41qMg0U01OuABoTosvVyZoUuMTogVveEBVIfDiNEcVZfzeDO0hlD0 XlfpMX6/8iAXKtX0sExDSV0wckajDXzbJ8v+ZIXIn/OFNhRNbrHprLeZ77NyWGDPeKgT5W6aQ9rj7 KPdmDE3o9jHwJXlwerrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6BuN-006eZW-JH; Tue, 28 Jun 2022 14:09:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6BuK-006eYD-3w for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 14:09:38 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD922153B; Tue, 28 Jun 2022 07:09:32 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B6393F5A1; Tue, 28 Jun 2022 07:09:31 -0700 (PDT) Date: Tue, 28 Jun 2022 15:09:29 +0100 From: Sudeep Holla To: Ard Biesheuvel Cc: Linux ARM , linux-efi , Russell King Subject: Re: [PATCH] ARM: efi: Simplify arch_efi_call_virt() macro by using typeof() Message-ID: <20220628140929.do5e5ic77twmed5e@bogus> References: <20220628125938.694256-1-sudeep.holla@arm.com> <20220628134738.xqj6gu5ngbsuql2f@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220628_070936_291704_2E512058 X-CRM114-Status: GOOD ( 34.16 ) 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 Tue, Jun 28, 2022 at 03:57:38PM +0200, Ard Biesheuvel wrote: > On Tue, 28 Jun 2022 at 15:47, Sudeep Holla wrote: > > > > On Tue, Jun 28, 2022 at 03:16:26PM +0200, Ard Biesheuvel wrote: > > > On Tue, 28 Jun 2022 at 14:59, Sudeep Holla wrote: > > > > > > > > Currently, the arch_efi_call_virt() assumes all users of it will have > > > > defined a type 'efi_##f##_t' to make use of it. It is unnecessarily > > > > forcing the users to create a new typedef when __efi_rt_asm_wrapper() > > > > actually expects void pointer. > > > > > > > > Simplify the arch_efi_call_virt() macro by using typeof(p->f) which must > > > > be a pointer as required by __efi_rt_asm_wrapper() and eliminate the > > > > explicit need for efi_##f##_t type for every user of this macro. > > > > > > > > This change is done to align with implementations on other similar > > > > architectures. > > > > > > > > Cc: Ard Biesheuvel > > > > Cc: Russell King > > > > Signed-off-by: Sudeep Holla > > > > --- > > > > arch/arm/include/asm/efi.h | 3 +-- > > > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > > > > > Hi, > > > > > > > > Reference for this change [1] and in particular[2] > > > > > > > > Regards, > > > > Sudeep > > > > > > > > [1] https://lore.kernel.org/r/20220628125346.693304-1-sudeep.holla@arm.com > > > > [2] https://lore.kernel.org/r/20220628125346.693304-3-sudeep.holla@arm.com/ > > > > > > > > diff --git a/arch/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h > > > > index 27218eabbf9a..d4a405c9b4b6 100644 > > > > --- a/arch/arm/include/asm/efi.h > > > > +++ b/arch/arm/include/asm/efi.h > > > > @@ -26,8 +26,7 @@ int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md); > > > > > > > > #define arch_efi_call_virt(p, f, args...) \ > > > > ({ \ > > > > - efi_##f##_t *__f; \ > > > > - __f = p->f; \ > > > > + typeof(p->f) __f = p->f; \ > > > > __f(args); \ > > > > }) > > > > > > > > > > I think this could simply be > > > > > > #define arch_efi_call_virt(p, f, args...) ((p)->f(args)) > > > > > > no? > > > > Yes, I came to similar conclusion just after sending this out as I started to > > look if we can have one generic definition for arm/arm64/riscv/loongarch. > > > > Not really - arm64 has the asm wrapper, and loongarch is only halfway > merged so I'm not sure yet if this is the final form. > Aargh! arm64 was typo, indeed arm64 has wrapper. I meant to refer other 3 archs. > > I am yet to figure out how asm/efi.h and linux/efi.h are included so that > > we can have generic definition in linux/efi.h and x86 can undefine that > > and redefine its own version. > > > > Does that make sense ? > > > > I appreciate the effort, but for now, let's just fix the ones we need > to fix (and the ARM one too while we're at it). PRM can only be > enabled on x86 and arm64 anyway. True. OK then I will just update ARM version and leave loongarch as is. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel