History log of /drivers/gpu/drm/nouveau/nouveau_mem.c
Revision Date Author Comments
e6084257d07fffc394ac6e4cf4496c946fd904ed 07-Feb-2012 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: several fixes for nvc0 memory timings

This patch fixes two small issues in timing generation as spotted on
several NVCx cards.

In addition, the header of the file is updated to also contain (some of)
the current developers of this code.

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
070be296b65d120c2fef58a5435f159ae32c4995 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/mem: handle dll_off for ddr2/ddr3

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
b830973b68895813b911fb04626d907744e7d7a2 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: fix dll off -> dll on transitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
a9bc247cbbc6310d2aefe4db0a6e92defde4426b 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: detect when we need dll disabled for gddr3

Fixes minor flickering on NVS295 when at perflvl 0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
1a7287ea6f37c930a092123f6584b0b24cfe2d13 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: track mr2 for gddr3

There's some "extended" GDDR3 chipsets out there with EMRS2 settings that
change the layout of MRS/EMRS1 bitmaps.. Sigh.. Still need to track down
how exactly we're supposed to handle this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
2d85bc8855d2734f5585861b261c5fe7a7ed92c1 23-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: introduce ram reclocking helper

This will probably result in more lines of code, however, we're going to
have at least 3 slightly different implementations of this very soon and
I'd rather keep the ram reclocking logic separate from the hw specifics.

DDR2/DDR3/GDDR3 implemented thus far, others will be added as necessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
085028ce3bf7136c5ab2eeb8bf012024d88905c8 18-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: embed timings into perflvl structs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
fd99fd6100d3b7aaa8dc76888a38bbb15e8041bc 17-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: calculate memory timings at perflvl creation time

Statically generating the PFB register and MR values for each timing set
turns out to be insufficient. There's at least one (so far) known piece
of information which effects MR values which is stored in the perflvl
entry on some chipsets (and in another table on later ones), which is
disconnected from the timing table entries.

After this change we will generate a timing set based on an input clock
frequency instead, and have this data stored in the performance level
data.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
c7c039fd31be82ecb8d48477955e76badd38141a 09-Jan-2012 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: implement DDR2/DDR3/GDDR3/GDDR5 MR generation and validation

Roy Spliet:
- Implement according to specs
- Simplify
- Make array for mc latency registers

Martin Peres:
- squash and split all the commits from Roy
- rework following Ben Skeggs comments
- add a form of timings validation
- store the initial timings for later use

Ben Skeggs
- merge slightly modified tidy-up patch with this one
- remove perflvl-dropping logic for the moment

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
bfb314652430ceca302bae0981d00903f055eee4 25-Nov-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: improve memory timing generation

- Rename several VBIOS entries to closer match the real world
- Add the missing 0x100238 and 0x100240 register values
- Parse bit 14 of the VBIOS timing table
- "Magic value" -> tCWL, fixing some minor bugs in the process
- Also name a few more by their name rather than their number.
- Some values seem to be dependent on the memory type. Fix

Edits by Martin Peres <martin.peres@labri.fr>:
- this is a squash commit
- reworked for fixing some style issues

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ddb2005516949dc50d117cb8381d7a3f8f0614b0 17-Dec-2011 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau/pm: style fixes

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c70c41e89f0481f26749d8264aebc594566c2a6d 13-Dec-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50: hopefully handle the DDR2/DDR3 memtype detection somewhat better

M version 2 appears to have a table with some form of memory type info
available.

NVIDIA appear to ignore the table information except for this DDR2/DDR3
case (which has the same value in 0x100714). My guess is this is due to
some of the supported memory types not being represented in the table.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7ad2d31cb692597f7918fce2f52a4c1949fbcf8d 10-Dec-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: move vram detection funcs to chipset-specific fb code

Also, display detected memory type in logs - though, we don't even try to
detect this yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f9f9f536312d4c3ca39502ccf6a3af60cfe38ff4 12-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/bios: pass drm_device to ROMPTR, rather than nvbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3230cfc34fca9d17c1628cf0e4ac25199592a69a 17-Oct-2011 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> drm/nouveau: enable the ttm dma pool when swiotlb is active V3

