-
Notifications
You must be signed in to change notification settings - Fork 210
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
Add support for retrieving boot cpu id and mpidr from proxy #369
base: main
Are you sure you want to change the base?
Conversation
Support non-0,0,0 boot cpu in python hypervisor code Signed-off-by: Daniel Berlin <[email protected]>
boot_cpu_name = "cpu" + str(self.p.get_boot_cpu_idx()) | ||
boot_cpu_adt = self.u.adt["/cpus/" + boot_cpu_name] | ||
boot_cpu_mpidr = self.p.get_boot_cpu_mpidr() | ||
self.started_cpus[0] = (boot_cpu_adt.die_id, boot_cpu_adt.cluster_id, boot_cpu_mpidr & 0xf) |
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.
t8122 doesn't have die-id
, please use getattr(boot_cpu_adt, "die_id", 0)
instead
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.
Will do
for cpu in self.adt["cpus"][1:]: | ||
boot_cpu_name = "cpu" + str(self.p.get_boot_cpu_idx()) | ||
for cpu in self.adt["cpus"]: | ||
if cpu.name == boot_cpu_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.
since we already have the CPU core's ADT node wouldn't it make more sense to test cpu.state == "running" directly
?
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.
yes, fair enough, i'l fix
@@ -54,6 +54,12 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply) | |||
case P_GET_BOOTARGS: | |||
reply->retval = boot_args_addr; | |||
break; | |||
case P_GET_BOOT_CPU_IDX: | |||
reply->retval = boot_cpu_idx; |
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 think it's a good idea to retrieve something which is only valid after smp_start_secondaries
is called.
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.
Thoughts on how to approach this?
This was all sort of a hack to get it working.
I could make smp_start_secondaries return this value as an out arg or something?
Or some totally different approach?
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 would use the state
property from the ADT. In two cases it is iterating over all CPUs and skipping the boot CPU. The remaining use can be replaced with [cpu for cpu in self.u.adt["cpus"] if cpu.state == "running"][0]
.
reply->retval = boot_cpu_idx; | ||
break; | ||
case P_GET_BOOT_CPU_MPIDR: | ||
reply->retval = boot_cpu_mpidr; |
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 think anyone has plans to use the non boot CPU for proxy commands so this is equivalent to u.mrs(MPIDR_EL1)
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.
Yes, i'l remove
for cpu in list(self.adt["cpus"]): | ||
if cpu.name != "cpu0": | ||
if cpu.name != boot_cpu_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.
simpler change without additional proxy commands would use the CPU's ADT node "state" property
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.
Yep.
4f95305
to
95d67cf
Compare
Review comments never got addressed for this one, right? @dberlin do you want me to fix it up myself if you're busy? |
I have the alternate implementation in https://github.com/jannau/m1n1/commits/t8122/ and will create a PR tonight |
this can be closed now, right? |
Uses it to add basic support for non-0,0,0 boot cpu in python hypervisor code
Signed-off-by: Daniel Berlin [email protected]