@@ -1764,7 +1764,8 @@ eb_relocate_vma_slow(struct i915_execbuffer *eb, struct eb_vma *ev)
return err;
}
-static int check_relocations(const struct drm_i915_gem_exec_object2 *entry)
+static int check_relocations(const struct i915_execbuffer *eb,
+ const struct drm_i915_gem_exec_object2 *entry)
{
const char __user *addr, *end;
unsigned long size;
@@ -1774,6 +1775,14 @@ static int check_relocations(const struct drm_i915_gem_exec_object2 *entry)
if (size == 0)
return 0;
+ /* Relocations are disallowed for all platforms after TGL-LP */
+ if (INTEL_GEN(eb->i915) >= 12 && !IS_TIGERLAKE(eb->i915))
+ return -EINVAL;
+
+ /* All discrete memory platforms are Gen12 or above */
+ if (WARN_ON(HAS_LMEM(eb->i915)))
+ return -EINVAL;
+
if (size > N_RELOC(ULONG_MAX))
return -EINVAL;
@@ -1807,7 +1816,7 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb)
if (nreloc == 0)
continue;
- err = check_relocations(&eb->exec[i]);
+ err = check_relocations(eb, &eb->exec[i]);
if (err)
goto err;
@@ -1880,7 +1889,7 @@ static int eb_prefault_relocations(const struct i915_execbuffer *eb)
for (i = 0; i < count; i++) {
int err;
- err = check_relocations(&eb->exec[i]);
+ err = check_relocations(eb, &eb->exec[i]);
if (err)
return err;
}