Re: [PATCH v7 2/5] KVM: arm64: Block cacheable PFNMAP mapping

From: Ankit Agrawal
Date: Wed Jun 18 2025 - 22:21:17 EST


Thanks Catalin for reviewing the patch.

>>  static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>>                         struct kvm_s2_trans *nested,
>>                         struct kvm_memory_slot *memslot, unsigned long hva,
>> @@ -1477,7 +1493,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>>  {
>>       int ret = 0;
>>       bool write_fault, writable, force_pte = false;
>> -     bool exec_fault, mte_allowed;
>> +     bool exec_fault, mte_allowed, is_vma_cacheable = false;
>
> Nit: do we need to initialise is_vma_cacheable here? It did not seem
> used until the kvm_vma_is_cacheable() call. Anyway, it's harmless.

Shouldn't be necessary. I'll remove it.

>>       if (disable_cmo) {
>> +             if (is_vma_cacheable) {
>> +                     ret = -EINVAL;
>> +                     goto out_unlock;
>> +             }
>
> so, is there anything else changing 'disable_cmo' up to this point? If
> not, I'd drop the second is_vma_cacheable check.
>
> --
> Catalin

Ack, we don't need the second check.