i915_utils.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: MIT
  2. /*
  3. * Copyright © 2019 Intel Corporation
  4. */
  5. #include <linux/device.h>
  6. #include <drm/drm_drv.h>
  7. #include <drm/drm_print.h>
  8. #include "i915_drv.h"
  9. #include "i915_reg.h"
  10. #include "i915_utils.h"
  11. void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint)
  12. {
  13. drm_notice(&i915->drm, "CI tainted: %#x by %pS\n",
  14. taint, __builtin_return_address(0));
  15. __add_taint_for_CI(taint);
  16. }
  17. bool i915_vtd_active(struct drm_i915_private *i915)
  18. {
  19. if (device_iommu_mapped(i915->drm.dev))
  20. return true;
  21. /* Running as a guest, we assume the host is enforcing VT'd */
  22. return i915_run_as_guest();
  23. }
  24. bool i915_direct_stolen_access(struct drm_i915_private *i915)
  25. {
  26. /*
  27. * Wa_22018444074
  28. *
  29. * Access via BAR can hang MTL, go directly to GSM/DSM,
  30. * except for VM guests which won't have access to it.
  31. *
  32. * Normally this would not work but on MTL the system firmware
  33. * should have relaxed the access permissions sufficiently.
  34. * 0x138914==0x1 indicates that the firmware has done its job.
  35. */
  36. return IS_METEORLAKE(i915) && !i915_run_as_guest() &&
  37. intel_uncore_read(&i915->uncore, MTL_PCODE_STOLEN_ACCESS) == STOLEN_ACCESS_ALLOWED;
  38. }