[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 15/20] xen/arm: vsmmuv3: Emulated SMMUv3 device tree node for dom0less
From: Rahul Singh <rahul.singh@xxxxxxx> XEN will create an Emulated SMMUv3 device tree node in the device tree to enable the dom0less domains to discover the virtual SMMUv3 during boot. Emulated SMMUv3 device tree node will only be created when cmdline option vsmmuv3 is enabled. Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx> Signed-off-by: Milan Djokic <milan_djokic@xxxxxxxx> --- xen/arch/arm/dom0less-build.c | 53 +++++++++++++++++++++++++++ xen/include/public/device_tree_defs.h | 1 + 2 files changed, 54 insertions(+) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 1fa6df214b..1e526c10de 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -217,10 +217,63 @@ static int __init make_vpl011_uart_node(struct kernel_info *kinfo) } #endif +#ifdef CONFIG_VIRTUAL_ARM_SMMU_V3 +static int __init make_vsmmuv3_node(const struct kernel_info *kinfo) +{ + int res; + char buf[24]; + __be32 reg[GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS]; + __be32 *cells; + void *fdt = kinfo->fdt; + + snprintf(buf, sizeof(buf), "iommu@%llx", GUEST_VSMMUV3_BASE); + + res = fdt_begin_node(fdt, buf); + if ( res ) + return res; + + res = fdt_property_string(fdt, "compatible", "arm,smmu-v3"); + if ( res ) + return res; + + /* Create reg property */ + cells = ®[0]; + dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_CELLS, + GUEST_VSMMUV3_BASE, GUEST_VSMMUV3_SIZE); + res = fdt_property(fdt, "reg", reg, + (GUEST_ROOT_ADDRESS_CELLS + + GUEST_ROOT_SIZE_CELLS) * sizeof(*reg)); + if ( res ) + return res; + + res = fdt_property_cell(fdt, "phandle", GUEST_PHANDLE_VSMMUV3); + if ( res ) + return res; + + res = fdt_property_cell(fdt, "#iommu-cells", 1); + if ( res ) + return res; + + res = fdt_end_node(fdt); + + return res; +} +#endif + int __init make_arch_nodes(struct kernel_info *kinfo) { int ret; + +#ifdef CONFIG_VIRTUAL_ARM_SMMU_V3 + if ( is_viommu_enabled() ) + { + ret = make_vsmmuv3_node(kinfo); + if ( ret ) + return -EINVAL; + } +#endif + ret = make_psci_node(kinfo->fdt); if ( ret ) return -EINVAL; diff --git a/xen/include/public/device_tree_defs.h b/xen/include/public/device_tree_defs.h index 9e80d0499d..7846a0425c 100644 --- a/xen/include/public/device_tree_defs.h +++ b/xen/include/public/device_tree_defs.h @@ -14,6 +14,7 @@ */ #define GUEST_PHANDLE_GIC (65000) #define GUEST_PHANDLE_IOMMU (GUEST_PHANDLE_GIC + 1) +#define GUEST_PHANDLE_VSMMUV3 (GUEST_PHANDLE_IOMMU + 1) #define GUEST_ROOT_ADDRESS_CELLS 2 #define GUEST_ROOT_SIZE_CELLS 2 -- 2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |