diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/mm_gp10b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/mm_gp10b.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c index 2c0056e1..a4b291d8 100644 --- a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GP10B MMU | 2 | * GP10B MMU |
3 | * | 3 | * |
4 | * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), | 7 | * copy of this software and associated documentation files (the "Software"), |
@@ -78,6 +78,32 @@ clean_up_va: | |||
78 | return err; | 78 | return err; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* | ||
82 | * For GV11B and TU104 MSS NVLINK HW settings are in force_snoop mode. | ||
83 | * This will force all the GPU mappings to be coherent. | ||
84 | * By default the mem aperture sets as sysmem_non_coherent and will use L2 mode. | ||
85 | * Change target pte aperture to sysmem_coherent if mem attribute requests for | ||
86 | * platform atomics to use rmw atomic capability. | ||
87 | * | ||
88 | */ | ||
89 | static u32 gmmu_aperture_mask(struct gk20a *g, | ||
90 | enum nvgpu_aperture mem_ap, | ||
91 | bool platform_atomic_attr, | ||
92 | u32 sysmem_mask, | ||
93 | u32 sysmem_coh_mask, | ||
94 | u32 vidmem_mask) | ||
95 | { | ||
96 | if (nvgpu_is_enabled(g, NVGPU_SUPPORT_PLATFORM_ATOMIC) && | ||
97 | platform_atomic_attr) { | ||
98 | mem_ap = APERTURE_SYSMEM_COH; | ||
99 | } | ||
100 | |||
101 | return nvgpu_aperture_mask_raw(g, mem_ap, | ||
102 | sysmem_mask, | ||
103 | sysmem_coh_mask, | ||
104 | vidmem_mask); | ||
105 | } | ||
106 | |||
81 | static void update_gmmu_pde3_locked(struct vm_gk20a *vm, | 107 | static void update_gmmu_pde3_locked(struct vm_gk20a *vm, |
82 | const struct gk20a_mmu_level *l, | 108 | const struct gk20a_mmu_level *l, |
83 | struct nvgpu_gmmu_pd *pd, | 109 | struct nvgpu_gmmu_pd *pd, |
@@ -191,8 +217,9 @@ static void __update_pte(struct vm_gk20a *vm, | |||
191 | u32 pte_addr = attrs->aperture == APERTURE_SYSMEM ? | 217 | u32 pte_addr = attrs->aperture == APERTURE_SYSMEM ? |
192 | gmmu_new_pte_address_sys_f(phys_shifted) : | 218 | gmmu_new_pte_address_sys_f(phys_shifted) : |
193 | gmmu_new_pte_address_vid_f(phys_shifted); | 219 | gmmu_new_pte_address_vid_f(phys_shifted); |
194 | u32 pte_tgt = nvgpu_aperture_mask_coh(g, | 220 | u32 pte_tgt = gmmu_aperture_mask(g, |
195 | attrs->aperture, | 221 | attrs->aperture, |
222 | attrs->platform_atomic, | ||
196 | gmmu_new_pte_aperture_sys_mem_ncoh_f(), | 223 | gmmu_new_pte_aperture_sys_mem_ncoh_f(), |
197 | gmmu_new_pte_aperture_sys_mem_coh_f(), | 224 | gmmu_new_pte_aperture_sys_mem_coh_f(), |
198 | gmmu_new_pte_aperture_video_memory_f()); | 225 | gmmu_new_pte_aperture_video_memory_f()); |
@@ -253,7 +280,7 @@ static void update_gmmu_pte_locked(struct vm_gk20a *vm, | |||
253 | "vm=%s " | 280 | "vm=%s " |
254 | "PTE: i=%-4u size=%-2u | " | 281 | "PTE: i=%-4u size=%-2u | " |
255 | "GPU %#-12llx phys %#-12llx " | 282 | "GPU %#-12llx phys %#-12llx " |
256 | "pgsz: %3dkb perm=%-2s kind=%#02x APT=%-6s %c%c%c%c%c " | 283 | "pgsz: %3dkb perm=%-2s kind=%#02x APT=%-6s %c%c%c%c%c%c " |
257 | "ctag=0x%08x " | 284 | "ctag=0x%08x " |
258 | "[0x%08x, 0x%08x]", | 285 | "[0x%08x, 0x%08x]", |
259 | vm->name, | 286 | vm->name, |
@@ -268,6 +295,7 @@ static void update_gmmu_pte_locked(struct vm_gk20a *vm, | |||
268 | attrs->priv ? 'P' : '-', | 295 | attrs->priv ? 'P' : '-', |
269 | attrs->coherent ? 'I' : '-', | 296 | attrs->coherent ? 'I' : '-', |
270 | attrs->valid ? 'V' : '-', | 297 | attrs->valid ? 'V' : '-', |
298 | attrs->platform_atomic ? 'A' : '-', | ||
271 | (u32)attrs->ctag / g->ops.fb.compression_page_size(g), | 299 | (u32)attrs->ctag / g->ops.fb.compression_page_size(g), |
272 | pte_w[1], pte_w[0]); | 300 | pte_w[1], pte_w[0]); |
273 | 301 | ||