openwrt/staging/blogic.git
11 years agodrm/nouveau: restore debugfs/vbios.rom support
Marcin Slusarz [Fri, 8 Feb 2013 20:42:13 +0000 (21:42 +0100)]
drm/nouveau: restore debugfs/vbios.rom support

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
11 years agodrm/nv50-/kms: remove UPDATE methods after each encoder disconnect
Ben Skeggs [Wed, 20 Feb 2013 10:37:15 +0000 (20:37 +1000)]
drm/nv50-/kms: remove UPDATE methods after each encoder disconnect

Supervisor can now handle more than one operation within a single
series of interrupts.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvd0/disp: handle multiple actions from one set of supervisor intrs
Ben Skeggs [Wed, 20 Feb 2013 09:21:08 +0000 (19:21 +1000)]
drm/nvd0/disp: handle multiple actions from one set of supervisor intrs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/disp: handle multiple actions from one set of supervisor intrs
Ben Skeggs [Wed, 20 Feb 2013 08:56:33 +0000 (18:56 +1000)]
drm/nv50/disp: handle multiple actions from one set of supervisor intrs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agonouveau: ACPI support depends on X86 and X86_PLATFORM_DEVICES
Ben Hutchings [Wed, 20 Feb 2013 02:57:32 +0000 (02:57 +0000)]
nouveau: ACPI support depends on X86 and X86_PLATFORM_DEVICES

If I build nouveau on ia64, Kconfig warns:

warning: (DRM_NOUVEAU) selects ACPI_WMI which has unmet direct dependencies (X86 && X86_PLATFORM_DEVICES && ACPI)
warning: (DRM_NOUVEAU) selects MXM_WMI which has unmet direct dependencies (X86 && X86_PLATFORM_DEVICES && ACPI_WMI)

Make all the ACPI support depend on X86 and select
X86_PLATFORM_DEVICES.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: add support for ddc/aux, and dp link training on anx9805
Ben Skeggs [Thu, 14 Feb 2013 22:48:58 +0000 (17:48 -0500)]
drm/nouveau/i2c: add support for ddc/aux, and dp link training on anx9805

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50: initial kms support for off-chip TMDS/DP encoders
Ben Skeggs [Sun, 10 Feb 2013 23:52:58 +0000 (09:52 +1000)]
drm/nv50: initial kms support for off-chip TMDS/DP encoders

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/disp: initial supervisor support for off-chip encoders
Ben Skeggs [Sun, 10 Feb 2013 23:24:23 +0000 (09:24 +1000)]
drm/nv50-/disp: initial supervisor support for off-chip encoders

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/disp: initial work towards supporting external encoders
Ben Skeggs [Sun, 10 Feb 2013 23:11:08 +0000 (09:11 +1000)]
drm/nv50-/disp: initial work towards supporting external encoders

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/kms: remove unnecessary wait-for-completion points
Ben Skeggs [Wed, 20 Feb 2013 04:34:18 +0000 (14:34 +1000)]
drm/nv50-/kms: remove unnecessary wait-for-completion points

DP link training is now handled as part of the supervisor processing,
and can no longer race with it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/disp: move DP link training to core and train from supervisor
Ben Skeggs [Tue, 19 Feb 2013 04:17:53 +0000 (23:17 -0500)]
drm/nv50-/disp: move DP link training to core and train from supervisor

We need to be able to do link training for PIOR-connected ANX9805 from
the third supervisor handler (due to script ordering in the bios, can't
have the "user" call train because some settings are overwritten from
the modesetting bios scripts).

This moves link training for SOR-connected DP encoders to the second
supervisor interrupt, *before* we call the modesetting scripts (yes,
different ordering from PIOR is necessary).  This is useful since we
should now be able to remove some hacks to workaround races between
the supervisor and link training paths.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/disp: handle supervisor tasks from workqueue
Ben Skeggs [Mon, 18 Feb 2013 22:50:51 +0000 (17:50 -0500)]
drm/nv50-/disp: handle supervisor tasks from workqueue

i2c_algo_bit sleeps...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: create proper chipset-specific class implementations
Ben Skeggs [Sat, 16 Feb 2013 05:21:58 +0000 (15:21 +1000)]
drm/nouveau/i2c: create proper chipset-specific class implementations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50-/disp: 0x0000 is a valid udisp config value
Ben Skeggs [Sat, 16 Feb 2013 03:49:21 +0000 (13:49 +1000)]
drm/nv50-/disp: 0x0000 is a valid udisp config value

Return an out-of-range value instead to signal a failure from
exec_clkcmp().

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/devinit: reverse the logic for running encoder init scripts
Ben Skeggs [Sat, 16 Feb 2013 02:10:38 +0000 (12:10 +1000)]
drm/nv50/devinit: reverse the logic for running encoder init scripts

