1254885Sdumbbell/*
2254885Sdumbbell * Copyright 2011 Red Hat Inc.
3254885Sdumbbell * All Rights Reserved.
4254885Sdumbbell *
5254885Sdumbbell * Permission is hereby granted, free of charge, to any person obtaining a
6254885Sdumbbell * copy of this software and associated documentation files (the
7254885Sdumbbell * "Software"), to deal in the Software without restriction, including
8254885Sdumbbell * without limitation the rights to use, copy, modify, merge, publish,
9254885Sdumbbell * distribute, sub license, and/or sell copies of the Software, and to
10254885Sdumbbell * permit persons to whom the Software is furnished to do so, subject to
11254885Sdumbbell * the following conditions:
12254885Sdumbbell *
13254885Sdumbbell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14254885Sdumbbell * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15254885Sdumbbell * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
16254885Sdumbbell * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
17254885Sdumbbell * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18254885Sdumbbell * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
19254885Sdumbbell * USE OR OTHER DEALINGS IN THE SOFTWARE.
20254885Sdumbbell *
21254885Sdumbbell * The above copyright notice and this permission notice (including the
22254885Sdumbbell * next paragraph) shall be included in all copies or substantial portions
23254885Sdumbbell * of the Software.
24254885Sdumbbell *
25254885Sdumbbell */
26254885Sdumbbell/*
27254885Sdumbbell * Authors:
28254885Sdumbbell *    Jerome Glisse <glisse@freedesktop.org>
29254885Sdumbbell */
30254885Sdumbbell/* Algorithm:
31254885Sdumbbell *
32254885Sdumbbell * We store the last allocated bo in "hole", we always try to allocate
33254885Sdumbbell * after the last allocated bo. Principle is that in a linear GPU ring
34254885Sdumbbell * progression was is after last is the oldest bo we allocated and thus
35254885Sdumbbell * the first one that should no longer be in use by the GPU.
36254885Sdumbbell *
37254885Sdumbbell * If it's not the case we skip over the bo after last to the closest
38254885Sdumbbell * done bo if such one exist. If none exist and we are not asked to
39254885Sdumbbell * block we report failure to allocate.
40254885Sdumbbell *
41254885Sdumbbell * If we are asked to block we wait on all the oldest fence of all
42254885Sdumbbell * rings. We just wait for any of those fence to complete.
43254885Sdumbbell */
44254885Sdumbbell
45254885Sdumbbell#include <sys/cdefs.h>
46254885Sdumbbell__FBSDID("$FreeBSD$");
47254885Sdumbbell
48254885Sdumbbell#include <dev/drm2/drmP.h>
49254885Sdumbbell#include "radeon.h"
50254885Sdumbbell
51254885Sdumbbellstatic void radeon_sa_bo_remove_locked(struct radeon_sa_bo *sa_bo);
52254885Sdumbbellstatic void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager);
53254885Sdumbbell
54254885Sdumbbellint radeon_sa_bo_manager_init(struct radeon_device *rdev,
55254885Sdumbbell			      struct radeon_sa_manager *sa_manager,
56254885Sdumbbell			      unsigned size, u32 domain)
57254885Sdumbbell{
58254885Sdumbbell	int i, r;
59254885Sdumbbell
60254885Sdumbbell	sx_init(&sa_manager->wq_lock, "drm__radeon_sa_manager_wq_mtx");
61254885Sdumbbell	cv_init(&sa_manager->wq, "drm__radeon_sa_manager__wq");
62254885Sdumbbell	sa_manager->bo = NULL;
63254885Sdumbbell	sa_manager->size = size;
64254885Sdumbbell	sa_manager->domain = domain;
65254885Sdumbbell	sa_manager->hole = &sa_manager->olist;
66254885Sdumbbell	INIT_LIST_HEAD(&sa_manager->olist);
67254885Sdumbbell	for (i = 0; i < RADEON_NUM_RINGS; ++i) {
68254885Sdumbbell		INIT_LIST_HEAD(&sa_manager->flist[i]);
69254885Sdumbbell	}
70254885Sdumbbell
71254885Sdumbbell	r = radeon_bo_create(rdev, size, RADEON_GPU_PAGE_SIZE, true,
72254885Sdumbbell			     RADEON_GEM_DOMAIN_CPU, NULL, &sa_manager->bo);
73254885Sdumbbell	if (r) {
74254885Sdumbbell		dev_err(rdev->dev, "(%d) failed to allocate bo for manager\n", r);
75254885Sdumbbell		return r;
76254885Sdumbbell	}
77254885Sdumbbell
78254885Sdumbbell	return r;
79254885Sdumbbell}
80254885Sdumbbell
81254885Sdumbbellvoid radeon_sa_bo_manager_fini(struct radeon_device *rdev,
82254885Sdumbbell			       struct radeon_sa_manager *sa_manager)
83254885Sdumbbell{
84254885Sdumbbell	struct radeon_sa_bo *sa_bo, *tmp;
85254885Sdumbbell
86254885Sdumbbell	if (!list_empty(&sa_manager->olist)) {
87254885Sdumbbell		sa_manager->hole = &sa_manager->olist,
88254885Sdumbbell		radeon_sa_bo_try_free(sa_manager);
89254885Sdumbbell		if (!list_empty(&sa_manager->olist)) {
90254885Sdumbbell			dev_err(rdev->dev, "sa_manager is not empty, clearing anyway\n");
91254885Sdumbbell		}
92254885Sdumbbell	}
93254885Sdumbbell	list_for_each_entry_safe(sa_bo, tmp, &sa_manager->olist, olist) {
94254885Sdumbbell		radeon_sa_bo_remove_locked(sa_bo);
95254885Sdumbbell	}
96254885Sdumbbell	radeon_bo_unref(&sa_manager->bo);
97254885Sdumbbell	sa_manager->size = 0;
98254885Sdumbbell	cv_destroy(&sa_manager->wq);
99254885Sdumbbell	sx_destroy(&sa_manager->wq_lock);
100254885Sdumbbell}
101254885Sdumbbell
102254885Sdumbbellint radeon_sa_bo_manager_start(struct radeon_device *rdev,
103254885Sdumbbell			       struct radeon_sa_manager *sa_manager)
104254885Sdumbbell{
105254885Sdumbbell	int r;
106254885Sdumbbell
107254885Sdumbbell	if (sa_manager->bo == NULL) {
108254885Sdumbbell		dev_err(rdev->dev, "no bo for sa manager\n");
109254885Sdumbbell		return -EINVAL;
110254885Sdumbbell	}
111254885Sdumbbell
112254885Sdumbbell	/* map the buffer */
113254885Sdumbbell	r = radeon_bo_reserve(sa_manager->bo, false);
114254885Sdumbbell	if (r) {
115254885Sdumbbell		dev_err(rdev->dev, "(%d) failed to reserve manager bo\n", r);
116254885Sdumbbell		return r;
117254885Sdumbbell	}
118254885Sdumbbell	r = radeon_bo_pin(sa_manager->bo, sa_manager->domain, &sa_manager->gpu_addr);
119254885Sdumbbell	if (r) {
120254885Sdumbbell		radeon_bo_unreserve(sa_manager->bo);
121254885Sdumbbell		dev_err(rdev->dev, "(%d) failed to pin manager bo\n", r);
122254885Sdumbbell		return r;
123254885Sdumbbell	}
124254885Sdumbbell	r = radeon_bo_kmap(sa_manager->bo, &sa_manager->cpu_ptr);
125254885Sdumbbell	radeon_bo_unreserve(sa_manager->bo);
126254885Sdumbbell	return r;
127254885Sdumbbell}
128254885Sdumbbell
129254885Sdumbbellint radeon_sa_bo_manager_suspend(struct radeon_device *rdev,
130254885Sdumbbell				 struct radeon_sa_manager *sa_manager)
131254885Sdumbbell{
132254885Sdumbbell	int r;
133254885Sdumbbell
134254885Sdumbbell	if (sa_manager->bo == NULL) {
135254885Sdumbbell		dev_err(rdev->dev, "no bo for sa manager\n");
136254885Sdumbbell		return -EINVAL;
137254885Sdumbbell	}
138254885Sdumbbell
139254885Sdumbbell	r = radeon_bo_reserve(sa_manager->bo, false);
140254885Sdumbbell	if (!r) {
141254885Sdumbbell		radeon_bo_kunmap(sa_manager->bo);
142254885Sdumbbell		radeon_bo_unpin(sa_manager->bo);
143254885Sdumbbell		radeon_bo_unreserve(sa_manager->bo);
144254885Sdumbbell	}
145254885Sdumbbell	return r;
146254885Sdumbbell}
147254885Sdumbbell
148254885Sdumbbellstatic void radeon_sa_bo_remove_locked(struct radeon_sa_bo *sa_bo)
149254885Sdumbbell{
150254885Sdumbbell	struct radeon_sa_manager *sa_manager = sa_bo->manager;
151254885Sdumbbell	if (sa_manager->hole == &sa_bo->olist) {
152254885Sdumbbell		sa_manager->hole = sa_bo->olist.prev;
153254885Sdumbbell	}
154254885Sdumbbell	list_del_init(&sa_bo->olist);
155254885Sdumbbell	list_del_init(&sa_bo->flist);
156254885Sdumbbell	radeon_fence_unref(&sa_bo->fence);
157254885Sdumbbell	free(sa_bo, DRM_MEM_DRIVER);
158254885Sdumbbell}
159254885Sdumbbell
160254885Sdumbbellstatic void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager)
161254885Sdumbbell{
162254885Sdumbbell	struct radeon_sa_bo *sa_bo, *tmp;
163254885Sdumbbell
164254885Sdumbbell	if (sa_manager->hole->next == &sa_manager->olist)
165254885Sdumbbell		return;
166254885Sdumbbell
167254885Sdumbbell	sa_bo = list_entry(sa_manager->hole->next, struct radeon_sa_bo, olist);
168254885Sdumbbell	list_for_each_entry_safe_from(sa_bo, tmp, &sa_manager->olist, olist) {
169254885Sdumbbell		if (sa_bo->fence == NULL || !radeon_fence_signaled(sa_bo->fence)) {
170254885Sdumbbell			return;
171254885Sdumbbell		}
172254885Sdumbbell		radeon_sa_bo_remove_locked(sa_bo);
173254885Sdumbbell	}
174254885Sdumbbell}
175254885Sdumbbell
176254885Sdumbbellstatic inline unsigned radeon_sa_bo_hole_soffset(struct radeon_sa_manager *sa_manager)
177254885Sdumbbell{
178254885Sdumbbell	struct list_head *hole = sa_manager->hole;
179254885Sdumbbell
180254885Sdumbbell	if (hole != &sa_manager->olist) {
181254885Sdumbbell		return list_entry(hole, struct radeon_sa_bo, olist)->eoffset;
182254885Sdumbbell	}
183254885Sdumbbell	return 0;
184254885Sdumbbell}
185254885Sdumbbell
186254885Sdumbbellstatic inline unsigned radeon_sa_bo_hole_eoffset(struct radeon_sa_manager *sa_manager)
187254885Sdumbbell{
188254885Sdumbbell	struct list_head *hole = sa_manager->hole;
189254885Sdumbbell
190254885Sdumbbell	if (hole->next != &sa_manager->olist) {
191254885Sdumbbell		return list_entry(hole->next, struct radeon_sa_bo, olist)->soffset;
192254885Sdumbbell	}
193254885Sdumbbell	return sa_manager->size;
194254885Sdumbbell}
195254885Sdumbbell
196254885Sdumbbellstatic bool radeon_sa_bo_try_alloc(struct radeon_sa_manager *sa_manager,
197254885Sdumbbell				   struct radeon_sa_bo *sa_bo,
198254885Sdumbbell				   unsigned size, unsigned align)
199254885Sdumbbell{
200254885Sdumbbell	unsigned soffset, eoffset, wasted;
201254885Sdumbbell
202254885Sdumbbell	soffset = radeon_sa_bo_hole_soffset(sa_manager);
203254885Sdumbbell	eoffset = radeon_sa_bo_hole_eoffset(sa_manager);
204254885Sdumbbell	wasted = (align - (soffset % align)) % align;
205254885Sdumbbell
206254885Sdumbbell	if ((eoffset - soffset) >= (size + wasted)) {
207254885Sdumbbell		soffset += wasted;
208254885Sdumbbell
209254885Sdumbbell		sa_bo->manager = sa_manager;
210254885Sdumbbell		sa_bo->soffset = soffset;
211254885Sdumbbell		sa_bo->eoffset = soffset + size;
212254885Sdumbbell		list_add(&sa_bo->olist, sa_manager->hole);
213254885Sdumbbell		INIT_LIST_HEAD(&sa_bo->flist);
214254885Sdumbbell		sa_manager->hole = &sa_bo->olist;
215254885Sdumbbell		return true;
216254885Sdumbbell	}
217254885Sdumbbell	return false;
218254885Sdumbbell}
219254885Sdumbbell
220254885Sdumbbell/**
221254885Sdumbbell * radeon_sa_event - Check if we can stop waiting
222254885Sdumbbell *
223254885Sdumbbell * @sa_manager: pointer to the sa_manager
224254885Sdumbbell * @size: number of bytes we want to allocate
225254885Sdumbbell * @align: alignment we need to match
226254885Sdumbbell *
227254885Sdumbbell * Check if either there is a fence we can wait for or
228254885Sdumbbell * enough free memory to satisfy the allocation directly
229254885Sdumbbell */
230254885Sdumbbellstatic bool radeon_sa_event(struct radeon_sa_manager *sa_manager,
231254885Sdumbbell			    unsigned size, unsigned align)
232254885Sdumbbell{
233254885Sdumbbell	unsigned soffset, eoffset, wasted;
234254885Sdumbbell	int i;
235254885Sdumbbell
236254885Sdumbbell	for (i = 0; i < RADEON_NUM_RINGS; ++i) {
237254885Sdumbbell		if (!list_empty(&sa_manager->flist[i])) {
238254885Sdumbbell			return true;
239254885Sdumbbell		}
240254885Sdumbbell	}
241254885Sdumbbell
242254885Sdumbbell	soffset = radeon_sa_bo_hole_soffset(sa_manager);
243254885Sdumbbell	eoffset = radeon_sa_bo_hole_eoffset(sa_manager);
244254885Sdumbbell	wasted = (align - (soffset % align)) % align;
245254885Sdumbbell
246254885Sdumbbell	if ((eoffset - soffset) >= (size + wasted)) {
247254885Sdumbbell		return true;
248254885Sdumbbell	}
249254885Sdumbbell
250254885Sdumbbell	return false;
251254885Sdumbbell}
252254885Sdumbbell
253254885Sdumbbellstatic bool radeon_sa_bo_next_hole(struct radeon_sa_manager *sa_manager,
254254885Sdumbbell				   struct radeon_fence **fences,
255254885Sdumbbell				   unsigned *tries)
256254885Sdumbbell{
257254885Sdumbbell	struct radeon_sa_bo *best_bo = NULL;
258254885Sdumbbell	unsigned i, soffset, best, tmp;
259254885Sdumbbell
260254885Sdumbbell	/* if hole points to the end of the buffer */
261254885Sdumbbell	if (sa_manager->hole->next == &sa_manager->olist) {
262254885Sdumbbell		/* try again with its beginning */
263254885Sdumbbell		sa_manager->hole = &sa_manager->olist;
264254885Sdumbbell		return true;
265254885Sdumbbell	}
266254885Sdumbbell
267254885Sdumbbell	soffset = radeon_sa_bo_hole_soffset(sa_manager);
268254885Sdumbbell	/* to handle wrap around we add sa_manager->size */
269254885Sdumbbell	best = sa_manager->size * 2;
270254885Sdumbbell	/* go over all fence list and try to find the closest sa_bo
271254885Sdumbbell	 * of the current last
272254885Sdumbbell	 */
273254885Sdumbbell	for (i = 0; i < RADEON_NUM_RINGS; ++i) {
274254885Sdumbbell		struct radeon_sa_bo *sa_bo;
275254885Sdumbbell
276254885Sdumbbell		if (list_empty(&sa_manager->flist[i])) {
277254885Sdumbbell			continue;
278254885Sdumbbell		}
279254885Sdumbbell
280254885Sdumbbell		sa_bo = list_first_entry(&sa_manager->flist[i],
281254885Sdumbbell					 struct radeon_sa_bo, flist);
282254885Sdumbbell
283254885Sdumbbell		if (!radeon_fence_signaled(sa_bo->fence)) {
284254885Sdumbbell			fences[i] = sa_bo->fence;
285254885Sdumbbell			continue;
286254885Sdumbbell		}
287254885Sdumbbell
288254885Sdumbbell		/* limit the number of tries each ring gets */
289254885Sdumbbell		if (tries[i] > 2) {
290254885Sdumbbell			continue;
291254885Sdumbbell		}
292254885Sdumbbell
293254885Sdumbbell		tmp = sa_bo->soffset;
294254885Sdumbbell		if (tmp < soffset) {
295254885Sdumbbell			/* wrap around, pretend it's after */
296254885Sdumbbell			tmp += sa_manager->size;
297254885Sdumbbell		}
298254885Sdumbbell		tmp -= soffset;
299254885Sdumbbell		if (tmp < best) {
300254885Sdumbbell			/* this sa bo is the closest one */
301254885Sdumbbell			best = tmp;
302254885Sdumbbell			best_bo = sa_bo;
303254885Sdumbbell		}
304254885Sdumbbell	}
305254885Sdumbbell
306254885Sdumbbell	if (best_bo) {
307254885Sdumbbell		++tries[best_bo->fence->ring];
308254885Sdumbbell		sa_manager->hole = best_bo->olist.prev;
309254885Sdumbbell
310254885Sdumbbell		/* we knew that this one is signaled,
311254885Sdumbbell		   so it's save to remote it */
312254885Sdumbbell		radeon_sa_bo_remove_locked(best_bo);
313254885Sdumbbell		return true;
314254885Sdumbbell	}
315254885Sdumbbell	return false;
316254885Sdumbbell}
317254885Sdumbbell
318254885Sdumbbellint radeon_sa_bo_new(struct radeon_device *rdev,
319254885Sdumbbell		     struct radeon_sa_manager *sa_manager,
320254885Sdumbbell		     struct radeon_sa_bo **sa_bo,
321254885Sdumbbell		     unsigned size, unsigned align, bool block)
322254885Sdumbbell{
323254885Sdumbbell	struct radeon_fence *fences[RADEON_NUM_RINGS];
324254885Sdumbbell	unsigned tries[RADEON_NUM_RINGS];
325254885Sdumbbell	int i, r;
326254885Sdumbbell
327254885Sdumbbell	KASSERT(align <= RADEON_GPU_PAGE_SIZE, ("align > RADEON_GPU_PAGE_SIZE"));
328254885Sdumbbell	KASSERT(size <= sa_manager->size, ("size > sa_manager->size"));
329254885Sdumbbell
330254885Sdumbbell	*sa_bo = malloc(sizeof(struct radeon_sa_bo), DRM_MEM_DRIVER, M_WAITOK);
331254885Sdumbbell	if ((*sa_bo) == NULL) {
332254885Sdumbbell		return -ENOMEM;
333254885Sdumbbell	}
334254885Sdumbbell	(*sa_bo)->manager = sa_manager;
335254885Sdumbbell	(*sa_bo)->fence = NULL;
336254885Sdumbbell	INIT_LIST_HEAD(&(*sa_bo)->olist);
337254885Sdumbbell	INIT_LIST_HEAD(&(*sa_bo)->flist);
338254885Sdumbbell
339254885Sdumbbell	sx_xlock(&sa_manager->wq_lock);
340254885Sdumbbell	do {
341254885Sdumbbell		for (i = 0; i < RADEON_NUM_RINGS; ++i) {
342254885Sdumbbell			fences[i] = NULL;
343254885Sdumbbell			tries[i] = 0;
344254885Sdumbbell		}
345254885Sdumbbell
346254885Sdumbbell		do {
347254885Sdumbbell			radeon_sa_bo_try_free(sa_manager);
348254885Sdumbbell
349254885Sdumbbell			if (radeon_sa_bo_try_alloc(sa_manager, *sa_bo,
350254885Sdumbbell						   size, align)) {
351254885Sdumbbell				sx_xunlock(&sa_manager->wq_lock);
352254885Sdumbbell				return 0;
353254885Sdumbbell			}
354254885Sdumbbell
355254885Sdumbbell			/* see if we can skip over some allocations */
356254885Sdumbbell		} while (radeon_sa_bo_next_hole(sa_manager, fences, tries));
357254885Sdumbbell
358254885Sdumbbell		sx_xunlock(&sa_manager->wq_lock);
359254885Sdumbbell		r = radeon_fence_wait_any(rdev, fences, false);
360254885Sdumbbell		sx_xlock(&sa_manager->wq_lock);
361254885Sdumbbell		/* if we have nothing to wait for block */
362254885Sdumbbell		if (r == -ENOENT && block) {
363254885Sdumbbell			while (!radeon_sa_event(sa_manager, size, align)) {
364254885Sdumbbell				r = -cv_wait_sig(&sa_manager->wq,
365254885Sdumbbell				    &sa_manager->wq_lock);
366259742Sdumbbell				if (r == -EINTR)
367259742Sdumbbell					r = -ERESTARTSYS;
368254885Sdumbbell				if (r != 0)
369254885Sdumbbell					break;
370254885Sdumbbell			}
371254885Sdumbbell
372254885Sdumbbell		} else if (r == -ENOENT) {
373254885Sdumbbell			r = -ENOMEM;
374254885Sdumbbell		}
375254885Sdumbbell
376254885Sdumbbell	} while (!r);
377254885Sdumbbell
378254885Sdumbbell	sx_xunlock(&sa_manager->wq_lock);
379254885Sdumbbell	free(*sa_bo, DRM_MEM_DRIVER);
380254885Sdumbbell	*sa_bo = NULL;
381254885Sdumbbell	return r;
382254885Sdumbbell}
383254885Sdumbbell
384254885Sdumbbellvoid radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo **sa_bo,
385254885Sdumbbell		       struct radeon_fence *fence)
386254885Sdumbbell{
387254885Sdumbbell	struct radeon_sa_manager *sa_manager;
388254885Sdumbbell
389254885Sdumbbell	if (sa_bo == NULL || *sa_bo == NULL) {
390254885Sdumbbell		return;
391254885Sdumbbell	}
392254885Sdumbbell
393254885Sdumbbell	sa_manager = (*sa_bo)->manager;
394254885Sdumbbell	sx_xlock(&sa_manager->wq_lock);
395254885Sdumbbell	if (fence && !radeon_fence_signaled(fence)) {
396254885Sdumbbell		(*sa_bo)->fence = radeon_fence_ref(fence);
397254885Sdumbbell		list_add_tail(&(*sa_bo)->flist,
398254885Sdumbbell			      &sa_manager->flist[fence->ring]);
399254885Sdumbbell	} else {
400254885Sdumbbell		radeon_sa_bo_remove_locked(*sa_bo);
401254885Sdumbbell	}
402254885Sdumbbell	cv_broadcast(&sa_manager->wq);
403254885Sdumbbell	sx_xunlock(&sa_manager->wq_lock);
404254885Sdumbbell	*sa_bo = NULL;
405254885Sdumbbell}
406254885Sdumbbell
407254885Sdumbbell#if defined(CONFIG_DEBUG_FS)
408254885Sdumbbellvoid radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager,
409254885Sdumbbell				  struct seq_file *m)
410254885Sdumbbell{
411254885Sdumbbell	struct radeon_sa_bo *i;
412254885Sdumbbell
413254885Sdumbbell	spin_lock(&sa_manager->wq.lock);
414254885Sdumbbell	list_for_each_entry(i, &sa_manager->olist, olist) {
415254885Sdumbbell		if (&i->olist == sa_manager->hole) {
416254885Sdumbbell			seq_printf(m, ">");
417254885Sdumbbell		} else {
418254885Sdumbbell			seq_printf(m, " ");
419254885Sdumbbell		}
420254885Sdumbbell		seq_printf(m, "[0x%08x 0x%08x] size %8d",
421254885Sdumbbell			   i->soffset, i->eoffset, i->eoffset - i->soffset);
422254885Sdumbbell		if (i->fence) {
423254885Sdumbbell			seq_printf(m, " protected by 0x%016llx on ring %d",
424254885Sdumbbell				   i->fence->seq, i->fence->ring);
425254885Sdumbbell		}
426254885Sdumbbell		seq_printf(m, "\n");
427254885Sdumbbell	}
428254885Sdumbbell	spin_unlock(&sa_manager->wq.lock);
429254885Sdumbbell}
430254885Sdumbbell#endif
431