From: Casey Bowman <casey.g.bowman@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: ville.syrjala@intel.com, wayne.boyer@intel.com,
jani.nikula@intel.com, lucas.demarchi@intel.com,
daniel.vetter@intel.com, michael.cheng@intel.com
Subject: [Intel-gfx] [RFC PATCH 1/1] i915/drm: Split out x86 and arm64 functionality
Date: Thu, 20 Jan 2022 14:16:52 -0800 [thread overview]
Message-ID: <20220120221652.207255-2-casey.g.bowman@intel.com> (raw)
In-Reply-To: <20220120221652.207255-1-casey.g.bowman@intel.com>
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
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 213c5f9fae32..dd66fe57934d 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -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
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 290dfd40c7b3..e688270c8257 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -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))
diff --git a/drivers/gpu/drm/i915/i915_platform.h b/drivers/gpu/drm/i915/i915_platform.h
new file mode 100644
index 000000000000..300f93d20f58
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_platform.h
@@ -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
diff --git a/drivers/gpu/drm/i915/i915_platform_arm64.c b/drivers/gpu/drm/i915/i915_platform_arm64.c
new file mode 100644
index 000000000000..95692c4dc75f
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_platform_arm64.c
@@ -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 */
diff --git a/drivers/gpu/drm/i915/i915_platform_x86.c b/drivers/gpu/drm/i915/i915_platform_x86.c
new file mode 100644
index 000000000000..9a7174ad2147
--- /dev/null
+++ b/drivers/gpu/drm/i915/i915_platform_x86.c
@@ -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 */
--
2.25.1
next prev parent reply other threads:[~2022-01-20 22:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 22:16 [Intel-gfx] [RFC PATCH 0/1] Splitting up platform-specific calls Casey Bowman
2022-01-20 22:16 ` Casey Bowman [this message]
2022-01-20 23:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2022-01-20 23:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-01-21 0:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-01-21 4:03 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-03 23:58 ` [Intel-gfx] [RFC PATCH 0/1] " Casey Bowman
2022-02-07 13:02 ` Jani Nikula
2022-02-09 5:07 ` Casey Bowman
2022-02-07 15:36 ` Tvrtko Ursulin
2022-02-09 5:25 ` Casey Bowman
2022-02-10 11:10 ` Tvrtko Ursulin
2022-02-10 20:12 ` Casey Bowman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220120221652.207255-2-casey.g.bowman@intel.com \
--to=casey.g.bowman@intel.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=lucas.demarchi@intel.com \
--cc=michael.cheng@intel.com \
--cc=ville.syrjala@intel.com \
--cc=wayne.boyer@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox