summaryrefslogtreecommitdiffstats
path: root/sys-kernel/boest-v5.0.15/raspberrypi/0165-Revert-staging-vchiq-rework-remove_event-handling.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sys-kernel/boest-v5.0.15/raspberrypi/0165-Revert-staging-vchiq-rework-remove_event-handling.patch')
-rw-r--r--sys-kernel/boest-v5.0.15/raspberrypi/0165-Revert-staging-vchiq-rework-remove_event-handling.patch217
1 files changed, 217 insertions, 0 deletions
diff --git a/sys-kernel/boest-v5.0.15/raspberrypi/0165-Revert-staging-vchiq-rework-remove_event-handling.patch b/sys-kernel/boest-v5.0.15/raspberrypi/0165-Revert-staging-vchiq-rework-remove_event-handling.patch
new file mode 100644
index 00000000..9383b481
--- /dev/null
+++ b/sys-kernel/boest-v5.0.15/raspberrypi/0165-Revert-staging-vchiq-rework-remove_event-handling.patch
@@ -0,0 +1,217 @@
+From beb7ad52e393753657d4f4c44e6c5f5a605178f3 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil@raspberrypi.org>
+Date: Wed, 6 Mar 2019 21:25:47 +0000
+Subject: [PATCH 165/194] Revert "staging: vchiq: rework remove_event handling"
+
+This reverts commit 852b2876a8a82f2c618da40b881bb07c2d42eb5c.
+
+Signed-off-by: Phil Elwell <phil@raspberrypi.org>
+---
+ .../interface/vchiq_arm/vchiq_core.c | 63 ++++++++++++-------
+ .../interface/vchiq_arm/vchiq_core.h | 12 ++--
+ 2 files changed, 45 insertions(+), 30 deletions(-)
+
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+index 1145a166a35f..163b8cfe435d 100644
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+@@ -418,23 +418,26 @@ vchiq_set_conn_state(struct vchiq_state *state, VCHIQ_CONNSTATE_T newstate)
+ }
+
+ static inline void
+-remote_event_create(wait_queue_head_t *wq, struct remote_event *event)
++remote_event_create(struct remote_event *event)
+ {
+ event->armed = 0;
+ /* Don't clear the 'fired' flag because it may already have been set
+ ** by the other side. */
+- init_waitqueue_head(wq);
+ }
+
+ static inline int
+-remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
++remote_event_wait(struct vchiq_state *state, struct remote_event *event)
+ {
+ if (!event->fired) {
+ event->armed = 1;
+ dsb(sy);
+- if (wait_event_killable(*wq, event->fired)) {
+- event->armed = 0;
+- return 0;
++ if (!event->fired) {
++ if (wait_for_completion_interruptible(
++ (struct completion *)
++ ((char *)state + event->event))) {
++ event->armed = 0;
++ return 0;
++ }
+ }
+ event->armed = 0;
+ wmb();
+@@ -445,27 +448,27 @@ remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
+ }
+
+ static inline void
+-remote_event_signal_local(wait_queue_head_t *wq, struct remote_event *event)
++remote_event_signal_local(struct vchiq_state *state, struct remote_event *event)
+ {
+ event->fired = 1;
+ event->armed = 0;
+- wake_up_all(wq);
++ complete((struct completion *)((char *)state + event->event));
+ }
+
+ static inline void
+-remote_event_poll(wait_queue_head_t *wq, struct remote_event *event)
++remote_event_poll(struct vchiq_state *state, struct remote_event *event)
+ {
+ if (event->fired && event->armed)
+- remote_event_signal_local(wq, event);
++ remote_event_signal_local(state, event);
+ }
+
+ void
+ remote_event_pollall(struct vchiq_state *state)
+ {
+- remote_event_poll(&state->sync_trigger_event, &state->local->sync_trigger);
+- remote_event_poll(&state->sync_release_event, &state->local->sync_release);
+- remote_event_poll(&state->trigger_event, &state->local->trigger);
+- remote_event_poll(&state->recycle_event, &state->local->recycle);
++ remote_event_poll(state, &state->local->sync_trigger);
++ remote_event_poll(state, &state->local->sync_release);
++ remote_event_poll(state, &state->local->trigger);
++ remote_event_poll(state, &state->local->recycle);
+ }
+
+ /* Round up message sizes so that any space at the end of a slot is always big
+@@ -550,7 +553,7 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service,
+ wmb();
+
+ /* ... and ensure the slot handler runs. */
+- remote_event_signal_local(&state->trigger_event, &state->local->trigger);
++ remote_event_signal_local(state, &state->local->trigger);
+ }
+
+ /* Called from queue_message, by the slot handler and application threads,
+@@ -1067,7 +1070,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
+ (mutex_lock_killable(&state->sync_mutex) != 0))
+ return VCHIQ_RETRY;
+
+- remote_event_wait(&state->sync_release_event, &local->sync_release);
++ remote_event_wait(state, &local->sync_release);
+
+ rmb();
+
+@@ -1887,7 +1890,7 @@ slot_handler_func(void *v)
+ while (1) {
+ DEBUG_COUNT(SLOT_HANDLER_COUNT);
+ DEBUG_TRACE(SLOT_HANDLER_LINE);
+- remote_event_wait(&state->trigger_event, &local->trigger);
++ remote_event_wait(state, &local->trigger);
+
+ rmb();
+
+@@ -1976,7 +1979,7 @@ recycle_func(void *v)
+ return -ENOMEM;
+
+ while (1) {
+- remote_event_wait(&state->recycle_event, &local->recycle);
++ remote_event_wait(state, &local->recycle);
+
+ process_free_queue(state, found, length);
+ }
+@@ -1999,7 +2002,7 @@ sync_func(void *v)
+ int type;
+ unsigned int localport, remoteport;
+
+- remote_event_wait(&state->sync_trigger_event, &local->sync_trigger);
++ remote_event_wait(state, &local->sync_trigger);
+
+ rmb();
+
+@@ -2194,6 +2197,11 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
+
+ init_completion(&state->connect);
+ mutex_init(&state->mutex);
++ init_completion(&state->trigger_event);
++ init_completion(&state->recycle_event);
++ init_completion(&state->sync_trigger_event);
++ init_completion(&state->sync_release_event);
++
+ mutex_init(&state->slot_mutex);
+ mutex_init(&state->recycle_mutex);
+ mutex_init(&state->sync_mutex);
+@@ -2225,18 +2233,25 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
+ state->data_use_count = 0;
+ state->data_quota = state->slot_queue_available - 1;
+
+- remote_event_create(&state->trigger_event, &local->trigger);
++ local->trigger.event = offsetof(struct vchiq_state, trigger_event);
++ remote_event_create(&local->trigger);
+ local->tx_pos = 0;
+- remote_event_create(&state->recycle_event, &local->recycle);
++
++ local->recycle.event = offsetof(struct vchiq_state, recycle_event);
++ remote_event_create(&local->recycle);
+ local->slot_queue_recycle = state->slot_queue_available;
+- remote_event_create(&state->sync_trigger_event, &local->sync_trigger);
+- remote_event_create(&state->sync_release_event, &local->sync_release);
++
++ local->sync_trigger.event = offsetof(struct vchiq_state, sync_trigger_event);
++ remote_event_create(&local->sync_trigger);
++
++ local->sync_release.event = offsetof(struct vchiq_state, sync_release_event);
++ remote_event_create(&local->sync_release);
+
+ /* At start-of-day, the slot is empty and available */
+ ((struct vchiq_header *)
+ SLOT_DATA_FROM_INDEX(state, local->slot_sync))->msgid =
+ VCHIQ_MSGID_PADDING;
+- remote_event_signal_local(&state->sync_release_event, &local->sync_release);
++ remote_event_signal_local(state, &local->sync_release);
+
+ local->debug[DEBUG_ENTRIES] = DEBUG_MAX;
+
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+index 5f07db519633..2a84b5df2046 100644
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+@@ -37,7 +37,6 @@
+ #include <linux/mutex.h>
+ #include <linux/completion.h>
+ #include <linux/kthread.h>
+-#include <linux/wait.h>
+
+ #include "vchiq_cfg.h"
+
+@@ -263,7 +262,8 @@ struct vchiq_bulk_queue {
+ struct remote_event {
+ int armed;
+ int fired;
+- u32 __unused;
++ /* Contains offset from the beginning of the VCHIQ_STATE_T structure */
++ u32 event;
+ };
+
+ typedef struct opaque_platform_state_t *VCHIQ_PLATFORM_STATE_T;
+@@ -424,16 +424,16 @@ struct vchiq_state {
+ struct task_struct *sync_thread;
+
+ /* Local implementation of the trigger remote event */
+- wait_queue_head_t trigger_event;
++ struct completion trigger_event;
+
+ /* Local implementation of the recycle remote event */
+- wait_queue_head_t recycle_event;
++ struct completion recycle_event;
+
+ /* Local implementation of the sync trigger remote event */
+- wait_queue_head_t sync_trigger_event;
++ struct completion sync_trigger_event;
+
+ /* Local implementation of the sync release remote event */
+- wait_queue_head_t sync_release_event;
++ struct completion sync_release_event;
+
+ char *tx_data;
+ char *rx_data;