diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 51 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/gr_gm20b.c | 10 |
2 files changed, 34 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index e613e65f..db8ef919 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <nvgpu/timers.h> | 23 | #include <nvgpu/timers.h> |
24 | #include <nvgpu/nvgpu_common.h> | 24 | #include <nvgpu/nvgpu_common.h> |
25 | #include <nvgpu/kmem.h> | ||
25 | #include <nvgpu/acr/nvgpu_acr.h> | 26 | #include <nvgpu/acr/nvgpu_acr.h> |
26 | 27 | ||
27 | #include "gk20a/gk20a.h" | 28 | #include "gk20a/gk20a.h" |
@@ -52,8 +53,10 @@ static int lsfm_discover_ucode_images(struct gk20a *g, | |||
52 | struct ls_flcn_mgr *plsfm); | 53 | struct ls_flcn_mgr *plsfm); |
53 | static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr *plsfm, | 54 | static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr *plsfm, |
54 | struct flcn_ucode_img *ucode_image, u32 falcon_id); | 55 | struct flcn_ucode_img *ucode_image, u32 falcon_id); |
55 | static void lsfm_free_ucode_img_res(struct flcn_ucode_img *p_img); | 56 | static void lsfm_free_ucode_img_res(struct gk20a *g, |
56 | static void lsfm_free_nonpmu_ucode_img_res(struct flcn_ucode_img *p_img); | 57 | struct flcn_ucode_img *p_img); |
58 | static void lsfm_free_nonpmu_ucode_img_res(struct gk20a *g, | ||
59 | struct flcn_ucode_img *p_img); | ||
57 | static int lsf_gen_wpr_requirements(struct gk20a *g, struct ls_flcn_mgr *plsfm); | 60 | static int lsf_gen_wpr_requirements(struct gk20a *g, struct ls_flcn_mgr *plsfm); |
58 | static void lsfm_init_wpr_contents(struct gk20a *g, struct ls_flcn_mgr *plsfm, | 61 | static void lsfm_init_wpr_contents(struct gk20a *g, struct ls_flcn_mgr *plsfm, |
59 | struct mem_desc *nonwpr); | 62 | struct mem_desc *nonwpr); |
@@ -159,7 +162,7 @@ static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
159 | goto release_sig; | 162 | goto release_sig; |
160 | } | 163 | } |
161 | 164 | ||
162 | lsf_desc = kzalloc(sizeof(struct lsf_ucode_desc), GFP_KERNEL); | 165 | lsf_desc = nvgpu_kzalloc(g, sizeof(struct lsf_ucode_desc)); |
163 | if (!lsf_desc) { | 166 | if (!lsf_desc) { |
164 | err = -ENOMEM; | 167 | err = -ENOMEM; |
165 | goto release_sig; | 168 | goto release_sig; |
@@ -196,7 +199,7 @@ static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
196 | gk20a_err(dev_from_gk20a(g), "failed to load fecs sig"); | 199 | gk20a_err(dev_from_gk20a(g), "failed to load fecs sig"); |
197 | return -ENOENT; | 200 | return -ENOENT; |
198 | } | 201 | } |
199 | lsf_desc = kzalloc(sizeof(struct lsf_ucode_desc), GFP_KERNEL); | 202 | lsf_desc = nvgpu_kzalloc(g, sizeof(struct lsf_ucode_desc)); |
200 | if (!lsf_desc) { | 203 | if (!lsf_desc) { |
201 | err = -ENOMEM; | 204 | err = -ENOMEM; |
202 | goto rel_sig; | 205 | goto rel_sig; |
@@ -204,7 +207,7 @@ static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
204 | memcpy(lsf_desc, (void *)fecs_sig->data, sizeof(struct lsf_ucode_desc)); | 207 | memcpy(lsf_desc, (void *)fecs_sig->data, sizeof(struct lsf_ucode_desc)); |
205 | lsf_desc->falcon_id = LSF_FALCON_ID_FECS; | 208 | lsf_desc->falcon_id = LSF_FALCON_ID_FECS; |
206 | 209 | ||
207 | p_img->desc = kzalloc(sizeof(struct pmu_ucode_desc), GFP_KERNEL); | 210 | p_img->desc = nvgpu_kzalloc(g, sizeof(struct pmu_ucode_desc)); |
208 | if (p_img->desc == NULL) { | 211 | if (p_img->desc == NULL) { |
209 | err = -ENOMEM; | 212 | err = -ENOMEM; |
210 | goto free_lsf_desc; | 213 | goto free_lsf_desc; |
@@ -247,7 +250,7 @@ static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
247 | release_firmware(fecs_sig); | 250 | release_firmware(fecs_sig); |
248 | return 0; | 251 | return 0; |
249 | free_lsf_desc: | 252 | free_lsf_desc: |
250 | kfree(lsf_desc); | 253 | nvgpu_kfree(g, lsf_desc); |
251 | rel_sig: | 254 | rel_sig: |
252 | release_firmware(fecs_sig); | 255 | release_firmware(fecs_sig); |
253 | return err; | 256 | return err; |
@@ -266,7 +269,7 @@ static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
266 | gk20a_err(dev_from_gk20a(g), "failed to load gpccs sig"); | 269 | gk20a_err(dev_from_gk20a(g), "failed to load gpccs sig"); |
267 | return -ENOENT; | 270 | return -ENOENT; |
268 | } | 271 | } |
269 | lsf_desc = kzalloc(sizeof(struct lsf_ucode_desc), GFP_KERNEL); | 272 | lsf_desc = nvgpu_kzalloc(g, sizeof(struct lsf_ucode_desc)); |
270 | if (!lsf_desc) { | 273 | if (!lsf_desc) { |
271 | err = -ENOMEM; | 274 | err = -ENOMEM; |
272 | goto rel_sig; | 275 | goto rel_sig; |
@@ -275,7 +278,7 @@ static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
275 | sizeof(struct lsf_ucode_desc)); | 278 | sizeof(struct lsf_ucode_desc)); |
276 | lsf_desc->falcon_id = LSF_FALCON_ID_GPCCS; | 279 | lsf_desc->falcon_id = LSF_FALCON_ID_GPCCS; |
277 | 280 | ||
278 | p_img->desc = kzalloc(sizeof(struct pmu_ucode_desc), GFP_KERNEL); | 281 | p_img->desc = nvgpu_kzalloc(g, sizeof(struct pmu_ucode_desc)); |
279 | if (p_img->desc == NULL) { | 282 | if (p_img->desc == NULL) { |
280 | err = -ENOMEM; | 283 | err = -ENOMEM; |
281 | goto free_lsf_desc; | 284 | goto free_lsf_desc; |
@@ -318,7 +321,7 @@ static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
318 | release_firmware(gpccs_sig); | 321 | release_firmware(gpccs_sig); |
319 | return 0; | 322 | return 0; |
320 | free_lsf_desc: | 323 | free_lsf_desc: |
321 | kfree(lsf_desc); | 324 | nvgpu_kfree(g, lsf_desc); |
322 | rel_sig: | 325 | rel_sig: |
323 | release_firmware(gpccs_sig); | 326 | release_firmware(gpccs_sig); |
324 | return err; | 327 | return err; |
@@ -406,7 +409,7 @@ int prepare_ucode_blob(struct gk20a *g) | |||
406 | gm20b_dbg_pmu("wpr carveout base:%llx\n", wpr_inf.wpr_base); | 409 | gm20b_dbg_pmu("wpr carveout base:%llx\n", wpr_inf.wpr_base); |
407 | gm20b_dbg_pmu("wpr carveout size :%x\n", wprsize); | 410 | gm20b_dbg_pmu("wpr carveout size :%x\n", wprsize); |
408 | 411 | ||
409 | sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); | 412 | sgt = nvgpu_kzalloc(g, sizeof(*sgt)); |
410 | if (!sgt) { | 413 | if (!sgt) { |
411 | gk20a_err(dev_from_gk20a(g), "failed to allocate memory\n"); | 414 | gk20a_err(dev_from_gk20a(g), "failed to allocate memory\n"); |
412 | return -ENOMEM; | 415 | return -ENOMEM; |
@@ -502,7 +505,7 @@ static int lsfm_discover_ucode_images(struct gk20a *g, | |||
502 | /*Free any ucode image resources if not managing this falcon*/ | 505 | /*Free any ucode image resources if not managing this falcon*/ |
503 | if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) { | 506 | if (!(pmu->pmu_mode & PMU_LSFM_MANAGED)) { |
504 | gm20b_dbg_pmu("pmu is not LSFM managed\n"); | 507 | gm20b_dbg_pmu("pmu is not LSFM managed\n"); |
505 | lsfm_free_ucode_img_res(&ucode_img); | 508 | lsfm_free_ucode_img_res(g, &ucode_img); |
506 | } | 509 | } |
507 | 510 | ||
508 | /* Enumerate all constructed falcon objects, | 511 | /* Enumerate all constructed falcon objects, |
@@ -534,7 +537,7 @@ static int lsfm_discover_ucode_images(struct gk20a *g, | |||
534 | } else { | 537 | } else { |
535 | gm20b_dbg_pmu("not managed %d\n", | 538 | gm20b_dbg_pmu("not managed %d\n", |
536 | ucode_img.lsf_desc->falcon_id); | 539 | ucode_img.lsf_desc->falcon_id); |
537 | lsfm_free_nonpmu_ucode_img_res( | 540 | lsfm_free_nonpmu_ucode_img_res(g, |
538 | &ucode_img); | 541 | &ucode_img); |
539 | } | 542 | } |
540 | } | 543 | } |
@@ -912,7 +915,7 @@ static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr *plsfm, | |||
912 | { | 915 | { |
913 | 916 | ||
914 | struct lsfm_managed_ucode_img *pnode; | 917 | struct lsfm_managed_ucode_img *pnode; |
915 | pnode = kzalloc(sizeof(struct lsfm_managed_ucode_img), GFP_KERNEL); | 918 | pnode = nvgpu_kzalloc(g, sizeof(struct lsfm_managed_ucode_img)); |
916 | if (pnode == NULL) | 919 | if (pnode == NULL) |
917 | return -ENOMEM; | 920 | return -ENOMEM; |
918 | 921 | ||
@@ -936,24 +939,26 @@ static int lsfm_add_ucode_img(struct gk20a *g, struct ls_flcn_mgr *plsfm, | |||
936 | return 0; | 939 | return 0; |
937 | } | 940 | } |
938 | 941 | ||
939 | /* Free any ucode image structure resources*/ | 942 | /* Free any ucode image structure resources. */ |
940 | static void lsfm_free_ucode_img_res(struct flcn_ucode_img *p_img) | 943 | static void lsfm_free_ucode_img_res(struct gk20a *g, |
944 | struct flcn_ucode_img *p_img) | ||
941 | { | 945 | { |
942 | if (p_img->lsf_desc != NULL) { | 946 | if (p_img->lsf_desc != NULL) { |
943 | kfree(p_img->lsf_desc); | 947 | nvgpu_kfree(g, p_img->lsf_desc); |
944 | p_img->lsf_desc = NULL; | 948 | p_img->lsf_desc = NULL; |
945 | } | 949 | } |
946 | } | 950 | } |
947 | 951 | ||
948 | /* Free any ucode image structure resources*/ | 952 | /* Free any ucode image structure resources. */ |
949 | static void lsfm_free_nonpmu_ucode_img_res(struct flcn_ucode_img *p_img) | 953 | static void lsfm_free_nonpmu_ucode_img_res(struct gk20a *g, |
954 | struct flcn_ucode_img *p_img) | ||
950 | { | 955 | { |
951 | if (p_img->lsf_desc != NULL) { | 956 | if (p_img->lsf_desc != NULL) { |
952 | kfree(p_img->lsf_desc); | 957 | nvgpu_kfree(g, p_img->lsf_desc); |
953 | p_img->lsf_desc = NULL; | 958 | p_img->lsf_desc = NULL; |
954 | } | 959 | } |
955 | if (p_img->desc != NULL) { | 960 | if (p_img->desc != NULL) { |
956 | kfree(p_img->desc); | 961 | nvgpu_kfree(g, p_img->desc); |
957 | p_img->desc = NULL; | 962 | p_img->desc = NULL; |
958 | } | 963 | } |
959 | } | 964 | } |
@@ -966,12 +971,12 @@ static void free_acr_resources(struct gk20a *g, struct ls_flcn_mgr *plsfm) | |||
966 | mg_ucode_img = plsfm->ucode_img_list; | 971 | mg_ucode_img = plsfm->ucode_img_list; |
967 | if (mg_ucode_img->ucode_img.lsf_desc->falcon_id == | 972 | if (mg_ucode_img->ucode_img.lsf_desc->falcon_id == |
968 | LSF_FALCON_ID_PMU) | 973 | LSF_FALCON_ID_PMU) |
969 | lsfm_free_ucode_img_res(&mg_ucode_img->ucode_img); | 974 | lsfm_free_ucode_img_res(g, &mg_ucode_img->ucode_img); |
970 | else | 975 | else |
971 | lsfm_free_nonpmu_ucode_img_res( | 976 | lsfm_free_nonpmu_ucode_img_res(g, |
972 | &mg_ucode_img->ucode_img); | 977 | &mg_ucode_img->ucode_img); |
973 | plsfm->ucode_img_list = mg_ucode_img->next; | 978 | plsfm->ucode_img_list = mg_ucode_img->next; |
974 | kfree(mg_ucode_img); | 979 | nvgpu_kfree(g, mg_ucode_img); |
975 | cnt--; | 980 | cnt--; |
976 | } | 981 | } |
977 | } | 982 | } |
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c index 5b5fa82c..4f4b8d4a 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #include <dt-bindings/soc/gm20b-fuse.h> | 23 | #include <dt-bindings/soc/gm20b-fuse.h> |
24 | 24 | ||
25 | #include <nvgpu/kmem.h> | ||
26 | |||
25 | #include "gk20a/gk20a.h" | 27 | #include "gk20a/gk20a.h" |
26 | #include "gk20a/gr_gk20a.h" | 28 | #include "gk20a/gr_gk20a.h" |
27 | 29 | ||
@@ -593,7 +595,7 @@ static int gr_gm20b_load_smid_config(struct gk20a *g) | |||
593 | u32 i, j; | 595 | u32 i, j; |
594 | u32 tpc_index, gpc_index; | 596 | u32 tpc_index, gpc_index; |
595 | 597 | ||
596 | tpc_sm_id = kcalloc(gr_cwd_sm_id__size_1_v(), sizeof(u32), GFP_KERNEL); | 598 | tpc_sm_id = nvgpu_kcalloc(g, gr_cwd_sm_id__size_1_v(), sizeof(u32)); |
597 | if (!tpc_sm_id) | 599 | if (!tpc_sm_id) |
598 | return -ENOMEM; | 600 | return -ENOMEM; |
599 | 601 | ||
@@ -625,7 +627,7 @@ static int gr_gm20b_load_smid_config(struct gk20a *g) | |||
625 | for (i = 0; i < gr_cwd_sm_id__size_1_v(); i++) | 627 | for (i = 0; i < gr_cwd_sm_id__size_1_v(); i++) |
626 | gk20a_writel(g, gr_cwd_sm_id_r(i), tpc_sm_id[i]); | 628 | gk20a_writel(g, gr_cwd_sm_id_r(i), tpc_sm_id[i]); |
627 | 629 | ||
628 | kfree(tpc_sm_id); | 630 | nvgpu_kfree(g, tpc_sm_id); |
629 | 631 | ||
630 | return 0; | 632 | return 0; |
631 | } | 633 | } |
@@ -1420,7 +1422,7 @@ static int gm20b_gr_fuse_override(struct gk20a *g) | |||
1420 | if (count <= 0) | 1422 | if (count <= 0) |
1421 | return count; | 1423 | return count; |
1422 | 1424 | ||
1423 | fuses = kmalloc(sizeof(u32) * count * 2, GFP_KERNEL); | 1425 | fuses = nvgpu_kmalloc(g, sizeof(u32) * count * 2); |
1424 | if (!fuses) | 1426 | if (!fuses) |
1425 | return -ENOMEM; | 1427 | return -ENOMEM; |
1426 | of_property_read_u32_array(np, "fuse-overrides", fuses, count * 2); | 1428 | of_property_read_u32_array(np, "fuse-overrides", fuses, count * 2); |
@@ -1440,7 +1442,7 @@ static int gm20b_gr_fuse_override(struct gk20a *g) | |||
1440 | } | 1442 | } |
1441 | } | 1443 | } |
1442 | 1444 | ||
1443 | kfree(fuses); | 1445 | nvgpu_kfree(g, fuses); |
1444 | return 0; | 1446 | return 0; |
1445 | } | 1447 | } |
1446 | 1448 | ||