kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Marc Zyngier <maz@kernel.org>,
	kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Jones <drjones@redhat.com>,
	Eric Auger <eric.auger@redhat.com>,
	qperret@google.com, kernel-team@android.com,
	Andrew Walbran <qwandor@google.com>
Subject: Re: [kvm-unit-tests PATCH] arm: pmu: Fix failing PMU test when no PMU is available
Date: Wed, 24 Mar 2021 14:50:05 +0000	[thread overview]
Message-ID: <23046a95-5876-e7a2-e4a4-6012a760815d@arm.com> (raw)
In-Reply-To: <20210324143856.2079220-1-maz@kernel.org>

Hi Marc,

Thank you for the patch! I have already sent a patch for this [1], which was
queued by Drew [2], but apparently has not landed in master yet.

[1] https://www.spinics.net/lists/kvm-arm/msg44084.html
[2]
https://gitlab.com/rhdrjones/kvm-unit-tests/-/commit/241dac4cadfd7d7ace8c8c3f0613376311b4e785


Thanks,

Alex

On 3/24/21 2:38 PM, Marc Zyngier wrote:
> The PMU unit tests fail with an UNDEF exception when no PMU
> is available (although KVM hasn't been totally consistent
> with that in the past).
>
> This is caused by PMCR_EL0 being read *before* ID_AA64DFR0_EL1
> is checked for the PMU version.
>
> Move the PMCR_EL0 access to a reasonable place, which allows the
> test to soft-fail gracefully.
>
> Fixes: 784ee933fa5f ("arm: pmu: Introduce defines for PMU versions")
> Reported-by: Andrew Walbran <qwandor@google.com>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  arm/pmu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arm/pmu.c b/arm/pmu.c
> index cc959e6..15c542a 100644
> --- a/arm/pmu.c
> +++ b/arm/pmu.c
> @@ -988,7 +988,7 @@ static void pmccntr64_test(void)
>  /* Return FALSE if no PMU found, otherwise return TRUE */
>  static bool pmu_probe(void)
>  {
> -	uint32_t pmcr = get_pmcr();
> +	uint32_t pmcr;
>  	uint8_t implementer;
>  
>  	pmu.version = get_pmu_version();
> @@ -997,6 +997,7 @@ static bool pmu_probe(void)
>  
>  	report_info("PMU version: 0x%x", pmu.version);
>  
> +	pmcr = get_pmcr();
>  	implementer = (pmcr >> PMU_PMCR_IMP_SHIFT) & PMU_PMCR_IMP_MASK;
>  	report_info("PMU implementer/ID code: %#"PRIx32"(\"%c\")/%#"PRIx32,
>  		    (pmcr >> PMU_PMCR_IMP_SHIFT) & PMU_PMCR_IMP_MASK,

  reply	other threads:[~2021-03-24 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 14:38 [kvm-unit-tests PATCH] arm: pmu: Fix failing PMU test when no PMU is available Marc Zyngier
2021-03-24 14:50 ` Alexandru Elisei [this message]
2021-03-24 15:10   ` Andrew Jones
2021-03-24 16:17     ` Marc Zyngier

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=23046a95-5876-e7a2-e4a4-6012a760815d@arm.com \
    --to=alexandru.elisei@arm.com \
    --cc=drjones@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qperret@google.com \
    --cc=qwandor@google.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 NNTP newsgroup(s).