Lines Matching refs:qmem
38 struct qmem { struct
47 static inline int qmem_alloc(struct device *dev, struct qmem **q, in qmem_alloc() argument
50 struct qmem *qmem; in qmem_alloc() local
56 *q = devm_kzalloc(dev, sizeof(*qmem), GFP_KERNEL); in qmem_alloc()
59 qmem = *q; in qmem_alloc()
61 qmem->entry_sz = entry_sz; in qmem_alloc()
62 qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN; in qmem_alloc()
63 qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova, in qmem_alloc()
65 if (!qmem->base) in qmem_alloc()
68 qmem->qsize = qsize; in qmem_alloc()
70 aligned_addr = ALIGN((u64)qmem->iova, OTX2_ALIGN); in qmem_alloc()
71 qmem->align = (aligned_addr - qmem->iova); in qmem_alloc()
72 qmem->base += qmem->align; in qmem_alloc()
73 qmem->iova += qmem->align; in qmem_alloc()
77 static inline void qmem_free(struct device *dev, struct qmem *qmem) in qmem_free() argument
79 if (!qmem) in qmem_free()
82 if (qmem->base) in qmem_free()
83 dma_free_attrs(dev, qmem->alloc_sz, in qmem_free()
84 qmem->base - qmem->align, in qmem_free()
85 qmem->iova - qmem->align, in qmem_free()
87 devm_kfree(dev, qmem); in qmem_free()
91 struct qmem *inst;
92 struct qmem *res;