If the card is capable of more than 32-bit, then use the default
TTM page pool code which allocates from anywhere in the memory.

Note: If the 'ttm.no_dma' parameter is set, the override is ignored
and the default TTM pool is used.

V2 use pci_set_consistent_dma_mask
V3 Rebase on top of no memory account changes (where/when is my
delorean when i need it ?)

CC: Ben Skeggs <bskeggs@redhat.com>
CC: Francisco Jerez <currojerez@riseup.net>
CC: Dave Airlie <airlied@redhat.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2228c6fe04ddc303e90c05dd9430539fbcd8fa18 14-Jul-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: Document and expose CL and WR for 0x1002Cx

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
9a7824887690836448eb73ccf0d8232da2e5bee3 09-Jul-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: add initial NV3x/NVCx memtiming support, improve other cards

NV30: Create framework for memtm
NV50: Improve reg creation,
NV50: Use P.version instead of card codename/stepping,
NVC0: Initial memtiming code for Fermi,
Renamed regs for consistency,
Overall redesign to improve readability,
Avoid kfree on null-pointer

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
048a88595a66526f68636b51b1cdb5842bc0f28c 04-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: make general drm modesetting init common

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
58b6542b50ded4243c26c251c0507e5f658642f6 27-Jun-2011 Jon Mason <jdmason@kudzu.us> DRM: remove drm_pci_device_is_pcie

drm_pci_device_is_pcie duplicates the funcationality of pci_is_pcie.
Convert callers of the former to the latter. This has the side benefit
of removing an unnecessary search in the PCI configuration space due to
using a saved PCIe capability offset.

[airlied: update for new callsite]

Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Dave Airlie <airlied@redhat.com>
3b40d07d8c4a9dc33ee6e1b4ad1d377309531ffe 24-Jun-2011 Younes Manton <younes.m@gmail.com> drm/nouveau: Calculate reserved VRAM for PRAMIN value before use.

'drm/nouveau: rework vram init/fini ordering a little' changed
the order of instmem.init() and nouveau_mem_vram_init() which
resulted in using ramin_rsvd_vram before it was calculated and
failing to init any accel on pre-NV50 cards.

Since it's only used on <NV50 just calculate it where it's needed
and leave it as default 0 for NV50.

Signed-off-by: Younes Manton <younes.m@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0de53a546b4f7056d1404e40320e57aad723621c 23-Jun-2011 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: fix nouveau_mem object leak

It's a regression from "drm/nouveau: create temp vmas for both src and
dst of bo moves".

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
24f246ac10ae6a6ae873045387d4501498869f74 10-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: rework vram init/fini ordering a little

Commit "drm/nouveau: add some debug output if nouveau_mm busy at destroy time"
revealed an issue where vram mm takedown would actually fail due to there
still being nodes present, causing nouveau to leak a small amount of memory
on module unload.

This splits TTM/nouveau_mm a bit more cleanly and ensures nouveau_mm fini
isn't done until all gpuobjs are also destroyed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7375c95b343aa575940704a38482a334ea87ac6c 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove 'chan' argument from nouveau_bo_new

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d2f96666c56a501c5b74c645d81918b7805d46ce 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: create temp vmas for both src and dst of bo moves

Greatly simplifies a number of things, particularly once per-client GPU
address spaces are involved.

May add this back later once I know what things'll look like.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f91bac5bf694e8060b7473fb0aefb8de09aa9595 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: store bo's page size in nouveau_bo

Was previously assuming a page size of 4KiB unless a VMA was present to
override it. Eventually, a buffer won't necessarily have a VMA at all at
some stages of its life, so we need to store this info elsewhere.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4cff3ce5fe5c3c88f103d58c5e7855f9519960e4 01-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40: fall back to paged dma object for the moment

PCI(E)GART isn't quite stable it seems, fall back to old method until I get
the time to sort it out properly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
960bdba08e06a1f35fc2fe784aa293dee58abc68 30-May-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix leak of gart mm node

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e614b2e7ca9f9946cede13b34c950b92af6fa7ef 14-Apr-2011 Martin Peres <martin.peres@free.fr> drm/nouveau: Associate memtimings with performance levels on cards <= nv98

