CVS commit: [netbsd-7] src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: martin Date: Wed Jan 28 11:24:31 UTC 2015 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm [netbsd-7]: vchiq_arm.c vchiq_kern_lib.c Log Message: Pull up following revision(s) (requested by skrll in ticket #464): sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c: revision 1.6 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c: revision 1.16 It turns out we needed to track pid all along, so revert the lwp tracking I did ages ago. quake has a chance of working now. To generate a diff of this commit: cvs rdiff -u -r1.13.2.2 -r1.13.2.3 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.5 -r1.5.2.1 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.2 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.3 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.2 Fri Jan 23 16:29:36 2015 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Wed Jan 28 11:24:31 2015 @@ -120,7 +120,7 @@ typedef struct user_service_struct { struct bulk_waiter_node { struct bulk_waiter bulk_waiter; - struct lwp *l; + int pid; struct list_head list; }; @@ -135,7 +135,7 @@ struct vchiq_instance_struct { int connected; int closing; - struct lwp *l; + int pid; int mark; struct list_head bulk_waiter_list; @@ -527,7 +527,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (pargs-is_open) { status = vchiq_open_service_internal - (service, (uintptr_t)instance-l); + (service, instance-pid); if (status != VCHIQ_SUCCESS) { vchiq_remove_service(service-handle); service = NULL; @@ -660,7 +660,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, lmutex_lock(instance-bulk_waiter_list_mutex); list_for_each(pos, instance-bulk_waiter_list) { if (list_entry(pos, struct bulk_waiter_node, - list)-l == current) { + list)-pid == current-l_proc-p_pid) { waiter = list_entry(pos, struct bulk_waiter_node, list); @@ -672,14 +672,14 @@ vchiq_ioctl(struct file *fp, u_long cmd, lmutex_unlock(instance-bulk_waiter_list_mutex); if (!waiter) { vchiq_log_error(vchiq_arm_log_level, - no bulk_waiter found for lwp %p, - current); + no bulk_waiter found for pid %d, + current-l_proc-p_pid); ret = -ESRCH; break; } vchiq_log_info(vchiq_arm_log_level, -found bulk_waiter %x for lwp %p, -(unsigned int)waiter, current); +found bulk_waiter %x for pid %d, +(unsigned int)waiter, current-l_proc-p_pid); pargs-userdata = waiter-bulk_waiter; } status = vchiq_bulk_transfer @@ -704,13 +704,13 @@ vchiq_ioctl(struct file *fp, u_long cmd, } else { const VCHIQ_BULK_MODE_T mode_waiting = VCHIQ_BULK_MODE_WAITING; - waiter-l = current; + waiter-pid = current-l_proc-p_pid; lmutex_lock(instance-bulk_waiter_list_mutex); list_add(waiter-list, instance-bulk_waiter_list); lmutex_unlock(instance-bulk_waiter_list_mutex); vchiq_log_info(vchiq_arm_log_level, -saved bulk_waiter %x for lwp %p, -(unsigned int)waiter, current); +saved bulk_waiter %x for pid %d, +(unsigned int)waiter, current-l_proc-p_pid); pargs-mode = mode_waiting; } @@ -1064,7 +1064,7 @@ vchiq_open(dev_t dev, int flags, int mod } instance-state = state; - instance-l = l; + instance-pid = current-l_proc-p_pid; #ifdef notyet ret = vchiq_proc_add_instance(instance); @@ -1205,8 +1205,8 @@ vchiq_close(struct file *fp) list_del(pos); vchiq_log_info(vchiq_arm_log_level, bulk_waiter - cleaned up %x - for lwp %p, - (unsigned int)waiter, waiter-l); + for pid %d, + (unsigned int)waiter, waiter-pid); _sema_destroy(waiter-bulk_waiter.event); kfree(waiter); } @@ -1297,9 +1297,9 @@ vchiq_dump_platform_instances(void *dump instance = service-instance; if (instance !instance-mark) { len = snprintf(buf, sizeof(buf), - Instance %x: lwp %p,%s completions + Instance %x: pid %d,%s completions %d/%d, - (unsigned int)instance, instance-l, + (unsigned int)instance, instance-pid, instance-connected ? connected, : , instance-completion_insert - Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.5 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.5.2.1 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c:1.5 Wed Jul 16 23:59:58 2014 +++
CVS commit: [netbsd-7] src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: martin Date: Fri Jan 23 16:29:37 UTC 2015 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm [netbsd-7]: vchiq_arm.c Log Message: Pull up following revision(s) (requested by skrll in ticket #446): sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c: revision 1.15 More count vs ret confusion. Need to send notification if count != 0. To generate a diff of this commit: cvs rdiff -u -r1.13.2.1 -r1.13.2.2 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.2 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.1 Mon Dec 29 16:25:28 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Fri Jan 23 16:29:36 2015 @@ -718,6 +718,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, case VCHIQ_IOC_AWAIT_COMPLETION: { VCHIQ_AWAIT_COMPLETION_T *pargs = arg; + int count = 0; DEBUG_TRACE(AWAIT_COMPLETION_LINE); if (!instance-connected) { @@ -752,9 +753,8 @@ vchiq_ioctl(struct file *fp, u_long cmd, if (ret == 0) { int msgbufcount = pargs-msgbufcount; - int count; - for (count = 0; count pargs-count; count++) { + for (; count pargs-count; count++) { VCHIQ_COMPLETION_DATA_T *completion; VCHIQ_SERVICE_T *service1; USER_SERVICE_T *user_service; @@ -847,7 +847,7 @@ vchiq_ioctl(struct file *fp, u_long cmd, pargs-count = count; } - if (ret != 0) + if (count != 0) up(instance-remove_event); lmutex_unlock(instance-completion_mutex); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
CVS commit: [netbsd-7] src/sys/external/bsd/vchiq/dist/interface/vchiq_arm
Module Name:src Committed By: martin Date: Mon Dec 29 16:25:28 UTC 2014 Modified Files: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm [netbsd-7]: vchiq_arm.c vchiq_core.c Log Message: Pull up following revision(s) (requested by nat in ticket #345): sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c: revision 1.14 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c: revision 1.10 Enable state/stats information on vchiq device read. Allow more space for temp string buffer in service stats display. Fixes corrupted display when rx and tx count become large. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.13.2.1 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c cvs rdiff -u -r1.9 -r1.9.6.1 \ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13.2.1 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c:1.13 Fri Jul 25 08:10:40 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Mon Dec 29 16:25:28 2014 @@ -36,6 +36,7 @@ #include sys/device.h #include sys/file.h #include sys/filedesc.h +#include sys/kmem.h #include vchiq_core.h #include vchiq_ioctl.h @@ -196,9 +197,10 @@ extern struct cfdriver vchiq_cd; static int vchiq_ioctl(struct file *, u_long, void *); static int vchiq_close(struct file *); +static int vchiq_read(struct file *, off_t *, struct uio *, kauth_cred_t, int); static const struct fileops vchiq_fileops = { - .fo_read = fbadop_read, + .fo_read = vchiq_read, .fo_write = fbadop_write, .fo_ioctl = vchiq_ioctl, .fo_fcntl = fnullop_fcntl, @@ -1245,9 +1247,7 @@ vchiq_dump(void *dump_context, const cha copy_bytes = min(len, (int)(context-space - context-actual)); if (copy_bytes == 0) return; - if (copy_to_user(context-buf + context-actual, str, - copy_bytes)) - context-actual = -EFAULT; + memcpy(context-buf + context-actual, str, copy_bytes); context-actual += copy_bytes; len -= copy_bytes; @@ -1256,9 +1256,7 @@ vchiq_dump(void *dump_context, const cha ** carriage return. */ if ((len == 0) (str[copy_bytes - 1] == '\0')) { char cr = '\n'; - if (copy_to_user(context-buf + context-actual - 1, -cr, 1)) -context-actual = -EFAULT; + memcpy(context-buf + context-actual - 1, cr, 1); } } } @@ -1432,6 +1430,7 @@ dump_phys_mem(void *virt_addr, uint32_t kfree(pages); } +#endif / * @@ -1439,23 +1438,29 @@ dump_phys_mem(void *virt_addr, uint32_t * ***/ -static ssize_t -vchiq_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) +static int +vchiq_read(struct file *file, off_t *ppos, struct uio *uio, kauth_cred_t cred, +int flags) { + int result; + + char *buf = kmem_zalloc(PAGE_SIZE, KM_SLEEP); + DUMP_CONTEXT_T context; context.buf = buf; context.actual = 0; - context.space = count; + context.space = PAGE_SIZE; context.offset = *ppos; vchiq_dump_state(context, g_state); *ppos += context.actual; - return context.actual; + result = uiomove(buf, context.actual, uio); + kmem_free(buf, PAGE_SIZE); + + return result; } -#endif VCHIQ_STATE_T * vchiq_get_state(void) Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9.6.1 --- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c:1.9 Thu Mar 27 23:03:07 2014 +++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Mon Dec 29 16:25:28 2014 @@ -3648,7 +3648,7 @@ vchiq_dump_state(void *dump_context, VCH void vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service) { - char buf[80]; + char buf[120]; int len; len = snprintf(buf, sizeof(buf), Service %d: %s (ref %u),