summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/cde_gp10b.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2018-01-29 19:21:30 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-02-02 15:11:53 -0500
commit98da3f8eed914225e9ffe0f768d7647506e95cdc (patch)
treea16c4e29f6983d648f08d2ba1d34440883231cef /drivers/gpu/nvgpu/common/linux/cde_gp10b.c
parentac5b3d9640790b99798070fbb011c4b0c100d33e (diff)
gpu: nvgpu: Cleanup usage of bypass_smmu
The GPU has multiple different operating modes in respect to IOMMU'ability. As such there needs to be a clean way to tell the driver whether it is IOMMU'able or not. This state also does not always reflect what is possible: all becasue the GPU can generate IOMMU'ed memory requests doesn't mean it wants to. The nvgpu_iommuable() API has now existed for a little while which is a useful way to convey whether nvgpu should consider the GPU as IOMMU'able. However, there is also the g->mm.bypass_smmu flag which used to be able to override what the GPU decided it should do. Typically it was assigned the same value as nvgpu_iommuable() but that was not necessarily a requirment. This patch removes all the usages of g->mm.bypass_smmu and instead uses the nvgpu_iommuable() function. All places where the check against g->mm.bypass_smmu have been replaced with nvgpu_iommuable(). The code should now be much cleaner. Subsequently other checks can also be placed in the nvgpu_iommuable() function. For example, when NVLINK comes online and the GPU should no longer consider DMA addresses and instead use scatter-gather lists directly the ngpu_iommuable() function will be able to check the state of NVLINK and then act accordingly. Change-Id: I0da6262386de15709decac89d63d3eecfec20cd7 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1648332 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/cde_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde_gp10b.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/cde_gp10b.c b/drivers/gpu/nvgpu/common/linux/cde_gp10b.c
index ffae6e34..483a3ee7 100644
--- a/drivers/gpu/nvgpu/common/linux/cde_gp10b.c
+++ b/drivers/gpu/nvgpu/common/linux/cde_gp10b.c
@@ -26,6 +26,7 @@
26#include "cde_gp10b.h" 26#include "cde_gp10b.h"
27 27
28#include <nvgpu/log.h> 28#include <nvgpu/log.h>
29#include <nvgpu/dma.h>
29 30
30enum gp10b_programs { 31enum gp10b_programs {
31 GP10B_PROG_HPASS = 0, 32 GP10B_PROG_HPASS = 0,
@@ -56,10 +57,10 @@ void gp10b_cde_get_program_numbers(struct gk20a *g,
56 hprog = GP10B_PROG_HPASS_DEBUG; 57 hprog = GP10B_PROG_HPASS_DEBUG;
57 vprog = GP10B_PROG_VPASS_DEBUG; 58 vprog = GP10B_PROG_VPASS_DEBUG;
58 } 59 }
59 if (g->mm.bypass_smmu) { 60 if (!nvgpu_iommuable(g)) {
60 if (!g->mm.disable_bigpage) { 61 if (!g->mm.disable_bigpage) {
61 nvgpu_warn(g, 62 nvgpu_warn(g,
62 "when bypass_smmu is 1, disable_bigpage must be 1 too"); 63 "When no IOMMU big pages cannot be used");
63 } 64 }
64 hprog |= 1; 65 hprog |= 1;
65 vprog |= 1; 66 vprog |= 1;
@@ -72,7 +73,7 @@ void gp10b_cde_get_program_numbers(struct gk20a *g,
72 73
73bool gp10b_need_scatter_buffer(struct gk20a *g) 74bool gp10b_need_scatter_buffer(struct gk20a *g)
74{ 75{
75 return g->mm.bypass_smmu; 76 return !nvgpu_iommuable(g);
76} 77}
77 78
78static u8 parity(u32 a) 79static u8 parity(u32 a)