A single U encoder table can match multiple DCB entries, whereas the
reverse is not true and can lead to us not matching a DCB entry at
all, and fail to initialise some encoders.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: store a type/mask hash in parsed dcb data
Ben Skeggs [Sat, 16 Feb 2013 02:01:59 +0000 (12:01 +1000)]
drm/nouveau/bios: store a type/mask hash in parsed dcb data

Matches format used by a couple of other vbios tables, useful
to have laying around already calculated.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: extend type to 16-bits, add lookup-by-type function
Ben Skeggs [Sat, 16 Feb 2013 03:19:18 +0000 (13:19 +1000)]
drm/nouveau/i2c: extend type to 16-bits, add lookup-by-type function

For off-chip transmitters we won't necessarily have an i2c table entry
to lookup, but we can do it instead by encoding the type to include
the extdev type and looking that up instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: aux channels not necessarily on nvio
Ben Skeggs [Fri, 15 Feb 2013 01:59:41 +0000 (20:59 -0500)]
drm/nouveau/i2c: aux channels not necessarily on nvio

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: fix a bit of a thinko in nv_wri2cr helper functions
Ben Skeggs [Fri, 15 Feb 2013 00:54:42 +0000 (19:54 -0500)]
drm/nouveau/i2c: fix a bit of a thinko in nv_wri2cr helper functions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: parse external transmitter type if off-chip
Ben Skeggs [Tue, 12 Feb 2013 00:16:31 +0000 (10:16 +1000)]
drm/nouveau/bios: parse external transmitter type if off-chip

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: store i2c port pointer directly in nouveau_encoder
Ben Skeggs [Mon, 11 Feb 2013 10:15:03 +0000 (20:15 +1000)]
drm/nouveau: store i2c port pointer directly in nouveau_encoder

This is about to become somewhat more complicated to determine in a
number of cases, so store the "common" case (DDC/AUX) directly inside
the encoder structure.

Pre-nv50 code not touched except to fill the pointer, don't care.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/i2c: handle i2c/aux mux outside of port lookup function
Ben Skeggs [Mon, 11 Feb 2013 10:06:04 +0000 (20:06 +1000)]
drm/nouveau/i2c: handle i2c/aux mux outside of port lookup function

Not quite how I want it yet, but, I'll fix that at some point.  For
right now, it's needed because find() won't necessarily be used right
before a transaction anymore.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/graph: avoid touching 400724, it doesn't exist
Ben Skeggs [Sun, 17 Feb 2013 01:31:17 +0000 (11:31 +1000)]
drm/nv50/graph: avoid touching 400724, it doesn't exist

Harmless, but we now get MMIO fault reports, so silence it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: Fix DPMS 1 on G4 Snowball, from snow white to coal black.
Stefan de Konink [Sat, 22 Dec 2012 17:04:37 +0000 (18:04 +0100)]
drm/nouveau: Fix DPMS 1 on G4 Snowball, from snow white to coal black.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=40275.

Signed-off-by: Stefan de Konink <stefan@konink.de>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/disp: sizeof() wrong pointer
Dan Carpenter [Wed, 23 Jan 2013 08:27:56 +0000 (11:27 +0300)]
drm/nouveau/disp: sizeof() wrong pointer

"data" is a void pointer and "args" is "data" after we have casted it to
a struct.  We care about the size of the struct here.  Btw,
sizeof(*data) is 1.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv84-/fence: prepare for emit/sync support of sysram sequences
Ben Skeggs [Thu, 14 Feb 2013 03:43:21 +0000 (13:43 +1000)]
drm/nv84-/fence: prepare for emit/sync support of sysram sequences

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fence: make internal hooks part of the context
Ben Skeggs [Thu, 14 Feb 2013 03:20:17 +0000 (13:20 +1000)]
drm/nouveau/fence: make internal hooks part of the context

A step towards being able to provide fences from other engines not
connected to PFIFO.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv17/fence: split from nv10 code
Ben Skeggs [Thu, 14 Feb 2013 02:59:36 +0000 (12:59 +1000)]
drm/nv17/fence: split from nv10 code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv84-/fence: abstract class emit/sync functions to virt+sequence
Ben Skeggs [Wed, 13 Feb 2013 23:37:35 +0000 (09:37 +1000)]
drm/nv84-/fence: abstract class emit/sync functions to virt+sequence

Now can be used to operate on any buffer mapped into the GPU virtual
address and not just the main inter-channel sync buffer.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv84/fence: access fences with full virtual address, not offset
Ben Skeggs [Wed, 13 Feb 2013 23:28:37 +0000 (09:28 +1000)]
drm/nv84/fence: access fences with full virtual address, not offset

