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 561B7C64EC4 for ; Wed, 8 Mar 2023 08:12:11 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aw6WR+tT0mwqhsbiOjrylBNW0tjzTlL91DQWKTJFznA=; b=gslZvCzaZmuVzx 4Nxfq1w3YH09VzvzfS5yHzcgY+ZmHTduIA1pn9ZecjtyuFgWz2Y040rbAyUmW3yjhv+6bitQFx/LW QkJfLmFDKzrTK56VhevtdaR94k884LxR1Ei4H/CnUiA4/Gdavm1B73QUdqQSAaXFqJyyESyf/9RgP Ag7vYIOYbB8OgoLWXP1oqS+QdmX0TsXkvxgviJq7aMT16w8L5m9fjhMKI6Pxvpz94mxA9vx7AQgrs PP2DnHyIfJpF2U9vDU7pZRv++lgEfDXJDVsJTFs6RUCB8LRIW8uG2UP0NUPnWLL7Emhnpmnz6t4YE LZle/LotMeeurcoh8LZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZotD-003ugv-Jc; Wed, 08 Mar 2023 08:11:11 +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 1pZot7-003uei-Hi for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2023 08:11:10 +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 9DBB8113E; Wed, 8 Mar 2023 00:11:38 -0800 (PST) Received: from [10.162.42.11] (unknown [10.162.42.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 216043F71A; Wed, 8 Mar 2023 00:10:52 -0800 (PST) Message-ID: Date: Wed, 8 Mar 2023 13:40:50 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v2] arm64/sysreg: allow *Enum blocks in SysregFields blocks Content-Language: en-US To: Mark Rutland , linux-arm-kernel@lists.infradead.org Cc: broonie@kernel.org, catalin.marinas@arm.com, maz@kernel.org, will@kernel.org References: <20230306114836.2575432-1-mark.rutland@arm.com> From: Anshuman Khandual In-Reply-To: <20230306114836.2575432-1-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230308_001105_686178_45C79EB6 X-CRM114-Status: GOOD ( 26.70 ) 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 3/6/23 17:18, Mark Rutland wrote: > We'd like to support Enum/SignedEnum/UnsignedEnum blocks within > SysregFields blocks, so that we can define enumerations for sets of > registers. This isn't currently supported by gen-sysreg.awk due to the > way we track the active block, which can't handle more than a single > layer of nesting, which imposes an awkward requirement that when ending > a block we know what the parent block is when calling change_block() > > Make this nicer by using a stack of active blocks, with block_push() to > start a block, and block_pop() to end a block. Doing so means that we > only need to check the active block at the start of parsing a line: for > the start of a block we can check the parent is valid, and for the end > of a block we check that the active block is valid. > > This structure makes the block parsing simpler and makes it easy to > permit a block to live under several potential parents (e.g. by > permitting Enum to start when the active block is Sysreg or > SysregFields). It also permits further nesting, if we need that in > future. > > To aid debugging, the stack of active blocks is reported for fatal > errors, and an error is raised if the file is terminated without ending > the active block. For clarity I've renamed the top-level element from > "None" to "Root". > > The Fields element it intended only for use within Sysreg blocks, and > does not make sense within SysregFields blocks, and so remains forbidden > within a SysregFields block. > > I've verified using sha1sum that this patch does not change the > current generated contents of . > > Signed-off-by: Mark Rutland > Cc: Anshuman Khandual > Cc: Catalin Marinas > Cc: Marc Zyngier > Cc: Mark Brown > Cc: Will Deacon > --- > arch/arm64/tools/gen-sysreg.awk | 95 ++++++++++++++++++++------------- > 1 file changed, 58 insertions(+), 37 deletions(-) > > This is a preparatory patch for BRBE support, as the BRBE series will > add a bunch of SysregFields with Enums. I'm sending this on its own as I > think it's a useful improvement/cleanup of the sysreg code regardless. This patch is indeed helpful for the upcoming BRBE V9 series which moves to define all the BRBINF_EL1 register fields via this new 'SysregFields' construct. This patch works as expected. Reviewed-by: Anshuman Khandual _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel