Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/vchiq/dist/interface Merge upstream fixes.
details: https://anonhg.NetBSD.org/src/rev/27251c74235e
branches: trunk
changeset: 328142:27251c74235e
user: skrll <skrll%NetBSD.org@localhost>
date: Thu Mar 27 23:03:06 2014 +0000
description:
Merge upstream fixes.
diffstat:
sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h | 4 +
sys/external/bsd/vchiq/dist/interface/vchi/vchi_cfg.h | 1 -
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c | 49 +++--
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c | 18 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h | 11 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_if.h | 37 ++--
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_ioctl.h | 26 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c | 24 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c | 75 +++++----
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_util.c | 31 ++++
10 files changed, 170 insertions(+), 106 deletions(-)
diffs (truncated from 722 to 300 lines):
diff -r 694ea6fada6d -r 27251c74235e sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h
--- a/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h Thu Mar 27 21:21:47 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h Thu Mar 27 23:03:06 2014 +0000
@@ -391,6 +391,10 @@
#define wmb membar_producer
#define dsb membar_producer
+#define smp_mb membar_producer
+#define smp_rmb membar_consumer
+#define smp_wmb membar_producer
+
#define device_print_prettyname(dev) device_printf((dev), "")
#endif /* __VCHI_NETBSD_H__ */
diff -r 694ea6fada6d -r 27251c74235e sys/external/bsd/vchiq/dist/interface/vchi/vchi_cfg.h
--- a/sys/external/bsd/vchiq/dist/interface/vchi/vchi_cfg.h Thu Mar 27 21:21:47 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchi/vchi_cfg.h Thu Mar 27 23:03:06 2014 +0000
@@ -41,7 +41,6 @@
/* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */
/* Really determined by the message driver, and should be available from a run-time call. */
-/* XXX: fixme */
#ifndef VCHI_BULK_ALIGN
# if __VCCOREVER__ >= 0x04000000
# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans
diff -r 694ea6fada6d -r 27251c74235e sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Thu Mar 27 21:21:47 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c Thu Mar 27 23:03:06 2014 +0000
@@ -384,6 +384,22 @@
/****************************************************************************
*
+* user_service_free
+*
+***************************************************************************/
+static void
+user_service_free(void *userdata)
+{
+ USER_SERVICE_T *user_service = userdata;
+
+ _sema_destroy(&user_service->insert_event);
+ _sema_destroy(&user_service->remove_event);
+
+ kfree(user_service);
+}
+
+/****************************************************************************
+*
* vchiq_ioctl
*
***************************************************************************/
@@ -465,7 +481,7 @@
void *userdata;
int srvstate;
- user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL);
+ user_service = kzalloc(sizeof(USER_SERVICE_T), GFP_KERNEL);
if (!user_service) {
ret = -ENOMEM;
break;
@@ -491,7 +507,7 @@
service = vchiq_add_service_internal(
instance->state,
&pargs->params, srvstate,
- instance);
+ instance, user_service_free);
if (service != NULL) {
user_service->service = service;
@@ -514,8 +530,6 @@
service = NULL;
ret = (status == VCHIQ_RETRY) ?
-EINTR : -EIO;
- user_service->service = NULL;
- user_service->instance = NULL;
break;
}
}
@@ -655,14 +669,14 @@
lmutex_unlock(&instance->bulk_waiter_list_mutex);
if (!waiter) {
vchiq_log_error(vchiq_arm_log_level,
- "no bulk_waiter found for pid %d",
- current->l_proc->p_pid);
+ "no bulk_waiter found for lwp %p",
+ current);
ret = -ESRCH;
break;
}
vchiq_log_info(vchiq_arm_log_level,
- "found bulk_waiter %x for pid %d",
- (unsigned int)waiter, current->l_proc->p_pid);
+ "found bulk_waiter %x for lwp %p",
+ (unsigned int)waiter, current);
pargs->userdata = &waiter->bulk_waiter;
}
status = vchiq_bulk_transfer
@@ -692,8 +706,8 @@
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 pid %d",
- (unsigned int)waiter, current->l_proc->p_pid);
+ "saved bulk_waiter %x for lwp %p",
+ (unsigned int)waiter, current);
pargs->mode = mode_waiting;
}
@@ -701,6 +715,7 @@
case VCHIQ_IOC_AWAIT_COMPLETION: {
VCHIQ_AWAIT_COMPLETION_T *pargs = arg;
+ int count = 0;
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
if (!instance->connected) {
@@ -735,7 +750,6 @@
if (ret == 0) {
int msgbufcount = pargs->msgbufcount;
- int count = 0;
for (count = 0; count < pargs->count; count++) {
VCHIQ_COMPLETION_DATA_T *completion;
VCHIQ_SERVICE_T *service1;
@@ -809,12 +823,8 @@
}
if (completion->reason ==
- VCHIQ_SERVICE_CLOSED) {
+ VCHIQ_SERVICE_CLOSED)
unlock_service(service1);
- _sema_destroy(&user_service->insert_event);
- _sema_destroy(&user_service->remove_event);
- kfree(user_service);
- }
if (copy_to_user((void __user *)(
(size_t)pargs->buf +
@@ -833,7 +843,7 @@
pargs->count = count;
}
- if (ret != 0)
+ if ((ret == 0 && count > 0) || ret != 0)
up(&instance->remove_event);
lmutex_unlock(&instance->completion_mutex);
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
@@ -1039,7 +1049,7 @@
return -ENOTCONN;
}
- instance = kmalloc(sizeof(*instance), GFP_KERNEL);
+ instance = kzalloc(sizeof(*instance), GFP_KERNEL);
if (!instance)
return -ENOMEM;
@@ -1161,9 +1171,6 @@
spin_unlock(&msg_queue_spinlock);
unlock_service(service);
- _sema_destroy(&user_service->insert_event);
- _sema_destroy(&user_service->remove_event);
- kfree(user_service);
}
/* Release any closed services */
diff -r 694ea6fada6d -r 27251c74235e sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Thu Mar 27 21:21:47 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.c Thu Mar 27 23:03:06 2014 +0000
@@ -77,7 +77,7 @@
static atomic_t pause_bulks_count = ATOMIC_INIT(0);
-DEFINE_SPINLOCK(service_spinlock);
+static DEFINE_SPINLOCK(service_spinlock);
DEFINE_SPINLOCK(bulk_waiter_spinlock);
DEFINE_SPINLOCK(quota_spinlock);
@@ -285,6 +285,9 @@
}
spin_unlock(&service_spinlock);
+ if (service && service->userdata_term)
+ service->userdata_term(service->base.userdata);
+
kfree(service);
}
@@ -1456,7 +1459,7 @@
}
state->deferred_bulks = 0;
}
-
+
static int
parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header)
{
@@ -1565,7 +1568,8 @@
return 1;
bail_not_ready:
- unlock_service(service);
+ if (service)
+ unlock_service(service);
return 0;
}
@@ -2487,7 +2491,7 @@
VCHIQ_SERVICE_T *
vchiq_add_service_internal(VCHIQ_STATE_T *state,
const VCHIQ_SERVICE_PARAMS_T *params, int srvstate,
- VCHIQ_INSTANCE_T instance)
+ VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term)
{
VCHIQ_SERVICE_T *service;
@@ -2499,6 +2503,7 @@
service->handle = VCHIQ_SERVICE_HANDLE_INVALID;
service->ref_count = 1;
service->srvstate = VCHIQ_SRVSTATE_FREE;
+ service->userdata_term = userdata_term;
service->localport = VCHIQ_PORT_FREE;
service->remoteport = VCHIQ_PORT_FREE;
@@ -3255,8 +3260,7 @@
bulk->size = size;
bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED;
- if (vchiq_prepare_bulk_data(bulk, memhandle,
- (void*)offset, size, dir) !=
+ if (vchiq_prepare_bulk_data(bulk, memhandle, offset, size, dir) !=
VCHIQ_SUCCESS)
goto unlock_error_exit;
@@ -3323,7 +3327,7 @@
VCHIQ_STATUS_T
vchiq_queue_message(VCHIQ_SERVICE_HANDLE_T handle,
- const VCHIQ_ELEMENT_T *elements, int count)
+ const VCHIQ_ELEMENT_T *elements, unsigned int count)
{
VCHIQ_SERVICE_T *service = find_service_by_handle(handle);
VCHIQ_STATUS_T status = VCHIQ_ERROR;
diff -r 694ea6fada6d -r 27251c74235e sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h Thu Mar 27 21:21:47 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_core.h Thu Mar 27 23:03:06 2014 +0000
@@ -238,6 +238,8 @@
VCHIQ_BULK_RECEIVE
} VCHIQ_BULK_DIR_T;
+typedef void (*VCHIQ_USERDATA_TERM_T)(void *userdata);
+
typedef struct vchiq_bulk_struct {
short mode;
short dir;
@@ -278,13 +280,14 @@
/* Use two counters rather than one to avoid the need for a mutex. */
short use_count;
short release_count;
-} __packed VCHIQ_SLOT_INFO_T;
+} VCHIQ_SLOT_INFO_T;
typedef struct vchiq_service_struct {
VCHIQ_SERVICE_BASE_T base;
VCHIQ_SERVICE_HANDLE_T handle;
unsigned int ref_count;
int srvstate;
+ VCHIQ_USERDATA_TERM_T userdata_term;
unsigned int localport;
unsigned int remoteport;
int public_fourcc;
@@ -378,7 +381,7 @@
/* Debugging state */
int debug[DEBUG_MAX];
-} __packed VCHIQ_SHARED_STATE_T;
+} VCHIQ_SHARED_STATE_T;
typedef struct vchiq_slot_zero_struct {
int magic;
@@ -392,7 +395,7 @@
VCHIQ_SHARED_STATE_T master;
VCHIQ_SHARED_STATE_T slave;
VCHIQ_SLOT_INFO_T slots[VCHIQ_MAX_SLOTS];
-} __packed VCHIQ_SLOT_ZERO_T;
+} VCHIQ_SLOT_ZERO_T;
struct vchiq_state_struct {
int id;
@@ -535,7 +538,7 @@
extern VCHIQ_SERVICE_T *
vchiq_add_service_internal(VCHIQ_STATE_T *state,
const VCHIQ_SERVICE_PARAMS_T *params, int srvstate,
- VCHIQ_INSTANCE_T instance);
+ VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term);
extern VCHIQ_STATUS_T
vchiq_open_service_internal(VCHIQ_SERVICE_T *service, int client_id);
diff -r 694ea6fada6d -r 27251c74235e sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_if.h
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_if.h Thu Mar 27 21:21:47 2014 +0000
Home |
Main Index |
Thread Index |
Old Index