Allows most of the code to be shared between nv84/nvc0 implementations,
and paves the way for doing emit/sync on non-VRAM buffers (multi-gpu,
dma-buf).

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/gpio/nve0: interrupt regs moved on kepler apparently
Ben Skeggs [Wed, 13 Feb 2013 03:34:39 +0000 (13:34 +1000)]
drm/nouveau/gpio/nve0: interrupt regs moved on kepler apparently

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/gpio: use event interfaces for interrupt signalling
Ben Skeggs [Sun, 3 Feb 2013 02:56:16 +0000 (12:56 +1000)]
drm/nouveau/gpio: use event interfaces for interrupt signalling

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/gpio: pass number of on-die gpio lines to base
Ben Skeggs [Sun, 3 Feb 2013 21:08:20 +0000 (07:08 +1000)]
drm/nouveau/gpio: pass number of on-die gpio lines to base

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/drm: store full dcb gpio function data in connector
Ben Skeggs [Sun, 3 Feb 2013 10:29:53 +0000 (20:29 +1000)]
drm/nouveau/drm: store full dcb gpio function data in connector

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fence/nv84-: put processes to sleep while waiting on fences
Ben Skeggs [Thu, 31 Jan 2013 04:57:33 +0000 (14:57 +1000)]
drm/nouveau/fence/nv84-: put processes to sleep while waiting on fences

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fifo/nvc0: bash some magic reg to make uevent interrupt work
Ben Skeggs [Thu, 31 Jan 2013 22:43:55 +0000 (17:43 -0500)]
drm/nouveau/fifo/nvc0: bash some magic reg to make uevent interrupt work

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fifo/nv84: support user event trigger
Ben Skeggs [Thu, 31 Jan 2013 12:41:07 +0000 (22:41 +1000)]
drm/nouveau/fifo/nv84: support user event trigger

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fifo/nvc0-: use interrupt 31 as an event trigger
Ben Skeggs [Thu, 31 Jan 2013 03:51:20 +0000 (13:51 +1000)]
drm/nouveau/fifo/nvc0-: use interrupt 31 as an event trigger

Generated if you try and use fifo method 0x20 on any subchannel, appears
that it can be safely masked off without stalling the whole GPU.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/disp: port vblank handling to event interface
Ben Skeggs [Wed, 30 Jan 2013 23:23:34 +0000 (09:23 +1000)]
drm/nouveau/disp: port vblank handling to event interface

This removes the nastiness with the interactions between display and
software engines when handling vblank semaphore release interrupts.

Now, all the semantics are handled in one place (sw) \o/.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/disp/nv04: implement a base display object class
Ben Skeggs [Wed, 30 Jan 2013 23:04:48 +0000 (09:04 +1000)]
drm/nouveau/disp/nv04: implement a base display object class

Will be used for upcoming vblank event interfaces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/core: basic event interface between core and drm
Ben Skeggs [Wed, 30 Jan 2013 14:38:22 +0000 (00:38 +1000)]
drm/nouveau/core: basic event interface between core and drm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fifo/nvc0: improve interrupt handler somewhat
Ben Skeggs [Fri, 1 Feb 2013 00:49:33 +0000 (19:49 -0500)]
drm/nouveau/fifo/nvc0: improve interrupt handler somewhat

Logs extra info for interrupts that have a sub-status register, and
handles the "special" ack from INTR bit 31.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv50/disp: fix missing sor modectrl sync flags
Ben Skeggs [Mon, 11 Feb 2013 03:56:31 +0000 (13:56 +1000)]
drm/nv50/disp: fix missing sor modectrl sync flags

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: reduce stack usage of nouveau_therm_ic_ctor
Marcin Slusarz [Tue, 5 Feb 2013 19:44:19 +0000 (20:44 +0100)]
drm/nouveau/therm: reduce stack usage of nouveau_therm_ic_ctor

Before: 1496 bytes
After:   152 bytes

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: use workqueue to shutdown the machine
Marcin Slusarz [Sun, 3 Feb 2013 18:28:14 +0000 (19:28 +0100)]
drm/nouveau/therm: use workqueue to shutdown the machine

orderly_poweroff cannot be called from atomic context.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nv40/therm: reset temperature sensor on init
Marcin Slusarz [Sun, 3 Feb 2013 18:12:49 +0000 (19:12 +0100)]
drm/nv40/therm: reset temperature sensor on init

Current uninitialized sensor detection does not work for me on nv4b and
sensor returns crazy values (>190°C). It stabilises later, but it's too
late - therm code shutdowns the machine...

Let's just reset it on init.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: turn on fan only when threshold hit in positive direction
Marcin Slusarz [Sun, 3 Feb 2013 17:17:41 +0000 (18:17 +0100)]
drm/nouveau/therm: turn on fan only when threshold hit in positive direction

