diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-05-25 13:27:10 -0400 |
---|---|---|
committer | Tejal Kudav <tkudav@nvidia.com> | 2018-06-14 09:44:07 -0400 |
commit | 27694ca572c4d7698b107c6713f0f0604b41c186 (patch) | |
tree | 60dc8a1a8518797fd95f82d1e02892a984911667 /drivers/gpu/nvgpu/common | |
parent | 5c8f1619ce5ab1cf46484c8914fa29bcc208b9a0 (diff) |
gpu: nvgpu: Implement bus HAL for bar2 bind
Implement BAR2 bind as a bus HAL and remove the corresponding MM HAL.
BAR2 bind HW API is in bus.
JIRA NVGPU-588
Change-Id: I3a8391b00f1ba65f9ed28b633f1d52bf7c984230
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1730896
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/bus/bus_gp10b.c | 64 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/bus/bus_gp10b.h | 33 |
2 files changed, 97 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/bus/bus_gp10b.c b/drivers/gpu/nvgpu/common/bus/bus_gp10b.c new file mode 100644 index 00000000..01e81069 --- /dev/null +++ b/drivers/gpu/nvgpu/common/bus/bus_gp10b.c | |||
@@ -0,0 +1,64 @@ | |||
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/mm.h> | ||
27 | |||
28 | #include "bus_gp10b.h" | ||
29 | #include "gk20a/gk20a.h" | ||
30 | |||
31 | #include <nvgpu/hw/gp10b/hw_bus_gp10b.h> | ||
32 | |||
33 | int gp10b_bus_bar2_bind(struct gk20a *g, struct nvgpu_mem *bar2_inst) | ||
34 | { | ||
35 | struct nvgpu_timeout timeout; | ||
36 | int err = 0; | ||
37 | u64 iova = nvgpu_inst_block_addr(g, bar2_inst); | ||
38 | u32 ptr_v = (u32)(iova >> bus_bar2_block_ptr_shift_v()); | ||
39 | |||
40 | nvgpu_log_info(g, "bar2 inst block ptr: 0x%08x", ptr_v); | ||
41 | |||
42 | gk20a_writel(g, bus_bar2_block_r(), | ||
43 | nvgpu_aperture_mask(g, bar2_inst, | ||
44 | bus_bar2_block_target_sys_mem_ncoh_f(), | ||
45 | bus_bar2_block_target_sys_mem_coh_f(), | ||
46 | bus_bar2_block_target_vid_mem_f()) | | ||
47 | bus_bar2_block_mode_virtual_f() | | ||
48 | bus_bar2_block_ptr_f(ptr_v)); | ||
49 | nvgpu_timeout_init(g, &timeout, 1000, NVGPU_TIMER_RETRY_TIMER); | ||
50 | do { | ||
51 | u32 val = gk20a_readl(g, bus_bind_status_r()); | ||
52 | u32 pending = bus_bind_status_bar2_pending_v(val); | ||
53 | u32 outstanding = bus_bind_status_bar2_outstanding_v(val); | ||
54 | if (!pending && !outstanding) | ||
55 | break; | ||
56 | |||
57 | nvgpu_udelay(5); | ||
58 | } while (!nvgpu_timeout_expired(&timeout)); | ||
59 | |||
60 | if (nvgpu_timeout_peek_expired(&timeout)) | ||
61 | err = -EINVAL; | ||
62 | |||
63 | return err; | ||
64 | } | ||
diff --git a/drivers/gpu/nvgpu/common/bus/bus_gp10b.h b/drivers/gpu/nvgpu/common/bus/bus_gp10b.h new file mode 100644 index 00000000..0a356f15 --- /dev/null +++ b/drivers/gpu/nvgpu/common/bus/bus_gp10b.h | |||
@@ -0,0 +1,33 @@ | |||
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_GP10B_BUS | ||
26 | #define _NVGPU_GP10B_BUS | ||
27 | |||
28 | struct gk20a; | ||
29 | struct nvgpu_mem; | ||
30 | |||
31 | int gp10b_bus_bar2_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst); | ||
32 | |||
33 | #endif | ||