|
@@ -181,8 +181,8 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
|
|
|
struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
|
|
|
struct drm_device *dev = &dev_priv->drm;
|
|
|
struct i915_gem_context *ctx;
|
|
|
- u32 *temp = NULL; /* Just here to make handling failures easy */
|
|
|
int slice = (int)(uintptr_t)attr->private;
|
|
|
+ u32 **remap_info;
|
|
|
int ret;
|
|
|
|
|
|
ret = l3_access_valid(dev_priv, offset);
|
|
@@ -193,11 +193,12 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
- if (!dev_priv->l3_parity.remap_info[slice]) {
|
|
|
- temp = kzalloc(GEN7_L3LOG_SIZE, GFP_KERNEL);
|
|
|
- if (!temp) {
|
|
|
- mutex_unlock(&dev->struct_mutex);
|
|
|
- return -ENOMEM;
|
|
|
+ remap_info = &dev_priv->l3_parity.remap_info[slice];
|
|
|
+ if (!*remap_info) {
|
|
|
+ *remap_info = kzalloc(GEN7_L3LOG_SIZE, GFP_KERNEL);
|
|
|
+ if (!*remap_info) {
|
|
|
+ ret = -ENOMEM;
|
|
|
+ goto out;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -205,18 +206,18 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
|
|
|
* aren't propagated. Since I cannot find a stable way to reset the GPU
|
|
|
* at this point it is left as a TODO.
|
|
|
*/
|
|
|
- if (temp)
|
|
|
- dev_priv->l3_parity.remap_info[slice] = temp;
|
|
|
-
|
|
|
- memcpy(dev_priv->l3_parity.remap_info[slice] + (offset/4), buf, count);
|
|
|
+ memcpy(*remap_info + (offset/4), buf, count);
|
|
|
|
|
|
/* NB: We defer the remapping until we switch to the context */
|
|
|
list_for_each_entry(ctx, &dev_priv->context_list, link)
|
|
|
ctx->remap_slice |= (1<<slice);
|
|
|
|
|
|
+ ret = count;
|
|
|
+
|
|
|
+out:
|
|
|
mutex_unlock(&dev->struct_mutex);
|
|
|
|
|
|
- return count;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
static struct bin_attribute dpf_attrs = {
|