MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tegra_bo_alloc_contig

Function tegra_bo_alloc_contig

freebsd/arm/nvidia/drm2/tegra_bo.c:95–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95static int
96tegra_bo_alloc_contig(size_t npages, u_long alignment, vm_memattr_t memattr,
97 vm_page_t **ret_page)
98{
99 vm_page_t m;
100 int pflags, tries, i;
101 vm_paddr_t low, high, boundary;
102
103 low = 0;
104 high = -1UL;
105 boundary = 0;
106 pflags = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NOBUSY |
107 VM_ALLOC_WIRED | VM_ALLOC_ZERO;
108 tries = 0;
109retry:
110 m = vm_page_alloc_contig(NULL, 0, pflags, npages, low, high, alignment,
111 boundary, memattr);
112 if (m == NULL) {
113 if (tries < 3) {
114 if (!vm_page_reclaim_contig(pflags, npages, low, high,
115 alignment, boundary))
116 vm_wait(NULL);
117 tries++;
118 goto retry;
119 }
120 return (ENOMEM);
121 }
122
123 for (i = 0; i < npages; i++, m++) {
124 if ((m->flags & PG_ZERO) == 0)
125 pmap_zero_page(m);
126 m->valid = VM_PAGE_BITS_ALL;
127 (*ret_page)[i] = m;
128 }
129
130 return (0);
131}
132
133/* Initialize pager and insert all object pages to it*/
134static int

Callers 1

tegra_bo_allocFunction · 0.85

Calls 4

vm_page_alloc_contigFunction · 0.85
vm_page_reclaim_contigFunction · 0.85
vm_waitFunction · 0.85
pmap_zero_pageFunction · 0.50

Tested by

no test coverage detected