diff options
| -rw-r--r-- | drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mcp77.c | 41 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmmcp77.c | 45 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv50.c | 16 |
7 files changed, 109 insertions, 10 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h index 975c42f620a0..542b7095b026 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h | |||
| @@ -120,6 +120,7 @@ int nv41_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | |||
| 120 | int nv44_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | 120 | int nv44_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
| 121 | int nv50_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | 121 | int nv50_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
| 122 | int g84_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | 122 | int g84_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
| 123 | int mcp77_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | ||
| 123 | int gf100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | 124 | int gf100_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
| 124 | int gk104_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | 125 | int gk104_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
| 125 | int gk20a_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); | 126 | int gk20a_mmu_new(struct nvkm_device *, int, struct nvkm_mmu **); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c index 00eeaaffeae5..08e77cd55e6e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | |||
| @@ -1251,7 +1251,7 @@ nvaa_chipset = { | |||
| 1251 | .i2c = g94_i2c_new, | 1251 | .i2c = g94_i2c_new, |
| 1252 | .imem = nv50_instmem_new, | 1252 | .imem = nv50_instmem_new, |
| 1253 | .mc = g98_mc_new, | 1253 | .mc = g98_mc_new, |
| 1254 | .mmu = g84_mmu_new, | 1254 | .mmu = mcp77_mmu_new, |
| 1255 | .mxm = nv50_mxm_new, | 1255 | .mxm = nv50_mxm_new, |
| 1256 | .pci = g94_pci_new, | 1256 | .pci = g94_pci_new, |
| 1257 | .therm = g84_therm_new, | 1257 | .therm = g84_therm_new, |
| @@ -1283,7 +1283,7 @@ nvac_chipset = { | |||
| 1283 | .i2c = g94_i2c_new, | 1283 | .i2c = g94_i2c_new, |
| 1284 | .imem = nv50_instmem_new, | 1284 | .imem = nv50_instmem_new, |
| 1285 | .mc = g98_mc_new, | 1285 | .mc = g98_mc_new, |
| 1286 | .mmu = g84_mmu_new, | 1286 | .mmu = mcp77_mmu_new, |
| 1287 | .mxm = nv50_mxm_new, | 1287 | .mxm = nv50_mxm_new, |
| 1288 | .pci = g94_pci_new, | 1288 | .pci = g94_pci_new, |
| 1289 | .therm = g84_therm_new, | 1289 | .therm = g84_therm_new, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild index 352a65f9371c..67ee983bb026 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/Kbuild | |||
| @@ -4,6 +4,7 @@ nvkm-y += nvkm/subdev/mmu/nv41.o | |||
| 4 | nvkm-y += nvkm/subdev/mmu/nv44.o | 4 | nvkm-y += nvkm/subdev/mmu/nv44.o |
| 5 | nvkm-y += nvkm/subdev/mmu/nv50.o | 5 | nvkm-y += nvkm/subdev/mmu/nv50.o |
| 6 | nvkm-y += nvkm/subdev/mmu/g84.o | 6 | nvkm-y += nvkm/subdev/mmu/g84.o |
| 7 | nvkm-y += nvkm/subdev/mmu/mcp77.o | ||
| 7 | nvkm-y += nvkm/subdev/mmu/gf100.o | 8 | nvkm-y += nvkm/subdev/mmu/gf100.o |
| 8 | nvkm-y += nvkm/subdev/mmu/gk104.o | 9 | nvkm-y += nvkm/subdev/mmu/gk104.o |
| 9 | nvkm-y += nvkm/subdev/mmu/gk20a.o | 10 | nvkm-y += nvkm/subdev/mmu/gk20a.o |
| @@ -22,6 +23,7 @@ nvkm-y += nvkm/subdev/mmu/vmmnv04.o | |||
| 22 | nvkm-y += nvkm/subdev/mmu/vmmnv41.o | 23 | nvkm-y += nvkm/subdev/mmu/vmmnv41.o |
| 23 | nvkm-y += nvkm/subdev/mmu/vmmnv44.o | 24 | nvkm-y += nvkm/subdev/mmu/vmmnv44.o |
| 24 | nvkm-y += nvkm/subdev/mmu/vmmnv50.o | 25 | nvkm-y += nvkm/subdev/mmu/vmmnv50.o |
| 26 | nvkm-y += nvkm/subdev/mmu/vmmmcp77.o | ||
| 25 | nvkm-y += nvkm/subdev/mmu/vmmgf100.o | 27 | nvkm-y += nvkm/subdev/mmu/vmmgf100.o |
| 26 | nvkm-y += nvkm/subdev/mmu/vmmgk104.o | 28 | nvkm-y += nvkm/subdev/mmu/vmmgk104.o |
| 27 | nvkm-y += nvkm/subdev/mmu/vmmgk20a.o | 29 | nvkm-y += nvkm/subdev/mmu/vmmgk20a.o |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mcp77.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mcp77.c new file mode 100644 index 000000000000..0527b50730d9 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mcp77.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2017 Red Hat Inc. | ||
| 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 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. | ||
| 21 | */ | ||
| 22 | #include "mem.h" | ||
| 23 | #include "vmm.h" | ||
| 24 | |||
| 25 | #include <nvif/class.h> | ||
| 26 | |||
| 27 | static const struct nvkm_mmu_func | ||
| 28 | mcp77_mmu = { | ||
| 29 | .dma_bits = 40, | ||
| 30 | .mmu = {{ -1, -1, NVIF_CLASS_MMU_NV50}}, | ||
| 31 | .mem = {{ -1, 0, NVIF_CLASS_MEM_NV50}, nv50_mem_new, nv50_mem_map }, | ||
| 32 | .vmm = {{ -1, -1, NVIF_CLASS_VMM_NV50}, mcp77_vmm_new, false, 0x0200 }, | ||
| 33 | .kind = nv50_mmu_kind, | ||
| 34 | .kind_sys = true, | ||
| 35 | }; | ||
| 36 | |||
| 37 | int | ||
| 38 | mcp77_mmu_new(struct nvkm_device *device, int index, struct nvkm_mmu **pmmu) | ||
| 39 | { | ||
| 40 | return nvkm_mmu_new_(&mcp77_mmu, device, index, pmmu); | ||
| 41 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h index 6d8f61ea467a..da06e64d8a7d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h | |||
| @@ -95,6 +95,9 @@ struct nvkm_vmm_desc { | |||
| 95 | const struct nvkm_vmm_desc_func *func; | 95 | const struct nvkm_vmm_desc_func *func; |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | extern const struct nvkm_vmm_desc nv50_vmm_desc_12[]; | ||
| 99 | extern const struct nvkm_vmm_desc nv50_vmm_desc_16[]; | ||
| 100 | |||
| 98 | extern const struct nvkm_vmm_desc gk104_vmm_desc_16_12[]; | 101 | extern const struct nvkm_vmm_desc gk104_vmm_desc_16_12[]; |
| 99 | extern const struct nvkm_vmm_desc gk104_vmm_desc_16_16[]; | 102 | extern const struct nvkm_vmm_desc gk104_vmm_desc_16_16[]; |
| 100 | extern const struct nvkm_vmm_desc gk104_vmm_desc_17_12[]; | 103 | extern const struct nvkm_vmm_desc gk104_vmm_desc_17_12[]; |
| @@ -169,6 +172,11 @@ int nv04_vmm_new_(const struct nvkm_vmm_func *, struct nvkm_mmu *, u32, | |||
| 169 | const char *, struct nvkm_vmm **); | 172 | const char *, struct nvkm_vmm **); |
| 170 | int nv04_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *); | 173 | int nv04_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *); |
| 171 | 174 | ||
| 175 | int nv50_vmm_join(struct nvkm_vmm *, struct nvkm_memory *); | ||
| 176 | void nv50_vmm_part(struct nvkm_vmm *, struct nvkm_memory *); | ||
| 177 | int nv50_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *); | ||
| 178 | void nv50_vmm_flush(struct nvkm_vmm *, int); | ||
| 179 | |||
| 172 | int gf100_vmm_new_(const struct nvkm_vmm_func *, const struct nvkm_vmm_func *, | 180 | int gf100_vmm_new_(const struct nvkm_vmm_func *, const struct nvkm_vmm_func *, |
| 173 | struct nvkm_mmu *, u64, u64, void *, u32, | 181 | struct nvkm_mmu *, u64, u64, void *, u32, |
| 174 | struct lock_class_key *, const char *, struct nvkm_vmm **); | 182 | struct lock_class_key *, const char *, struct nvkm_vmm **); |
| @@ -200,6 +208,8 @@ int nv44_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, | |||
| 200 | struct lock_class_key *, const char *, struct nvkm_vmm **); | 208 | struct lock_class_key *, const char *, struct nvkm_vmm **); |
| 201 | int nv50_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, | 209 | int nv50_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, |
| 202 | struct lock_class_key *, const char *, struct nvkm_vmm **); | 210 | struct lock_class_key *, const char *, struct nvkm_vmm **); |
| 211 | int mcp77_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, | ||
| 212 | struct lock_class_key *, const char *, struct nvkm_vmm **); | ||
| 203 | int g84_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, | 213 | int g84_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, |
| 204 | struct lock_class_key *, const char *, struct nvkm_vmm **); | 214 | struct lock_class_key *, const char *, struct nvkm_vmm **); |
| 205 | int gf100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, | 215 | int gf100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmmcp77.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmmcp77.c new file mode 100644 index 000000000000..e63d984cbfd4 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmmcp77.c | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2017 Red Hat Inc. | ||
| 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 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. | ||
| 21 | */ | ||
| 22 | #include "vmm.h" | ||
| 23 | |||
| 24 | static const struct nvkm_vmm_func | ||
| 25 | mcp77_vmm = { | ||
| 26 | .join = nv50_vmm_join, | ||
| 27 | .part = nv50_vmm_part, | ||
| 28 | .valid = nv50_vmm_valid, | ||
| 29 | .flush = nv50_vmm_flush, | ||
| 30 | .page_block = 1 << 29, | ||
| 31 | .page = { | ||
| 32 | { 16, &nv50_vmm_desc_16[0], NVKM_VMM_PAGE_xVxx }, | ||
| 33 | { 12, &nv50_vmm_desc_12[0], NVKM_VMM_PAGE_xVHx }, | ||
| 34 | {} | ||
| 35 | } | ||
