From: Stephen Rothwell Date: Tue, 29 Apr 2014 01:18:58 +0000 (+1000) Subject: Merge remote-tracking branch 'drm-intel/for-linux-next' X-Git-Tag: next-20140429~48 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f70cccd428c8c645d939f93ac5cac292377dc6e6;p=karo-tx-linux.git Merge remote-tracking branch 'drm-intel/for-linux-next' Conflicts: drivers/gpu/drm/i915/i915_gem_context.c --- f70cccd428c8c645d939f93ac5cac292377dc6e6 diff --cc drivers/gpu/drm/i915/i915_gem_context.c index d72db15afa02,30b355afb362..f77b4c126465 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@@ -231,32 -232,40 +231,40 @@@ __create_hw_context(struct drm_device * return ERR_PTR(-ENOMEM); kref_init(&ctx->ref); - ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); - INIT_LIST_HEAD(&ctx->link); - if (ctx->obj == NULL) { - kfree(ctx); - DRM_DEBUG_DRIVER("Context object allocated failed\n"); - return ERR_PTR(-ENOMEM); - } + list_add_tail(&ctx->link, &dev_priv->context_list); - /* - * Try to make the context utilize L3 as well as LLC. - * - * On VLV we don't have L3 controls in the PTEs so we - * shouldn't touch the cache level, especially as that - * would make the object snooped which might have a - * negative performance impact. - */ - if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev)) { - ret = i915_gem_object_set_cache_level(ctx->obj, - I915_CACHE_L3_LLC); - /* Failure shouldn't ever happen this early */ - if (WARN_ON(ret)) + if (dev_priv->hw_context_size) { + ctx->obj = i915_gem_alloc_object(dev, dev_priv->hw_context_size); + if (ctx->obj == NULL) { + ret = -ENOMEM; goto err_out; - } + } - if (INTEL_INFO(dev)->gen >= 7) { - list_add_tail(&ctx->link, &dev_priv->context_list); ++ /* ++ * Try to make the context utilize L3 as well as LLC. ++ * ++ * On VLV we don't have L3 controls in the PTEs so we ++ * shouldn't touch the cache level, especially as that ++ * would make the object snooped which might have a ++ * negative performance impact. ++ */ ++ if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev)) { + ret = i915_gem_object_set_cache_level(ctx->obj, + I915_CACHE_L3_LLC); + /* Failure shouldn't ever happen this early */ + if (WARN_ON(ret)) + goto err_out; + } + } /* Default context will never have a file_priv */ - if (file_priv == NULL) - return ctx; - - ret = idr_alloc(&file_priv->context_idr, ctx, DEFAULT_CONTEXT_ID, 0, - GFP_KERNEL); - if (ret < 0) - goto err_out; + if (file_priv != NULL) { + ret = idr_alloc(&file_priv->context_idr, ctx, + DEFAULT_CONTEXT_ID, 0, GFP_KERNEL); + if (ret < 0) + goto err_out; + } else + ret = DEFAULT_CONTEXT_ID; ctx->file_priv = file_priv; ctx->id = ret;