blob: c3dacf3b05bedccf033507fa822841a1ff215cef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* GXP client structure.
*
* Copyright (C) 2022 Google LLC
*/
#ifndef __GXP_CLIENT_H__
#define __GXP_CLIENT_H__
#include <linux/rwsem.h>
#include <linux/types.h>
#include "gxp-internal.h"
#include "gxp-eventfd.h"
#include "gxp-vd.h"
/* Holds state belonging to a client */
struct gxp_client {
struct list_head list_entry;
struct gxp_dev *gxp;
/*
* Protects all state of this client instance.
* Any operation that requires a client hold a particular wakelock must
* lock this semaphore for reading for the duration of that operation.
*/
struct rw_semaphore semaphore;
bool has_block_wakelock;
bool has_vd_wakelock;
/* Value is one of the GXP_POWER_STATE_* values from gxp.h. */
uint requested_power_state;
/* Value is one of the MEMORY_POWER_STATE_* values from gxp.h. */
uint requested_memory_power_state;
bool requested_aggressor;
struct gxp_virtual_device *vd;
bool tpu_mbx_allocated;
struct gxp_tpu_mbx_desc mbx_desc;
struct gxp_eventfd *mb_eventfds[GXP_NUM_CORES];
pid_t pid;
};
/*
* Allocates and initializes a client container.
*/
struct gxp_client *gxp_client_create(struct gxp_dev *gxp);
/*
* Frees up the client container cleaning up any wakelocks, virtual devices, or
* TPU mailboxes it holds.
*/
void gxp_client_destroy(struct gxp_client *client);
#endif /* __GXP_CLIENT_H__ */
|