mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: remove nvgpu_next files
Remove all nvgpu_next files and move the code into corresponding nvgpu files. Merge nvgpu-next-*.yaml into nvgpu-.yaml files. Jira NVGPU-4771 Change-Id: I595311be3c7bbb4f6314811e68712ff01763801e Signed-off-by: Antony Clince Alex <aalex@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2547557 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
c7d43f5292
commit
f9cac0c64d
@@ -39,12 +39,6 @@
|
||||
#include "ioctl_tsg.h"
|
||||
#include "ioctl.h"
|
||||
|
||||
/** @cond DOXYGEN_SHOULD_SKIP_THIS */
|
||||
#if defined(CONFIG_NVGPU_NON_FUSA)
|
||||
#include "os/linux/nvgpu_next_ioctl_prof.h"
|
||||
#endif
|
||||
/** @endcond DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
#include <nvgpu/gr/gr_utils.h>
|
||||
#include <nvgpu/gr/gr_instances.h>
|
||||
#include <nvgpu/grmgr.h>
|
||||
@@ -762,6 +756,78 @@ static int nvgpu_prof_ioctl_pma_stream_update_get_put(struct nvgpu_profiler_obje
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NVGPU_HAL_NON_FUSA)
|
||||
static u32 nvgpu_prof_vab_reserve_translate_vab_mode(struct gk20a *g, u32 mode)
|
||||
{
|
||||
u32 vab_mode = 0U;
|
||||
|
||||
if (mode == NVGPU_PROFILER_VAB_RANGE_CHECKER_MODE_ACCESS) {
|
||||
vab_mode = NVGPU_VAB_MODE_ACCESS;
|
||||
} else if (mode == NVGPU_PROFILER_VAB_RANGE_CHECKER_MODE_DIRTY) {
|
||||
vab_mode = NVGPU_VAB_MODE_DIRTY;
|
||||
} else {
|
||||
nvgpu_err(g, "Unknown vab mode: 0x%x", mode);
|
||||
}
|
||||
|
||||
return vab_mode;
|
||||
}
|
||||
|
||||
static int nvgpu_prof_ioctl_vab_reserve(struct nvgpu_profiler_object *prof,
|
||||
struct nvgpu_profiler_vab_reserve_args *arg)
|
||||
{
|
||||
struct gk20a *g = prof->g;
|
||||
int err;
|
||||
u32 vab_mode = nvgpu_prof_vab_reserve_translate_vab_mode(g,
|
||||
(u32)arg->vab_mode);
|
||||
struct nvgpu_profiler_vab_range_checker *user_ckr =
|
||||
(struct nvgpu_profiler_vab_range_checker *)(uintptr_t)
|
||||
arg->range_checkers_ptr;
|
||||
struct nvgpu_vab_range_checker *ckr;
|
||||
|
||||
if (arg->num_range_checkers == 0) {
|
||||
nvgpu_err(g, "Range checkers cannot be zero");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ckr = nvgpu_kzalloc(g, sizeof(struct nvgpu_vab_range_checker) *
|
||||
arg->num_range_checkers);
|
||||
if (copy_from_user(ckr, user_ckr,
|
||||
sizeof(struct nvgpu_vab_range_checker) *
|
||||
arg->num_range_checkers)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
err = g->ops.fb.vab.reserve(g, vab_mode, arg->num_range_checkers, ckr);
|
||||
|
||||
nvgpu_kfree(g, ckr);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int nvgpu_prof_ioctl_vab_flush(struct nvgpu_profiler_object *prof,
|
||||
struct nvgpu_profiler_vab_flush_state_args *arg)
|
||||
{
|
||||
int err;
|
||||
struct gk20a *g = prof->g;
|
||||
u64 *user_data = nvgpu_kzalloc(g, arg->buffer_size);
|
||||
|
||||
err = g->ops.fb.vab.dump_and_clear(g, user_data, arg->buffer_size);
|
||||
if (err < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (copy_to_user((void __user *)(uintptr_t)arg->buffer_ptr,
|
||||
user_data, arg->buffer_size)) {
|
||||
nvgpu_err(g, "copy_to_user failed!");
|
||||
err = -EFAULT;
|
||||
}
|
||||
|
||||
fail:
|
||||
nvgpu_kfree(g, user_data);
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
@@ -848,13 +914,35 @@ long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
|
||||
(struct nvgpu_profiler_pma_stream_update_get_put_args *)buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
#if defined(CONFIG_NVGPU_NON_FUSA)
|
||||
err = nvgpu_next_prof_fops_ioctl(prof, cmd, (void *)buf);
|
||||
#else
|
||||
case NVGPU_PROFILER_IOCTL_VAB_RESERVE:
|
||||
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_VAB_ENABLED)) {
|
||||
break;
|
||||
}
|
||||
|
||||
err = nvgpu_prof_ioctl_vab_reserve(prof,
|
||||
(struct nvgpu_profiler_vab_reserve_args *)buf);
|
||||
break;
|
||||
|
||||
case NVGPU_PROFILER_IOCTL_VAB_FLUSH_STATE:
|
||||
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_VAB_ENABLED)) {
|
||||
break;
|
||||
}
|
||||
|
||||
err = nvgpu_prof_ioctl_vab_flush(prof,
|
||||
(struct nvgpu_profiler_vab_flush_state_args *)buf);
|
||||
break;
|
||||
|
||||
case NVGPU_PROFILER_IOCTL_VAB_RELEASE:
|
||||
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_VAB_ENABLED)) {
|
||||
err = g->ops.fb.vab.release(g);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
nvgpu_err(g, "unrecognized profiler ioctl cmd: 0x%x", cmd);
|
||||
err = -ENOTTY;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -869,3 +957,4 @@ long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2020-2021, 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,
|
||||
@@ -20,10 +20,18 @@
|
||||
|
||||
struct inode;
|
||||
struct file;
|
||||
#if defined(CONFIG_NVGPU_NON_FUSA)
|
||||
struct nvgpu_profiler_object;
|
||||
#endif
|
||||
|
||||
int nvgpu_prof_dev_fops_open(struct inode *inode, struct file *filp);
|
||||
int nvgpu_prof_ctx_fops_open(struct inode *inode, struct file *filp);
|
||||
int nvgpu_prof_fops_release(struct inode *inode, struct file *filp);
|
||||
long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
#if defined(CONFIG_NVGPU_NON_FUSA)
|
||||
int nvgpu_next_prof_fops_ioctl(struct nvgpu_profiler_object *prof,
|
||||
unsigned int cmd, void *buf);
|
||||
#endif
|
||||
|
||||
#endif /* LINUX_IOCTL_PROF_H */
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* GA10B Tegra Platform Interface
|
||||
*
|
||||
* Copyright (c) 2021, 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 <linux/uaccess.h>
|
||||
#include <uapi/linux/nvgpu.h>
|
||||
|
||||
#include <nvgpu/profiler.h>
|
||||
#include <nvgpu/log.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/kmem.h>
|
||||
#include <nvgpu/fb.h>
|
||||
|
||||
#include "nvgpu_next_ioctl_prof.h"
|
||||
|
||||
static u32 nvgpu_prof_vab_reserve_translate_vab_mode(struct gk20a *g, u32 mode)
|
||||
{
|
||||
u32 vab_mode = 0U;
|
||||
|
||||
if (mode == NVGPU_PROFILER_VAB_RANGE_CHECKER_MODE_ACCESS) {
|
||||
vab_mode = NVGPU_VAB_MODE_ACCESS;
|
||||
} else if (mode == NVGPU_PROFILER_VAB_RANGE_CHECKER_MODE_DIRTY) {
|
||||
vab_mode = NVGPU_VAB_MODE_DIRTY;
|
||||
} else {
|
||||
nvgpu_err(g, "Unknown vab mode: 0x%x", mode);
|
||||
}
|
||||
|
||||
return vab_mode;
|
||||
}
|
||||
|
||||
static int nvgpu_prof_ioctl_vab_reserve(struct nvgpu_profiler_object *prof,
|
||||
struct nvgpu_profiler_vab_reserve_args *arg)
|
||||
{
|
||||
struct gk20a *g = prof->g;
|
||||
int err;
|
||||
u32 vab_mode = nvgpu_prof_vab_reserve_translate_vab_mode(g,
|
||||
(u32)arg->vab_mode);
|
||||
struct nvgpu_profiler_vab_range_checker *user_ckr =
|
||||
(struct nvgpu_profiler_vab_range_checker *)(uintptr_t)
|
||||
arg->range_checkers_ptr;
|
||||
struct nvgpu_vab_range_checker *ckr;
|
||||
|
||||
if (arg->num_range_checkers == 0) {
|
||||
nvgpu_err(g, "Range checkers cannot be zero");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ckr = nvgpu_kzalloc(g, sizeof(struct nvgpu_vab_range_checker) *
|
||||
arg->num_range_checkers);
|
||||
if (copy_from_user(ckr, user_ckr,
|
||||
sizeof(struct nvgpu_vab_range_checker) *
|
||||
arg->num_range_checkers)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
err = g->ops.fb.vab.reserve(g, vab_mode, arg->num_range_checkers, ckr);
|
||||
|
||||
nvgpu_kfree(g, ckr);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int nvgpu_prof_ioctl_vab_flush(struct nvgpu_profiler_object *prof,
|
||||
struct nvgpu_profiler_vab_flush_state_args *arg)
|
||||
{
|
||||
int err;
|
||||
struct gk20a *g = prof->g;
|
||||
u64 *user_data = nvgpu_kzalloc(g, arg->buffer_size);
|
||||
|
||||
err = g->ops.fb.vab.dump_and_clear(g, user_data, arg->buffer_size);
|
||||
if (err < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (copy_to_user((void __user *)(uintptr_t)arg->buffer_ptr,
|
||||
user_data, arg->buffer_size)) {
|
||||
nvgpu_err(g, "copy_to_user failed!");
|
||||
err = -EFAULT;
|
||||
}
|
||||
|
||||
fail:
|
||||
nvgpu_kfree(g, user_data);
|
||||
return err;
|
||||
}
|
||||
|
||||
int nvgpu_next_prof_fops_ioctl(struct nvgpu_profiler_object *prof,
|
||||
unsigned int cmd, void *buf)
|
||||
{
|
||||
int err = -ENOTTY;
|
||||
struct gk20a *g = prof->g;
|
||||
|
||||
switch (cmd) {
|
||||
case NVGPU_PROFILER_IOCTL_VAB_RESERVE:
|
||||
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_VAB_ENABLED)) {
|
||||
break;
|
||||
}
|
||||
|
||||
err = nvgpu_prof_ioctl_vab_reserve(prof,
|
||||
(struct nvgpu_profiler_vab_reserve_args *)buf);
|
||||
break;
|
||||
|
||||
case NVGPU_PROFILER_IOCTL_VAB_FLUSH_STATE:
|
||||
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_VAB_ENABLED)) {
|
||||
break;
|
||||
}
|
||||
|
||||
err = nvgpu_prof_ioctl_vab_flush(prof,
|
||||
(struct nvgpu_profiler_vab_flush_state_args *)buf);
|
||||
break;
|
||||
|
||||
case NVGPU_PROFILER_IOCTL_VAB_RELEASE:
|
||||
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_VAB_ENABLED)) {
|
||||
err = g->ops.fb.vab.release(g);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
nvgpu_err(g, "unrecognized profiler ioctl cmd: 0x%x", cmd);
|
||||
err = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 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_NVGPU_NEXT_IOCTL_PROF_H
|
||||
#define LINUX_NVGPU_NEXT_IOCTL_PROF_H
|
||||
|
||||
struct nvgpu_profiler_object;
|
||||
|
||||
int nvgpu_next_prof_fops_ioctl(struct nvgpu_profiler_object *prof,
|
||||
unsigned int cmd, void *buf);
|
||||
|
||||
#endif /* LINUX_NVGPU_NEXT_IOCTL_PROF_H */
|
||||
Reference in New Issue
Block a user