Skip to content

Commit 46ee03c

Browse files
authored
arm64/hyperv: Add Device Tree Support
Add support for Device Tree (DT) configurations within the arm64 Hyper-V environment, enabling boot with DeviceTree, too, rather than with ACPI or SMCCC only. Signed-off-by: Roman Kisel <romank@microsoft.com> Signed-off-by: Hardik Garg <hargar@microsoft.com>
2 parents 8af63f3 + 377a1f3 commit 46ee03c

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

arch/arm64/hyperv/mshyperv.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include <linux/errno.h>
1616
#include <linux/version.h>
1717
#include <linux/cpuhotplug.h>
18+
#include <linux/libfdt.h>
19+
#include <linux/of.h>
20+
#include <linux/of_fdt.h>
1821
#include <asm/mshyperv.h>
1922

2023
static bool hyperv_initialized;
@@ -70,6 +73,19 @@ static bool __init hyperv_detect_via_smccc(void)
7073
return arm_smccc_hypervisor_has_uuid(&hyperv_uuid);
7174
}
7275

76+
static bool __init hyperv_detect_via_fdt(void)
77+
{
78+
#if IS_ENABLED(CONFIG_OF)
79+
const unsigned long hyp_node = of_get_flat_dt_subnode_by_name(
80+
of_get_flat_dt_root(), "hypervisor");
81+
82+
return (hyp_node != -FDT_ERR_NOTFOUND) &&
83+
of_flat_dt_is_compatible(hyp_node, "microsoft,hyperv");
84+
#else
85+
return false;
86+
#endif
87+
}
88+
7389
static int __init hyperv_init(void)
7490
{
7591
struct hv_get_vp_registers_output result;
@@ -82,7 +98,9 @@ static int __init hyperv_init(void)
8298
*
8399
* In such cases, do nothing and return success.
84100
*/
85-
if (!hyperv_detect_via_acpi() && !hyperv_detect_via_smccc())
101+
if (!hyperv_detect_via_acpi() &&
102+
!hyperv_detect_via_smccc() &&
103+
!hyperv_detect_via_fdt())
86104
return 0;
87105

88106
/* Setup the guest ID */

0 commit comments

Comments
 (0)