v2 (Ben Skeggs): fix ramcfg strap, and remove bogus handling of perf 0x40

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
976661093dab143f164b81f15133724fa2a4bb86 17-Apr-2011 Jimmy Rentz <jb17bsome@gmail.com> drm/nouveau: Fix a crash at card takedown for NV40 and older cards

NV40 and older cards (pre NV50) reserve a vram bo for the vga memory at
card init. This bo is then freed at card shutdown. The problem is that
the ttm bo vram manager was already freed. So a crash occurs when the
vga bo is freed. The fix is to free the vga bo prior to freeing the ttm
bo vram manager. There might be other solutions but this seemed the
simplest to me.

Signed-off-by: Jimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
96c50082904c7cefa3b01356f62268ee6d9e9f38 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: move set_tile_region to nouveau_exec_engine

In the very least VPE (PMPEG and friends) also has this style of tile
region regs, lets make them just work if/when they get added.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
50066f8117d79163b96d3bf778c41961be1fe5cd 27-Mar-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau: improve memtiming table parsing

Improves the parsing of the memory timing table on NV50-NV98revA1 chipsets.

Added stepping to drm_nouveau_private to make sure newer NV98 (105M) is
zero rather than incorrect.

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0b89a072f942412c45d00f74e7e789e019e5de2c 20-Mar-2011 Emil Velikov <emil.l.velikov@gmail.com> drm/nouveau: Fix missing whitespace checkpatch.pl errors.

This patch fixes messages such as
ERROR: space required after that ','
ERROR: spaces required around that '='

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
71298e2f0b6fb6dce9f2b2e999652edf1f643d9e 20-Mar-2011 Emil Velikov <emil.l.velikov@gmail.com> drm/nouveau: Fix indentation-related checkpatch.pl error messages.

Fix 'ERROR: code indent should use tabs where possible'
Fix 'ERROR: space required before the open parenthesis ('

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
7a7b94ad8ce3e24d4dd97b45583911e0f03aecd6 17-Apr-2011 Jimmy Rentz <jb17bsome@gmail.com> drm/nouveau: Fix a crash at card takedown for NV40 and older cards

NV40 and older cards (pre NV50) reserve a vram bo for the vga memory at
card init. This bo is then freed at card shutdown. The problem is that
the ttm bo vram manager was already freed. So a crash occurs when the
vga bo is freed. The fix is to free the vga bo prior to freeing the ttm
bo vram manager. There might be other solutions but this seemed the
simplest to me.

Signed-off-by: Jimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
01d153326ecd81ed77395f1699a30af416cf77ab 08-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix nv30 pcie boards

Wasn't aware they even existed, apparently they do! They're actually
AGP chips with a bridge as far as I can tell, which puts them in the
same boat as nv40/nv45.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ac5c15fa585a89bcebca92dfdbb862dd507534fc 09-Feb-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau: correct memtiming table parsing for nv4x

In line with envytools, verified on 4 or 5 BIOS'es.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
459ca7e5283914845d7139905ff58824d2b0cc85 08-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40: attempt to reserve just enough vram for all 32 channels

This also makes the fact we're giving 512MiB of GART space to all PCIE
boards explicit, although the vast majority (if not all) of them will
now have a ramin_rsvd_vram larger than 2MiB anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ef1b287169cd3d1e428c8ed8222e0bbf733d5dbb 07-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix regression causing ttm to not be able to evict vram

TTM assumes an error condition from man->func->get_node() means that
something went horribly wrong, and causes it to bail.

The driver is supposed to return 0, and leave mm_node == NULL to
signal that it couldn't allocate any memory.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8f7286f8e4e80f7b868ba3d117ae900f0d207cbe 14-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50: support for compression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
26c0c9e33a2eb44b345d22d5928d5c8b7b261226 09-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0: delay GART binding until move_notify time

The immediate benefit of doing this is that on NV50 and up, the GPU
virtual address of any buffer is now constant, regardless of what
memtype they're placed in.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d5f423947a11103c43ad26ebb680d049c2d8edd6 09-Feb-2011 Ben Skeggs <bskeggs@redhat.com> 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>
3425df486ca247d9e8487be06a6cd0763ba38180 10-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0: unmap buffers from the vm when they're evicted

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d550c41e4ff11fe69b5f92868157253d27937d1f 15-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove no_vm/mappable flags from nouveau_bo

'mappable' isn't really used at all, nor is it necessary anymore as the
bo code is capable of moving buffers to mappable vram as required.

'no_vm' isn't necessary anymore either, any places that don't want to be
mapped into a GPU address space should allocate the VRAM directly instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e0435120a8e91990e995ffacb109f82cd44fdfc1 11-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40: support for 39-bit dma addresses on native PCIE chipsets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a2c06ee2fe5b48a71e697bae00c6e7195fc016b6 23-Feb-2011 Dave Airlie <airlied@redhat.com> Revert "ttm: Include the 'struct dev' when using the DMA API."

This reverts commit 5a893fc28f0393adb7c885a871b8c59e623fd528.

This causes a use after free in the ttm free alloc pages path,
when it tries to get the be after the be has been destroyed.

Signed-off-by: Dave Airlie <airlied@redhat.com>
5a893fc28f0393adb7c885a871b8c59e623fd528 22-Feb-2011 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> ttm: Include the 'struct dev' when using the DMA API.

This makes the accounting when using 'debug_dma_dump_mappings()'
and CONFIG_DMA_API_DEBUG=y be assigned to the correct device
instead of 'fallback'.

No functional change - just cosmetic.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
8410ea3b95d105a5be5db501656f44bbb91197c1 14-Dec-2010 Dave Airlie <airlied@gmail.com> drm: rework PCI/platform driver interface.

This abstracts the pci/platform interface out a step further,
we can go further but this is far enough for now to allow USB
to be plugged in.

The drivers now just call the init code directly for their
device type.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8b464bfed674fc25d39d8a686010ebe509c8f62a 14-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: greatly simplify mm, killing some bugs in the process

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8984e046153eb1d6b0b24626169f9c6e58232e1b 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: initial vm implementation, use for bar1/bar3 management

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4c74eb7ff276813ee73943a3756b295675fb2865 10-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: import initial vm backend

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
60d2a88ae896ae51c76f8b15c2f4b762d5b00864 06-Dec-2010 Ben Skeggs <bskeggs@redhat.com> 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>
5f6fdca570b13a8a2c9cab9ab6edfc17487049cf 12-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: enable non-contig vram allocations where requested

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
bfd83aca5a1c4cc07fb18d96ed8660f2c338a8f3 12-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: enable 4KiB pages for small vram allocations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4c1361429841344ce4d164492ee7620cf3286eb7 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com> 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>
a11c3198c9ba38d81e25b65e3908d531feba1372 27-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: import new vm code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
573a2a37e8648a3249426c816f51e7ef50f6f73e 25-Aug-2010 Ben Skeggs <bskeggs@redhat.com> 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>
a5cf68b04b2b8ea716cf6fd8499c1c54d05fdf5e 24-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Rework tile region handling.

The point is to share more code between the PFB/PGRAPH tile region
hooks, and give the hardware specific functions a chance to allocate
per-region resources.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
382d62e524db528cdf53563ad9a018adc170dfde 20-Oct-2010 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: fix annoying nouveau_fence type issue

nouveau_fence_* functions are not type safe, which could lead to bugs.
Additionally every use of nouveau_fence_unref had to cast struct
nouveau_fence to void **.
Fix it by renaming old functions and creating static inline functions with
new prototypes. We still need old functions, because we pass function
pointers to ttm.
As we are wrapping functions, drop unused "void *arg" parameter where possible.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cac8f05b4294d18cfa940511c286ca03aa6590ad 20-Oct-2010 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: improve memtiming mappings

Improvements:
- Fix bug in switch statement
- Add parts of 0x10022c, 0x10023c
- Clean up 0x100234
- Comment out assumption in 0x100228 until verified

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
56ac7475350ee646f5f7316abcdf65d3be94da1c 22-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: implement possible workaround for NV86 PGRAPH TLB flush hang

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cbab95db84f2a444d99bec77bac8b9b6ef20d11c 11-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Some random cleanups.

Remove some unused/duplicated definitions and make sparse happy again.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a845fff841b13678b2d80f10425aba87db840e4a 04-Oct-2010 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau: fix thinkos in mem timing table recordlen check

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7760fcb020b41352af4e675ce65a6aa0e93c170f 17-Sep-2010 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau: Import initial memory timing work

This isn't correct everywhere yet, but since we don't use the data yet
it's perfectly safe to push in, and the information we gain from logs
will help to fix the remaining issues.

v2 (Ben Skeggs <bskeggs@redhat.com>):
- fixed up formatting
- free parsed timing info on takedown
- switched timing table printout to debug loglevel

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9f56b1265d66f6698e3155529e6c5d0c34b37afa 07-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Simplify tile region handling.

Instead of emptying the caches to avoid a race with the PFIFO puller,
go straight ahead and try to recover from it when it happens. Also,
kill pfifo->cache_flush and tile->lock, we don't need them anymore.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
de5899bdaccaabfaab894559a7eec3302ae88b52 08-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add module parameter to override the default AGP rate.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
71d0618661f9dd531caa94ce2ce5dc919321624b 08-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Don't enable AGP FW on nv18.

FW seems to be broken on nv18, it causes random lockups and breaks
suspend/resume even with the blob.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fbd2895e45aebdb3d3ea73a3a796cf3bb9c912da 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> 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>
6c3d7ef25e3b4a0ea511b1e9d4a0a212750874a6 11-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: calculate vram reordering block size

Will be used at a later point when we plug in an alternative VRAM memory
manager for GeForce 8+ boards.

Based on pscnv code to do the same.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Koƛcielnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b3beb167af0de6d7cb03aed0687eca645cfd06a6 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> 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>
316f60a120a8f1dacb574f705d5faf7eac3e6e2a 26-Aug-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Fix suspend on some nv4x AGP cards.

On some nv4x cards (specifically, the ones that use an internal
PCIE->AGP bridge) the AGP controller state isn't preserved after a
suspend/resume cycle, and the AGP control registers have moved from
0x18xx to 0x100xx, so the FW check in nouveau_mem_reset_agp() doesn't
quite work. Check "dev->agp->mode" instead.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c556d989038a6eba1411acf39163eb660e0a13bc 04-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: implement memory detection

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2b495268fc596fd474d2a2cbbc711d8bb1e11e88 30-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Fix AGP reset when AGP FW is already enabled on init.

Previously nouveau_mem_reset_agp() was only disabling AGP fast writes
when coming back from suspend. However, the "locked out of the card
because of FW" problem can also be reproduced on init if you
unload/reload nouveau.ko several times. This patch makes the AGP code
reset FW on init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0d3470d218949dc1307313647c70154c7452a68b 02-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove unused ttm bo list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e04d8e829d7807e132d8c82c3554b164a803c617 23-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Reset AGP before running the init scripts.

BIOS scripts usually make an attempt to reset the AGP controller,
however on some nv4x cards doing it properly involves switching FW off
and on: if we do that without updating the AGP bridge settings
accordingly (e.g. with the corresponding calls to agp_enable()) we
will be locking ourselves out of the card MMIO space. Do it from
nouveau_mem_reset_agp() before the init scripts are executed.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3c7066bca990a440b512663f89680bd1c1cae6c1 13-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add some PFB register defines.

Also collect all the PFB registers in a single place and remove some
duplicated definitions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
baf8035edb5d8285cbf0bf2d1895b0a787501f8f 09-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix mtrr cleanup path

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
631872155f35b907ae3950016d9e72a308449d69 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: move tlb flushing to a helper function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f56cb86f9abd229418f894a8ffedfb9ff465c181 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> 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>
6e86e0419471d11ed3d4d46039ee90e8cb85806c 03-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Fix a couple of sparse warnings.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7a2e4e03b77b929b10f3007395128a9870090653 02-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: fix memory detection for cards with >=4GiB VRAM

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fb4f56214dd632d90b8ac64d7781faeb4dd744c7 02-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: missed some braces

