Messages in this thread | | | From | Ankit Agrawal <> | Subject | Re: [PATCH v1 1/1] vfio/nvgrace-gpu: Convey kvm that the device is wc safe | Date | Thu, 29 Feb 2024 16:31:09 +0000 |
| |
>> > + /* >> > + * The VM_ALLOW_ANY_UNCACHED VMA flag is implemented for ARM64, >> > + * allowing KVM stage 2 device mapping attributes to use Normal-NC >> > + * rather than DEVICE_nGnRE, which allows guest mappings >> > + * supporting write-combining attributes (WC). This also >> > + * unlocks memory-like operations such as unaligned accesses >> > + * This setting suits the fake BARs as they are expected to >> > + * demonstrate such properties within the guest. >> > + * >> > + * ARM does not architecturally guarantee this is safe, and indeed >> > + * some MMIO regions like the GICv2 VCPU interface can trigger >> > + * uncontained faults if Normal-NC is used. The nvgrace-gpu >> > + * however is safe in that the platform guarantees that no >> > + * action taken on the MMIO mapping can trigger an uncontained >> > + * failure. Hence VM_ALLOW_ANY_UNCACHED is set in the VMA flags. >> > + */ >> > + vm_flags_set(vma, VM_ALLOW_ANY_UNCACHED); >> > + >> > return 0; >> > } >> > >> >> The commit log sort of covers it, but this comment doesn't seem to >> cover why we're setting an uncached attribute to the usemem region >> which we're specifically mapping as coherent... did we end up giving >> this flag a really poor name if it's being used here to allow unaligned >> access? Thanks, > > Also, this is setting the vma flag *after* the call to > remap_pfn_range(), which seems quite sketchy. Thanks,
I will move it to the block that Jason pointed.
> Alex
| |