Lines Matching refs:dev_dax

17 static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma,  in check_vma()  argument
20 struct device *dev = &dev_dax->dev; in check_vma()
23 if (!dax_alive(dev_dax->dax_dev)) in check_vma()
34 mask = dev_dax->align - 1; in check_vma()
54 __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, in dax_pgoff_to_phys() argument
59 for (i = 0; i < dev_dax->nr_range; i++) { in dax_pgoff_to_phys()
60 struct dev_dax_range *dax_range = &dev_dax->ranges[i]; in dax_pgoff_to_phys()
81 struct dev_dax *dev_dax = filp->private_data; in dax_set_mapping() local
85 if (dev_dax->pgmap->vmemmap_shift) in dax_set_mapping()
103 static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax, in __dev_dax_pte_fault() argument
106 struct device *dev = &dev_dax->dev; in __dev_dax_pte_fault()
111 if (check_vma(dev_dax, vmf->vma, __func__)) in __dev_dax_pte_fault()
114 if (dev_dax->align > PAGE_SIZE) { in __dev_dax_pte_fault()
116 dev_dax->align, fault_size); in __dev_dax_pte_fault()
120 if (fault_size != dev_dax->align) in __dev_dax_pte_fault()
123 phys = dax_pgoff_to_phys(dev_dax, vmf->pgoff, PAGE_SIZE); in __dev_dax_pte_fault()
136 static vm_fault_t __dev_dax_pmd_fault(struct dev_dax *dev_dax, in __dev_dax_pmd_fault() argument
140 struct device *dev = &dev_dax->dev; in __dev_dax_pmd_fault()
146 if (check_vma(dev_dax, vmf->vma, __func__)) in __dev_dax_pmd_fault()
149 if (dev_dax->align > PMD_SIZE) { in __dev_dax_pmd_fault()
151 dev_dax->align, fault_size); in __dev_dax_pmd_fault()
155 if (fault_size < dev_dax->align) in __dev_dax_pmd_fault()
157 else if (fault_size > dev_dax->align) in __dev_dax_pmd_fault()
166 phys = dax_pgoff_to_phys(dev_dax, pgoff, PMD_SIZE); in __dev_dax_pmd_fault()
180 static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax, in __dev_dax_pud_fault() argument
184 struct device *dev = &dev_dax->dev; in __dev_dax_pud_fault()
191 if (check_vma(dev_dax, vmf->vma, __func__)) in __dev_dax_pud_fault()
194 if (dev_dax->align > PUD_SIZE) { in __dev_dax_pud_fault()
196 dev_dax->align, fault_size); in __dev_dax_pud_fault()
200 if (fault_size < dev_dax->align) in __dev_dax_pud_fault()
202 else if (fault_size > dev_dax->align) in __dev_dax_pud_fault()
211 phys = dax_pgoff_to_phys(dev_dax, pgoff, PUD_SIZE); in __dev_dax_pud_fault()
224 static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax, in __dev_dax_pud_fault() argument
236 struct dev_dax *dev_dax = filp->private_data; in dev_dax_huge_fault() local
238 dev_dbg(&dev_dax->dev, "%s: op=%s addr=%#lx order=%d\n", current->comm, in dev_dax_huge_fault()
244 rc = __dev_dax_pte_fault(dev_dax, vmf); in dev_dax_huge_fault()
246 rc = __dev_dax_pmd_fault(dev_dax, vmf); in dev_dax_huge_fault()
248 rc = __dev_dax_pud_fault(dev_dax, vmf); in dev_dax_huge_fault()
265 struct dev_dax *dev_dax = filp->private_data; in dev_dax_may_split() local
267 if (!IS_ALIGNED(addr, dev_dax->align)) in dev_dax_may_split()
275 struct dev_dax *dev_dax = filp->private_data; in dev_dax_pagesize() local
277 return dev_dax->align; in dev_dax_pagesize()
289 struct dev_dax *dev_dax = filp->private_data; in dax_mmap() local
292 dev_dbg(&dev_dax->dev, "trace\n"); in dax_mmap()
299 rc = check_vma(dev_dax, vma, __func__); in dax_mmap()
315 struct dev_dax *dev_dax = filp ? filp->private_data : NULL; in dax_get_unmapped_area() local
317 if (!dev_dax || addr) in dax_get_unmapped_area()
320 align = dev_dax->align; in dax_get_unmapped_area()
350 struct dev_dax *dev_dax = dax_get_private(dax_dev); in dax_open() local
352 dev_dbg(&dev_dax->dev, "trace\n"); in dax_open()
359 filp->private_data = dev_dax; in dax_open()
367 struct dev_dax *dev_dax = filp->private_data; in dax_release() local
369 dev_dbg(&dev_dax->dev, "trace\n"); in dax_release()
388 static void dev_dax_kill(void *dev_dax) in dev_dax_kill() argument
390 kill_dev_dax(dev_dax); in dev_dax_kill()
393 static int dev_dax_probe(struct dev_dax *dev_dax) in dev_dax_probe() argument
395 struct dax_device *dax_dev = dev_dax->dax_dev; in dev_dax_probe()
396 struct device *dev = &dev_dax->dev; in dev_dax_probe()
403 if (static_dev_dax(dev_dax)) { in dev_dax_probe()
404 if (dev_dax->nr_range > 1) { in dev_dax_probe()
410 pgmap = dev_dax->pgmap; in dev_dax_probe()
412 if (dev_dax->pgmap) { in dev_dax_probe()
419 struct_size(pgmap, ranges, dev_dax->nr_range - 1), in dev_dax_probe()
424 pgmap->nr_range = dev_dax->nr_range; in dev_dax_probe()
425 dev_dax->pgmap = pgmap; in dev_dax_probe()
427 for (i = 0; i < dev_dax->nr_range; i++) { in dev_dax_probe()
428 struct range *range = &dev_dax->ranges[i].range; in dev_dax_probe()
433 for (i = 0; i < dev_dax->nr_range; i++) { in dev_dax_probe()
434 struct range *range = &dev_dax->ranges[i].range; in dev_dax_probe()
445 if (dev_dax->align > PAGE_SIZE) in dev_dax_probe()
447 order_base_2(dev_dax->align >> PAGE_SHIFT); in dev_dax_probe()
466 return devm_add_action_or_reset(dev, dev_dax_kill, dev_dax); in dev_dax_probe()