KVM Archive mirror
 help / color / mirror / Atom feed
From: Manali Shukla <manali.shukla@amd.com>
To: <kvm@vger.kernel.org>, <linux-kselftest@vger.kernel.org>
Cc: <pbonzini@redhat.com>, <seanjc@google.com>, <shuah@kernel.org>,
	<nikunj@amd.com>, <thomas.lendacky@amd.com>,
	<manali.shukla@amd.com>
Subject: [PATCH] KVM: selftest: Add family and model check for zen4 in PMU filter test
Date: Wed, 1 May 2024 15:24:51 +0000	[thread overview]
Message-ID: <20240501152451.4458-1-manali.shukla@amd.com> (raw)

PMU event filter test fails on zen4 architecture because of
unavailability of family and model check for zen4 in use_amd_pmu().
So, add family and model check for zen4 architecture in use_amd_pmu().

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
---
 .../testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
index 3c85d1ae9893..c212ca4ffa72 100644
--- a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
+++ b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
@@ -374,6 +374,12 @@ static bool is_zen3(uint32_t family, uint32_t model)
 	return family == 0x19 && model <= 0x0f;
 }
 
+static bool is_zen4(uint32_t family, uint32_t model)
+{
+	return family == 0x19 && ((model >= 0x10 && model <= 0x1f) ||
+		(model >= 0xa0 && model <= 0xaf));
+}
+
 /*
  * Determining AMD support for a PMU event requires consulting the AMD
  * PPR for the CPU or reference material derived therefrom. The AMD
@@ -390,7 +396,8 @@ static bool use_amd_pmu(void)
 	return host_cpu_is_amd &&
 		(is_zen1(family, model) ||
 		 is_zen2(family, model) ||
-		 is_zen3(family, model));
+		 is_zen3(family, model) ||
+		 is_zen4(family, model));
 }
 
 /*
-- 
2.34.1


             reply	other threads:[~2024-05-01 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01 15:24 Manali Shukla [this message]
2024-05-01 15:32 ` [PATCH] KVM: selftest: Add family and model check for zen4 in PMU filter test Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240501152451.4458-1-manali.shukla@amd.com \
    --to=manali.shukla@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=thomas.lendacky@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).