[PATCH v7 1/5] KVM: arm64: Rename symbols to reflect whether CMO may be used

Ankit Agrawal ankita at nvidia.com
Wed Jun 18 19:22:32 PDT 2025


Thanks Catalin for reviewing the patch.

>> -static bool kvm_is_device_pfn(unsigned long pfn)
>> +static bool kvm_can_use_cmo_pfn(unsigned long pfn)
>>  {
>> -     return !pfn_is_map_memory(pfn);
>> +     return pfn_is_map_memory(pfn);
>>  }
>
> I wonder, why not just use pfn_is_map_memory() directly? At a quick
> grep, it's only used in one place and your patches don't seem to modify
> this function further.

Ok sure, will make the change.

>> Currently, the kvm_is_device_pfn() detects if the memory is kernel
>> mapped. It thus implies whether KVM can use Cache Maintenance
>> Operations (CMOs) on that PFN. Rename the function to reflect this.
>>
>> Additionally, the "device" variable is effectively trying to setup the S2
>> to prevent CMOs. Calling it 'disable_cmo' would make this code clearer.
>
> I'm not sure CMOs is the only reason. Another is to prevent the guest
> from mapping device memory as something other than Device with
> possible implications for external aborts.

Ack.


More information about the linux-arm-kernel mailing list