+ the same for shutdown threshold - seems impossible, but shutdown can fail.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: report channel owner in ioctl error paths
Marcin Slusarz [Sun, 3 Feb 2013 21:02:47 +0000 (22:02 +0100)]
drm/nouveau: report channel owner in ioctl error paths

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: always initialize alarm_program_lock
Marcin Slusarz [Wed, 30 Jan 2013 21:21:31 +0000 (22:21 +0100)]
drm/nouveau/therm: always initialize alarm_program_lock

Fixes "BUG: spinlock bad magic" on module load for nva3+ cards.

Introduced in commit "drm/nouveau/therm: implement support for temperature
alarms".

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: handle backlight_device_register failure
Marcin Slusarz [Sun, 27 Jan 2013 16:13:52 +0000 (17:13 +0100)]
drm/nouveau: handle backlight_device_register failure

Found by smatch.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: use kmemdup for edid allocation/copying
Marcin Slusarz [Sun, 27 Jan 2013 16:04:48 +0000 (17:04 +0100)]
drm/nouveau: use kmemdup for edid allocation/copying

Avoids potential null pointer dereference.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: use drm_property_create_range helper
Marcin Slusarz [Sun, 27 Jan 2013 15:43:00 +0000 (16:43 +0100)]
drm/nouveau: use drm_property_create_range helper

Avoids potential null pointer dereference.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: remove unnecessary null pointer check from nouveau_fence_new
Cong Ding [Tue, 15 Jan 2013 17:19:49 +0000 (18:19 +0100)]
drm/nouveau: remove unnecessary null pointer check from nouveau_fence_new

the variable chan is dereferenced in line 190, so it is no reason to check
null again in line 198.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nvc0/graph: remove redundant null checks
Marcin Slusarz [Sun, 27 Jan 2013 15:11:18 +0000 (16:11 +0100)]
drm/nvc0/graph: remove redundant null checks

It's safe to call kfree(NULL).

Found by smatch.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fan: fix selection of fan speed when fan->get returns an error
Marcin Slusarz [Sun, 27 Jan 2013 14:51:09 +0000 (15:51 +0100)]
drm/nouveau/fan: fix selection of fan speed when fan->get returns an error

fan->get returns int, but we write it to unsigned variable, and then check
whether it's >= 0 (it always is)

Found by smatch:
drivers/gpu/drm/nouveau/core/subdev/therm/fan.c:61 nouveau_fan_update() warn: always true condition '(duty >= 0) => (0-u32max >= 0)'

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: quiet static-related sparse noise
Marcin Slusarz [Sun, 27 Jan 2013 14:01:55 +0000 (15:01 +0100)]
drm/nouveau: quiet static-related sparse noise

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: tiny debugging messages fixes
Marcin Slusarz [Sun, 30 Dec 2012 15:35:24 +0000 (16:35 +0100)]
drm/nouveau/bios: tiny debugging messages fixes

COPY_ZM_REG: destination and source addresses were swapped
RAM_RESTRICT_ZM_REG_GROUP: missing 0x prefix for register address

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: mark nv_printk_ as printf-like function
Marcin Slusarz [Sat, 29 Dec 2012 15:24:37 +0000 (16:24 +0100)]
drm/nouveau: mark nv_printk_ as printf-like function

...and fix all warnings

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: share fence structures between nv10+ and nv50 implementations
Marcin Slusarz [Tue, 25 Dec 2012 16:50:43 +0000 (17:50 +0100)]
drm/nouveau: share fence structures between nv10+ and nv50 implementations

We already rely on them having the same fields and layout.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fan: handle the cases where we are outside of the linear zone
Martin Peres [Thu, 20 Dec 2012 00:32:09 +0000 (01:32 +0100)]
drm/nouveau/fan: handle the cases where we are outside of the linear zone

This fixes a bug where, when temperature is outside of the linear range, fan
pwm would be outside of the allowed range ([0, 100]) and could get negative in
some cases.

It seems like a regression that happened when we re-worked the fan management
logic before merging.

Tested-by: Ozan Çağlayan <ozancag@gmail.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: report channel owner in error messages
Marcin Slusarz [Sun, 9 Dec 2012 22:00:34 +0000 (23:00 +0100)]
drm/nouveau: report channel owner in error messages

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: prepare for reporting channel owner
Marcin Slusarz [Sun, 9 Dec 2012 14:45:21 +0000 (15:45 +0100)]
drm/nouveau: prepare for reporting channel owner

- record channel owner process name
- add some helpers for accessing this information
- let nouveau_enum hold additional value (will be needed in the next patch)

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: use pr_cont
Marcin Slusarz [Sun, 9 Dec 2012 14:45:20 +0000 (15:45 +0100)]
drm/nouveau: use pr_cont

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: split fifo interrupt handler
Marcin Slusarz [Sun, 9 Dec 2012 14:45:19 +0000 (15:45 +0100)]
drm/nouveau: split fifo interrupt handler

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: force a minimum hysteresis on temperature alarm thresholds
Martin Peres [Sat, 8 Dec 2012 13:00:38 +0000 (14:00 +0100)]
drm/nouveau/therm: force a minimum hysteresis on temperature alarm thresholds

