Commit graph

44 commits

Author SHA1 Message Date
Ben Skeggs 6e32fedc8b drm/nouveau: will need to specify channel for vm-ful gpuobj allocations
Abuses existing gpuobj_new() chan argument for this, which in turn forces
all NVOBJ_FLAG_VM allocations to be done from the global heap, not
suballocated from the channel's private heap.  Not a problem though in
practise.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:18 +10:00
Ben Skeggs f8522fc80f drm/nvc0: fix suspend/resume of PGRAPH/PCOPYn
We need the physical VRAM address in vinst, even for objects mapped into
a vm, as the gpuobj suspend/resume code uses PMEM to access the object.

Previously, vinst was overloaded to mean "VRAM address" for !VM objects,
and "VM address" for VM objects, causing the wrong data to be accessed
during suspend/resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:33 +10:00
Ben Skeggs 04eb34a43c drm/nouveau: split ramin_lock into two locks, one hardirq safe
Fixes a possible lock ordering reversal between context_switch_lock
and ramin_lock.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2011-04-20 08:50:14 +10:00
Dave Airlie 38f1cff086 Merge commit '5359533801e3dd3abca5b7d3d985b0b33fd9fe8b' into drm-core-next
This commit changed an internal radeon structure, that meant a new driver
in -next had to be fixed up, merge in the commit and fix up the driver.

Also fixes a trivial nouveau merge.

Conflicts:
	drivers/gpu/drm/nouveau/nouveau_mem.c
2011-03-16 11:34:41 +10:00
Ben Skeggs 6f70a4c3d1 drm/nv50-nvc0: prevent multiple vm/bar flushes occuring simultanenously
The per-vm mutex doesn't prevent this completely, a flush coming from the
BAR VM could potentially happen at the same time as one for the channel
VM.  Not to mention that if/when we get per-client/channel VM, this will
happen far more frequently.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-03-08 07:03:08 +10:00
Ben Skeggs d5f423947a drm/nouveau: rename nouveau_vram to nouveau_mem
This structure will also be used for GART in the near future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:55 +10:00
Daniel Vetter 31a5b8ce8f drm/nouveau: don't munge in drm_mm internals
Nouveau was checking drm_mm internals on teardown to see whether the
memory manager was initialized. Hide these internals in a small
inline helper function.

Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:18:20 +10:00
Ben Skeggs c906ca0fbf drm/nvc0: enable protection of system-use-only structures in vm
Somehow missed this in the original merge of the nvc0 code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-01-17 11:28:50 +10:00
Ben Skeggs 3ee0128140 drm/nouveau: modify vm to accomodate dual page tables for nvc0
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-21 17:17:01 +10:00
Francisco Jerez c45aadabb9 drm/nv50: fix a couple of vm init issues
Fixes overwriting the first page table entry when testing that the PRAMIN
BAR can be correctly read/written, and adds an additional bar flush after
poking the BAR3 control regs.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-16 10:34:43 +10:00
Ben Skeggs 60d2a88ae8 drm/nouveau: kick vram functions out into an "engine"
NVC0 will be able to share some of nv50's paths this way.  This also makes
it the card-specific vram code responsible for deciding if a given set
of tile_flags is valid, rather than duplicating the allowed types in
nv50_vram.c and nouveau_gem.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:20 +10:00
Ben Skeggs 34cf01bc4b drm/nouveau: allow gpuobj vinst to be a virtual address when necessary
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:19 +10:00
Ben Skeggs b571fe21f5 drm/nv50: tidy up PCIEGART implementation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:17 +10:00
Ben Skeggs 4c13614298 drm/nv50: implement global channel address space on new VM code
As of this commit, it's guaranteed that if an object is in VRAM that its
GPU virtual address will be constant.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:13 +10:00
Ben Skeggs f869ef8823 drm/nv50: implement BAR1/BAR3 management on top of new VM code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:12 +10:00
Ben Skeggs a11c3198c9 drm/nv50: import new vm code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:10 +10:00
Ben Skeggs 573a2a37e8 drm/nv50: implement custom vram mm
This is required on nv50 as we need to be able to have more precise control
over physical VRAM allocations to avoid buffer corruption when using
buffers of mixed memory types.

This removes some nasty overallocation/alignment that we were previously
using to "control" this problem.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-08 13:48:07 +10:00
Ben Skeggs e41115d0ad drm/nouveau: rework gpu-specific instmem interfaces
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:11:48 +10:00
Ben Skeggs dc1e5c0dbf drm/nouveau: simplify gpuobj suspend/resume
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:11:47 +10:00
Ben Skeggs 9100468d1b drm/nouveau: pass gpuobj alignment request down into backing allocator
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:06:51 +10:00
Ben Skeggs cff5c13324 drm/nouveau: add more fine-grained locking to channel list + structures
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-12-03 15:05:18 +10:00
Ben Skeggs 56ac747535 drm/nv50: implement possible workaround for NV86 PGRAPH TLB flush hang
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-11-18 14:38:45 +10:00
Ben Skeggs d961db75ce drm/ttm: restructure to allow driver to plug in alternate memory manager
Nouveau will need this on GeForce 8 and up to account for the GPU
reordering physical VRAM for some memory types.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Thomas Hellström <thellstrom@vmware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-10-05 10:01:20 +10:00
Ben Skeggs 038b8b2a0d drm/nv50: flush bar1 vm / dma object setup before poking 0x1708
Should fix issues noticed on NVAC (MacBook Pro / ION) since gpuobj
rework.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:06 +10:00
Francisco Jerez 4b5c152a79 drm/nouveau: Remove implicit argument from nv_wait().
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:36 +10:00
Ben Skeggs e05c5a317e drm/nouveau: tidy ram{ht,fc,ro} a bit
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:22 +10:00
Ben Skeggs fbd2895e45 drm/nouveau: rework init ordering so nv50_instmem.c can be less bad
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:22:42 +10:00
Ben Skeggs 5125bfd886 drm/nv50: allow gpuobjs that aren't mapped into aperture
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:28 +10:00
Ben Skeggs 43efc9ce25 drm/nouveau: simplify fake gpu objects
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:23 +10:00
Ben Skeggs a8eaebc6c5 drm/nouveau: remove nouveau_gpuobj_ref completely, replace with sanity
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:14 +10:00
Ben Skeggs b3beb167af drm/nouveau: modify object accessors, offset in bytes rather than dwords
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:00 +10:00
Marcin Slusarz 615661f394 drm/nv50: initialize ramht_refs list for faked 0 channel
We need it for PFIFO_INTR_CACHE_ERROR interrupt handling,
because nouveau_fifo_swmthd looks for matching gpuobj in
ramht_refs list.
It fixes kernel panic in nouveau_gpuobj_ref_find.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-03 08:23:51 +10:00
Ben Skeggs 46d4cae200 drm/nv50-nvc0: ramht_size is meant to be in bytes, not entries
Fixes an infinite loop that can happen in RAMHT lookup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-17 11:59:24 +10:00
Ben Skeggs bf563a6b7c drm/nv50: correct wait condition for instmem flush
Reported-by: Marcin Koƛcielnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:52 +10:00
Ben Skeggs 734ee8357a drm/nv50: use correct PRAMIN flush register on original nv50
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:41:36 +10:00
Ben Skeggs 631872155f drm/nv50: move tlb flushing to a helper function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:41 +10:00
Ben Skeggs f56cb86f9a drm/nouveau: add instmem flush() hook
This removes the previous prepare_access() and finish_access() hooks, and
replaces it with a much simpler flush() hook.

All the chipset-specific code before nv50 has its use removed completely,
as it's not required there at all.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:40 +10:00
Ben Skeggs b833ac26f1 drm/nouveau: use drm_mm in preference to custom code doing the same thing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:12:51 +10:00
Jordan Crouse 01d73a6967 drm: Remove drm_resource wrappers
Remove the drm_resource wrappers and directly use the
actual PCI and/or platform functions in their place.

[airlied: fixup nouveau properly to build]

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-06-01 10:07:24 +10:00
Ben Skeggs 494ab824f1 drm/nv50: fix instmem init on IGPs if stolen mem crosses 4GiB mark
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-04-09 10:12:19 +10:00
Ben Skeggs a76fb4e8ff drm/nouveau: detect vram amount once, and save the value
As opposed to repeatedly reading the amount back from the GPU every
time we need to know the VRAM size.

We should now fail to load gracefully on detecting no VRAM, rather than
something potentially messy happening.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-04-09 10:12:02 +10:00
Matt Turner 3bfc7d22d0 drm/nouveau: use ALIGN instead of open coding it
CC: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:46 +10:00
Ben Skeggs 76befb8c30 drm/nv50: fix instmem binding on IGPs to point at stolen system memory
This also modifies the unused PRAMIN PT entries to be all zeroes, can't
really recall why I used 9/0 initially, just that it didn't work for
some reason.  It was likely masking a bug elsewhere that's since been
fixed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-23 13:50:21 +10:00
Ben Skeggs 6ee738610f drm/nouveau: Add DRM driver for NVIDIA GPUs
This adds a drm/kms staging non-API stable driver for GPUs from NVIDIA.

This driver is a KMS-based driver and requires a compatible nouveau
userspace libdrm and nouveau X.org driver.

This driver requires firmware files not available in this kernel tree,
interested parties can find them via the nouveau project git archive.

This driver is reverse engineered, and is in no way supported by nVidia.

Support for nearly the complete range of nvidia hw from nv04->g80 (nv50)
is available, and the kms driver should support driving nearly all
output types (displayport is under development still) along with supporting
suspend/resume.

This work is all from the upstream nouveau project found at
nouveau.freedesktop.org.

The original authors list from nouveau git tree is:
Anssi Hannula <anssi.hannula@iki.fi>
Ben Skeggs <bskeggs@redhat.com>
Francisco Jerez <currojerez@riseup.net>
Maarten Maathuis <madman2003@gmail.com>
Marcin Koƛcielnicki <koriakin@0x04.net>
Matthew Garrett <mjg@redhat.com>
Matt Parnell <mparnell@gmail.com>
Patrice Mandin <patmandin@gmail.com>
Pekka Paalanen <pq@iki.fi>
Xavier Chantry <shiningxc@gmail.com>
along with project founder Stephane Marchesin <marchesin@icps.u-strasbg.fr>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-11 21:29:34 +10:00