Lines Matching refs:qmem
42 struct qmem { struct
51 static inline int qmem_alloc(struct device *dev, struct qmem **q, in qmem_alloc() argument
54 struct qmem *qmem; in qmem_alloc() local
60 *q = devm_kzalloc(dev, sizeof(*qmem), GFP_KERNEL); in qmem_alloc()
63 qmem = *q; in qmem_alloc()
65 qmem->entry_sz = entry_sz; in qmem_alloc()
66 qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN; in qmem_alloc()
67 qmem->base = dma_alloc_coherent(dev, qmem->alloc_sz, in qmem_alloc()
68 &qmem->iova, GFP_KERNEL); in qmem_alloc()
69 if (!qmem->base) in qmem_alloc()
72 qmem->qsize = qsize; in qmem_alloc()
74 aligned_addr = ALIGN((u64)qmem->iova, OTX2_ALIGN); in qmem_alloc()
75 qmem->align = (aligned_addr - qmem->iova); in qmem_alloc()
76 qmem->base += qmem->align; in qmem_alloc()
77 qmem->iova += qmem->align; in qmem_alloc()
81 static inline void qmem_free(struct device *dev, struct qmem *qmem) in qmem_free() argument
83 if (!qmem) in qmem_free()
86 if (qmem->base) in qmem_free()
87 dma_free_coherent(dev, qmem->alloc_sz, in qmem_free()
88 qmem->base - qmem->align, in qmem_free()
89 qmem->iova - qmem->align); in qmem_free()
90 devm_kfree(dev, qmem); in qmem_free()
94 struct qmem *inst;
95 struct qmem *res;