drm/nouveau/gem: use bo.offset rather than mm_node.start

Won't necessarily be a drm_mm_node in the future, and I can't think of any
good reason to not use the offset from the bo struct.  There may have been
some reason once apon a time, but, separate commit just in case.

Signed-off-by: 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>
drm/nouveau/agp: move all agp stuff into its own source file

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/core: pull in most of the new core infrastructure

This commit provides most of the infrastructure to support a major overhaul
of Nouveau's internals coming in the following commits.  This work aims to
take all the things we've learned over the last several years, and turn that
into a cleaner architecture that's more maintainable going forward.

RAMHT and MM bits of the new core have been left out for the moment, and
will be pulled in as I go through the process of porting the code to
become either subdev or engine modules.

There are several main goals I wanted to achieve through this work:

-- Reduce complexity

The goal here was to make each component of the driver as independent as
possible, which will ease maintainability and readability, and provide a
good base for resetting locked up GPU units in the future.

-- Better tracking of GPU units that are required at any given time

This is for future PM work, we'll be able to tell exactly what parts of the
GPU we need powered at any given point (etc).

-- Expose all available NVIDIA GPUs to the client

In order to support things such as multi-GPU channels, we want to be able
to expose all the NVIDIA GPUs to the client over a single file descriptor
so it can send a single push buffer to multiple GPUs.

-- Untangle the core hardware support code from the DRM implementation

This happened initially as an unexpected side-effect of developing the
initial core infrastructure in userspace, but it turned into a goal of
the whole project.  Initial benefits will be the availablility of a
number of userspace tools and tests using the same code as the driver
itself, but will also be important as I look into some virtualisation
ideas.

v2: Ben Skeggs <bskeggs@redhat.com>
- fix duplicate assignments noticed by clang
- implement some forgotten yelling in error path
- ensure 64-bit engine mask is used everywhere

v3: Marcin Slusarz <marcin.slusarz@gmail.com>
- sparse fixes

Signed-off-by: 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>
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>
drm/nouveau/bios: pull in basic vbios subdev, more to come later

v2: Ben Skeggs <bskeggs@redhat.com>
- use unaligned macros to access vbios image
- endianness fixes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/oldbios: remove shadowing support, use bios subdev's image

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/gpio: port gpio to subdev interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/i2c: port to subdev interfaces

v2: Ben Skeggs <bskeggs@redhat.com>
- fix typo in default bus selection

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/clk: implement stub clock subdev

Signed-off-by: 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>
drm/nouveau: implement devinit subdev, and new init table parser

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/mc: port to subdev interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/timer: port to subdev interfaces

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/core: add support for reverse mm allocations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nv50-/instmem: allocate vram for kernel objects from end of vram

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/fb: merge fb/vram and port to subdev interfaces

Signed-off-by: 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>
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>