summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-23 13:21:14 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-30 16:24:35 -0400
commit66a2511a366113fa4d42dc500c9df9b348d9f208 (patch)
tree5d2367412887214d040d9ade1f1d48c93c434a46 /drivers/gpu/nvgpu/include
parentb817e9e207cca88698d28b6b4ab410f03d715171 (diff)
gpu: nvgpu: Begin removing variables in struct gk20a
Begin removing all of the myriad flag variables in struct gk20a and replace that with one API that checks for flags being enabled or disabled. The API is as follows: bool nvgpu_is_enabled(struct gk20a *g, int flag); bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state); These APIs allow many of the gk20a flags to be replaced by defines. This makes flag usage consistent and saves a small amount of memory in struct gk20a. Also it makes struct gk20a easier to read since there's less clutter scattered through out. JIRA NVGPU-84 Change-Id: I6525cecbe97c4e8379e5f53e29ef0b4dbd1a7fc2 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1488049 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/enabled.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
new file mode 100644
index 00000000..5d30ba12
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __NVGPU_ENABLED_H__
18#define __NVGPU_ENABLED_H__
19
20struct gk20a;
21
22#include <nvgpu/types.h>
23
24/*
25 * Available flags that describe what's enabled and what's not in the GPU. Each
26 * flag here is defined by it's offset in a bitmap.
27 */
28#define NVGPU_IS_FMODEL 1
29#define NVGPU_DRIVER_IS_DYING 2
30
31/*
32 * Must be greater than the largest bit offset in the above list.
33 */
34#define NVGPU_MAX_ENABLED_BITS 64
35
36/**
37 * nvgpu_is_enabled - Check if the passed flag is enabled.
38 *
39 * @g - The GPU.
40 * @flag - Which flag to check.
41 *
42 * Returns true if the passed @flag is true; false otherwise.
43 */
44bool nvgpu_is_enabled(struct gk20a *g, int flag);
45
46/**
47 * __nvgpu_set_enabled - Set the state of a flag.
48 *
49 * @g - The GPU.
50 * @flag - Which flag to modify.
51 * @state - The state to set the flag to.
52 *
53 * Set the state of the passed @flag to @state. This will return the previous
54 * state of the passed @flag.
55 */
56bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state);
57
58int nvgpu_init_enabled_flags(struct gk20a *g);
59
60#endif