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
237 struct dev_dax *dev_dax = filp->private_data; in dev_dax_huge_fault() local
239 dev_dbg(&dev_dax->dev, "%s: %s (%#lx - %#lx) size = %d\n", current->comm, in dev_dax_huge_fault()
246 rc = __dev_dax_pte_fault(dev_dax, vmf); in dev_dax_huge_fault()
249 rc = __dev_dax_pmd_fault(dev_dax, vmf); in dev_dax_huge_fault()
252 rc = __dev_dax_pud_fault(dev_dax, vmf); in dev_dax_huge_fault()
271 struct dev_dax *dev_dax = filp->private_data; in dev_dax_may_split() local
273 if (!IS_ALIGNED(addr, dev_dax->align)) in dev_dax_may_split()
281 struct dev_dax *dev_dax = filp->private_data; in dev_dax_pagesize() local
283 return dev_dax->align; in dev_dax_pagesize()
295 struct dev_dax *dev_dax = filp->private_data; in dax_mmap() local
298 dev_dbg(&dev_dax->dev, "trace\n"); in dax_mmap()
305 rc = check_vma(dev_dax, vma, __func__); in dax_mmap()
321 struct dev_dax *dev_dax = filp ? filp->private_data : NULL; in dax_get_unmapped_area() local
323 if (!dev_dax || addr) in dax_get_unmapped_area()
326 align = dev_dax->align; in dax_get_unmapped_area()
356 struct dev_dax *dev_dax = dax_get_private(dax_dev); in dax_open() local
358 dev_dbg(&dev_dax->dev, "trace\n"); in dax_open()
365 filp->private_data = dev_dax; in dax_open()
373 struct dev_dax *dev_dax = filp->private_data; in dax_release() local
375 dev_dbg(&dev_dax->dev, "trace\n"); in dax_release()
394 static void dev_dax_kill(void *dev_dax) in dev_dax_kill() argument
396 kill_dev_dax(dev_dax); in dev_dax_kill()
399 int dev_dax_probe(struct dev_dax *dev_dax) in dev_dax_probe() argument
401 struct dax_device *dax_dev = dev_dax->dax_dev; in dev_dax_probe()
402 struct device *dev = &dev_dax->dev; in dev_dax_probe()
409 if (static_dev_dax(dev_dax)) { in dev_dax_probe()
410 if (dev_dax->nr_range > 1) { in dev_dax_probe()
416 pgmap = dev_dax->pgmap; in dev_dax_probe()
418 if (dev_dax->pgmap) { in dev_dax_probe()
425 struct_size(pgmap, ranges, dev_dax->nr_range - 1), in dev_dax_probe()
430 pgmap->nr_range = dev_dax->nr_range; in dev_dax_probe()
431 dev_dax->pgmap = pgmap; 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()
439 for (i = 0; i < dev_dax->nr_range; i++) { in dev_dax_probe()
440 struct range *range = &dev_dax->ranges[i].range; in dev_dax_probe()
451 if (dev_dax->align > PAGE_SIZE) in dev_dax_probe()
453 order_base_2(dev_dax->align >> PAGE_SHIFT); in dev_dax_probe()
472 return devm_add_action_or_reset(dev, dev_dax_kill, dev_dax); in dev_dax_probe()