From: Oliver Upton <oliver.upton@linux.dev>
To: kvmarm@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH 2/2] KVM: arm64: selftests: Add tests for MMIO external abort injection
Date: Fri, 18 Oct 2024 21:03:02 +0000 [thread overview]
Message-ID: <ZxLNBh6h0Nb9QR0t@linux.dev> (raw)
In-Reply-To: <20241018194757.3685856-3-oliver.upton@linux.dev>
On Fri, Oct 18, 2024 at 07:47:57PM +0000, Oliver Upton wrote:
> Test that the plumbing exposed to userspace for injecting aborts in
> response to unexpected MMIO works as intended in two different flavors:
>
> - A 'normal' MMIO instruction (i.e. ESR_ELx.ISV=1)
>
> - An ISV=0 MMIO instruction with/without KVM_CAP_ARM_NISV_TO_USER
> enabled
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
> tools/testing/selftests/kvm/Makefile | 1 +
> .../selftests/kvm/aarch64/mmio_abort.c | 158 ++++++++++++++++++
> 2 files changed, 159 insertions(+)
> create mode 100644 tools/testing/selftests/kvm/aarch64/mmio_abort.c
>
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index 960cf6a77198..98957a99ead6 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -156,6 +156,7 @@ TEST_GEN_PROGS_aarch64 += aarch64/aarch32_id_regs
> TEST_GEN_PROGS_aarch64 += aarch64/arch_timer_edge_cases
> TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions
> TEST_GEN_PROGS_aarch64 += aarch64/hypercalls
> +TEST_GEN_PROGS_aarch64 += aarch64/mmio_abort
> TEST_GEN_PROGS_aarch64 += aarch64/page_fault_test
> TEST_GEN_PROGS_aarch64 += aarch64/psci_test
> TEST_GEN_PROGS_aarch64 += aarch64/set_id_regs
> diff --git a/tools/testing/selftests/kvm/aarch64/mmio_abort.c b/tools/testing/selftests/kvm/aarch64/mmio_abort.c
> new file mode 100644
> index 000000000000..08c4afec1f28
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/aarch64/mmio_abort.c
> @@ -0,0 +1,158 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * mmio_abort - Tests for userspace MMIO abort injection
> + *
> + * Copyright (c) 2024 Google LLC
> + */
> +#include "processor.h"
> +#include "test_util.h"
> +
> +#define MMIO_ADDR 0x8000000ULL
> +
> +#define ESR_ELx_FSC_EXTABT (0x10)
> +
> +static u64 expected_abort_pc;
> +
> +static void expect_sea_handler(struct ex_regs *regs)
> +{
> + GUEST_ASSERT_EQ(regs->pc, expected_abort_pc);
> + GUEST_ASSERT(read_sysreg(esr_el1) & ESR_ELx_FSC_EXTABT);
> +
This needs to extract and compare the entire FSC field, I'll fix it the
next time around.
--
Thanks,
Oliver
next prev parent reply other threads:[~2024-10-18 21:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 19:47 [PATCH 0/2] KVM: arm64: Fix splat/misbehavior for MMIO SEA injection Oliver Upton
2024-10-18 19:47 ` [PATCH 1/2] KVM: arm64: Don't retire aborted MMIO instruction Oliver Upton
2024-10-19 9:10 ` Marc Zyngier
2024-10-19 18:13 ` Oliver Upton
2024-10-18 19:47 ` [PATCH 2/2] KVM: arm64: selftests: Add tests for MMIO external abort injection Oliver Upton
2024-10-18 21:03 ` Oliver Upton [this message]
2024-10-19 9:16 ` [PATCH 0/2] KVM: arm64: Fix splat/misbehavior for MMIO SEA injection 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=ZxLNBh6h0Nb9QR0t@linux.dev \
--to=oliver.upton@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.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