Commit graph

349511 commits

Author SHA1 Message Date
Marcin Slusarz
ec49b5c2fb 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>
2013-02-20 16:00:43 +10:00
Marcin Slusarz
07df30435e 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>
2013-02-20 16:00:42 +10:00
Marcin Slusarz
d0a5191dcf 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>
2013-02-20 16:00:42 +10:00
Marcin Slusarz
134fc03275 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>
2013-02-20 16:00:41 +10:00
Marcin Slusarz
a84fa1a32e 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>
2013-02-20 16:00:41 +10:00
Marcin Slusarz
3969f05bb8 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>
2013-02-20 16:00:40 +10:00
Marcin Slusarz
b795016cd2 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>
2013-02-20 16:00:39 +10:00
Marcin Slusarz
a441dbb1d6 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>
2013-02-20 16:00:39 +10:00
Marcin Slusarz
03e9a04050 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>
2013-02-20 16:00:38 +10:00
Cong Ding
b5d8f05204 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>
2013-02-20 16:00:37 +10:00
Marcin Slusarz
fd69aee427 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>
2013-02-20 16:00:37 +10:00
Marcin Slusarz
fc3109a2cb 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>
2013-02-20 16:00:36 +10:00
Marcin Slusarz
cd897837ea drm/nouveau: quiet static-related sparse noise
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:36 +10:00
Marcin Slusarz
bfd8bd1f81 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>
2013-02-20 16:00:35 +10:00
Marcin Slusarz
950fbfab42 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>
2013-02-20 16:00:34 +10:00
Marcin Slusarz
a4cea27b69 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>
2013-02-20 16:00:34 +10:00
Martin Peres
a624bafbf1 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>
2013-02-20 16:00:33 +10:00
Marcin Slusarz
93260d3c02 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>
2013-02-20 16:00:33 +10:00
Marcin Slusarz
a2896cede0 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>
2013-02-20 16:00:32 +10:00
Marcin Slusarz
f533da1027 drm/nouveau: use pr_cont
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:31 +10:00
Marcin Slusarz
fc10199ee3 drm/nouveau: split fifo interrupt handler
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:31 +10:00
Martin Peres
3600ad5e1b 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>
2013-02-20 16:00:30 +10:00
Emil Velikov
f1aa4a1de5 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>
2013-02-20 16:00:30 +10:00
Ben Skeggs
708ff04b13 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>
2013-02-20 16:00:29 +10:00
Ben Skeggs
e8c3cc0803 drm/nouveau/bios: rename DCB_GPIO_PWM_FAN to DCB_GPIO_FAN
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:28 +10:00
Ben Skeggs
112a12aab8 drm/nouveau/bios: add support for parsing xpio table data
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:28 +10:00
Ben Skeggs
230881821a drm/nouveau: remove some more unnecessary legacy bios code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:27 +10:00
Ben Skeggs
e84e4b67dd drm/nouveau: remove legacy vbios type detection
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:26 +10:00
Ben Skeggs
5e90a88cb3 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>
2013-02-20 16:00:26 +10:00
Ben Skeggs
b2c36312c9 drm/nouveau/hwmon: s/fan0/fan1/
Fan speed info now shown by sensors.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:25 +10:00
Ben Skeggs
1a22274b28 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>
2013-02-20 16:00:25 +10:00
Martin Peres
041d62469f 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>
2013-02-20 16:00:24 +10:00
Martin Peres
12e32896f7 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>
2013-02-20 16:00:24 +10:00
Martin Peres
0083b91dac 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>
2013-02-20 16:00:23 +10:00
Martin Peres
9d7175c808 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>
2013-02-20 16:00:23 +10:00
Ben Skeggs
382b5bbb4a drm/nvc0/bus: report useful data on mmio fault
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:22 +10:00
Martin Peres
a10220bbf8 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>
2013-02-20 16:00:21 +10:00
Martin Peres
694472f417 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>
2013-02-20 16:00:21 +10:00
Martin Peres
fa37e8dda2 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>
2013-02-20 16:00:20 +10:00
Martin Peres
06afd4e83b 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>
2013-02-20 16:00:20 +10:00
Martin Peres
0cbf83bbe5 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>
2013-02-20 16:00:19 +10:00
Ben Skeggs
9c3bd3a531 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>
2013-02-20 16:00:18 +10:00
Ben Skeggs
68197b4ba0 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>
2013-02-20 16:00:18 +10:00
Ben Skeggs
9cbcd3374a drm/nvd0/therm: add support for hardware fan tachometer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:17 +10:00
Ben Skeggs
7b49bd684c drm/nva3/therm: add support for hardware fan tachometer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:17 +10:00
Ben Skeggs
d639b4f5ba 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>
2013-02-20 16:00:16 +10:00
Ben Skeggs
5f066c32a5 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>
2013-02-20 16:00:16 +10:00
Ben Skeggs
bc79202f4c nvd0/therm: implement more appropriate pwm fan control functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-02-20 16:00:15 +10:00
Linus Torvalds
88b62b915b Linux 3.8-rc6 2013-02-01 12:08:14 +11:00
Linus Torvalds
cc6c954a07 A fix for stacked dm thin devices and a fix for the new dm WRITE SAME
support.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJRCn+IAAoJEK2W1qbAHj1naQEP/2eXMOslRyws7M6CcsEgpEK9
 N2L2hf6bD3xF/04ZSLbHFI6hPe9wDXSL9Vxd+DRLYTSnc0E9WYBXHmE6Eb0L0xK8
 m0Iubk/hi7mk6mnMJtpTFT5pazBTPhVz0nXOijguh5U6PW0xL+4ypXe9nrH2jtW0
 DvEHFDIPbKcqwplm8nvo/QJ5O3YNQaMifKUtpXF/JWGlCYP4vPk0dJVg9ATbscEV
 Fg3kefoJzZM09q3Uvo01wigbj+wRkpBK9+CiyW6XcE0lkOAnFmpvyYerIoAHAK37
 Rsw5J4aMPA9U8mggBEtlHBWa0q5utZafHM11lT2ZeFGCXkdn+TSWni6O7ov54xPP
 Cd7jx+uNpe/OuLT5YjbCg2IMXgJs+zIZMSeqSj3SrywE0a0EQHECWiXaFmMmrCCJ
 TgZtmp/HS1UsdoiHA3v3ZX3AaX4W+mggYp/5md9P1vHyYS9uTlgSVplhwtVgsL23
 EsDxNNxODSIFMAMnrXxAV+NBPiQRY42K22hK/RrnWew9roAQHxroIvQDmzzm5ZRL
 BqCFW3w/x2loJOZZ6NH/J8IUEoF9RhCK1tOGVjFuAVn30srt3zXb4pOzYeydykT7
 m04HaGO7rCBJI75XdVDhm6ozOvV/GhXF2fJOt4qyoX/X6M8YN5i0jfwC3rhKeuOe
 U9fyyYoQV37EWIRI9K5Q
 =qtaF
 -----END PGP SIGNATURE-----

Merge tag 'dm-3.8-fixes-2' of git://git.kernel.org/pub/scm/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
2013-02-01 12:04:22 +11:00