History log of /linux-master/drivers/gpu/drm/nouveau/nouveau_drv.h
Revision Date Author Comments
# 9a0c32d6 01-Feb-2024 Danilo Krummrich <dakr@redhat.com>

drm/nouveau: don't fini scheduler if not initialized

nouveau_abi16_ioctl_channel_alloc() and nouveau_cli_init() simply call
their corresponding *_fini() counterpart. This can lead to
nouveau_sched_fini() being called without struct nouveau_sched ever
being initialized in the first place.

Instead of embedding struct nouveau_sched into struct nouveau_cli and
struct nouveau_chan_abi16, allocate struct nouveau_sched separately,
such that we can check for the corresponding pointer to be NULL in the
particular *_fini() functions.

It makes sense to allocate struct nouveau_sched separately anyway, since
in a subsequent commit we can also avoid to allocate a struct
nouveau_sched in nouveau_abi16_ioctl_channel_alloc() at all, if the
VM_BIND uAPI has been disabled due to the legacy uAPI being used.

Fixes: 5f03a507b29e ("drm/nouveau: implement 1:1 scheduler - entity relationship")
Reported-by: Timur Tabi <ttabi@nvidia.com>
Tested-by: Timur Tabi <ttabi@nvidia.com>
Closes: https://lore.kernel.org/nouveau/20240131213917.1545604-1-ttabi@nvidia.com/
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240202000606.3526-1-dakr@redhat.com


# 5f03a507 13-Nov-2023 Danilo Krummrich <dakr@redhat.com>

drm/nouveau: implement 1:1 scheduler - entity relationship

Recent patches to the DRM scheduler [1][2] allow for a variable number
of run-queues and add support for (shared) workqueues rather than
dedicated kthreads per scheduler. This allows us to create a 1:1
relationship between a GPU scheduler and a scheduler entity, in order to
properly support firmware schedulers being able to handle an arbitrary
amount of dynamically allocated command ring buffers. This perfectly
matches Nouveau's needs, hence make use of it.

Topology wise we create one scheduler instance per client (handling
VM_BIND jobs) and one scheduler instance per channel (handling EXEC
jobs).

All channel scheduler instances share a workqueue, but every client
scheduler instance has a dedicated workqueue. The latter is required to
ensure that for VM_BIND job's free_job() work and run_job() work can
always run concurrently and hence, free_job() work can never stall
run_job() work. For EXEC jobs we don't have this requirement, since EXEC
job's free_job() does not require to take any locks which indirectly or
directly are held for allocations elsewhere.

[1] https://lore.kernel.org/all/8f53f7ef-7621-4f0b-bdef-d8d20bc497ff@redhat.com/T/
[2] https://lore.kernel.org/all/20231031032439.1558703-1-matthew.brost@intel.com/T/

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231114002728.3491-1-dakr@redhat.com


# 266f7618 07-Nov-2023 Danilo Krummrich <dakr@redhat.com>

drm/nouveau: separately allocate struct nouveau_uvmm

Allocate struct nouveau_uvmm separately in preparation for subsequent
commits introducing reference counting for struct drm_gpuvm.

While at it, get rid of nouveau_uvmm_init() as indirection of
nouveau_uvmm_ioctl_vm_init() and perform some minor cleanups.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231108001259.15123-9-dakr@redhat.com


# 68132cc6 10-Aug-2023 Dave Airlie <airlied@redhat.com>

nouveau/u_memcpya: use vmemdup_user

I think there are limit checks in place for most things but the
new uAPI wants to not have them.

Add a limit check and use the vmemdup_user helper instead.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230810185020.231135-1-airlied@gmail.com


# c5f93623 15-Sep-2023 Dan Carpenter <dan.carpenter@linaro.org>

nouveau/u_memcpya: fix NULL vs error pointer bug

The u_memcpya() function is supposed to return error pointers on
error. Returning NULL will lead to an Oops.

Fixes: e3885f712134 ("nouveau/u_memcpya: use vmemdup_user")
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/10fd258b-466f-4c5b-9d48-fe61a3f21424@moroto.mountain


# e3885f71 10-Aug-2023 Dave Airlie <airlied@redhat.com>

nouveau/u_memcpya: use vmemdup_user

I think there are limit checks in place for most things but the
new uAPI wants to not have them.

Add a limit check and use the vmemdup_user helper instead.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230810185020.231135-1-airlied@gmail.com


# b88baab8 04-Aug-2023 Danilo Krummrich <dakr@redhat.com>

drm/nouveau: implement new VM_BIND uAPI

This commit provides the implementation for the new uapi motivated by the
Vulkan API. It allows user mode drivers (UMDs) to:

1) Initialize a GPU virtual address (VA) space via the new
DRM_IOCTL_NOUVEAU_VM_INIT ioctl for UMDs to specify the portion of VA
space managed by the kernel and userspace, respectively.

2) Allocate and free a VA space region as well as bind and unbind memory
to the GPUs VA space via the new DRM_IOCTL_NOUVEAU_VM_BIND ioctl.
UMDs can request the named operations to be processed either
synchronously or asynchronously. It supports DRM syncobjs
(incl. timelines) as synchronization mechanism. The management of the
GPU VA mappings is implemented with the DRM GPU VA manager.

3) Execute push buffers with the new DRM_IOCTL_NOUVEAU_EXEC ioctl. The
execution happens asynchronously. It supports DRM syncobj (incl.
timelines) as synchronization mechanism. DRM GEM object locking is
handled with drm_exec.

Both, DRM_IOCTL_NOUVEAU_VM_BIND and DRM_IOCTL_NOUVEAU_EXEC, use the DRM
GPU scheduler for the asynchronous paths.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230804182406.5222-12-dakr@redhat.com


# fbc0ced4 04-Aug-2023 Danilo Krummrich <dakr@redhat.com>

drm/nouveau: move usercopy helpers to nouveau_drv.h

Move the usercopy helpers to a common driver header file to make it
usable for the new API added in subsequent commits.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230804182406.5222-7-dakr@redhat.com


# 7b05a7c0 04-Aug-2023 Danilo Krummrich <dakr@redhat.com>

drm/nouveau: get vmm via nouveau_cli_vmm()

Provide a getter function for the client's current vmm context. Since
we'll add a new (u)vmm context for UMD bindings in subsequent commits,
this will keep the code clean.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230804182406.5222-5-dakr@redhat.com


# a3185f91 09-May-2022 Christian König <christian.koenig@amd.com>

drm/ttm: merge ttm_bo_api.h and ttm_bo_driver.h v2

Merge and cleanup the two headers into a single description of the
object API. Also move all the documentation to the implementation and
drop unnecessary includes from the header.

No functional change.

v2: minimal checkpatch.pl cleanup

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221125102137.1801-4-christian.koenig@amd.com


# eb39c613 01-Jun-2022 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fifo: expose per-runlist CHID information

DRM uses this to setup fence-related items.

- nouveau_chan.runlist will always be "0" for the moment, not an issue
as GPUs prior to ampere have system-wide channel IDs,

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>


# 4a16dd9d 01-Jun-2022 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/kms: switch to drm fbdev helpers

This removes support for accelerated fbcon rendering, and fixes a number
of races/crashes/issues around suspend/resume/module unload etc.

Losing HW accelerated rendering isn't ideal, but it's been significantly
reduced in performance since the removal of accelerated scrolling in the
kernel anyway - not to mention, can be racey (skips cpu<->gpu sync) from
certain contexts.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 99d0701a 01-Jun-2022 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/nvkm: rip out old notify

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>


# d62f8e98 01-Jun-2022 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/kms: switch hpd_lock from mutex to spinlock

There's no good reason for this to be a mutex, and once the layers of
workqueues have been untangled, nouveau_connector_hpd() can be called
from IRQ context and won't be able to take a mutex.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>


# c4feba47 01-Jun-2022 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/nvkm: rip out event uapi

Userspace never ended up using this to be clever about dealing with
channel death, and it won't be, not like this anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# abae9164 25-Nov-2020 Jeremy Cline <jcline@redhat.com>

drm/nouveau: Add a dedicated mutex for the clients list

Rather than protecting the nouveau_drm clients list with the lock within
the "client" nouveau_cli, add a dedicated lock to serialize access to
the list. This is both clearer and necessary to avoid lockdep being
upset with us when we need to iterate through all the clients in the
list and potentially lock their mutex, which is the same class as the
lock protecting the entire list.

Cc: stable@vger.kernel.org # 5.4+
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201125202648.5220-3-jcline@redhat.com
Link: https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests/14


# f07069da 17-Nov-2020 Christian König <christian.koenig@amd.com>

drm/ttm: move memory accounting into vmwgfx v4

This is just another feature which is only used by VMWGFX, so move
it into the driver instead.

I've tried to add the accounting sysfs file to the kobject of the drm
minor, but I'm not 100% sure if this works as expected.

v2: fix typo in KFD and avoid 64bit divide
v3: fix init order in VMWGFX
v4: use pdev sysfs reference instead of drm

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Zack Rusin <zackr@vmware.com> (v3)
Tested-by: Nirmoy Das <nirmoy.das@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210208133226.36955-2-christian.koenig@amd.com


# 8af8a109 01-Oct-2020 Christian König <christian.koenig@amd.com>

drm/ttm: device naming cleanup

Rename ttm_bo_device to ttm_device.
Rename ttm_bo_driver to ttm_device_funcs.
Rename ttm_bo_global to ttm_global.

Move global and device related functions to ttm_device.[ch].

No functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/415222/


# 9125e242 13-Nov-2020 Lyude Paul <lyude@redhat.com>

drm/nouveau/kms/nv50-: Fix locking for audio callbacks

Noticed that I wasn't paying close enough attention the last time I looked
at our audio callbacks, as I completely missed the fact that we were
figuring out which audio-enabled connector goes to each encoder by checking
it's state, but without grabbing any of the appropriate modesetting locks
to do so.

That being said however: trying to grab modesetting locks in our audio
callbacks would be very painful due to the potential for locking inversion
between HDA and DRM. So, let's instead just copy what i915 does again - add
our own audio lock to protect audio related state, and store each audio
enabled connector in each nouveau_encoder struct so that we don't need to
check any atomic states.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5cf82904 17-Nov-2020 Christian König <christian.koenig@amd.com>

drm/ttm/drivers: remove unecessary ttm_module.h include v2

ttm_module.h deals with internals of TTM and should never
be include outside of it.

v2: also move the file around

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/404885/


# 461619f5 24-Oct-2020 Christian König <christian.koenig@amd.com>

drm/nouveau: switch to new allocator

It should be able to handle all cases now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com>
Tested-by: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.freedesktop.org/patch/397082/?series=83051&rev=1


# 141b15e5 21-Aug-2020 Christian König <christian.koenig@amd.com>

drm/nouveau: move io_reserve_lru handling into the driver v5

While working on TTM cleanups I've found that the io_reserve_lru used by
Nouveau is actually not working at all.

In general we should remove driver specific handling from the memory
management, so this patch moves the io_reserve_lru handling into Nouveau
instead.

v2: don't call ttm_bo_unmap_virtual in nouveau_ttm_io_mem_reserve
v3: rebased and use both base and offset in the check
v4: fix small typos and test the patch
v5: rebased and keep the mem.bus init in TTM.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/388643/


# d297ce4b 26-Aug-2020 Lyude Paul <lyude@redhat.com>

drm/nouveau/kms: Only use hpd_work for reprobing in HPD paths

Currently we perform both short IRQ handling for DP, and connector
reprobing in the HPD IRQ handler. However since we need to grab
connection_mutex in order to reprobe a connector, in theory we could
accidentally block ourselves from handling any short IRQs until after a
modeset completes if a connector hotplug happens to occur in parallel
with a modeset.

I haven't seen this actually happen yet, but since we're cleaning up
nouveau's hotplug handling code anyway and we already have a hpd worker,
we can simply fix this by only relying on the HPD worker to actually
reprobe connectors when we receive a HPD IRQ. We also add a mask to
nouveau_drm to keep track of which connectors are waiting to be reprobed
in response to an HPD IRQ.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200826182456.322681-13-lyude@redhat.com


