blob: 293c6c74c1a298681a97ebf8253f13ca6f5764f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
* GM20B GPC MMU
*
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <linux/types.h>
#include "gk20a/gk20a.h"
#include "gk20a/kind_gk20a.h"
#include "hw_fb_gm20b.h"
#include "hw_top_gm20b.h"
#include "hw_gmmu_gm20b.h"
static void fb_gm20b_init_fs_state(struct gk20a *g)
{
gk20a_dbg_info("initialize gm20b fb");
gk20a_writel(g, fb_fbhub_num_active_ltcs_r(),
g->ltc_count);
}
static void gm20b_init_uncompressed_kind_map(void)
{
gk20a_init_uncompressed_kind_map();
gk20a_uc_kind_map[gmmu_pte_kind_s8_v()] =
gk20a_uc_kind_map[gmmu_pte_kind_s8_2s_v()] =
gmmu_pte_kind_s8_v();
}
static bool gm20b_kind_supported(u8 k)
{
return k == gmmu_pte_kind_smsked_message_v()
|| (k >= gmmu_pte_kind_s8_v() &&
k <= gmmu_pte_kind_s8_2s_v());
}
static bool gm20b_kind_z(u8 k)
{
return (k >= gmmu_pte_kind_s8_v() &&
k <= gmmu_pte_kind_s8_2s_v());
}
static bool gm20b_kind_compressible(u8 k)
{
return (k >= gmmu_pte_kind_s8_v() &&
k <= gmmu_pte_kind_s8_2s_v());
}
static bool gm20b_kind_zbc(u8 k)
{
return (k >= gmmu_pte_kind_s8_v() &&
k <= gmmu_pte_kind_s8_2s_v());
}
static void gm20b_init_kind_attr(void)
{
u16 k;
gk20a_init_kind_attr();
for (k = 0; k < 256; k++) {
if (gm20b_kind_supported((u8)k))
gk20a_kind_attr[k] |= GK20A_KIND_ATTR_SUPPORTED;
if (gm20b_kind_compressible((u8)k))
gk20a_kind_attr[k] |= GK20A_KIND_ATTR_COMPRESSIBLE;
if (gm20b_kind_z((u8)k))
gk20a_kind_attr[k] |= GK20A_KIND_ATTR_Z;
if (gm20b_kind_zbc((u8)k))
gk20a_kind_attr[k] |= GK20A_KIND_ATTR_ZBC;
}
}
static void gm20b_fb_set_mmu_page_size(struct gk20a *g)
{
/* set large page size in fb */
u32 fb_mmu_ctrl = gk20a_readl(g, fb_mmu_ctrl_r());
fb_mmu_ctrl |= fb_mmu_ctrl_use_pdb_big_page_size_true_f();
gk20a_writel(g, fb_mmu_ctrl_r(), fb_mmu_ctrl);
}
void gm20b_init_fb(struct gpu_ops *gops)
{
gops->fb.init_fs_state = fb_gm20b_init_fs_state;
gops->fb.set_mmu_page_size = gm20b_fb_set_mmu_page_size;
gm20b_init_uncompressed_kind_map();
gm20b_init_kind_attr();
}
|