47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <drm/drm_drv.h>
|
|
#include <drm/drm_print.h>
|
|
|
|
#include "i915_drv.h"
|
|
#include "i915_reg.h"
|
|
#include "i915_utils.h"
|
|
|
|
void add_taint_for_CI(struct drm_i915_private *i915, unsigned int taint)
|
|
{
|
|
drm_notice(&i915->drm, "CI tainted: %#x by %pS\n",
|
|
taint, __builtin_return_address(0));
|
|
|
|
__add_taint_for_CI(taint);
|
|
}
|
|
|
|
bool i915_vtd_active(struct drm_i915_private *i915)
|
|
{
|
|
if (device_iommu_mapped(i915->drm.dev))
|
|
return true;
|
|
|
|
/* Running as a guest, we assume the host is enforcing VT'd */
|
|
return i915_run_as_guest();
|
|
}
|
|
|
|
bool i915_direct_stolen_access(struct drm_i915_private *i915)
|
|
{
|
|
/*
|
|
* Wa_22018444074
|
|
*
|
|
* Access via BAR can hang MTL, go directly to GSM/DSM,
|
|
* except for VM guests which won't have access to it.
|
|
*
|
|
* Normally this would not work but on MTL the system firmware
|
|
* should have relaxed the access permissions sufficiently.
|
|
* 0x138914==0x1 indicates that the firmware has done its job.
|
|
*/
|
|
return IS_METEORLAKE(i915) && !i915_run_as_guest() &&
|
|
intel_uncore_read(&i915->uncore, MTL_PCODE_STOLEN_ACCESS) == STOLEN_ACCESS_ALLOWED;
|
|
}
|