summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/enabled.h5
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/sec2.h97
3 files changed, 103 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
index ccf60546..074be0c3 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h
@@ -170,10 +170,13 @@ struct gk20a;
170/* Multiple WPR support */ 170/* Multiple WPR support */
171#define NVGPU_SUPPORT_MULTIPLE_WPR 68 171#define NVGPU_SUPPORT_MULTIPLE_WPR 68
172 172
173/* SEC2 RTOS support*/
174#define NVGPU_SUPPORT_SEC2_RTOS 69
175
173/* 176/*
174 * Must be greater than the largest bit offset in the above list. 177 * Must be greater than the largest bit offset in the above list.
175 */ 178 */
176#define NVGPU_MAX_ENABLED_BITS 69 179#define NVGPU_MAX_ENABLED_BITS 70
177 180
178/** 181/**
179 * nvgpu_is_enabled - Check if the passed flag is enabled. 182 * nvgpu_is_enabled - Check if the passed flag is enabled.
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
index 104d463b..bb46d85c 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
@@ -67,6 +67,7 @@ struct nvgpu_gpfifo_args;
67#include <nvgpu/sim.h> 67#include <nvgpu/sim.h>
68#include <nvgpu/ecc.h> 68#include <nvgpu/ecc.h>
69#include <nvgpu/tsg.h> 69#include <nvgpu/tsg.h>
70#include <nvgpu/sec2.h>
70 71
71#include "gk20a/clk_gk20a.h" 72#include "gk20a/clk_gk20a.h"
72#include "gk20a/ce2_gk20a.h" 73#include "gk20a/ce2_gk20a.h"
@@ -1450,6 +1451,7 @@ struct gk20a {
1450 struct perf_pmupstate perf_pmu; 1451 struct perf_pmupstate perf_pmu;
1451 struct pmgr_pmupstate pmgr_pmu; 1452 struct pmgr_pmupstate pmgr_pmu;
1452 struct therm_pmupstate therm_pmu; 1453 struct therm_pmupstate therm_pmu;
1454 struct nvgpu_sec2 sec2;
1453 1455
1454#ifdef CONFIG_DEBUG_FS 1456#ifdef CONFIG_DEBUG_FS
1455 struct railgate_stats pstats; 1457 struct railgate_stats pstats;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/sec2.h b/drivers/gpu/nvgpu/include/nvgpu/sec2.h
new file mode 100644
index 00000000..7c755841
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/sec2.h
@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef NVGPU_SEC2_H
24#define NVGPU_SEC2_H
25
26#include <nvgpu/kmem.h>
27#include <nvgpu/dma.h>
28#include <nvgpu/nvgpu_mem.h>
29#include <nvgpu/allocator.h>
30#include <nvgpu/lock.h>
31#include <nvgpu/flcnif_cmn.h>
32#include <nvgpu/falcon.h>
33
34#include <nvgpu/sec2if/sec2_cmd_if.h>
35#include <nvgpu/sec2if/sec2_if_sec2.h>
36
37#define NVGPU_SEC2_TRACE_BUFSIZE (32U*1024U)
38
39#define SEC2_MAX_NUM_SEQUENCES (256U)
40#define SEC2_SEQ_BIT_SHIFT (5U)
41#define SEC2_SEQ_TBL_SIZE \
42 (SEC2_MAX_NUM_SEQUENCES >> SEC2_SEQ_BIT_SHIFT)
43
44#define SEC2_INVALID_SEQ_DESC (~0U)
45
46enum {
47 SEC2_SEQ_STATE_FREE = 0U,
48 SEC2_SEQ_STATE_PENDING,
49 SEC2_SEQ_STATE_USED,
50 SEC2_SEQ_STATE_CANCELLED
51};
52
53typedef void (*sec2_callback)(struct gk20a *, struct nv_flcn_msg_sec2 *,
54 void *, u32, u32);
55
56struct sec2_sequence {
57 u8 id;
58 u32 state;
59 u32 desc;
60 struct nv_flcn_msg_sec2 *msg;
61 u8 *out_payload;
62 sec2_callback callback;
63 void *cb_params;
64};
65
66struct nvgpu_sec2 {
67 struct gk20a *g;
68 struct nvgpu_falcon *flcn;
69 u32 falcon_id;
70
71 struct nvgpu_falcon_queue queue[SEC2_QUEUE_NUM];
72
73 struct sec2_sequence *seq;
74 unsigned long sec2_seq_tbl[SEC2_SEQ_TBL_SIZE];
75 u32 next_seq_desc;
76 struct nvgpu_mutex sec2_seq_lock;
77
78 bool isr_enabled;
79 struct nvgpu_mutex isr_mutex;
80
81 struct nvgpu_allocator dmem;
82
83 /* set to true once init received */
84 bool sec2_ready;
85
86 struct nvgpu_mem trace_buf;
87
88 void (*remove_support)(struct nvgpu_sec2 *sec2);
89
90 u32 command_ack;
91};
92
93/* sec2 init */
94int nvgpu_init_sec2_support(struct gk20a *g);
95int nvgpu_sec2_destroy(struct gk20a *g);
96
97#endif /* NVGPU_SEC2_H */