diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 57 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | 2 |
7 files changed, 18 insertions, 74 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 844718a7..ca785b19 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "gr_gk20a.h" | 32 | #include "gr_gk20a.h" |
33 | #include "debug_gk20a.h" | 33 | #include "debug_gk20a.h" |
34 | #include "semaphore_gk20a.h" | 34 | #include "semaphore_gk20a.h" |
35 | #include "nvgpu_common.h" | ||
35 | 36 | ||
36 | #include "hw_ccsr_gk20a.h" | 37 | #include "hw_ccsr_gk20a.h" |
37 | #include "hw_pbdma_gk20a.h" | 38 | #include "hw_pbdma_gk20a.h" |
@@ -1179,7 +1180,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) | |||
1179 | int err = 0; | 1180 | int err = 0; |
1180 | u64 vaddr; | 1181 | u64 vaddr; |
1181 | 1182 | ||
1182 | img = gk20a_request_firmware(g, "gpu2cde.bin"); | 1183 | img = nvgpu_request_firmware(g, "gpu2cde.bin", 0); |
1183 | if (!img) { | 1184 | if (!img) { |
1184 | dev_err(cde_ctx->dev, "cde: could not fetch the firmware"); | 1185 | dev_err(cde_ctx->dev, "cde: could not fetch the firmware"); |
1185 | return -ENOSYS; | 1186 | return -ENOSYS; |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 51384933..721c44e3 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/cdev.h> | 23 | #include <linux/cdev.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/firmware.h> | ||
26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
27 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
28 | #include <linux/export.h> | 27 | #include <linux/export.h> |
@@ -706,8 +705,6 @@ void gk20a_remove_support(struct device *dev) | |||
706 | if (g->sim.remove_support) | 705 | if (g->sim.remove_support) |
707 | g->sim.remove_support(&g->sim); | 706 | g->sim.remove_support(&g->sim); |
708 | 707 | ||
709 | release_firmware(g->pmu_fw); | ||
710 | |||
711 | /* free mappings to registers, etc */ | 708 | /* free mappings to registers, etc */ |
712 | 709 | ||
713 | if (g->regs) { | 710 | if (g->regs) { |
@@ -2047,60 +2044,6 @@ int gk20a_init_gpu_characteristics(struct gk20a *g) | |||
2047 | return 0; | 2044 | return 0; |
2048 | } | 2045 | } |
2049 | 2046 | ||
2050 | static const struct firmware * | ||
2051 | do_request_firmware(struct device *dev, const char *prefix, const char *fw_name) | ||
2052 | { | ||
2053 | const struct firmware *fw; | ||
2054 | char *fw_path = NULL; | ||
2055 | int path_len, err; | ||
2056 | |||
2057 | if (prefix) { | ||
2058 | path_len = strlen(prefix) + strlen(fw_name); | ||
2059 | path_len += 2; /* for the path separator and zero terminator*/ | ||
2060 | |||
2061 | fw_path = kzalloc(sizeof(*fw_path) * path_len, GFP_KERNEL); | ||
2062 | if (!fw_path) | ||
2063 | return NULL; | ||
2064 | |||
2065 | sprintf(fw_path, "%s/%s", prefix, fw_name); | ||
2066 | fw_name = fw_path; | ||
2067 | } | ||
2068 | |||
2069 | err = request_firmware(&fw, fw_name, dev); | ||
2070 | kfree(fw_path); | ||
2071 | if (err) | ||
2072 | return NULL; | ||
2073 | return fw; | ||
2074 | } | ||
2075 | |||
2076 | /* This is a simple wrapper around request_firmware that takes 'fw_name' and | ||
2077 | * applies an IP specific relative path prefix to it. The caller is | ||
2078 | * responsible for calling release_firmware later. */ | ||
2079 | const struct firmware * | ||
2080 | gk20a_request_firmware(struct gk20a *g, const char *fw_name) | ||
2081 | { | ||
2082 | struct device *dev = g->dev; | ||
2083 | const struct firmware *fw; | ||
2084 | |||
2085 | /* current->fs is NULL when calling from SYS_EXIT. | ||
2086 | Add a check here to prevent crash in request_firmware */ | ||
2087 | if (!current->fs || !fw_name) | ||
2088 | return NULL; | ||
2089 | |||
2090 | BUG_ON(!g->ops.name); | ||
2091 | fw = do_request_firmware(dev, g->ops.name, fw_name); | ||
2092 | |||
2093 | #ifdef CONFIG_TEGRA_GK20A | ||
2094 | /* TO BE REMOVED - Support loading from legacy SOC specific path. */ | ||
2095 | if (!fw) { | ||
2096 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
2097 | fw = do_request_firmware(dev, platform->soc_name, fw_name); | ||
2098 | } | ||
2099 | #endif | ||
2100 | |||
2101 | return fw; | ||
2102 | } | ||
2103 | |||
2104 | int gk20a_read_ptimer(struct gk20a *g, u64 *value) | 2047 | int gk20a_read_ptimer(struct gk20a *g, u64 *value) |
2105 | { | 2048 | { |
2106 | const unsigned int max_iterations = 3; | 2049 | const unsigned int max_iterations = 3; |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 1cccaebe..2b55dd26 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -762,11 +762,6 @@ struct gk20a { | |||
762 | #ifdef CONFIG_DEBUG_FS | 762 | #ifdef CONFIG_DEBUG_FS |
763 | struct railgate_stats pstats; | 763 | struct railgate_stats pstats; |
764 | #endif | 764 | #endif |
765 | /* Save pmu fw here so that it lives cross suspend/resume. | ||
766 | pmu suspend destroys all pmu sw/hw states. Loading pmu | ||
767 | fw in resume crashes when the resume is from sys_exit. */ | ||
768 | const struct firmware *pmu_fw; | ||
769 | |||
770 | u32 gr_idle_timeout_default; | 765 | u32 gr_idle_timeout_default; |
771 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) | 766 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) |
772 | u32 timeouts_enabled; | 767 | u32 timeouts_enabled; |
@@ -1178,9 +1173,6 @@ int gk20a_do_unidle(void); | |||
1178 | int __gk20a_do_idle(struct device *dev, bool force_reset); | 1173 | int __gk20a_do_idle(struct device *dev, bool force_reset); |
1179 | int __gk20a_do_unidle(struct device *dev); | 1174 | int __gk20a_do_unidle(struct device *dev); |
1180 | 1175 | ||
1181 | const struct firmware * | ||
1182 | gk20a_request_firmware(struct gk20a *g, const char *fw_name); | ||
1183 | |||
1184 | #define NVGPU_GPU_ARCHITECTURE_SHIFT 4 | 1176 | #define NVGPU_GPU_ARCHITECTURE_SHIFT 4 |
1185 | 1177 | ||
1186 | /* constructs unique and compact GPUID from nvgpu_gpu_characteristics | 1178 | /* constructs unique and compact GPUID from nvgpu_gpu_characteristics |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c index 5b76eee2..5a1152d5 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "gk20a.h" | 24 | #include "gk20a.h" |
25 | #include "gr_ctx_gk20a.h" | 25 | #include "gr_ctx_gk20a.h" |
26 | #include "hw_gr_gk20a.h" | 26 | #include "hw_gr_gk20a.h" |
27 | #include "nvgpu_common.h" | ||
27 | 28 | ||
28 | static int gr_gk20a_alloc_load_netlist_u32(u32 *src, u32 len, | 29 | static int gr_gk20a_alloc_load_netlist_u32(u32 *src, u32 len, |
29 | struct u32_list_gk20a *u32_list) | 30 | struct u32_list_gk20a *u32_list) |
@@ -135,7 +136,7 @@ static int gr_gk20a_init_ctx_vars_fw(struct gk20a *g, struct gr_gk20a *gr) | |||
135 | continue; | 136 | continue; |
136 | } | 137 | } |
137 | 138 | ||
138 | netlist_fw = gk20a_request_firmware(g, name); | 139 | netlist_fw = nvgpu_request_firmware(g, name, 0); |
139 | if (!netlist_fw) { | 140 | if (!netlist_fw) { |
140 | gk20a_warn(d, "failed to load netlist %s", name); | 141 | gk20a_warn(d, "failed to load netlist %s", name); |
141 | continue; | 142 | continue; |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 883cacdc..9a201cb6 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "gk20a.h" | 34 | #include "gk20a.h" |
35 | #include "kind_gk20a.h" | 35 | #include "kind_gk20a.h" |
36 | #include "gr_ctx_gk20a.h" | 36 | #include "gr_ctx_gk20a.h" |
37 | #include "nvgpu_common.h" | ||
37 | 38 | ||
38 | #include "hw_ccsr_gk20a.h" | 39 | #include "hw_ccsr_gk20a.h" |
39 | #include "hw_ctxsw_prog_gk20a.h" | 40 | #include "hw_ctxsw_prog_gk20a.h" |
@@ -2124,7 +2125,7 @@ int gr_gk20a_init_ctxsw_ucode(struct gk20a *g) | |||
2124 | u32 ucode_size; | 2125 | u32 ucode_size; |
2125 | int err = 0; | 2126 | int err = 0; |
2126 | 2127 | ||
2127 | fecs_fw = gk20a_request_firmware(g, GK20A_FECS_UCODE_IMAGE); | 2128 | fecs_fw = nvgpu_request_firmware(g, GK20A_FECS_UCODE_IMAGE, 0); |
2128 | if (!fecs_fw) { | 2129 | if (!fecs_fw) { |
2129 | gk20a_err(d, "failed to load fecs ucode!!"); | 2130 | gk20a_err(d, "failed to load fecs ucode!!"); |
2130 | return -ENOENT; | 2131 | return -ENOENT; |
@@ -2134,7 +2135,7 @@ int gr_gk20a_init_ctxsw_ucode(struct gk20a *g) | |||
2134 | fecs_boot_image = (void *)(fecs_fw->data + | 2135 | fecs_boot_image = (void *)(fecs_fw->data + |
2135 | sizeof(struct gk20a_ctxsw_bootloader_desc)); | 2136 | sizeof(struct gk20a_ctxsw_bootloader_desc)); |
2136 | 2137 | ||
2137 | gpccs_fw = gk20a_request_firmware(g, GK20A_GPCCS_UCODE_IMAGE); | 2138 | gpccs_fw = nvgpu_request_firmware(g, GK20A_GPCCS_UCODE_IMAGE, 0); |
2138 | if (!gpccs_fw) { | 2139 | if (!gpccs_fw) { |
2139 | release_firmware(fecs_fw); | 2140 | release_firmware(fecs_fw); |
2140 | gk20a_err(d, "failed to load gpccs ucode!!"); | 2141 | gk20a_err(d, "failed to load gpccs ucode!!"); |
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index ca9f2e15..fc95b5bc 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "hw_mc_gk20a.h" | 30 | #include "hw_mc_gk20a.h" |
31 | #include "hw_pwr_gk20a.h" | 31 | #include "hw_pwr_gk20a.h" |
32 | #include "hw_top_gk20a.h" | 32 | #include "hw_top_gk20a.h" |
33 | #include "nvgpu_common.h" | ||
33 | 34 | ||
34 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC | 35 | #ifdef CONFIG_ARCH_TEGRA_18x_SOC |
35 | #include "nvgpu_gpuid_t18x.h" | 36 | #include "nvgpu_gpuid_t18x.h" |
@@ -2883,6 +2884,8 @@ void gk20a_remove_pmu_support(struct pmu_gk20a *pmu) | |||
2883 | 2884 | ||
2884 | if (gk20a_alloc_initialized(&pmu->dmem)) | 2885 | if (gk20a_alloc_initialized(&pmu->dmem)) |
2885 | gk20a_alloc_destroy(&pmu->dmem); | 2886 | gk20a_alloc_destroy(&pmu->dmem); |
2887 | |||
2888 | release_firmware(pmu->fw); | ||
2886 | } | 2889 | } |
2887 | 2890 | ||
2888 | static int gk20a_init_pmu_reset_enable_hw(struct gk20a *g) | 2891 | static int gk20a_init_pmu_reset_enable_hw(struct gk20a *g) |
@@ -2904,18 +2907,18 @@ static int gk20a_prepare_ucode(struct gk20a *g) | |||
2904 | struct mm_gk20a *mm = &g->mm; | 2907 | struct mm_gk20a *mm = &g->mm; |
2905 | struct vm_gk20a *vm = &mm->pmu.vm; | 2908 | struct vm_gk20a *vm = &mm->pmu.vm; |
2906 | 2909 | ||
2907 | if (g->pmu_fw) | 2910 | if (pmu->fw) |
2908 | return gk20a_init_pmu(pmu); | 2911 | return gk20a_init_pmu(pmu); |
2909 | 2912 | ||
2910 | g->pmu_fw = gk20a_request_firmware(g, GK20A_PMU_UCODE_IMAGE); | 2913 | pmu->fw = nvgpu_request_firmware(g, GK20A_PMU_UCODE_IMAGE, 0); |
2911 | if (!g->pmu_fw) { | 2914 | if (!pmu->fw) { |
2912 | gk20a_err(d, "failed to load pmu ucode!!"); | 2915 | gk20a_err(d, "failed to load pmu ucode!!"); |
2913 | return err; | 2916 | return err; |
2914 | } | 2917 | } |
2915 | 2918 | ||
2916 | gk20a_dbg_fn("firmware loaded"); | 2919 | gk20a_dbg_fn("firmware loaded"); |
2917 | 2920 | ||
2918 | pmu->desc = (struct pmu_ucode_desc *)g->pmu_fw->data; | 2921 | pmu->desc = (struct pmu_ucode_desc *)pmu->fw->data; |
2919 | pmu->ucode_image = (u32 *)((u8 *)pmu->desc + | 2922 | pmu->ucode_image = (u32 *)((u8 *)pmu->desc + |
2920 | pmu->desc->descriptor_size); | 2923 | pmu->desc->descriptor_size); |
2921 | 2924 | ||
@@ -2930,7 +2933,8 @@ static int gk20a_prepare_ucode(struct gk20a *g) | |||
2930 | return gk20a_init_pmu(pmu); | 2933 | return gk20a_init_pmu(pmu); |
2931 | 2934 | ||
2932 | err_release_fw: | 2935 | err_release_fw: |
2933 | release_firmware(g->pmu_fw); | 2936 | release_firmware(pmu->fw); |
2937 | pmu->fw = NULL; | ||
2934 | 2938 | ||
2935 | return err; | 2939 | return err; |
2936 | } | 2940 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h index fe82eca4..b28fd597 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.h | |||
@@ -738,6 +738,8 @@ struct pmu_gk20a { | |||
738 | u32 falcon_id; | 738 | u32 falcon_id; |
739 | u32 aelpg_param[5]; | 739 | u32 aelpg_param[5]; |
740 | u32 override_done; | 740 | u32 override_done; |
741 | |||
742 | const struct firmware *fw; | ||
741 | }; | 743 | }; |
742 | 744 | ||
743 | int gk20a_init_pmu_support(struct gk20a *g); | 745 | int gk20a_init_pmu_support(struct gk20a *g); |