4a2ad17ae26eaed8378a63984bad33d23e4a6ef5
[openwrt/staging/lynxis.git] /
1 From 557bd0e3900e81fa06279658494b2d535a5e8869 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Tue, 22 Jan 2019 12:04:09 +0000
4 Subject: [PATCH 313/782] staging: mmal-vchiq: Fix client_component for 64 bit
5 kernel
6
7 The MMAL client_component field is used with the event
8 mechanism to allow the client to identify the component for
9 which the event is generated.
10 The field is only 32bits in size, therefore we can't use a
11 pointer to the component in a 64 bit kernel.
12
13 Component handles are already held in an array per VCHI
14 instance, so use the array index as the client_component handle
15 to avoid having to create a new IDR for this purpose.
16
17 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
18 ---
19 .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 12 +++++++++---
20 .../staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 1 +
21 2 files changed, 10 insertions(+), 3 deletions(-)
22
23 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
24 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
25 @@ -473,9 +473,9 @@ buffer_from_host(struct vchiq_mmal_insta
26 static void event_to_host_cb(struct vchiq_mmal_instance *instance,
27 struct mmal_msg *msg, u32 msg_len)
28 {
29 - /* FIXME: Not going to work on 64 bit */
30 + int comp_idx = msg->u.event_to_host.client_component;
31 struct vchiq_mmal_component *component =
32 - (struct vchiq_mmal_component *)msg->u.event_to_host.client_component;
33 + &instance->component[comp_idx];
34 struct vchiq_mmal_port *port = NULL;
35 struct mmal_msg_context *msg_context;
36 u32 port_num = msg->u.event_to_host.port_num;
37 @@ -1074,7 +1074,7 @@ static int create_component(struct vchiq
38
39 /* build component create message */
40 m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
41 - m.u.component_create.client_component = (u32)(unsigned long)component;
42 + m.u.component_create.client_component = component->client_component;
43 strncpy(m.u.component_create.name, name,
44 sizeof(m.u.component_create.name));
45
46 @@ -1869,6 +1869,12 @@ int vchiq_mmal_component_init(struct vch
47 goto unlock;
48 }
49
50 + /* We need a handle to reference back to our component structure.
51 + * Use the array index in instance->component rather than rolling
52 + * another IDR.
53 + */
54 + component->client_component = idx;
55 +
56 ret = create_component(instance, component, name);
57 if (ret < 0) {
58 pr_err("%s: failed to create component %d (Not enough GPU mem?)\n",
59 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
60 +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h
61 @@ -97,6 +97,7 @@ struct vchiq_mmal_component {
62 struct vchiq_mmal_port input[MAX_PORT_COUNT]; /* input ports */
63 struct vchiq_mmal_port output[MAX_PORT_COUNT]; /* output ports */
64 struct vchiq_mmal_port clock[MAX_PORT_COUNT]; /* clock ports */
65 + u32 client_component; /* Used to ref back to client struct */
66 };
67
68 int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance);