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 X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D895EC433ED for ; Thu, 13 May 2021 11:53:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6081F61186 for ; Thu, 13 May 2021 11:53:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6081F61186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=puYJuWg0tr+stO5tnyFK+iD5FN1XySW82aiaJfF3IhE=; b=LoBRjSGaSTXEC70ozaZzG5dYi bL5pjA6BhPifHz7k2jpC44/oNjpZEiSfL1UpelYnWssi7AosNGhANGSGWumCKQtv0s9OGCdzp9DHw 0YdwfzcSaQfp0pvU/RNgQzyZZKOr/9BO1Jul+J9QW1S+r9GQBV/FjIh+kmSGxNZD8Yyr1vUvpVkhN 9iS258MTpxSXi+8PwVPfZIi6m3/4DcNCsehRirPisxFZLZG8wFc3NK6SHXO3POKK4LVCbTEXbQMlI gTdeuolrpOri1KOd3NVe5K38UN7wdsxcpH9nFZ3qYRx6aH3UK+Jab4eq7LNN1S633MkgnRpsH+OoK Cl+Y5/84g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lh9sg-005SWW-Jp; Thu, 13 May 2021 11:51:54 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lh9sd-005SW9-EM for linux-arm-kernel@desiato.infradead.org; Thu, 13 May 2021 11:51:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=K2BVN88sAl7e4rbmMZ9wFUaBDl7WpgTmdz2a+xrKe+I=; b=VzTvsP1wjOjrfLKWQTs36h+rWZ SUn8qU1Jv49EKDsm1Nxy+qz0XE/+g5w7/mwQ2SvOP7Vy1YSLQY0yGsIfDlfDb2IBPZ9bZS3tACLDi Wo7bZrPxk9VoBazkOfha8qzTR85MBS7gXhrjPQU2F1w1TFaSakvWbgWmS+5jwCHqrjjIcgVZgh3rK OYLN/GKX+SUy2L0I2htZ/knMtzOKFs9bhDPUz8eyKJjE9ynSsOU76Frly8p2ZzzQWLj2HHyI4Pw+O 3v4F53gCuAQIiF2NLQxPu92FB/uhNEGNbPCJJHphyVTjXWTTKOzi0hgkeC4ojOjSSjBvlIiak+IqJ oJW7opvw==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lh9sa-00BDgZ-Eo for linux-arm-kernel@lists.infradead.org; Thu, 13 May 2021 11:51:50 +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 DB0CF1480; Thu, 13 May 2021 04:51:43 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.5.198]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4EA5E3F73B; Thu, 13 May 2021 04:51:42 -0700 (PDT) Date: Thu, 13 May 2021 12:51:39 +0100 From: Mark Rutland To: Anshuman Khandual Cc: Mark Brown , Catalin Marinas , Will Deacon , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64: Generate cpucaps.h Message-ID: <20210513115139.GC10886@C02TD0UTHF1T.local> References: <20210428121231.11219-1-broonie@kernel.org> <9abba2a3-ce01-1cbe-5db3-97575219efad@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9abba2a3-ce01-1cbe-5db3-97575219efad@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210513_045148_613971_08E411E5 X-CRM114-Status: GOOD ( 31.67 ) 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 Thu, May 13, 2021 at 10:35:04AM +0530, Anshuman Khandual wrote: > > On 4/28/21 5:42 PM, Mark Brown wrote: > > The arm64 code allocates an internal constant to every CPU feature it can > > detect, distinct from the public hwcap numbers we use to expose some > > features to userspace. Currently this is maintained manually which is an > > irritating source of conflicts when working on new features, to avoid this > > replace the header with a simple text file listing the names we've assigned > > and sort it to minimise conflicts. > > > > As part of doing this we also do the Kbuild hookup required to hook up > > an arch tools directory and to generate header files in there. > > > > This will result in a renumbering and reordering of the existing constants, > > since they are all internal only the values should not be important. The > > reordering will impact the order in which some steps in enumeration handle > > features but the algorithm is not intended to depend on this and I haven't > > seen any issues when testing. Due to the UAO cpucap having been removed in > > the past we end up with ARM64_NCAPS being 1 smaller than it was before. > > > > Signed-off-by: Mark Brown > > --- > > arch/arm64/Makefile | 3 ++ > > arch/arm64/include/asm/Kbuild | 2 + > > arch/arm64/include/asm/cpucaps.h | 74 -------------------------------- > > arch/arm64/tools/Makefile | 22 ++++++++++ > > arch/arm64/tools/cpucaps | 65 ++++++++++++++++++++++++++++ > > arch/arm64/tools/gen-cpucaps.awk | 40 +++++++++++++++++ > > 6 files changed, 132 insertions(+), 74 deletions(-) > > delete mode 100644 arch/arm64/include/asm/cpucaps.h > > create mode 100644 arch/arm64/tools/Makefile > > create mode 100644 arch/arm64/tools/cpucaps > > create mode 100755 arch/arm64/tools/gen-cpucaps.awk > > > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > > index 7ef44478560d..b52481f0605d 100644 > > --- a/arch/arm64/Makefile > > +++ b/arch/arm64/Makefile > > @@ -175,6 +175,9 @@ vdso_install: > > $(if $(CONFIG_COMPAT_VDSO), \ > > $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) > > > > +archprepare: > > + $(Q)$(MAKE) $(build)=arch/arm64/tools kapi > > Small nit. So going forward this new directory (arch/arm64/tools/), will > be used to hold similar scripts that generate header or similar things ? > At first the directory name 'tool' was bit confusing but seems like other > archs (arm, m68k, mips, powerpc, s390, sh) have this directory as well. Yup; there's more stuff we might want to put here in future, e.g. * Generation of (or consistency-checks) for the kernel HWCAP glue * Generation of the sysreg headers * Generation of the insn code * Generation of metadata (or consistency checks) for RELIABLE_STACKTRACE, LIVEPATCH, etc [...] > > +BEGIN { > > + print "#ifndef __ASM_CPUCAPS_H" > > + print "#define __ASM_CPUCAPS_H" > > + print "" > > + print "/* Generated file - do not edit */" > > + cap_num = 0 > > + print "" > > +} > > + > > +/^[vA-Z0-9_]+$/ { > > Small nit. Should this be length restricted at the least ? > Like each CAP entries should not exceed a certain length. I don't think we should enforce a length limit in the script, as we'd have to select an arbitrary limit, and given we should catch exceedingly long names during review, I think it's more likely to be a hindrance than a help (e.g. if we ever bump up against that limit). > > + printf("#define ARM64_%-30s\t%d\n", $0, cap_num++) > > + next > > +} > > + > > +END { > > + printf("#define ARM64_NCAPS\t\t\t\t%d\n", cap_num) > > + print "" > > + print "#endif" > > Small nit. Should it be print "#endif /* __ASM_CPUCAPS_H */" instead > in order to be complete. Agreed; that would be nice. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel