diff options
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_common.h | 16 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_file_ops.c | 171 |
2 files changed, 104 insertions, 83 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index a41367803529..048b928bb4bf 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 QLogic, Inc. All rights reserved. | 2 | * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved. |
3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
@@ -318,11 +318,17 @@ struct ipath_base_info { | |||
318 | /* address of readonly memory copy of the rcvhdrq tail register. */ | 318 | /* address of readonly memory copy of the rcvhdrq tail register. */ |
319 | __u64 spi_rcvhdr_tailaddr; | 319 | __u64 spi_rcvhdr_tailaddr; |
320 | 320 | ||
321 | /* shared memory pages for subports if IPATH_RUNTIME_MASTER is set */ | 321 | /* shared memory pages for subports if port is shared */ |
322 | __u64 spi_subport_uregbase; | 322 | __u64 spi_subport_uregbase; |
323 | __u64 spi_subport_rcvegrbuf; | 323 | __u64 spi_subport_rcvegrbuf; |
324 | __u64 spi_subport_rcvhdr_base; | 324 | __u64 spi_subport_rcvhdr_base; |
325 | 325 | ||
326 | /* shared memory page for hardware port if it is shared */ | ||
327 | __u64 spi_port_uregbase; | ||
328 | __u64 spi_port_rcvegrbuf; | ||
329 | __u64 spi_port_rcvhdr_base; | ||
330 | __u64 spi_port_rcvhdr_tailaddr; | ||
331 | |||
326 | } __attribute__ ((aligned(8))); | 332 | } __attribute__ ((aligned(8))); |
327 | 333 | ||
328 | 334 | ||
@@ -346,7 +352,7 @@ struct ipath_base_info { | |||
346 | * may not be implemented; the user code must deal with this if it | 352 | * may not be implemented; the user code must deal with this if it |
347 | * cares, or it must abort after initialization reports the difference. | 353 | * cares, or it must abort after initialization reports the difference. |
348 | */ | 354 | */ |
349 | #define IPATH_USER_SWMINOR 3 | 355 | #define IPATH_USER_SWMINOR 4 |
350 | 356 | ||
351 | #define IPATH_USER_SWVERSION ((IPATH_USER_SWMAJOR<<16) | IPATH_USER_SWMINOR) | 357 | #define IPATH_USER_SWVERSION ((IPATH_USER_SWMAJOR<<16) | IPATH_USER_SWMINOR) |
352 | 358 | ||
@@ -420,7 +426,7 @@ struct ipath_user_info { | |||
420 | #define IPATH_CMD_TID_UPDATE 19 /* update expected TID entries */ | 426 | #define IPATH_CMD_TID_UPDATE 19 /* update expected TID entries */ |
421 | #define IPATH_CMD_TID_FREE 20 /* free expected TID entries */ | 427 | #define IPATH_CMD_TID_FREE 20 /* free expected TID entries */ |
422 | #define IPATH_CMD_SET_PART_KEY 21 /* add partition key */ | 428 | #define IPATH_CMD_SET_PART_KEY 21 /* add partition key */ |
423 | #define IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes */ | 429 | #define __IPATH_CMD_SLAVE_INFO 22 /* return info on slave processes (for old user code) */ |
424 | #define IPATH_CMD_ASSIGN_PORT 23 /* allocate HCA and port */ | 430 | #define IPATH_CMD_ASSIGN_PORT 23 /* allocate HCA and port */ |
425 | #define IPATH_CMD_USER_INIT 24 /* set up userspace */ | 431 | #define IPATH_CMD_USER_INIT 24 /* set up userspace */ |
426 | 432 | ||
@@ -432,7 +438,7 @@ struct ipath_port_info { | |||
432 | __u16 port; /* port on unit assigned to caller */ | 438 | __u16 port; /* port on unit assigned to caller */ |
433 | __u16 subport; /* subport on unit assigned to caller */ | 439 | __u16 subport; /* subport on unit assigned to caller */ |
434 | __u16 num_ports; /* number of ports available on unit */ | 440 | __u16 num_ports; /* number of ports available on unit */ |
435 | __u16 num_subports; /* number of subport slaves opened on port */ | 441 | __u16 num_subports; /* number of subports opened on port */ |
436 | }; | 442 | }; |
437 | 443 | ||
438 | struct ipath_tid_info { | 444 | struct ipath_tid_info { |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index a1cfedf8fb1c..bb53bde80ee8 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 QLogic, Inc. All rights reserved. | 2 | * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved. |
3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
@@ -99,7 +99,7 @@ static int ipath_get_base_info(struct file *fp, | |||
99 | sz = sizeof(*kinfo); | 99 | sz = sizeof(*kinfo); |
100 | /* If port sharing is not requested, allow the old size structure */ | 100 | /* If port sharing is not requested, allow the old size structure */ |
101 | if (!shared) | 101 | if (!shared) |
102 | sz -= 3 * sizeof(u64); | 102 | sz -= 7 * sizeof(u64); |
103 | if (ubase_size < sz) { | 103 | if (ubase_size < sz) { |
104 | ipath_cdbg(PROC, | 104 | ipath_cdbg(PROC, |
105 | "Base size %zu, need %zu (version mismatch?)\n", | 105 | "Base size %zu, need %zu (version mismatch?)\n", |
@@ -177,22 +177,41 @@ static int ipath_get_base_info(struct file *fp, | |||
177 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + | 177 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + |
178 | dd->ipath_palign * | 178 | dd->ipath_palign * |
179 | (dd->ipath_pbufsport - kinfo->spi_piocnt); | 179 | (dd->ipath_pbufsport - kinfo->spi_piocnt); |
180 | kinfo->__spi_uregbase = (u64) dd->ipath_uregbase + | ||
181 | dd->ipath_palign * pd->port_port; | ||
182 | } else { | 180 | } else { |
183 | unsigned slave = subport_fp(fp) - 1; | 181 | unsigned slave = subport_fp(fp) - 1; |
184 | 182 | ||
185 | kinfo->spi_piocnt = dd->ipath_pbufsport / subport_cnt; | 183 | kinfo->spi_piocnt = dd->ipath_pbufsport / subport_cnt; |
186 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + | 184 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + |
187 | dd->ipath_palign * kinfo->spi_piocnt * slave; | 185 | dd->ipath_palign * kinfo->spi_piocnt * slave; |
186 | } | ||
187 | if (shared) { | ||
188 | kinfo->spi_port_uregbase = (u64) dd->ipath_uregbase + | ||
189 | dd->ipath_palign * pd->port_port; | ||
190 | kinfo->spi_port_rcvegrbuf = kinfo->spi_rcv_egrbufs; | ||
191 | kinfo->spi_port_rcvhdr_base = kinfo->spi_rcvhdr_base; | ||
192 | kinfo->spi_port_rcvhdr_tailaddr = kinfo->spi_rcvhdr_tailaddr; | ||
193 | |||
188 | kinfo->__spi_uregbase = cvt_kvaddr(pd->subport_uregbase + | 194 | kinfo->__spi_uregbase = cvt_kvaddr(pd->subport_uregbase + |
189 | PAGE_SIZE * slave); | 195 | PAGE_SIZE * subport_fp(fp)); |
190 | 196 | ||
191 | kinfo->spi_rcvhdr_base = cvt_kvaddr(pd->subport_rcvhdr_base + | 197 | kinfo->spi_rcvhdr_base = cvt_kvaddr(pd->subport_rcvhdr_base + |
192 | pd->port_rcvhdrq_size * slave); | 198 | pd->port_rcvhdrq_size * subport_fp(fp)); |
193 | kinfo->spi_rcvhdr_tailaddr = 0; | 199 | kinfo->spi_rcvhdr_tailaddr = 0; |
194 | kinfo->spi_rcv_egrbufs = cvt_kvaddr(pd->subport_rcvegrbuf + | 200 | kinfo->spi_rcv_egrbufs = cvt_kvaddr(pd->subport_rcvegrbuf + |
195 | dd->ipath_rcvegrcnt * dd->ipath_rcvegrbufsize * slave); | 201 | pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size * |
202 | subport_fp(fp)); | ||
203 | |||
204 | kinfo->spi_subport_uregbase = | ||
205 | cvt_kvaddr(pd->subport_uregbase); | ||
206 | kinfo->spi_subport_rcvegrbuf = | ||
207 | cvt_kvaddr(pd->subport_rcvegrbuf); | ||
208 | kinfo->spi_subport_rcvhdr_base = | ||
209 | cvt_kvaddr(pd->subport_rcvhdr_base); | ||
210 | ipath_cdbg(PROC, "port %u flags %x %llx %llx %llx\n", | ||
211 | kinfo->spi_port, kinfo->spi_runtime_flags, | ||
212 | (unsigned long long) kinfo->spi_subport_uregbase, | ||
213 | (unsigned long long) kinfo->spi_subport_rcvegrbuf, | ||
214 | (unsigned long long) kinfo->spi_subport_rcvhdr_base); | ||
196 | } | 215 | } |
197 | 216 | ||
198 | kinfo->spi_pioindex = (kinfo->spi_piobufbase - dd->ipath_piobufbase) / | 217 | kinfo->spi_pioindex = (kinfo->spi_piobufbase - dd->ipath_piobufbase) / |
@@ -209,20 +228,10 @@ static int ipath_get_base_info(struct file *fp, | |||
209 | 228 | ||
210 | if (master) { | 229 | if (master) { |
211 | kinfo->spi_runtime_flags |= IPATH_RUNTIME_MASTER; | 230 | kinfo->spi_runtime_flags |= IPATH_RUNTIME_MASTER; |
212 | kinfo->spi_subport_uregbase = | ||
213 | cvt_kvaddr(pd->subport_uregbase); | ||
214 | kinfo->spi_subport_rcvegrbuf = | ||
215 | cvt_kvaddr(pd->subport_rcvegrbuf); | ||
216 | kinfo->spi_subport_rcvhdr_base = | ||
217 | cvt_kvaddr(pd->subport_rcvhdr_base); | ||
218 | ipath_cdbg(PROC, "port %u flags %x %llx %llx %llx\n", | ||
219 | kinfo->spi_port, kinfo->spi_runtime_flags, | ||
220 | (unsigned long long) kinfo->spi_subport_uregbase, | ||
221 | (unsigned long long) kinfo->spi_subport_rcvegrbuf, | ||
222 | (unsigned long long) kinfo->spi_subport_rcvhdr_base); | ||
223 | } | 231 | } |
224 | 232 | ||
225 | if (copy_to_user(ubase, kinfo, sizeof(*kinfo))) | 233 | sz = (ubase_size < sizeof(*kinfo)) ? ubase_size : sizeof(*kinfo); |
234 | if (copy_to_user(ubase, kinfo, sz)) | ||
226 | ret = -EFAULT; | 235 | ret = -EFAULT; |
227 | 236 | ||
228 | bail: | 237 | bail: |
@@ -1152,50 +1161,47 @@ static int mmap_kvaddr(struct vm_area_struct *vma, u64 pgaddr, | |||
1152 | size = pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size; | 1161 | size = pd->port_rcvegrbuf_chunks * pd->port_rcvegrbuf_size; |
1153 | 1162 | ||
1154 | /* | 1163 | /* |
1155 | * Master has all the slave uregbase, rcvhdrq, and | 1164 | * Each process has all the subport uregbase, rcvhdrq, and |
1156 | * rcvegrbufs mmapped. | 1165 | * rcvegrbufs mmapped - as an array for all the processes, |
1166 | * and also separately for this process. | ||
1157 | */ | 1167 | */ |
1158 | if (subport == 0) { | 1168 | if (pgaddr == cvt_kvaddr(pd->subport_uregbase)) { |
1159 | unsigned num_slaves = pd->port_subport_cnt - 1; | 1169 | addr = pd->subport_uregbase; |
1160 | 1170 | size = PAGE_SIZE * pd->port_subport_cnt; | |
1161 | if (pgaddr == cvt_kvaddr(pd->subport_uregbase)) { | 1171 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvhdr_base)) { |
1162 | addr = pd->subport_uregbase; | 1172 | addr = pd->subport_rcvhdr_base; |
1163 | size = PAGE_SIZE * num_slaves; | 1173 | size = pd->port_rcvhdrq_size * pd->port_subport_cnt; |
1164 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvhdr_base)) { | 1174 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvegrbuf)) { |
1165 | addr = pd->subport_rcvhdr_base; | 1175 | addr = pd->subport_rcvegrbuf; |
1166 | size = pd->port_rcvhdrq_size * num_slaves; | 1176 | size *= pd->port_subport_cnt; |
1167 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvegrbuf)) { | 1177 | } else if (pgaddr == cvt_kvaddr(pd->subport_uregbase + |
1168 | addr = pd->subport_rcvegrbuf; | 1178 | PAGE_SIZE * subport)) { |
1169 | size *= num_slaves; | 1179 | addr = pd->subport_uregbase + PAGE_SIZE * subport; |
1170 | } else | 1180 | size = PAGE_SIZE; |
1171 | goto bail; | 1181 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvhdr_base + |
1172 | } else if (pgaddr == cvt_kvaddr(pd->subport_uregbase + | 1182 | pd->port_rcvhdrq_size * subport)) { |
1173 | PAGE_SIZE * (subport - 1))) { | 1183 | addr = pd->subport_rcvhdr_base + |
1174 | addr = pd->subport_uregbase + PAGE_SIZE * (subport - 1); | 1184 | pd->port_rcvhdrq_size * subport; |
1175 | size = PAGE_SIZE; | 1185 | size = pd->port_rcvhdrq_size; |
1176 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvhdr_base + | 1186 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvegrbuf + |
1177 | pd->port_rcvhdrq_size * (subport - 1))) { | 1187 | size * subport)) { |
1178 | addr = pd->subport_rcvhdr_base + | 1188 | addr = pd->subport_rcvegrbuf + size * subport; |
1179 | pd->port_rcvhdrq_size * (subport - 1); | 1189 | /* rcvegrbufs are read-only on the slave */ |
1180 | size = pd->port_rcvhdrq_size; | 1190 | if (vma->vm_flags & VM_WRITE) { |
1181 | } else if (pgaddr == cvt_kvaddr(pd->subport_rcvegrbuf + | 1191 | dev_info(&dd->pcidev->dev, |
1182 | size * (subport - 1))) { | 1192 | "Can't map eager buffers as " |
1183 | addr = pd->subport_rcvegrbuf + size * (subport - 1); | 1193 | "writable (flags=%lx)\n", vma->vm_flags); |
1184 | /* rcvegrbufs are read-only on the slave */ | 1194 | ret = -EPERM; |
1185 | if (vma->vm_flags & VM_WRITE) { | 1195 | goto bail; |
1186 | dev_info(&dd->pcidev->dev, | 1196 | } |
1187 | "Can't map eager buffers as " | 1197 | /* |
1188 | "writable (flags=%lx)\n", vma->vm_flags); | 1198 | * Don't allow permission to later change to writeable |
1189 | ret = -EPERM; | 1199 | * with mprotect. |
1190 | goto bail; | 1200 | */ |
1191 | } | 1201 | vma->vm_flags &= ~VM_MAYWRITE; |
1192 | /* | 1202 | } else { |
1193 | * Don't allow permission to later change to writeable | ||
1194 | * with mprotect. | ||
1195 | */ | ||
1196 | vma->vm_flags &= ~VM_MAYWRITE; | ||
1197 | } else | ||
1198 | goto bail; | 1203 | goto bail; |
1204 | } | ||
1199 | len = vma->vm_end - vma->vm_start; | 1205 | len = vma->vm_end - vma->vm_start; |
1200 | if (len > size) { | 1206 | if (len > size) { |
1201 | ipath_cdbg(MM, "FAIL: reqlen %lx > %zx\n", len, size); | 1207 | ipath_cdbg(MM, "FAIL: reqlen %lx > %zx\n", len, size); |
@@ -1273,14 +1279,13 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma) | |||
1273 | goto bail; | 1279 | goto bail; |
1274 | } | 1280 | } |
1275 | 1281 | ||
1282 | ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port; | ||
1276 | if (!pd->port_subport_cnt) { | 1283 | if (!pd->port_subport_cnt) { |
1277 | /* port is not shared */ | 1284 | /* port is not shared */ |
1278 | ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port; | ||
1279 | piocnt = dd->ipath_pbufsport; | 1285 | piocnt = dd->ipath_pbufsport; |
1280 | piobufs = pd->port_piobufs; | 1286 | piobufs = pd->port_piobufs; |
1281 | } else if (!subport_fp(fp)) { | 1287 | } else if (!subport_fp(fp)) { |
1282 | /* caller is the master */ | 1288 | /* caller is the master */ |
1283 | ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port; | ||
1284 | piocnt = (dd->ipath_pbufsport / pd->port_subport_cnt) + | 1289 | piocnt = (dd->ipath_pbufsport / pd->port_subport_cnt) + |
1285 | (dd->ipath_pbufsport % pd->port_subport_cnt); | 1290 | (dd->ipath_pbufsport % pd->port_subport_cnt); |
1286 | piobufs = pd->port_piobufs + | 1291 | piobufs = pd->port_piobufs + |
@@ -1289,7 +1294,6 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma) | |||
1289 | unsigned slave = subport_fp(fp) - 1; | 1294 | unsigned slave = subport_fp(fp) - 1; |
1290 | 1295 | ||
1291 | /* caller is a slave */ | 1296 | /* caller is a slave */ |
1292 | ureg = 0; | ||
1293 | piocnt = dd->ipath_pbufsport / pd->port_subport_cnt; | 1297 | piocnt = dd->ipath_pbufsport / pd->port_subport_cnt; |
1294 | piobufs = pd->port_piobufs + dd->ipath_palign * piocnt * slave; | 1298 | piobufs = pd->port_piobufs + dd->ipath_palign * piocnt * slave; |
1295 | } | 1299 | } |
@@ -1303,9 +1307,6 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma) | |||
1303 | ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0, | 1307 | ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0, |
1304 | (void *) dd->ipath_pioavailregs_dma, | 1308 | (void *) dd->ipath_pioavailregs_dma, |
1305 | "pioavail registers"); | 1309 | "pioavail registers"); |
1306 | else if (subport_fp(fp)) | ||
1307 | /* Subports don't mmap the physical receive buffers */ | ||
1308 | ret = -EINVAL; | ||
1309 | else if (pgaddr == pd->port_rcvegr_phys) | 1310 | else if (pgaddr == pd->port_rcvegr_phys) |
1310 | ret = mmap_rcvegrbufs(vma, pd); | 1311 | ret = mmap_rcvegrbufs(vma, pd); |
1311 | else if (pgaddr == (u64) pd->port_rcvhdrq_phys) | 1312 | else if (pgaddr == (u64) pd->port_rcvhdrq_phys) |
@@ -1403,32 +1404,41 @@ static int init_subports(struct ipath_devdata *dd, | |||
1403 | const struct ipath_user_info *uinfo) | 1404 | const struct ipath_user_info *uinfo) |
1404 | { | 1405 | { |
1405 | int ret = 0; | 1406 | int ret = 0; |
1406 | unsigned num_slaves; | 1407 | unsigned num_subports; |
1407 | size_t size; | 1408 | size_t size; |
1408 | 1409 | ||
1409 | /* Old user binaries don't know about subports */ | ||
1410 | if ((uinfo->spu_userversion & 0xffff) != IPATH_USER_SWMINOR) | ||
1411 | goto bail; | ||
1412 | /* | 1410 | /* |
1413 | * If the user is requesting zero or one port, | 1411 | * If the user is requesting zero or one port, |
1414 | * skip the subport allocation. | 1412 | * skip the subport allocation. |
1415 | */ | 1413 | */ |
1416 | if (uinfo->spu_subport_cnt <= 1) | 1414 | if (uinfo->spu_subport_cnt <= 1) |
1417 | goto bail; | 1415 | goto bail; |
1416 | |||
1417 | /* Old user binaries don't know about new subport implementation */ | ||
1418 | if ((uinfo->spu_userversion & 0xffff) != IPATH_USER_SWMINOR) { | ||
1419 | dev_info(&dd->pcidev->dev, | ||
1420 | "Mismatched user minor version (%d) and driver " | ||
1421 | "minor version (%d) while port sharing. Ensure " | ||
1422 | "that driver and library are from the same " | ||
1423 | "release.\n", | ||
1424 | (int) (uinfo->spu_userversion & 0xffff), | ||
1425 | IPATH_USER_SWMINOR); | ||
1426 | goto bail; | ||
1427 | } | ||
1418 | if (uinfo->spu_subport_cnt > INFINIPATH_MAX_SUBPORT) { | 1428 | if (uinfo->spu_subport_cnt > INFINIPATH_MAX_SUBPORT) { |
1419 | ret = -EINVAL; | 1429 | ret = -EINVAL; |
1420 | goto bail; | 1430 | goto bail; |
1421 | } | 1431 | } |
1422 | 1432 | ||
1423 | num_slaves = uinfo->spu_subport_cnt - 1; | 1433 | num_subports = uinfo->spu_subport_cnt; |
1424 | pd->subport_uregbase = vmalloc(PAGE_SIZE * num_slaves); | 1434 | pd->subport_uregbase = vmalloc(PAGE_SIZE * num_subports); |
1425 | if (!pd->subport_uregbase) { | 1435 | if (!pd->subport_uregbase) { |
1426 | ret = -ENOMEM; | 1436 | ret = -ENOMEM; |
1427 | goto bail; | 1437 | goto bail; |
1428 | } | 1438 | } |
1429 | /* Note: pd->port_rcvhdrq_size isn't initialized yet. */ | 1439 | /* Note: pd->port_rcvhdrq_size isn't initialized yet. */ |
1430 | size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * | 1440 | size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * |
1431 | sizeof(u32), PAGE_SIZE) * num_slaves; | 1441 | sizeof(u32), PAGE_SIZE) * num_subports; |
1432 | pd->subport_rcvhdr_base = vmalloc(size); | 1442 | pd->subport_rcvhdr_base = vmalloc(size); |
1433 | if (!pd->subport_rcvhdr_base) { | 1443 | if (!pd->subport_rcvhdr_base) { |
1434 | ret = -ENOMEM; | 1444 | ret = -ENOMEM; |
@@ -1437,7 +1447,7 @@ static int init_subports(struct ipath_devdata *dd, | |||
1437 | 1447 | ||
1438 | pd->subport_rcvegrbuf = vmalloc(pd->port_rcvegrbuf_chunks * | 1448 | pd->subport_rcvegrbuf = vmalloc(pd->port_rcvegrbuf_chunks * |
1439 | pd->port_rcvegrbuf_size * | 1449 | pd->port_rcvegrbuf_size * |
1440 | num_slaves); | 1450 | num_subports); |
1441 | if (!pd->subport_rcvegrbuf) { | 1451 | if (!pd->subport_rcvegrbuf) { |
1442 | ret = -ENOMEM; | 1452 | ret = -ENOMEM; |
1443 | goto bail_rhdr; | 1453 | goto bail_rhdr; |
@@ -1447,6 +1457,11 @@ static int init_subports(struct ipath_devdata *dd, | |||
1447 | pd->port_subport_id = uinfo->spu_subport_id; | 1457 | pd->port_subport_id = uinfo->spu_subport_id; |
1448 | pd->active_slaves = 1; | 1458 | pd->active_slaves = 1; |
1449 | set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag); | 1459 | set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag); |
1460 | memset(pd->subport_uregbase, 0, PAGE_SIZE * num_subports); | ||
1461 | memset(pd->subport_rcvhdr_base, 0, size); | ||
1462 | memset(pd->subport_rcvegrbuf, 0, pd->port_rcvegrbuf_chunks * | ||
1463 | pd->port_rcvegrbuf_size * | ||
1464 | num_subports); | ||
1450 | goto bail; | 1465 | goto bail; |
1451 | 1466 | ||
1452 | bail_rhdr: | 1467 | bail_rhdr: |
@@ -1588,7 +1603,7 @@ static int find_best_unit(struct file *fp, | |||
1588 | if (curcpu != -1) { | 1603 | if (curcpu != -1) { |
1589 | if (npresent) { | 1604 | if (npresent) { |
1590 | prefunit = curcpu / (ncpus / npresent); | 1605 | prefunit = curcpu / (ncpus / npresent); |
1591 | ipath_dbg("%s[%u] %d chips, %d cpus, " | 1606 | ipath_cdbg(PROC,"%s[%u] %d chips, %d cpus, " |
1592 | "%d cpus/chip, select unit %d\n", | 1607 | "%d cpus/chip, select unit %d\n", |
1593 | current->comm, current->pid, | 1608 | current->comm, current->pid, |
1594 | npresent, ncpus, ncpus / npresent, | 1609 | npresent, ncpus, ncpus / npresent, |
@@ -2086,7 +2101,7 @@ static ssize_t ipath_write(struct file *fp, const char __user *data, | |||
2086 | dest = &cmd.cmd.part_key; | 2101 | dest = &cmd.cmd.part_key; |
2087 | src = &ucmd->cmd.part_key; | 2102 | src = &ucmd->cmd.part_key; |
2088 | break; | 2103 | break; |
2089 | case IPATH_CMD_SLAVE_INFO: | 2104 | case __IPATH_CMD_SLAVE_INFO: |
2090 | copy = sizeof(cmd.cmd.slave_mask_addr); | 2105 | copy = sizeof(cmd.cmd.slave_mask_addr); |
2091 | dest = &cmd.cmd.slave_mask_addr; | 2106 | dest = &cmd.cmd.slave_mask_addr; |
2092 | src = &ucmd->cmd.slave_mask_addr; | 2107 | src = &ucmd->cmd.slave_mask_addr; |
@@ -2152,7 +2167,7 @@ static ssize_t ipath_write(struct file *fp, const char __user *data, | |||
2152 | case IPATH_CMD_SET_PART_KEY: | 2167 | case IPATH_CMD_SET_PART_KEY: |
2153 | ret = ipath_set_part_key(pd, cmd.cmd.part_key); | 2168 | ret = ipath_set_part_key(pd, cmd.cmd.part_key); |
2154 | break; | 2169 | break; |
2155 | case IPATH_CMD_SLAVE_INFO: | 2170 | case __IPATH_CMD_SLAVE_INFO: |
2156 | ret = ipath_get_slave_info(pd, | 2171 | ret = ipath_get_slave_info(pd, |
2157 | (void __user *) (unsigned long) | 2172 | (void __user *) (unsigned long) |
2158 | cmd.cmd.slave_mask_addr); | 2173 | cmd.cmd.slave_mask_addr); |