Luckily this had absolutely no effect whatsoever :)

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cd0b072f95b3dbee5d7b97f52edc40f00d5d28e1 01-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove left-over !DRIVER_MODESET paths

It's far preferable to have the driver do nothing at all for "nomodeset".

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b833ac26f1f1c8e8d9149d83dbdd91432f2807d5 01-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: use drm_mm in preference to custom code doing the same thing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
01d73a6967f12fe6c4bbde1834a9fe662264a2eb 27-May-2010 Jordan Crouse <jcrouse@codeaurora.org> 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>
8b281db596744a15b2abbfdbf655796c64e172ca 31-May-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: cast IGP memory location to u64 before shifting

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a76fb4e8ffe42144529e21fe1e609b762e8eb5cc 18-Mar-2010 Ben Skeggs <bskeggs@redhat.com> 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>
40b2a687bd92827ca144d3623cf48377d8f7680d 15-Mar-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: add more 0x100c80 flushy magic

Fixes the !vbo_fifo path in the 3D driver on certain chipsets. Still not
really any good idea of what exactly the magic achieves, but it makes
things work.

While we're at it, in the PCIEGART path, flush on unbinding also.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6c42966768b0254f465a8f451333795283f53d22 19-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: fix vram ptes on IGPs to point at stolen system memory

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
531e77139f26e8da32ee694b9ee5e6f4c764f1db 11-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: improve vram page table construction

This commit changes nouveau to construct PTEs which look very much like
the ones the binary driver creates.

I presume that filling multiple PTEs identically with length flags and
the physical address of the start of a block of VRAM is a hint to the
memory controller that it need not perform additional page table lookups
for that range of addresses.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4c27bd339d226175ac0e4dc3ab8289ba696db8be 11-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: more efficient clearing of gpu page table entries

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
66b6ebaccb176a2068bbe328f162614dce524621 11-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: make nv50_mem_vm_{bind,unbind} operate only on vram

GART is handled elsewhere, no reason to have the code for it here too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
71666475018a3024fb49499096d26a9350349e8b 16-Jan-2010 Luca Barbieri <luca@luca-barbieri.com> drm/nouveau: Evict buffers in VRAM before freeing sgdma

Currently, we take down the sgdma engine without evicting all buffers
from VRAM.

The TTM device release will try to evict anything in VRAM to GART
memory, but this will fail since sgdma has already been taken down.

This causes an infinite loop in kernel mode on module unload.
It usually doesn't happen because there aren't any buffer on close.
However, if the GPU is locked up, this condition is easily triggered.

This patch fixes it in the simplest way possible by cleaning VRAM
right before cleaning SGDMA memory.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ac8fb975e8c88d312a376b035494be17548d01c6 15-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: reserve VGA area for the moment

This is to prevent things such as GART tables and other important GPU
structures being allocated there before we take over fbcon ourselves.

This is more of a workaround for the moment, a better solution will
require some more invasive changes, but it'll be done at some point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
77cb5c75e89ccfeb993d9dec37f8edb3a855e9f4 13-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove PRIV0 check in nouveau_mem_close()

We don't setup PRIV0 anymore, so this is unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
287c1532145b63d394060d46c0309b123b862345 11-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Make the MM aware of pre-G80 tiling.

This commit has also the following 3 bugfix commits squashed into it from
the nouveau git tree:

drm/nouveau: Fix up the tiling alignment restrictions for nv1x.
drm/nouveau: Fix up the nv2x tiling alignment restrictions.
drm/nv50: fix align typo for g9x

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
a0af9add499cf29a16707b7b148842992077f4cb 11-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Make the MM aware of pre-G80 tiling.

This commit has also the following 3 bugfix commits squashed into it from
the nouveau git tree:

drm/nouveau: Fix up the tiling alignment restrictions for nv1x.
drm/nouveau: Fix up the nv2x tiling alignment restrictions.
drm/nv50: fix align typo for g9x

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
b694dfb25a8de4ffbc14c9092ab8f88344ca86b1 15-Dec-2009 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix build with CONFIG_AGP=n

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6ee738610f41b59733f63718f0bdbcba7d3a3f12 11-Dec-2009 Ben Skeggs <bskeggs@redhat.com> 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>