Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 "Radeon, intel and nouveau, along with one mgag200 fix

   - intel fix for an ioctl overflow, along with a regression fix for
     some phantom irqs on Ironlake.
   - nouveau has a lockdep warning and a bunch of thermal fixes
   - radeon has new pci ids and some minor fixes."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (26 commits)
  drm/mgag200: Bug fix: Modified pll algorithm for EH project
  drm/i915: stop using GMBUS IRQs on Gen4 chips
  drm/nv50/kms: prevent lockdep false-positive in page flipping path
  drm/nouveau/core: fix return value of nouveau_object_del()
  MAINTAINERS: intel-gfx is no longer subscribers-only
  drm/i915: Use the fixed pixel clock for eDP in intel_dp_set_m_n()
  drm/nouveau/hwmon: do not expose a buggy temperature if it is unavailable
  drm/nouveau/therm: display the availability of the internal sensor
  drm/nouveau/therm: disable temperature management if the sensor isn't readable
  drm/nouveau/therm: disable auto fan management if temperature is not available
  drm/nv40/therm: reserve negative temperatures for errors
  drm/nv40/therm: disable temperature reading if the bios misses some parameters
  drm/nouveau/therm-ic: the temperature is off by sensor_constant, warn the user
  drm/nouveau/therm: remove some confusion introduced by therm_mode
  drm/nouveau/therm: do not make assumptions on temperature
  drm/nv40/therm: increase the sensor's settling delay to 20ms
  drm/nv40/therm: improve selection between the old and the new style
  Revert "drm/i915: try to train DP even harder"
  drm/radeon: add Richland pci ids
  drm/radeon: add support for Richland APUs
  ...
This commit is contained in:
Linus Torvalds 2013-03-21 08:27:58 -07:00
commit 172a271b5e
19 changed files with 205 additions and 92 deletions

View File

@ -2623,7 +2623,7 @@ F: include/uapi/drm/
INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
M: Daniel Vetter <daniel.vetter@ffwll.ch> M: Daniel Vetter <daniel.vetter@ffwll.ch>
L: intel-gfx@lists.freedesktop.org (subscribers-only) L: intel-gfx@lists.freedesktop.org
L: dri-devel@lists.freedesktop.org L: dri-devel@lists.freedesktop.org
T: git git://people.freedesktop.org/~danvet/drm-intel T: git git://people.freedesktop.org/~danvet/drm-intel
S: Supported S: Supported

View File

