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 5109BC25B10 for ; Mon, 13 May 2024 05:29:04 +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=w43nvHnHxJ9fqQdrhYatjRL52OmfnyNjZh2GlfrEujY=; b=LhdPTyGMCF0FPt a0ys8M/s2B6NPAn1+sxBbbbjGjMojtP1RNQIa3OxgM7KYoOk2vDqvVX/S6eHeAzW82NCPMRQjsDhe FRLuSA23vdMAp3MKspMNcpe8/0X9eoygKDXUCQb3L/wFM+a4wRf4XXqAGfw6bBvkWlYLItZH5hjAD LCTCQ2tVCCTP3c0IomACi87Ny3MAUvfAPP89F0CwHpc++qfT5NAU2wUCh3A25PYLi4GF1QLLRZt3Q w3YobNfEsNOYZm+APIPWvIeJSdQqn3Qe+qkhiUoEaalmoijl7wZdGsiEq0li9RmadQARJTPI/oNdh uxaR226wkSDSAcpqIJ1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6OF4-0000000BkI2-0szL; Mon, 13 May 2024 05:28:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6OF0-0000000BkHW-3IEa for linux-arm-kernel@lists.infradead.org; Mon, 13 May 2024 05:28:51 +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 CA4871007; Sun, 12 May 2024 22:29:13 -0700 (PDT) Received: from [10.163.38.21] (unknown [10.163.38.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 254D13F762; Sun, 12 May 2024 22:28:44 -0700 (PDT) Message-ID: Date: Mon, 13 May 2024 10:58:53 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Content-Language: en-US To: Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, Oliver Upton , Will Deacon , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Fuad Tabba References: <20240418053804.2573071-1-anshuman.khandual@arm.com> <20240418053804.2573071-2-anshuman.khandual@arm.com> <871q73rufi.wl-maz@kernel.org> From: Anshuman Khandual In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240512_222850_901074_60A9E9A8 X-CRM114-Status: GOOD ( 10.82 ) 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 5/10/24 23:39, Mark Rutland wrote: > On Mon, Apr 29, 2024 at 07:53:14AM +0530, Anshuman Khandual wrote: >> On 4/18/24 13:09, Marc Zyngier wrote: >>> On Thu, 18 Apr 2024 06:38:03 +0100, >>> Anshuman Khandual wrote: >>>> #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ >>> >>> If you are going to rework this, can we instead use something less >>> verbose such as SYS_FIELD_GET()? >> >> Just wondering, is not FIELD_PREP() and SYS_FIELD_GET() does the exact opposite thing. >> The earlier builds the entire register value from various constituents, where as the >> later extracts a single register field from a complete register value instead. Or did >> I just misunderstood something here. > > He means use one of the SYS_FIELD_*() helpers, e.g. SYS_FIELD_PREP_ENUM(), with > which this can be: > > #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL0, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL1, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL2, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL3, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, RAS, IMP) \ > ) > > ... which is far less verbose, and much easier to read. Got it, this makes sense, will fold in the above changes and respin after the merge window. Thanks for the clarification. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel