mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: Remove Linux devnode fields from gk20a
Move Linux devnode related fields to a new header file os_linux.h. The class structure is defined in module.c, so move its declaration to module.h. JIRA NVGPU-38 Change-Id: I5d8920169064f4289ff61004f7f81543a9aba221 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1505927 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
2ffbdc50d8
commit
92c43deefc
@@ -28,6 +28,8 @@
|
||||
#include "ioctl_ctrl.h"
|
||||
#include "ioctl_as.h"
|
||||
#include "ioctl_tsg.h"
|
||||
#include "module.h"
|
||||
#include "os_linux.h"
|
||||
|
||||
#define GK20A_NUM_CDEVS 7
|
||||
|
||||
@@ -162,49 +164,50 @@ static int gk20a_create_device(
|
||||
void gk20a_user_deinit(struct device *dev, struct class *class)
|
||||
{
|
||||
struct gk20a *g = gk20a_from_dev(dev);
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
if (g->channel.node) {
|
||||
device_destroy(class, g->channel.cdev.dev);
|
||||
cdev_del(&g->channel.cdev);
|
||||
if (l->channel.node) {
|
||||
device_destroy(class, l->channel.cdev.dev);
|
||||
cdev_del(&l->channel.cdev);
|
||||
}
|
||||
|
||||
if (g->as_dev.node) {
|
||||
device_destroy(class, g->as_dev.cdev.dev);
|
||||
cdev_del(&g->as_dev.cdev);
|
||||
if (l->as_dev.node) {
|
||||
device_destroy(class, l->as_dev.cdev.dev);
|
||||
cdev_del(&l->as_dev.cdev);
|
||||
}
|
||||
|
||||
if (g->ctrl.node) {
|
||||
device_destroy(class, g->ctrl.cdev.dev);
|
||||
cdev_del(&g->ctrl.cdev);
|
||||
if (l->ctrl.node) {
|
||||
device_destroy(class, l->ctrl.cdev.dev);
|
||||
cdev_del(&l->ctrl.cdev);
|
||||
}
|
||||
|
||||
if (g->dbg.node) {
|
||||
device_destroy(class, g->dbg.cdev.dev);
|
||||
cdev_del(&g->dbg.cdev);
|
||||
if (l->dbg.node) {
|
||||
device_destroy(class, l->dbg.cdev.dev);
|
||||
cdev_del(&l->dbg.cdev);
|
||||
}
|
||||
|
||||
if (g->prof.node) {
|
||||
device_destroy(class, g->prof.cdev.dev);
|
||||
cdev_del(&g->prof.cdev);
|
||||
if (l->prof.node) {
|
||||
device_destroy(class, l->prof.cdev.dev);
|
||||
cdev_del(&l->prof.cdev);
|
||||
}
|
||||
|
||||
if (g->tsg.node) {
|
||||
device_destroy(class, g->tsg.cdev.dev);
|
||||
cdev_del(&g->tsg.cdev);
|
||||
if (l->tsg.node) {
|
||||
device_destroy(class, l->tsg.cdev.dev);
|
||||
cdev_del(&l->tsg.cdev);
|
||||
}
|
||||
|
||||
if (g->ctxsw.node) {
|
||||
device_destroy(class, g->ctxsw.cdev.dev);
|
||||
cdev_del(&g->ctxsw.cdev);
|
||||
if (l->ctxsw.node) {
|
||||
device_destroy(class, l->ctxsw.cdev.dev);
|
||||
cdev_del(&l->ctxsw.cdev);
|
||||
}
|
||||
|
||||
if (g->sched.node) {
|
||||
device_destroy(class, g->sched.cdev.dev);
|
||||
cdev_del(&g->sched.cdev);
|
||||
if (l->sched.node) {
|
||||
device_destroy(class, l->sched.cdev.dev);
|
||||
cdev_del(&l->sched.cdev);
|
||||
}
|
||||
|
||||
if (g->cdev_region)
|
||||
unregister_chrdev_region(g->cdev_region, GK20A_NUM_CDEVS);
|
||||
if (l->cdev_region)
|
||||
unregister_chrdev_region(l->cdev_region, GK20A_NUM_CDEVS);
|
||||
}
|
||||
|
||||
int gk20a_user_init(struct device *dev, const char *interface_name,
|
||||
@@ -213,51 +216,52 @@ int gk20a_user_init(struct device *dev, const char *interface_name,
|
||||
int err;
|
||||
dev_t devno;
|
||||
struct gk20a *g = gk20a_from_dev(dev);
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
err = alloc_chrdev_region(&devno, 0, GK20A_NUM_CDEVS, dev_name(dev));
|
||||
if (err) {
|
||||
dev_err(dev, "failed to allocate devno\n");
|
||||
goto fail;
|
||||
}
|
||||
g->cdev_region = devno;
|
||||
l->cdev_region = devno;
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "",
|
||||
&g->channel.cdev, &g->channel.node,
|
||||
&l->channel.cdev, &l->channel.node,
|
||||
&gk20a_channel_ops,
|
||||
class);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-as",
|
||||
&g->as_dev.cdev, &g->as_dev.node,
|
||||
&l->as_dev.cdev, &l->as_dev.node,
|
||||
&gk20a_as_ops,
|
||||
class);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-ctrl",
|
||||
&g->ctrl.cdev, &g->ctrl.node,
|
||||
&l->ctrl.cdev, &l->ctrl.node,
|
||||
&gk20a_ctrl_ops,
|
||||
class);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-dbg",
|
||||
&g->dbg.cdev, &g->dbg.node,
|
||||
&l->dbg.cdev, &l->dbg.node,
|
||||
&gk20a_dbg_ops,
|
||||
class);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-prof",
|
||||
&g->prof.cdev, &g->prof.node,
|
||||
&l->prof.cdev, &l->prof.node,
|
||||
&gk20a_prof_ops,
|
||||
class);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-tsg",
|
||||
&g->tsg.cdev, &g->tsg.node,
|
||||
&l->tsg.cdev, &l->tsg.node,
|
||||
&gk20a_tsg_ops,
|
||||
class);
|
||||
if (err)
|
||||
@@ -265,7 +269,7 @@ int gk20a_user_init(struct device *dev, const char *interface_name,
|
||||
|
||||
#ifdef CONFIG_GK20A_CTXSW_TRACE
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-ctxsw",
|
||||
&g->ctxsw.cdev, &g->ctxsw.node,
|
||||
&l->ctxsw.cdev, &l->ctxsw.node,
|
||||
&gk20a_ctxsw_ops,
|
||||
class);
|
||||
if (err)
|
||||
@@ -273,7 +277,7 @@ int gk20a_user_init(struct device *dev, const char *interface_name,
|
||||
#endif
|
||||
|
||||
err = gk20a_create_device(dev, devno++, interface_name, "-sched",
|
||||
&g->sched.cdev, &g->sched.node,
|
||||
&l->sched.cdev, &l->sched.node,
|
||||
&gk20a_sched_ops,
|
||||
class);
|
||||
if (err)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "gk20a/platform_gk20a.h"
|
||||
#include "ioctl_as.h"
|
||||
#include "vm_priv.h"
|
||||
#include "os_linux.h"
|
||||
|
||||
static int gk20a_as_ioctl_bind_channel(
|
||||
struct gk20a_as_share *as_share,
|
||||
@@ -253,13 +254,15 @@ static int gk20a_as_ioctl_map_buffer_compbits(
|
||||
|
||||
int gk20a_as_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct gk20a_as_share *as_share;
|
||||
struct gk20a *g;
|
||||
int err;
|
||||
|
||||
gk20a_dbg_fn("");
|
||||
|
||||
g = container_of(inode->i_cdev, struct gk20a, as_dev.cdev);
|
||||
l = container_of(inode->i_cdev, struct nvgpu_os_linux, as_dev.cdev);
|
||||
g = &l->g;
|
||||
|
||||
err = gk20a_as_alloc_share(g, 0, 0, &as_share);
|
||||
if (err) {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "gk20a/dbg_gpu_gk20a.h"
|
||||
#include "gk20a/fence_gk20a.h"
|
||||
#include "ioctl_channel.h"
|
||||
#include "os_linux.h"
|
||||
|
||||
static void gk20a_channel_trace_sched_param(
|
||||
void (*trace)(int chid, int tsgid, pid_t pid, u32 timeslice,
|
||||
@@ -359,8 +360,9 @@ free_ref:
|
||||
|
||||
int gk20a_channel_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct gk20a *g = container_of(inode->i_cdev,
|
||||
struct gk20a, channel.cdev);
|
||||
struct nvgpu_os_linux *l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, channel.cdev);
|
||||
struct gk20a *g = &l->g;
|
||||
int ret;
|
||||
|
||||
gk20a_dbg_fn("start");
|
||||
@@ -378,6 +380,7 @@ int gk20a_channel_open_ioctl(struct gk20a *g,
|
||||
struct file *file;
|
||||
char name[64];
|
||||
s32 runlist_id = args->in.runlist_id;
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
err = get_unused_fd_flags(O_RDWR);
|
||||
if (err < 0)
|
||||
@@ -387,7 +390,7 @@ int gk20a_channel_open_ioctl(struct gk20a *g,
|
||||
snprintf(name, sizeof(name), "nvhost-%s-fd%d",
|
||||
dev_name(g->dev), fd);
|
||||
|
||||
file = anon_inode_getfile(name, g->channel.cdev.ops, NULL, O_RDWR);
|
||||
file = anon_inode_getfile(name, l->channel.cdev.ops, NULL, O_RDWR);
|
||||
if (IS_ERR(file)) {
|
||||
err = PTR_ERR(file);
|
||||
goto clean_up;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "gk20a/gk20a.h"
|
||||
#include "gk20a/platform_gk20a.h"
|
||||
#include "gk20a/fence_gk20a.h"
|
||||
#include "os_linux.h"
|
||||
|
||||
#include <nvgpu/log.h>
|
||||
|
||||
@@ -48,15 +49,16 @@ struct gk20a_ctrl_priv {
|
||||
|
||||
int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct gk20a *g;
|
||||
struct gk20a_ctrl_priv *priv;
|
||||
int err = 0;
|
||||
|
||||
gk20a_dbg_fn("");
|
||||
|
||||
g = container_of(inode->i_cdev,
|
||||
struct gk20a, ctrl.cdev);
|
||||
g = gk20a_get(g);
|
||||
l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, ctrl.cdev);
|
||||
g = gk20a_get(&l->g);
|
||||
if (!g)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -199,6 +201,7 @@ static int gk20a_ctrl_alloc_as(
|
||||
struct gk20a *g,
|
||||
struct nvgpu_alloc_as_args *args)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
struct gk20a_as_share *as_share;
|
||||
int err;
|
||||
int fd;
|
||||
@@ -212,7 +215,7 @@ static int gk20a_ctrl_alloc_as(
|
||||
|
||||
snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd);
|
||||
|
||||
file = anon_inode_getfile(name, g->as_dev.cdev.ops, NULL, O_RDWR);
|
||||
file = anon_inode_getfile(name, l->as_dev.cdev.ops, NULL, O_RDWR);
|
||||
if (IS_ERR(file)) {
|
||||
err = PTR_ERR(file);
|
||||
goto clean_up;
|
||||
@@ -239,6 +242,7 @@ clean_up:
|
||||
static int gk20a_ctrl_open_tsg(struct gk20a *g,
|
||||
struct nvgpu_gpu_open_tsg_args *args)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
int err;
|
||||
int fd;
|
||||
struct file *file;
|
||||
@@ -251,7 +255,7 @@ static int gk20a_ctrl_open_tsg(struct gk20a *g,
|
||||
|
||||
snprintf(name, sizeof(name), "nvgpu-%s-tsg%d", g->name, fd);
|
||||
|
||||
file = anon_inode_getfile(name, g->tsg.cdev.ops, NULL, O_RDWR);
|
||||
file = anon_inode_getfile(name, l->tsg.cdev.ops, NULL, O_RDWR);
|
||||
if (IS_ERR(file)) {
|
||||
err = PTR_ERR(file);
|
||||
goto clean_up;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "gk20a/tsg_gk20a.h"
|
||||
#include "ioctl_tsg.h"
|
||||
#include "ioctl_channel.h"
|
||||
#include "os_linux.h"
|
||||
|
||||
struct tsg_private {
|
||||
struct gk20a *g;
|
||||
@@ -240,13 +241,13 @@ free_ref:
|
||||
|
||||
int nvgpu_ioctl_tsg_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct gk20a *g;
|
||||
struct nvgpu_os_linux *l;
|
||||
int ret;
|
||||
|
||||
g = container_of(inode->i_cdev,
|
||||
struct gk20a, tsg.cdev);
|
||||
l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, tsg.cdev);
|
||||
gk20a_dbg_fn("");
|
||||
ret = nvgpu_ioctl_tsg_open(g, filp);
|
||||
ret = nvgpu_ioctl_tsg_open(&l->g, filp);
|
||||
gk20a_dbg_fn("done");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#ifdef CONFIG_TEGRA_19x_GPU
|
||||
#include "nvgpu_gpuid_t19x.h"
|
||||
#endif
|
||||
#include "os_linux.h"
|
||||
|
||||
#define CLASS_NAME "nvidia-gpu"
|
||||
/* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */
|
||||
@@ -849,6 +850,7 @@ static inline void set_gk20a(struct platform_device *pdev, struct gk20a *gk20a)
|
||||
|
||||
static int gk20a_probe(struct platform_device *dev)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct gk20a *gk20a;
|
||||
int err;
|
||||
struct gk20a_platform *platform = NULL;
|
||||
@@ -874,12 +876,13 @@ static int gk20a_probe(struct platform_device *dev)
|
||||
if (gk20a_gpu_is_virtual(&dev->dev))
|
||||
return vgpu_probe(dev);
|
||||
|
||||
gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL);
|
||||
if (!gk20a) {
|
||||
l = kzalloc(sizeof(*l), GFP_KERNEL);
|
||||
if (!l) {
|
||||
dev_err(&dev->dev, "couldn't allocate gk20a support");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
gk20a = &l->g;
|
||||
set_gk20a(dev, gk20a);
|
||||
gk20a->dev = &dev->dev;
|
||||
gk20a->log_mask = NVGPU_DEFAULT_DBG_MASK;
|
||||
|
||||
@@ -19,4 +19,6 @@ struct device;
|
||||
int gk20a_pm_finalize_poweron(struct device *dev);
|
||||
void gk20a_remove_support(struct gk20a *g);
|
||||
|
||||
extern struct class nvgpu_class;
|
||||
|
||||
#endif
|
||||
|
||||
76
drivers/gpu/nvgpu/common/linux/os_linux.h
Normal file
76
drivers/gpu/nvgpu/common/linux/os_linux.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef NVGPU_OS_LINUX_H
|
||||
#define NVGPU_OS_LINUX_H
|
||||
|
||||
#include <linux/cdev.h>
|
||||
|
||||
#include "gk20a/gk20a.h"
|
||||
|
||||
struct nvgpu_os_linux {
|
||||
struct gk20a g;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} channel;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} ctrl;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} as_dev;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} dbg;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} prof;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} tsg;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} ctxsw;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} sched;
|
||||
|
||||
dev_t cdev_region;
|
||||
};
|
||||
|
||||
static inline struct nvgpu_os_linux *nvgpu_os_linux_from_gk20a(struct gk20a *g)
|
||||
{
|
||||
return container_of(g, struct nvgpu_os_linux, g);
|
||||
}
|
||||
|
||||
#define INTERFACE_NAME "nvhost%s-gpu"
|
||||
|
||||
#endif
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "pci.h"
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
#define PCI_INTERFACE_NAME "card-%s%%s"
|
||||
|
||||
static int nvgpu_pci_tegra_probe(struct device *dev)
|
||||
@@ -346,6 +348,7 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *pent)
|
||||
{
|
||||
struct gk20a_platform *platform = NULL;
|
||||
struct nvgpu_os_linux *l;
|
||||
struct gk20a *g;
|
||||
int err;
|
||||
char nodefmt[64];
|
||||
@@ -359,12 +362,14 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
|
||||
platform = &nvgpu_pci_device[pent->driver_data];
|
||||
pci_set_drvdata(pdev, platform);
|
||||
|
||||
g = kzalloc(sizeof(struct gk20a), GFP_KERNEL);
|
||||
if (!g) {
|
||||
nvgpu_err(g, "couldn't allocate gk20a support");
|
||||
l = kzalloc(sizeof(*l), GFP_KERNEL);
|
||||
if (!l) {
|
||||
dev_err(&pdev->dev, "couldn't allocate gk20a support");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
g = &l->g;
|
||||
|
||||
nvgpu_kmem_init(g);
|
||||
|
||||
err = nvgpu_init_enabled_flags(g);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "gk20a.h"
|
||||
#include "platform_gk20a.h"
|
||||
#include "gr_gk20a.h"
|
||||
#include "common/linux/os_linux.h"
|
||||
|
||||
#include <nvgpu/log.h>
|
||||
#include <nvgpu/atomic.h>
|
||||
@@ -266,6 +267,7 @@ static int gk20a_ctxsw_dev_ioctl_poll(struct gk20a_ctxsw_dev *dev)
|
||||
|
||||
int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct gk20a *g;
|
||||
struct gk20a_ctxsw_trace *trace;
|
||||
struct gk20a_ctxsw_dev *dev;
|
||||
@@ -276,8 +278,8 @@ int gk20a_ctxsw_dev_open(struct inode *inode, struct file *filp)
|
||||
/* only one VM for now */
|
||||
const int vmid = 0;
|
||||
|
||||
g = container_of(inode->i_cdev, struct gk20a, ctxsw.cdev);
|
||||
g = gk20a_get(g);
|
||||
l = container_of(inode->i_cdev, struct nvgpu_os_linux, ctxsw.cdev);
|
||||
g = gk20a_get(&l->g);
|
||||
if (!g)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "gr_gk20a.h"
|
||||
#include "dbg_gpu_gk20a.h"
|
||||
#include "regops_gk20a.h"
|
||||
#include "common/linux/os_linux.h"
|
||||
|
||||
#include <nvgpu/hw/gk20a/hw_therm_gk20a.h>
|
||||
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
|
||||
@@ -115,6 +116,7 @@ static int alloc_profiler(struct gk20a *g,
|
||||
static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
|
||||
struct file *filp, bool is_profiler)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct dbg_session_gk20a *dbg_session;
|
||||
struct gk20a *g;
|
||||
|
||||
@@ -123,12 +125,12 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
|
||||
int err;
|
||||
|
||||
if (!is_profiler)
|
||||
g = container_of(inode->i_cdev,
|
||||
struct gk20a, dbg.cdev);
|
||||
l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, dbg.cdev);
|
||||
else
|
||||
g = container_of(inode->i_cdev,
|
||||
struct gk20a, prof.cdev);
|
||||
g = gk20a_get(g);
|
||||
l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, prof.cdev);
|
||||
g = gk20a_get(&l->g);
|
||||
if (!g)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ struct nvgpu_cpu_time_correlation_sample;
|
||||
|
||||
#include <nvgpu/lock.h>
|
||||
#include <nvgpu/thread.h>
|
||||
#include <linux/cdev.h>
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
#include <linux/debugfs.h>
|
||||
#endif
|
||||
@@ -1157,53 +1156,11 @@ struct gk20a {
|
||||
|
||||
struct nvgpu_gpu_characteristics gpu_characteristics;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} channel;
|
||||
|
||||
struct gk20a_as as;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} ctrl;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} as_dev;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} dbg;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} prof;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} tsg;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} ctxsw;
|
||||
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
} sched;
|
||||
|
||||
struct nvgpu_mutex client_lock;
|
||||
int client_refcount; /* open channels and ctrl nodes */
|
||||
|
||||
dev_t cdev_region;
|
||||
|
||||
struct gpu_ops ops;
|
||||
|
||||
int irqs_enabled;
|
||||
@@ -1518,10 +1475,6 @@ static inline u32 scale_ptimer(u32 timeout , u32 scale10x)
|
||||
return (timeout * 10) / scale10x;
|
||||
}
|
||||
|
||||
extern struct class nvgpu_class;
|
||||
|
||||
#define INTERFACE_NAME "nvhost%s-gpu"
|
||||
|
||||
int gk20a_prepare_poweroff(struct gk20a *g);
|
||||
int gk20a_finalize_poweron(struct gk20a *g);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "gk20a.h"
|
||||
#include "gr_gk20a.h"
|
||||
#include "sched_gk20a.h"
|
||||
#include "common/linux/os_linux.h"
|
||||
|
||||
#include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h>
|
||||
#include <nvgpu/hw/gk20a/hw_gr_gk20a.h>
|
||||
@@ -370,12 +371,13 @@ static int gk20a_sched_dev_ioctl_put_tsg(struct gk20a_sched_ctrl *sched,
|
||||
|
||||
int gk20a_sched_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct gk20a *g = container_of(inode->i_cdev,
|
||||
struct gk20a, sched.cdev);
|
||||
struct nvgpu_os_linux *l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, sched.cdev);
|
||||
struct gk20a *g;
|
||||
struct gk20a_sched_ctrl *sched;
|
||||
int err = 0;
|
||||
|
||||
g = gk20a_get(g);
|
||||
g = gk20a_get(&l->g);
|
||||
if (!g)
|
||||
return -ENODEV;
|
||||
sched = &g->sched_ctrl;
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
#include "gk20a/channel_gk20a.h"
|
||||
#include "gm20b/hal_gm20b.h"
|
||||
|
||||
#include "common/linux/module.h"
|
||||
#include "common/linux/os_linux.h"
|
||||
|
||||
#include <nvgpu/hw/gk20a/hw_mc_gk20a.h>
|
||||
|
||||
static inline int vgpu_comm_init(struct platform_device *pdev)
|
||||
@@ -628,6 +631,7 @@ static int vgpu_get_constants(struct gk20a *g)
|
||||
|
||||
int vgpu_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct gk20a *gk20a;
|
||||
int err;
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -641,11 +645,12 @@ int vgpu_probe(struct platform_device *pdev)
|
||||
|
||||
gk20a_dbg_fn("");
|
||||
|
||||
gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL);
|
||||
if (!gk20a) {
|
||||
l = kzalloc(sizeof(*l), GFP_KERNEL);
|
||||
if (!l) {
|
||||
dev_err(dev, "couldn't allocate gk20a support");
|
||||
return -ENOMEM;
|
||||
}
|
||||
gk20a = &l->g;
|
||||
|
||||
nvgpu_kmem_init(gk20a);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user