From patchwork Mon Nov 28 13:56:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 26784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5693464wrr; Mon, 28 Nov 2022 06:08:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4LGzlxeqQ2iNc+CZJ6DH2OA1n8PHwNbHAPO3XL1qDTfKm+wu65btwQA7DdTno8KIKDVPUA X-Received: by 2002:a17:907:8c81:b0:7bf:5cc5:67c5 with SMTP id td1-20020a1709078c8100b007bf5cc567c5mr5422386ejc.488.1669644533627; Mon, 28 Nov 2022 06:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669644533; cv=none; d=google.com; s=arc-20160816; b=fYFMlPBrizgrO94N3u3bGrx5JBmxmCzfUcPPztV/Hlhm/Kz6lKMxD1ZkMg9i1JKhXu G73qzfmKvkUIv1qGF9av1MtfwLEynu0mCL5xw8p9bA4eVegKbG2tn4737Y+76isVml9U KzDywqOkLK7O17VZwrp7RYgoEdmehZHgmilAmdDtmly9DFA7tSWt2V38V6XuYZOR2+0/ La1AjNq8irvv7fVwUPzNwuujPPau5n7S3O2xqyHw0wgumY6tW7RakqGNDQ2ECHyKkBy/ eIIrW/w9jrLTscia3vq0vPLG81rhZodb58uVFWwDNuNhP4pRA7X9vtwKZcT1TnrfvqFr rZOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=p33VIguMLW50mQ0akSmyHvU00n7FkxKdKTJitG5FQRI=; b=AA99OARCB+9onPPXKsAKDH4Oglst8PQ4MJa7+psNTST1yNBft1GU9Luyn7Nh9RiaA7 cBEtKjHBaQ6s9T5w2X2UOwLhQZLk30EXrOhhjW3C69OUcmfHkqV92hFf+qmTVzbOpa51 WEF0gWM0PES6bM3J13ar6DPMUFrYg/mzpuyVWnM2WllyBy9cJzYcjMPru0/GX7cIvOup RpwYR9zS/bzxkbh8xbxicufse//3TY5bXnbiMJrglL/ZnmCmb12H7nqLrqHXtGCgw9aK dwedCjGrkX/5IXLx38u/tuf0NJcoEbhz+XXMt+cwJaQjWCG+AhMClgSqay7DXxVhTXQy cTuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x20-20020a05640226d400b0046ae9e1c5b2si6645116edd.200.2022.11.28.06.08.20; Mon, 28 Nov 2022 06:08:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232234AbiK1N5R (ORCPT + 99 others); Mon, 28 Nov 2022 08:57:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbiK1N4v (ORCPT ); Mon, 28 Nov 2022 08:56:51 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEE84209B1; Mon, 28 Nov 2022 05:56:42 -0800 (PST) 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 50B84D6E; Mon, 28 Nov 2022 05:56:49 -0800 (PST) Received: from a077893.arm.com (unknown [10.163.44.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8A4433F73D; Mon, 28 Nov 2022 05:56:39 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, maz@kernel.org Cc: Anshuman Khandual , Arnaldo Carvalho de Melo , Mark Rutland , Will Deacon , Catalin Marinas , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: arm64: Replace PMU version number '0' with ID_AA64DFR0_EL1_PMUVer_NI Date: Mon, 28 Nov 2022 19:26:29 +0530 Message-Id: <20221128135629.118346-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750749186347849525?= X-GMAIL-MSGID: =?utf-8?q?1750749186347849525?= kvm_host_pmu_init() returns when detected PMU is either not implemented, or implementation defined. kvm_pmu_probe_armpmu() also has a similar situation Extracted ID_AA64DFR0_EL1_PMUVer value, when PMU is not implemented is '0', which can be replaced with ID_AA64DFR0_EL1_PMUVer_NI defined as '0b0000'. Cc: Arnaldo Carvalho de Melo Cc: Marc Zyngier Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: linux-perf-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Anshuman Khandual --- This applies on v6.1-rc6 arch/arm64/kvm/pmu-emul.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c index 0003c7d37533..089a0b4c561b 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -774,7 +774,8 @@ void kvm_host_pmu_init(struct arm_pmu *pmu) { struct arm_pmu_entry *entry; - if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF) + if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI || + pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF) return; mutex_lock(&arm_pmus_lock); @@ -827,7 +828,7 @@ static struct arm_pmu *kvm_pmu_probe_armpmu(void) if (event->pmu) { pmu = to_arm_pmu(event->pmu); - if (pmu->pmuver == 0 || + if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI || pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF) pmu = NULL; }