Re: [PATCH v1 1/1] vfio/nvgrace-gpu: Convey kvm that the device is wc safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> > 
>> > +   /*
>> > +    * 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,
>
> Yeah, I sugged to fold that hunk into this:
>
>        if (index == RESMEM_REGION_INDEX)
>                vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
>
> So it makes more sense. VM_ALLOW_ANY_UNCACHED shouldn't be used on the
> cachable mapping. The comment should be more specific to this driver
> and not so generic:
>
> /*
> * nvgrace has no issue with uncontained failures on NORMAL_NC
> * access. Tell KVM to open up guest usage of NORMAL_NC for this mapping.
> */

Sure, I will restrict this to resmem. Also will update the comment accordingly.

>
> Jason




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux