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

Function dmar_pgalloc

freebsd/x86/iommu/intel_utils.c:259–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257int dmar_tbl_pagecnt;
258
259vm_page_t
260dmar_pgalloc(vm_object_t obj, vm_pindex_t idx, int flags)
261{
262 vm_page_t m;
263 int zeroed, aflags;
264
265 zeroed = (flags & IOMMU_PGF_ZERO) != 0 ? VM_ALLOC_ZERO : 0;
266 aflags = zeroed | VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | VM_ALLOC_NODUMP |
267 ((flags & IOMMU_PGF_WAITOK) != 0 ? VM_ALLOC_WAITFAIL :
268 VM_ALLOC_NOWAIT);
269 for (;;) {
270 if ((flags & IOMMU_PGF_OBJL) == 0)
271 VM_OBJECT_WLOCK(obj);
272 m = vm_page_lookup(obj, idx);
273 if ((flags & IOMMU_PGF_NOALLOC) != 0 || m != NULL) {
274 if ((flags & IOMMU_PGF_OBJL) == 0)
275 VM_OBJECT_WUNLOCK(obj);
276 break;
277 }
278 m = vm_page_alloc_contig(obj, idx, aflags, 1, 0,
279 dmar_high, PAGE_SIZE, 0, VM_MEMATTR_DEFAULT);
280 if ((flags & IOMMU_PGF_OBJL) == 0)
281 VM_OBJECT_WUNLOCK(obj);
282 if (m != NULL) {
283 if (zeroed && (m->flags & PG_ZERO) == 0)
284 pmap_zero_page(m);
285 atomic_add_int(&dmar_tbl_pagecnt, 1);
286 break;
287 }
288 if ((flags & IOMMU_PGF_WAITOK) == 0)
289 break;
290 }
291 return (m);
292}
293
294void
295dmar_pgfree(vm_object_t obj, vm_pindex_t idx, int flags)

Callers 7

domain_idmap_nextlvlFunction · 0.85
domain_pgtbl_map_pteFunction · 0.85
domain_alloc_pgtblFunction · 0.85
dmar_ensure_ctx_pageFunction · 0.85
ctx_id_entry_initFunction · 0.85
dmar_attachFunction · 0.85
dmar_map_pgtblFunction · 0.85

Calls 3

vm_page_lookupFunction · 0.85
vm_page_alloc_contigFunction · 0.85
pmap_zero_pageFunction · 0.50

Tested by

no test coverage detected