summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2018-04-06 17:16:10 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-25 13:15:40 -0400
commit2dbf961365822e38ac6b7266388fcfa503f6e52f (patch)
treed3ee4e3698b80c2d9a4174547c42e66098b63750 /drivers/gpu/nvgpu/gm20b
parent775c69af8cffbd3c11cda027a99ad9d588e09f95 (diff)
gpu: nvgpu: Move bus HAL to common
Move implementation of bus HAL to common/bus. Change-Id: Ia89350f9d94f3ccfd5500a340e6a677cd7d4cfaa Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1726337 GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r--drivers/gpu/nvgpu/gm20b/bus_gm20b.c67
-rw-r--r--drivers/gpu/nvgpu/gm20b/bus_gm20b.h33
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c4
3 files changed, 2 insertions, 102 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/bus_gm20b.c b/drivers/gpu/nvgpu/gm20b/bus_gm20b.c
deleted file mode 100644
index ca2a40bf..00000000
--- a/drivers/gpu/nvgpu/gm20b/bus_gm20b.c
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * GM20B MMU
3 *
4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#include <nvgpu/timers.h>
26#include <nvgpu/bus.h>
27#include <nvgpu/mm.h>
28#include <nvgpu/enabled.h>
29
30#include "bus_gm20b.h"
31#include "gk20a/gk20a.h"
32#include "gk20a/bus_gk20a.h"
33
34#include <nvgpu/hw/gm20b/hw_bus_gm20b.h>
35
36int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst)
37{
38 struct nvgpu_timeout timeout;
39 int err = 0;
40 u64 iova = nvgpu_inst_block_addr(g, bar1_inst);
41 u32 ptr_v = (u32)(iova >> bus_bar1_block_ptr_shift_v());
42
43 nvgpu_log_info(g, "bar1 inst block ptr: 0x%08x", ptr_v);
44
45 gk20a_writel(g, bus_bar1_block_r(),
46 nvgpu_aperture_mask(g, bar1_inst,
47 bus_bar1_block_target_sys_mem_ncoh_f(),
48 bus_bar1_block_target_sys_mem_coh_f(),
49 bus_bar1_block_target_vid_mem_f()) |
50 bus_bar1_block_mode_virtual_f() |
51 bus_bar1_block_ptr_f(ptr_v));
52 nvgpu_timeout_init(g, &timeout, 1000, NVGPU_TIMER_RETRY_TIMER);
53 do {
54 u32 val = gk20a_readl(g, bus_bind_status_r());
55 u32 pending = bus_bind_status_bar1_pending_v(val);
56 u32 outstanding = bus_bind_status_bar1_outstanding_v(val);
57 if (!pending && !outstanding)
58 break;
59
60 nvgpu_udelay(5);
61 } while (!nvgpu_timeout_expired(&timeout));
62
63 if (nvgpu_timeout_peek_expired(&timeout))
64 err = -EINVAL;
65
66 return err;
67}
diff --git a/drivers/gpu/nvgpu/gm20b/bus_gm20b.h b/drivers/gpu/nvgpu/gm20b/bus_gm20b.h
deleted file mode 100644
index 961b906a..00000000
--- a/drivers/gpu/nvgpu/gm20b/bus_gm20b.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * GM20B BUS
3 *
4 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef _NVGPU_GM20B_BUS
26#define _NVGPU_GM20B_BUS
27
28struct gk20a;
29struct nvgpu_mem;
30
31int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst);
32
33#endif
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index f96c576b..ccceab03 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -23,6 +23,8 @@
23 */ 23 */
24 24
25#include "common/clock_gating/gm20b_gating_reglist.h" 25#include "common/clock_gating/gm20b_gating_reglist.h"
26#include "common/bus/bus_gm20b.h"
27#include "common/bus/bus_gk20a.h"
26 28
27#include "gk20a/gk20a.h" 29#include "gk20a/gk20a.h"
28#include "gk20a/ce2_gk20a.h" 30#include "gk20a/ce2_gk20a.h"
@@ -33,7 +35,6 @@
33#include "gk20a/mm_gk20a.h" 35#include "gk20a/mm_gk20a.h"
34#include "gk20a/css_gr_gk20a.h" 36#include "gk20a/css_gr_gk20a.h"
35#include "gk20a/mc_gk20a.h" 37#include "gk20a/mc_gk20a.h"
36#include "gk20a/bus_gk20a.h"
37#include "gk20a/flcn_gk20a.h" 38#include "gk20a/flcn_gk20a.h"
38#include "gk20a/priv_ring_gk20a.h" 39#include "gk20a/priv_ring_gk20a.h"
39#include "gk20a/regops_gk20a.h" 40#include "gk20a/regops_gk20a.h"
@@ -52,7 +53,6 @@
52#include "clk_gm20b.h" 53#include "clk_gm20b.h"
53#include "regops_gm20b.h" 54#include "regops_gm20b.h"
54#include "therm_gm20b.h" 55#include "therm_gm20b.h"
55#include "bus_gm20b.h"
56#include "hal_gm20b.h" 56#include "hal_gm20b.h"
57#include "acr_gm20b.h" 57#include "acr_gm20b.h"
58#include "fuse_gm20b.h" 58#include "fuse_gm20b.h"