summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2018-05-25 17:25:01 -0400
committerTejal Kudav <tkudav@nvidia.com>2018-06-14 09:44:07 -0400
commitdec8625b88d1430f4bf3eac37954fbb732de3f1a (patch)
treea90171ea9fbd53c8690f8338af54befad3d624ef /drivers/gpu/nvgpu
parentd4dfa63e6c324430ad2cac4fabb73a95858b2573 (diff)
gpu: nvgpu: Move SW scratch register read to bus
SW scratch register is in bus register range. Move query of that register to bus HAL from bios. JIRA NVGPU-588 Change-Id: I69f35af3d5f8da3550eb68fe7d060a3ec48ce275 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1730898 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r--drivers/gpu/nvgpu/Makefile1
-rw-r--r--drivers/gpu/nvgpu/common/bus/bus_gv100.c39
-rw-r--r--drivers/gpu/nvgpu/common/bus/bus_gv100.h33
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gv100/bios_gv100.c20
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c3
6 files changed, 86 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 3cbe5b96..c75e1417 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_GK20A) := nvgpu.o
26nvgpu-y += common/bus/bus_gk20a.o \ 26nvgpu-y += common/bus/bus_gk20a.o \
27 common/bus/bus_gm20b.o \ 27 common/bus/bus_gm20b.o \
28 common/bus/bus_gp10b.o \ 28 common/bus/bus_gp10b.o \
29 common/bus/bus_gv100.o \
29 common/ptimer/ptimer.o \ 30 common/ptimer/ptimer.o \
30 common/ptimer/ptimer_gk20a.o 31 common/ptimer/ptimer_gk20a.o
31 32
diff --git a/drivers/gpu/nvgpu/common/bus/bus_gv100.c b/drivers/gpu/nvgpu/common/bus/bus_gv100.c
new file mode 100644
index 00000000..2aa15e67
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/bus/bus_gv100.c
@@ -0,0 +1,39 @@
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#include <nvgpu/timers.h>
24#include <nvgpu/mm.h>
25
26#include "bus_gv100.h"
27#include "gk20a/gk20a.h"
28
29#include <nvgpu/hw/gv100/hw_bus_gv100.h>
30
31u32 gv100_bus_read_sw_scratch(struct gk20a *g, u32 index)
32{
33 return gk20a_readl(g, bus_sw_scratch_r(index));
34}
35
36void gv100_bus_write_sw_scratch(struct gk20a *g, u32 index, u32 val)
37{
38 gk20a_writel(g, bus_sw_scratch_r(index), val);
39}
diff --git a/drivers/gpu/nvgpu/common/bus/bus_gv100.h b/drivers/gpu/nvgpu/common/bus/bus_gv100.h
new file mode 100644
index 00000000..b6b608da
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/bus/bus_gv100.h
@@ -0,0 +1,33 @@
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_GV100_BUS
24#define NVGPU_GV100_BUS
25
26#include <nvgpu/types.h>
27
28struct gk20a;
29
30u32 gv100_bus_read_sw_scratch(struct gk20a *g, u32 index);
31void gv100_bus_write_sw_scratch(struct gk20a *g, u32 index, u32 val);
32
33#endif
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index d8941cdf..5440238f 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -1124,6 +1124,8 @@ struct gpu_ops {
1124 u32 (*set_bar0_window)(struct gk20a *g, struct nvgpu_mem *mem, 1124 u32 (*set_bar0_window)(struct gk20a *g, struct nvgpu_mem *mem,
1125 struct nvgpu_sgt *sgt, struct nvgpu_sgl *sgl, 1125 struct nvgpu_sgt *sgt, struct nvgpu_sgl *sgl,
1126 u32 w); 1126 u32 w);
1127 u32 (*read_sw_scratch)(struct gk20a *g, u32 index);
1128 void (*write_sw_scratch)(struct gk20a *g, u32 index, u32 val);
1127 } bus; 1129 } bus;
1128 1130
1129 struct { 1131 struct {
diff --git a/drivers/gpu/nvgpu/gv100/bios_gv100.c b/drivers/gpu/nvgpu/gv100/bios_gv100.c
index 9ca05a11..45d5ed31 100644
--- a/drivers/gpu/nvgpu/gv100/bios_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/bios_gv100.c
@@ -29,7 +29,6 @@
29#include "bios_gv100.h" 29#include "bios_gv100.h"
30 30
31#include <nvgpu/hw/gv100/hw_pwr_gv100.h> 31#include <nvgpu/hw/gv100/hw_pwr_gv100.h>
32#include <nvgpu/hw/gv100/hw_bus_gv100.h>
33 32
34#define PMU_BOOT_TIMEOUT_DEFAULT 100 /* usec */ 33#define PMU_BOOT_TIMEOUT_DEFAULT 100 /* usec */
35#define PMU_BOOT_TIMEOUT_MAX 2000000 /* usec */ 34#define PMU_BOOT_TIMEOUT_MAX 2000000 /* usec */
@@ -53,14 +52,13 @@
53 52
54void gv100_bios_preos_reload_check(struct gk20a *g) 53void gv100_bios_preos_reload_check(struct gk20a *g)
55{ 54{
56 u32 progress = gk20a_readl(g, 55 u32 progress = g->ops.bus.read_sw_scratch(g, SCRATCH_PREOS_PROGRESS);
57 bus_sw_scratch_r(SCRATCH_PREOS_PROGRESS));
58 56
59 if (PREOS_PROGRESS_MASK(progress) != PREOS_PROGRESS_NOT_STARTED) { 57 if (PREOS_PROGRESS_MASK(progress) != PREOS_PROGRESS_NOT_STARTED) {
60 u32 reload = gk20a_readl(g, 58 u32 reload = g->ops.bus.read_sw_scratch(g,
61 bus_sw_scratch_r(SCRATCH_PRE_OS_RELOAD)); 59 SCRATCH_PRE_OS_RELOAD);
62 60
63 gk20a_writel(g, bus_sw_scratch_r(SCRATCH_PRE_OS_RELOAD), 61 g->ops.bus.write_sw_scratch(g, SCRATCH_PRE_OS_RELOAD,
64 PRE_OS_RELOAD_SET(reload, PRE_OS_RELOAD_YES)); 62 PRE_OS_RELOAD_SET(reload, PRE_OS_RELOAD_YES));
65 } 63 }
66} 64}
@@ -76,16 +74,15 @@ int gv100_bios_preos_wait_for_halt(struct gk20a *g)
76 nvgpu_udelay(PMU_BOOT_TIMEOUT_DEFAULT); 74 nvgpu_udelay(PMU_BOOT_TIMEOUT_DEFAULT);
77 75
78 /* Check the progress */ 76 /* Check the progress */
79 progress = gk20a_readl(g, bus_sw_scratch_r(SCRATCH_PREOS_PROGRESS)); 77 progress = g->ops.bus.read_sw_scratch(g, SCRATCH_PREOS_PROGRESS);
80 78
81 if (PREOS_PROGRESS_MASK(progress) == PREOS_PROGRESS_STARTED) { 79 if (PREOS_PROGRESS_MASK(progress) == PREOS_PROGRESS_STARTED) {
82 err = 0; 80 err = 0;
83 81
84 /* Complete the handshake */ 82 /* Complete the handshake */
85 tmp = gk20a_readl(g, 83 tmp = g->ops.bus.read_sw_scratch(g, SCRATCH_PMU_EXIT_AND_HALT);
86 bus_sw_scratch_r(SCRATCH_PMU_EXIT_AND_HALT));
87 84
88 gk20a_writel(g, bus_sw_scratch_r(SCRATCH_PMU_EXIT_AND_HALT), 85 g->ops.bus.write_sw_scratch(g, SCRATCH_PMU_EXIT_AND_HALT,
89 PMU_EXIT_AND_HALT_SET(tmp, PMU_EXIT_AND_HALT_YES)); 86 PMU_EXIT_AND_HALT_SET(tmp, PMU_EXIT_AND_HALT_YES));
90 87
91 nvgpu_timeout_init(g, &timeout, 88 nvgpu_timeout_init(g, &timeout,
@@ -94,8 +91,7 @@ int gv100_bios_preos_wait_for_halt(struct gk20a *g)
94 NVGPU_TIMER_RETRY_TIMER); 91 NVGPU_TIMER_RETRY_TIMER);
95 92
96 do { 93 do {
97 progress = gk20a_readl(g, 94 progress = g->ops.bus.read_sw_scratch(g, SCRATCH_PREOS_PROGRESS);
98 bus_sw_scratch_r(SCRATCH_PREOS_PROGRESS));
99 preos_completed = pwr_falcon_cpuctl_halt_intr_v( 95 preos_completed = pwr_falcon_cpuctl_halt_intr_v(
100 gk20a_readl(g, pwr_falcon_cpuctl_r())) && 96 gk20a_readl(g, pwr_falcon_cpuctl_r())) &&
101 (PREOS_PROGRESS_MASK(progress) == 97 (PREOS_PROGRESS_MASK(progress) ==
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c
index 13e0c1a3..56429975 100644
--- a/drivers/gpu/nvgpu/gv100/hal_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c
@@ -24,6 +24,7 @@
24 24
25#include "common/bus/bus_gk20a.h" 25#include "common/bus/bus_gk20a.h"
26#include "common/bus/bus_gp10b.h" 26#include "common/bus/bus_gp10b.h"
27#include "common/bus/bus_gv100.h"
27#include "common/clock_gating/gv100_gating_reglist.h" 28#include "common/clock_gating/gv100_gating_reglist.h"
28#include "common/ptimer/ptimer_gk20a.h" 29#include "common/ptimer/ptimer_gk20a.h"
29 30
@@ -794,6 +795,8 @@ static const struct gpu_ops gv100_ops = {
794 .bar1_bind = NULL, 795 .bar1_bind = NULL,
795 .bar2_bind = gp10b_bus_bar2_bind, 796 .bar2_bind = gp10b_bus_bar2_bind,
796 .set_bar0_window = gk20a_bus_set_bar0_window, 797 .set_bar0_window = gk20a_bus_set_bar0_window,
798 .read_sw_scratch = gv100_bus_read_sw_scratch,
799 .write_sw_scratch = gv100_bus_write_sw_scratch,
797 }, 800 },
798 .ptimer = { 801 .ptimer = {
799 .isr = gk20a_ptimer_isr, 802 .isr = gk20a_ptimer_isr,