return 0;
 }
 
+static bool apply_subtest_filter(const char *caller, const char *name)
+{
+       char *filter, *sep, *tok;
+       bool result = true;
+
+       filter = kstrdup(i915_selftest.filter, GFP_KERNEL);
+       for (sep = filter; (tok = strsep(&sep, ","));) {
+               bool allow = true;
+               char *sl;
+
+               if (*tok == '!') {
+                       allow = false;
+                       tok++;
+               }
+
+               if (*tok == '\0')
+                       continue;
+
+               sl = strchr(tok, '/');
+               if (sl) {
+                       *sl++ = '\0';
+                       if (strcmp(tok, caller)) {
+                               if (allow)
+                                       result = false;
+                               continue;
+                       }
+                       tok = sl;
+               }
+
+               if (strcmp(tok, name)) {
+                       if (allow)
+                               result = false;
+                       continue;
+               }
+
+               result = allow;
+               break;
+       }
+       kfree(filter);
+
+       return result;
+}
+
 int __i915_subtests(const char *caller,
                    const struct i915_subtest *st,
                    unsigned int count,
                if (signal_pending(current))
                        return -EINTR;
 
+               if (!apply_subtest_filter(caller, st->name))
+                       continue;
+
                pr_debug(DRIVER_NAME ": Running %s/%s\n", caller, st->name);
                GEM_TRACE("Running %s/%s\n", caller, st->name);
 
 
 module_param_named(st_random_seed, i915_selftest.random_seed, uint, 0400);
 module_param_named(st_timeout, i915_selftest.timeout_ms, uint, 0400);
+module_param_named(st_filter, i915_selftest.filter, charp, 0400);
 
 module_param_named_unsafe(mock_selftests, i915_selftest.mock, int, 0400);
 MODULE_PARM_DESC(mock_selftests, "Run selftests before loading, using mock hardware (0:disabled [default], 1:run tests then load driver, -1:run tests then exit module)");