mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 21:33:00 +00:00
drm/nouveau/mmu/gk104,gk20a: implement vmm on top of new base
Adds support for: - Selection of a 64KiB big page size (NvFbBigPage=16). - System-memory PDs. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
540a1dde57
commit
7de078aa79
@ -18,3 +18,5 @@ nvkm-y += nvkm/subdev/mmu/vmmnv41.o
|
||||
nvkm-y += nvkm/subdev/mmu/vmmnv44.o
|
||||
nvkm-y += nvkm/subdev/mmu/vmmnv50.o
|
||||
nvkm-y += nvkm/subdev/mmu/vmmgf100.o
|
||||
nvkm-y += nvkm/subdev/mmu/vmmgk104.o
|
||||
nvkm-y += nvkm/subdev/mmu/vmmgk20a.o
|
||||
|
@ -19,7 +19,9 @@
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "priv.h"
|
||||
#include "vmm.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
static const struct nvkm_mmu_func
|
||||
gk104_mmu = {
|
||||
@ -34,6 +36,7 @@ gk104_mmu = {
|
||||
.map_sg = gf100_vm_map_sg,
|
||||
.unmap = gf100_vm_unmap,
|
||||
.flush = gf100_vm_flush,
|
||||
.vmm = {{ -1, -1, NVIF_CLASS_VMM_GF100}, gk104_vmm_new },
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -19,7 +19,9 @@
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "priv.h"
|
||||
#include "vmm.h"
|
||||
|
||||
#include <nvif/class.h>
|
||||
|
||||
static const struct nvkm_mmu_func
|
||||
gk20a_mmu = {
|
||||
@ -34,6 +36,7 @@ gk20a_mmu = {
|
||||
.map_sg = gf100_vm_map_sg,
|
||||
.unmap = gf100_vm_unmap,
|
||||
.flush = gf100_vm_flush,
|
||||
.vmm = {{ -1, -1, NVIF_CLASS_VMM_GF100}, gk20a_vmm_new },
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -68,6 +68,11 @@ struct nvkm_vmm_desc {
|
||||
const struct nvkm_vmm_desc_func *func;
|
||||
};
|
||||
|
||||
extern const struct nvkm_vmm_desc gk104_vmm_desc_16_12[];
|
||||
extern const struct nvkm_vmm_desc gk104_vmm_desc_16_16[];
|
||||
extern const struct nvkm_vmm_desc gk104_vmm_desc_17_12[];
|
||||
extern const struct nvkm_vmm_desc gk104_vmm_desc_17_17[];
|
||||
|
||||
struct nvkm_vmm_page {
|
||||
u8 shift;
|
||||
const struct nvkm_vmm_desc *desc;
|
||||
@ -133,4 +138,8 @@ int g84_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
|
||||
struct lock_class_key *, const char *, struct nvkm_vmm **);
|
||||
int gf100_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
|
||||
struct lock_class_key *, const char *, struct nvkm_vmm **);
|
||||
int gk104_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
|
||||
struct lock_class_key *, const char *, struct nvkm_vmm **);
|
||||
int gk20a_vmm_new(struct nvkm_mmu *, u64, u64, void *, u32,
|
||||
struct lock_class_key *, const char *, struct nvkm_vmm **);
|
||||
#endif
|
||||
|
85
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk104.c
Normal file
85
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk104.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2017 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "vmm.h"
|
||||
|
||||
static const struct nvkm_vmm_desc_func
|
||||
gk104_vmm_lpt = {
|
||||
};
|
||||
|
||||
const struct nvkm_vmm_desc
|
||||
gk104_vmm_desc_17_12[] = {
|
||||
{ SPT, 15, 8, 0x1000, &gf100_vmm_pgt },
|
||||
{ PGD, 13, 8, 0x1000, &gf100_vmm_pgd },
|
||||
{}
|
||||
};
|
||||
|
||||
const struct nvkm_vmm_desc
|
||||
gk104_vmm_desc_17_17[] = {
|
||||
{ LPT, 10, 8, 0x1000, &gk104_vmm_lpt },
|
||||
{ PGD, 13, 8, 0x1000, &gf100_vmm_pgd },
|
||||
{}
|
||||
};
|
||||
|
||||
const struct nvkm_vmm_desc
|
||||
gk104_vmm_desc_16_12[] = {
|
||||
{ SPT, 14, 8, 0x1000, &gf100_vmm_pgt },
|
||||
{ PGD, 14, 8, 0x1000, &gf100_vmm_pgd },
|
||||
{}
|
||||
};
|
||||
|
||||
const struct nvkm_vmm_desc
|
||||
gk104_vmm_desc_16_16[] = {
|
||||
{ LPT, 10, 8, 0x1000, &gk104_vmm_lpt },
|
||||
{ PGD, 14, 8, 0x1000, &gf100_vmm_pgd },
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct nvkm_vmm_func
|
||||
gk104_vmm_17 = {
|
||||
.join = gf100_vmm_join,
|
||||
.part = gf100_vmm_part,
|
||||
.page = {
|
||||
{ 17, &gk104_vmm_desc_17_17[0], NVKM_VMM_PAGE_xVxC },
|
||||
{ 12, &gk104_vmm_desc_17_12[0], NVKM_VMM_PAGE_xVHx },
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
||||
static const struct nvkm_vmm_func
|
||||
gk104_vmm_16 = {
|
||||
.join = gf100_vmm_join,
|
||||
.part = gf100_vmm_part,
|
||||
.page = {
|
||||
{ 16, &gk104_vmm_desc_16_16[0], NVKM_VMM_PAGE_xVxC },
|
||||
{ 12, &gk104_vmm_desc_16_12[0], NVKM_VMM_PAGE_xVHx },
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
gk104_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc,
|
||||
struct lock_class_key *key, const char *name,
|
||||
struct nvkm_vmm **pvmm)
|
||||
{
|
||||
return gf100_vmm_new_(&gk104_vmm_16, &gk104_vmm_17, mmu, addr,
|
||||
size, argv, argc, key, name, pvmm);
|
||||
}
|
53
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk20a.c
Normal file
53
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk20a.c
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2017 Red Hat Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "vmm.h"
|
||||
|
||||
static const struct nvkm_vmm_func
|
||||
gk20a_vmm_17 = {
|
||||
.join = gf100_vmm_join,
|
||||
.part = gf100_vmm_part,
|
||||
.page = {
|
||||
{ 17, &gk104_vmm_desc_17_17[0], NVKM_VMM_PAGE_xxHC },
|
||||
{ 12, &gk104_vmm_desc_17_12[0], NVKM_VMM_PAGE_xxHx },
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
||||
static const struct nvkm_vmm_func
|
||||
gk20a_vmm_16 = {
|
||||
.join = gf100_vmm_join,
|
||||
.part = gf100_vmm_part,
|
||||
.page = {
|
||||
{ 16, &gk104_vmm_desc_16_16[0], NVKM_VMM_PAGE_xxHC },
|
||||
{ 12, &gk104_vmm_desc_16_12[0], NVKM_VMM_PAGE_xxHx },
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
gk20a_vmm_new(struct nvkm_mmu *mmu, u64 addr, u64 size, void *argv, u32 argc,
|
||||
struct lock_class_key *key, const char *name,
|
||||
struct nvkm_vmm **pvmm)
|
||||
{
|
||||
return gf100_vmm_new_(&gk20a_vmm_16, &gk20a_vmm_17, mmu, addr,
|
||||
size, argv, argc, key, name, pvmm);
|
||||
}
|
Loading…
Reference in New Issue
Block a user