From 32127c65151ffc7288ff8483d5b18be77a662b0b Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Fri, 3 Aug 2018 10:36:30 -0700 Subject: gpu: nvgpu: Use NVLINK config instead of has_physical_mode This flag - has_physical_mode - doesn't seem to do much other than force the PTE/PDE and inst block addresses to be physical instead of potentially IOMMUed. There is a reason to do this on volta (nvlink not being IOMMU'able being the primary reason) but this flag is too general it seems. The flag was being enabled on all native platforms. The problem is that some page tables (the maxwell small page directories) could be larger than 4KB which meant that the allocation used for them could be potentially discontiguous. Discontiguous page directories obviously is incorrect. This patch deletes the has_physical_mode flag and instead replaces the places where it's checked with a check for nvlink being enabled. Since we _do_ want to program phyiscal PDEs and PTEs for NVLINK devices (regardless of IOMMU status they always access memory by physical address) we need a check for NVLINK state. Bug 200414723 Change-Id: I09ad86b12d8aabcf9648a22503f4747fd63514dd Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1792163 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/gmmu.c | 5 +++-- drivers/gpu/nvgpu/common/mm/mm.c | 5 +++-- drivers/gpu/nvgpu/include/nvgpu/mm.h | 1 - drivers/gpu/nvgpu/os/linux/module.c | 2 -- drivers/gpu/nvgpu/os/linux/pci.c | 2 -- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index 4e723e2e..f6f2b9ad 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c @@ -215,10 +215,11 @@ static u64 nvgpu_pde_phys_addr(struct gk20a *g, struct nvgpu_gmmu_pd *pd) { u64 page_addr; - if (g->mm.has_physical_mode) + if (nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK)) { page_addr = nvgpu_mem_get_phys_addr(g, pd->mem); - else + } else { page_addr = nvgpu_mem_get_addr(g, pd->mem); + } return page_addr + pd->mem_offs; } diff --git a/drivers/gpu/nvgpu/common/mm/mm.c b/drivers/gpu/nvgpu/common/mm/mm.c index 42d708ee..2c3a1cd6 100644 --- a/drivers/gpu/nvgpu/common/mm/mm.c +++ b/drivers/gpu/nvgpu/common/mm/mm.c @@ -128,10 +128,11 @@ int nvgpu_mm_suspend(struct gk20a *g) u64 nvgpu_inst_block_addr(struct gk20a *g, struct nvgpu_mem *inst_block) { - if (g->mm.has_physical_mode) + if (nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK)) { return nvgpu_mem_get_phys_addr(g, inst_block); - else + } else { return nvgpu_mem_get_addr(g, inst_block); + } } void nvgpu_free_inst_block(struct gk20a *g, struct nvgpu_mem *inst_block) diff --git a/drivers/gpu/nvgpu/include/nvgpu/mm.h b/drivers/gpu/nvgpu/include/nvgpu/mm.h index 033e2548..3a1b2a6c 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/mm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/mm.h @@ -147,7 +147,6 @@ struct mm_gk20a { bool ltc_enabled_current; bool ltc_enabled_target; bool disable_bigpage; - bool has_physical_mode; struct nvgpu_mem sysmem_flush; diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 46a82d86..4b64847e 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -1257,8 +1257,6 @@ static int gk20a_probe(struct platform_device *dev) goto return_err; } - gk20a->mm.has_physical_mode = !nvgpu_is_hypervisor_mode(gk20a); - return 0; return_err: diff --git a/drivers/gpu/nvgpu/os/linux/pci.c b/drivers/gpu/nvgpu/os/linux/pci.c index e9374769..79a30495 100644 --- a/drivers/gpu/nvgpu/os/linux/pci.c +++ b/drivers/gpu/nvgpu/os/linux/pci.c @@ -806,8 +806,6 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, } } - g->mm.has_physical_mode = false; - return 0; err_free_irq: -- cgit v1.2.2