# 2966141a 03-Aug-2020 Dave Airlie <airlied@redhat.com>

drm/ttm: rename ttm_mem_reg to ttm_resource.

This name better reflects what the object does. I didn't rename
all the pointers it seemed too messy.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-60-airlied@gmail.com


# 2bf00037 22-Jun-2020 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/kms/nv04-: no need for multiple nvsw objects

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>


# 3e176fd0 29-Jun-2020 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/nvif: add support for object-level debug output

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>


# 434fdb51 24-Mar-2020 Karol Herbst <kherbst@redhat.com>

drm/nouveau: workaround runpm fail by disabling PCI power management on certain intel bridges

Fixes the infamous 'runtime PM' bug many users are facing on Laptops with
Nvidia Pascal GPUs by skipping said PCI power state changes on the GPU.

Depending on the used kernel there might be messages like those in demsg:

"nouveau 0000:01:00.0: Refused to change power state, currently in D3"
"nouveau 0000:01:00.0: can't change power state from D3cold to D0 (config
space inaccessible)"
followed by backtraces of kernel crashes or timeouts within nouveau.

It's still unkown why this issue exists, but this is a reliable workaround
and solves a very annoying issue for user having to choose between a
crashing kernel or higher power consumption of their Laptops.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Mika Westerberg <mika.westerberg@intel.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205623
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 742db30c 13-Jan-2020 Takashi Iwai <tiwai@suse.de>

drm/nouveau: Add HD-audio component notifier support

This patch adds the support for the notification of HD-audio hotplug
via the already existing drm_audio_component framework. This allows
us more reliable hotplug notification and ELD transfer without
accessing HD-audio bus; it's more efficient, and more importantly, it
works without waking up the runtime PM.

The implementation is rather simplistic: nouveau driver provides the
get_eld ops for HD-audio, and it notifies the audio hotplug via
pin_eld_notify callback upon each nv50_audio_enable() and _disable()
call. As the HD-audio pin assignment seems corresponding to the CRTC,
the crtc->index number is passed directly as the zero-based port
number.

The bind and unbind callbacks handle the device-link so that it
assures the PM call order.

Link: https://lore.kernel.org/r/20190722143815.7339-3-tiwai@suse.de
Reviewed-by: Lyude Paul <lyude@redhat.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4f632fb2 27-Oct-2019 Jani Nikula <jani.nikula@intel.com>

drm/nouveau: use drm_debug_enabled() to check for debug categories

Allow better abstraction of the drm_debug global variable in the
future. No functional changes.

v2: move unlikely() to drm_debug_enabled()

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/34a1e7db6eab6467c6607d9a57581d1de75d87da.1572258936.git.jani.nikula@intel.com


# ed22eb56 07-Aug-2019 Lyude Paul <lyude@redhat.com>

drm/nouveau/dispnv50: Fix runtime PM ref tracking for non-blocking modesets

This is something that got noticed a while ago back when I was fixing a
large number of runtime PM related issues in nouveau, but never got
fixed:

https://patchwork.freedesktop.org/series/46815/#rev7

It's not safe to iterate the entire list of CRTCs in
nv50_disp_atomic_commit(), as we could be doing a non-blocking modeset
on one CRTC in parallel with one or more other CRTCs. Likewise, this
means it's also not safe to do so in order to track runtime PM state.
While this code is certainly wrong, so far the only issues I've seen
this cause in the wild is the occasional PM ref unbalance after an
atomic check failure + module reloading (since the PCI device will
outlive nouveau in such scenarios).

So, do this far more elegantly: grab a runtime PM ref across the modeset
and commit tail, then grab/put references for each CRTC enable/disable.
This also ends up being much simpler then the previous broken solution
we had.

Finally, since we've removed all it's users: get rid of
nouveau_drm->have_disp_power_ref.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# eb3f4cfa 26-May-2019 Hariprasad Kelam <hariprasad.kelam@gmail.com>

drm/nouveau: fix nvif/device.h is included more than once

remove duplicate inclusion of nvif/device.h

Issue identified by includecheck

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c587cd6f 19-May-2019 Sam Ravnborg <sam@ravnborg.org>

drm/nouveau: drop drmP.h from nouveau_drv.h

Drop the deprecated drmP.h header from nouveau_drv.h.
Fix fallout in other parts of the driver.

Build tested using allmodconfig and allyesconfig.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b7019ac5 19-Jun-2019 Ilia Mirkin <imirkin@alum.mit.edu>

drm/nouveau: fix bogus GPL-2 license header

The bulk SPDX addition made all these files into GPL-2.0 licensed files.
However the remainder of the project is MIT-licensed, these files
(primarily header files) were simply missing the boiler plate and got
caught up in the global update.

Fixes: b24413180f5 (License cleanup: add SPDX GPL-2.0 license identifier to files with no license)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# aa8e2435 07-Feb-2019 Thomas Zimmermann <tzimmermann@suse.de>

drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same
value. The only exception is vboxvideo, which is being converted to the
new offset by this patch. Unifying the constants in a single place
simplifies the driver code.

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>


# 5be73b69 26-Jul-2018 Jérôme Glisse <jglisse@redhat.com>

drm/nouveau/dmem: device memory helpers for SVM

Device memory can be use in SVM, in which case we do not have any of
the existing buffer object. This commit add infrastructure to allow
use of device memory without nouveau_bo. Again this is a temporary
solution until a rework of GPU memory management.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>


# eeaf06ac 04-Jul-2018 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/svm: initial support for shared virtual memory

This uses HMM to mirror a process' CPU page tables into a channel's page
tables, and keep them synchronised so that both the CPU and GPU are able
to access the same memory at the same virtual address.

While this code also supports Volta/Turing, it's only enabled for Pascal
GPUs currently due to channel recovery being unreliable right now on the
later GPUs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# bfe91afa 19-Feb-2019 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: prepare for enabling svm with existing userspace interfaces

For a channel to make use of SVM features, it requires a different GPU MMU
configuration than we would normally use, which is not desirable to switch
to unless a client is actively going to use SVM.

In order to supporting SVM without more extensive changes to the userspace
interfaces, the SVM_INIT ioctl needs to replace the previous configuration
safely.

The only way we can currently do this safely, accounting for some unlikely
failure conditions, is to allocate the new VMM without destroying the last
one, and prioritising the SVM-enabled configuration in the code that cares.

This will get cleaned up again further down the track.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fcd6f048 12-Feb-2019 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/kms/nv04-nv4x: move a bunch of pre-nv50 page flip code to dispnv04

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a64f784b 19-Oct-2018 Christian König <christian.koenig@amd.com>

drm/ttm: initialize globals during device init (v2)

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>


# 27eb1fa9 19-Oct-2018 Christian König <christian.koenig@amd.com>

drm/ttm: use a static ttm_mem_global instance

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>


# 6d757753 06-Sep-2018 Lyude Paul <lyude@redhat.com>

drm/nouveau: Move backlight device into nouveau_connector

Currently module unloading is broken in nouveau due to a rather annoying
race condition resulting from nouveau_backlight.c having gone a bit
stale over time:

