summaryrefslogtreecommitdiff
path: root/drivers/gpu/host1x/channel.h
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2017-06-15 02:18:42 +0300
committerThierry Reding <treding@nvidia.com>2017-06-15 14:25:38 +0200
commit8474b02531c4881a762c52ef869c52429e38633f (patch)
tree41cdb37fa4e424170bd7670e07ca0981c9f6c81f /drivers/gpu/host1x/channel.h
parent03f0de770eda7a3f2e3950ca9f15d73e1dfd4596 (diff)
gpu: host1x: Refactor channel allocation code
This is largely a rewrite of the Host1x channel allocation code, bringing several changes: - The previous code could deadlock due to an interaction between the 'reflock' mutex and CDMA timeout handling. This gets rid of the mutex. - Support for more than 32 channels, required for Tegra186 - General refactoring, including better encapsulation of channel ownership handling into channel.c Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Tested-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/host1x/channel.h')
-rw-r--r--drivers/gpu/host1x/channel.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/host1x/channel.h b/drivers/gpu/host1x/channel.h
index df767cf90d51..7068e42d42df 100644
--- a/drivers/gpu/host1x/channel.h
+++ b/drivers/gpu/host1x/channel.h
@@ -20,17 +20,21 @@
#define __HOST1X_CHANNEL_H
#include <linux/io.h>
+#include <linux/kref.h>
#include "cdma.h"
struct host1x;
+struct host1x_channel;
-struct host1x_channel {
- struct list_head list;
+struct host1x_channel_list {
+ struct host1x_channel *channels;
+ unsigned long *allocated_channels;
+};
- unsigned int refcount;
+struct host1x_channel {
+ struct kref refcount;
unsigned int id;
- struct mutex reflock;
struct mutex submitlock;
void __iomem *regs;
struct device *dev;
@@ -38,9 +42,10 @@ struct host1x_channel {
};
/* channel list operations */
-int host1x_channel_list_init(struct host1x *host);
-
-#define host1x_for_each_channel(host, channel) \
- list_for_each_entry(channel, &host->chlist.list, list)
+int host1x_channel_list_init(struct host1x_channel_list *chlist,
+ unsigned int num_channels);
+void host1x_channel_list_free(struct host1x_channel_list *chlist);
+struct host1x_channel *host1x_channel_get_index(struct host1x *host,
+ unsigned int index);
#endif