gpu: nvgpu: enable CONFIG_NVGPU_VPR for all kernels

VPR functionality is split up as static VPR and VPR resize. Static VPR
is supported on all kernels. VPR resize is enabled only on 4.9 kernel.

Enable CONFIG_NVGPU_VPR unconditionally in Linux Makefile. Compile
VPR resize related functionality in nvgpu under the check for
Linux kernel version using new define NVGPU_VPR_RESIZE_SUPPORTED.

JIRA LS-458
Bug 200754700

Change-Id: Ib92f7f1b95afc6c69fbdf33354459c147337350c
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2647619
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-12-29 14:57:02 +00:00
committed by mobile promotions
parent a47ce8eafe
commit a2f4fdf190
5 changed files with 36 additions and 11 deletions

View File

@@ -123,10 +123,7 @@ ifeq ($(CONFIG_TEGRA_GR_VIRTUALIZATION),y)
CONFIG_NVGPU_GR_VIRTUALIZATION := y CONFIG_NVGPU_GR_VIRTUALIZATION := y
endif endif
# Support for NVGPU VPR
ifeq ($(CONFIG_TEGRA_VPR),y)
CONFIG_NVGPU_VPR := y CONFIG_NVGPU_VPR := y
endif
# Support Tegra fuse # Support Tegra fuse
ifeq ($(CONFIG_TEGRA_KFUSE),y) ifeq ($(CONFIG_TEGRA_KFUSE),y)

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -25,6 +25,18 @@
#include <nvgpu/types.h> #include <nvgpu/types.h>
#ifdef __KERNEL__
#include <linux/version.h>
/*
* VPR resize is enabled only on 4.9 kernel because kernel core mm changes to
* support it are intrusive and they can't be upstreamed easily. Upstream
* kernel will have support for static VPR. Note that static VPR is
* supported on all kernels.
*/
#define NVGPU_VPR_RESIZE_SUPPORTED (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0))
#endif /* __KERNEL__ */
#ifdef CONFIG_NVGPU_VPR #ifdef CONFIG_NVGPU_VPR
bool nvgpu_is_vpr_resize_enabled(void); bool nvgpu_is_vpr_resize_enabled(void);
#else #else

View File

@@ -1,7 +1,7 @@
/* /*
* GK20A Graphics * GK20A Graphics
* *
* Copyright (c) 2011-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2011-2022, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -26,7 +26,10 @@
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#ifdef CONFIG_NVGPU_VPR
#include <nvgpu/vpr.h>
#if NVGPU_VPR_RESIZE_SUPPORTED
#include <linux/platform/tegra/common.h> #include <linux/platform/tegra/common.h>
#endif #endif
#include <linux/pci.h> #include <linux/pci.h>
@@ -1005,7 +1008,7 @@ void gk20a_remove_support(struct gk20a *g)
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
struct sim_nvgpu_linux *sim_linux; struct sim_nvgpu_linux *sim_linux;
#ifdef CONFIG_NVGPU_VPR #if NVGPU_VPR_RESIZE_SUPPORTED
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_VPR)) { if (nvgpu_is_enabled(g, NVGPU_SUPPORT_VPR)) {
tegra_unregister_idle_unidle(gk20a_do_idle); tegra_unregister_idle_unidle(gk20a_do_idle);
} }
@@ -1082,7 +1085,7 @@ static int gk20a_init_support(struct platform_device *pdev)
void __iomem *addr; void __iomem *addr;
int err = -ENOMEM; int err = -ENOMEM;
#ifdef CONFIG_NVGPU_VPR #if NVGPU_VPR_RESIZE_SUPPORTED
tegra_register_idle_unidle(gk20a_do_idle, gk20a_do_unidle, g); tegra_register_idle_unidle(gk20a_do_idle, gk20a_do_unidle, g);
#endif #endif

View File

@@ -1,7 +1,7 @@
/* /*
* GK20A Tegra Platform Interface * GK20A Tegra Platform Interface
* *
* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -21,10 +21,12 @@
#include <uapi/linux/nvgpu.h> #include <uapi/linux/nvgpu.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <nvgpu/vpr.h>
#if defined(CONFIG_TEGRA_DVFS) #if defined(CONFIG_TEGRA_DVFS)
#include <linux/tegra_soctherm.h> #include <linux/tegra_soctherm.h>
#endif #endif
#if defined(CONFIG_NVGPU_TEGRA_FUSE) || defined(CONFIG_NVGPU_VPR) #if defined(CONFIG_NVGPU_TEGRA_FUSE) || NVGPU_VPR_RESIZE_SUPPORTED
#include <linux/platform/tegra/common.h> #include <linux/platform/tegra/common.h>
#endif #endif
@@ -683,7 +685,9 @@ int gk20a_tegra_init_secure_alloc(struct gk20a_platform *platform)
* On simulation platform, VPR is only supported with * On simulation platform, VPR is only supported with
* vdk frontdoor boot and gpu frontdoor mode. * vdk frontdoor boot and gpu frontdoor mode.
*/ */
#if NVGPU_VPR_RESIZE_SUPPORTED
tegra_unregister_idle_unidle(gk20a_do_idle); tegra_unregister_idle_unidle(gk20a_do_idle);
#endif
nvgpu_log_info(g, nvgpu_log_info(g,
"VPR is not supported on simulation platform"); "VPR is not supported on simulation platform");
return 0; return 0;
@@ -700,7 +704,9 @@ int gk20a_tegra_init_secure_alloc(struct gk20a_platform *platform)
/* Some platforms disable VPR. In that case VPR allocations always /* Some platforms disable VPR. In that case VPR allocations always
* fail. Just disable VPR usage in nvgpu in that case. */ * fail. Just disable VPR usage in nvgpu in that case. */
if (dma_mapping_error(&tegra_vpr_dev, iova)) { if (dma_mapping_error(&tegra_vpr_dev, iova)) {
#if NVGPU_VPR_RESIZE_SUPPORTED
tegra_unregister_idle_unidle(gk20a_do_idle); tegra_unregister_idle_unidle(gk20a_do_idle);
#endif
return 0; return 0;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -14,9 +14,16 @@
#include <nvgpu/vpr.h> #include <nvgpu/vpr.h>
#include <linux/init.h> #include <linux/init.h>
#if NVGPU_VPR_RESIZE_SUPPORTED
#include <linux/platform/tegra/common.h> #include <linux/platform/tegra/common.h>
#endif
bool nvgpu_is_vpr_resize_enabled(void) bool nvgpu_is_vpr_resize_enabled(void)
{ {
#if NVGPU_VPR_RESIZE_SUPPORTED
return tegra_is_vpr_resize_enabled(); return tegra_is_vpr_resize_enabled();
#else
return false;
#endif
} }