summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv100/bios_gv100.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-08-04 00:43:50 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-10 15:05:41 -0400
commitf518304e0d8102216c7c0022cd4b66fcd844264c (patch)
treefc6be25fb1f713654d5f725361bd1ecb722a085c /drivers/gpu/nvgpu/gv100/bios_gv100.c
parentbb1c38e2f5f133a4281f73f8076a206ec728bd22 (diff)
gpu: nvgpu: fix GV100 hal definitions
These changes allow GV100 to init the basic HALs to pass nvgpu_submit_twod (1) Allocate fault buffer from vidmem instead of sysmem to prevent coherency issues (2) Properly enable FB (3) Fan control requires the execution of the pre-os FW, without it the SKU201 is extremely noisy JIRA: NVGPUGV100-9 Change-Id: I9b2072737e45432f957e7faae6d33bc0ab43b817 Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1539926 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv100/bios_gv100.c')
-rw-r--r--drivers/gpu/nvgpu/gv100/bios_gv100.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv100/bios_gv100.c b/drivers/gpu/nvgpu/gv100/bios_gv100.c
new file mode 100644
index 00000000..9ca05a11
--- /dev/null
+++ b/drivers/gpu/nvgpu/gv100/bios_gv100.c
@@ -0,0 +1,108 @@
1/*
2 * Copyright (c) 2017, 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#include <nvgpu/bios.h>
24#include <nvgpu/nvgpu_common.h>
25#include <nvgpu/timers.h>
26
27#include "gk20a/gk20a.h"
28#include "gp106/bios_gp106.h"
29#include "bios_gv100.h"
30
31#include <nvgpu/hw/gv100/hw_pwr_gv100.h>
32#include <nvgpu/hw/gv100/hw_bus_gv100.h>
33
34#define PMU_BOOT_TIMEOUT_DEFAULT 100 /* usec */
35#define PMU_BOOT_TIMEOUT_MAX 2000000 /* usec */
36
37#define SCRATCH_PREOS_PROGRESS 6
38#define PREOS_PROGRESS_MASK(r) ((r >> 12) & 0xf)
39#define PREOS_PROGRESS_NOT_STARTED 0
40#define PREOS_PROGRESS_STARTED 1
41#define PREOS_PROGRESS_EXIT 2
42#define PREOS_PROGRESS_EXIT_SECUREMODE 3
43#define PREOS_PROGRESS_ABORTED 6
44
45#define SCRATCH_PMU_EXIT_AND_HALT 1
46#define PMU_EXIT_AND_HALT_SET(r, v) ((r & ~0x200UL) | v)
47#define PMU_EXIT_AND_HALT_YES (0x1UL << 9)
48
49#define SCRATCH_PRE_OS_RELOAD 1
50#define PRE_OS_RELOAD_SET(r, v) ((r & ~0x100UL) | v)
51#define PRE_OS_RELOAD_YES (0x1UL << 8)
52
53
54void gv100_bios_preos_reload_check(struct gk20a *g)
55{
56 u32 progress = gk20a_readl(g,
57 bus_sw_scratch_r(SCRATCH_PREOS_PROGRESS));
58
59 if (PREOS_PROGRESS_MASK(progress) != PREOS_PROGRESS_NOT_STARTED) {
60 u32 reload = gk20a_readl(g,
61 bus_sw_scratch_r(SCRATCH_PRE_OS_RELOAD));
62
63 gk20a_writel(g, bus_sw_scratch_r(SCRATCH_PRE_OS_RELOAD),
64 PRE_OS_RELOAD_SET(reload, PRE_OS_RELOAD_YES));
65 }
66}
67
68int gv100_bios_preos_wait_for_halt(struct gk20a *g)
69{
70 int err = -EINVAL;
71 u32 progress;
72 u32 tmp;
73 int preos_completed;
74 struct nvgpu_timeout timeout;
75
76 nvgpu_udelay(PMU_BOOT_TIMEOUT_DEFAULT);
77
78 /* Check the progress */
79 progress = gk20a_readl(g, bus_sw_scratch_r(SCRATCH_PREOS_PROGRESS));
80
81 if (PREOS_PROGRESS_MASK(progress) == PREOS_PROGRESS_STARTED) {
82 err = 0;
83
84 /* Complete the handshake */
85 tmp = gk20a_readl(g,
86 bus_sw_scratch_r(SCRATCH_PMU_EXIT_AND_HALT));
87
88 gk20a_writel(g, bus_sw_scratch_r(SCRATCH_PMU_EXIT_AND_HALT),
89 PMU_EXIT_AND_HALT_SET(tmp, PMU_EXIT_AND_HALT_YES));
90
91 nvgpu_timeout_init(g, &timeout,
92 PMU_BOOT_TIMEOUT_MAX /
93 PMU_BOOT_TIMEOUT_DEFAULT,
94 NVGPU_TIMER_RETRY_TIMER);
95
96 do {
97 progress = gk20a_readl(g,
98 bus_sw_scratch_r(SCRATCH_PREOS_PROGRESS));
99 preos_completed = pwr_falcon_cpuctl_halt_intr_v(
100 gk20a_readl(g, pwr_falcon_cpuctl_r())) &&
101 (PREOS_PROGRESS_MASK(progress) ==
102 PREOS_PROGRESS_EXIT);
103 nvgpu_udelay(PMU_BOOT_TIMEOUT_DEFAULT);
104 } while (!preos_completed && !nvgpu_timeout_expired(&timeout));
105 }
106
107 return err;
108}