This should avoid the situation where a user gets its kernel logs flooded when
temperature oscillates around a threshold with 0°C hysteresis.

This patch is just meant to fix broken vbios (as reported on a nv4e on
sysfs hwmon interface.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: set legacy bios data before parsing the structure
Emil Velikov [Fri, 7 Dec 2012 17:26:44 +0000 (17:26 +0000)]
drm/nouveau: set legacy bios data before parsing the structure

Commit 767baf82 drm/nouveau: remove some more unnecessary legacy bios code

has introduced a regression my misplacing the code that sets the major/chip
versions, which are used whist parsing the bmp/bit structure in vbios

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: don't try pwm/toggle control if GPIO_FAN is input
Ben Skeggs [Fri, 7 Dec 2012 01:37:28 +0000 (11:37 +1000)]
drm/nouveau/therm: don't try pwm/toggle control if GPIO_FAN is input

My GTX660 has the GPIO_FAN function, but it's configured in input-mode;
presumably to monitor the frequency set by an I2C fan controller?

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: rename DCB_GPIO_PWM_FAN to DCB_GPIO_FAN
Ben Skeggs [Fri, 7 Dec 2012 01:01:25 +0000 (11:01 +1000)]
drm/nouveau/bios: rename DCB_GPIO_PWM_FAN to DCB_GPIO_FAN

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/bios: add support for parsing xpio table data
Ben Skeggs [Fri, 7 Dec 2012 00:31:09 +0000 (10:31 +1000)]
drm/nouveau/bios: add support for parsing xpio table data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: remove some more unnecessary legacy bios code
Ben Skeggs [Thu, 6 Dec 2012 05:44:23 +0000 (15:44 +1000)]
drm/nouveau: remove some more unnecessary legacy bios code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau: remove legacy vbios type detection
Ben Skeggs [Thu, 6 Dec 2012 05:32:56 +0000 (15:32 +1000)]
drm/nouveau: remove legacy vbios type detection

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/hwmon: create hwmon attributes under hwmon device in sysfs
Ben Skeggs [Thu, 6 Dec 2012 05:17:12 +0000 (15:17 +1000)]
drm/nouveau/hwmon: create hwmon attributes under hwmon device in sysfs

From browsing my /sys, a few other things seem to do this, and it looks
cleaner this way too :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/hwmon: s/fan0/fan1/
Ben Skeggs [Thu, 6 Dec 2012 05:13:06 +0000 (15:13 +1000)]
drm/nouveau/hwmon: s/fan0/fan1/

Fan speed info now shown by sensors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: better transitions and debug logging
Ben Skeggs [Thu, 6 Dec 2012 00:28:34 +0000 (10:28 +1000)]
drm/nouveau/therm: better transitions and debug logging

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/doc: document the sysfs thermal management interface
Martin Peres [Tue, 20 Nov 2012 01:29:22 +0000 (02:29 +0100)]
drm/nouveau/doc: document the sysfs thermal management interface

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/hwmon: add missing alarm thresholds
Martin Peres [Tue, 20 Nov 2012 00:14:13 +0000 (01:14 +0100)]
drm/nouveau/hwmon: add missing alarm thresholds

Expose all the hysteresis parameters + shutdown (emergency) +
fan_boost (fixed pwm trip point).

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: implement support for temperature alarms
Martin Peres [Sun, 4 Nov 2012 23:18:49 +0000 (00:18 +0100)]
drm/nouveau/therm: implement support for temperature alarms

For now, we only boost the fan speed to the maximum and auto-mode
when hitting the FAN_BOOST threshold and halt the computer when it
reaches the shutdown temperature. The downclock and critical thresholds
do nothing.

On nv43:50 and nva3+, temperature is polled because of the limited hardware.
I'll improve the nva3+ situation by implementing alarm management in PDAEMON
whenever I can but polling once every second shouldn't be such a problem.

v2 (Ben Skeggs):
- rebased

v3: fixed false-detections and threshold reprogrammation handling on nv50:nvc0

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nv41/bus: report useful data on mmio fault
Martin Peres [Fri, 7 Dec 2012 01:26:02 +0000 (02:26 +0100)]
drm/nv41/bus: report useful data on mmio fault

Based on Ben Skeggs's nvc0 patch. Tested on my nv4b, 84 and 92.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nvc0/bus: report useful data on mmio fault
Ben Skeggs [Tue, 4 Dec 2012 05:25:28 +0000 (15:25 +1000)]
drm/nvc0/bus: report useful data on mmio fault

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/pbus: add a PBUS subdev that hands IRQs to the right subdevs
Martin Peres [Sun, 4 Nov 2012 00:01:53 +0000 (01:01 +0100)]
drm/nouveau/pbus: add a PBUS subdev that hands IRQs to the right subdevs

We are going to use PTHERM's IRQs for thermal monitoring but we need to route
them first.

On nv31-50, PBUS's IRQ line is shared with GPIOs IRQs.

It seems like nv10-31 GPIO interruptions aren't well handled. I kept the
original behaviour but it is wrong and may lead to an IRQ storm.

Since we enable all PBUS IRQs, we need a way to avoid being stormed if we
don't handle them. The solution I used was to mask the IRQs that have not been
handled. This will also print one message in the logs to let us know.

v2: drop the shared intr handler because of was racy
v3: style fixes
v4: drop a useless construct in the chipset-dependent INTR
v5: add BUS to the disable mask
v6 (Ben Skeggs):
- general tidy to match the rest of the driver's style
- nva3->nvc0, nva3 can be serviced just fine with nv50.c, rnndb even notes
  that the THERM_ALARM bit got left in the hw until fermi anyway.. so, it's
  not going to conflict
- removed the peephole and user stuff, for the moment.. will handle them
  later if we find a good reason to actually care..
- limited INTR_EN to just what we can handle for now, mostly to prevent
  spam of unknown status bits (seen on at least nv4x)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/therm: implement automatic fan management
Martin Peres [Wed, 5 Dec 2012 10:28:09 +0000 (20:28 +1000)]
drm/nouveau/therm: implement automatic fan management

v2: improved design but drops safety monitoring (to be in a later patch)
v3: fix locking and mode management
v4: gently fallback to the no-control mode when temperature cannot be got
    and use kernel-provided min/max macros
v5 (Ben Skeggs):
- rebased on my previous patches
v6: fix hysterisis management in trip-based auto fan management

This commit also forbids access to fan management to nvc0+ chipsets as
fan management is already taken care of my PDAEMON's default fw.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/fan: obey fan bump/slow periods as defined by vbios
Martin Peres [Wed, 5 Dec 2012 09:46:35 +0000 (19:46 +1000)]
drm/nouveau/fan: obey fan bump/slow periods as defined by vbios

v2 (Ben Skeggs):
- split from larger patch
- fixed to not require alarm resched patch

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/bios: parse fan bump/slow periods, and trip points
Martin Peres [Wed, 5 Dec 2012 08:42:00 +0000 (18:42 +1000)]
drm/nouveau/bios: parse fan bump/slow periods, and trip points

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/fan: add toggle fan support
Martin Peres [Sun, 2 Sep 2012 23:37:02 +0000 (01:37 +0200)]
drm/nouveau/fan: add toggle fan support

v2: change percent from int to atomic_t
v3: random fixes
v4 (Ben Skeggs):
- adapted for split-out fan-control "protocol" structure
- removed need for timer resched
- support for forcing 'toggle' control on PWM boards

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/therm: cleanly separate pwm control logic from therm
Ben Skeggs [Wed, 5 Dec 2012 06:21:59 +0000 (16:21 +1000)]
drm/nouveau/therm: cleanly separate pwm control logic from therm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/therm: add interfaces to allow forcing off pwm fan control
Ben Skeggs [Wed, 5 Dec 2012 04:56:37 +0000 (14:56 +1000)]
drm/nouveau/therm: add interfaces to allow forcing off pwm fan control

Mostly to allow for the possibility of testing 'toggle' fan control easily.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nvd0/therm: add support for hardware fan tachometer
Ben Skeggs [Tue, 4 Dec 2012 02:10:19 +0000 (12:10 +1000)]
drm/nvd0/therm: add support for hardware fan tachometer

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nva3/therm: add support for hardware fan tachometer
Ben Skeggs [Tue, 4 Dec 2012 02:18:59 +0000 (12:18 +1000)]
drm/nva3/therm: add support for hardware fan tachometer

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agodrm/nouveau/therm: collect fan tach info in common fan constructor
Ben Skeggs [Tue, 4 Dec 2012 03:25:26 +0000 (13:25 +1000)]
drm/nouveau/therm: collect fan tach info in common fan constructor

This info will be used by two more implementations in upcoming commits.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agodrm/nouveau/therm: fix various style issues, make more consistent
Ben Skeggs [Tue, 4 Dec 2012 01:35:40 +0000 (11:35 +1000)]
drm/nouveau/therm: fix various style issues, make more consistent

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
11 years agonvd0/therm: implement more appropriate pwm fan control functions
Ben Skeggs [Mon, 3 Dec 2012 23:50:33 +0000 (09:50 +1000)]
nvd0/therm: implement more appropriate pwm fan control functions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11 years agoLinux 3.8-rc6
Linus Torvalds [Fri, 1 Feb 2013 01:08:14 +0000 (12:08 +1100)]
Linux 3.8-rc6

11 years agoMerge tag 'dm-3.8-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm
Linus Torvalds [Fri, 1 Feb 2013 01:04:22 +0000 (12:04 +1100)]
Merge tag 'dm-3.8-fixes-2' of git://git./linux/kernel/git/agk/linux-dm

Pull more device-mapper fixes from Alasdair G Kergon:
 "A fix for stacked dm thin devices and a fix for the new dm WRITE SAME
  support."

* tag 'dm-3.8-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm:
  dm: fix write same requests counting
  dm thin: fix queue limits stacking

11 years agoMerge branch 'for-3.8/upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Thu, 31 Jan 2013 21:44:59 +0000 (08:44 +1100)]
Merge branch 'for-3.8/upstream-fixes' of git://git./linux/kernel/git/jikos/hid

PullHID fixes from Jiri Kosina:

 - fix i2c-hid and hidraw interaction, by Benjamin Tissoires

 - a quirk to make a particular device (Formosa IR receiver) work
   properly, by Nicholas Santos

* 'for-3.8/upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: i2c-hid: fix i2c_hid_output_raw_report
  HID: usbhid: quirk for Formosa IR receiver
  HID: remove x bit from sensor doc

11 years agoMerge tag 'nfs-for-3.8-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Linus Torvalds [Thu, 31 Jan 2013 21:43:52 +0000 (08:43 +1100)]
Merge tag 'nfs-for-3.8-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:

 - Error reporting in nfs_xdev_mount incorrectly maps all errors to
   ENOMEM

 - Fix an NFSv4 refcounting issue

 - Fix a mount failure when the server reboots during NFSv4 trunking
   discovery

 - NFSv4.1 mounts may need to run the lease recovery thread.

 - Don't silently fail setattr() requests on mountpoints

 - Fix a SUNRPC socket/transport livelock and priority queue issue

 - We must handle NFS4ERR_DELAY when resetting the NFSv4.1 session.

* tag 'nfs-for-3.8-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFSv4.1: Handle NFS4ERR_DELAY when resetting the NFSv4.1 session
  SUNRPC: When changing the queue priority, ensure that we change the owner
  NFS: Don't silently fail setattr() requests on mountpoints
  NFSv4.1: Ensure that nfs41_walk_client_list() does start lease recovery
  NFSv4: Fix NFSv4 trunking discovery
  NFSv4: Fix NFSv4 reference counting for trunked sessions
  NFS: Fix error reporting in nfs_xdev_mount

11 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Linus Torvalds [Thu, 31 Jan 2013 21:43:04 +0000 (08:43 +1100)]
Merge branch 'upstream' of git://git.linux-mips.org/ralf/upstream-linus

Pull MIPS updates from Ralf Baechle:
 "A number of fixes all across the MIPS tree.  No area is particularly
  standing out and things have cooled down quite nicely for a release."

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MIPS: Function tracer: Fix broken function tracing
  mips: Move __virt_addr_valid() to a place for MIPS 64
  MIPS: Netlogic: Fix UP compilation on XLR
  MIPS: AR71xx: Fix AR71XX_PCI_MEM_SIZE
  MIPS: AR724x: Fix AR724X_PCI_MEM_SIZE
  MIPS: Lantiq: Fix cp0_perfcount_irq mapping
  MIPS: DSP: Fix DSP mask for registers.
  MIPS: Fix build failure by adding definition of pfn_pmd().
  MIPS: Octeon: Fix warning.
  MIPS: delay.c: Check BITS_PER_LONG instead of __SIZEOF_LONG__
  MIPS: PNX833x: Fix comment.
  MIPS: Add struct p_format to union mips_instruction.
  MIPS: Export <asm/break.h>.
  MIPS: BCM47xx: Enable SSB prerequisite SSB_DRIVER_PCICORE.
  MIPS: BCM47xx: Select GPIOLIB for BCMA on bcm47xx platform
  MIPS: vpe.c: Fix null pointer dereference in print arguments.

11 years agoHID: i2c-hid: fix i2c_hid_output_raw_report
Benjamin Tissoires [Thu, 31 Jan 2013 16:50:02 +0000 (17:50 +0100)]
HID: i2c-hid: fix i2c_hid_output_raw_report

i2c_hid_output_raw_report is used by hidraw to forward set_report requests.
The current implementation of i2c_hid_set_report needs to take the
report_id as an argument. The report_id is stored in the first byte
of the buffer in argument of i2c_hid_output_raw_report.

Not removing the report_id from the given buffer adds this byte 2 times
in the command, leading to a non working command.

Reported-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoMIPS: Function tracer: Fix broken function tracing
Al Cooper [Wed, 16 Jan 2013 22:43:28 +0000 (22:43 +0000)]
MIPS: Function tracer: Fix broken function tracing

Function tracing is currently broken for all 32 bit MIPS platforms.
When tracing is enabled, the kernel immediately hangs on boot.
This is a result of commit b732d439cb43336cd6d7e804ecb2c81193ef63b0
that changes the kernel/trace/Kconfig file so that is no longer
forces FRAME_POINTER when FUNCTION_TRACING is enabled.

MIPS frame pointers are generally considered to be useless because
they cannot be used to unwind the stack. Unfortunately the MIPS
function tracing code has bugs that are masked by the use of frame
pointers. This commit fixes the bugs so that MIPS frame pointers
don't need to be enabled.

The bugs are a result of the odd calling sequence used to call the trace
routine. This calling sequence is inserted into every traceable function
when the tracing CONFIG option is enabled. This sequence is generated
for 32bit MIPS platforms by the compiler via the "-pg" flag.

Part of the sequence is "addiu sp,sp,-8" in the delay slot after every
call to the trace routine "_mcount" (some legacy thing where 2 arguments
used to be pushed on the stack). The _mcount routine is expected to
adjust the sp by +8 before returning.  So when not disabled, the original
jalr and addiu will be there, so _mcount has to adjust sp.

The problem is that when tracing is disabled for a function, the
"jalr _mcount" instruction is replaced with a nop, but the
"addiu sp,sp,-8" is still executed and the stack pointer is left
trashed. When frame pointers are enabled the problem is masked
because any access to the stack is done through the frame
pointer and the stack pointer is restored from the frame pointer when
the function returns.

This patch writes two nops starting at the address of the "jalr _mcount"
instruction whenever tracing is disabled. This means that the
"addiu sp,sp.-8" will be converted to a nop along with the "jalr".  When
disabled, there will be two nops.

This is SMP safe because the first time this happens is during
ftrace_init() which is before any other processor has been started.
Subsequent calls to enable/disable tracing when other CPUs ARE running
will still be safe because the enable will only change the first nop
to a "jalr" and the disable, while writing 2 nops, will only be changing
the "jalr". This patch also stops using stop_machine() to call the
tracer enable/disable routines and calls them directly because the
routines are SMP safe.

When the kernel first boots we have to be able to handle the gcc
generated jalr, addui sequence until ftrace_init gets a chance to run
and change the sequence. At this point mcount just adjusts the stack
and returns. When ftrace_init runs, we convert the jalr/addui to nops.
Then whenever tracing is enabled we convert the first nop to a "jalr
mcount+8". The mcount+8 entry point skips the stack adjust.

[ralf@linux-mips.org: Folded in  Steven Rostedt's build fix.]

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Cc: rostedt@goodmis.org
Cc: ddaney.cavm@gmail.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/4806/
Patchwork: https://patchwork.linux-mips.org/patch/4841/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
11 years agodm: fix write same requests counting
Alasdair G Kergon [Thu, 31 Jan 2013 14:23:36 +0000 (14:23 +0000)]
dm: fix write same requests counting

When processing write same requests, fix dm to send the configured
number of WRITE SAME requests to the target rather than the number of
discards, which is not always the same.

Device-mapper WRITE SAME support was introduced by commit
23508a96cd2e857d57044a2ed7d305f2d9daf441 ("dm: add WRITE SAME support").

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
11 years agomips: Move __virt_addr_valid() to a place for MIPS 64
Steven Rostedt [Fri, 25 Jan 2013 17:13:15 +0000 (17:13 +0000)]
mips: Move __virt_addr_valid() to a place for MIPS 64

Commit d3ce88431892 "MIPS: Fix modpost error in modules attepting to use
virt_addr_valid()" moved __virt_addr_valid() from a macro in a header
file to a function in ioremap.c. But ioremap.c is only compiled for MIPS
32, and not for MIPS 64.

When compiling for my yeeloong2, which supposedly supports hibernation,
which compiles kernel/power/snapshot.c which calls virt_addr_valid(), I
got this error:

  LD      init/built-in.o
kernel/built-in.o: In function `memory_bm_free':
snapshot.c:(.text+0x4c9c4): undefined reference to `__virt_addr_valid'
snapshot.c:(.text+0x4ca58): undefined reference to `__virt_addr_valid'
kernel/built-in.o: In function `snapshot_write_next':
(.text+0x4e44c): undefined reference to `__virt_addr_valid'
kernel/built-in.o: In function `snapshot_write_next':
(.text+0x4e890): undefined reference to `__virt_addr_valid'
make[1]: *** [vmlinux] Error 1
make: *** [sub-make] Error 2

I suspect that __virt_addr_valid() is fine for mips 64. I moved it to
mmap.c such that it gets compiled for mips 64 and 32.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/4842/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>