From patchwork Sat Aug 19 04:39:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 13358501 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 394A0EE49A9 for ; Sat, 19 Aug 2023 04:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242875AbjHSEkg (ORCPT ); Sat, 19 Aug 2023 00:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242866AbjHSEkE (ORCPT ); Sat, 19 Aug 2023 00:40:04 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C8BA7 for ; Fri, 18 Aug 2023 21:40:03 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-583312344e7so22476997b3.1 for ; Fri, 18 Aug 2023 21:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692420002; x=1693024802; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=D2rf4521dR3zfDVxwsUnaZ4b3GIZAWIZe5mix3E7tmw=; b=qJS+3BP7OJziky4Ud3VEiJCDjUq1/v8p2/3so871pbftG1o6VhLmHaKAvxvc/L0/lL RvCeLG/sgdDmxuip/JLrWp8B5ZiIpGuDZEPzkKvGL7Wg3vYk6L9uI6IuPq4l5LgLmXfh kHGTifVOEVrb/wXei6Jui/bmc3s7YTqeQ3iYB4FfHQuFRL/6SeEAyyfKS00ArXonMIYv yjG0yYi24sKXP7HhYV217lmUt+h4sE9EqNuLUVdP89KEd4X8eS+fP0KCnAV0RyzQwsPf Q1uTjgegb1D7RycOUdaMzSEY8qtgpI3IBfGaExfyHzH6dTzWNciN2emzhZJovG6Ia+Da syjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692420002; x=1693024802; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=D2rf4521dR3zfDVxwsUnaZ4b3GIZAWIZe5mix3E7tmw=; b=g+sHd3u/Y2lii4nQF/cCD5toR/zXUq+MjDTDN/DK1xrsaxqkrijEqIcD1JAReGTQGp OkgbCgNhvhtVLe85bSlgCIxQ2sgXYISDPJiKnwCFrzcPwAXvz2s9CamJv0aUEw1aiYh+ kUMCu3hWgWd5f6GYN3qTWo7Dyo28j6NBJFs3dzJGIwr7YXTU9CTYuKs/mE/uvNP2X61i miIgPVeaiHpJFSlQvyUuNfjft/Y867ptfkLWtbt87LtweoTy9EIrml/OrO0zTwEnyiw2 cXatk3KejWGSc7ocVcFkOQMGl7re5wKp2d62I2VeKzbZQZflyxgXgTX/lyqqrweJN2mE wijA== X-Gm-Message-State: AOJu0Yz7TDntDe/Ru9qdal800saM8n/MNwLfus2lb7MSyZMYxed7m5o9 Jsl1v+JnYo0m4dBULsurZaYq+V0GJlQ= X-Google-Smtp-Source: AGHT+IELA4iR22cgCTDziZj26+U0sQqaJauKgJgwS++FJVq1RlXhGN+EUKXwl62A9kMl5bSyEq87t/VnBkY= X-Received: from reijiw-west4.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:aa1]) (user=reijiw job=sendgmr) by 2002:a81:b71a:0:b0:56c:f8b7:d4fa with SMTP id v26-20020a81b71a000000b0056cf8b7d4famr9410ywh.7.1692420002422; Fri, 18 Aug 2023 21:40:02 -0700 (PDT) Date: Fri, 18 Aug 2023 21:39:46 -0700 In-Reply-To: <20230819043947.4100985-1-reijiw@google.com> Mime-Version: 1.0 References: <20230819043947.4100985-1-reijiw@google.com> X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog Message-ID: <20230819043947.4100985-4-reijiw@google.com> Subject: [PATCH v3 3/4] KVM: arm64: PMU: Don't advertise the STALL_SLOT event From: Reiji Watanabe To: Marc Zyngier , Oliver Upton , kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Zenghui Yu , Suzuki K Poulose , Jing Zhang , Raghavendra Rao Anata , Reiji Watanabe Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Currently, KVM hides the STALL_SLOT event for guests if the host PMU version is PMUv3p4 or newer, as PMMIR_EL1 is handled as RAZ for the guests. But, this should be based on the guests' PMU version (instead of the host PMU version), as an older PMU that doesn't support PMMIR_EL1 could support the STALL_SLOT event, according to the Arm ARM. Exposing the STALL_SLOT event without PMMIR_EL1 won't be very useful anyway though. Stop advertising the STALL_SLOT event for guests unconditionally, rather than fixing or keeping the inaccurate checking to advertise the event for the case, where it is not very useful. Suggested-by: Oliver Upton Signed-off-by: Reiji Watanabe --- arch/arm64/kvm/pmu-emul.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c index eaeb8fea7971..b9633deff32a 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -761,8 +761,7 @@ u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1) * Don't advertise STALL_SLOT, as PMMIR_EL0 is handled * as RAZ */ - if (vcpu->kvm->arch.arm_pmu->pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4) - val &= ~BIT_ULL(ARMV8_PMUV3_PERFCTR_STALL_SLOT - 32); + val &= ~BIT_ULL(ARMV8_PMUV3_PERFCTR_STALL_SLOT - 32); base = 32; }