Re: [PATCH v6 1/4] kvm: arm64: introduce new flag for non-cacheable IO memory
From: Ankit Agrawal
Date: Fri Feb 09 2024 - 09:14:31 EST
>>
>> + switch (prot & (KVM_PGTABLE_PROT_DEVICE |
>> + KVM_PGTABLE_PROT_NORMAL_NC)) {
>> + case 0:
>> + attr = KVM_S2_MEMATTR(pgt, NORMAL);
>> + break;
>> + case KVM_PGTABLE_PROT_DEVICE:
>> + if (prot & KVM_PGTABLE_PROT_X)
>> + return -EINVAL;
>> + attr = KVM_S2_MEMATTR(pgt, DEVICE_nGnRE);
>> + break;
>> + case KVM_PGTABLE_PROT_NORMAL_NC:
>> + attr = KVM_S2_MEMATTR(pgt, NORMAL_NC);
>> + break;
>> + default:
>> + WARN_ON_ONCE(1);
>> + }
>
> Cosmetic nit, but I'd find this a little easier to read if the normal
> case was the default (i.e. drop 'case 0') and we returned an error for
> DEVICE | NC.
Makes sense, will update the logic accordingly.