Re: [PATCH v6 3/4] kvm: arm64: set io memory s2 pte as normalnc for vfio pci device

From: Oliver Upton
Date: Thu Feb 08 2024 - 08:27:05 EST


On Thu, Feb 08, 2024 at 02:16:51AM +0530, ankita@xxxxxxxxxx wrote:
> @@ -1557,10 +1559,18 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
> if (exec_fault)
> prot |= KVM_PGTABLE_PROT_X;
>
> - if (device)
> - prot |= KVM_PGTABLE_PROT_DEVICE;
> - else if (cpus_have_final_cap(ARM64_HAS_CACHE_DIC))
> + if (device) {
> + /*
> + * To provide VM with the ability to get device IO memory
> + * with NormalNC property, map device MMIO as NormalNC in S2.
> + */

nit: the comment doesn't provide anything of value, the logic is rather
straightforward here.

> + if (vfio_allow_wc)
> + prot |= KVM_PGTABLE_PROT_NORMAL_NC;
> + else
> + prot |= KVM_PGTABLE_PROT_DEVICE;
> + } else if (cpus_have_final_cap(ARM64_HAS_CACHE_DIC)) {
> prot |= KVM_PGTABLE_PROT_X;
> + }
>
> /*
> * Under the premise of getting a FSC_PERM fault, we just need to relax
> --
> 2.34.1
>

--
Thanks,
Oliver