From patchwork Fri Jul 28 18:19:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 13332272 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 11CB5C001DF for ; Fri, 28 Jul 2023 18:19:58 +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=PeoY21X/TXDD6hBompZwtTp1dKXrlK1Q3BHjdCGSI/k=; b=AgtrrAMT3WxZK+p+OYzVKUZ/FV vzYX0o/deTx0tFpRl/v/dNFJZh84w4h1Mkubk5tdV18kQPvtAB950SMvYeDmc4zdc81fyHaK11oct A2NtHl4bLFCQ/qagXrRz3R9zFffwpADB+lZmjt5LstIL6Rj51bb6+FUPcDjPRWPd7vUqA66q6fzxD hb5KS3i55sN96hcdyo9Pfeo8qk0BBWCdLcq5U9uUYxUOeop4BQhufQEBM/mrRGk79BoybaNNRPC3+ zMZcCimVRe/hAL1jeQPwN7bxOjFVM1gq4IZe2SL2WxRgugTSVRlPFZtFwoRadwo7ICcLFsBiVPpA0 U3J/5MZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPS3x-004T2O-2n; Fri, 28 Jul 2023 18:19:41 +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 1qPS3u-004T0O-2U for linux-arm-kernel@lists.infradead.org; Fri, 28 Jul 2023 18:19:40 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-583c49018c6so24886637b3.0 for ; Fri, 28 Jul 2023 11:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690568375; x=1691173175; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=T7cMhi6W1QA72qy6OnVjmEOCding/R2p1klzAYF0ZSc=; b=rF2yKEaY1+qGW4yqr/ZDga1hoWZYiI2p2zc8yQ9kHdT44KsPEvoMVekCxp8AfghkrW rMjKjRvkxs+wiCzBI5lgToksGFROkVlXlN+SkQIjZniH8ytnyaxvtlQRlJn9Cj8kcvI3 KoFNL9T8OSKOnjnssPigziHXCqK1L3kE2iRASoTLF1OnyYkPMah8AsJk05j8hATC3ZZ2 C8bnTiwVpe5/KEZBZIzcExtKteckZN91xceRRLul0/fRz8xcWAGQJvr8FcCUVvOx9LpH CBFXgWSA928eM+Yo7h1fWLEYXg24t9YcsTPZYlS7JEpAAXmcD3X0XI3V5Wi6vT6uSlm2 uZDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690568375; x=1691173175; 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=T7cMhi6W1QA72qy6OnVjmEOCding/R2p1klzAYF0ZSc=; b=TPq2mSoaXH8YVcRpXpwY/SFMt2MOuoE760sCDY+CvHhQFwaxs6FQggtpyvx37VDzag uD15nUceAdYgL6efcZFxd//ECJbdZABT5dtNsiKnBtQwuuYg4uNingUzehFmUj69Thz3 ggafC5lLqTxrUd/0ge956sdj9f00OlkELuRay5PYWup/17ZKbKUN6BP/rxJUxSoak0Mi rF3P73oJCknVZPn0RwGoWf9qKYuVzD4cV9Pv2hbFMUMem8wD7UJ82nHi5OvNo7n+bs6D MOzfCPBBmsn61b8mUPr6fGuVFnOsLAZ9urFuLlyTFVfy/GeHc86MEP5xfLDjcSOEDCXz eHlQ== X-Gm-Message-State: ABy/qLYFEWEwmxFwZEAqGACLRWSQ/tawhBvhl1hZ9zCQAbqa/LOLw2AA At6PQ5zhkPsv0mtAfXZlkxkwm+tvXdk= X-Google-Smtp-Source: APBJJlHHrkbaWwlROgHKR6eB+lXZtSRXwpmBiCRMU364RcnA5ppYwL/doSe0Q2ZdQqFbWDIBBE84vPbLp04= X-Received: from reijiw-west4.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:aa1]) (user=reijiw job=sendgmr) by 2002:a05:6902:100f:b0:cf9:3564:33cc with SMTP id w15-20020a056902100f00b00cf9356433ccmr18274ybt.13.1690568374733; Fri, 28 Jul 2023 11:19:34 -0700 (PDT) Date: Fri, 28 Jul 2023 11:19:03 -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-2-reijiw@google.com> Subject: [PATCH v2 1/5] KVM: arm64: PMU: Use of pmuv3_implemented() instead of open-coded version 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_111938_810404_903953E0 X-CRM114-Status: GOOD ( 12.15 ) 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 Replace the open-coded PMU version check with pmuv3_implemented() to simplify the code. Signed-off-by: Reiji Watanabe --- arch/arm64/kvm/pmu-emul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c index 560650972478..dee83119e112 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -14,6 +14,7 @@ #include #include #include +#include #define PERF_ATTR_CFG1_COUNTER_64BIT BIT(0) @@ -672,8 +673,7 @@ void kvm_host_pmu_init(struct arm_pmu *pmu) { struct arm_pmu_entry *entry; - if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI || - pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF) + if (!pmuv3_implemented(pmu->pmuver)) return; mutex_lock(&arm_pmus_lock);