-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCMI-Mediator add support for DomUs #214
base: rpi5_dev
Are you sure you want to change the base?
SCMI-Mediator add support for DomUs #214
Conversation
libxenhypfs will return blob properties as is. This output can be used to retrieve information from the hypfs. Caller is responsible for parsing property value. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
xen/arch/arm/domain.c
Outdated
@@ -698,6 +702,27 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) | |||
return 0; | |||
} | |||
|
|||
#ifdef CONFIG_HOST_DTB_EXPORT | |||
#define HYPFS_PROPERTY_MAX_SIZE 4096 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that DTB is much bigger than 4k. Also, naming is quite ambiguous. It just says "hypfs property". Which property exactly?
I believe, this is the leftover from your previous version. But in this version it makes no sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. it's leftover. I've made HOST_DTB_MAX_SIZE config parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with default as 8192. but probably 4096 is enough because current dtb in rcar is 2150
xen/arch/arm/domain.c
Outdated
@@ -698,6 +702,27 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) | |||
return 0; | |||
} | |||
|
|||
#ifdef CONFIG_HOST_DTB_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it is living in the middle of domain.c
? This file is for low-level domain state manipulation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find a better place. What do you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bootfdt.c
maybe?
xen/arch/arm/domain_build.c
Outdated
@@ -1741,6 +1755,12 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo, | |||
*/ | |||
evtchn_allocate(d); | |||
|
|||
#ifdef CONFIG_SCMI_SMC | |||
res = mem_permit_access(kinfo->d, kinfo->d->arch.sci_channel.paddr, | |||
0x1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no magic values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still constant 0x1000
xen/arch/arm/domain_build.c
Outdated
if ( res ) | ||
return res; | ||
|
||
return map_regions_p2mt(d, gaddr_to_gfn(addr), PFN_DOWN(len), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you remove iomem access permission if this call is failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where it was fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged these changes to wrong commit. I'm sorry... now fixec
xen/include/xen/scmi_dt_maker.h
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting is not consistent with the previous lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
tools/libs/light/libxl_arm.c
Outdated
int r; | ||
|
||
if (fdt_magic(fdt) != FDT_MAGIC) { | ||
LOG(ERROR, "Partial FDT is not a valid Flat Device Tree"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the partial device tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
tools/libs/light/libxl_arm.c
Outdated
|
||
r = fdt_check_header(fdt); | ||
if (r) { | ||
LOG(ERROR, "Failed to check the partial FDT (%d)", r); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the partial device tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
tools/libs/light/libxl_arm.c
Outdated
goto out; | ||
} | ||
|
||
nodeoff = get_path_nodeoff("/scmi", pfdt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be /firmware/scmi
? I believe we discussed this at the daily call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup. sorry. it's leftover
tools/libs/light/libxl_arm.c
Outdated
} | ||
|
||
nodeoff = get_path_nodeoff("/scmi", pfdt); | ||
if ( nodeoff <= 0 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coding style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2fixed
sci_info->paddr = d->arch.sci_channel.paddr; | ||
sci_info->func_id = d->arch.sci_channel.guest_func_id; | ||
#endif /* CONFIG_ARM_SCI */ | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you need to return -ENODEV
if CONFIG_ARM_SCI
is not enabled or SCI is not enabled for the domain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the second part of my comment? What if SCI is not enabled for that particular domain? It will have no valid paddr and func id in that case
xen/arch/arm/domctl.c
Outdated
return 0; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra enter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
xen/arch/arm/domctl.c
Outdated
return subarch_do_domctl(domctl, d, u_domctl); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
If enabled, host device-tree will be exported to hypfs and can be accessed through /devicetree path. Exported device-tree has the same format, as the device-tree exported to the sysfs by the Linux kernel. This is useful when XEN toolstack needs an access to the host device-tree. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
This enumeration sets SCI type for the domain. Currently there is two possible options: either 'none' or 'scmi_smc'. 'none' is the default value and it disables SCI support at all. 'scmi_smc' enables access to the Firmware from the domains using SCMI protocol and SMC as transport. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
@lorc @GrygiriiS updated. ready to stage 2 |
I see no new changes |
2eb8c90
to
418a1bc
Compare
I'm really sorry... pushed to another branch... Updated @lorc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you are missing some fixes, although you said that you fixed it
xen/arch/arm/domain_build.c
Outdated
if ( res ) | ||
return res; | ||
|
||
return map_regions_p2mt(d, gaddr_to_gfn(addr), PFN_DOWN(len), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where it was fixed.
xen/arch/arm/domain_build.c
Outdated
@@ -1741,6 +1755,12 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo, | |||
*/ | |||
evtchn_allocate(d); | |||
|
|||
#ifdef CONFIG_SCMI_SMC | |||
res = mem_permit_access(kinfo->d, kinfo->d->arch.sci_channel.paddr, | |||
0x1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still constant 0x1000
Mapping for the hardware domain should be done during domain construciton as it is done for other domains. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
Integration of the SCMI-Mediator feature to the Domain-0 construction process. It includes shared memory node creation and mapping with phandle update on the scmi 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 <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
Assgin devices to the access-controller during Domain-0 build. This registers devices in the SCMI server for the Domain-0. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
Remove space before function definition. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
418a1bc
to
2e8d596
Compare
Fixed all. Merged changes to the wrong commit. I think once Review is finished. I will make a pr to 4.19-xt0.1 with already reviewed code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the last two comments resolved:
Reviewed-by: Volodymyr Babchuk <[email protected]>
sci_info->paddr = d->arch.sci_channel.paddr; | ||
sci_info->func_id = d->arch.sci_channel.guest_func_id; | ||
#endif /* CONFIG_ARM_SCI */ | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the second part of my comment? What if SCI is not enabled for that particular domain? It will have no valid paddr and func id in that case
tools/libs/light/libxl_arm.c
Outdated
|
||
phandle = fdt_get_phandle(pfdt, node_next); | ||
|
||
rc = fdt_get_path(pfdt, node_next, full_name, 128); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least use sizeof(full_name)
here. No need for magic numbers.
In reply to comment: #214 (comment) |
Where? Imagine you have purely virtual DomU without access to hardware. It does not need access to SCMI and SCMI should be disabled for this domain. In this case this domctl should return EINVAL or ENODEV or some other error. |
sci_info->func_id = d->arch.sci_channel.guest_func_id; | ||
return 0; | ||
#else | ||
return -ENODEV; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some weird github twist... probably.
Integration of the SCMI mediator with xen libs: - add hypercalls to aquire SCI channel and set device permissions for DomUs; - add SCMI_SMC nodes to DomUs device-tree based on partial device-tree; - SCI requests redirection from DomUs to Firmware. Signed-off-by: Oleksii Moisieiev <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]>
2e8d596
to
7226c43
Compare
fixed. |
7226c43
to
f5007bb
Compare
This feature is adding SCMI mediator support for DomU. Since toolstack is not using in current rpi5 setup - there is no posibility to test it on rpi5. But this approach was tested on R-Car Gen3 board which is using toolstack to start the Domains.
This pr was made to make SCMI-Mediator support generic.
Config parameters needed to enable scmi feature:
DomU configuration:
DomU partial dtb:
TODO:
Postponed: