igt_flush_test.c 786 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * SPDX-License-Identifier: MIT
  3. *
  4. * Copyright © 2018 Intel Corporation
  5. */
  6. #include "../i915_drv.h"
  7. #include "../i915_selftest.h"
  8. #include "igt_flush_test.h"
  9. int igt_flush_test(struct drm_i915_private *i915, unsigned int flags)
  10. {
  11. cond_resched();
  12. if (flags & I915_WAIT_LOCKED &&
  13. i915_gem_switch_to_kernel_context(i915)) {
  14. pr_err("Failed to switch back to kernel context; declaring wedged\n");
  15. i915_gem_set_wedged(i915);
  16. }
  17. if (i915_gem_wait_for_idle(i915, flags, HZ / 5) == -ETIME) {
  18. pr_err("%pS timed out, cancelling all further testing.\n",
  19. __builtin_return_address(0));
  20. GEM_TRACE("%pS timed out.\n", __builtin_return_address(0));
  21. GEM_TRACE_DUMP();
  22. i915_gem_set_wedged(i915);
  23. }
  24. return i915_terminally_wedged(&i915->gpu_error) ? -EIO : 0;
  25. }