@ -103,7 +103,7 @@ static const char *cache_level_str(int type)
static void static void
describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
{ {
seq_printf(m, "%p: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", seq_printf(m, "%pK: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s",
&obj->base, &obj->base,
get_pin_flag(obj), get_pin_flag(obj),
get_tiling_flag(obj), get_tiling_flag(obj),

View File

@ -732,6 +732,8 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
int count) int count)
{ {
int i; int i;
int relocs_total = 0;
int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr;
@ -740,10 +742,13 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS)
return -EINVAL; return -EINVAL;
/* First check for malicious input causing overflow */ /* First check for malicious input causing overflow in
if (exec[i].relocation_count > * the worst case where we need to allocate the entire
INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) * relocation tree as a single array.
*/
if (exec[i].relocation_count > relocs_max - relocs_total)
return -EINVAL; return -EINVAL;
relocs_total += exec[i].relocation_count;
length = exec[i].relocation_count * length = exec[i].relocation_count *
sizeof(struct drm_i915_gem_relocation_entry); sizeof(struct drm_i915_gem_relocation_entry);

View File

@ -820,6 +820,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
struct intel_link_m_n m_n; struct intel_link_m_n m_n;
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
int target_clock;
/* /*
* Find the lane count in the intel_encoder private * Find the lane count in the intel_encoder private
@ -835,13 +836,22 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
} }
} }
target_clock = mode->clock;
for_each_encoder_on_crtc(dev, crtc, intel_encoder) {
if (intel_encoder->type == INTEL_OUTPUT_EDP) {
target_clock = intel_edp_target_clock(intel_encoder,
mode);
break;
}
}
/* /*
* Compute the GMCH and Link ratios. The '3' here is * Compute the GMCH and Link ratios. The '3' here is
* the number of bytes_per_pixel post-LUT, which we always * the number of bytes_per_pixel post-LUT, which we always
* set up for 8-bits of R/G/B, or 3 bytes total. * set up for 8-bits of R/G/B, or 3 bytes total.
*/ */
intel_link_compute_m_n(intel_crtc->bpp, lane_count, intel_link_compute_m_n(intel_crtc->bpp, lane_count,
mode->clock, adjusted_mode->clock, &m_n); target_clock, adjusted_mode->clock, &m_n);
if (IS_HASWELL(dev)) { if (IS_HASWELL(dev)) {
I915_WRITE(PIPE_DATA_M1(cpu_transcoder), I915_WRITE(PIPE_DATA_M1(cpu_transcoder),
@ -1930,7 +1940,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
for (i = 0; i < intel_dp->lane_count; i++) for (i = 0; i < intel_dp->lane_count; i++)
if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0)
break; break;
if (i == intel_dp->lane_count && voltage_tries == 5) { if (i == intel_dp->lane_count) {
++loop_tries; ++loop_tries;
if (loop_tries == 5) { if (loop_tries == 5) {
DRM_DEBUG_KMS("too many full retries, give up\n"); DRM_DEBUG_KMS("too many full retries, give up\n");

View File

@ -203,7 +203,13 @@ intel_gpio_setup(struct intel_gmbus *bus, u32 pin)
algo->data = bus; algo->data = bus;
} }
#define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 4) /*
* gmbus on gen4 seems to be able to generate legacy interrupts even when in MSI
* mode. This results in spurious interrupt warnings if the legacy irq no. is
* shared with another device. The kernel then disables that interrupt source
* and so prevents the other device from working properly.
*/
#define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5)
static int static int
gmbus_wait_hw_status(struct drm_i915_private *dev_priv, gmbus_wait_hw_status(struct drm_i915_private *dev_priv,
u32 gmbus2_status, u32 gmbus2_status,
@ -214,6 +220,9 @@ gmbus_wait_hw_status(struct drm_i915_private *dev_priv,
u32 gmbus2 = 0; u32 gmbus2 = 0;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
if (!HAS_GMBUS_IRQ(dev_priv->dev))
gmbus4_irq_en = 0;
/* Important: The hw handles only the first bit, so set only one! Since /* Important: The hw handles only the first bit, so set only one! Since
* we also need to check for NAKs besides the hw ready/idle signal, we * we also need to check for NAKs besides the hw ready/idle signal, we
* need to wake up periodically and check that ourselves. */ * need to wake up periodically and check that ourselves. */

View File

@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
m = n = p = 0; m = n = p = 0;
vcomax = 800000; vcomax = 800000;
vcomin = 400000; vcomin = 400000;
pllreffreq = 3333; pllreffreq = 33333;
delta = 0xffffffff; delta = 0xffffffff;
permitteddelta = clock * 5 / 1000; permitteddelta = clock * 5 / 1000;
for (testp = 16; testp > 0; testp--) { for (testp = 16; testp > 0; testp >>= 1) {
if (clock * testp > vcomax) if (clock * testp > vcomax)
continue; continue;
if (clock * testp < vcomin) if (clock * testp < vcomin)
continue; continue;
for (testm = 1; testm < 33; testm++) { for (testm = 1; testm < 33; testm++) {
for (testn = 1; testn < 257; testn++) { for (testn = 17; testn < 257; testn++) {
computed = (pllreffreq * testn) / computed = (pllreffreq * testn) /
(testm * testp); (testm * testp);
if (computed > clock) if (computed > clock)
@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
if (tmpdelta < delta) { if (tmpdelta < delta) {
delta = tmpdelta; delta = tmpdelta;
n = testn - 1; n = testn - 1;
m = (testm - 1) | ((n >> 1) & 0x80); m = (testm - 1);
p = testp - 1; p = testp - 1;
} }
if ((clock * testp) >= 600000) if ((clock * testp) >= 600000)
p |= 80; p |= 0x80;
} }
} }
} }

View File

@ -278,7 +278,6 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle)
struct nouveau_object *parent = NULL; struct nouveau_object *parent = NULL;
struct nouveau_object *namedb = NULL; struct nouveau_object *namedb = NULL;
struct nouveau_handle *handle = NULL; struct nouveau_handle *handle = NULL;
int ret = -EINVAL;
parent = nouveau_handle_ref(client, _parent); parent = nouveau_handle_ref(client, _parent);
if (!parent) if (!parent)
@ -295,7 +294,7 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle)
} }
nouveau_object_ref(NULL, &parent); nouveau_object_ref(NULL, &parent);
return ret; return handle ? 0 : -EINVAL;
} }
int int

View File

@ -4,7 +4,7 @@
#include <core/device.h> #include <core/device.h>
#include <core/subdev.h> #include <core/subdev.h>
enum nouveau_therm_mode { enum nouveau_therm_fan_mode {
NOUVEAU_THERM_CTRL_NONE = 0, NOUVEAU_THERM_CTRL_NONE = 0,
NOUVEAU_THERM_CTRL_MANUAL = 1, NOUVEAU_THERM_CTRL_MANUAL = 1,
NOUVEAU_THERM_CTRL_AUTO = 2, NOUVEAU_THERM_CTRL_AUTO = 2,

View File

@ -134,7 +134,7 @@ nouveau_therm_alarm(struct nouveau_alarm *alarm)
} }
int int
nouveau_therm_mode(struct nouveau_therm *therm, int mode) nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode)
{ {
struct nouveau_therm_priv *priv = (void *)therm; struct nouveau_therm_priv *priv = (void *)therm;
struct nouveau_device *device = nv_device(therm); struct nouveau_device *device = nv_device(therm);
@ -149,10 +149,15 @@ nouveau_therm_mode(struct nouveau_therm *therm, int mode)
(mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0))
return -EINVAL; return -EINVAL;
/* do not allow automatic fan management if the thermal sensor is
* not available */
if (priv->mode == 2 && therm->temp_get(therm) < 0)
return -EINVAL;
if (priv->mode == mode) if (priv->mode == mode)
return 0; return 0;
nv_info(therm, "Thermal management: %s\n", name[mode]); nv_info(therm, "fan management: %s\n", name[mode]);
nouveau_therm_update(therm, mode); nouveau_therm_update(therm, mode);
return 0; return 0;
} }
@ -213,7 +218,7 @@ nouveau_therm_attr_set(struct nouveau_therm *therm,
priv->fan->bios.max_duty = value; priv->fan->bios.max_duty = value;
return 0; return 0;
case NOUVEAU_THERM_ATTR_FAN_MODE: case NOUVEAU_THERM_ATTR_FAN_MODE:
return nouveau_therm_mode(therm, value); return nouveau_therm_fan_mode(therm, value);
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST:
priv->bios_sensor.thrs_fan_boost.temp = value; priv->bios_sensor.thrs_fan_boost.temp = value;
priv->sensor.program_alarms(therm); priv->sensor.program_alarms(therm);
@ -263,7 +268,7 @@ _nouveau_therm_init(struct nouveau_object *object)
return ret; return ret;
if (priv->suspend >= 0) if (priv->suspend >= 0)
nouveau_therm_mode(therm, priv->mode); nouveau_therm_fan_mode(therm, priv->mode);
priv->sensor.program_alarms(therm); priv->sensor.program_alarms(therm);
return 0; return 0;
} }
@ -313,11 +318,12 @@ nouveau_therm_create_(struct nouveau_object *parent,
int int
nouveau_therm_preinit(struct nouveau_therm *therm) nouveau_therm_preinit(struct nouveau_therm *therm)
{ {
nouveau_therm_ic_ctor(therm);
nouveau_therm_sensor_ctor(therm); nouveau_therm_sensor_ctor(therm);
nouveau_therm_ic_ctor(therm);
nouveau_therm_fan_ctor(therm); nouveau_therm_fan_ctor(therm);
nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_NONE); nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_NONE);
nouveau_therm_sensor_preinit(therm);
return 0; return 0;
} }

View File

@ -32,6 +32,7 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c,
struct i2c_board_info *info) struct i2c_board_info *info)
{ {
struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c);
struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
struct i2c_client *client; struct i2c_client *client;
request_module("%s%s", I2C_MODULE_PREFIX, info->type); request_module("%s%s", I2C_MODULE_PREFIX, info->type);
@ -46,8 +47,9 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c,
} }
nv_info(priv, nv_info(priv,
"Found an %s at address 0x%x (controlled by lm_sensors)\n", "Found an %s at address 0x%x (controlled by lm_sensors, "
info->type, info->addr); "temp offset %+i C)\n",
info->type, info->addr, sensor->offset_constant);
priv->ic = client; priv->ic = client;
return true; return true;

