From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751773AbdI0T4n (ORCPT ); Wed, 27 Sep 2017 15:56:43 -0400 Received: from asavdk3.altibox.net ([109.247.116.14]:59637 "EHLO asavdk3.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154AbdI0T4l (ORCPT ); Wed, 27 Sep 2017 15:56:41 -0400 Date: Wed, 27 Sep 2017 21:56:37 +0200 From: Sam Ravnborg To: Vijay Kumar Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, babu.moger@oracle.com, rob.gardner@oracle.com Subject: Re: [PATCH v2 2/2] sparc64: Use lzcnt instruction for fls and __fls Message-ID: <20170927195637.GB15193@ravnborg.org> References: <1506540326-9604-1-git-send-email-vijay.ac.kumar@oracle.com> <1506540326-9604-3-git-send-email-vijay.ac.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1506540326-9604-3-git-send-email-vijay.ac.kumar@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.2 cv=WJY9ZTkR c=1 sm=1 tr=0 a=Ij76tQDYWdb01v2+RnYW5w==:117 a=Ij76tQDYWdb01v2+RnYW5w==:17 a=kj9zAlcOel0A:10 a=yPCof4ZbAAAA:8 a=O2NkKeqqP5wwki6zUoQA:9 a=CjuIK1q_8ugA:10 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vijay. On Wed, Sep 27, 2017 at 01:25:26PM -0600, Vijay Kumar wrote: > For T4 and above, patch fls and __fls functions > at the boot time to use lzcnt instruction. > > Signed-off-by: Vijay Kumar > Reviewed-by: Babu Moger > --- > arch/sparc/Makefile | 1 + > arch/sparc/kernel/head_64.S | 2 ++ > arch/sparc/lib/Makefile | 3 +++ > arch/sparc/lib/NG4fls.S | 30 ++++++++++++++++++++++++++++++ > arch/sparc/lib/NG4patch.S | 9 +++++++++ > 5 files changed, 45 insertions(+), 0 deletions(-) > > diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile > index 8496a07..0763cd8 100644 > --- a/arch/sparc/Makefile > +++ b/arch/sparc/Makefile > @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare > KBUILD_CFLAGS += -Wa,--undeclared-regs > KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) > KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs > +KBUILD_AFLAGS += -Wa,-Asparc4 This change is not justified anywhere?? > > ifeq ($(CONFIG_MCOUNT),y) > KBUILD_CFLAGS += -pg > diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S > index 78e0211..1165254 100644 > --- a/arch/sparc/kernel/head_64.S > +++ b/arch/sparc/kernel/head_64.S > @@ -628,6 +628,8 @@ niagara4_patch: > nop > call niagara4_patch_pageops > nop > + call niagara4_patch_fls > + nop > > ba,a,pt %xcc, 80f > nop > diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile > index eefbb9c..72d2d8c 100644 > --- a/arch/sparc/lib/Makefile > +++ b/arch/sparc/lib/Makefile > @@ -46,3 +46,6 @@ lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o > obj-$(CONFIG_SPARC64) += iomap.o > obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o > obj-$(CONFIG_SPARC64) += PeeCeeI.o > + > +obj-$(CONFIG_SPARC64) += fls.o > +obj-$(CONFIG_SPARC64) += NG4fls.o > diff --git a/arch/sparc/lib/NG4fls.S b/arch/sparc/lib/NG4fls.S > new file mode 100644 > index 0000000..eb239aa > --- /dev/null > +++ b/arch/sparc/lib/NG4fls.S > @@ -0,0 +1,30 @@ > +/* NG4fls.S: SPARC optimized fls and __fls for T4 and above. > + * > + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. > + */ > + > + .text > + .align 32 > + > + .globl NG4fls > + .globl __NG4fls > + .type NG4fls, #function > + .type __NG4fls, #function Use ENTRY(), ENDPROC() as already mentioned. > +NG4fls: > + lzcnt %o0, %o1 > + mov 64, %o2 > + retl > + sub %o2, %o1, %o0 > + .size NG4fls, .-NG4fls > + > +__NG4fls: > + brz,pn %o0, 1f > + mov %o0, %o1 Use tabs for indent, not spaces. In this case one tab + one space. > + lzcnt %o1, %o0 > + mov 63, %o2 > + sub %o2, %o0, %o0 > +1: > + retl > + nop > + .size __NG4fls, .-__NG4fls > diff --git a/arch/sparc/lib/NG4patch.S b/arch/sparc/lib/NG4patch.S > index 3cc0f8c..1010d53 100644 > --- a/arch/sparc/lib/NG4patch.S > +++ b/arch/sparc/lib/NG4patch.S > @@ -52,3 +52,12 @@ niagara4_patch_pageops: > retl > nop > .size niagara4_patch_pageops,.-niagara4_patch_pageops > + > + .globl niagara4_patch_fls > + .type niagara4_patch_fls,#function > +niagara4_patch_fls: > + NG_DO_PATCH(fls, NG4fls) > + NG_DO_PATCH(__fls, __NG4fls) > + retl > + nop > + .size niagara4_patch_fls,.-niagara4_patch_fls Please path the remaining functions in this file with ENTRY(), ENDPROC() - in a separate patch. Sam