From: Ricardo Koller <ricarkol@google.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
maz@kernel.org, eric.auger@redhat.com, alexandru.elisei@arm.com,
pbonzini@redhat.com
Subject: Re: [PATCH v3 5/5] KVM: arm64: selftests: get-reg-list: Split base and pmu registers
Date: Wed, 2 Jun 2021 16:26:51 -0700 [thread overview]
Message-ID: <YLgTu4EEnwfrtHSo@google.com> (raw)
In-Reply-To: <20210531103344.29325-6-drjones@redhat.com>
On Mon, May 31, 2021 at 12:33:44PM +0200, Andrew Jones wrote:
> Since KVM commit 11663111cd49 ("KVM: arm64: Hide PMU registers from
> userspace when not available") the get-reg-list* tests have been
> failing with
>
> ...
> ... There are 74 missing registers.
> The following lines are missing registers:
> ...
>
> where the 74 missing registers are all PMU registers. This isn't a
> bug in KVM that the selftest found, even though it's true that a
> KVM userspace that wasn't setting the KVM_ARM_VCPU_PMU_V3 VCPU
> flag, but still expecting the PMU registers to be in the reg-list,
> would suddenly no longer have their expectations met. In that case,
> the expectations were wrong, though, so that KVM userspace needs to
> be fixed, and so does this selftest. The fix for this selftest is to
> pull the PMU registers out of the base register sublist into their
> own sublist and then create new, pmu-enabled vcpu configs which can
> be tested.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Ricardo Koller <ricarkol@google.com>
> ---
> .../selftests/kvm/aarch64/get-reg-list.c | 39 +++++++++++++++----
> 1 file changed, 31 insertions(+), 8 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> index b46b8a1fdc0c..a16c8f05366c 100644
> --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> @@ -637,7 +637,7 @@ int main(int ac, char **av)
> * The current blessed list was primed with the output of kernel version
> * v4.15 with --core-reg-fixup and then later updated with new registers.
> *
> - * The blessed list is up to date with kernel version v5.10-rc5
> + * The blessed list is up to date with kernel version v5.13-rc3
> */
> static __u64 base_regs[] = {
> KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(regs.regs[0]),
> @@ -829,8 +829,6 @@ static __u64 base_regs[] = {
> ARM64_SYS_REG(3, 0, 5, 2, 0), /* ESR_EL1 */
> ARM64_SYS_REG(3, 0, 6, 0, 0), /* FAR_EL1 */
> ARM64_SYS_REG(3, 0, 7, 4, 0), /* PAR_EL1 */
> - ARM64_SYS_REG(3, 0, 9, 14, 1), /* PMINTENSET_EL1 */
> - ARM64_SYS_REG(3, 0, 9, 14, 2), /* PMINTENCLR_EL1 */
> ARM64_SYS_REG(3, 0, 10, 2, 0), /* MAIR_EL1 */
> ARM64_SYS_REG(3, 0, 10, 3, 0), /* AMAIR_EL1 */
> ARM64_SYS_REG(3, 0, 12, 0, 0), /* VBAR_EL1 */
> @@ -839,6 +837,16 @@ static __u64 base_regs[] = {
> ARM64_SYS_REG(3, 0, 13, 0, 4), /* TPIDR_EL1 */
> ARM64_SYS_REG(3, 0, 14, 1, 0), /* CNTKCTL_EL1 */
> ARM64_SYS_REG(3, 2, 0, 0, 0), /* CSSELR_EL1 */
> + ARM64_SYS_REG(3, 3, 13, 0, 2), /* TPIDR_EL0 */
> + ARM64_SYS_REG(3, 3, 13, 0, 3), /* TPIDRRO_EL0 */
> + ARM64_SYS_REG(3, 4, 3, 0, 0), /* DACR32_EL2 */
> + ARM64_SYS_REG(3, 4, 5, 0, 1), /* IFSR32_EL2 */
> + ARM64_SYS_REG(3, 4, 5, 3, 0), /* FPEXC32_EL2 */
> +};
> +
> +static __u64 pmu_regs[] = {
> + ARM64_SYS_REG(3, 0, 9, 14, 1), /* PMINTENSET_EL1 */
> + ARM64_SYS_REG(3, 0, 9, 14, 2), /* PMINTENCLR_EL1 */
> ARM64_SYS_REG(3, 3, 9, 12, 0), /* PMCR_EL0 */
> ARM64_SYS_REG(3, 3, 9, 12, 1), /* PMCNTENSET_EL0 */
> ARM64_SYS_REG(3, 3, 9, 12, 2), /* PMCNTENCLR_EL0 */
> @@ -848,8 +856,6 @@ static __u64 base_regs[] = {
> ARM64_SYS_REG(3, 3, 9, 13, 0), /* PMCCNTR_EL0 */
> ARM64_SYS_REG(3, 3, 9, 14, 0), /* PMUSERENR_EL0 */
> ARM64_SYS_REG(3, 3, 9, 14, 3), /* PMOVSSET_EL0 */
> - ARM64_SYS_REG(3, 3, 13, 0, 2), /* TPIDR_EL0 */
> - ARM64_SYS_REG(3, 3, 13, 0, 3), /* TPIDRRO_EL0 */
> ARM64_SYS_REG(3, 3, 14, 8, 0),
> ARM64_SYS_REG(3, 3, 14, 8, 1),
> ARM64_SYS_REG(3, 3, 14, 8, 2),
> @@ -913,9 +919,6 @@ static __u64 base_regs[] = {
> ARM64_SYS_REG(3, 3, 14, 15, 5),
> ARM64_SYS_REG(3, 3, 14, 15, 6),
> ARM64_SYS_REG(3, 3, 14, 15, 7), /* PMCCFILTR_EL0 */
> - ARM64_SYS_REG(3, 4, 3, 0, 0), /* DACR32_EL2 */
> - ARM64_SYS_REG(3, 4, 5, 0, 1), /* IFSR32_EL2 */
> - ARM64_SYS_REG(3, 4, 5, 3, 0), /* FPEXC32_EL2 */
> };
>
> static __u64 vregs[] = {
> @@ -1015,6 +1018,8 @@ static __u64 sve_rejects_set[] = {
> { "base", .regs = base_regs, .regs_n = ARRAY_SIZE(base_regs), }
> #define VREGS_SUBLIST \
> { "vregs", .regs = vregs, .regs_n = ARRAY_SIZE(vregs), }
> +#define PMU_SUBLIST \
> + { "pmu", .regs = pmu_regs, .regs_n = ARRAY_SIZE(pmu_regs), }
> #define SVE_SUBLIST \
> { "sve", .capability = KVM_CAP_ARM_SVE, .feature = KVM_ARM_VCPU_SVE, .finalize = true, \
> .regs = sve_regs, .regs_n = ARRAY_SIZE(sve_regs), \
> @@ -1027,6 +1032,14 @@ static struct vcpu_config vregs_config = {
> {0},
> },
> };
> +static struct vcpu_config vregs_pmu_config = {
> + .sublists = {
> + BASE_SUBLIST,
> + VREGS_SUBLIST,
> + PMU_SUBLIST,
> + {0},
> + },
> +};
> static struct vcpu_config sve_config = {
> .sublists = {
> BASE_SUBLIST,
> @@ -1034,9 +1047,19 @@ static struct vcpu_config sve_config = {
> {0},
> },
> };
> +static struct vcpu_config sve_pmu_config = {
> + .sublists = {
> + BASE_SUBLIST,
> + SVE_SUBLIST,
> + PMU_SUBLIST,
> + {0},
> + },
> +};
>
> static struct vcpu_config *vcpu_configs[] = {
> &vregs_config,
> + &vregs_pmu_config,
> &sve_config,
> + &sve_pmu_config,
> };
> static int vcpu_configs_n = ARRAY_SIZE(vcpu_configs);
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-06-02 23:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 10:33 [PATCH v3 0/5] KVM: arm64: selftests: Fix get-reg-list Andrew Jones
2021-05-31 10:33 ` [PATCH v3 1/5] KVM: arm64: selftests: get-reg-list: Introduce vcpu configs Andrew Jones
2021-06-02 23:40 ` Ricardo Koller
2021-06-03 12:14 ` Andrew Jones
2021-05-31 10:33 ` [PATCH v3 2/5] KVM: arm64: selftests: get-reg-list: Prepare to run multiple configs at once Andrew Jones
2021-06-02 23:56 ` Ricardo Koller
2021-05-31 10:33 ` [PATCH v3 3/5] KVM: arm64: selftests: get-reg-list: Provide config selection option Andrew Jones
2021-06-03 0:03 ` Ricardo Koller
2021-05-31 10:33 ` [PATCH v3 4/5] KVM: arm64: selftests: get-reg-list: Remove get-reg-list-sve Andrew Jones
2021-06-03 0:09 ` Ricardo Koller
2021-05-31 10:33 ` [PATCH v3 5/5] KVM: arm64: selftests: get-reg-list: Split base and pmu registers Andrew Jones
2021-06-02 23:26 ` Ricardo Koller [this message]
2021-06-22 7:07 ` [PATCH v3 0/5] KVM: arm64: selftests: Fix get-reg-list Andrew Jones
2021-06-22 7:32 ` Marc Zyngier
2021-06-22 7:48 ` Andrew Jones
2021-06-22 7:57 ` 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=YLgTu4EEnwfrtHSo@google.com \
--to=ricarkol@google.com \
--cc=alexandru.elisei@arm.com \
--cc=drjones@redhat.com \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.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).