summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_ttm.c
Commit message (Collapse)AuthorAgeFilesLines
* drm/nouveau/drm/ttm: Remove set but not used variable 'mem'YueHaibing2020-01-151-4/+0
| | | | | | | | | | | | | drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_vram_manager_new: drivers/gpu/drm/nouveau/nouveau_ttm.c:66:22: warning: variable mem set but not used [-Wunused-but-set-variable] drivers/gpu/drm/nouveau/nouveau_ttm.c: In function nouveau_gart_manager_new: drivers/gpu/drm/nouveau/nouveau_ttm.c:106:22: warning: variable mem set but not used [-Wunused-but-set-variable] They are not used any more, so remove it. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: switch to gem vma offset managerGerd Hoffmann2019-09-111-1/+1
| | | | | | | | | | Pass gem vma_offset_manager to ttm_bo_device_init(), so ttm uses it instead of its own embedded struct. This makes some gem functions (specifically drm_gem_object_lookup) work on ttm objects. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-3-kraxel@redhat.com
* drm/ttm: turn ttm_bo_device.vma_manager into a pointerGerd Hoffmann2019-09-111-0/+1
| | | | | | | | | | | | | | | | Rename the embedded struct vma_offset_manager, new name is _vma_manager. ttm_bo_device.vma_manager changed to a pointer. The ttm_bo_device_init() function gets an additional vma_manager argument which allows to initialize ttm with a different vma manager. When passing NULL the embedded _vma_manager is used. All callers are updated to pass NULL, so the behavior doesn't change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Christian König <christian.koenig@amd.com> Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-2-kraxel@redhat.com
* drm/ttm: Quick-test mmap offset in ttm_bo_mmap()Thomas Zimmermann2019-03-191-3/+0
| | | | | | | | | | | A BO's address has to be at least the minimum offset. Sharing this test in ttm_bo_mmap() removes code from drivers. A full buffer-address validation is still done within drm_vma_offset_lockup_locked(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init()Thomas Zimmermann2019-03-191-1/+0
| | | | | | | | | | The parameter file_page_offset is a constant shared by all drivers. Just replace it with the constant itself. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/ttm: initialize globals during device init (v2)Christian König2018-11-051-39/+0
| | | | | | | | | | | | Make sure that the global BO state is always correctly initialized. This allows removing all the device code to initialize it. v2: fix up vbox (Alex) Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/ttm: use a static ttm_mem_global instanceChristian König2018-11-051-31/+3
| | | | | | | | | | | As the name says we only need one global instance of ttm_mem_global. Drop all the driver initialization and just use a single exported instance which is initialized during BO global initialization. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/ttm: Rename ttm_bo_global_{init,release}() to ttm_bo_global_ref_{,}()Thomas Zimmermann2018-11-051-2/+2
| | | | | | | | | | | The functions ttm_bo_global_init() and ttm_bo_global_release() do not receive an argument of type struct ttm_bo_global. Both take a struct drm_global_reference that contains points to a struct ttm_bo_global_ref. Renaming them reflects this. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/noveau: add SPDX identifier and clarify licenseDirk Hohndel (VMware)2018-06-291-2/+1
| | | | | | | | | This is dual licensed under GPL-2.0 or MIT. Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Dirk Hohndel (VMware) <dirk@hohndel.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180506231626.115996-5-dirk@hohndel.org
* drm/nouveau/ttm: don't dereference nvbo::cli, it can outlive clientBen Skeggs2018-05-101-3/+3
| | | | | | | Potentially responsible for some random OOPSes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Cc: stable@vger.kernel.org [v4.15+]
* drm/nouveau: use alternate memory type for system-memory buffers with kind != 0Ben Skeggs2017-12-191-10/+29
| | | | | | | | | | | | Fixes bug on Tegra where we'd strip kind information from system memory (ie. all) buffers, resulting in misrendering. Behaviour on dGPU should be unchanged. Reported-by: Thierry Reding <treding@nvidia.com> Fixes: d7722134b8 ("drm/nouveau: switch over to new memory and vmm interfaces") Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Tested-by: Thierry Reding <treding@nvidia.com>
* drm/nouveau: switch over to new memory and vmm interfacesBen Skeggs2017-11-021-15/+3
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: switch to vmm limitBen Skeggs2017-11-021-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: fetch memory type indices that we care about for ttmBen Skeggs2017-11-021-1/+29
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: consolidate handling of dma maskBen Skeggs2017-11-021-30/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: allocate vram with nvkm_ram_get()Ben Skeggs2017-11-021-4/+2
| | | | | | | | | | | | This will cause a subtle behaviour change on GPUs that are in mixed-memory configurations in that VRAM in the degraded section of VRAM will no longer be used for TTM buffer objects. That section of VRAM is not meant to be used for displayable/compressed surfaces, and we have no reliable way with the current interfaces to be able to make that decision properly. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: separate buffer object backing memory from nvkm structuresBen Skeggs2017-11-021-96/+47
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: consolidate identical functions in nouveau_ttm.cBen Skeggs2017-11-021-46/+17
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: remove unnecessary use of ttm_mem_type_manager::privBen Skeggs2017-11-021-13/+3
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: split various bo flags out into their own membersBen Skeggs2017-11-021-8/+6
| | | | | | It's far more convenient to deal with like this. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/mmu/nv04-nv4x: move global vmm to nvkm_mmuBen Skeggs2017-11-021-4/+1
| | | | | | In a future commit, this will be constructed by common code. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: fix handling of GART OOM on pre-NV50 chipsetsBen Skeggs2017-11-021-0/+4
| | | | | | | | The correct thing to do on OOM is to return 0 and set mm_node to NULL, otherwise TTM will assume some other kind of error, and not attempt to evict other buffers to make space. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/ttm: make ttm_mem_type_manager_func debug more usefulChristian König2017-08-171-2/+4
| | | | | | | | Provide the drm printer directly instead of just the callback. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/nouveau: fix include notation and remove -Iinclude/drm flagMasahiro Yamada2017-05-171-1/+1
| | | | | | | | | Include <drm/*.h> instead of relative path from include/drm, then remove the -Iinclude/drm compiler flag. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1493009447-31524-12-git-send-email-yamada.masahiro@socionext.com
* drm/nouveau: s/mem/reg/ for struct ttm_mem_reg variablesBen Skeggs2017-02-171-24/+24
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: allocate device object for every clientBen Skeggs2017-02-171-14/+14
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: use designated initializersKees Cook2016-12-181-14/+14
| | | | | | | | | | | Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161217010442.GA140619@beast
* drm/drivers: add support for using the arch wc mapping API.Dave Airlie2016-10-261-0/+8
| | | | | | | | | | | This fixes a regression in all these drivers since the cache mode tracking was fixed for mixed mappings. It uses the new arch API to add the VRAM range to the PAT mapping tracking tables. Fixes: 87744ab3832 (mm: fix cache mode tracking in vm_insert_mixed()) Reviewed-by: Christian König <christian.koenig@amd.com>. Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/nouveau/core: recognise GP100 chipsetBen Skeggs2016-07-141-0/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: rename nouveau_drm.h to nouveau_drv.hBen Skeggs2016-05-201-1/+1
| | | | | | | Fixes out-of-tree build issue where uapi/drm/nouveau_drm.h gets picked up instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* nouveau: don't call pci_dma_supportedChristoph Hellwig2015-11-101-2/+5
| | | | | | | | | | | | | | | Just try to set a 64-bit DMA mask first and retry with the smaller dma_mask if dma_set_mask failed. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: David Airlie <airlied@linux.ie> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Alexandre Courbot <acourbot@nvidia.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Thierry Reding <treding@nvidia.com> Cc: Dave Airlie <airlied@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* drm/nouveau/ttm: set the DMA mask for platform devicesAlexandre Courbot2015-11-031-6/+19
| | | | | | | | | | So far the DMA mask was not set for platform devices, which limited them to a 32-bit physical space. Allow dma_set_mask() to be called for non-PCI devices, and also take the IOMMU bit into account since it could restrict the physically addressable space. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/ttm: convert to DMA APIAlexandre Courbot2015-11-031-7/+5
| | | | | | | | The pci_dma_* functions are now superseeded in the kernel by the DMA API. Make the conversion to this more generic API. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/pci: merge agp handling from nouveau drmBen Skeggs2015-08-281-2/+10
| | | | | | | This commit reinstates the pre-DEVINIT AGP fiddling that was broken in an earlier commit. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/device: remove pci/platform_device from common structBen Skeggs2015-08-281-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/device: cleaner abstraction for device resource functionsBen Skeggs2015-08-281-2/+3
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/fb: transition nvkm_ram away from being based on nvkm_objectBen Skeggs2015-08-281-33/+6
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/mmu: cosmetic changesBen Skeggs2015-08-281-1/+1
| | | | | | | This is purely preparation for upcoming commits, there should be no code changes here. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/fb: cosmetic changesBen Skeggs2015-08-281-10/+10
| | | | | | | This is purely preparation for upcoming commits, there should be no code changes here. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* Merge tag 'v4.2-rc7' into drm-nextDave Airlie2015-08-171-0/+9
|\ | | | | | | | | | | Linux 4.2-rc7 Backmerge master for i915 fixes
| * drm/nouveau/nouveau/ttm: fix tiled system memory with MaxwellAlexandre Courbot2015-07-281-0/+9
| | | | | | | | | | | | | | | | | | | | | | Add Maxwell to the switch statement that sets node->memtype, otherwise all tiling information is ignored for buffers in system memory. While we are at it, make that switch statement explicitly complain the next time we meet a non-handled card family. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* | drm/nouveau: Don't take dev->struct_mutex in ttm_finiDaniel Vetter2015-08-111-2/+0
|/ | | | | | | | | This is only called in driver load/unload paths, no need to grab any locks at all. Also, ttm takes care of itself anyway. Cc: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
* make RAM device optionalAlexandre Courbot2015-04-141-0/+3
| | | | | | | | | | | | | | | Having a RAM device does not make sense for chips like GK20A which have no dedicated video memory. The dummy RAM device that we used so far works as a temporary band-aid, but in the longer term it is desirable for the driver to be able to work without any kind of VRAM. This patch adds a few conditionals in places where a RAM device was assumed to be present and allows some more objects to be allocated from the TT domain, allowing Nouveau to handle GPUs for which pfb->ram == NULL. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: finalise nvkm namespace switch (no binary change)Ben Skeggs2015-01-221-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>
* drm/nouveau/nvif: namespace of nvkm accessors (no binary change)Ben Skeggs2015-01-221-9/+9
| | | | | | | | | | NVKM is having it's namespace switched to nvkm_, which will conflict with these functions (which are workarounds for the fact that as of yet, we still aren't able to split DRM and NVKM completely). A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau/mmu: rename from vmmgr (no binary change)Ben Skeggs2015-01-221-5/+5
| | | | | | | | | | | | | | | | | | 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/nouveau: remove symlinks, move core/ to nvkm/ (no code changes)Ben Skeggs2015-01-221-1/+1
| | | | | | | | | | | | The symlinks were annoying some people, and they're not used anywhere else in the kernel tree. The include directory structure has been changed so that symlinks aren't needed anymore. NVKM has been moved from core/ to nvkm/ to make it more obvious as to what the directory is for, and as some minor prep for when NVKM gets split out into its own module (virt) at a later date. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* nouveau: bring back legacy mmap handlerDave Airlie2014-12-231-1/+2
| | | | | | | | | | | | | | | nouveau userspace back at 1.0.1 used to call the X server DRIOpenDRMMaster interface even for DRI2 (doh!), this attempts to map the sarea and fails if it can't. Since 884c6dabb0eafe7227f099c9e78e514191efaf13 from Daniel, this fails, but only ancient drivers would see it. Revert the nouveau bits of that fix. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: <stable@vger.kernel.org> # 3.18 Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/<ttm-based-drivers>: Don't call drm_mmapDaniel Vetter2014-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | Really, the legacy buffer api should be dead, especially for all these newfangled drivers. I suspect this is copypasta from the transitioning days, which probably originated in radeon. Cc: "Christian König" <christian.koenig@amd.com> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Rashika <rashika.kheria@gmail.com> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Fabian Frederick <fabf@skynet.be> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Alexandre Courbot <acourbot@nvidia.com> Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com> Cc: Christian Engelmayer <cengelma@gmx.at> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Ben Skeggs <bskeggs@redhat.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/ttm: move fpfn and lpfn into each placement v2Christian König2014-08-271-6/+3
| | | | | | | | | This allows us to more fine grained specify where to place the buffer object. v2: rebased on drm-next, add bochs changes as well Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>