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: 13358510 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 9EC53EE49AA for ; Sat, 19 Aug 2023 04:41:03 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=8lfl/7Xe/UYnQuGuJHJcRq5LBF92F/QJdvz5+dobuJU=; b=VbXydoUxaRMojqS97qO4LZzFGZ N22MxWAuS/RY6D5TN2uhCiu+qstGdAYqPKs2Z2MYI/x42zX7xYepvq6Os2P6951YBZFdY4O2NTzja iyT9GmicTkC3JpOO0F98o9802KwwHDxc3WdOWERRn+ya5KHMl7ac22c86ZOhZhf4hmvzWklXyXP/v UFd25kThOhtCE9vNt/VhiwCorWRmRxY776YT3jYujAt/8ro4wtFMhBi29cKKsU8mzzvx+AkqDr6he VrGhs4cCm44IVtxD2vcge4z+upk2fHnyKaFrUUz+OqKSfszUFmu5TGl9cTS6o+XTsLezQzlZ4gbC8 9wo44ZiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qXDl9-00AOWi-2c; Sat, 19 Aug 2023 04:40:23 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qXDkp-00AOTH-2V for linux-arm-kernel@lists.infradead.org; Sat, 19 Aug 2023 04:40:05 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-58d428d4956so22550467b3.0 for ; Fri, 18 Aug 2023 21:40:02 -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=dH6D6GyLBujj7WAhO1o4M4VkWsmtFbfiafcbSB3gV9VWIcYFa0r6dLVI6wYmQ1/Fkt fsomvM2pVkAYHR2EHfiRc647NrOZRylhli/cSYQDgswd3Peohbt8ablZvYzxRjwjDuYU uVpMLsjkm8hGQjzpbXi+RrPfKtQE9G+EvT3D+YapEXLNpB0ZjW9CK45VcAArNQI5FgTm 0OLjxX5/UkWuDrpAr2xsc/EVwXwsGX3sUbAQj8ts8JMYc65rvzPMRZ6r0KNKzOqbf/7t GGtSwaN4ledqfjGD+KIIxJyye1vEQIkV7/boJ5IHVhapJthdo0Lt91eP8Mtz8tDiCVhe xAoQ== X-Gm-Message-State: AOJu0YyqLMxpbh8rL5ixCVqKDPpExgdMaubOZW4o62cdksYy5KueilKb z/dxnP6xOkThV4YFV9METk/1ZDUeSBI= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_214003_819758_1B7DF5BE X-CRM114-Status: GOOD ( 13.11 ) 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 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; }