Some x86 checks are unnecessary on arm64 systems, so they are being split out to avoid being used. We are starting the split with run_as_guest(), which has an x86-specific usage, while on arm64, we aren't using it. The split reflects the way the kernel currently handles platform-specific libraries, but these calls are localized to i915. Signed-off-by: Casey Bowman <casey.g.bowman@xxxxxxxxx> --- drivers/gpu/drm/i915/Makefile | 3 +++ drivers/gpu/drm/i915/i915_drv.h | 7 ++----- drivers/gpu/drm/i915/platforms/Makefile | 8 ++++++++ .../arm64/include/platform/i915_hypervisor.h | 11 +++++++++++ .../platforms/x86/include/platform/i915_hypervisor.h | 9 +++++++++ 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/i915/platforms/Makefile create mode 100644 drivers/gpu/drm/i915/platforms/arm64/include/platform/i915_hypervisor.h create mode 100644 drivers/gpu/drm/i915/platforms/x86/include/platform/i915_hypervisor.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 16cab8db012a..f69ed0c10e80 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -29,6 +29,9 @@ subdir-ccflags-y += -I$(srctree)/$(src) # Please keep these build lists sorted! +# arch support +include $(src)/platforms/Makefile + # core driver code i915-y += i915_driver.o \ i915_config.o \ diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 78fa3340101b..ba2cfb4d9830 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -87,6 +87,8 @@ #include "gt/intel_workarounds.h" #include "gt/uc/intel_uc.h" +#include "platform/i915_hypervisor.h" + #include "intel_device_info.h" #include "intel_memory_region.h" #include "intel_pch.h" @@ -1498,11 +1500,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/platforms/Makefile b/drivers/gpu/drm/i915/platforms/Makefile new file mode 100644 index 000000000000..03250b5704ea --- /dev/null +++ b/drivers/gpu/drm/i915/platforms/Makefile @@ -0,0 +1,8 @@ +ifdef CONFIG_X86 +ccflags-y += -I $(srctree)/$(src)/platforms/x86/include/ +endif + +ifdef CONFIG_ARM64 +ccflags-y += -I $(srctree)/$(src)/platforms/arm64/include/ +endif + diff --git a/drivers/gpu/drm/i915/platforms/arm64/include/platform/i915_hypervisor.h b/drivers/gpu/drm/i915/platforms/arm64/include/platform/i915_hypervisor.h new file mode 100644 index 000000000000..cd9050711dce --- /dev/null +++ b/drivers/gpu/drm/i915/platforms/arm64/include/platform/i915_hypervisor.h @@ -0,0 +1,11 @@ +#ifndef _I915_HYPERVISOR_ +#define _I915_HYPERVISOR_ + + +/* Not supported for arm64, so we return */ +static inline bool run_as_guest(void) +{ + return false; +} + +#endif diff --git a/drivers/gpu/drm/i915/platforms/x86/include/platform/i915_hypervisor.h b/drivers/gpu/drm/i915/platforms/x86/include/platform/i915_hypervisor.h new file mode 100644 index 000000000000..5eab54f5e09f --- /dev/null +++ b/drivers/gpu/drm/i915/platforms/x86/include/platform/i915_hypervisor.h @@ -0,0 +1,9 @@ +#ifndef _I915_HYPERVISOR_ +#define _I915_HYPERVISOR_ + +static inline bool run_as_guest(void) +{ + return !hypervisor_is_type(X86_HYPER_NATIVE); +} + +#endif -- 2.25.1