From bc87e8989ddf2f74ff2c988a25e4a81e559a5c30 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 22 Aug 2017 08:31:32 -0700 Subject: gpu: nvgpu: Remove support for old kernel version Remove support for pre-4.4 kernels. This allows deleting the checks for kernel version, and usage of linux/version.h. Change-Id: I4d6cb30512ea164d27549f4f4d096e5931bb1379 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1543499 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/clk.c | 1 - drivers/gpu/nvgpu/common/linux/dma.c | 1 + drivers/gpu/nvgpu/common/linux/firmware.c | 4 --- drivers/gpu/nvgpu/common/linux/module.c | 2 -- .../gpu/nvgpu/common/linux/platform_gk20a_tegra.c | 5 ---- drivers/gpu/nvgpu/common/linux/sysfs.c | 1 - drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 23 ----------------- drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 1 - drivers/gpu/nvgpu/gk20a/gk20a.h | 8 ------ drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 5 ---- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 10 -------- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 1 - drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | 1 - drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 29 ---------------------- drivers/gpu/nvgpu/gk20a/sync_gk20a.h | 2 -- drivers/gpu/nvgpu/gm20b/gr_gm20b.h | 2 -- drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 8 ------ drivers/gpu/nvgpu/vgpu/css_vgpu.c | 4 --- drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c | 5 ---- 19 files changed, 1 insertion(+), 112 deletions(-) diff --git a/drivers/gpu/nvgpu/common/linux/clk.c b/drivers/gpu/nvgpu/common/linux/clk.c index 892b892a..3f768867 100644 --- a/drivers/gpu/nvgpu/common/linux/clk.c +++ b/drivers/gpu/nvgpu/common/linux/clk.c @@ -17,7 +17,6 @@ */ #include -#include #include diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 2116053d..cd6ad1b2 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c @@ -16,6 +16,7 @@ #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/common/linux/firmware.c b/drivers/gpu/nvgpu/common/linux/firmware.c index b49bc4a3..44ff1507 100644 --- a/drivers/gpu/nvgpu/common/linux/firmware.c +++ b/drivers/gpu/nvgpu/common/linux/firmware.c @@ -44,14 +44,10 @@ static const struct firmware *do_request_firmware(struct device *dev, fw_name = fw_path; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - err = request_firmware(&fw, fw_name, dev); -#else if (flags & NVGPU_REQUEST_FIRMWARE_NO_WARN) err = request_firmware_direct(&fw, fw_name, dev); else err = request_firmware(&fw, fw_name, dev); -#endif nvgpu_kfree(get_gk20a(dev), fw_path); if (err) diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index f5c6ca1f..691fdd69 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -1025,9 +1025,7 @@ static struct platform_driver gk20a_driver = { .driver = { .owner = THIS_MODULE, .name = "gk20a", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) .probe_type = PROBE_PREFER_ASYNCHRONOUS, -#endif #ifdef CONFIG_OF .of_match_table = tegra_gk20a_of_match, #endif diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c index 71081be5..2c556d8a 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c @@ -13,7 +13,6 @@ * more details. */ -#include #include #include #include @@ -822,10 +821,8 @@ static int gk20a_tegra_probe(struct device *dev) dev_warn(dev, "board does not support scaling"); } platform->g->clk.gpc_pll.id = GM20B_GPC_PLL_B1; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) if (tegra_chip_get_revision() > TEGRA210_REVISION_A04p) platform->g->clk.gpc_pll.id = GM20B_GPC_PLL_C1; -#endif } if (tegra_get_chip_id() == TEGRA132) @@ -841,9 +838,7 @@ static int gk20a_tegra_probe(struct device *dev) return ret; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) pmc = ioremap(TEGRA_PMC_BASE, 4096); -#endif return 0; } diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c index 28ebb21d..1b59c480 100644 --- a/drivers/gpu/nvgpu/common/linux/sysfs.c +++ b/drivers/gpu/nvgpu/common/linux/sysfs.c @@ -14,7 +14,6 @@ * along with this program. If not, see . */ -#include #include #include #include diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index aa340ba6..6a07406a 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c @@ -13,8 +13,6 @@ * more details. */ -#include - #include #include #include @@ -97,23 +95,15 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, return -EINVAL; /* validate syncpt ids */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) { -#else for (i = 0; i < sync_fence->num_fences; i++) { pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); -#endif wait_id = nvgpu_nvhost_sync_pt_id(pt); if (!wait_id || !nvgpu_nvhost_syncpt_is_valid_pt_ext( sp->nvhost_dev, wait_id)) { sync_fence_put(sync_fence); return -EINVAL; } -#if !(LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)) } -#else - } -#endif num_wait_cmds = nvgpu_nvhost_sync_num_pts(sync_fence); if (num_wait_cmds == 0) { @@ -132,13 +122,9 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, } i = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) { -#else for (i = 0; i < sync_fence->num_fences; i++) { struct fence *f = sync_fence->cbs[i].sync_pt; struct sync_pt *pt = sync_pt_from_fence(f); -#endif u32 wait_id = nvgpu_nvhost_sync_pt_id(pt); u32 wait_value = nvgpu_nvhost_sync_pt_thresh(pt); @@ -154,12 +140,7 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, i * wait_cmd_size, wait_id, wait_value, sp->syncpt_buf.gpu_va); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - i++; - } -#else } -#endif WARN_ON(i != num_wait_cmds); sync_fence_put(sync_fence); @@ -675,11 +656,7 @@ static int gk20a_channel_semaphore_wait_fd( } /* If the fence has signaled there is no reason to wait on it. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - status = sync_fence->status; -#else status = atomic_read(&sync_fence->status); -#endif if (status == 0) { sync_fence_put(sync_fence); goto skip_slow_path; diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index 5fa9a0df..a7250b17 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c @@ -14,7 +14,6 @@ #include "fence_gk20a.h" #include -#include #include #include diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 8f097cac..5efa846d 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1086,11 +1086,7 @@ struct gk20a { struct railgate_stats pstats; #endif u32 gr_idle_timeout_default; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 timeouts_enabled; -#else bool timeouts_enabled; -#endif unsigned int ch_wdt_timeout_ms; struct nvgpu_mutex poweron_lock; @@ -1102,11 +1098,7 @@ struct gk20a { u32 timeslice_high_priority_us; u32 min_timeslice_us; u32 max_timeslice_us; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 runlist_interleave; -#else bool runlist_interleave; -#endif bool slcg_enabled; bool blcg_enabled; diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index e21be1e5..2ce78cef 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -1056,7 +1056,6 @@ static const struct dma_buf_ops gk20a_vidbuf_ops = { static struct dma_buf *gk20a_vidbuf_export(struct gk20a_vidmem_buf *buf) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) DEFINE_DMA_BUF_EXPORT_INFO(exp_info); exp_info.priv = buf; @@ -1065,10 +1064,6 @@ static struct dma_buf *gk20a_vidbuf_export(struct gk20a_vidmem_buf *buf) exp_info.flags = O_RDWR; return dma_buf_export(&exp_info); -#else - return dma_buf_export(buf, &gk20a_vidbuf_ops, buf->mem->size, - O_RDWR, NULL); -#endif } #endif diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index af176a73..e8b90c8f 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -248,24 +247,15 @@ struct mm_gk20a { bool use_full_comp_tag_line; bool ltc_enabled_current; bool ltc_enabled_target; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 bypass_smmu; - u32 disable_bigpage; -#else bool bypass_smmu; bool disable_bigpage; -#endif bool has_physical_mode; struct nvgpu_mem sysmem_flush; u32 pramin_window; struct nvgpu_spinlock pramin_window_lock; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 force_pramin; /* via debugfs */ -#else bool force_pramin; /* via debugfs */ -#endif struct { size_t size; diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 791286f0..36938069 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -17,7 +17,6 @@ #define _GK20A_PLATFORM_H_ #include -#include #include diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h index f4e8c601..3ad0c116 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h @@ -21,7 +21,6 @@ #ifndef __PMU_GK20A_H__ #define __PMU_GK20A_H__ -#include #include #include #include diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c index 247f3d63..deaf19a1 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c @@ -13,7 +13,6 @@ * more details. */ -#include #include #include #include @@ -75,23 +74,6 @@ int gk20a_is_sema_backed_sync_fence(struct sync_fence *fence) { struct sync_timeline *t; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - struct sync_pt *spt; - int i = 0; - - if (list_empty(&fence->pt_list_head)) - return 0; - - list_for_each_entry(spt, &fence->pt_list_head, pt_list) { - i++; - - if (i >= 2) - return 0; - } - - spt = list_first_entry(&fence->pt_list_head, struct sync_pt, pt_list); - t = spt->parent; -#else struct fence *pt = fence->cbs[0].sync_pt; struct sync_pt *spt = sync_pt_from_fence(pt); @@ -102,7 +84,6 @@ int gk20a_is_sema_backed_sync_fence(struct sync_fence *fence) return 0; t = sync_pt_parent(spt); -#endif if (t->ops == &gk20a_sync_timeline_ops) return 1; @@ -114,15 +95,6 @@ struct nvgpu_semaphore *gk20a_sync_fence_get_sema(struct sync_fence *f) struct sync_pt *spt; struct gk20a_sync_pt_inst *pti; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - if (!f) - return NULL; - - if (!gk20a_is_sema_backed_sync_fence(f)) - return NULL; - - spt = list_first_entry(&f->pt_list_head, struct sync_pt, pt_list); -#else struct fence *pt; if (!f) @@ -133,7 +105,6 @@ struct nvgpu_semaphore *gk20a_sync_fence_get_sema(struct sync_fence *f) pt = f->cbs[0].sync_pt; spt = sync_pt_from_fence(pt); -#endif pti = container_of(spt, struct gk20a_sync_pt_inst, pt); return pti->shared->sema; diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/sync_gk20a.h index a422377c..be8219cc 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.h @@ -18,8 +18,6 @@ #ifndef _GK20A_SYNC_H_ #define _GK20A_SYNC_H_ -#include - struct sync_timeline; struct sync_fence; struct sync_pt; diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.h b/drivers/gpu/nvgpu/gm20b/gr_gm20b.h index d3adacd8..116a92f4 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.h @@ -16,8 +16,6 @@ #ifndef _NVHOST_GM20B_GR_MMU_H #define _NVHOST_GM20B_GR_MMU_H -#include - struct gk20a; enum { diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h index 42a647b4..ac53e231 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h @@ -16,8 +16,6 @@ #ifndef _NVGPU_GR_GP10B_H_ #define _NVGPU_GR_GP10B_H_ -#include - #include "gk20a/mm_gk20a.h" struct gk20a; @@ -55,15 +53,9 @@ int gr_gp10b_set_cilp_preempt_pending(struct gk20a *g, struct gr_t18x { struct { u32 preempt_image_size; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 force_preemption_gfxp; - u32 force_preemption_cilp; - u32 dump_ctxsw_stats_on_channel_close; -#else bool force_preemption_gfxp; bool force_preemption_cilp; bool dump_ctxsw_stats_on_channel_close; -#endif } ctx_vars; u32 fecs_feature_override_ecc_val; diff --git a/drivers/gpu/nvgpu/vgpu/css_vgpu.c b/drivers/gpu/nvgpu/vgpu/css_vgpu.c index a06ca037..d14f0da3 100644 --- a/drivers/gpu/nvgpu/vgpu/css_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/css_vgpu.c @@ -68,11 +68,7 @@ static int vgpu_css_init_snapshot_buffer(struct gr_gk20a *gr) goto fail; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) - buf = ioremap_cached(css_cookie->ipa, css_cookie->size); -#else buf = ioremap_cache(css_cookie->ipa, css_cookie->size); -#endif if (!buf) { nvgpu_info(g, "ioremap_cache failed"); err = -EINVAL; diff --git a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c index 7cab4d1e..d201d596 100644 --- a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -69,11 +68,7 @@ static int vgpu_fecs_trace_init(struct gk20a *g) goto fail; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - vcst->buf = ioremap_cached(vcst->cookie->ipa, vcst->cookie->size); -#else vcst->buf = ioremap_cache(vcst->cookie->ipa, vcst->cookie->size); -#endif if (!vcst->buf) { dev_info(dev_from_gk20a(g), "ioremap_cache failed\n"); err = -EINVAL; -- cgit v1.2.2