diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 32 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/vgpu.c | 7 |
2 files changed, 13 insertions, 26 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index a5345764..87faa2f2 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c | |||
@@ -617,18 +617,6 @@ static int vgpu_gr_free_obj_ctx(struct channel_gk20a *c, | |||
617 | return 0; | 617 | return 0; |
618 | } | 618 | } |
619 | 619 | ||
620 | static u32 vgpu_gr_get_gpc_tpc_count(struct gk20a *g, u32 gpc_index) | ||
621 | { | ||
622 | u32 data; | ||
623 | |||
624 | WARN_ON(gpc_index > 0); | ||
625 | |||
626 | if (vgpu_get_attribute(vgpu_get_handle(g), | ||
627 | TEGRA_VGPU_ATTRIB_GPC0_TPC_COUNT, &data)) | ||
628 | gk20a_err(dev_from_gk20a(g), "failed to retrieve gpc0_tpc_count"); | ||
629 | return data; | ||
630 | } | ||
631 | |||
632 | static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) | 620 | static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) |
633 | { | 621 | { |
634 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); | 622 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
@@ -640,11 +628,6 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) | |||
640 | gr->gpc_count = priv->constants.gpc_count; | 628 | gr->gpc_count = priv->constants.gpc_count; |
641 | gr->max_tpc_per_gpc_count = priv->constants.max_tpc_per_gpc_count; | 629 | gr->max_tpc_per_gpc_count = priv->constants.max_tpc_per_gpc_count; |
642 | 630 | ||
643 | if (vgpu_get_attribute(vgpu_get_handle(g), | ||
644 | TEGRA_VGPU_ATTRIB_TPC_COUNT, | ||
645 | &gr->tpc_count)) | ||
646 | return -ENOMEM; | ||
647 | |||
648 | gr->max_tpc_count = gr->max_gpc_count * gr->max_tpc_per_gpc_count; | 631 | gr->max_tpc_count = gr->max_gpc_count * gr->max_tpc_per_gpc_count; |
649 | 632 | ||
650 | gr->gpc_tpc_count = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); | 633 | gr->gpc_tpc_count = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); |
@@ -660,9 +643,12 @@ static int vgpu_gr_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) | |||
660 | if (!gr->sm_to_cluster) | 643 | if (!gr->sm_to_cluster) |
661 | goto cleanup; | 644 | goto cleanup; |
662 | 645 | ||
646 | gr->tpc_count = 0; | ||
663 | for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) { | 647 | for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) { |
664 | gr->gpc_tpc_count[gpc_index] = | 648 | gr->gpc_tpc_count[gpc_index] = |
665 | vgpu_gr_get_gpc_tpc_count(g, gpc_index); | 649 | priv->constants.gpc_tpc_count[gpc_index]; |
650 | |||
651 | gr->tpc_count += gr->gpc_tpc_count[gpc_index]; | ||
666 | 652 | ||
667 | if (g->ops.gr.get_gpc_tpc_mask) | 653 | if (g->ops.gr.get_gpc_tpc_mask) |
668 | gr->gpc_tpc_mask[gpc_index] = | 654 | gr->gpc_tpc_mask[gpc_index] = |
@@ -739,15 +725,9 @@ static int vgpu_gr_get_zcull_info(struct gk20a *g, struct gr_gk20a *gr, | |||
739 | 725 | ||
740 | static u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) | 726 | static u32 vgpu_gr_get_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) |
741 | { | 727 | { |
742 | u32 data; | 728 | struct vgpu_priv_data *priv = vgpu_get_priv_data(g); |
743 | |||
744 | WARN_ON(gpc_index > 0); | ||
745 | |||
746 | if (vgpu_get_attribute(vgpu_get_handle(g), | ||
747 | TEGRA_VGPU_ATTRIB_GPC0_TPC_MASK, &data)) | ||
748 | gk20a_err(dev_from_gk20a(g), "failed to retrieve gpc0_tpc_mask"); | ||
749 | 729 | ||
750 | return data; | 730 | return priv->constants.gpc_tpc_mask[gpc_index]; |
751 | } | 731 | } |
752 | 732 | ||
753 | static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) | 733 | static u32 vgpu_gr_get_max_fbps_count(struct gk20a *g) |
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index f5aef512..125be58c 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c | |||
@@ -504,6 +504,13 @@ static int vgpu_get_constants(struct gk20a *g) | |||
504 | return err; | 504 | return err; |
505 | } | 505 | } |
506 | 506 | ||
507 | if (unlikely(p->gpc_count > TEGRA_VGPU_MAX_GPC_COUNT || | ||
508 | p->max_tpc_per_gpc_count > TEGRA_VGPU_MAX_TPC_COUNT_PER_GPC)) { | ||
509 | gk20a_err(g->dev, "gpc_count %d max_tpc_per_gpc %d overflow", | ||
510 | (int)p->gpc_count, (int)p->max_tpc_per_gpc_count); | ||
511 | return -EINVAL; | ||
512 | } | ||
513 | |||
507 | priv->constants = *p; | 514 | priv->constants = *p; |
508 | return 0; | 515 | return 0; |
509 | } | 516 | } |