From b716286e0fd9fab3bccfb674573c27f4b7d65d5b Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Thu, 18 Apr 2019 09:47:44 -0700 Subject: [PATCH] gpu: nvgpu: create common sim unit Move all simulation related code to common sim unit. Moved common/sim.c -> common/sim/sim.c common/sim_pci.c -> common/sim/sim_pci.c Also moved sim netlist related functionality also here. Because, sim related code is not part of safety build and it will work as single place-holder for all sim related code. common/netlist/netlist_sim.c -> common/sim/sim_netlist.c Changed function name for initializing sim netlist context vars and moved it to sim.h from netlist.h nvgpu_netlist_init_ctx_vars_sim -> nvgpu_init_sim_netlist_ctx_vars JIRA NVGPU-2078 Change-Id: Ibe3452d1595ebd8cc08ce7bd186fdf4291e40ca6 Signed-off-by: Seshendra Gadagottu Reviewed-on: https://git-master.nvidia.com/r/2100605 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile | 6 +++--- drivers/gpu/nvgpu/Makefile.sources | 6 +++--- drivers/gpu/nvgpu/common/netlist/netlist.c | 3 ++- drivers/gpu/nvgpu/common/{ => sim}/sim.c | 0 .../common/{netlist/netlist_sim.c => sim/sim_netlist.c} | 4 ++-- drivers/gpu/nvgpu/common/{ => sim}/sim_pci.c | 0 drivers/gpu/nvgpu/include/nvgpu/netlist.h | 1 - drivers/gpu/nvgpu/include/nvgpu/sim.h | 1 + 8 files changed, 11 insertions(+), 10 deletions(-) rename drivers/gpu/nvgpu/common/{ => sim}/sim.c (100%) rename drivers/gpu/nvgpu/common/{netlist/netlist_sim.c => sim/sim_netlist.c} (99%) rename drivers/gpu/nvgpu/common/{ => sim}/sim_pci.c (100%) diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 3bf42cafe..3b9a47ecd 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -74,7 +74,6 @@ nvgpu-y += \ common/gr/obj_ctx.o \ common/gr/fs_state.o \ common/netlist/netlist.o \ - common/netlist/netlist_sim.o \ common/init/nvgpu_init.o \ common/pmu/pmu.o \ common/pmu/pmu_allocator.o \ @@ -483,8 +482,9 @@ nvgpu-y += \ common/power_features/power_features.o \ common/power_features/cg/cg.o \ common/power_features/pg/pg.o \ - common/sim.o \ - common/sim_pci.o \ + common/sim/sim.o \ + common/sim/sim_pci.o \ + common/sim/sim_netlist.o \ common/rc/rc.o \ common/fifo/fifo.o \ common/fifo/channel.o \ diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index d63a32357..72ab9b6e1 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -58,8 +58,9 @@ srcs += os/posix/bug.c \ os/posix/os_sched.c \ os/posix/kmem.c -srcs += common/sim.c \ - common/sim_pci.c \ +srcs += common/sim/sim.c \ + common/sim/sim_pci.c \ + common/sim/sim_netlist.c \ common/init/nvgpu_init.c \ common/mm/allocators/nvgpu_allocator.c \ common/mm/allocators/bitmap_allocator.c \ @@ -119,7 +120,6 @@ srcs += common/sim.c \ common/gr/obj_ctx.c \ common/gr/fs_state.c \ common/netlist/netlist.c \ - common/netlist/netlist_sim.c \ common/pmu/pmu.c \ common/pmu/pmu_allocator.c \ common/pmu/pmu_mutex.c \ diff --git a/drivers/gpu/nvgpu/common/netlist/netlist.c b/drivers/gpu/nvgpu/common/netlist/netlist.c index d885b6f1c..19e30d85b 100644 --- a/drivers/gpu/nvgpu/common/netlist/netlist.c +++ b/drivers/gpu/nvgpu/common/netlist/netlist.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -512,7 +513,7 @@ int nvgpu_netlist_init_ctx_vars(struct gk20a *g) } if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { - return nvgpu_netlist_init_ctx_vars_sim(g); + return nvgpu_init_sim_netlist_ctx_vars(g); } else { return nvgpu_netlist_init_ctx_vars_fw(g); } diff --git a/drivers/gpu/nvgpu/common/sim.c b/drivers/gpu/nvgpu/common/sim/sim.c similarity index 100% rename from drivers/gpu/nvgpu/common/sim.c rename to drivers/gpu/nvgpu/common/sim/sim.c diff --git a/drivers/gpu/nvgpu/common/netlist/netlist_sim.c b/drivers/gpu/nvgpu/common/sim/sim_netlist.c similarity index 99% rename from drivers/gpu/nvgpu/common/netlist/netlist_sim.c rename to drivers/gpu/nvgpu/common/sim/sim_netlist.c index 250375178..03ca7122f 100644 --- a/drivers/gpu/nvgpu/common/netlist/netlist_sim.c +++ b/drivers/gpu/nvgpu/common/sim/sim_netlist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,7 +25,7 @@ #include #include -int nvgpu_netlist_init_ctx_vars_sim(struct gk20a *g) +int nvgpu_init_sim_netlist_ctx_vars(struct gk20a *g) { struct nvgpu_netlist_vars *netlist_vars = g->netlist_vars; int err = -ENOMEM; diff --git a/drivers/gpu/nvgpu/common/sim_pci.c b/drivers/gpu/nvgpu/common/sim/sim_pci.c similarity index 100% rename from drivers/gpu/nvgpu/common/sim_pci.c rename to drivers/gpu/nvgpu/common/sim/sim_pci.c diff --git a/drivers/gpu/nvgpu/include/nvgpu/netlist.h b/drivers/gpu/nvgpu/include/nvgpu/netlist.h index 672d7634d..cc51b3f8d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/netlist.h +++ b/drivers/gpu/nvgpu/include/nvgpu/netlist.h @@ -209,7 +209,6 @@ struct nvgpu_netlist_vars { }; int nvgpu_netlist_init_ctx_vars(struct gk20a *g); -int nvgpu_netlist_init_ctx_vars_sim(struct gk20a *g); void nvgpu_netlist_deinit_ctx_vars(struct gk20a *g); struct netlist_av_list *nvgpu_netlist_get_sw_non_ctx_load_av_list( diff --git a/drivers/gpu/nvgpu/include/nvgpu/sim.h b/drivers/gpu/nvgpu/include/nvgpu/sim.h index 0f0af38d1..e15a74cd1 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/sim.h +++ b/drivers/gpu/nvgpu/include/nvgpu/sim.h @@ -56,5 +56,6 @@ void nvgpu_free_sim_support(struct gk20a *g); void nvgpu_remove_sim_support(struct gk20a *g); void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v); u32 sim_readl(struct sim_nvgpu *sim, u32 r); +int nvgpu_init_sim_netlist_ctx_vars(struct gk20a *g); #endif /* NVGPU_SIM_H */