gpu: nvgpu: Scrub gk20a_platform dependencies

Remove gk20a_platform dependencies from gk20a.h. This makes
gk20a_platform a Linux platform specific data structure. Add #include
for platform_gk20a.h in the source files that still depend on Linux.

JIRA NVGPU-16

Change-Id: Ib098accd34a1f5066eb8680c387f9b178169f3f0
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1463547
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Terje Bergstrom
2017-04-14 13:19:04 -07:00
committed by mobile promotions
parent b1d303685b
commit b7fca01b0e
43 changed files with 106 additions and 51 deletions

View File

@@ -26,10 +26,15 @@
#include <nvgpu/atomic.h>
#include <nvgpu/bug.h>
#include <nvgpu/kref.h>
#include <nvgpu/log.h>
#include "gk20a/gk20a.h"
#include "clk/clk_arb.h"
#ifdef CONFIG_DEBUG_FS
#include "gk20a/platform_gk20a.h"
#endif
#define MAX_F_POINTS 256
#define DEFAULT_EVENT_NUMBER 32
@@ -1482,8 +1487,7 @@ static long nvgpu_clk_arb_ioctl_event_dev(struct file *filp, unsigned int cmd,
(struct nvgpu_gpu_set_event_filter_args *)buf);
break;
default:
dev_dbg(dev_from_gk20a(g),
"unrecognized event ioctl cmd: 0x%x", cmd);
nvgpu_warn(g, "unrecognized event ioctl cmd: 0x%x", cmd);
err = -ENOTTY;
}

View File

@@ -17,6 +17,7 @@
#include <linux/clk.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
struct clk *gk20a_clk_get(struct gk20a *g)
{

View File

@@ -18,6 +18,9 @@
#include "gk20a/gk20a.h"
#include "gk20a/pmu_gk20a.h"
#ifdef CONFIG_DEBUG_FS
#include "gk20a/platform_gk20a.h"
#endif
#include <nvgpu/hw/gk20a/hw_pwr_gk20a.h>
#include <nvgpu/hw/gp106/hw_fb_gp106.h>

View File

@@ -25,6 +25,7 @@
#include <nvgpu/linux/dma.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#if defined(CONFIG_GK20A_VIDMEM)
static u64 __nvgpu_dma_alloc(struct nvgpu_allocator *allocator, dma_addr_t at,

View File

@@ -23,6 +23,7 @@
#include "gk20a/gk20a_scale.h"
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "module.h"
#define EMC3D_DEFAULT_RATIO 750

View File

@@ -21,6 +21,7 @@
#include <nvgpu/firmware.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
static const struct firmware *do_request_firmware(struct device *dev,
const char *prefix, const char *fw_name, int flags)

View File

@@ -21,6 +21,7 @@
#include <nvgpu/nvgpu_common.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h"
#include "gk20a/ctxsw_trace_gk20a.h"
#include "ioctl_channel.h"

View File

@@ -26,6 +26,7 @@
#include <nvgpu/gmmu.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "ioctl_as.h"
static int gk20a_as_ioctl_bind_channel(

View File

@@ -28,6 +28,7 @@
#include "ioctl_ctrl.h"
#include "ioctl_tsg.h"
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gk20a/fence_gk20a.h"
#include <nvgpu/log.h>

View File

@@ -26,6 +26,7 @@
#include <nvgpu/log.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gk20a/tsg_gk20a.h"
#include "ioctl_tsg.h"
#include "ioctl_channel.h"

View File

@@ -30,6 +30,7 @@
#include <nvgpu/soc.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "vgpu/vgpu.h"
#include "gk20a/gk20a_scale.h"
#include "gk20a/ctxsw_trace_gk20a.h"

View File

@@ -21,6 +21,7 @@
#include <nvgpu/soc.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
/*
* Returns 1 if the platform is pre-Si and should ignore the timeout checking.

View File

@@ -20,7 +20,9 @@
#include "gk20a/gk20a.h"
#include "gk20a/mm_gk20a.h"
#ifdef CONFIG_DEBUG_FS
#include "gk20a/platform_gk20a.h"
#endif
u32 nvgpu_alloc_tracing_on;

View File

@@ -20,6 +20,7 @@
#include <linux/fs.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include "platform_gk20a.h"
#endif
#include <linux/dma-buf.h>

View File

@@ -33,6 +33,10 @@
#include <nvgpu/hw/gk20a/hw_mc_gk20a.h>
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
#ifdef CONFIG_DEBUG_FS
#include "platform_gk20a.h"
#endif
static u32 ce2_nonblockpipe_isr(struct gk20a *g, u32 fifo_intr)
{
gk20a_dbg(gpu_dbg_intr, "ce2 non-blocking pipe interrupt\n");

View File

@@ -2378,7 +2378,6 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
struct fifo_profile_gk20a *profile)
{
struct gk20a *g = c->g;
struct device *d = dev_from_gk20a(g);
struct priv_cmd_entry *wait_cmd = NULL;
struct priv_cmd_entry *incr_cmd = NULL;
struct gk20a_fence *pre_fence = NULL;
@@ -2394,13 +2393,10 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
bool need_deferred_cleanup = false;
struct nvgpu_gpfifo __user *user_gpfifo = args ?
(struct nvgpu_gpfifo __user *)(uintptr_t)args->gpfifo : NULL;
struct gk20a_platform *platform;
if (g->driver_is_dying)
return -ENODEV;
platform = gk20a_get_platform(d);
if (c->has_timedout)
return -ETIMEDOUT;

View File

@@ -24,6 +24,7 @@
#include "ctxsw_trace_gk20a.h"
#include "gk20a.h"
#include "platform_gk20a.h"
#include "gr_gk20a.h"
#include <nvgpu/log.h>

View File

@@ -28,6 +28,7 @@
#include <nvgpu/log.h>
#include "gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gr_gk20a.h"
#include "dbg_gpu_gk20a.h"
#include "regops_gk20a.h"

View File

@@ -25,6 +25,7 @@
#include <nvgpu/log.h>
#include "gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "debug_gk20a.h"
#include <nvgpu/hw/gk20a/hw_ram_gk20a.h>

View File

@@ -27,6 +27,7 @@
#include "fecs_trace_gk20a.h"
#include "gk20a.h"
#include "gr_gk20a.h"
#include "platform_gk20a.h"
#include <nvgpu/log.h>

View File

@@ -45,6 +45,10 @@
#include <nvgpu/hw/gk20a/hw_mc_gk20a.h>
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
#ifdef CONFIG_DEBUG_FS
#include "platform_gk20a.h"
#endif
#define FECS_METHOD_WFI_RESTORE 0x80000
static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id,

View File

@@ -27,6 +27,7 @@
#include <trace/events/gk20a.h>
#include "gk20a.h"
#include "platform_gk20a.h"
#include "channel_sync_gk20a.h"
#include "ctxsw_trace_gk20a.h"

View File

@@ -58,7 +58,6 @@ struct dbg_profiler_object_data;
#include "pmu_gk20a.h"
#include "priv_ring_gk20a.h"
#include "therm_gk20a.h"
#include "platform_gk20a.h"
#include "gm20b/acr_gm20b.h"
#include "cde_gk20a.h"
#include "debug_gk20a.h"
@@ -1232,11 +1231,6 @@ static inline unsigned long gk20a_get_gr_idle_timeout(struct gk20a *g)
g->gr_idle_timeout_default : MAX_SCHEDULE_TIMEOUT;
}
static inline struct gk20a *get_gk20a(struct device *dev)
{
return gk20a_get_platform(dev)->g;
}
enum BAR0_DEBUG_OPERATION {
BARO_ZERO_NOP = 0,
OP_END = 'DONE',
@@ -1352,17 +1346,6 @@ static inline u32 gk20a_bar1_readl(struct gk20a *g, u32 b)
}
/* convenience */
static inline struct device *dev_from_gk20a(struct gk20a *g)
{
return g->dev;
}
static inline struct gk20a *gk20a_from_dev(struct device *dev)
{
if (!dev)
return NULL;
return ((struct gk20a_platform *)dev_get_drvdata(dev))->g;
}
static inline struct gk20a *gk20a_from_as(struct gk20a_as *as)
{
return container_of(as, struct gk20a, as);
@@ -1418,23 +1401,6 @@ enum {
KEPLER_CHANNEL_GPFIFO_C = 0xA26F,
};
static inline bool gk20a_gpu_is_virtual(struct device *dev)
{
struct gk20a_platform *platform = dev_get_drvdata(dev);
return platform->virtual_dev;
}
static inline int support_gk20a_pmu(struct device *dev)
{
if (IS_ENABLED(CONFIG_GK20A_PMU)) {
/* gPMU is not supported for vgpu */
return !gk20a_gpu_is_virtual(dev);
}
return 0;
}
void gk20a_create_sysfs(struct device *dev);
void gk20a_remove_sysfs(struct device *dev);

View File

@@ -26,6 +26,7 @@
#include <nvgpu/kmem.h>
#include "gk20a.h"
#include "platform_gk20a.h"
#include "pmu_gk20a.h"
#include "clk_gk20a.h"
#include "gk20a_scale.h"

View File

@@ -31,6 +31,7 @@
#include <nvgpu/kmem.h>
#include "gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gr_gk20a.h"
#include "fifo_gk20a.h"
#include "pmu_gk20a.h"

View File

@@ -37,9 +37,12 @@
#include "regops_gk20a.h"
#include "dbg_gpu_gk20a.h"
#include "debug_gk20a.h"
#include "platform_gk20a.h"
#include "ctxsw_trace_gk20a.h"
#ifdef CONFIG_DEBUG_FS
#include "platform_gk20a.h"
#endif
#include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h>
#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h>
#include <nvgpu/hw/gk20a/hw_fifo_gk20a.h>

View File

@@ -41,6 +41,7 @@
#include <nvgpu/linux/dma.h>
#include "gk20a.h"
#include "platform_gk20a.h"
#include "mm_gk20a.h"
#include "fence_gk20a.h"
#include "kind_gk20a.h"
@@ -1262,16 +1263,16 @@ u64 gk20a_vm_alloc_va(struct vm_gk20a *vm,
struct nvgpu_allocator *vma = vm->vma[gmmu_pgsz_idx];
u64 offset;
u64 gmmu_page_size = vm->gmmu_page_sizes[gmmu_pgsz_idx];
struct gk20a *g = vm->mm->g;
if (gmmu_pgsz_idx >= gmmu_nr_page_sizes) {
dev_warn(dev_from_vm(vm),
nvgpu_warn(g,
"invalid page size requested in gk20a vm alloc");
return 0;
}
if ((gmmu_pgsz_idx == gmmu_page_size_big) && !vm->big_pages) {
dev_warn(dev_from_vm(vm),
"unsupportd page size requested");
nvgpu_warn(g, "unsupportd page size requested");
return 0;
}

View File

@@ -21,6 +21,8 @@
#include <nvgpu/lock.h>
#include "gk20a.h"
#define GK20A_CLKS_MAX 4
struct gk20a;
@@ -252,4 +254,36 @@ int gk20a_tegra_busy(struct device *dev);
void gk20a_tegra_idle(struct device *dev);
void gk20a_tegra_debug_dump(struct device *pdev);
static inline struct gk20a *get_gk20a(struct device *dev)
{
return gk20a_get_platform(dev)->g;
}
static inline struct device *dev_from_gk20a(struct gk20a *g)
{
return g->dev;
}
static inline struct gk20a *gk20a_from_dev(struct device *dev)
{
if (!dev)
return NULL;
return ((struct gk20a_platform *)dev_get_drvdata(dev))->g;
}
static inline bool gk20a_gpu_is_virtual(struct device *dev)
{
struct gk20a_platform *platform = dev_get_drvdata(dev);
return platform->virtual_dev;
}
static inline int support_gk20a_pmu(struct device *dev)
{
if (IS_ENABLED(CONFIG_GK20A_PMU)) {
/* gPMU is not supported for vgpu */
return !gk20a_gpu_is_virtual(dev);
}
return 0;
}
#endif

View File

@@ -16,12 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/module.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/uaccess.h>
#include <nvgpu/nvgpu_common.h>
#include <nvgpu/timers.h>
#include <nvgpu/kmem.h>
@@ -41,6 +35,12 @@
#include "nvgpu_gpuid_t19x.h"
#endif
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include "platform_gk20a.h"
#endif
#define GK20A_PMU_UCODE_IMAGE "gpmu_ucode.bin"
#define PMU_MEM_SCRUBBING_TIMEOUT_MAX 1000

View File

@@ -15,6 +15,7 @@
#include <linux/wait.h>
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include "platform_gk20a.h"
#endif
#include <linux/uaccess.h>
#include <linux/poll.h>

View File

@@ -19,6 +19,7 @@
#include <linux/platform_device.h>
#include "gk20a.h"
#include "platform_gk20a.h"
#include <nvgpu/log.h>

View File

@@ -20,6 +20,7 @@
#include <nvgpu/firmware.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gm20b/fifo_gm20b.h"
#include "bios_gm206.h"

View File

@@ -29,6 +29,7 @@
#endif
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "clk_gm20b.h"
#include <nvgpu/soc.h>

View File

@@ -23,6 +23,9 @@
#include <nvgpu/kmem.h>
#include "gk20a/gk20a.h"
#ifdef CONFIG_DEBUG_FS
#include "gk20a/platform_gk20a.h"
#endif
#include "clk_gp106.h"
#include "clk/clk_arb.h"

View File

@@ -12,10 +12,12 @@
*/
#include "therm_gp106.h"
#include "therm/thrmpmu.h"
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include "gk20a/platform_gk20a.h"
#endif
#include "therm/thrmpmu.h"
#include <nvgpu/hw/gp106/hw_therm_gp106.h>

View File

@@ -23,6 +23,10 @@
#include "gm206/bios_gm206.h"
#include "gp106/xve_gp106.h"
#ifdef CONFIG_DEBUG_FS
#include "gk20a/platform_gk20a.h"
#endif
#include <nvgpu/bug.h>
#include <nvgpu/hw/gp106/hw_xp_gp106.h>

View File

@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gp10b_sysfs.h"
#include <nvgpu/hw/gp10b/hw_gr_gp10b.h>

View File

@@ -16,6 +16,7 @@
#include <nvgpu/dma.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gm20b/mm_gm20b.h"
#include "mm_gp10b.h"
#include "rpfb_gp10b.h"

View File

@@ -17,6 +17,7 @@
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include "gk20a/platform_gk20a.h"
#endif
int pmgr_pwr_devices_get_power(struct gk20a *g, u32 *val)

View File

@@ -15,6 +15,7 @@
#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "gm206/bios_gm206.h"
#include "gk20a/pmu_gk20a.h"

View File

@@ -15,6 +15,7 @@
#include <nvgpu/bug.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include "pwrpolicy.h"
#include "boardobj/boardobjgrp.h"
#include "boardobj/boardobjgrp_e32.h"

View File

@@ -20,6 +20,7 @@
#include "clk.h"
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
static unsigned long nvgpu_linux_clk_get_rate(struct gk20a *g, u32 api_domain)
{

View File

@@ -19,6 +19,7 @@
#include <linux/tegra_gr_comm.h>
#include <linux/tegra_vgpu.h>
#include "gk20a/gk20a.h"
#include "gk20a/platform_gk20a.h"
#include <nvgpu/thread.h>