diff options
author | Jack Steiner <steiner@sgi.com> | 2009-06-17 19:28:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 16:04:00 -0400 |
commit | 3eac2e95d7bb92222e185e445eca1fe3f695050f (patch) | |
tree | 51edba7b926d3587dfa40646bf7b453f47d26dff /drivers/misc | |
parent | 836ce679c0b5b5040164171afc33753396864b30 (diff) |
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: Jack Steiner <steiner@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/sgi-gru/grufile.c | 6 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grumain.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 9e6da46eeb04..b1567ce868e9 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -135,11 +135,9 @@ static int gru_create_new_context(unsigned long arg) | |||
135 | if (copy_from_user(&req, (void __user *)arg, sizeof(req))) | 135 | if (copy_from_user(&req, (void __user *)arg, sizeof(req))) |
136 | return -EFAULT; | 136 | return -EFAULT; |
137 | 137 | ||
138 | if (req.data_segment_bytes == 0 || | 138 | if (req.data_segment_bytes > max_user_dsr_bytes) |
139 | req.data_segment_bytes > max_user_dsr_bytes) | ||
140 | return -EINVAL; | 139 | return -EINVAL; |
141 | if (!req.control_blocks || !req.maximum_thread_count || | 140 | if (req.control_blocks > max_user_cbrs || !req.maximum_thread_count) |
142 | req.control_blocks > max_user_cbrs) | ||
143 | return -EINVAL; | 141 | return -EINVAL; |
144 | 142 | ||
145 | if (!(req.options & GRU_OPT_MISS_MASK)) | 143 | if (!(req.options & GRU_OPT_MISS_MASK)) |
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c index 3398e54a762b..4e6e8c3554f0 100644 --- a/drivers/misc/sgi-gru/grumain.c +++ b/drivers/misc/sgi-gru/grumain.c | |||
@@ -150,7 +150,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax, | |||
150 | unsigned long bits = 0; | 150 | unsigned long bits = 0; |
151 | int i; | 151 | int i; |
152 | 152 | ||
153 | do { | 153 | while (n--) { |
154 | i = find_first_bit(p, mmax); | 154 | i = find_first_bit(p, mmax); |
155 | if (i == mmax) | 155 | if (i == mmax) |
156 | BUG(); | 156 | BUG(); |
@@ -158,7 +158,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax, | |||
158 | __set_bit(i, &bits); | 158 | __set_bit(i, &bits); |
159 | if (idx) | 159 | if (idx) |
160 | *idx++ = i; | 160 | *idx++ = i; |
161 | } while (--n); | 161 | } |
162 | return bits; | 162 | return bits; |
163 | } | 163 | } |
164 | 164 | ||