@@ -320,6 +320,10 @@ i915-y += intel_gvt.o
include $(src)/gvt/Makefile
endif
+# Architecture-specific calls
+i915-$(CONFIG_X86) += i915_platform_x86.o
+i915-$(CONFIG_ARM64) += i915_platform_arm64.o
+
obj-$(CONFIG_DRM_I915) += i915.o
obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
@@ -107,6 +107,7 @@
#include "gt/intel_timeline.h"
#include "i915_vma.h"
+#include "i915_platform.h"
/* General customization:
*/
@@ -1543,11 +1544,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
#define INTEL_DISPLAY_ENABLED(dev_priv) \
(drm_WARN_ON(&(dev_priv)->drm, !HAS_DISPLAY(dev_priv)), !(dev_priv)->params.disable_display)
-static inline bool run_as_guest(void)
-{
- return !hypervisor_is_type(X86_HYPER_NATIVE);
-}
-
#define HAS_D12_PLANE_MINIMIZATION(dev_priv) (IS_ROCKETLAKE(dev_priv) || \
IS_ALDERLAKE_S(dev_priv))
new file mode 100644
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef _I915_PLATFORM_
+#define _I915_PLATFORM_
+
+#include <linux/types.h>
+#include <linux/bug.h>
+
+/* Start of i915_drv functionality */
+bool run_as_guest(void);
+/* End of i915_drv functionality */
+
+#endif
new file mode 100644
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+/*
+ * Read before adding/removing content!
+ *
+ * Ensure that all functions defined here are also defined
+ * in the i915_platform_x86.c file.
+ *
+ * If the function is a dummy function, be sure to add
+ * a DRM_WARN() call to note that the function is a
+ * dummy function to users so that we can better track
+ * any issues that arise due to changes in either file.
+ *
+ * Also be sure to label Start/End of sections where
+ * functions originate from. These files will host
+ * architecture-specific content from a myriad of files,
+ * labeling the sections will help devs keep track of
+ * where the calls interact.
+ */
+
+#include "i915_platform.h"
+
+/* Start of i915_drv functionality */
+/* Intel VT-d is not used on ARM64 systems */
+bool run_as_guest(void)
+{
+ WARN(1, "%s not supported on arm64 platforms.", __func__);
+ return false;
+}
+/* End of i915_drv functionality */
new file mode 100644
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+/*
+ * Read before adding/removing content!
+ *
+ * Ensure that all functions defined here are also defined
+ * in the i915_platform_arm64.c file.
+ *
+ * If the function is a dummy function, be sure to add
+ * a DRM_WARN() call to note that the function is a
+ * dummy function to users so that we can better track
+ * any issues that arise due to changes in either file.
+ *
+ * Also be sure to label Start/End of sections where
+ * functions originate from. These files will host
+ * architecture-specific content from a myriad of files,
+ * labeling the sections will help devs keep track of
+ * where the calls interact.
+ */
+
+#include "i915_platform.h"
+
+#include <asm/hypervisor.h>
+
+/* Start of i915_drv functionality */
+bool run_as_guest(void)
+{
+ return !hypervisor_is_type(X86_HYPER_NATIVE);
+}
+/* End of i915_drv functionality */
Some x86 checks are unnecessary on arm64 systems, so they are being split out to avoid being used. There may be further arm64 implementations created in the future for this area, so it's better to split this out now. Signed-off-by: Casey Bowman <casey.g.bowman@intel.com> --- drivers/gpu/drm/i915/Makefile | 4 +++ drivers/gpu/drm/i915/i915_drv.h | 6 +--- drivers/gpu/drm/i915/i915_platform.h | 16 +++++++++++ drivers/gpu/drm/i915/i915_platform_arm64.c | 33 ++++++++++++++++++++++ drivers/gpu/drm/i915/i915_platform_x86.c | 33 ++++++++++++++++++++++ 5 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_platform.h create mode 100644 drivers/gpu/drm/i915/i915_platform_arm64.c create mode 100644 drivers/gpu/drm/i915/i915_platform_x86.c