Home | History | Annotate | Line # | Download | only in mmu
      1 /*	$NetBSD: nouveau_nvkm_subdev_mmu_vmmgm20b.c,v 1.2 2021/12/18 23:45:41 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2017 Red Hat Inc.
      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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  */
     24 #include <sys/cdefs.h>
     25 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_vmmgm20b.c,v 1.2 2021/12/18 23:45:41 riastradh Exp $");
     26 
     27 #include "vmm.h"
     28 
     29 static const struct nvkm_vmm_func
     30 gm20b_vmm_17 = {
     31 	.join = gm200_vmm_join,
     32 	.part = gf100_vmm_part,
     33 	.aper = gk20a_vmm_aper,
     34 	.valid = gf100_vmm_valid,
     35 	.flush = gf100_vmm_flush,
     36 	.invalidate_pdb = gf100_vmm_invalidate_pdb,
     37 	.page = {
     38 		{ 27, &gm200_vmm_desc_17_17[1], NVKM_VMM_PAGE_Sxxx },
     39 		{ 17, &gm200_vmm_desc_17_17[0], NVKM_VMM_PAGE_SxHC },
     40 		{ 12, &gm200_vmm_desc_17_12[0], NVKM_VMM_PAGE_SxHx },
     41 		{}
     42 	}
     43 };
     44 
     45 static const struct nvkm_vmm_func
     46 gm20b_vmm_16 = {
     47 	.join = gm200_vmm_join,
     48 	.part = gf100_vmm_part,
     49 	.aper = gk20a_vmm_aper,
     50 	.valid = gf100_vmm_valid,
     51 	.flush = gf100_vmm_flush,
     52 	.invalidate_pdb = gf100_vmm_invalidate_pdb,
     53 	.page = {
     54 		{ 27, &gm200_vmm_desc_16_16[1], NVKM_VMM_PAGE_Sxxx },
     55 		{ 16, &gm200_vmm_desc_16_16[0], NVKM_VMM_PAGE_SxHC },
     56 		{ 12, &gm200_vmm_desc_16_12[0], NVKM_VMM_PAGE_SxHx },
     57 		{}
     58 	}
     59 };
     60 
     61 int
     62 gm20b_vmm_new(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
     63 	      void *argv, u32 argc, struct lock_class_key *key,
     64 	      const char *name, struct nvkm_vmm **pvmm)
     65 {
     66 	return gm200_vmm_new_(&gm20b_vmm_16, &gm20b_vmm_17, mmu, managed, addr,
     67 			      size, argv, argc, key, name, pvmm);
     68 }
     69 
     70 int
     71 gm20b_vmm_new_fixed(struct nvkm_mmu *mmu, bool managed, u64 addr, u64 size,
     72 		    void *argv, u32 argc, struct lock_class_key *key,
     73 		    const char *name, struct nvkm_vmm **pvmm)
     74 {
     75 	return gf100_vmm_new_(&gm20b_vmm_16, &gm20b_vmm_17, mmu, managed, addr,
     76 			      size, argv, argc, key, name, pvmm);
     77 }
     78