[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SA1PR12MB71990CC60F96FEBFA9CABC58B05F2@SA1PR12MB7199.namprd12.prod.outlook.com>
Date: Thu, 29 Feb 2024 16:29:04 +0000
From: Ankit Agrawal <ankita@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>, Alex Williamson
<alex.williamson@...hat.com>
CC: Yishai Hadas <yishaih@...dia.com>, "shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>, "kevin.tian@...el.com"
<kevin.tian@...el.com>, Aniket Agashe <aniketa@...dia.com>, Neo Jia
<cjia@...dia.com>, Kirti Wankhede <kwankhede@...dia.com>, "Tarun Gupta
(SW-GPU)" <targupta@...dia.com>, Vikram Sethi <vsethi@...dia.com>, Andy
Currid <acurrid@...dia.com>, Alistair Popple <apopple@...dia.com>, John
Hubbard <jhubbard@...dia.com>, Dan Williams <danw@...dia.com>, Rahul
Rameshbabu <rrameshbabu@...dia.com>, Zhi Wang <zhiw@...dia.com>, "Anuj
Aggarwal (SW-GPU)" <anuaggarwal@...dia.com>, Matt Ochs <mochs@...dia.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 1/1] vfio/nvgrace-gpu: Convey kvm that the device is wc
safe
>> >
>> > + /*
>> > + * 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
Powered by blists - more mailing lists