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 25AA8ECAAA1 for ; Thu, 27 Oct 2022 17:25:46 +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=4/UHCD18eir/9hrlNzIatw+myhIZM6WXvA1FG7lR1to=; b=uko45YdwSzdpWg+tA6N/Z3a93I 33h1yeOAQAWy0P4SjbpS5MzMeWFx5eTBYWyOc8dT0FsoxBuOmHjdfwTTz52Cj9Ahxfo/Vvy/Eq8PZ vkdhFD0znCQKtBepmBb5l3k3X5pMnw3heNGzRIx9u9XdYUzLrPv/ihzVJ2lHUcec5VRgAKRpJmm7b C+ttHUPwR+FeoR1OXQVWmflJtOmwv2GicvEX2DIqaUt/IWOMwksg2+qaWljcCFJIVloFpNWAwfhVx 0KDqIfq37/0MrG8zLKr8VJ7xv2NltMwAwH+urES5VK8tA+iU1EHKZ1NP8+caV8UY2poPQ8LBO0G8U H019Lj1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo6cX-00ELsu-CM; Thu, 27 Oct 2022 17:24:45 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oo6cU-00ELrP-O5 for linux-arm-kernel@lists.infradead.org; Thu, 27 Oct 2022 17:24:44 +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 ams.source.kernel.org (Postfix) with ESMTPS id 1A4E6B826F9; Thu, 27 Oct 2022 17:24:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C88ACC433B5; Thu, 27 Oct 2022 17:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666891477; bh=5fx+7t9++1F1VmB8YaQOGyc/rEsxRR+nOp2+GO8srUM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EjbVZwgYYZ3rD5ChDt9vFEOn8hQQ3wgTRDB9mFDU451EbcSaH88wWDfiPGr5UmsOk YVGSyKHnjSjP9A887RPB+cLb8MgH0BPdhlLKckjhc4Mds6EAqiyzBCz71cQCDwBvV3 1Q1ic228xwN/tKvuuJanwb+boD5U8hK74sVNLSjxFrKSAkRrVfqKHZhz0DVRMn3+q8 ot5npOmonBSKZBDzEQd41RrrUhDFMvxJ3BiYUY3ejUWjesEBHjfOFlj2tGZiUuEvIk oQ6BnVNdjF6p3aBL7UKjEEl7j0g9PEDK/NCnifKatFvZTOUhBen+KLdWEn8+viUBVY 8O8VHgrSLlwaQ== 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 1oo6cN-0023RF-JP; Thu, 27 Oct 2022 18:24:35 +0100 MIME-Version: 1.0 Date: Thu, 27 Oct 2022 18:24:35 +0100 From: Marc Zyngier To: Reiji Watanabe Cc: Linux ARM , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 6/9] KVM: arm64: PMU: Move the ID_AA64DFR0_EL1.PMUver limit to VM creation In-Reply-To: References: <20220805135813.2102034-1-maz@kernel.org> <20220805135813.2102034-7-maz@kernel.org> <86k04mejd0.wl-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <989ec7a63aff44e5fe2d85f691a7f330@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, kvm@vger.kernel.org, kernel-team@android.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-20221027_102442_957763_5F114AD6 X-CRM114-Status: GOOD ( 16.32 ) 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-10-27 17:09, Reiji Watanabe wrote: >> I think that with this patch both PMUVer and Perfmon values get set to >> 0 (pmuver_to_perfmon() returns 0 for both ID_AA64DFR0_PMUVER_IMP_DEF >> and no PMU at all). Am I missing anything here? > > When pmuver_to_perfmon() returns 0 for ID_AA64DFR0_PMUVER_IMP_DEF, > cpuid_feature_cap_perfmon_field() is called with 'cap' == 0. Then, > the code in cpuid_feature_cap_perfmon_field() updates the 'val' with 0 > if the given 'features' (sanitized) value is > ID_AA64DFR0_PMUVER_IMP_DEF. > So, now the val(== 0) is not larger than the cap (== 0), and > cpuid_feature_cap_perfmon_field() ends up returning the given > 'features' > value as it is without updating the PERFMON field. Ah, thanks for spelling it out for me, I was definitely looking at the wrong side of things. You're absolutely right. The code I have now makes sure to: (1) preserve the IMP_DEF view of the PMU if userspace provides such setting (2) directly places the emulated PMU revision in the feature set without calling cpuid_feature_cap_perfmon_field(), which indeed does the wrong thing. Hopefully I got it right this time! ;-) Thanks again, 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