diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/module.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 4af62d5f..950b1581 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "intr.h" | 47 | #include "intr.h" |
48 | #include "cde.h" | 48 | #include "cde.h" |
49 | #include "ioctl.h" | 49 | #include "ioctl.h" |
50 | #include "sim_gk20a.h" | ||
50 | #ifdef CONFIG_TEGRA_19x_GPU | 51 | #ifdef CONFIG_TEGRA_19x_GPU |
51 | #include "nvgpu_gpuid_t19x.h" | 52 | #include "nvgpu_gpuid_t19x.h" |
52 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | 53 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION |
@@ -637,11 +638,10 @@ void gk20a_remove_support(struct gk20a *g) | |||
637 | if (g->mm.remove_support) | 638 | if (g->mm.remove_support) |
638 | g->mm.remove_support(&g->mm); | 639 | g->mm.remove_support(&g->mm); |
639 | 640 | ||
640 | if (g->sim.remove_support) | 641 | if (g->sim->remove_support) |
641 | g->sim.remove_support(&g->sim); | 642 | g->sim->remove_support(g->sim); |
642 | 643 | ||
643 | /* free mappings to registers, etc */ | 644 | /* free mappings to registers, etc */ |
644 | |||
645 | if (l->regs) { | 645 | if (l->regs) { |
646 | iounmap(l->regs); | 646 | iounmap(l->regs); |
647 | l->regs = NULL; | 647 | l->regs = NULL; |
@@ -661,6 +661,11 @@ static int gk20a_init_support(struct platform_device *dev) | |||
661 | int err = 0; | 661 | int err = 0; |
662 | struct gk20a *g = get_gk20a(&dev->dev); | 662 | struct gk20a *g = get_gk20a(&dev->dev); |
663 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | 663 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); |
664 | struct sim_gk20a_linux *sim_linux = nvgpu_kzalloc(g, sizeof(*sim_linux)); | ||
665 | if (!sim_linux) | ||
666 | goto fail; | ||
667 | |||
668 | g->sim = &sim_linux->sim; | ||
664 | 669 | ||
665 | tegra_register_idle_unidle(gk20a_do_idle, gk20a_do_unidle, g); | 670 | tegra_register_idle_unidle(gk20a_do_idle, gk20a_do_unidle, g); |
666 | 671 | ||
@@ -681,13 +686,13 @@ static int gk20a_init_support(struct platform_device *dev) | |||
681 | } | 686 | } |
682 | 687 | ||
683 | if (nvgpu_platform_is_simulation(g)) { | 688 | if (nvgpu_platform_is_simulation(g)) { |
684 | g->sim.g = g; | 689 | g->sim->g = g; |
685 | g->sim.regs = gk20a_ioremap_resource(dev, | 690 | sim_linux->regs = gk20a_ioremap_resource(dev, |
686 | GK20A_SIM_IORESOURCE_MEM, | 691 | GK20A_SIM_IORESOURCE_MEM, |
687 | &g->sim.reg_mem); | 692 | &sim_linux->reg_mem); |
688 | if (IS_ERR(g->sim.regs)) { | 693 | if (IS_ERR(sim_linux->regs)) { |
689 | nvgpu_err(g, "failed to remap gk20a sim regs"); | 694 | nvgpu_err(g, "failed to remap gk20a sim regs"); |
690 | err = PTR_ERR(g->sim.regs); | 695 | err = PTR_ERR(sim_linux->regs); |
691 | goto fail; | 696 | goto fail; |
692 | } | 697 | } |
693 | 698 | ||
@@ -703,6 +708,8 @@ static int gk20a_init_support(struct platform_device *dev) | |||
703 | return 0; | 708 | return 0; |
704 | 709 | ||
705 | fail: | 710 | fail: |
711 | nvgpu_kfree(g, sim_linux); | ||
712 | g->sim = NULL; | ||
706 | return err; | 713 | return err; |
707 | } | 714 | } |
708 | 715 | ||