| 1 | // SPDX-License-Identifier: MIT |
|---|---|
| 2 | /* Copyright © 2025 Intel Corporation */ |
| 3 | |
| 4 | #include <linux/device.h> |
| 5 | |
| 6 | #include <drm/drm_device.h> |
| 7 | |
| 8 | #ifdef CONFIG_X86 |
| 9 | #include <asm/hypervisor.h> |
| 10 | #endif |
| 11 | |
| 12 | #include "intel_display_core.h" |
| 13 | #include "intel_display_utils.h" |
| 14 | |
| 15 | bool intel_display_run_as_guest(struct intel_display *display) |
| 16 | { |
| 17 | #if IS_ENABLED(CONFIG_X86) |
| 18 | return !hypervisor_is_type(type: X86_HYPER_NATIVE); |
| 19 | #else |
| 20 | /* Not supported yet */ |
| 21 | return false; |
| 22 | #endif |
| 23 | } |
| 24 | |
| 25 | bool intel_display_vtd_active(struct intel_display *display) |
| 26 | { |
| 27 | if (device_iommu_mapped(dev: display->drm->dev)) |
| 28 | return true; |
| 29 | |
| 30 | /* Running as a guest, we assume the host is enforcing VT'd */ |
| 31 | return intel_display_run_as_guest(display); |
| 32 | } |
| 33 |
