Files
linux-nvgpu/drivers/gpu/nvgpu/Kconfig
Debarshi Dutta 86b31c4f7c gpu: nvgpu: alternative implementation of dma_buf_get/set_data
Historically, nvgpu has supported a struct gk20a_dmabuf_priv and
associated it with a dmabuf instance. This was aided by Nvmap's
dma_buf_set_drv_data() and dma_buf_get_drvdata() APIs. gk20a_dmabuf_priv
is used to store Comptag IDs i.e. (1 per 64 kb) as well as can store the
dmabuf attachments to avoid multiple attach/detach calls. dma_buf_set_drv_data()
allows Nvgpu to associate an instance of struct gk20a_dmabuf_priv with the instance
of the dmabuf and also provide a release callback to delete the
instance when the last reference to the dmabuf is put. Nvmap accomplishes
this by modifying the struct dma_buf_ops definition to include the
set_drv_data and get_drv_data callbacks in the kernel code.

The above approach won't work for upstream Kstable and Nvmap
plans to remove these APIs for upcoming newer downstream kernels as
well.

In order to implement the same functionality without depending on Nvmap,
Nvgpu will implement a release chaining mechanism. Dmabuf's 'ops' pointer
points to a constant struct and hence a whole copy of the ops is made
followed by altering the new copy's release pointer.

struct gk20a_dmabuf_priv stores the new copy and the dmabuf's 'ops' is
changed to point to this. This allows Nvgpu to retrieve
the corresponding gk20a_dmabuf_priv instance using container_of.

Nvgpu's custom release callback will invoke the original release
callback of the dmabuf's producer as a last step, thus completing the
full circle. In case, the driver is removed, Nvgpu restores the
dmabuf's 'ops' back to the original state. In order to accomplish this,
every instance of a struct nvgpu_os_linux maintains a linkedlist of the
gk20a_dma_buf instances. During the driver removal, this linkedlist is
traversed and the corresponding dmabuf's 'ops' pointer is put back to
its original state followed by freeing of this instance.

Nvgpu is a producer of dmabuf's for vidmem and needs
a way to check whether the given dmabuf belongs to itself.
Its no longer reliable to depend on a comparision of
the 'ops' pointer. Instead dmabuf_export_info() allows a name to be set by the
exporter and this can be used to compare with a memory location
that belongs to Nvgpu. Similarly for sysmem dmabufs, Nvmap makes a
similar change in the way it identifies whether a dmabuf belongs to
itself.

Removed NVGPU_DMABUF_HAS_DRVDATA and moved to a unified mechanism for
both downstream as well as upstream kernel.

Some of the other changes in this file include the following.
1) Deletion of dmabuf.c and moving its contents over to dmabuf_priv.c
2) Replacing gk20a_mm_pin_has_drvdata with nvgpu_mm_pin_privdata and
vice-versa for unpin.

Bug 2878569

Change-Id: Icf8e79b05a25ad5a85f478c3ee0fc1eb7747e22d
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2341001
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Puneet Saxena <puneets@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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2020-12-15 14:13:28 -06:00

261 lines
6.3 KiB
Plaintext

