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.

+               mmio_invalidate(npu_context, address > 0, address, flush,
+                               shift);
+               local_irq_enable();
+               address += (1ull << shift);
+       } while (address < end);
  }

-aneesh

Reply via email to