From patchwork Fri Jul 28 18:19:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 13332275 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 88D8DC001DF for ; Fri, 28 Jul 2023 18:20:26 +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=0lPn17DZtjoiHuZGYKd4w5rl64GiCeuBq85Eh9bDP+o=; b=NGaMtq+k0bwhBAgbm8NuAZbxZP vN7SiST7jkC8+VOstuA8+TfgSUAj5CVkMgpYzeOWO43kpXhewgI4HjaZCZwJp9m8RaxDqsBgBlieI CHv4kX1HJK+orGJwYMZvxu0+PJ/Nl47CjKTxWVFQwQ5LZFhmwdBbBJzmuW3v48Cu5L1uiiMtOAeyc JwX2Lcuo/HetDpFwjUCPoRpSfSI3KHdQ7tsqB7jPpOrxXtR8P1rQWplX72M/BxqlZ9hHckKaJL8si 3HCKMrntg8C/AWCAFXeYUlalFhwC6ZSIm3ga6cCo7Q/X4mpg3qIqOeskeU5B378oYfVEEjV0ngT5L Aw48fLQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPS4R-004TCA-0l; Fri, 28 Jul 2023 18:20:11 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPS4O-004TAn-0j for linux-arm-kernel@lists.infradead.org; Fri, 28 Jul 2023 18:20:09 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d0fff3cf2d7so2267319276.2 for ; Fri, 28 Jul 2023 11:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690568407; x=1691173207; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=69C/ntI6f1AOmR1sB1xGfWOc1uE0vjjS6a/8TiFNaMY=; b=4imiPj/W9BwPalHOzSmw17NqttBRQo5o87hsgLVbMTlVmd/zBz0lRAimJvIDRV4WdE r+gxspdcXCtepHLMuOluphMantxnNzisQBUf88GFsz+BmYeK9BeB55+0okua86LKOxU+ NjZvQoJhPEQWEkhKojZNYVyui45IbdRp/Ul8n0lbLS02iL2UhRDICNo1e4dohFmFUkbo lPfxWdqTRPZAb/6xg65Y1GZH5JvMfWX5HSpDppDP2c0EgAh19zghIogAY2iCtWeeSoYS mn5ojApZi7HdigofpZ+vY024pSWUwn8FwASrIWAb0U0bBw8UoN9K0mqtOWIev5TTR3A0 t54Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690568407; x=1691173207; 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=69C/ntI6f1AOmR1sB1xGfWOc1uE0vjjS6a/8TiFNaMY=; b=MjrSZi/9IkxX84lEMlpkMl27n3ZHTzRi5hn06dSS+wl/aAdlAYaKm0ieD+jtPgii3Z ZkU56YKsA9JfUifY8CcLrofO4O7cTuT4UCkEhjmQejSp1CwGACAOg+H+LAkvsXQnP3R+ I+UBcCzIbCetECV0XD4y+Vb93imofcZ8SxAbndZSi2nJSm4jH0wnrx8hiDBw0LChvGm4 Fg47QKUaI0TPPrPXx5WLMHqeBX1mgrh+/X9WRs0Cm4GR4t93WpxyrgyFzA5NJ3ciVNKd djlv8Zzpk7+5uA1D6ba1jovHyfsa2vA4kp6zUk19q2FYSYw2PtklRsF1pV4DNd+/VFyz dCkw== X-Gm-Message-State: ABy/qLYkx06YxBEd+iQSJIionjBu5ak4wH9qBCRUiXmKEg/wfhofsCVf XoSHV69Svhm6++yqLhmZ/jBJhy97Cxk= X-Google-Smtp-Source: APBJJlHrauGCVrlINhpGcDmzp09heYPiNXagZxSTvSvZvveFxIbf1oHobA+L0v+vSB3K7l2kPHKEOClCwfE= X-Received: from reijiw-west4.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:aa1]) (user=reijiw job=sendgmr) by 2002:a05:6902:1611:b0:d0d:587c:e031 with SMTP id bw17-20020a056902161100b00d0d587ce031mr15462ybb.9.1690568407149; Fri, 28 Jul 2023 11:20:07 -0700 (PDT) Date: Fri, 28 Jul 2023 11:19:06 -0700 In-Reply-To: <20230728181907.1759513-1-reijiw@google.com> Mime-Version: 1.0 References: <20230728181907.1759513-1-reijiw@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230728181907.1759513-5-reijiw@google.com> Subject: [PATCH v2 4/5] 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-20230728_112008_290915_8EABC0E3 X-CRM114-Status: GOOD ( 12.75 ) 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 f0cbc9024bb7..68f44f893b44 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -754,8 +754,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; }