config GK20A
tristate "Nvidia GK20A GPU support"
default n
help
Choose this option if you have an SoC with integrated
Nvidia GPU IP.
config GK20A_PMU
bool "Support GK20A PMU"
depends on GK20A
default n
help
Say Y here to enable GK20A PMU features.
choice
depends on GK20A
prompt "Enable GK20A frequency scaling"
default GK20A_DEVFREQ
optional
help
Select this entry to enable gk20a scaling
config GK20A_DEVFREQ
depends on COMMON_CLK && PM_DEVFREQ
bool "Use Devfreq"
help
Select this to use devfreq based scaling.
Devfreq is a common framework that allows using
variety of different governors and changing
between governors on the fly. By default, no
governor is selected.
endchoice
config GK20A_PM_QOS
depends on GK20A_DEVFREQ
bool "Use PM_QOS constraints for devfreq based scaling"
default y
help
Enable support to pass PM_QOS constraints to devfreq based
scaling.
config NVGPU_TRACK_MEM_USAGE
bool "Track the usage of system memory in nvgpu"
depends on GK20A
default n
help
Say Y here to allow nvgpu to track and keep statistics on
the system memory used by the driver. This does recreate
some of the kmem_leak tracking but this is also applicable
to other OSes which do not have Linux' kmem_leak.
config NVGPU_CYCLESTATS
bool "Support GPU CYCLE STATS"
depends on GK20A
default y
help
Say Y here to enable the cycle stats debugging features.
config NVGPU_FECS_TRACE
bool "Support NVGPU FECS Context Switch tracing"
depends on GK20A
default y
help
Enable support for the NVGPU Context Switch Tracing. In this mode,
FECS collects timestamps for contexts loaded on GR engine. This
allows tracking context switches on GR engine, as well as
identifying processes that submitted work.
config TEGRA_GK20A_NVHOST
bool "Support interfacing with nvhost hardware"
depends on TEGRA_GRHOST || TEGRA_HOST1X
depends on GK20A
default y
help
Enable support in GK20A for the nvhost (host1x) dma engine hardware
that includes things like hardware syncpts. This requires either
TEGRA_GRHOST or TEGRA_HOST1X.
config TEGRA_GK20A
bool "Enable the GK20A GPU on Tegra"
depends on GK20A
default y
help
Enable support for the GK20A graphics engine on Tegra
by adding a Tegra platfrom interface to the GK20A driver.
config TEGRA_ACR
bool "Enable HS bin support on GM20B GPU on Tegra"
depends on GK20A && GK20A_PMU
default n
help
Enable Support for Loading High Secure binary, and using
Write Protected Regions (WPR) for storing ucodes, and bootstrap
PMU, FECS and GPCCS in Low Secure mode.
config TEGRA_USE_NA_GPCPLL
bool "Enable noise aware mode of GM20B GPCPLL on Tegra"
depends on GK20A
depends on COMMON_CLK
default n
help
Enable noise aware (NA) mode of GM20b GPCPLL. In this mode PLL output
frequency is automatically adjusted when GM20b voltage is fluctuating
because of transient PMIC or power distribution tree noise.
config GK20A_PCI
bool "Support PCIe NVIDIA GPUs on nvgpu"
depends on PCI && GK20A
default y
help
Enable support for GPUs on PCIe bus.
config GK20A_TRACE_PRINTK
bool "Support trace_printk debugging"
depends on GK20A && TRACING
default n
help
Enable nvgpu debug facility to redirect debug spew to ftrace. This
affects kernel memory use, so should not be enabled by default.
config NVGPU_USE_TEGRA_ALLOC_FD
bool "Use tegra_alloc_fd() for allocating dma_buf fds for vidmem"
depends on GK20A
depends on NV_TEGRA_MC
default y
help
Use tegra_alloc_fd() for allocating dma_buf fds. This allocates
the fds above 1024 which exempts them from counting against process
fd limit.
It is only available in Tegra kernel.
config NVGPU_SUPPORT_TURING
bool "Turing family GPU"
depends on GK20A && ARCH_TEGRA_19x_SOC
default y
help
Support for NVIDIA Turing family of GPU
config NVGPU_DEBUGGER
bool "Support debugger APIs"
depends on GK20A
default y
help
Support for debugger APIs
config NVGPU_LS_PMU
bool "LS PMU support"
depends on GK20A
default y
help
Support for iGPU LS PMU enable/disable
config NVGPU_LOGGING
bool "NVGPU logging"
depends on GK20A
default y
help
Enable/Disable NVGPU logging
config NVGPU_HAL_NON_FUSA
bool "Support non-functionally safe HALs"
depends on GK20A
default y
help
Enable/Disable the support of HALs from chips that do not have functional
safety certification
config NVGPU_RECOVERY
bool "Recovery support"
depends on GK20A
default y
help
Support recovery on failure (which may involve engine reset)
config NVGPU_NVLINK
bool "Nvlink support"
depends on TEGRA_NVLINK
default y
help
Support Nvlink
config NVGPU_GR_VIRTUALIZATION
bool "NVGPU Virtualization Support"
depends on TEGRA_GR_VIRTUALIZATION
default y
help
Support NVGPU Virtualization
config NVGPU_COMPRESSION
bool "Compression support"
depends on GK20A
default y
help
Support for compression
config NVGPU_SUPPORT_CDE
bool "Support extraction of comptags for CDE"
depends on GK20A
depends on NVGPU_COMPRESSION
default n
help
Enable support for extraction of comptags for CDE.
config NVGPU_DGPU
bool "NVGPU DGPU support"
depends on GK20A
depends on GK20A_PCI
default y
help
Support for NVGPU DGPU
config NVGPU_VPR
bool "NVGPU VPR support"
depends on GK20A
default y
help
Support for NVGPU VPR
config NVGPU_TEGRA_FUSE
bool "Tegra fuse Support"
depends on GK20A
default y
help
Support Tegra fuse
choice
prompt "Supported sync fence backend"
default NVGPU_SYNCFD_ANDROID
depends on GK20A
help
GPU job synchronization (fences before and after submits) can use raw
syncpoints if available and sync fds if chosen. Without syncpoints,
nvgpu also provides semaphore-backed sync fds to userspace.
Select which kernel-provided API is used for sync fds. Matching
support is required for the userspace drivers too.
config NVGPU_SYNCFD_STABLE
bool "Upstream stabilized SYNC_FILE"
depends on SYNC_FILE
help
Select CONFIG_SYNC_FILE, the cross-driver "Explicit Synchronization
Framework" stabilized upstream from the Android sync since v4.9.
config NVGPU_SYNCFD_ANDROID
bool "Android SYNC"
depends on SYNC
help
Select CONFIG_SYNC, the legacy synchronization framework provided by
Android (and deprecated in Linux 4.9+ in favor of dma fences and the
stabilized SYNC_FILE).
config NVGPU_SYNCFD_NONE
bool "Nothing"
help
Do not build in support for sync fences.
endchoice