drm/amdgpu: add determine passthrough under arm64
authorVictor Zhao <Victor.Zhao@amd.com>
Mon, 24 Jan 2022 04:13:58 +0000 (12:13 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jan 2022 20:47:34 +0000 (15:47 -0500)
add determine for passthrough mode under arm64 by reading
CurrentEL register

v2: squash in warning fix (Alex)

Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h

index c5edd84c1c125e226f544f86999649d38fe5f66e..645093610aa0402fb6dc0bdb4b1b59e0b8aa9e9b 100644 (file)
@@ -294,8 +294,10 @@ struct amdgpu_video_codec_info;
 
 static inline bool is_virtual_machine(void)
 {
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86)
        return boot_cpu_has(X86_FEATURE_HYPERVISOR);
+#elif defined(CONFIG_ARM64)
+       return !is_kernel_in_hyp_mode();
 #else
        return false;
 #endif