View File

@ -29,54 +29,83 @@ struct nv40_therm_priv {
struct nouveau_therm_priv base; struct nouveau_therm_priv base;
}; };
static int enum nv40_sensor_style { INVALID_STYLE = -1, OLD_STYLE = 0, NEW_STYLE = 1 };
nv40_sensor_setup(struct nouveau_therm *therm)
static enum nv40_sensor_style
nv40_sensor_style(struct nouveau_therm *therm)
{ {
struct nouveau_device *device = nv_device(therm); struct nouveau_device *device = nv_device(therm);
switch (device->chipset) {
case 0x43:
case 0x44:
case 0x4a:
case 0x47:
return OLD_STYLE;
case 0x46:
case 0x49:
case 0x4b:
case 0x4e:
case 0x4c:
case 0x67:
case 0x68:
case 0x63:
return NEW_STYLE;
default:
return INVALID_STYLE;
}
}
static int
nv40_sensor_setup(struct nouveau_therm *therm)
{
enum nv40_sensor_style style = nv40_sensor_style(therm);
/* enable ADC readout and disable the ALARM threshold */ /* enable ADC readout and disable the ALARM threshold */
if (device->chipset >= 0x46) { if (style == NEW_STYLE) {
nv_mask(therm, 0x15b8, 0x80000000, 0); nv_mask(therm, 0x15b8, 0x80000000, 0);
nv_wr32(therm, 0x15b0, 0x80003fff); nv_wr32(therm, 0x15b0, 0x80003fff);
mdelay(10); /* wait for the temperature to stabilize */ mdelay(20); /* wait for the temperature to stabilize */
return nv_rd32(therm, 0x15b4) & 0x3fff; return nv_rd32(therm, 0x15b4) & 0x3fff;
} else { } else if (style == OLD_STYLE) {
nv_wr32(therm, 0x15b0, 0xff); nv_wr32(therm, 0x15b0, 0xff);
mdelay(20); /* wait for the temperature to stabilize */
return nv_rd32(therm, 0x15b4) & 0xff; return nv_rd32(therm, 0x15b4) & 0xff;
} } else
return -ENODEV;
} }
static int static int
nv40_temp_get(struct nouveau_therm *therm) nv40_temp_get(struct nouveau_therm *therm)
{ {
struct nouveau_therm_priv *priv = (void *)therm; struct nouveau_therm_priv *priv = (void *)therm;
struct nouveau_device *device = nv_device(therm);
struct nvbios_therm_sensor *sensor = &priv->bios_sensor; struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
enum nv40_sensor_style style = nv40_sensor_style(therm);
int core_temp; int core_temp;
if (device->chipset >= 0x46) { if (style == NEW_STYLE) {
nv_wr32(therm, 0x15b0, 0x80003fff); nv_wr32(therm, 0x15b0, 0x80003fff);
core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; core_temp = nv_rd32(therm, 0x15b4) & 0x3fff;
} else { } else if (style == OLD_STYLE) {
nv_wr32(therm, 0x15b0, 0xff); nv_wr32(therm, 0x15b0, 0xff);
core_temp = nv_rd32(therm, 0x15b4) & 0xff; core_temp = nv_rd32(therm, 0x15b4) & 0xff;
} } else
return -ENODEV;
/* Setup the sensor if the temperature is 0 */ /* if the slope or the offset is unset, do no use the sensor */
if (core_temp == 0) if (!sensor->slope_div || !sensor->slope_mult ||
core_temp = nv40_sensor_setup(therm); !sensor->offset_num || !sensor->offset_den)
return -ENODEV;
if (sensor->slope_div == 0)
sensor->slope_div = 1;
if (sensor->offset_den == 0)
sensor->offset_den = 1;
if (sensor->slope_mult < 1)
sensor->slope_mult = 1;
core_temp = core_temp * sensor->slope_mult / sensor->slope_div; core_temp = core_temp * sensor->slope_mult / sensor->slope_div;
core_temp = core_temp + sensor->offset_num / sensor->offset_den; core_temp = core_temp + sensor->offset_num / sensor->offset_den;
core_temp = core_temp + sensor->offset_constant - 8; core_temp = core_temp + sensor->offset_constant - 8;
/* reserve negative temperatures for errors */
if (core_temp < 0)
core_temp = 0;
return core_temp; return core_temp;
} }

