[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] hvf: arm: Ignore cache operations on MMIO
From: |
Mark Kettenis |
Subject: |
Re: [PATCH v2] hvf: arm: Ignore cache operations on MMIO |
Date: |
Tue, 26 Oct 2021 11:34:07 +0200 (CEST) |
> From: Alexander Graf <agraf@csgraf.de>
> Date: Tue, 26 Oct 2021 09:12:41 +0200
>
> Apple's Hypervisor.Framework forwards cache operations as MMIO traps
> into user space. For MMIO however, these have no meaning: There is no
> cache attached to them.
>
> So let's just treat cache data exits as nops.
>
> This fixes OpenBSD booting as guest.
>
> Signed-off-by: Alexander Graf <agraf@csgraf.de>
> Reported-by: AJ Barris <AwlsomeAlex@github.com>
> Reference: https://github.com/utmapp/UTM/issues/3197
> ---
> target/arm/hvf/hvf.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index bff3e0cde7..0dc96560d3 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -1150,12 +1150,19 @@ int hvf_vcpu_exec(CPUState *cpu)
> uint32_t sas = (syndrome >> 22) & 3;
> uint32_t len = 1 << sas;
> uint32_t srt = (syndrome >> 16) & 0x1f;
> + uint32_t cm = (syndrome >> 8) & 0x1;
> uint64_t val = 0;
>
> trace_hvf_data_abort(env->pc, hvf_exit->exception.virtual_address,
> hvf_exit->exception.physical_address, isv,
> iswrite, s1ptw, len, srt);
>
> + if (cm) {
> + /* We don't cache MMIO regions */
> + advance_pc = true;
> + break;
> + }
> +
> assert(isv);
>
> if (iswrite) {
> --
> 2.30.1 (Apple Git-130)
Now that I see this diff, I think this is pretty much how I fixed it
when first trying your hvf patchset back in december/january. Before
I lost the change because I accidentally wiped the disk...
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>