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 F3EF8C4332F for ; Sat, 19 Nov 2022 12:55:19 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+/SQbvVQmaP9rkOLx/5XhbmXtZ5EKdLP/fsRYmNtV4c=; b=hVB6bhTDigHCdllxda/oCWZ7Qj UnkUk4p2u4L7CQSTuScBELDENxq/hTd43XCDPx4MgoGpu1YRInINK6Q6flo+BxjqRjaJRztQuHdQW kc5I+J2gQwkptU754KwfhJ7cPrunoyeAXZ3gnenkjt9wobmfYt6L410InT5oIIe/NDr6Edhe4go2G ksI6m+n52pwYWomsWAsTSBdqBrdM05ow3FWZ0Mnwa8WKRPBmIU/C9lCYGfef3uQOZbHG5R6uX/VSf G5DB2UGNS3K07HBHL+3jMUmr02/8U11qkeGpMZIbWoe/Z3kfMTAEfRJu2XEjjwOKAsBW5j+LMISU1 zAweX8wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1owNMG-00Dou8-EN; Sat, 19 Nov 2022 12:54:08 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1owNME-00Doto-54 for linux-arm-kernel@lists.infradead.org; Sat, 19 Nov 2022 12:54:07 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 74D646098A; Sat, 19 Nov 2022 12:54:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD73C433D6; Sat, 19 Nov 2022 12:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668862444; bh=vioAvYwfiaLZn2wwZZq6HjQqCvgo19zaYRMDjhkRB4U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LGoMvRluIE3TsL7CDUqe2tLxyTeVvN3GQABrBDYTnvZuErTa3wLMUUl68KOrer/Rn 371Kg+wQf9fJ7ngdBDRRg2pMLLdd6fUKDTsLmtowCxh2l6IxlKkLZ8GDSShAELXhqV iYvkpo9sQCJJmy8I8hrLBkzaMKW+hsLlUftPYjda7krJXVNyHZqtuWkRsfgggbc4qn UNHyk3gJrcU36H2XFwk2LvLwznlSBH3VObVUzJz9vltv3oGEdeK10PGnsW+7gzy0uc mLxzA0Q2FnP5AQ0EHSh99UAcnemd9FlZQOryYtjBWMkEX2zoEtT4qeDp9i6thZs5tL oJvTPVIps2E2A== Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1owNMA-007EQZ-H7; Sat, 19 Nov 2022 12:54:02 +0000 MIME-Version: 1.0 Date: Sat, 19 Nov 2022 12:54:02 +0000 From: Marc Zyngier To: Reiji Watanabe Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Ricardo Koller Subject: Re: [PATCH v4 12/16] KVM: arm64: PMU: Allow ID_DFR0_EL1.PerfMon to be set from userspace In-Reply-To: References: <20221113163832.3154370-1-maz@kernel.org> <20221113163832.3154370-13-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <6b70f8fac8b2fd316b618c3c2e67e07b@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: reijiw@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, oliver.upton@linux.dev, ricarkol@google.com 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-20221119_045406_325275_D5962CD3 X-CRM114-Status: GOOD ( 21.37 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-11-19 05:52, Reiji Watanabe wrote: > Hi Marc, > > On Sun, Nov 13, 2022 at 8:46 AM Marc Zyngier wrote: >> >> Allow userspace to write ID_DFR0_EL1, on the condition that only >> the PerfMon field can be altered and be something that is compatible >> with what was computed for the AArch64 view of the guest. >> >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/kvm/sys_regs.c | 57 >> ++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 56 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c >> index 3cbcda665d23..dc201a0557c0 100644 >> --- a/arch/arm64/kvm/sys_regs.c >> +++ b/arch/arm64/kvm/sys_regs.c >> @@ -1070,6 +1070,19 @@ static u8 vcpu_pmuver(const struct kvm_vcpu >> *vcpu) >> return vcpu->kvm->arch.dfr0_pmuver.unimp; >> } >> >> +static u8 perfmon_to_pmuver(u8 perfmon) >> +{ >> + switch (perfmon) { >> + case ID_DFR0_PERFMON_8_0: >> + return ID_AA64DFR0_EL1_PMUVer_IMP; >> + case ID_DFR0_PERFMON_IMP_DEF: >> + return ID_AA64DFR0_EL1_PMUVer_IMP_DEF; > > Nit: Since IMP_DEF is 0xf for both PMUVER and PERFMON, > I think the 'default' can handle IMP_DEF (I have the same > comment for pmuver_to_perfmon in the patch-10). It sure can, but IMP_DEF is special enough in its treatment (we explicitly check this value in set_id_dfr0_el1()) that it actually helps the reader to keep the explicit conversion here. > >> + default: >> + /* Anything ARMv8.1+ has the same value. For now. */ > > Nit: Shouldn't the comment also mention NI (and IMP_DEF) ? > (I have the same comment for pmuver_to_perfmon in the patch-10) I can expand the comment to include NI. > Otherwise: > Reviewed-by: Reiji Watanabe Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel