mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: Move Linux kernel driver code to module.c
Move Linux driver specific code to common/linux/module.c. This includes module initialization, power management, and interrupt functions. Move pci.c, pci.h and nvgpu_common.c under common/linux as they're Linux only files. JIRA NVGPU-16 Change-Id: If92b4dd78ebc0c2bbfa9fbca258e9552e4979b4b Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1456162 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
cb283956b8
commit
03e7ef2657
@@ -23,6 +23,7 @@ endif
|
||||
obj-$(CONFIG_GK20A) := nvgpu.o
|
||||
|
||||
nvgpu-y := \
|
||||
common/linux/module.o \
|
||||
common/linux/kmem.o \
|
||||
common/linux/timers.o \
|
||||
common/linux/ioctl.o \
|
||||
@@ -34,13 +35,13 @@ nvgpu-y := \
|
||||
common/linux/nvgpu_mem.o \
|
||||
common/linux/dma.o \
|
||||
common/linux/soc.o \
|
||||
common/linux/driver_common.o \
|
||||
common/mm/nvgpu_allocator.o \
|
||||
common/mm/bitmap_allocator.o \
|
||||
common/mm/buddy_allocator.o \
|
||||
common/mm/page_allocator.o \
|
||||
common/mm/lockless_allocator.o \
|
||||
common/pramin.o \
|
||||
common/nvgpu_common.o \
|
||||
common/semaphore.o \
|
||||
common/as.o \
|
||||
common/rbtree.o \
|
||||
@@ -105,7 +106,7 @@ nvgpu-y := \
|
||||
|
||||
nvgpu-$(CONFIG_TEGRA_GK20A) += tegra/linux/platform_gk20a_tegra.o
|
||||
nvgpu-$(CONFIG_SYNC) += gk20a/sync_gk20a.o
|
||||
nvgpu-$(CONFIG_GK20A_PCI) += pci.o
|
||||
nvgpu-$(CONFIG_GK20A_PCI) += common/linux/pci.o
|
||||
|
||||
nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
|
||||
gk20a/platform_vgpu_tegra.o \
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "gk20a/gk20a_scale.h"
|
||||
#include "gk20a/gk20a.h"
|
||||
#include "gk20a/gr_gk20a.h"
|
||||
#include "module.h"
|
||||
|
||||
#define EMC3D_DEFAULT_RATIO 750
|
||||
|
||||
@@ -124,6 +124,20 @@ static void nvgpu_init_mm_vars(struct gk20a *g)
|
||||
nvgpu_mutex_init(&g->mm.priv_lock);
|
||||
}
|
||||
|
||||
static int gk20a_secure_page_alloc(struct device *dev)
|
||||
{
|
||||
struct gk20a_platform *platform = dev_get_drvdata(dev);
|
||||
int err = 0;
|
||||
|
||||
if (platform->secure_page_alloc) {
|
||||
err = platform->secure_page_alloc(dev);
|
||||
if (!err)
|
||||
platform->secure_alloc_ready = true;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int nvgpu_probe(struct gk20a *g,
|
||||
const char *debugfs_symlink,
|
||||
const char *interface_name,
|
||||
1052
drivers/gpu/nvgpu/common/linux/module.c
Normal file
1052
drivers/gpu/nvgpu/common/linux/module.c
Normal file
File diff suppressed because it is too large
Load Diff
22
drivers/gpu/nvgpu/common/linux/module.h
Normal file
22
drivers/gpu/nvgpu/common/linux/module.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
#ifndef __NVGPU_COMMON_LINUX_MODULE_H__
|
||||
#define __NVGPU_COMMON_LINUX_MODULE_H__
|
||||
|
||||
struct gk20a;
|
||||
struct device;
|
||||
|
||||
int gk20a_pm_finalize_poweron(struct device *dev);
|
||||
void gk20a_remove_support(struct gk20a *g);
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "gk20a/gk20a.h"
|
||||
#include "gk20a/platform_gk20a.h"
|
||||
#include "clk/clk.h"
|
||||
#include "module.h"
|
||||
|
||||
#include "pci.h"
|
||||
|
||||
@@ -228,6 +228,74 @@ void gk20a_init_debug_ops(struct gpu_ops *gops)
|
||||
gops->debug.show_dump = gk20a_debug_show_dump;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static int railgate_residency_show(struct seq_file *s, void *data)
|
||||
{
|
||||
struct device *dev = s->private;
|
||||
struct gk20a_platform *platform = dev_get_drvdata(dev);
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
unsigned long time_since_last_state_transition_ms;
|
||||
unsigned long total_rail_gate_time_ms;
|
||||
unsigned long total_rail_ungate_time_ms;
|
||||
|
||||
if (platform->is_railgated(dev)) {
|
||||
time_since_last_state_transition_ms =
|
||||
jiffies_to_msecs(jiffies -
|
||||
g->pstats.last_rail_gate_complete);
|
||||
total_rail_ungate_time_ms = g->pstats.total_rail_ungate_time_ms;
|
||||
total_rail_gate_time_ms =
|
||||
g->pstats.total_rail_gate_time_ms +
|
||||
time_since_last_state_transition_ms;
|
||||
} else {
|
||||
time_since_last_state_transition_ms =
|
||||
jiffies_to_msecs(jiffies -
|
||||
g->pstats.last_rail_ungate_complete);
|
||||
total_rail_gate_time_ms = g->pstats.total_rail_gate_time_ms;
|
||||
total_rail_ungate_time_ms =
|
||||
g->pstats.total_rail_ungate_time_ms +
|
||||
time_since_last_state_transition_ms;
|
||||
}
|
||||
|
||||
seq_printf(s, "Time with Rails Gated: %lu ms\n"
|
||||
"Time with Rails UnGated: %lu ms\n"
|
||||
"Total railgating cycles: %lu\n",
|
||||
total_rail_gate_time_ms,
|
||||
total_rail_ungate_time_ms,
|
||||
g->pstats.railgating_cycle_count - 1);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int railgate_residency_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, railgate_residency_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations railgate_residency_fops = {
|
||||
.open = railgate_residency_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
int gk20a_railgating_debugfs_init(struct device *dev)
|
||||
{
|
||||
struct dentry *d;
|
||||
struct gk20a_platform *platform = dev_get_drvdata(dev);
|
||||
|
||||
if (!platform->can_railgate)
|
||||
return 0;
|
||||
|
||||
d = debugfs_create_file(
|
||||
"railgate_residency", S_IRUGO|S_IWUSR, platform->debugfs, dev,
|
||||
&railgate_residency_fops);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void gk20a_debug_init(struct device *dev, const char *debugfs_symlink)
|
||||
{
|
||||
struct gk20a_platform *platform = dev_get_drvdata(dev);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1389,6 +1389,7 @@ int gk20a_do_unidle(void);
|
||||
int __gk20a_do_idle(struct device *dev, bool force_reset);
|
||||
int __gk20a_do_unidle(struct device *dev);
|
||||
|
||||
int gk20a_can_busy(struct gk20a *g);
|
||||
void gk20a_driver_start_unload(struct gk20a *g);
|
||||
int gk20a_wait_for_idle(struct device *dev);
|
||||
|
||||
@@ -1431,9 +1432,8 @@ extern struct class nvgpu_class;
|
||||
|
||||
#define INTERFACE_NAME "nvhost%s-gpu"
|
||||
|
||||
int gk20a_pm_init(struct device *dev);
|
||||
int gk20a_pm_finalize_poweron(struct device *dev);
|
||||
void gk20a_remove_support(struct gk20a *g);
|
||||
int gk20a_prepare_poweroff(struct gk20a *g);
|
||||
int gk20a_finalize_poweron(struct gk20a *g);
|
||||
|
||||
static inline struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch)
|
||||
{
|
||||
@@ -1476,8 +1476,4 @@ void gk20a_put(struct gk20a *g);
|
||||
int gk20a_railgating_debugfs_init(struct device *dev);
|
||||
#endif
|
||||
|
||||
int gk20a_secure_page_alloc(struct device *dev);
|
||||
void __iomem *gk20a_ioremap_resource(struct platform_device *dev, int i,
|
||||
struct resource **out);
|
||||
|
||||
#endif /* GK20A_H */
|
||||
|
||||
@@ -103,15 +103,6 @@ int gk20a_init_sim_support(struct platform_device *pdev)
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
u64 phys;
|
||||
|
||||
g->sim.g = g;
|
||||
g->sim.regs = gk20a_ioremap_resource(pdev, GK20A_SIM_IORESOURCE_MEM,
|
||||
&g->sim.reg_mem);
|
||||
if (IS_ERR(g->sim.regs)) {
|
||||
nvgpu_err(g, "failed to remap gk20a sim regs\n");
|
||||
err = PTR_ERR(g->sim.regs);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* allocate sim event/msg buffers */
|
||||
err = alloc_and_kmap_iopage(g, &g->sim.send_bfr.kvaddr,
|
||||
&g->sim.send_bfr.phys,
|
||||
|
||||
Reference in New Issue
Block a user