View File

@ -102,7 +102,7 @@ struct nouveau_therm_priv {
struct i2c_client *ic; struct i2c_client *ic;
}; };
int nouveau_therm_mode(struct nouveau_therm *therm, int mode); int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode);
int nouveau_therm_attr_get(struct nouveau_therm *therm, int nouveau_therm_attr_get(struct nouveau_therm *therm,
enum nouveau_therm_attr_type type); enum nouveau_therm_attr_type type);
int nouveau_therm_attr_set(struct nouveau_therm *therm, int nouveau_therm_attr_set(struct nouveau_therm *therm,
@ -122,6 +122,7 @@ int nouveau_therm_fan_sense(struct nouveau_therm *therm);
int nouveau_therm_preinit(struct nouveau_therm *); int nouveau_therm_preinit(struct nouveau_therm *);
void nouveau_therm_sensor_preinit(struct nouveau_therm *);
void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm,
enum nouveau_therm_thrs thrs, enum nouveau_therm_thrs thrs,
enum nouveau_therm_thrs_state st); enum nouveau_therm_thrs_state st);

View File

@ -34,10 +34,6 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm)
{ {
struct nouveau_therm_priv *priv = (void *)therm; struct nouveau_therm_priv *priv = (void *)therm;
priv->bios_sensor.slope_mult = 1;
priv->bios_sensor.slope_div = 1;
priv->bios_sensor.offset_num = 0;
priv->bios_sensor.offset_den = 1;
priv->bios_sensor.offset_constant = 0; priv->bios_sensor.offset_constant = 0;
priv->bios_sensor.thrs_fan_boost.temp = 90; priv->bios_sensor.thrs_fan_boost.temp = 90;
@ -60,11 +56,6 @@ nouveau_therm_temp_safety_checks(struct nouveau_therm *therm)
struct nouveau_therm_priv *priv = (void *)therm; struct nouveau_therm_priv *priv = (void *)therm;
struct nvbios_therm_sensor *s = &priv->bios_sensor; struct nvbios_therm_sensor *s = &priv->bios_sensor;
if (!priv->bios_sensor.slope_div)
priv->bios_sensor.slope_div = 1;
if (!priv->bios_sensor.offset_den)
priv->bios_sensor.offset_den = 1;
/* enforce a minimum hysteresis on thresholds */ /* enforce a minimum hysteresis on thresholds */
s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2);
s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2);
@ -106,16 +97,16 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
const char *thresolds[] = { const char *thresolds[] = {
"fanboost", "downclock", "critical", "shutdown" "fanboost", "downclock", "critical", "shutdown"
}; };
uint8_t temperature = therm->temp_get(therm); int temperature = therm->temp_get(therm);
if (thrs < 0 || thrs > 3) if (thrs < 0 || thrs > 3)
return; return;
if (dir == NOUVEAU_THERM_THRS_FALLING) if (dir == NOUVEAU_THERM_THRS_FALLING)
nv_info(therm, "temperature (%u C) went below the '%s' threshold\n", nv_info(therm, "temperature (%i C) went below the '%s' threshold\n",
temperature, thresolds[thrs]); temperature, thresolds[thrs]);
else else
nv_info(therm, "temperature (%u C) hit the '%s' threshold\n", nv_info(therm, "temperature (%i C) hit the '%s' threshold\n",
temperature, thresolds[thrs]); temperature, thresolds[thrs]);
active = (dir == NOUVEAU_THERM_THRS_RISING); active = (dir == NOUVEAU_THERM_THRS_RISING);
@ -123,7 +114,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm,
case NOUVEAU_THERM_THRS_FANBOOST: case NOUVEAU_THERM_THRS_FANBOOST:
if (active) { if (active) {
nouveau_therm_fan_set(therm, true, 100); nouveau_therm_fan_set(therm, true, 100);
nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO); nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO);
} }
break; break;
case NOUVEAU_THERM_THRS_DOWNCLOCK: case NOUVEAU_THERM_THRS_DOWNCLOCK:
@ -202,7 +193,7 @@ alarm_timer_callback(struct nouveau_alarm *alarm)
NOUVEAU_THERM_THRS_SHUTDOWN); NOUVEAU_THERM_THRS_SHUTDOWN);
/* schedule the next poll in one second */ /* schedule the next poll in one second */
if (list_empty(&alarm->head)) if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head))
ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm);
spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags);
@ -225,6 +216,17 @@ nouveau_therm_program_alarms_polling(struct nouveau_therm *therm)
alarm_timer_callback(&priv->sensor.therm_poll_alarm); alarm_timer_callback(&priv->sensor.therm_poll_alarm);
} }
void
nouveau_therm_sensor_preinit(struct nouveau_therm *therm)
{
const char *sensor_avail = "yes";
if (therm->temp_get(therm) < 0)
sensor_avail = "no";
nv_info(therm, "internal sensor: %s\n", sensor_avail);
}
int int
nouveau_therm_sensor_ctor(struct nouveau_therm *therm) nouveau_therm_sensor_ctor(struct nouveau_therm *therm)
{ {

View File

@ -402,8 +402,12 @@ nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf)
struct drm_device *dev = dev_get_drvdata(d); struct drm_device *dev = dev_get_drvdata(d);
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_therm *therm = nouveau_therm(drm->device); struct nouveau_therm *therm = nouveau_therm(drm->device);
int temp = therm->temp_get(therm);
return snprintf(buf, PAGE_SIZE, "%d\n", therm->temp_get(therm) * 1000); if (temp < 0)
return temp;
return snprintf(buf, PAGE_SIZE, "%d\n", temp * 1000);
} }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp,
NULL, 0); NULL, 0);
@ -871,7 +875,12 @@ static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO | S_IWUSR,
nouveau_hwmon_get_pwm1_max, nouveau_hwmon_get_pwm1_max,
nouveau_hwmon_set_pwm1_max, 0); nouveau_hwmon_set_pwm1_max, 0);
static struct attribute *hwmon_attributes[] = { static struct attribute *hwmon_default_attributes[] = {
&sensor_dev_attr_name.dev_attr.attr,
&sensor_dev_attr_update_rate.dev_attr.attr,
NULL
};
static struct attribute *hwmon_temp_attributes[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr,
&sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
@ -882,8 +891,6 @@ static struct attribute *hwmon_attributes[] = {
&sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,
&sensor_dev_attr_temp1_emergency.dev_attr.attr, &sensor_dev_attr_temp1_emergency.dev_attr.attr,
&sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr,
&sensor_dev_attr_name.dev_attr.attr,
&sensor_dev_attr_update_rate.dev_attr.attr,
NULL NULL
}; };
static struct attribute *hwmon_fan_rpm_attributes[] = { static struct attribute *hwmon_fan_rpm_attributes[] = {
@ -898,8 +905,11 @@ static struct attribute *hwmon_pwm_fan_attributes[] = {
NULL NULL
}; };
static const struct attribute_group hwmon_attrgroup = { static const struct attribute_group hwmon_default_attrgroup = {
.attrs = hwmon_attributes, .attrs = hwmon_default_attributes,
};
static const struct attribute_group hwmon_temp_attrgroup = {
.attrs = hwmon_temp_attributes,
}; };
static const struct attribute_group hwmon_fan_rpm_attrgroup = { static const struct attribute_group hwmon_fan_rpm_attrgroup = {
.attrs = hwmon_fan_rpm_attributes, .attrs = hwmon_fan_rpm_attributes,
@ -931,13 +941,22 @@ nouveau_hwmon_init(struct drm_device *dev)
} }
dev_set_drvdata(hwmon_dev, dev); dev_set_drvdata(hwmon_dev, dev);
/* default sysfs entries */ /* set the default attributes */
ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_attrgroup); ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_default_attrgroup);
if (ret) { if (ret) {
if (ret) if (ret)
goto error; goto error;
} }
/* if the card has a working thermal sensor */
if (therm->temp_get(therm) >= 0) {
ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup);
if (ret) {
if (ret)
goto error;
}
}
/* if the card has a pwm fan */ /* if the card has a pwm fan */
/*XXX: incorrect, need better detection for this, some boards have /*XXX: incorrect, need better detection for this, some boards have
* the gpio entries for pwm fan control even when there's no * the gpio entries for pwm fan control even when there's no
@ -979,11 +998,10 @@ nouveau_hwmon_fini(struct drm_device *dev)
struct nouveau_pm *pm = nouveau_pm(dev); struct nouveau_pm *pm = nouveau_pm(dev);
if (pm->hwmon) { if (pm->hwmon) {
sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); sysfs_remove_group(&pm->hwmon->kobj, &hwmon_default_attrgroup);
sysfs_remove_group(&pm->hwmon->kobj, sysfs_remove_group(&pm->hwmon->kobj, &hwmon_temp_attrgroup);
&hwmon_pwm_fan_attrgroup); sysfs_remove_group(&pm->hwmon->kobj, &hwmon_pwm_fan_attrgroup);
sysfs_remove_group(&pm->hwmon->kobj, sysfs_remove_group(&pm->hwmon->kobj, &hwmon_fan_rpm_attrgroup);
&hwmon_fan_rpm_attrgroup);
hwmon_device_unregister(pm->hwmon); hwmon_device_unregister(pm->hwmon);
} }

View File

@ -524,6 +524,8 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
swap_interval <<= 4; swap_interval <<= 4;
if (swap_interval == 0) if (swap_interval == 0)
swap_interval |= 0x100; swap_interval |= 0x100;
if (chan == NULL)
evo_sync(crtc->dev);
push = evo_wait(sync, 128); push = evo_wait(sync, 128);
if (unlikely(push == NULL)) if (unlikely(push == NULL))
@ -586,8 +588,6 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
sync->addr ^= 0x10; sync->addr ^= 0x10;
sync->data++; sync->data++;
FIRE_RING (chan); FIRE_RING (chan);
} else {
evo_sync(crtc->dev);
} }
/* queue the flip */ /* queue the flip */

