mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: linux: move os ops to a common file
Currently only cde uses nvgpu_os_linux_ops to set up linux specific ops. Move nvgpu_os_linux_ops of a gpu to a common file so that those can be reused for other os ops of that gpu. JIRA NVGPU-603 Change-Id: Icf1ff275d3832229137f730fe8183b8015e82673 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1797902 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
18e060227d
commit
94eebcdd8c
@@ -49,6 +49,9 @@ nvgpu-y += common/bus/bus_gk20a.o \
|
||||
|
||||
# Linux specific parts of nvgpu.
|
||||
nvgpu-y += \
|
||||
os/linux/os_ops.o \
|
||||
os/linux/os_ops_gm20b.o \
|
||||
os/linux/os_ops_gp10b.o \
|
||||
os/linux/kmem.o \
|
||||
os/linux/timers.o \
|
||||
os/linux/ioctl.o \
|
||||
|
||||
@@ -1791,24 +1791,3 @@ int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd,
|
||||
dma_buf_put(dmabuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nvgpu_cde_init_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
struct gk20a *g = &l->g;
|
||||
u32 ver = g->params.gpu_arch + g->params.gpu_impl;
|
||||
|
||||
switch (ver) {
|
||||
case GK20A_GPUID_GM20B:
|
||||
case GK20A_GPUID_GM20B_B:
|
||||
l->ops.cde = gm20b_cde_ops.cde;
|
||||
break;
|
||||
case NVGPU_GPUID_GP10B:
|
||||
l->ops.cde = gp10b_cde_ops.cde;
|
||||
break;
|
||||
default:
|
||||
/* CDE is optional, so today ignoring unknown chip is fine */
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GM20B CDE
|
||||
*
|
||||
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2015-2018, 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"),
|
||||
@@ -35,10 +35,10 @@ enum programs {
|
||||
PROG_PASSTHROUGH = 6,
|
||||
};
|
||||
|
||||
static void gm20b_cde_get_program_numbers(struct gk20a *g,
|
||||
u32 block_height_log2,
|
||||
u32 shader_parameter,
|
||||
int *hprog_out, int *vprog_out)
|
||||
void gm20b_cde_get_program_numbers(struct gk20a *g,
|
||||
u32 block_height_log2,
|
||||
u32 shader_parameter,
|
||||
int *hprog_out, int *vprog_out)
|
||||
{
|
||||
int hprog = PROG_HPASS;
|
||||
int vprog = (block_height_log2 >= 2) ?
|
||||
@@ -56,9 +56,3 @@ static void gm20b_cde_get_program_numbers(struct gk20a *g,
|
||||
*hprog_out = hprog;
|
||||
*vprog_out = vprog;
|
||||
}
|
||||
|
||||
struct nvgpu_os_linux_ops gm20b_cde_ops = {
|
||||
.cde = {
|
||||
.get_program_numbers = gm20b_cde_get_program_numbers,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GM20B CDE
|
||||
*
|
||||
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2015-2018, 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,8 +25,9 @@
|
||||
#ifndef _NVHOST_GM20B_CDE
|
||||
#define _NVHOST_GM20B_CDE
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
extern struct nvgpu_os_linux_ops gm20b_cde_ops;
|
||||
void gm20b_cde_get_program_numbers(struct gk20a *g,
|
||||
u32 block_height_log2,
|
||||
u32 shader_parameter,
|
||||
int *hprog_out, int *vprog_out);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -151,11 +151,3 @@ int gp10b_populate_scatter_buffer(struct gk20a *g,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct nvgpu_os_linux_ops gp10b_cde_ops = {
|
||||
.cde = {
|
||||
.get_program_numbers = gp10b_cde_get_program_numbers,
|
||||
.need_scatter_buffer = gp10b_need_scatter_buffer,
|
||||
.populate_scatter_buffer = gp10b_populate_scatter_buffer,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GP10B CDE
|
||||
*
|
||||
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2015-2018, 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"),
|
||||
@@ -27,6 +27,14 @@
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
extern struct nvgpu_os_linux_ops gp10b_cde_ops;
|
||||
|
||||
void gp10b_cde_get_program_numbers(struct gk20a *g,
|
||||
u32 block_height_log2,
|
||||
u32 shader_parameter,
|
||||
int *hprog_out, int *vprog_out);
|
||||
bool gp10b_need_scatter_buffer(struct gk20a *g);
|
||||
int gp10b_populate_scatter_buffer(struct gk20a *g,
|
||||
struct sg_table *sgt,
|
||||
size_t surface_size,
|
||||
void *scatter_buffer_ptr,
|
||||
size_t scatter_buffer_size);
|
||||
#endif
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "ioctl.h"
|
||||
|
||||
#include "os_linux.h"
|
||||
#include "os_ops.h"
|
||||
#include "ctxsw_trace.h"
|
||||
#include "driver_common.h"
|
||||
#include "channel.h"
|
||||
@@ -183,17 +184,6 @@ static int gk20a_restore_registers(struct gk20a *g)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||
err = nvgpu_cde_init_ops(l);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l)
|
||||
{
|
||||
struct gk20a *g = &l->g;
|
||||
|
||||
40
drivers/gpu/nvgpu/os/linux/os_ops.c
Normal file
40
drivers/gpu/nvgpu/os/linux/os_ops.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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/>.
|
||||
*/
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
#include "os_ops_gm20b.h"
|
||||
#include "os_ops_gp10b.h"
|
||||
|
||||
int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
struct gk20a *g = &l->g;
|
||||
u32 ver = g->params.gpu_arch + g->params.gpu_impl;
|
||||
|
||||
switch (ver) {
|
||||
case GK20A_GPUID_GM20B:
|
||||
case GK20A_GPUID_GM20B_B:
|
||||
nvgpu_gm20b_init_os_ops(l);
|
||||
break;
|
||||
case NVGPU_GPUID_GP10B:
|
||||
nvgpu_gp10b_init_os_ops(l);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
22
drivers/gpu/nvgpu/os/linux/os_ops.h
Normal file
22
drivers/gpu/nvgpu/os/linux/os_ops.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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 __LINUX_OS_OPS_H
|
||||
#define __LINUX_OS_OPS_H
|
||||
|
||||
int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l);
|
||||
|
||||
#endif
|
||||
34
drivers/gpu/nvgpu/os/linux/os_ops_gm20b.c
Normal file
34
drivers/gpu/nvgpu/os/linux/os_ops_gm20b.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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/>.
|
||||
*/
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
#include "cde_gm20b.h"
|
||||
|
||||
static struct nvgpu_os_linux_ops gm20b_os_linux_ops = {
|
||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||
.cde = {
|
||||
.get_program_numbers = gm20b_cde_get_program_numbers,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
void nvgpu_gm20b_init_os_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||
l->ops.cde = gm20b_os_linux_ops.cde;
|
||||
#endif
|
||||
}
|
||||
22
drivers/gpu/nvgpu/os/linux/os_ops_gm20b.h
Normal file
22
drivers/gpu/nvgpu/os/linux/os_ops_gm20b.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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 __LINUX_OS_OPS_GM20B_H
|
||||
#define __LINUX_OS_OPS_GM20B_H
|
||||
|
||||
void nvgpu_gm20b_init_os_ops(struct nvgpu_os_linux *l);
|
||||
|
||||
#endif
|
||||
36
drivers/gpu/nvgpu/os/linux/os_ops_gp10b.c
Normal file
36
drivers/gpu/nvgpu/os/linux/os_ops_gp10b.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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/>.
|
||||
*/
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
#include "cde_gp10b.h"
|
||||
|
||||
static struct nvgpu_os_linux_ops gp10b_os_linux_ops = {
|
||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||
.cde = {
|
||||
.get_program_numbers = gp10b_cde_get_program_numbers,
|
||||
.need_scatter_buffer = gp10b_need_scatter_buffer,
|
||||
.populate_scatter_buffer = gp10b_populate_scatter_buffer,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
void nvgpu_gp10b_init_os_ops(struct nvgpu_os_linux *l)
|
||||
{
|
||||
#ifdef CONFIG_NVGPU_SUPPORT_CDE
|
||||
l->ops.cde = gp10b_os_linux_ops.cde;
|
||||
#endif
|
||||
}
|
||||
22
drivers/gpu/nvgpu/os/linux/os_ops_gp10b.h
Normal file
22
drivers/gpu/nvgpu/os/linux/os_ops_gp10b.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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 __LINUX_OS_OPS_GP10B_H
|
||||
#define __LINUX_OS_OPS_GP10B_H
|
||||
|
||||
void nvgpu_gp10b_init_os_ops(struct nvgpu_os_linux *l);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user