diff --git a/arch/nvgpu-interface.yaml b/arch/nvgpu-interface.yaml index 3ca4006eb..9a67bee98 100644 --- a/arch/nvgpu-interface.yaml +++ b/arch/nvgpu-interface.yaml @@ -126,3 +126,7 @@ os_sched: nvhost: safe: yes sources: [ include/nvgpu/nvhost.h ] + +vpr: + safe: no + sources: [ include/nvgpu/vpr.h ] diff --git a/arch/nvgpu-linux.yaml b/arch/nvgpu-linux.yaml index 4f4710694..feab0d816 100644 --- a/arch/nvgpu-linux.yaml +++ b/arch/nvgpu-linux.yaml @@ -16,6 +16,9 @@ bsearch: channel: sources: [ os/linux/linux-channel.c, os/linux/channel.h ] +vpr: + sources: [ os/linux/vpr.c ] + clk: sources: [ os/linux/clk.c, os/linux/clk.h ] diff --git a/arch/nvgpu-posix.yaml b/arch/nvgpu-posix.yaml index 31e5a7ecf..029ccac9b 100644 --- a/arch/nvgpu-posix.yaml +++ b/arch/nvgpu-posix.yaml @@ -33,7 +33,8 @@ all: os/posix/posix-vgpu.c, os/posix/posix-vidmem.c, os/posix/fecs_trace_posix.c, - os/posix/stubs.c ] + os/posix/stubs.c, + os/posix/posix-vpr.c ] headers: safe: no diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 5890b6d1d..b3c451bf2 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -355,7 +355,8 @@ nvgpu-y += \ os/linux/os_ops_tu104.o \ os/linux/bsearch.o \ os/linux/sdl/sdl_stub.o \ - os/linux/dmabuf_vidmem.o + os/linux/dmabuf_vidmem.o \ + os/linux/vpr.o nvgpu-$(CONFIG_DEBUG_FS) += \ os/linux/debug.o \ diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index d594c6311..9ce7fbb17 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -37,7 +37,8 @@ srcs += os/posix/nvgpu.c \ os/posix/stubs.c \ os/posix/posix-nvhost.c \ os/posix/posix-vgpu.c \ - os/posix/posix-dt.c + os/posix/posix-dt.c \ + os/posix/posix-vpr.c ifdef CONFIG_NVGPU_FECS_TRACE srcs += os/posix/fecs_trace_posix.c diff --git a/drivers/gpu/nvgpu/common/fifo/submit.c b/drivers/gpu/nvgpu/common/fifo/submit.c index 6a43fe799..258ae8048 100644 --- a/drivers/gpu/nvgpu/common/fifo/submit.c +++ b/drivers/gpu/nvgpu/common/fifo/submit.c @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef CONFIG_NVGPU_TRACE #include @@ -405,6 +406,7 @@ static int nvgpu_submit_channel_gpfifo(struct nvgpu_channel *c, * - pre- or post-fence functionality * - channel wdt * - GPU rail-gating with non-deterministic channels + * - VPR resize enabled with non-deterministic channels * - buffer refcounting * * If none of the conditions are met, then job tracking is not @@ -413,8 +415,9 @@ static int nvgpu_submit_channel_gpfifo(struct nvgpu_channel *c, */ need_job_tracking = (flag_fence_wait || flag_fence_get || - (nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) - && !c->deterministic) || + ((nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE) || + nvgpu_is_vpr_resize_enabled()) && + !c->deterministic) || !skip_buffer_refcounting); #ifdef CONFIG_NVGPU_CHANNEL_WDT diff --git a/drivers/gpu/nvgpu/include/nvgpu/vpr.h b/drivers/gpu/nvgpu/include/nvgpu/vpr.h new file mode 100644 index 000000000..19cdf89a7 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/vpr.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019, 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef NVGPU_VPR_H +#define NVGPU_VPR_H + +#include + +bool nvgpu_is_vpr_resize_enabled(void); + +#endif /* NVGPU_VPR_H */ \ No newline at end of file diff --git a/drivers/gpu/nvgpu/os/linux/vpr.c b/drivers/gpu/nvgpu/os/linux/vpr.c new file mode 100644 index 000000000..d51c42054 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/vpr.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2019, 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. + */ + +#include + +#include +#include + +bool nvgpu_is_vpr_resize_enabled(void) +{ + return tegra_is_vpr_resize_enabled(); +} diff --git a/drivers/gpu/nvgpu/os/posix/posix-vpr.c b/drivers/gpu/nvgpu/os/posix/posix-vpr.c new file mode 100644 index 000000000..309100db8 --- /dev/null +++ b/drivers/gpu/nvgpu/os/posix/posix-vpr.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019, 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. + */ + +#include + +bool nvgpu_is_vpr_resize_enabled(void) +{ + return false; +} \ No newline at end of file