summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* instmem/gk20a: use direct CPU accessAlexandre Courbot2015-09-111-19/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | The Great Nouveau Refactoring Take II brought us a lot of goodness, including acquire/release methods that are called before and after an instobj is modified. These functions can be used as synchronization points to manage CPU/GPU coherency if we modify an instobj using the CPU. This patch replaces the legacy and slow PRAMIN access for gk20a instmem with CPU mappings and writes. A LRU list is used to unmap unused mappings after a certain threshold (currently 1MB) of mapped instobjs is reached. This allows mappings to be reused most of the time. Accessing instobjs using the CPU requires to maintain the GPU L2 cache, which we do in the acquire/release functions. This triggers a lot of L2 flushes/invalidates, but most of them are performed on an empty cache (and thus return immediately), and overall context setup performance greatly benefits from this (from 250ms to 160ms on Jetson TK1 for a simple libdrm program). Making L2 management more explicit should allow us to grab some more performance in the future. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* tegra: merge platform setup from nouveau drmBen Skeggs2015-08-284-13/+194
| | | | | | | | The copyright header in nvkm/engine/device/platform.c has been replaced with the NVIDIA one from drm/nouveau_platform.c, as most of the actual code is now theirs. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* pci: merge agp handling from nouveau drmBen Skeggs2015-08-281-0/+54
| | | | | | | This commit reinstates the pre-DEVINIT AGP fiddling that was broken in an earlier commit. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* device: import pciid list and integrate quirks with itBen Skeggs2015-08-282-1/+3
| | | | | | PCI IDs taken from the NVIDIA binary driver, with permission. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* pmu: convert to new-style nvkm_subdevBen Skeggs2015-08-281-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* fifo: convert user classes to new-style nvkm_objectBen Skeggs2015-08-281-1/+45
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* imem: improve management of instance memoryBen Skeggs2015-08-281-0/+5
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* mmu: protect each vm with its own mutexBen Skeggs2015-08-281-1/+1
| | | | | | | | | | An upcoming commit requires being able to modify the PRAMIN BAR page tables while already holding the MMU subdev mutex. To solve this issue, each VM has been given its own mutex. As a nice side-effect, this also allows separate VMs to be updated concurrently. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* device: separate construction of pci/tegra devicesBen Skeggs2015-08-283-32/+47
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* subdev: implement support for new-style nvkm_subdevBen Skeggs2015-08-281-1/+4
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* nvif: replace path-based object identificationBen Skeggs2015-08-283-0/+115
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* device: simplify subdev constructionBen Skeggs2015-08-283-2/+11
| | | | | | | | | | | | | Replaces the piece-by-piece (in response to NV_DEVICE ctor args) device contruction with a once-off all-or-nothing approach, eliminating some tricky refcounting issues. The partial device init capability was only required by some tools, and has been moved to probe time instead. Temporarily removes a workaround for some boards where we need to fiddle with AGP registers before executing the DEVINIT scripts. A later commit in this series reinstates it. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* device: tidy ctor/dtor interfacesBen Skeggs2015-08-283-24/+31
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* client: tidy ctor/dtor interfacesBen Skeggs2015-08-282-10/+6
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* platform: remove subclassing of nvkm_deviceBen Skeggs2015-08-281-5/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* i2c: transition pad/ports away from being based on nvkm_objectBen Skeggs2015-08-281-1/+2
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* core: remove last printksBen Skeggs2015-08-282-2/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* sec: switch to subdev printk macrosBen Skeggs2015-08-281-1/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* core: type-safe printk macrosBen Skeggs2015-08-284-16/+15
| | | | | | | | | | | | | | | | These require an explicit pointers to nvkm_object/nvkm_subdev/nvkm_device, depending on which macros are used. This is unlike the previous macros which take a void *, and work for anything derived from nvkm_object (by way of some awful heuristics). The output will be a bit confused until everything has been transitioned, as the logging format used is a more standard style that previously. In addition, usage of pr_cont(), which doesn't work correctly with the dev_*() printk functions (and was potentially racy to begin with), will be replaced. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* tmr: type-safe PTIMER-based delay/wait macrosBen Skeggs2015-08-281-0/+5
| | | | | | | | | | | | These require an explicit struct nvkm_device pointer, unlike the previous macros which take a void *, and work for (almost) anything derived from nvkm_object by using some heuristics. These macros are more general than the previous ones, and can be used to handle PTIMER-based busy-waits (will be used in later devinit fixes) as well as more complicated wait conditions. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* lib: various tweaksBen Skeggs2015-08-288-131/+232
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* gr: use NVIDIA-provided external firmwaresAlexandre Courbot2015-08-281-0/+1
| | | | | | | | | NVIDIA will officially start providing GR firmwares through linux-firmware for GPUs that require it. Change the GR firmware lookup function to use these files. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm: move uapi so it gets picked before copy in linux treeBen Skeggs2015-03-171-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* platform: probe IOMMU if presentAlexandre Courbot2015-03-171-0/+32
| | | | | | | | | | | | Tegra SoCs have an IOMMU that can be used to present non-contiguous physical memory as contiguous to the GPU and maximize the use of large pages in the GPU MMU, leading to performance gains. This patch adds support for probing such a IOMMU if present and make its properties available in the nouveau_platform_gpu structure so subsystems can take advantage of it. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* instmem/gk20a: use DMA attributesAlexandre Courbot2015-03-171-0/+31
| | | | | | | | | | | instmem for GK20A is allocated using dma_alloc_coherent(), which provides us with a coherent CPU mapping that we never use because instmem objects are accessed through PRAMIN. Switch to dma_alloc_attrs() which gives us the option to dismiss that CPU mapping and free up some CPU virtual space. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* lib: fix drm backendBen Skeggs2015-03-171-1/+1
|
* drm: finalise nvkm namespace switch (no binary change)Ben Skeggs2015-01-194-26/+26
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* device: namespace + nvidia gpu names (no binary change)Ben Skeggs2015-01-192-4/+2
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* sec: namespace + nvidia gpu names (no binary change)Ben Skeggs2015-01-191-1/+1
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* gr: namespace + nvidia gpu names (no binary change)Ben Skeggs2015-01-191-10/+10
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* ce: namespace + nvidia gpu names (no binary change)Ben Skeggs2015-01-191-2/+2
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* pmu: namespace + nvidia gpu names (no binary change)Ben Skeggs2015-01-191-4/+4
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* core: namespace + nvidia gpu names (no binary change)Ben Skeggs2015-01-191-1/+0
| | | | | | | | | | | | | | | | The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* gr: rename from graph (no binary change)Ben Skeggs2015-01-191-12/+12
| | | | | | | | | | | | | | | | | | Shorter device name, match Tegra and our existing enums. The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* ce: rename from copy (no binary change)Ben Skeggs2015-01-191-2/+2
| | | | | | | | | | | | | | | | | | Switch to NVIDIA's name for the device. The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* sec: separate from cipher (formerly crypt)Ben Skeggs2015-01-191-2/+2
| | | | | | | | | | | | | | | | Switch to NVIDIA's name for the device. The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* pmu: rename from pwr (no binary change)Ben Skeggs2015-01-191-4/+4
| | | | | | | | | | | | | | | | | | Switch to NVIDIA's name for the device. The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm: remove symlinks from build, use Kbuild files for lib buildBen Skeggs2015-01-196-17/+84
| | | | | | | | | | | | | | | | | The DRM build used a separate, symlinked, source tree out of a desire to avoid Kbuild/autotools' object files conflicting. Not only is this very annoying to maintain, but it's made worse by having two entirely separate source file lists to maintain too. Fixes both these issues by ditching automake (it doesn't approve of the kernel's Kbuild syntax) in favour of custom makefiles that can build libnvif.so from the Kbuild files. Like the previous commit, this will never show up in the kernel tree (it has its own version). Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* lib: fix for spinlock changeBen Skeggs2015-01-101-0/+1
|
* volt: add support for GK20AVince Hsu2014-12-021-0/+31
| | | | | | | | | | The voltage value are calculated by the hardware characterized result. Signed-off-by: Vince Hsu <vinceh@nvidia.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Acked-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* lib: add null backendBen Skeggs2014-12-022-0/+136
| | | | | | | For the moment, just used to speed up vbios-only testing. Have some ideas for extending in the future. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm: introduce nv_device_is_cpu_coherent()Alexandre Courbot2014-12-021-0/+2
| | | | | | | | | | | | Add a function allowing us to know whether a device is CPU-coherent, i.e. accesses performed by the CPU on GPU-mapped buffers will be immediately visible on the GPU side and vice-versa. For now, a device is considered to be coherent if it uses the PCI bus on a non-ARM architecture. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* bios: split out shadow methodsBen Skeggs2014-12-021-0/+4
| | | | | | | | | | | We're about to need to be able to fetch additional chunks of data beyond the primary bios image, which makes fetching a lot more complicated. This splits out the verious shadowing routines to be nothing more than very dumb "fetch this much data from this offset" routines, and leaves the logic of what and how much to fetch in common code. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* fb/ram/gk104-: perform certain steps only when bios data differsBen Skeggs2014-10-021-2/+3
| | | | | | | Awful, awful. But, on the GK106 I have, some upcoming patches show that this is actually necessary after all. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm: expose the full object/event interfaces to userspaceBen Skeggs2014-08-102-3/+223
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* nvif: import library functions for the ioctl/event interfacesBen Skeggs2014-08-104-132/+87
| | | | | | | | | | | | This is a wrapper around the interfaces defined in an earlier commit, and is also used by various userspace (either by a libdrm backend, or libpciaccess) tools/tests. In the future this will be extended to handle channels, replacing some long-unloved code we currently use, and allow fifo/display/mpeg (hi Ilia ;)) engines to all be exposed in the same way. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* lib: silence some issues reported by valgrindBen Skeggs2014-08-103-24/+29
|
* device: add method to retrieve some basic device infoBen Skeggs2014-08-101-0/+6
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* core: rework event interfaceBen Skeggs2014-08-101-1/+24
| | | | | | | | | | | | | | | This is a lot of prep-work for being able to send event notifications back to userspace. Events now contain data, rather than a "something just happened" signal. Handler data is now embedded into a containing structure, rather than being kmalloc()'d, and can optionally have the notify routine handled in a workqueue. Various races between suspend/unload with display HPD/DP IRQ handlers automagically solved as a result. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* gk20a: reclocking supportAlexandre Courbot2014-08-101-0/+26
| | | | | | | | | Add support for reclocking on GK20A, using a statically-defined pstates table. The algorithms for calculating the coefficients and setting the clocks are directly taken from the ChromeOS kernel. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>