Re: [PATCH v4 08/15] arm64: kvm: Duplicate hyp/tlb.c for VHE/nVHE

From: Marc Zyngier
Date: Sun Jul 05 2020 - 09:49:28 EST


On Thu, 25 Jun 2020 14:14:13 +0100,
David Brazdil <dbrazdil@xxxxxxxxxx> wrote:
>
> tlb.c contains code for flushing the TLB, with code shared between VHE/nVHE.
> Because common code is small, duplicate tlb.c and specialize each copy for
> VHE/nVHE.
>
> Signed-off-by: David Brazdil <dbrazdil@xxxxxxxxxx>
> ---
> arch/arm64/kernel/image-vars.h | 14 +--
> arch/arm64/kvm/hyp/Makefile | 2 +-
> arch/arm64/kvm/hyp/nvhe/Makefile | 2 +-
> arch/arm64/kvm/hyp/{ => nvhe}/tlb.c | 94 +---------------
> arch/arm64/kvm/hyp/vhe/Makefile | 2 +-
> arch/arm64/kvm/hyp/vhe/tlb.c | 162 ++++++++++++++++++++++++++++
> 6 files changed, 178 insertions(+), 98 deletions(-)
> rename arch/arm64/kvm/hyp/{ => nvhe}/tlb.c (62%)
> create mode 100644 arch/arm64/kvm/hyp/vhe/tlb.c
>

[...]

> diff --git a/arch/arm64/kvm/hyp/vhe/tlb.c b/arch/arm64/kvm/hyp/vhe/tlb.c
> new file mode 100644
> index 000000000000..35e8e112ba28
> --- /dev/null
> +++ b/arch/arm64/kvm/hyp/vhe/tlb.c

[...]

> +void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
> +{
> + struct tlb_inv_context cxt;
> +
> + dsb(ishst);
> +
> + /* Switch to requested VMID */
> + kvm = kern_hyp_va(kvm);

nit: this is now superfluous. I'll drop it locally.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.