2 * Copyright 2017 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
25 gk104_vmm_lpt_invalid(struct nvkm_vmm
*vmm
,
26 struct nvkm_mmu_pt
*pt
, u32 ptei
, u32 ptes
)
28 /* VALID_FALSE + PRIV tells the MMU to ignore corresponding SPTEs. */
29 VMM_FO064(pt
, vmm
, ptei
* 8, BIT_ULL(1) /* PRIV. */, ptes
);
32 static const struct nvkm_vmm_desc_func
34 .invalid
= gk104_vmm_lpt_invalid
,
35 .unmap
= gf100_vmm_pgt_unmap
,
36 .mem
= gf100_vmm_pgt_mem
,
39 const struct nvkm_vmm_desc
40 gk104_vmm_desc_17_12
[] = {
41 { SPT
, 15, 8, 0x1000, &gf100_vmm_pgt
},
42 { PGD
, 13, 8, 0x1000, &gf100_vmm_pgd
},
46 const struct nvkm_vmm_desc
47 gk104_vmm_desc_17_17
[] = {
48 { LPT
, 10, 8, 0x1000, &gk104_vmm_lpt
},
49 { PGD
, 13, 8, 0x1000, &gf100_vmm_pgd
},
53 const struct nvkm_vmm_desc
54 gk104_vmm_desc_16_12
[] = {
55 { SPT
, 14, 8, 0x1000, &gf100_vmm_pgt
},
56 { PGD
, 14, 8, 0x1000, &gf100_vmm_pgd
},
60 const struct nvkm_vmm_desc
61 gk104_vmm_desc_16_16
[] = {
62 { LPT
, 10, 8, 0x1000, &gk104_vmm_lpt
},
63 { PGD
, 14, 8, 0x1000, &gf100_vmm_pgd
},
67 static const struct nvkm_vmm_func
69 .join
= gf100_vmm_join
,
70 .part
= gf100_vmm_part
,
71 .aper
= gf100_vmm_aper
,
72 .valid
= gf100_vmm_valid
,
73 .flush
= gf100_vmm_flush
,
74 .invalidate_pdb
= gf100_vmm_invalidate_pdb
,
76 { 17, &gk104_vmm_desc_17_17
[0], NVKM_VMM_PAGE_xVxC
},
77 { 12, &gk104_vmm_desc_17_12
[0], NVKM_VMM_PAGE_xVHx
},
82 static const struct nvkm_vmm_func
84 .join
= gf100_vmm_join
,
85 .part
= gf100_vmm_part
,
86 .aper
= gf100_vmm_aper
,
87 .valid
= gf100_vmm_valid
,
88 .flush
= gf100_vmm_flush
,
89 .invalidate_pdb
= gf100_vmm_invalidate_pdb
,
91 { 16, &gk104_vmm_desc_16_16
[0], NVKM_VMM_PAGE_xVxC
},
92 { 12, &gk104_vmm_desc_16_12
[0], NVKM_VMM_PAGE_xVHx
},
98 gk104_vmm_new(struct nvkm_mmu
*mmu
, bool managed
, u64 addr
, u64 size
,
99 void *argv
, u32 argc
, struct lock_class_key
*key
,
100 const char *name
, struct nvkm_vmm
**pvmm
)
102 return gf100_vmm_new_(&gk104_vmm_16
, &gk104_vmm_17
, mmu
, managed
, addr
,
103 size
, argv
, argc
, key
, name
, pvmm
);