From 222379af328d7b6e12470bd00248f6b81f92744a Mon Sep 17 00:00:00 2001 From: Oleksii Moisieiev Date: Sun, 22 Sep 2024 00:12:32 +0300 Subject: [PATCH] xen: arm: scmi_dt_maker: Set shared memory phandle to existing node When creating hardware domain there is a need to set correct phandle to the "shmem" property on the scmi node. Shared memory node is generated while scmi node is copied as is from Xen device-tree. Correct shmem phandle is set during domain device-tree processing. Signed-off-by: Oleksii Moisieiev --- xen/drivers/passthrough/arm/scmi_dt_maker.c | 15 ++++++++++++++- xen/include/xen/scmi_dt_maker.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/arm/scmi_dt_maker.c b/xen/drivers/passthrough/arm/scmi_dt_maker.c index f088acb4ee3d..33587cab3466 100644 --- a/xen/drivers/passthrough/arm/scmi_dt_maker.c +++ b/xen/drivers/passthrough/arm/scmi_dt_maker.c @@ -25,7 +25,7 @@ struct scmi_phandle { LIST_HEAD(scmi_ph_list); - int __init scmi_dt_make_shmem_node(struct kernel_info *kinfo) +int __init scmi_dt_make_shmem_node(struct kernel_info *kinfo) { int res; void *fdt = kinfo->fdt; @@ -311,3 +311,16 @@ int __init scmi_dt_scan_node(struct kernel_info *kinfo, void *pfdt, clean_handles(); return rc; } + +int __init scmi_dt_set_phandle(struct kernel_info *kinfo, + const char *name) +{ + int offset = fdt_path_offset(kinfo->fdt, name); + __be32 val = cpu_to_be32(kinfo->phandle_sci_shmem); + + if ( !offset ) + return -ENODEV; + + return fdt_setprop_inplace(kinfo->fdt, offset, "shmem", + &val,sizeof(val)); +} diff --git a/xen/include/xen/scmi_dt_maker.h b/xen/include/xen/scmi_dt_maker.h index 5675351a8bba..f15fa59fd947 100644 --- a/xen/include/xen/scmi_dt_maker.h +++ b/xen/include/xen/scmi_dt_maker.h @@ -16,10 +16,13 @@ int __init scmi_dt_make_shmem_node(struct kernel_info *kinfo); int __init scmi_dt_create_node(struct kernel_info *kinfo); int __init scmi_dt_scan_node(struct kernel_info *kinfo, void *pfdt, int nodeoff); +int __init scmi_dt_set_phandle(struct kernel_info *kinfo, + const char *name); #else #define scmi_dt_make_shmem_node(kinfo) (0) #define scmi_dt_create_node(kinfo) (0) #define scmi_dt_scan_node(kinfo, pfdt, nodeoff) (0) +#define scmi_dt_set_phandle(kinfo, name) (0) #endif /* CONFIG_SCMI_SMC */