[ 1960.791143] ==================================================================
[ 1960.791394] BUG: KASAN: use-after-free in nouveau_backlight_exit+0x112/0x150 [nouveau]
[ 1960.791460] Read of size 4 at addr ffff88075accf350 by task zsh/11185
[ 1960.791521]
[ 1960.791545] CPU: 7 PID: 11185 Comm: zsh Kdump: loaded Tainted: G O 4.18.0Lyude-Test+ #4
[ 1960.791580] Hardware name: LENOVO 20EQS64N0B/20EQS64N0B, BIOS N1EET79W (1.52 ) 07/13/2018
[ 1960.791628] Call Trace:
[ 1960.791680] dump_stack+0xa4/0xfd
[ 1960.791721] print_address_description+0x71/0x239
[ 1960.791833] ? nouveau_backlight_exit+0x112/0x150 [nouveau]
[ 1960.791877] kasan_report.cold.6+0x242/0x2fe
[ 1960.791919] __asan_report_load4_noabort+0x19/0x20
[ 1960.792012] nouveau_backlight_exit+0x112/0x150 [nouveau]
[ 1960.792081] nouveau_display_destroy+0x76/0x150 [nouveau]
[ 1960.792150] nouveau_drm_device_fini+0xb7/0x190 [nouveau]
[ 1960.792265] nouveau_drm_device_remove+0x14b/0x1d0 [nouveau]
[ 1960.792347] ? nouveau_cli_work_queue+0x2e0/0x2e0 [nouveau]
[ 1960.792378] ? trace_hardirqs_on_caller+0x38b/0x570
[ 1960.792406] ? trace_hardirqs_on+0xd/0x10
[ 1960.792472] nouveau_drm_remove+0x37/0x50 [nouveau]
[ 1960.792502] pci_device_remove+0x112/0x2d0
[ 1960.792530] ? pcibios_free_irq+0x10/0x10
[ 1960.792558] ? kasan_check_write+0x14/0x20
[ 1960.792587] device_release_driver_internal+0x35c/0x650
[ 1960.792617] device_release_driver+0x12/0x20
[ 1960.792643] pci_stop_bus_device+0x172/0x1e0
[ 1960.792671] pci_stop_and_remove_bus_device_locked+0x1a/0x30
[ 1960.792715] remove_store+0xcb/0xe0
[ 1960.792753] ? sriov_numvfs_store+0x2e0/0x2e0
[ 1960.792779] ? __lock_is_held+0xb5/0x140
[ 1960.792808] ? component_add+0x530/0x530
[ 1960.792834] dev_attr_store+0x3f/0x70
[ 1960.792859] ? sysfs_file_ops+0x11d/0x170
[ 1960.792885] sysfs_kf_write+0x104/0x150
[ 1960.792915] ? sysfs_file_ops+0x170/0x170
[ 1960.792940] kernfs_fop_write+0x24f/0x400
[ 1960.792978] ? __lock_acquire+0x6ea/0x47f0
[ 1960.793021] __vfs_write+0xeb/0x760
[ 1960.793048] ? kernel_read+0x130/0x130
[ 1960.793076] ? __lock_is_held+0xb5/0x140
[ 1960.793107] ? rcu_read_lock_sched_held+0xdd/0x110
[ 1960.793135] ? rcu_sync_lockdep_assert+0x78/0xb0
[ 1960.793162] ? __sb_start_write+0x183/0x220
[ 1960.793189] vfs_write+0x14d/0x4a0
[ 1960.793229] ksys_write+0xd2/0x1b0
[ 1960.793255] ? __ia32_sys_read+0xb0/0xb0
[ 1960.793298] ? fput+0x1d/0x120
[ 1960.793324] ? filp_close+0xf3/0x130
[ 1960.793349] ? entry_SYSCALL_64_after_hwframe+0x59/0xbe
[ 1960.793380] __x64_sys_write+0x73/0xb0
[ 1960.793407] do_syscall_64+0xaa/0x400
[ 1960.793433] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1960.793460] RIP: 0033:0x7f59df433164
[ 1960.793486] Code: 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 8d 05 81 38 2d 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 41 54 49 89 d4 55 48 89 f5 53
[ 1960.793541] RSP: 002b:00007ffd70ee2fb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 1960.793576] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f59df433164
[ 1960.793620] RDX: 0000000000000002 RSI: 00005578088640c0 RDI: 0000000000000001
[ 1960.793665] RBP: 00005578088640c0 R08: 00007f59df7038c0 R09: 00007f59e0995b80
[ 1960.793696] R10: 000000000000000a R11: 0000000000000246 R12: 00007f59df702760
[ 1960.793730] R13: 0000000000000002 R14: 00007f59df6fd760 R15: 0000000000000002
[ 1960.793768]
[ 1960.793790] Allocated by task 11167:
[ 1960.793816] save_stack+0x43/0xd0
[ 1960.793841] kasan_kmalloc+0xc4/0xe0
[ 1960.793880] kasan_slab_alloc+0x11/0x20
[ 1960.793905] kmem_cache_alloc+0xd7/0x270
[ 1960.793944] getname_flags+0xbd/0x520
[ 1960.793969] user_path_at_empty+0x23/0x50
[ 1960.793994] do_faccessat+0x1fc/0x5d0
[ 1960.794018] __x64_sys_access+0x59/0x80
[ 1960.794043] do_syscall_64+0xaa/0x400
[ 1960.794067] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1960.794093]
[ 1960.794127] Freed by task 11167:
[ 1960.794152] save_stack+0x43/0xd0
[ 1960.794190] __kasan_slab_free+0x139/0x190
[ 1960.794215] kasan_slab_free+0xe/0x10
[ 1960.794239] kmem_cache_free+0xcb/0x2c0
[ 1960.794264] putname+0xad/0xe0
[ 1960.794287] filename_lookup.part.59+0x1f1/0x360
[ 1960.794313] user_path_at_empty+0x3e/0x50
[ 1960.794338] do_faccessat+0x1fc/0x5d0
[ 1960.794362] __x64_sys_access+0x59/0x80
[ 1960.794393] do_syscall_64+0xaa/0x400
[ 1960.794421] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1960.794461]
[ 1960.794483] The buggy address belongs to the object at ffff88075acceac0
[ 1960.794483] which belongs to the cache names_cache of size 4096
[ 1960.794540] The buggy address is located 2192 bytes inside of
[ 1960.794540] 4096-byte region [ffff88075acceac0, ffff88075accfac0)
[ 1960.794581] The buggy address belongs to the page:
[ 1960.794609] page:ffffea001d6b3200 count:1 mapcount:0 mapping:ffff880778e4b1c0 index:0x0 compound_mapcount: 0
[ 1960.794651] flags: 0x8000000000008100(slab|head)
[ 1960.794679] raw: 8000000000008100 ffffea001d39e808 ffffea001d39ea08 ffff880778e4b1c0
[ 1960.794739] raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
[ 1960.794785] page dumped because: kasan: bad access detected
[ 1960.794813]
[ 1960.794834] Memory state around the buggy address:
[ 1960.794861] ffff88075accf200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 1960.794894] ffff88075accf280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 1960.794925] >ffff88075accf300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 1960.794956] ^
[ 1960.794985] ffff88075accf380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 1960.795017] ffff88075accf400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[ 1960.795061] ==================================================================
[ 1960.795106] Disabling lock debugging due to kernel taint
[ 1960.795131] ------------[ cut here ]------------
[ 1960.795148] ida_remove called for id=1802201963 which is not allocated.
[ 1960.795193] WARNING: CPU: 7 PID: 11185 at lib/idr.c:521 ida_remove+0x184/0x210
[ 1960.795213] Modules linked in: nouveau(O) mxm_wmi ttm i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm joydev vfat fat intel_rapl x86_pkg_temp_thermal coretemp crc32_pclmul iTCO_wdt psmouse wmi_bmof mei_me tpm_tis mei tpm_tis_core tpm i2c_i801 thinkpad_acpi pcc_cpufreq crc32c_intel serio_raw xhci_pci xhci_hcd wmi video i2c_dev i2c_core
[ 1960.795305] CPU: 7 PID: 11185 Comm: zsh Kdump: loaded Tainted: G B O 4.18.0Lyude-Test+ #4
[ 1960.795330] Hardware name: LENOVO 20EQS64N0B/20EQS64N0B, BIOS N1EET79W (1.52 ) 07/13/2018
[ 1960.795352] RIP: 0010:ida_remove+0x184/0x210
[ 1960.795370] Code: 4c 89 f7 e8 ae c8 00 00 eb 22 41 83 c4 02 4c 89 e8 41 83 fc 3f 0f 86 64 ff ff ff 44 89 fe 48 c7 c7 20 94 1e 83 e8 54 ed 81 fe <0f> 0b 48 b8 00 00 00 00 00 fc ff df 48 01 c3 c7 03 00 00 00 00 c7
[ 1960.795402] RSP: 0018:ffff88074d4df7b8 EFLAGS: 00010082
[ 1960.795421] RAX: 0000000000000000 RBX: 1ffff100e9a9befa RCX: ffffffff81479975
[ 1960.795440] RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88077c1de690
[ 1960.795460] RBP: ffff88074d4df878 R08: ffffed00ef83bcd3 R09: ffffed00ef83bcd2
[ 1960.795479] R10: ffffed00ef83bcd2 R11: ffff88077c1de697 R12: 000000000000036b
[ 1960.795498] R13: 0000000000000202 R14: ffffffffa0aa7fa0 R15: 000000006b6b6b6b
[ 1960.795518] FS: 00007f59e0995b80(0000) GS:ffff88077c1c0000(0000) knlGS:0000000000000000
[ 1960.795553] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1960.795571] CR2: 00007f59e09a2010 CR3: 00000004a1a70005 CR4: 00000000003606e0
[ 1960.795596] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1960.795629] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 1960.795649] Call Trace:
[ 1960.795667] ? ida_destroy+0x1d0/0x1d0
[ 1960.795686] ? kasan_check_write+0x14/0x20
[ 1960.795704] ? do_raw_spin_lock+0xc2/0x1c0
[ 1960.795724] ida_simple_remove+0x26/0x40
[ 1960.795794] nouveau_backlight_exit+0x9d/0x150 [nouveau]
[ 1960.795867] nouveau_display_destroy+0x76/0x150 [nouveau]
[ 1960.795930] nouveau_drm_device_fini+0xb7/0x190 [nouveau]
[ 1960.795989] nouveau_drm_device_remove+0x14b/0x1d0 [nouveau]
[ 1960.796047] ? nouveau_cli_work_queue+0x2e0/0x2e0 [nouveau]
[ 1960.796067] ? trace_hardirqs_on_caller+0x38b/0x570
[ 1960.796089] ? trace_hardirqs_on+0xd/0x10
[ 1960.796146] nouveau_drm_remove+0x37/0x50 [nouveau]
[ 1960.796167] pci_device_remove+0x112/0x2d0
[ 1960.796186] ? pcibios_free_irq+0x10/0x10
[ 1960.796218] ? kasan_check_write+0x14/0x20
[ 1960.796237] device_release_driver_internal+0x35c/0x650
[ 1960.796257] device_release_driver+0x12/0x20
[ 1960.796289] pci_stop_bus_device+0x172/0x1e0
[ 1960.796308] pci_stop_and_remove_bus_device_locked+0x1a/0x30
[ 1960.796328] remove_store+0xcb/0xe0
[ 1960.796345] ? sriov_numvfs_store+0x2e0/0x2e0
[ 1960.796364] ? __lock_is_held+0xb5/0x140
[ 1960.796383] ? component_add+0x530/0x530
[ 1960.796401] dev_attr_store+0x3f/0x70
[ 1960.796419] ? sysfs_file_ops+0x11d/0x170
[ 1960.796436] sysfs_kf_write+0x104/0x150
[ 1960.796454] ? sysfs_file_ops+0x170/0x170
[ 1960.796471] kernfs_fop_write+0x24f/0x400
[ 1960.796488] ? __lock_acquire+0x6ea/0x47f0
[ 1960.796520] __vfs_write+0xeb/0x760
[ 1960.796538] ? kernel_read+0x130/0x130
[ 1960.796556] ? __lock_is_held+0xb5/0x140
[ 1960.796590] ? rcu_read_lock_sched_held+0xdd/0x110
[ 1960.796608] ? rcu_sync_lockdep_assert+0x78/0xb0
[ 1960.796626] ? __sb_start_write+0x183/0x220
[ 1960.796648] vfs_write+0x14d/0x4a0
[ 1960.796666] ksys_write+0xd2/0x1b0
[ 1960.796684] ? __ia32_sys_read+0xb0/0xb0
[ 1960.796701] ? fput+0x1d/0x120
[ 1960.796732] ? filp_close+0xf3/0x130
[ 1960.796749] ? entry_SYSCALL_64_after_hwframe+0x59/0xbe
[ 1960.796768] __x64_sys_write+0x73/0xb0
[ 1960.796800] do_syscall_64+0xaa/0x400
[ 1960.796818] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1960.796836] RIP: 0033:0x7f59df433164
[ 1960.796854] Code: 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 8d 05 81 38 2d 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 41 54 49 89 d4 55 48 89 f5 53
[ 1960.796884] RSP: 002b:00007ffd70ee2fb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 1960.796906] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f59df433164
[ 1960.796926] RDX: 0000000000000002 RSI: 00005578088640c0 RDI: 0000000000000001
[ 1960.796946] RBP: 00005578088640c0 R08: 00007f59df7038c0 R09: 00007f59e0995b80
[ 1960.796966] R10: 000000000000000a R11: 0000000000000246 R12: 00007f59df702760
[ 1960.796985] R13: 0000000000000002 R14: 00007f59df6fd760 R15: 0000000000000002
[ 1960.797008] irq event stamp: 509990
[ 1960.797026] hardirqs last enabled at (509989): [<ffffffff8119ff78>] flush_work+0x4b8/0x6d0
[ 1960.797063] hardirqs last disabled at (509990): [<ffffffff8297c395>] _raw_spin_lock_irqsave+0x25/0x60
[ 1960.797085] softirqs last enabled at (509744): [<ffffffff82c005ad>] __do_softirq+0x5ad/0x8c0
[ 1960.797121] softirqs last disabled at (509735): [<ffffffff8115aa15>] irq_exit+0x1a5/0x1e0
[ 1960.797142] ---[ end trace fb1342325f1846b8 ]---

While I haven't actually gone into the details of what's causing this to
happen (maybe the kernel removes the backlight device in the device core
before we get to it?), it doesn't really matter anyway because the way
nouveau handles backlights has long since been deprecated.

According to the documentation on the drm_connector->late_register()
hook, the ->late_register() hook should be used for adding extra
connector-related devices. Vice versa, the ->early_unregister() hook is
meant to be used for removing those devices.

So: gut nouveau_drm->bl_list and nouveau_drm->backlight, and replace
them with per-connector backlight structures. Additionally, move
backlight registration/teardown into the ->late_register() and
->early_unregister() hooks so that DRM can give us a chance to remove
the backlight before the connector is even removed. This appears to fix
the problem once and for all.

Changes since v2:
- Use NV_INFO_ONCE for printing GMUX information, since otherwise this
will end up printing that message for as many times as we have
connectors

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4c497075 06-Sep-2018 Lyude Paul <lyude@redhat.com>

drm/nouveau: Add NV_PRINTK_ONCE and variants

Since we're about to use this in nouveau_backlight.c. Same thing as
DRM_WARN_ONCE, DRM_INFO_ONCE, etc...

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# eb47db4f 08-May-2018 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fifo: support channel count query

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fd1eabd8 03-Mar-2018 Lukas Wunner <lukas@wunner.de>

drm/nouveau: Runtime suspend despite HDA being unbound

Commit 5addcf0a5f0f ("nouveau: add runtime PM support (v0.9)") prevents
runtime suspend of the GPU if its integrated HDA controller is not bound
to a driver. The rationale appears to be that probing the HDA fails if
the GPU is in D3cold.

However we now use a device link to ensure that the GPU is runtime
resumed while the HDA controller is probed, rendering this safety
measure obsolete. Remove it.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Denis Lisov <dennis.lissov@gmail.com> # Nvidia Optimus
Tested-by: Peter Wu <peter@lekensteyn.nl> # Nvidia Optimus
Tested-by: Lukas Wunner <lukas@wunner.de> # MacBook Pro
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://patchwork.freedesktop.org/patch/msgid/77e0ab74f3377ea9b6acf8fab624acfb4f7dbeca.1520068884.git.lukas@wunner.de


# 74a39954 13-Dec-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: use alternate memory type for system-memory buffers with kind != 0

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>


# b2441318 01-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

License cleanup: add SPDX GPL-2.0 license identifier to files with no license

Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.

