]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/display: add intel_display_run_as_guest()
authorJani Nikula <jani.nikula@intel.com>
Wed, 22 Oct 2025 15:17:11 +0000 (18:17 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 31 Oct 2025 11:09:10 +0000 (13:09 +0200)
Add intel_display_utils.c for display utilities that need more than a
header.

Start off with intel_display_run_as_guest(). The implementation is
intentional duplication of the i915_utils.h i915_run_as_guest(), with
the idea that it's small enough to not matter.

Reviewed-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://patch.msgid.link/469f9c41e0c3e3099314a3cf1a7671bf36ec8ffd.1761146196.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/Makefile
drivers/gpu/drm/i915/display/intel_display_utils.c [new file with mode: 0644]
drivers/gpu/drm/i915/display/intel_display_utils.h
drivers/gpu/drm/i915/display/intel_pch.c
drivers/gpu/drm/xe/Makefile

index be439fb45cca7a3d5eb5d22ea5b1a969a01f8271..4d107d114690ff2605c99573b1131f940dfd50cd 100644 (file)
@@ -256,6 +256,7 @@ i915-y += \
        display/intel_display_rpm.o \
        display/intel_display_rps.o \
        display/intel_display_snapshot.o \
+       display/intel_display_utils.o \
        display/intel_display_wa.o \
        display/intel_dmc.o \
        display/intel_dmc_wl.o \
diff --git a/drivers/gpu/drm/i915/display/intel_display_utils.c b/drivers/gpu/drm/i915/display/intel_display_utils.c
new file mode 100644 (file)
index 0000000..13d3999
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: MIT
+/* Copyright © 2025 Intel Corporation */
+
+#ifdef CONFIG_X86
+#include <asm/hypervisor.h>
+#endif
+
+#include "intel_display_utils.h"
+
+bool intel_display_run_as_guest(struct intel_display *display)
+{
+#if IS_ENABLED(CONFIG_X86)
+       return !hypervisor_is_type(X86_HYPER_NATIVE);
+#else
+       /* Not supported yet */
+       return false;
+#endif
+}
index 0a2b603ea856273ee141c0f70f849bdeeaaff401..e54e69afd9592da72beb262c6b2300f93c535ebd 100644 (file)
@@ -4,7 +4,13 @@
 #ifndef __INTEL_DISPLAY_UTILS__
 #define __INTEL_DISPLAY_UTILS__
 
+#include <linux/types.h>
+
+struct intel_display;
+
 #define KHz(x) (1000 * (x))
 #define MHz(x) KHz(1000 * (x))
 
+bool intel_display_run_as_guest(struct intel_display *display);
+
 #endif /* __INTEL_DISPLAY_UTILS__ */
index 469e8a3cfb49fa8267ca65dee5d2b3bfdcce8fef..65359a36df48375bc2371a20b6f97c943e9049f8 100644 (file)
@@ -5,8 +5,8 @@
 
 #include <drm/drm_print.h>
 
-#include "i915_utils.h"
 #include "intel_display_core.h"
+#include "intel_display_utils.h"
 #include "intel_pch.h"
 
 #define INTEL_PCH_DEVICE_ID_MASK               0xff80
@@ -328,7 +328,7 @@ void intel_pch_detect(struct intel_display *display)
                            "Display disabled, reverting to NOP PCH\n");
                display->pch_type = PCH_NOP;
        } else if (!pch) {
-               if (i915_run_as_guest() && HAS_DISPLAY(display)) {
+               if (intel_display_run_as_guest(display) && HAS_DISPLAY(display)) {
                        intel_virt_detect_pch(display, &id, &pch_type);
                        display->pch_type = pch_type;
                } else {
index 58e1d68e495b71560ab2e4479c2edbabbcfa9c6b..016b566ff04f1e98bf630aa7117121294bfa2540 100644 (file)
@@ -254,6 +254,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \
        i915-display/intel_display_power_map.o \
        i915-display/intel_display_power_well.o \
        i915-display/intel_display_trace.o \
+       i915-display/intel_display_utils.o \
        i915-display/intel_display_wa.o \
        i915-display/intel_dkl_phy.o \
        i915-display/intel_dmc.o \