mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 09:57:08 +03:00
gpu: nvgpu: remove dependency on linux header for sim_gk20a*
This patch removes linux dependencies from sim_gk20a.h under gk20a/sim_gk20a.h. The following changes are made in this patch. 1) Created a linux based structure sim_gk20a_linux that contains a common sim_gk20a struct inside it. The common struct sim_gk20a doesn't contain any linux specific structs. 2) The common struct sim_gk20a contains an added function pointer which is used to invoke gk20a_sim_esc_readl() method. 3) sim_gk20a.c is moved to nvgpu/common/linux along with a new header sim_gk20a.h that contains the definition of struct sim_gk20a_linux. 4) struct gk20a now contains a pointer of sim_gk20a instead of the entire object. The memory for this struct is allocated and initialized during gk20a_init_support() and freed during invocation of gk20_remove_support(). 5) We first obtain the pointer for struct sim_gk20a_linux from the pointer of sim_gk20a using the container_of method in order to work on the struct. JIRA NVGPU-386 Change-Id: Ic82b8702642377f82694577a53c3ca0b9c1bb2ab Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1603073 GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
830d3f10ca
commit
312f6c2c5f
@@ -47,6 +47,7 @@
|
||||
#include "intr.h"
|
||||
#include "cde.h"
|
||||
#include "ioctl.h"
|
||||
#include "sim_gk20a.h"
|
||||
#ifdef CONFIG_TEGRA_19x_GPU
|
||||
#include "nvgpu_gpuid_t19x.h"
|
||||
#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
|
||||
@@ -637,11 +638,10 @@ void gk20a_remove_support(struct gk20a *g)
|
||||
if (g->mm.remove_support)
|
||||
g->mm.remove_support(&g->mm);
|
||||
|
||||
if (g->sim.remove_support)
|
||||
g->sim.remove_support(&g->sim);
|
||||
if (g->sim->remove_support)
|
||||
g->sim->remove_support(g->sim);
|
||||
|
||||
/* free mappings to registers, etc */
|
||||
|
||||
if (l->regs) {
|
||||
iounmap(l->regs);
|
||||
l->regs = NULL;
|
||||
@@ -661,6 +661,11 @@ static int gk20a_init_support(struct platform_device *dev)
|
||||
int err = 0;
|
||||
struct gk20a *g = get_gk20a(&dev->dev);
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
struct sim_gk20a_linux *sim_linux = nvgpu_kzalloc(g, sizeof(*sim_linux));
|
||||
if (!sim_linux)
|
||||
goto fail;
|
||||
|
||||
g->sim = &sim_linux->sim;
|
||||
|
||||
tegra_register_idle_unidle(gk20a_do_idle, gk20a_do_unidle, g);
|
||||
|
||||
@@ -681,13 +686,13 @@ static int gk20a_init_support(struct platform_device *dev)
|
||||
}
|
||||
|
||||
if (nvgpu_platform_is_simulation(g)) {
|
||||
g->sim.g = g;
|
||||
g->sim.regs = gk20a_ioremap_resource(dev,
|
||||
g->sim->g = g;
|
||||
sim_linux->regs = gk20a_ioremap_resource(dev,
|
||||
GK20A_SIM_IORESOURCE_MEM,
|
||||
&g->sim.reg_mem);
|
||||
if (IS_ERR(g->sim.regs)) {
|
||||
&sim_linux->reg_mem);
|
||||
if (IS_ERR(sim_linux->regs)) {
|
||||
nvgpu_err(g, "failed to remap gk20a sim regs");
|
||||
err = PTR_ERR(g->sim.regs);
|
||||
err = PTR_ERR(sim_linux->regs);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -703,6 +708,8 @@ static int gk20a_init_support(struct platform_device *dev)
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
nvgpu_kfree(g, sim_linux);
|
||||
g->sim = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user