For non */uapi/* files that summary was:

SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139

and resulted in the first patch in this series.

If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:

SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930

and resulted in the second patch in this series.

- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:

SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1

and that resulted in the third patch in this series.

- when the two scanners agreed on the detected license(s), that became
the concluded license(s).

- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.

- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).

- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.

- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct

This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 632b740c 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/mmu: remove old vmm frontend

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 814a2324 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: implement per-client delayed workqueue with fence support

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7f507624 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: determine memory class for each client

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 96da0bcd 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allocate vmm object for every client

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 658c71f4 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: fetch memory type indices that we care about for ttm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 01670a79 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allocate mmu object for every client

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 24e8375b 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: separate constant-va tracking from nvkm vma structure

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# cb7e88e7 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: hang drm client of a master

TTM memory allocations will be hanging off the DRM's client, but the
locking needed to do so gets really tricky with all the other use of
the DRM's object tree.

To solve this, we make the normal DRM client a child of a new master,
where the memory allocations will be done from instead.

This also solves a potential race with client creation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e75c091b 31-Oct-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: store nouveau_drm in nouveau_cli, as opposed to drm_device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 451b58d2 31-Oct-2017 Rhys Kidd <rhyskidd@gmail.com>

drm/nouveau: Document nouveau support for Tegra in DRIVER_DESC

nouveau supports the Tegra K1 and higher after the SoC-based GPUs converged
with the main GeForce GPU families.

v2:
- Qualify that support is Tegra K1+ (Martin Peres)

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Martin Peres <martin.peres@free.fr>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 321f5c5f 01-Jun-2017 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: replace multiple open-coded runpm support checks with function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ae95621b 23-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

drm/nouveau: fix include notation and remove -Iinclude/drm flag

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


# 1167c6bc 17-May-2016 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allocate device object for every client

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 20d8a88e 17-May-2016 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: tidy up the client init/fini interfaces

These were a little insane.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 15266ae3 11-Jan-2017 Lyude Paul <lyude@redhat.com>

drm/nouveau: Handle fbcon suspend/resume in seperate worker

Resuming from RPM can happen while already holding
dev->mode_config.mutex. This means we can't actually handle fbcon in
any RPM resume workers, since restoring fbcon requires grabbing
dev->mode_config.mutex again. So move the fbcon suspend/resume code into
it's own worker, and rely on that instead to avoid deadlocking.

This fixes more deadlocks for runtime suspending the GPU on the ThinkPad
W541. Reproduction recipe:

- Get a machine with both optimus and a nvidia card with connectors
attached to it
- Wait for the nvidia GPU to suspend
- Attempt to manually reprobe any of the connectors on the nvidia GPU
using sysfs
- *deadlock*

[airlied: use READ_ONCE to address Hans's comment]

Signed-off-by: Lyude <lyude@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Kilian Singer <kilian.singer@quantumtechnology.info>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: David Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# db1a0ae2 07-Dec-2016 Pierre Moreau <pierre.morrow@free.fr>

drm/nouveau/bl: Assign different names to interfaces

Currently, every backlight interface created by Nouveau uses the same name,
nv_backlight. This leads to a sysfs warning as it tries to create an already
existing folder. This patch adds a incremented number to the name, but keeps
the initial name as nv_backlight, to avoid possibly breaking userspace; the
second interface will be named nv_backlight1, and so on.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86539

v2:
* Switch to using ida for generating unique IDs, as suggested by Ilia Mirkin;
* Allocate backlight name on the stack, as suggested by Ilia Mirkin;
* Move `nouveau_get_backlight_name()` to avoid forward declaration, as
suggested by Ilia Mirkin;
* Fix reference to bug report formatting, as reported by Nick Tenney.

v3:
* Define a macro for the size of the backlight name, to avoid defining
it multiple times;
* Use snprintf in place of sprintf.

v4:
* Do not create similarly named interfaces when reaching the maximum
amount of unique names, but fail instead, as pointed out by Lukas Wunner

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 81280d0e 21-Nov-2016 Hans de Goede <hdegoede@redhat.com>

drm/nouveau: Rename acpi_work to hpd_work

We need to call drm_helper_hpd_irq_event() on resume to properly detect
monitor connection / disconnection on some laptops. For runtime-resume
(which gets called on resume from normal suspend too) we must call
drm_helper_hpd_irq_event() from a workqueue to avoid a deadlock.

Rename acpi_work to hpd_work, and move it out of the #ifdef CONFIG_ACPI
blocks to make it suitable for generic work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3a6536c5 09-Nov-2016 Hans de Goede <hdegoede@redhat.com>

drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE

Various notebooks with nvidia GPUs generate an ACPI_VIDEO_NOTIFY_PROBE
acpi-video event when an external device gets plugged in (and again on
modesets on that connector), the default behavior in the acpi-video
driver for this is to send a KEY_SWITCHVIDEOMODE evdev event, which
causes e.g. gnome-settings-daemon to ask us to rescan the connectors
(good), but also causes g-s-d to switch to mirror mode on a newly plugged
monitor rather then using the monitor to extend the desktop (bad)
as KEY_SWITCHVIDEOMODE is supposed to switch between extend the desktop
vs mirror mode.

More troublesome are the repeated ACPI_VIDEO_NOTIFY_PROBE events on
changing the mode on the connector, which cause g-s-d to switch
between mirror/extend mode, which causes a new ACPI_VIDEO_NOTIFY_PROBE
event and we end up with an endless loop.

This commit fixes this by adding an acpi notifier block handler to
nouveau_display.c to intercept ACPI_VIDEO_NOTIFY_PROBE and:

1) Wake-up runtime suspended GPUs and call drm_helper_hpd_irq_event()
on them, this is necessary in some cases for the GPU to detect connector
hotplug events while runtime suspended
2) Return NOTIFY_BAD to stop acpi-video from emitting a bogus
KEY_SWITCHVIDEOMODE key-press event

There already is another acpi notifier block handler registered in
drivers/gpu/drm/nouveau/nvkm/engine/device/acpi.c, but that is not
suitable since that one gets unregistered on runtime suspend, and
we also want to intercept ACPI_VIDEO_NOTIFY_PROBE when runtime suspended.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 3dbd036b 04-Nov-2016 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/kms/nv50: separate out mode commit

This commit separates the calculation of EVO state from the commit, in
order to make the same code useful for atomic modesetting.

The legacy interfaces have been wrapped on top of them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8d021d71 24-Aug-2016 Martin Peres <martin.peres@free.fr>

drm/nouveau/drm/nouveau: add a LED driver for the NVIDIA logo

We received a donation of a Titan which has this useless feature
allowing users to control the brightness of the LED behind the
logo of NVIDIA. In the true spirit of open source, let's expose
that to the users of very expensive cards!

This patch hooks up this LED/PWM to the LED subsystem which allows
blinking it in sync with cpu/disk/network/whatever activity (heartbeat
is quite nice!). Users may also implement some breathing effect or
morse code support in the userspace if they feel like it.

v2:
- surround the use of the LED framework with ifdef CONFIG_LEDS_CLASS

v3:
- avoid using ifdefs everywhere, follow the recommendations of
/doc/Documentation/CodingStyle. Suggested by Emil Velikov.

v4 (Ben):
- squashed series of fixes from ml

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4dc28134 19-May-2016 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: rename nouveau_drm.h to nouveau_drv.h

Fixes out-of-tree build issue where uapi/drm/nouveau_drm.h gets picked
up instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 77145f1c 31-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: port remainder of drm code, and rip out compat layer

v2: Ben Skeggs <bskeggs@redhat.com>
- fill in nouveau_pm.dev to prevent oops
- fix ppc issues (build + OF shadow)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 51a3d342 25-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/backlight: remove dependence on nouveau_drv.h

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fce875d6 25-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move compat ioctl out of nouveau_drv.h

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c0077061 25-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/acpi: move definitions out of nouveau_drv.h

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d38ac521 22-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/mxm: split up into bios code and a subdev module

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 08c77096 21-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: start culling unused code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ebb945a9 19-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: port all engines to new engine module format

This is a HUGE commit, but it's not nearly as bad as it looks - any problems
can be isolated to a particular chipset and engine combination. It was
simply too difficult to port each one at a time, the compat layers are
*already* ridiculous.

Most of the changes here are simply to the glue, the process for each of the
engine modules was to start with a standard skeleton and copy+paste the old
code into the appropriate places, fixing up variable names etc as needed.

v2: Marcin Slusarz <marcin.slusarz@gmail.com>
- fix find/replace bug in license header

v3: Ben Skeggs <bskeggs@redhat.com>
- bump indirect pushbuf size to 8KiB, 4KiB barely enough for userspace and
left no space for kernel's requirements during GEM pushbuf submission.
- fix duplicate assignments noticed by clang

v4: Marcin Slusarz <marcin.slusarz@gmail.com>
- add sparse annotations to nv04_fifo_pause/nv04_fifo_start
- use ioread32_native/iowrite32_native for fifo control registers

v5: Ben Skeggs <bskeggs@redhat.com>
- rebase on v3.6-rc4, modified to keep copy engine fix intact
- nv10/fence: unmap fence bo before destroying
- fixed fermi regression when using nvidia gr fuc
- fixed typo in supported dma_mask checking

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# bc9e7b9a 19-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move some more code around to more appropriate places

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e193b1d4 18-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fence: un-port from nouveau_exec_engine interfaces

Still the same code, but not an "engine" anymore. The fence code is more of
a policy decision rather than exposing mechanisms, so it's not appropriate
to port it to the new engine subsystem.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 66f24723 18-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: pull nouveau_gem definitions into their own header

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8be21a64 18-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: pull nouveau_bo definitions into their own header

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 017e6e29 17-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nv04/disp: kick all private state out to own header

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3863c9bc 14-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/instmem: completely new implementation, as a subdev module

v2 (Ben Skeggs):
- some fixes for 64KiB PAGE_SIZE
- fix porting issues in (currently unused) nv41/nv44 pciegart code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8a9b889e 13-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove last use of nouveau_gpuobj_new_fake()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 73a60c0d 13-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/gpuobj: remove flags for vm-mappings

Having GPUOBJ and VM intertwined like this makes it *really* hard to
continue porting to the new driver architecture, split it out in
favour of requiring explit maps be the caller.

It's more flexible and obvious this way anyway...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 18c9b959 13-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/gpuobj: create wrapper functions for mapping gpuobj into vm/bar

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5787640d 13-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nv04-nv40/instmem: remove use of nouveau_gpuobj_new_fake()

These type of fake objects will not be supported for much longer.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# af7afbd2 13-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nv04-nv40/instmem: duplicate nv04 code as nv40, remove alternate paths

A ton of duplication for the moment, will go away when they become subdevs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 861d2107 11-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fb: merge fb/vram and port to subdev interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5a5c7432 11-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/timer: port to subdev interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7d9115de 10-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/mc: port to subdev interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# cb75d97e 10-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: implement devinit subdev, and new init table parser

v2:
- make sure not to execute display scripts unless resuming

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 70790f4f 10-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/clock: pull in the implementation from all over the place

Still missing the main bits we use to change performance levels, I'll get
to it after all the hard yakka has been finished.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e0996aea 09-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/gpio: port gpio to subdev interfaces

v2: Ben Skeggs <bskeggs@redhat.com>
- rebase on top of v3.6-rc6 with gpio reset patch integrated already

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# cd42439d 09-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/oldbios: remove shadowing support, use bios subdev's image

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 586c55f6 08-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: have non-core mmio accesses go through device object

Adds an extra layer of indirection to each register access, but it's not
too bad, and will also go away as pieces are ported.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 94580299 05-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: implement module init functions in nouveau_drm.c

These currently just call the existing ones in nouveau_drv.c, but will be
extended in upcoming commits. This needed to be separated from the current
code as there will be some header clashes until things are ported.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# aa4cc5d2 05-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/agp: move all agp stuff into its own source file

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 02a841d4 04-Jul-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: restructure source tree, split core from drm implementation

Future work will be headed in the way of separating the policy supplied by
the nouveau drm module from the mechanisms provided by the driver core.

There will be a couple of major classes (subdev, engine) of driver modules
that have clearly defined tasks, and the further directory structure change
is to reflect this.

No code changes here whatsoever, aside from fixing up a couple of include
file pathnames.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 760285e7 02-Oct-2012 David Howells <dhowells@redhat.com>

UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/

Convert #include "..." to #include <path/...> in drivers/gpu/.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>


# 71585545 25-Jul-2012 Marcin Slusarz <marcin.slusarz@gmail.com>

drm/nouveau: init vblank requests list

Fixes kernel panic when vblank interrupt triggers before first sync to
vblank request.

(Besides init, remove some relevant leftovers from vblank rework)

Reported-by: Ortwin Glück <odi@odi.ch>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org [3.5]
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0ade74b6 07-May-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: extend vblank semaphore to generic dmaobj + offset pair

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2a259a3d 07-May-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: mark most of our ioctls as deprecated, move to compat layer

These will be replaced in the near future, the code isn't yet stable enough
for this merge window however.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ce22af03 05-May-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move current gpuobj code out of nouveau_object.c

I want this file for the new interfaces...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 35916ace 31-May-2012 Dave Airlie <airlied@redhat.com>

nouveau: add vmap support to nouveau prime support

Tested sharing to udl.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# d1b167e1 03-May-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/ttm: untangle code to support accelerated buffer moves

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c420b2dc 01-May-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fifo: turn all fifo modules into engine modules

Been tested on each major revision that's relevant here, but I'm sure there
are still bugs waiting to be ironed out.

This is a *very* invasive change.

There's a couple of pieces left that I don't like much (eg. other engines
using fifo_priv for the channel count), but that's an artefact of there
being a master channel list still. This is changing, slowly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 67b342ef 30-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fifo: remove all the "special" engine hooks

All the places this stuff is actually needed tends to be chipset-specific
anyway, so we're able to just inline the register bashing instead.

The parts of the common code that still directly touch PFIFO temporarily
have conditionals, these will be removed in subsequent commits that will
refactor the fifo modules into engine modules like graph/mpeg etc.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5e120f6e 29-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fence: convert to exec engine, and improve channel sync

Now have a somewhat simpler semaphore sync implementation for nv17:nv84,
and a switched to using semaphores as fences on nv84+ and making use of
the hardware's >= acquire operation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d375e7d5 29-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fence: minor api changes for an upcoming rework

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 875ac34a 29-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/fence: make ttm interfaces wrap ours, not the other way around

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 35bcf5d5 30-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move flip-related channel setup to software engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 20abd163 30-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: create real execution engine for software object class

Just a cleanup more or less, and to remove the need for special handling of
software objects.

This removes a heap of documentation on dma/graph object formats. The info
is very out of date with our current understanding, and is far better
documented in rnndb in envytools git.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d58086de 19-Apr-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nv40-50/gr: restructure grctx/prog generation

The conditional definition of the generation helper functions apparently
confuses some IDEs....

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ab394543 12-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nve0/gr: initial implementation

This may, perhaps, get re-merged with nvc0_graph.c at some point. It's
still unclear as to how great an idea that'd be. Stay tuned...

Completely dependent on firmware blobs from NVIDIA binary driver currently.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5132f377 07-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nve0/fifo: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 22b33e8e 02-Apr-2012 Dave Airlie <airlied@redhat.com>

nouveau: add PRIME support

This adds prime->fd and fd->prime support to nouveau,
it passes the SG object to TTM, and then populates the
GART entries using it.

v2: add stubbed kmap + use new function to fill out pages array
for faulting + add reimport test.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 68455a43 03-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nve0: initial modesetting support for kepler chipsets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f887c425 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: bump version to 1.0.0

The time has come to get a proper version number that we can change to
indicate new features etc, rather than the lock-step 0.0.XX that we
previously had.

libdrm has recognised this version as compatible with 0.0.16 since 2.4.22,
so hopefully any breakage people see should be very minimal.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 27100ac9 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: oops, increase channel dispc_vma to 4

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 48aca13f 17-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove m2mf creation on userspace channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d5316e25 20-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0-/disp: reimplement flip completion method as fifo method

Removes need for M2MF subchannel usage on NVC0+.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b5b2e598 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove subchannel names from places where it doesn't matter

These are FIFO methods, it doesn't matter what subchannel is being used.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# accf9496 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/ttm: always do buffer moves on kernel channel

There was once good reasons for wanting the drm to be able to use M2MF etc
on user channels, but they're not relevant anymore. For the general
buffer move case, we've already lost by transferring between vram/sysmem
already so the context switching overhead is minimal in comparison.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2f5394c3 11-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: map first page of mmio early and determine chipset earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8663bc7c 08-Mar-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/dp: move all nv50/sor-specific code out of nouveau_dp.c

Off-chip encoders (which we don't support yet anyway), and newer chipsets
(such as NVD9...), will need their own code for this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# df26bc9c 21-Jan-2012 Christoph Bumiller <e0425955@student.tuwien.ac.at>

drm/nv50/display: expose color vibrance control

Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 990449c7 11-Jan-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0/vm: support unsnooped system memory

v2 (Emil Velikov <emil.l.velikov@gmail.com>):
- Fixed a regression on certain nv50 IGP due to not passing the correct
target type to nv50_vm_addr()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Johannes Obermayr <johannesobermayr@gmx.de>


# 25c53c10 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: extend profile interface for destroy/init/fini

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>


# 8d7bb400 23-Jan-2012 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: rework to allow selecting separate profiles for ac/battery

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>


# 085028ce 17-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>


# fd99fd61 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>


# c7c039fd 08-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>


# bfb31465 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>


# b1aa5531 20-Aug-2011 Martin Peres <martin.peres@ensi-bourges.fr>

drm/nouveau: move pwm_divisor to the nouveau_pm_fan struct

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# bc6389e4 06-Oct-2011 Martin Peres <martin.peres@ensi-bourges.fr>

drm/nouveau/pm: restore fan speed after suspend

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ddb20055 16-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>


# c70c41e8 12-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>


# ff92a6cd 12-Dec-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv20-nv40: add memory type detection

NV20/NV30 is partially educated guesswork at this point, based on any
information around about available memory types and a horribly unspeakable
amount of vbios image scouring. I'm not entirely certain the GDDR3 define
is correct, I have not spotted a single vbios with that value yet (though
it is mentioned in some 1218-using nv4x vbios), but there are reports that
some nv3x did use it..

NV40(100914) confirmed by switching an NV49 to DDR1/DDR2 values and making
sure that the binary driver behaviour showed it had detected DDR1/DDR2
instead of GDDR3 before dying horribly.

NV40(100474) confirmed by doing much the same task as above on an NV44,
except this was *much* easier as changing the values didn't seem to have
any noticable effect on the memory controller aside from changing the
binary driver's behaviour.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d81c19e3 12-Dec-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv20: split PFB code out of nv10_fb.c

Most functions were quite different between NV10/NV20 already, and they're
about to get even more so.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7ad2d31c 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>


# d099230c 16-Dec-2011 Peter Lekensteyn <lekensteyn@gmail.com>

nouveau: Support Optimus models for vga_switcheroo

Newer nVidia cards with Optimus do not support/use the DSM switching functions.
Instead, it require a DSM function to be called prior to bringing a device into
D3 state. No other _DSM calls are necessary before/after enabling/disabling a
device. Switching between discrete and integrated GPU is not supported by
this Optimus _DSM call, therefore return on the switching method.

Signed-off-by: Peter Lekensteyn <lekensteyn@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 4e03b4af 19-Nov-2011 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Fix pushbufs over the 4GB mark.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a0b25635 20-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/gpio: reimplement as nouveau_gpio.c, fixing a number of issues

- moves out of nouveau_bios.c and demagics the logical state definitions
- simplifies chipset-specific driver interface
- makes most of gpio irq handling common, will use for nv4x hpd later
- api extended to allow both direct gpio access, and access using the
logical function states
- api extended to allow for future use of gpio extender chips
- pre-nv50 was handled very badly, the main issue being that all GPIOs
were being treated as output-only.
- fixes nvd0 so gpio changes actually stick, magic reg needs bashing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 675aac03 21-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: just pass gpio line to pwm_*, not entire gpio struct

We don't need more than the line id to determine the PWM controller, and
the GPIO interfaces are about to change somewhat.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b4c26818 12-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/mxm: initial implementation of dcb sanitisation

The DCB table provided by the VBIOS on most MXM chips has a number of
entries which either need to be disabled, or modified according to the
MXM-SIS Output Device Descriptors.

The x86 vbios code usually takes care of this for us, however, with the
large number of laptops now with switchable graphics or optimus, a lot
of the time nouveau is responsible for POSTing the card instead - leaving
some fun situations like, plugging in a monitor and having nouveau decide
3 connectors actually just got plugged in..

No MXM-SIS fetching methods implemented yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 486a45c2 10-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/i2c: do parsing of i2c-related vbios info in nouveau_i2c.c

Not much point parsing the vbios data into a struct which is only used once
to parse the data into another struct, go directly from vbios to
nouveau_i2c_chan.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6b5a81a2 09-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/bios: start refactoring dcb routines

This primary reason for this was mostly to avoid duplication of some of
this stuff by the MXM-SIS parser. However, some other cleanups will also
follow this as a result.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3376ee37 11-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvd0/disp: add support for page flipping

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f62b27db 08-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: shutdown display on suspend/hibernate

Known to fix some serious issues with hibernate on a couple of systems.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2a44e499 08-Nov-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/disp: introduce proper init/fini, separate from create/destroy

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ff2b6c6e 26-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: remove the older interfaces completely

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f3fbaf34 25-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50/pm: rewrite clock management, and switch to the new pm hooks

This area is horrifically complicated on these chipsets, and it's likely we
will need at least a few more tweaks yet.

Oh yes, and it's completely disabled on IGPs for the moment. From traces,
things look potentially different there yet again. Sigh...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# dd1da8de 09-Jul-2011 Martin Peres <martin.peres@ensi-bourges.fr>

drm/nouveau/pm: make clocks_set return an error code clocks_set can fail.

Reporting an error is better than silently refusing to reclock.

V2: Use the same logic on nv40

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# de691855 16-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: improve dithering properties, and implement proper auto mode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b29caa58 05-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add overscan compensation connector properties

Exposes the same connector properties as the Radeon implementation, however
their behaviour isn't exactly the same. The primary difference being that
unless both hborder/vborder have been defined by the user, the driver will
keep the aspect ratio of the overscanned area the same as the mode the
display is programmed for.

Enabled for digital outputs on GeForce 8 and up, excluding GF119.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 27d5030a 05-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move master modesetting init to nouveau_display

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 25575b41 04-Oct-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/hdmi: build ELD from EDID, notify audio driver of its presence

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 35bb5089 26-Sep-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50/pm: s/unk05/vdec/

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 1e054157 16-Sep-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: remove defunct fanspeed_set/get from pm table

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a175094c 16-Sep-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: introduce generic handler for on-chip fan controller

The handling of the internal pwm fan controller is similar enough between
current chipsets that it makes sense to share the logic, and bugfixes :)

No hw backends converted yet, will automatically fall-through to the
"old" per-chipset fanspeed hooks for now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3f8e11e4 15-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50/pm: mostly nailed down fan pwm frequency selection

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 11b7d895 14-Aug-2011 Martin Peres <martin.peres@ensi-bourges.fr>

drm/nouveau/pm: manual pwm fanspeed management for nv40+ boards

Exposes the following sysfs entries:
- fan0_input: read the rotational speed of the fan (poll a bit during 250ms)
- pwm0: set the pwm duty cycle
- pwm0_min/max: set the minimum/maximum pwm value

v2 (Ben Skeggs):
- nv50 pwm controller code removed in favour of other more complete code
- FAN_RPM -> FAN_SENSE
- merged FAN_SENSE readout into common code, not at all nv50-specific
- protected fanspeed changes with perflvl_wr
- formatting tidying
- added some comments where things are shaky

v3 (Martin Peres)
- ensure duty min/max from thermal table are sane

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>


# 8f27c543 10-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/vdec: implement stub modules for the known engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0c101461 27-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv40/pm: parse fan pwm divisor from vbios tables

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 649bf3ca 01-Nov-2011 Jerome Glisse <jglisse@redhat.com>

drm/ttm: merge ttm_backend and ttm_tt V5

ttm_backend will only exist with a ttm_tt, and ttm_tt
will only be of interest when bound to a backend. Merge them
to avoid code and data duplication.

V2 Rebase on top of memory accounting overhaul
V3 Rebase on top of more memory accounting changes
V4 Rebase on top of no memory account changes (where/when is my
delorean when i need it ?)
V5 make sure ttm is unbound before destroying, change commit
message on suggestion from Tormod Volden

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>


# 33dbc27f 29-Sep-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add dumb ioctl support

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 59ef9742 11-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv40/pm: execute memory reset script from vbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5f1800bd 04-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/dp: return master dp table pointer too when looking up encoder

Will need to be able to distinguish 2.0/2.1 from 3.0 soon. Also, move
the vbios parsing to nouveau_dp where it belongs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 721b0821 04-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/bios: simplify U/d table hash matching func to just match

The caller is now responsible for parsing its own lists (or whatever) of
possible encoders.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 27a45987 03-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/dp: restructure link training code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a002fece 03-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/dp: pass in required datarate to link training

Not used currently, but it will be used in preference to pre-determined
lane/bandwidth numbers at a later point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 10b461e4 02-Aug-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50/backlight: take the sor into account when bashing regs

I'm sure that out there somewhere, someone will need this. We currently
haven't seen an example of LVDS being on a non-0 SOR so far though.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 46959b77 30-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/dp: remove reliance on vbios for native displayport

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 43720133 19-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/dp: rewrite auxch transaction routines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f2cbe46f 20-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: determine timing crystal freq from straps

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2228c6fe 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>


# 9a782488 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>


# 26f6d88b 04-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvd0/disp: very initial evo setup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 02e4f587 06-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/bios: allow passing in crtc to the init table parser

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d7f8172c 02-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvd0/gpio: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 03bc9675 03-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allow modeset module option to select 'headless mode'

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 048a8859 03-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: make general drm modesetting init common

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2e9733ff 02-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvd0: add a card_type for 0xdX chipsets

These are different enough from 0xcX to justify it, half fermi, half
kepler(??)..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 987eec10 23-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: embed nouveau_mm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 323dcac5 23-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: rename nv40_mpeg to nv31_mpeg

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 9698b9a6 20-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0/pm: more complete parsing of clock domains

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 78e2933d 18-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add function to wait until a callback returns true

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4fd2847e 17-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nva3/pm: parse/reclock vdec/41a0 clocks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 77e7da68 16-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: add hooks to get/set *all* clocks at once

This is probably better than having to tell the common code about all the
clocks that exist on every chipset.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 03ce8d9e 09-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: some fermi chipsets still use volt 0x30

Fun, fun.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3b5565dd 09-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: add support for parsing perflvl voltage on fermi chips

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c3450239 08-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/pm: store voltage in microvolts

Instead of 10s of millivolts, to match fermi vbios.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6c320fef 19-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: pass flag to engine fini() method on suspend

It may not be necessary to fail in certain cases (such as failing to idle)
on module unload, whereas on suspend it's important to ensure a consistent
state can be restored on resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 70ad25ab 19-Jul-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: replace nv04_graph_fifo_access() use with direct reg bashing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 40ce4279 21-Jun-2011 Emil Velikov <emil.l.velikov@gmail.com>

drm/nouveau/temp: Fix signed/unsigned int logic

Many (all?) of the coefficients related to calculating the
correct temperature are signed integers

This patch correcly parses and stores those values
It also ensures that the default offset is 0 (previously 1)

Affected cards - the original nv50 and the nv40 family

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 24f246ac 09-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>


# 2fd3db6f 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove implicit mapping of every bo into chan_vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7375c95b 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove 'chan' argument from nouveau_bo_new

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3d483d57 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0: explicitly map PDISP semaphore buffer into each channel's vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d02836b4 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv84-nvc0: explicitly map semaphore buffer into channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ce163f69 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0: explicitly map pushbuf bo into channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0b718733 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0: explicitly map notifier bo into channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fd2871af 05-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: initial changes to support multiple VMAs per buffer object

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d2f96666 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>


# f91bac5b 05-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>


# 6e32fedc 02-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

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>


# 639212d0 03-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau/gem: implement stub hooks for GEM object open/close

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f6d4e621 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove 'chan' argument from nouveau_gem_new

Userspace hasn't passed us a channel_hint for a long long time now, and
there isn't actually a need to do so anymore anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fe32b16e 02-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0/vm: take client reference on shared channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e8a863c1 01-Jun-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: store a per-client channel list

Removes the need to disable IRQs to lookup channel struct on every pushbuf
ioctl, among others.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3f0a68d8 30-May-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allocate structure to store per-client data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0411de85 25-May-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0/gr: import and use our own fuc by default

The ability to use NVIDIA's fuc has been retained *temporarily* in order
to better debug any issues that may be lingering in our initial attempt
at writing this ucode. Once I'm fairly confident we're okay, it'll be
removed.

There's a number of things not implemented by this fuc currently, but
most of it is sets of state that our context setup would not have used
anyway. No doubt we'll find out what they're for at some point, and
implement it if required.

This has been tested on 0xc0/0xc4 thus far, and from what I could tell
it worked as well as NVIDIA's. It's also been tested on 0xc1, but even
with NVIDIA's fuc that chipset doesn't work correctly with nouveau yet.

0xc3/0xc8/0xce should in theory be supported too, but I don't have the
hardware to check that.

There's no doubt numerous bugs to squash yet, please report any!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f8522fc8 25-May-2011 Ben Skeggs <bskeggs@redhat.com>

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>


# aba99a84 24-May-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: default to noaccel on 0xc1/0xc8/0xce for now

Until we know these should work properly, would much rather default to
noaccel than risk giving people corruption/hangs out of the box..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 52eba8dd 27-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nva3/clk: better pll calculation when no fractional fb div available

The core/mem/shader clocks don't support the fractional feedback divider,
causing our calculated clocks to be off by quite a lot in some cases. To
solve this we will switch to a search-based algorithm when fN is NULL.

For my NVA8 at PL3, this actually generates identical cooefficients to
the binary driver. Hopefully that's a good sign, and that does not
break VPLL calculation for someone..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 047d2df5 19-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0/pm: parse clock for pll 0x0a (0x137020) from perf table

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e614b2e7 13-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>


# 93187450 11-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: rename nv84_mpeg to nv50_mpeg

In preparation for adding 0x50 support.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c0924326 04-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv84: add support for PMPEG

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a02ccc7f 04-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv40/vpe: add support for PMPEG

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d5a27370 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0: implement support for copy engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7ff5441e 17-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nva3: implement support for copy engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a82dd49f 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove remnants of nouveau_pgraph_engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 96c50082 31-Mar-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>


# 4976986b 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv04/gr: move to exec engine interfaces

Like nv10-nv50, needs cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d11db279 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv10/gr: move to exec engine interfaces

Like nv20-nv50, needs cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a0b1de84 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv20-nv30/gr: move to exec engine interface

A bit of cleanup done along the way, but, like nv40/nv50, needs more.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 39c8d368 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv40/gr: move to exec engine interfaces

Like nv50, this needs a good cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7a45cd19 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0/gr: move to exec engine interfaces

Much nicer to do that nv50, the code was pretty much written to expect
such a change in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2703c21a 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50/gr: move to exec engine interfaces

This needs a massive cleanup, but to catch bugs from the interface changes
vs the engine code cleanup, this will be done later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6dfdd7a6 30-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: working towards a common way to represent engines

There's lots of more-or-less independant engines present on NVIDIA GPUs
these days, and we generally want to perform the same operations on them.
Implementing new ones requires hooking into lots of different places,
the aim of this work is to make this simpler and cleaner.

NV84:NV98 PCRYPT moved over as a test.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2d7b919c 30-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove some unused members from dev_priv

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4ea52f89 30-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move engine object creation into per-engine hooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 50066f81 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>


# 0b89a072 19-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>


# 71298e2f 19-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>


# 04eb34a4 05-Apr-2011 Ben Skeggs <bskeggs@redhat.com>

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>


# 2b4cebe4 28-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: use "nv86" tlb flush method on everything except 0x50/0xac

It has been reported that this greatly improves (and possibly fixes
completely) the stability of NVA3+ chipsets. In traces of my NVA8,
NVIDIA now appear to be doing this too.

The most recent traces of 0x50 and 0xac I could find don't show NVIDIA
checking PGRAPH status on these flushes, so for now, we won't either.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 7eae3efa 22-Mar-2011 Matthew Garrett <mjg@redhat.com>

nouveau: change the backlight parent device to the connector, not the PCI dev

We may eventually end up with per-connector backlights, especially with
ddcci devices. Make sure that the parent node for the backlight device is
the connector rather than the PCI device.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 6fdb383e 07-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: check for vm traps on every gr irq

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 73412c38 03-Mar-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allocate kernel's notifier object at end of block

The nv30/nv40 3d driver is about to start using DMA_FENCE from the 3D
object which, it turns out, doesn't like its DMA object to not be
aligned to a 4KiB boundary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 8f7286f8 13-Feb-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: support for compression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 26c0c9e3 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>


# d5f42394 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>


# 3425df48 09-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>


# db5c8e29 09-Feb-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0: restrict memtype to those specified at creation time

Upcoming patches are going to enable full support for buffers that keep
a constant GPU virtual address whenever they're validated for use by
the GPU.

In order for this to work properly while keeping support for large pages,
we need to know if it's ever going to be possible for a buffer to end
up in GART, and if so, disable large pages for the buffer's VMA.

This is a new restriction that's not present in earlier kernel's, but
should not break userspace as the current code never attempts to validate
buffers into a memtype other than it was created with.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6ba9a683 09-Feb-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: pass domain rather than ttm flags to gem_new()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d550c41e 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>


# f13e435c 03-Feb-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0: switch to tasklet for display isr bh

We need to be able to have the bh run while possibly spinning waiting for
the EVO notifier to signal. This apparently happens in some circumstances
with preempt disabled, so our workqueue was never being run.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ef8389a8 31-Jan-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv50-nvc0: move non-sharable display state into private structure

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d82f8e6c 26-Jan-2011 Tejun Heo <tj@kernel.org>

drm/nouveau: use system_wq instead of dev_priv->wq

With cmwq, there's no reason for nouveau to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead. Each work item is sync
flushed when the containing structure is unregistered/destroyed.

Note that this change also makes sure that nv50_gpio_handler is not
freed while the contained work item is still running.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7948758d 10-Jan-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv40: implement support for on-chip PCIEGART

v2. moved nv44 pciegart table back to instmem, where it's not
accessible by userspace clients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 58e6c7a9 10-Jan-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: introduce new gart type, and name _SGDMA more appropriately

In preparation for the addition of a new nv40 backend, we'll need to be
able to distinguish between a paged dma object and the on-chip GART.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 1c2a679a 17-Jan-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove dead function definition

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c906ca0f 13-Jan-2011 Ben Skeggs <bskeggs@redhat.com>

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>


# c693931d 10-Jan-2011 Ben Skeggs <bskeggs@redhat.com>

drm/nv40: make detection of 0x4097-ful chipsets available everywhere

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5bcf719b 06-Dec-2010 Dave Airlie <airlied@redhat.com>

drm/switcheroo: track state of switch in drivers.

We need to track the state of the switch in drivers, so that after s/r
we don't resume the card we've explicitly switched off before. Also
don't allow a userspace open to occur if we've switched the gpu off.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# 6effe393 29-Dec-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: sync up gr data error names with rnn, use for nvc0 also

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 966a5b7d 23-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0: implement pgraph engine hooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b2b09938 23-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0: implement pfifo engine hooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8984e046 14-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>


# 4c74eb7f 09-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0: import initial vm backend

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fd70b6cd 07-Dec-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv04-nv40: Fix up PCI(E) GART DMA object bus address calculation.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 60d2a88a 05-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>


# 34cf01bc 21-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allow gpuobj vinst to be a virtual address when necessary

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b571fe21 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: tidy up PCIEGART implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4c136142 14-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>


# f869ef88 14-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: implement BAR1/BAR3 management on top of new VM code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a11c3198 26-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: import new vm code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 573a2a37 24-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>


# 7a45d764 21-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: wrap calls to ttm_bo_validate()

This will be used later to fixup bo.offset with a buffer's fixed GPU
virtual address.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 12fb9525 18-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: introduce a util function to wait on reg != val

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ceac3099 22-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: implicitly insert non-DMA objects into RAMHT

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6dccd311 18-Nov-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Synchronize with the user channel before GPU object destruction.

There have been reports of PFIFO cache errors during context take down
(fdo bug 31637). They are caused by some GPU objects being taken out
while the channel is still potentially processing commands. Make sure
that all the previous rendering has landed before releasing a GPU
object.

Reported-by: Grzesiek Sójka <pld@pfu.pl>
Reported-by: Patrice Mandin <patmandin@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7f4a195f 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: tidy up and extend dma object creation interfaces

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7b4808bb 14-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove dummy page use from PCI(E)GART, use PTE present instead

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 20f63afe 14-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: allocate page for unknown PFB object in nv50_fb.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e41115d0 31-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: rework gpu-specific instmem interfaces

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# dc1e5c0d 24-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: simplify gpuobj suspend/resume

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fce2bad0 10-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: rework PGPIO IRQ handling and hotplug detection

Allows callers to install their own handlers for when a GPIO line
changes state (such as for hotplug detect).

This also fixes a bug where we weren't acknowledging the GPIO IRQ
until after the bottom half had run, causing a severe IRQ storm
in some cases.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 274fec93 02-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: tidy+move PGRAPH ISRs to their respective *_graph.c files

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5178d40d 02-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: move PFIFO ISR into nv04_fifo.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2cbd4c81 02-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: move GPIO ISR to nv50_gpio.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8f8a5448 02-Nov-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allow irq handlers to be installed by engine-specific code

Lets start to clean up this mess!

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 87a326a3 24-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv20: Add Z compression support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a5cf68b0 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>


# e419cf09 25-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Add a separate class for the kernel channel mutex.

nouveau_bo_move_m2mf() needs to lock the kernel channel, and it may be
called from the pushbuf IOCTL with an user channel already locked. Use
a separate subclass for the kernel channel mutex because this is
legitimate mutex nesting.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 1f6d2de2 24-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv50: Keep track of the head a channel is vsync'ing to.

In a multihead setup vblank interrupts may end up enabled in both
heads. In that case we want to ignore the vblank interrupts coming
from the wrong CRTC to avoid tearing and unbalanced calls to
drm_vblank_get/put (fdo bug 31074).

Reported-by: Felix Leimbach <felix.leimbach@gmx.net>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 332b242f 20-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Implement the pageflip ioctl.

nv0x-nv4x should be mostly fine, nv50 doesn't work yet.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 042206c0 21-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Implement the vblank DRM hooks.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 382d62e5 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>


# 35fa2f2a 20-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add support for MSI

Only supported on NV50+ so far, and disabled by default currently. The
module parameter "msi=1" will enable it.

There's a kernel bug which will cause this to fail if the module (or the
NVIDIA binary driver) has ever been loaded before loading nouveau with
MSI enabled. As such, this is only safe to enable if you have nouveau
load on boot, and don't wish to ever reload it.

The workaround is to "echo 0 > /sys/bus/pci/devices/<device>/enable"
until the enable count reads 0. Then you should be able to load nouveau
with MSI enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 1e96268a 18-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: initial work to allow multiple evo channels

This doesn't work yet for unknown reasons.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# bd2e597d 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv84: add support for the PCRYPT engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b8c157d3 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: only expose the object classes that are supported by the chipset

We previously added all the available classes for the entire generation,
even though the objects wouldn't work on the hardware.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a6a1a380 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: use object class structs more extensively

The structs themselves, as well as the non-sw object creation function are
probably very misnamed now. That's a problem for later :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 50536946 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: store engine type in gpuobj class structs

We will eventually want to address hw engines other than PGRAPH.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 9100468d 14-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: pass gpuobj alignment request down into backing allocator

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f091a3d4 17-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Implement weak channel references.

nouveau_channel_ref() takes a "weak" channel reference that doesn't
prevent the hardware channel resources from being released, it just
keeps the channel data structure alive.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# feeb0aec 17-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Add unlocked variants of nouveau_channel_get/put.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3945e475 17-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Refactor context destruction to avoid a lock ordering issue.

The destroy_context() engine hooks call gpuobj management functions to
release the channel resources, these functions use HARDIRQ-unsafe locks
whereas destroy_context() is called with the HARDIRQ-safe
context_switch_lock held, that's a lock ordering violation.

Push the engine-specific channel destruction logic into destroy_context()
and let the hardware-specific code lock and unlock when it's actually
needed. Change the engine destruction order to avoid a race in the small
gap between pgraph and pfifo context uninitialization.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6032649d 11-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: hook up acpi power supply change tracking

Not used at all yet, but lets hook it up now anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 21e86c1c 10-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove cpu_writers lock

No other driver uses this, and userspace should be responsible for handling
locking between them if they share BOs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# cff5c133 06-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add more fine-grained locking to channel list + structures

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6a6b73f2 05-Oct-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add per-channel mutex, use to lock access to drm's channel

This fixes a race condition between fbcon acceleration and TTM buffer
moves. To reproduce:

- start X
- switch to vt and "while (true); do dmesg; done"
- switch to another vt and "sleep 2 && cat /path/to/debugfs/dri/0/evict_vram"
- switch back to vt running dmesg

We don't make use of this on any other channel yet, they're currently
protected by drm_global_mutex. This will change in the near future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ab838338 16-Nov-2010 Andy Lutomirski <luto@mit.edu>

nouveau: Acknowledge HPD irq in handler, not bottom half

The old code generated an interrupt storm bad enough to completely
take down my system.

Signed-off-by: Andy Lutomirski <luto@mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 56ac7475 21-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>


# f13b3263 09-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Expose some BO usage flags to userspace.

This will be needed for Z compression and to take smarter placement
decisions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# cbab95db 10-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>


# 8af29ccd 02-Oct-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv50: Fix large 3D performance regression caused by the interchannel sync patches.

Reported-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Maarten Maathuis <madman2003@gmail.com>
Tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0c6c1c2f 21-Sep-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Use semaphores to handle inter-channel sync in hardware.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8ac3891b 21-Sep-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Provide a means to have arbitrary work run on fence completion.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2730723b 21-Sep-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Minor refactoring/cleanup of the fence code.

Mainly to make room for inter-channel sync.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0cba1b76 29-Sep-2010 Marcin Kościelnicki <koriakin@0x04.net>

drm/nouveau: Add a module option to force card POST.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# aee582de 26-Sep-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: run perflvl and M table scripts on mem clock change

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5c6dc657 26-Sep-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: pass perflvl struct to clock_pre()

On certain boards, there's BIOS scripts and memory timings that need to
be modified with the memclk. Just pass in the entire perflvl struct and
let the chipset-specific code decide what to do.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 7760fcb0 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>


# 8155cac4 23-Sep-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Refactor nouveau_temp_get() into engine pointers.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 34e9d85a 22-Sep-2010 Martin Peres <martin.peres@ensi-bourges.fr>

drm/nouveau: Add temperature support (vbios parsing, readings, hwmon)

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6f876986 16-Sep-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: allow static performance level setting

Guarded by a module parameter for the moment, read the code for the
magic value which enables it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 330c5988 15-Sep-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: import initial work on vbios performance table parsing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 855a95e4 15-Sep-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: make the behaviour of get_pll_limits() consistent

This replaces all the pll_types definitions for ones that match the types
used in the tables in recent VBIOS versions.

get_pll_limits() will now accept either type or register value as input
across all limits table versions, and will store the actual register ID
that a PLL type refers to in the returned structure.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 9f56b126 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>


# 4b5c152a 07-Sep-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Remove implicit argument from nv_wait().

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# de5899bd 07-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>


# d96773e7 02-Sep-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: move vm trap to nv50_fb.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 185abecc 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove nouveau_gpuobj_late_takedown

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e05d7eae 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: protect gpuobj list + global instmem heap with spinlock

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# eb9bcbdc 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: fix gpuobj refcount to use atomics

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e05c5a31 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: tidy ram{ht,fc,ro} a bit

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# fbd2895e 31-Aug-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>


# 6c3d7ef2 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>


# 5125bfd8 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

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>


# 43efc9ce 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: simplify fake gpu objects

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a8eaebc6 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

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>


# de3a6c0a 31-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: rebase per-channel pramin heap offsets to 0

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b3beb167 31-Aug-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>


# 2a7fdb2b 30-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: have nv_mask return original register value

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# acae116c 15-Aug-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Use a helper function to match PCI device/subsystem IDs.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 415e6186 22-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: fix race condition when under memory pressure

When VRAM is running out it's possible that the client's push buffers get
evicted to main memory. When they're validated back in, the GPU may
be used for the copy back to VRAM, but the existing synchronisation code
only deals with inter-channel sync, not sync between PFIFO and PGRAPH on
the same channel. This leads to PFIFO fetching from command buffers that
haven't quite been copied by PGRAPH yet.

This patch marks push buffers as so, and forces any GPU-assisted buffer
moves to be done on a different channel, which triggers the correct
synchronisation to happen before we submit them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4b223eef 02-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nvc0: starting point for GF100 support, everything stubbed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 4a9f822f 20-Jul-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv17-nv4x: Attempt to init some external TMDS transmitters.

sil164 and friends are the most common, usually they just need to be
poked once because a fixed configuration is enough for any modes and
clocks, so they worked without this patch if the BIOS had done a good
job on POST. Display couldn't survive a suspend/resume cycle though.
Unfortunately, BIOS scripts are useless here.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 0d3470d2 02-Aug-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove unused ttm bo list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ba4420c2 08-Mar-2010 Dave Airlie <airlied@redhat.com>

drm: move ttm global code to core drm

I wrote this for the prime sharing work, but I also noticed other external
non-upstream drivers from a large company carrying a similiar patch, so I
may as well ship it in master.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# ee2e0131 25-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: introduce gpio engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c88c2e06 24-Jul-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Move display init to a new nouveau_engine.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e04d8e82 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>


# 8bded189 21-Jul-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv30: Init the PFB+0x3xx memory timing regs.

Fixes the randomly flashing vertical lines seen on some nv3x after a
cold-boot.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# d0875edd 22-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: add function to control GPIO IRQ reporting

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 49eed80a 22-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add nv_mask register accessor

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 5620ba46 22-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: fix build without CONFIG_ACPI

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a6ed76d7 11-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: support fetching LVDS EDID from ACPI

Based on a patch from Matthew Garrett.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Matthew Garrett <mjg@redhat.com>


# 734ee835 14-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: use correct PRAMIN flush register on original nv50

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 047d1d3c 30-May-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: reduce usage of fence spinlock to when absolutely necessary

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# c50a5681 07-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv20-nv30: move context table object out of dev_priv

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ac94a343 07-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: cleanup nv50_fifo.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 3b569e0f 07-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove unused fbdev_info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ec91db26 07-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove ability to use external firmware

This was always really a developer option, and if it's really necessary we
can hack this in ourselves.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 63187215 07-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: move tlb flushing to a helper function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f56cb86f 07-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>


# b6d3d871 06-Jun-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove dev_priv->init_state and friends

Nouveau will no longer load at all if card initialisation fails, so all
these checks are unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 87c0e0e5 05-Jul-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: rewrite display irq handler

The previous handler basically worked correctly for a full-blown mode
change. However, it did nothing at all when a partial (encoder only)
reconfiguation was necessary, leading to the display hanging on certain
types of mode switch.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8ccfe9e0 04-Jul-2010 Francisco Jerez <currojerez@riseup.net>

drm/nv04-nv40: Prevent invalid DAC/TVDAC combinations.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8f1a6086 27-Jun-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: tidy connector/encoder creation a little

Create connectors before encoders to avoid having to do another loop across
encoder list whenever we create a new connector. This allows us to pass
the connector to the encoder creation functions, and avoid using a
create_resources() callback since we can now call it directly.

This can also potentially modify the connector ordering on nv50. On cards
where the DCB connector and encoder tables are in the same order, things
will be unchanged. However, there's some cards where the ordering between
the tables differ, and in one case, leads us to naming the connectors
"wrongly".

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# b833ac26 31-May-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>


# afeb3e11 06-Apr-2010 Dave Airlie <airlied@redhat.com>

drm/nouveau: attempt to get bios from ACPI v3

Some of the laptops with the switchable graphics, seem to not post the secondary GPU at all, and we can't find a copy of the BIOS anywhere except in the ACPI rom retrieval.

This adds support for ACPI ROM retrieval to nouveau.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# e9ebb68b 27-Apr-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: support fractional feedback divider on newer chips

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 06415c56 16-May-2010 Marcin Slusarz <marcin.slusarz@gmail.com>

fbmem, drm/nouveau: kick firmware framebuffers as soon as possible

Currently vesafb/efifb/... is kicked when hardware driver is registering
framebuffer. To do it hardware must be fully functional, so there's a short
window between start of initialisation and framebuffer registration when
two drivers touch the hardware. Unfortunately sometimes it breaks nouveau
initialisation.

Fix it by kicking firmware driver(s) before we start touching the hardware.

Reported-by: Didier Spaier <didier.spaier@epsm.fr>
Tested-by: Didier Spaier <didier.spaier@epsm.fr>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>


# 45284162 06-Apr-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: implement gpio set/get routines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a5acac66 29-Mar-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: punt hotplug irq handling out to workqueue

On DP outputs we'll likely end up running vbios init tables here, which
may sleep.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a76fb4e8 17-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>


# 952eb635 17-Mar-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove some unused members from drm_nouveau_private

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 78ad0f7b 18-Mar-2010 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Make use of TTM busy_placements.

Previously we were filling it the same as "placements", but in some
cases there're valid alternatives that we were ignoring completely.
Keeping a back-up memory type helps on several low-mem situations.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 8be48d92 29-Mar-2010 Dave Airlie <airlied@redhat.com>

drm/kms/fb: move to using fb helper crtc grouping instead of core crtc list

This move to using the list of crtcs in the fb helper and cleans up the
whole picking code, now we store the crtc/connectors we want directly
into the modeset and we use the modeset directly to set the mode.

Fixes from James Simmons and Ben Skeggs.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# 38651674 29-Mar-2010 Dave Airlie <airlied@redhat.com>

drm/fb: fix fbdev object model + cleanup properly.

The fbdev layer in the kms code should act like a consumer of the kms services and avoid having relying on information being store in the kms core structures in order for it to work.

This patch

a) removes the info pointer/psuedo palette from the core drm_framebuffer structure and moves it to the fbdev helper layer, it also removes the core drm keeping a list of kernel kms fbdevs.
b) migrated all the fb helper functions out of the crtc helper file into the fb helper file.
c) pushed the fb probing/hotplug control into the driver
d) makes the surface sizes into a structure for ease of passing
This changes the intel/radeon/nouveau drivers to use the new helper.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# f4053509 14-Mar-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add module option to disable TV detection

Intended to be used as a workaround in cases where we falsely detect
that a TV is connected when it's not.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# da647d5b 03-Mar-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: add option to allow override of dcb connector table types

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 304424e1 28-Feb-2010 Marcin Kościelnicki <koriakin@0x04.net>

drm/nv50: Improve PGRAPH interrupt handling.

This makes nouveau recognise and report more kinds of PGRAPH errors, as
well as prevent GPU lockups resulting from some of them.

Lots of guesswork was involved and some part of this is probably
incorrect. Some potential-lockuop situations are handled by just
resetting a whole PGRAPH subunit, which doesn't sound like a "proper"
solution, but seems to work just fine... for now.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 2f41a7f1 02-Mar-2010 Dave Airlie <airlied@redhat.com>

drm/nouveau: fix *staging* driver build with switcheroo off.

This driver is in *staging*. Fix the build with the switcheroo off.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# 8edb381d 01-Mar-2010 Dave Airlie <airlied@redhat.com>

vga_switcheroo: fix build on platforms with no ACPI

radeon was always including the atpx code unnecessarily, also core
switcheroo was including acpi headers.

Signed-off-by: Dave Airlie <airlied@redhat.com>


# 6a9ee8af 31-Jan-2010 Dave Airlie <airlied@linux.ie>

vga_switcheroo: initial implementation (v15)

Many new laptops now come with 2 gpus, one to be used for low power
modes and one for gaming/on-ac applications. These GPUs are typically
wired to the laptop panel and VGA ports via a multiplexer unit which
is controlled via ACPI methods.

4 combinations of systems typically exist - with 2 ACPI methods.
Intel/ATI - Lenovo W500/T500 - use ATPX ACPI method
ATI/ATI - some ASUS - use ATPX ACPI Method
Intel/Nvidia - - use _DSM ACPI method
Nvidia/Nvidia - - use _DSM ACPI method.

TODO:
This patch adds support for the ATPX method and initial bits
for the _DSM methods that need to written by someone with
access to the hardware.
Add a proper non-debugfs interface - need to get some proper
testing first.

v2: add power up/down support for both devices
on W500 puts i915/radeon into D3 and cuts power to radeon.

v3: redo probing methods, no DMI list, drm devices call to
register with switcheroo, it tries to find an ATPX method on
any device and once there is two devices + ATPX it inits the
switcher.

v4: ATPX msg handling using buffers - should work on more machines

v5: rearchitect after more mjg59 discussion - move ATPX handling to
radeon driver.

v6: add file headers + initial nouveau bits (to be filled out).

v7: merge delayed switcher code.

v8: avoid suspend/resume of gpu that is off

v9: rearchitect - mjg59 is always right. - move all ATPX code to
radeon, should allow simpler DSM also proper ATRM handling

v10: add ATRM support for radeon BIOS, add mutex to lock vgasr_priv

v11: fix bug in resuming Intel for 2nd time.

v12: start fixing up nvidia code blindly.

v13: blindly guess at finishing nvidia code

v14: remove radeon audio hacks - fix up intel resume more like upstream

v15: clean up printks + remove unnecessary igd/dis pointers

mount debugfs

/sys/kernel/debug/vgaswitcheroo/switch - should exist if ATPX detected
+ 2 cards.

DIS - immediate change to discrete
IGD - immediate change to IGD
DDIS - delayed change to discrete
DIGD - delayed change to IGD
ON - turn on not in use
OFF - turn off not in use

Tested on W500 (Intel/ATI) and T500 (Intel/ATI)

Signed-off-by: Dave Airlie <airlied@redhat.com>


# d5f3c90d 24-Feb-2010 Marcin Kościelnicki <koriakin@0x04.net>

drm/nv50: Implement ctxprog/state generation.

This removes dependence on external firmware for NV50 generation cards.
If the generated ctxprogs don't work for you for some reason, please
report it.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 04a39c57 23-Feb-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: merge nvbios and nouveau_bios_info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a1606a95 11-Feb-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: new gem pushbuf interface, bump to 0.0.16

This commit breaks the userspace interface, and requires a new libdrm for
nouveau to operate again.

The multiple GEM_PUSHBUF ioctls that were present in 0.0.15 for
compatibility purposes are now gone, and replaced with the new ioctl which
allows for multiple push buffers to be submitted (necessary for hw index
buffers in the nv50 3d driver) and relocations to be applied on any buffer.

A number of other ioctls (CARD_INIT, GEM_PIN, GEM_UNPIN) that were needed
for userspace modesetting have also been removed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 9a391ad8 10-Feb-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nv50: switch to indirect push buffer controls

PFIFO on G80 and up has a new mode where the main ring buffer is simply a
ring of pointers to indirect buffers containing the actual command/data
packets. In order to be able to implement index buffers in the 3D driver
we need to be able to submit data-only push buffers right after the cmd
packet header, which is only possible using the new command submission
method.

This commit doesn't make it possible to implement index buffers yet, some
userspace interface changes will be required, but it does allow for
testing/debugging of the hardware-side support in the meantime.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ff9e5279 01-Feb-2010 Maarten Maathuis <madman2003@gmail.com>

drm/nouveau: protect channel create/destroy and irq handler with a spinlock

The nv50 pgraph handler (for example) could reenable pgraph fifo access
and that would be bad when pgraph context is being unloaded (we need the
guarantee a ctxprog isn't running).

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 76befb8c 19-Feb-2010 Ben Skeggs <bskeggs@redhat.com>

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>


# 3ad2f3fb 02-Feb-2010 Daniel Mack <daniel@caiaq.de>

tree-wide: Assorted spelling fixes

In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# a32ed69d 26-Jan-2010 Marcin Kościelnicki <koriakin@0x04.net>

drm/nouveau: Add module options to disable acceleration.

noaccel=1 disables all acceleration and doesn't even attempt
initialising PGRAPH+PFIFO, nofbaccel=1 only makes fbcon unaccelerated.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# a1470890 17-Jan-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: report LVDS as disconnected if lid closed

Also adds a module option to ignore the status reported via ACPI, in case
we hit systems with broken ACPI.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ac8fb975 14-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>


# c63834e1 07-Jan-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: initialise DMA tracking parameters earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# e9dd8e11 03-Jan-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove unused nouveau_channel_idle() function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ca4362ad 25-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Allocate a per-channel instance of NV_SW.

It will be useful for various synchronization purposes, mostly stolen
from "[PATCH] drm/nv50: synchronize user channel after buffer object
move on kernel channel" by Maarten Maathuis.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 02076da9 17-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Clean up the nv17-nv4x load detection code a bit.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 287c1532 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>


# 0d87c100 15-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Pre-G80 tiling support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 617e234b 13-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Add cache_flush/pull fifo engine functions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 75c99da6 07-Jan-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: initialise DMA tracking parameters earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 61768bf1 03-Jan-2010 Ben Skeggs <bskeggs@redhat.com>

drm/nouveau: remove unused nouveau_channel_idle() function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# f03a314b 25-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Allocate a per-channel instance of NV_SW.

It will be useful for various synchronization purposes, mostly stolen
from "[PATCH] drm/nv50: synchronize user channel after buffer object
move on kernel channel" by Maarten Maathuis.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 11d6eb2a 17-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Clean up the nv17-nv4x load detection code a bit.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# a0af9add 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>


# cb00f7c1 15-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Pre-G80 tiling support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 588d7d12 13-Dec-2009 Francisco Jerez <currojerez@riseup.net>

drm/nouveau: Add cache_flush/pull fifo engine functions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>


# 054b93e4 15-Dec-2009 Ben Skeggs <bskeggs@redhat.com>

drm/nv40: implement ctxprog/state generation

The context programs are *very* simple compared to the ones used by
the binary driver. There's notes in nv40_grctx.c explaining most of
the things we don't implement. If we discover if/why any of it is
required further down the track, we'll handle it then.

The PGRAPH state generated for each chipset should match what NVIDIA
do almost exactly (there's a couple of exceptions). If someone has
a lot of time on their hands, they could figure out the mapping of
object/method to PGRAPH register and demagic the initial state a little,
it's not terribly important however.

At time of commit, confirmed to be working at least well enough for
accelerated X (and where tested, for 3D apps) on NV40, NV43, NV44, NV46,
NV49, NV4A, NV4B and NV4E.

A module option has been added to force the use of external firmware
blobs if it becomes required.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# ef2bb506 13-Dec-2009 Maarten Maathuis <madman2003@gmail.com>

drm/nouveau: use drm debug levels

- Use driver level (0x2) for NV_DEBUG instead of all levels
- Create a NV_DEBUG_KMS for KMS level (0x4) and use them in modesetting code
- Remove a few odd NV_TRACE calls and replace some of them with NV_DEBUG_KMS or
NV_INFO

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>


# 6ee73861 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>