/* Note that this only resolves i915_gem_object_set_cpu_read_domain_range(), and doesn't handle transitioning from !(read_domains & I915_GEM_DOMAIN_CPU).  */
static void i915_gem_object_set_to_full_cpu_read_domain(struct drm_gem_object *obj)
/* Note that this only resolves i915_gem_object_set_cpu_read_domain_range(), and doesn't handle transitioning from !(read_domains & I915_GEM_DOMAIN_CPU).  */
static void i915_gem_object_set_to_full_cpu_read_domain(struct drm_gem_object *obj)
{
	struct drm_i915_gem_object *obj_priv = obj->driver_private;
	if (!obj_priv->page_cpu_valid)
		return;
	if (obj->read_domains & I915_GEM_DOMAIN_CPU) {
		int i;
		for (i = 0; i <= (obj->size - 1) / PAGE_SIZE; i++) {
			if (obj_priv->page_cpu_valid[i])
				continue;
			drm_clflush_pages(obj_priv->pages + i, 1);
		}
	}
	kfree(obj_priv->page_cpu_valid);
	obj_priv->page_cpu_valid = NULL;
}