View File

@ -468,13 +468,19 @@ static void cayman_gpu_init(struct radeon_device *rdev)
(rdev->pdev->device == 0x9907) || (rdev->pdev->device == 0x9907) ||
(rdev->pdev->device == 0x9908) || (rdev->pdev->device == 0x9908) ||
(rdev->pdev->device == 0x9909) || (rdev->pdev->device == 0x9909) ||
(rdev->pdev->device == 0x990B) ||
(rdev->pdev->device == 0x990C) ||
(rdev->pdev->device == 0x990F) ||
(rdev->pdev->device == 0x9910) || (rdev->pdev->device == 0x9910) ||
(rdev->pdev->device == 0x9917)) { (rdev->pdev->device == 0x9917) ||
(rdev->pdev->device == 0x9999)) {
rdev->config.cayman.max_simds_per_se = 6; rdev->config.cayman.max_simds_per_se = 6;
rdev->config.cayman.max_backends_per_se = 2; rdev->config.cayman.max_backends_per_se = 2;
} else if ((rdev->pdev->device == 0x9903) || } else if ((rdev->pdev->device == 0x9903) ||
(rdev->pdev->device == 0x9904) || (rdev->pdev->device == 0x9904) ||
(rdev->pdev->device == 0x990A) || (rdev->pdev->device == 0x990A) ||
(rdev->pdev->device == 0x990D) ||
(rdev->pdev->device == 0x990E) ||
(rdev->pdev->device == 0x9913) || (rdev->pdev->device == 0x9913) ||
(rdev->pdev->device == 0x9918)) { (rdev->pdev->device == 0x9918)) {
rdev->config.cayman.max_simds_per_se = 4; rdev->config.cayman.max_simds_per_se = 4;
@ -483,6 +489,9 @@ static void cayman_gpu_init(struct radeon_device *rdev)
(rdev->pdev->device == 0x9990) || (rdev->pdev->device == 0x9990) ||
(rdev->pdev->device == 0x9991) || (rdev->pdev->device == 0x9991) ||
(rdev->pdev->device == 0x9994) || (rdev->pdev->device == 0x9994) ||
(rdev->pdev->device == 0x9995) ||
(rdev->pdev->device == 0x9996) ||
(rdev->pdev->device == 0x999A) ||
(rdev->pdev->device == 0x99A0)) { (rdev->pdev->device == 0x99A0)) {
rdev->config.cayman.max_simds_per_se = 3; rdev->config.cayman.max_simds_per_se = 3;
rdev->config.cayman.max_backends_per_se = 1; rdev->config.cayman.max_backends_per_se = 1;
@ -616,11 +625,22 @@ static void cayman_gpu_init(struct radeon_device *rdev)
WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config);
WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config);
tmp = gb_addr_config & NUM_PIPES_MASK; if ((rdev->config.cayman.max_backends_per_se == 1) &&
tmp = r6xx_remap_render_backend(rdev, tmp, (rdev->flags & RADEON_IS_IGP)) {
rdev->config.cayman.max_backends_per_se * if ((disabled_rb_mask & 3) == 1) {
rdev->config.cayman.max_shader_engines, /* RB0 disabled, RB1 enabled */
CAYMAN_MAX_BACKENDS, disabled_rb_mask); tmp = 0x11111111;
} else {
/* RB1 disabled, RB0 enabled */
tmp = 0x00000000;
}
} else {
tmp = gb_addr_config & NUM_PIPES_MASK;
tmp = r6xx_remap_render_backend(rdev, tmp,
rdev->config.cayman.max_backends_per_se *
rdev->config.cayman.max_shader_engines,
CAYMAN_MAX_BACKENDS, disabled_rb_mask);
}
WREG32(GB_BACKEND_MAP, tmp); WREG32(GB_BACKEND_MAP, tmp);
cgts_tcc_disable = 0xffff0000; cgts_tcc_disable = 0xffff0000;
@ -1771,6 +1791,7 @@ int cayman_resume(struct radeon_device *rdev)
int cayman_suspend(struct radeon_device *rdev) int cayman_suspend(struct radeon_device *rdev)
{ {
r600_audio_fini(rdev); r600_audio_fini(rdev);
radeon_vm_manager_fini(rdev);
cayman_cp_enable(rdev, false); cayman_cp_enable(rdev, false);
cayman_dma_stop(rdev); cayman_dma_stop(rdev);
evergreen_irq_suspend(rdev); evergreen_irq_suspend(rdev);

View File

@ -122,10 +122,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
goto out_cleanup; goto out_cleanup;
} }
/* r100 doesn't have dma engine so skip the test */ if (rdev->asic->copy.dma) {
/* also, VRAM-to-VRAM test doesn't make much sense for DMA */
/* skip it as well if domains are the same */
if ((rdev->asic->copy.dma) && (sdomain != ddomain)) {
time = radeon_benchmark_do_move(rdev, size, saddr, daddr, time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
RADEON_BENCHMARK_COPY_DMA, n); RADEON_BENCHMARK_COPY_DMA, n);
if (time < 0) if (time < 0)
@ -135,13 +132,15 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
sdomain, ddomain, "dma"); sdomain, ddomain, "dma");
} }
time = radeon_benchmark_do_move(rdev, size, saddr, daddr, if (rdev->asic->copy.blit) {
RADEON_BENCHMARK_COPY_BLIT, n); time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
if (time < 0) RADEON_BENCHMARK_COPY_BLIT, n);
goto out_cleanup; if (time < 0)
if (time > 0) goto out_cleanup;
radeon_benchmark_log_results(n, size, time, if (time > 0)
sdomain, ddomain, "blit"); radeon_benchmark_log_results(n, size, time,
sdomain, ddomain, "blit");
}
out_cleanup: out_cleanup:
if (sobj) { if (sobj) {

View File

@ -4469,6 +4469,7 @@ int si_resume(struct radeon_device *rdev)
int si_suspend(struct radeon_device *rdev) int si_suspend(struct radeon_device *rdev)
{ {
radeon_vm_manager_fini(rdev);
si_cp_enable(rdev, false); si_cp_enable(rdev, false);
cayman_dma_stop(rdev); cayman_dma_stop(rdev);
si_irq_suspend(rdev); si_irq_suspend(rdev);

View File

@ -581,7 +581,11 @@
{0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x990B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x990C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x990D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x990E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
@ -592,6 +596,13 @@
{0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9996, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9998, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x9999, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x999A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x999B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
{0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \