[rfc] powerpc/npu: Cleanup MMIO ATSD flushing
Balbir Singh
bsingharora at gmail.com
Tue Oct 31 10:28:12 AEDT 2017
On Tue, Oct 31, 2017 at 3:03 AM, Aneesh Kumar K.V
<aneeshkumar.opensource at gmail.com> wrote:
>
>
> On 10/30/2017 06:08 PM, Balbir Singh wrote:
>>
>> +
>> +static void pnv_npu2_invalidate_helper(struct npu_context *npu_context,
>> + struct mm_struct *mm, unsigned long start,
>> + unsigned long end, bool flush)
>> +{
>> + unsigned long address;
>> + bool is_thp;
>> + unsigned int hshift, shift;
>> +
>> + address = start;
>> + do {
>> + local_irq_disable();
>> + find_linux_pte(mm->pgd, address, &is_thp, &hshift);
>> + if (!is_thp)
>> + shift = PAGE_SHIFT;
>> + else
>> + shift = hshift;
>
>
> Is that correct? if is_thp is 0 can we derive shift from hshift? IIUC we set
> hshift only
> if it is a hugepage.
OK.. I assumed that it'll be set. So I've got to check for
if (is_thp)
shift = mmu_psize_defs[MMU_PAGE_2M].shift
else if (hshift)
shift = hshift
else
shift = PAGE_SHIFT
>
>
>> + mmio_invalidate(npu_context, address > 0, address, flush,
>> + shift);
>> + local_irq_enable();
>> + address += (1ull << shift);
>> + } while (address < end);
>> }
>>
Thanks for the review!
Balbir Singh.
More information about the Linuxppc-dev
mailing list