Re: [kvm-unit-tests PATCH v3 15/27] arm/arm64: mmu_disable: Clean and invalidate before disabling

Andrew Jones
2022-07-01T11:16:33Z

On Fri, Jul 01, 2022 at 11:24:44AM +0100, Alexandru Elisei wrote:
...
> > being dropped and replaced by one of you with something that "makes
> > more sense" as long as the outcome (coherent execution on bare-metal)
> > still works.
>
> Hmm... maybe an experiment will work. I propose the following:
>
> 1. Revert this patch.
> 2. Apply this diff on top of the series:
>
> diff --git a/lib/arm/setup.c b/lib/arm/setup.c
> index 30d04d0eb100..913f4088d96c 100644
> --- a/lib/arm/setup.c
> +++ b/lib/arm/setup.c
> @@ -374,6 +374,11 @@ static efi_status_t efi_mem_init(efi_bootinfo_t *efi_bootinfo)
> }
> }
> __phys_end &= PHYS_MASK;
> +
> + asm volatile("dc cvau, %0\n" :: "r" (&__phys_offset) : "memory");
> + asm volatile("dc cvau, %0\n" :: "r" (&__phys_end) : "memory");
> + dsb(sy);
> +
> asm_mmu_disable();
>
> if (free_mem_pages == 0)
>
> This is the solution, based on an architectural explanation of what we were
> observing, that I proposed on your github branch, a solution that you've
> tested with the result:
>
> "I tested at least 10 times (lost count) with a build where "arm/arm64:
> mmu_disable: Clean and invalidate before disabling" was reverted from the
> target-efi branch and your hack was applied. It worked every time."
>
> [1] https://github.com/rhdrjones/kvm-unit-tests/commit/fc58684bc47b7d07d75098fdfddb6083e9b12104#commitcomment-44222926
>

Hi Alex,

Thanks for digging that back up. I had lost track of it. The last comment
is you saying that you'll send a proper patch. Did you send one that got
lost? If not, would you like to send one now that Nikos can incorporate?

Thanks,
drew