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 DBF19C021AA for ; Wed, 19 Feb 2025 19:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NjYUiQEVRnh+LEW1joDithnJdGu+7HBvyyYwmr3syVc=; b=p/1//BCenxV5HuVG9mQvWBXqLf KgAe5IDnWwvVocmOy+L/KZ4DarVGO2wpieqxXzI+SLVDJYjfyT/4XSlGrA03bcDkL/seX7QzH5Ke/ jIVgCIrWry1504yoeqw05rg0cTGP/+e0oKCAidvpjELUA+oGKvFEQWl+WRdm56SJj2Smolln4Qe5T kpTvcoNvw3veuJ7RgKIlksiRF9KtwLV1o8Wr/TExMMCGfWwsTLd6zOxdo2+++3Z5au+/vDD/JzdXT 7L3Rzetkl09w8bff7LOBeWzqYY8xgAqMacTtwOmIWCXwZVQHzpbeskIP8J2wci8ZrjcB4YWA807R7 SS4oJY9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tkq6N-0000000Ek4W-3d1C; Wed, 19 Feb 2025 19:51:23 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tkpqi-0000000EfM9-0Esu for linux-arm-kernel@lists.infradead.org; Wed, 19 Feb 2025 19:35:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id BCCCD6111F; Wed, 19 Feb 2025 19:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD18AC4CED1; Wed, 19 Feb 2025 19:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739993710; bh=Fn3wSAWM9ieh5UpaveCtIUFgMyNxAkN0r0CDO0Ag7jA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IJQiBSs/OxkI/b/fg3rkPfPtMCLTTVv1+aG2xhowPUN9D3oLnDGftbbGSRQhDcK7u ZcLPs7QbUi6hex3dZHv8ZcTTuYKe43MQKKJEJWI6m0L3rWuOoNs19gDePjWsUlv9IK 4K1LrljQSvq2sWmYBMnJi78pR2ljKq5KuEn276r+zUpVGwHckYGN+eBBfGWyyxB9WW dy+lPHI0chP9BpNAf8WDxzQvRHBCHdsmYSjLZRRUniZ73Y0JyFgip+ImP0B+4vsZdi uQnRrAP+xenUMjLuMYizDAacCwiWVMd2z3BWAyMj2XCfTToNKZ76q1Jhu5+GoFRkh/ c0S8kF2n00l1Q== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tkpqe-005wOm-Se; Wed, 19 Feb 2025 19:35:08 +0000 Date: Wed, 19 Feb 2025 19:35:08 +0000 Message-ID: <86zfihramr.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, Joey Gouly , Suzuki K Poulose , Zenghui Yu , Mingwei Zhang , Colton Lewis , Raghavendra Rao Ananta , Catalin Marinas , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Janne Grunau Subject: Re: [PATCH v2 07/14] KVM: arm64: Use a cpucap to determine if system supports FEAT_PMUv3 In-Reply-To: References: <20250203183111.191519-1-oliver.upton@linux.dev> <20250203183111.191519-8-oliver.upton@linux.dev> <864j0psuas.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, mizhang@google.com, coltonlewis@google.com, rananta@google.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, j@jannau.net X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250219_113512_156312_CD3139BF X-CRM114-Status: GOOD ( 17.80 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 19 Feb 2025 19:22:56 +0000, Oliver Upton wrote: > > On Wed, Feb 19, 2025 at 05:44:59PM +0000, Marc Zyngier wrote: > > > +static bool has_pmuv3(const struct arm64_cpu_capabilities *entry, int scope) > > > +{ > > > + u64 dfr0 = read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1); > > > + unsigned int pmuver; > > > + > > > + pmuver = cpuid_feature_extract_unsigned_field(dfr0, > > > + ID_AA64DFR0_EL1_PMUVer_SHIFT); > > > + if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF) > > > + return false; > > > + > > > + return pmuver >= ID_AA64DFR0_EL1_PMUVer_IMP; > > > > Given that PMUVer is a signed field, how about using > > cpuid_feature_extract_signed_field() and do a signed comparison instead? > > I'm happy to include a comment, but the PMUVer field is not signed. Any value > other than 0xF is meant to be treated as an unsigned quantity. > > DDI047L.a D24.1.3.2 is where this is coming from. Duh, you're of course correct. Ignore me. M. -- Without deviation from the norm, progress is not possible.