Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3eac2e95 authored by Jack Steiner's avatar Jack Steiner Committed by Linus Torvalds
Browse files

gru: support contexts with zero dsrs or cbrs



Support alocation of GRU contexts that contain zero DSR or CBR resources.
Some instructions do not require DSR resources.  Contexts without CBR
resources are useful for diagnostics.

Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 836ce679
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -135,11 +135,9 @@ static int gru_create_new_context(unsigned long arg)
	if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
	if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
		return -EFAULT;
		return -EFAULT;


	if (req.data_segment_bytes == 0 ||
	if (req.data_segment_bytes > max_user_dsr_bytes)
				req.data_segment_bytes > max_user_dsr_bytes)
		return -EINVAL;
		return -EINVAL;
	if (!req.control_blocks || !req.maximum_thread_count ||
	if (req.control_blocks > max_user_cbrs || !req.maximum_thread_count)
				req.control_blocks > max_user_cbrs)
		return -EINVAL;
		return -EINVAL;


	if (!(req.options & GRU_OPT_MISS_MASK))
	if (!(req.options & GRU_OPT_MISS_MASK))
+2 −2
Original line number Original line Diff line number Diff line
@@ -150,7 +150,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
	unsigned long bits = 0;
	unsigned long bits = 0;
	int i;
	int i;


	do {
	while (n--) {
		i = find_first_bit(p, mmax);
		i = find_first_bit(p, mmax);
		if (i == mmax)
		if (i == mmax)
			BUG();
			BUG();
@@ -158,7 +158,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
		__set_bit(i, &bits);
		__set_bit(i, &bits);
		if (idx)
		if (idx)
			*idx++ = i;
			*idx++ = i;
	} while (--n);
	}
	return bits;
	return bits;
}
}