mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/i915/display: add intel_display_vtd_active()
Add intel_display_vtd_active() to utils. It's intentional duplication with i915_utils.h i915_vtd_active(), but reduces duplication with xe. Win some, lose some. Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Link: https://patch.msgid.link/e022166af7c67f43904e2d0fc87bc5c13e0f1204.1761146196.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "intel_display_core.h"
|
||||
#include "intel_display_regs.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_display_utils.h"
|
||||
#include "intel_mchbar_regs.h"
|
||||
#include "intel_pcode.h"
|
||||
#include "intel_uncore.h"
|
||||
@@ -842,14 +843,13 @@ static unsigned int intel_bw_num_active_planes(struct intel_display *display,
|
||||
static unsigned int intel_bw_data_rate(struct intel_display *display,
|
||||
const struct intel_bw_state *bw_state)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(display->drm);
|
||||
unsigned int data_rate = 0;
|
||||
enum pipe pipe;
|
||||
|
||||
for_each_pipe(display, pipe)
|
||||
data_rate += bw_state->data_rate[pipe];
|
||||
|
||||
if (DISPLAY_VER(display) >= 13 && i915_vtd_active(i915))
|
||||
if (DISPLAY_VER(display) >= 13 && intel_display_vtd_active(display))
|
||||
data_rate = DIV_ROUND_UP(data_rate * 105, 100);
|
||||
|
||||
return data_rate;
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include "intel_display_regs.h"
|
||||
#include "intel_display_rpm.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_display_utils.h"
|
||||
#include "intel_display_wa.h"
|
||||
#include "intel_dmc.h"
|
||||
#include "intel_dp.h"
|
||||
@@ -831,9 +832,8 @@ static void intel_async_flip_vtd_wa(struct intel_display *display,
|
||||
static bool needs_async_flip_vtd_wa(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_display *display = to_intel_display(crtc_state);
|
||||
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
|
||||
|
||||
return crtc_state->uapi.async_flip && i915_vtd_active(i915) &&
|
||||
return crtc_state->uapi.async_flip && intel_display_vtd_active(display) &&
|
||||
(DISPLAY_VER(display) == 9 || display->platform.broadwell ||
|
||||
display->platform.haswell);
|
||||
}
|
||||
@@ -8356,7 +8356,5 @@ void i830_disable_pipe(struct intel_display *display, enum pipe pipe)
|
||||
|
||||
bool intel_scanout_needs_vtd_wa(struct intel_display *display)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(display->drm);
|
||||
|
||||
return IS_DISPLAY_VER(display, 6, 11) && i915_vtd_active(i915);
|
||||
return IS_DISPLAY_VER(display, 6, 11) && intel_display_vtd_active(display);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/* Copyright © 2025 Intel Corporation */
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
#include <drm/drm_device.h>
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
#include <asm/hypervisor.h>
|
||||
#endif
|
||||
|
||||
#include "intel_display_core.h"
|
||||
#include "intel_display_utils.h"
|
||||
|
||||
bool intel_display_run_as_guest(struct intel_display *display)
|
||||
@@ -16,3 +21,12 @@ bool intel_display_run_as_guest(struct intel_display *display)
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool intel_display_vtd_active(struct intel_display *display)
|
||||
{
|
||||
if (device_iommu_mapped(display->drm->dev))
|
||||
return true;
|
||||
|
||||
/* Running as a guest, we assume the host is enforcing VT'd */
|
||||
return intel_display_run_as_guest(display);
|
||||
}
|
||||
|
||||
@@ -12,5 +12,6 @@ struct intel_display;
|
||||
#define MHz(x) KHz(1000 * (x))
|
||||
|
||||
bool intel_display_run_as_guest(struct intel_display *display);
|
||||
bool intel_display_vtd_active(struct intel_display *display);
|
||||
|
||||
#endif /* __INTEL_DISPLAY_UTILS__ */
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "intel_display_rpm.h"
|
||||
#include "intel_display_trace.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_display_utils.h"
|
||||
#include "intel_display_wa.h"
|
||||
#include "intel_fbc.h"
|
||||
#include "intel_fbc_regs.h"
|
||||
@@ -1472,7 +1473,8 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state,
|
||||
}
|
||||
|
||||
/* WaFbcTurnOffFbcWhenHyperVisorIsUsed:skl,bxt */
|
||||
if (i915_vtd_active(i915) && (display->platform.skylake || display->platform.broxton)) {
|
||||
if (intel_display_vtd_active(display) &&
|
||||
(display->platform.skylake || display->platform.broxton)) {
|
||||
plane_state->no_fbc_reason = "VT-d enabled";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,18 +3,8 @@
|
||||
* Copyright © 2023 Intel Corporation
|
||||
*/
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_utils.h"
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
|
||||
|
||||
/* i915 specific, just put here for shutting it up */
|
||||
|
||||
Reference in New Issue
Block a user