ARM: EXYNOS: add Exynos Dual Cluster Support
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 3/4 ARM: EXYNOS: add Exynos Dual Cluster Support
Quoted 19 lines · Dave Martin
Quoted 9 lines · Nicolas Pitre
Quoted 6 lines · Dave Martin
If there is a pending powerdown which has reached the
__mcpm_cpu_down()stage, then the kernel has no way to know what is still pending. This means that when callingexynos_power_up(cpu, cluster)after a successful call toexynos_power_down(same cpu, cluster), there is a chance that the CPU still gets powered down, because of the pendingexynos_core_power_control()on the outbound side.Quoted 3 lines
Quoted 3 lines
This isn't an issue for TC2, because TC2's power controller queues requests and services them in order, so a new powerup request cannot race with a powerdown request in that way.
We still rely on the power controller doing some serialisation.
Come to think of it, I should go and take a look at how
cpu_kill()should be implemented for DSCSB too.
Quoted 7 lines
Quoted 4 lines
The reason why this isn't an issue for TC2 is because the request to power down request is sent from within the spinlock protected area which serializes all requests. Here
exynos_core_power_down()is invoked where there is no such protection.We don't wait for the requests to complete before dropping the lock, so we still rely on the SPC doing some serialisation.
Yes. But the request order is still preserved in that case.
In this case here, the exynos_core_power_up call is performed with a lock held, but exynos_core_power_down is not. This means that, by the time exynos_core_power_down is about to be called, some other CPU might have decided that the current CPU should not power down after all and call exynos_core_power_up. Which one will win the race and execute before the other is up in the air.
It is important that the actual power control be tightly related to the management of the usage count currently and properly done within the lock protected area. If the use count is zero in the power_up request then the power has to be turned on.
However here there is still a chance that the power will be turned off right away afterwards based on the skip_wfi variable which is wrong.
Quoted 6 lines
Quoted 2 lines
The simple fix would be to simply move this call up, assuming that the power is actually turned off only when the WFI signal is asserted.
Can you explain? I'm not sure I get this -- once the outbound CPU has gone into blackout there's no way to know when it's finished except to wait.
The issue here is not about whether or not the outbound has finished killing itself. It is about making sure that the actual power knob is on or off according to the use count. Therefore the power knob has to be toggled from within the same lock protected area as the use count for coherency to be preserved. If exynos_core_power_down is called outside of the lock protected area, it is well possible that the use count might have gone back to 1 in the mean time.
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Maybe we should always just poll and wait, though.
exynos_power_up()should never be called for a CPU that the kernel thinks is already up, so it should either be down already (in which case we will poll the status once and then continue), or a power down is pending (in which case we must wait, but we know the wait will terminate). This would be simpler than tracking a "power down pending" flag for each CPU.That is also a good way to avoid the race.
I guess it will depend on exactly what the power controller does.
Right.
Samsung people: could you give us more info on the behavior of the power controller please?
Nicolas
Hi,
Quoted 62 lines · Nicolas Pitre
Quoted 17 lines · Dave Martin
Quoted 11 lines · Nicolas Pitre
Quoted 9 lines · Dave Martin
If there is a pending powerdown which has reached the
__mcpm_cpu_down()stage, then the kernel has no way to know what is still pending. This means that when callingexynos_power_up(cpu, cluster)after a successful call toexynos_power_down(same cpu, cluster), there is a chance that the CPU still gets powered down, because of the pendingexynos_core_power_control()on the outbound side.
This isn't an issue for TC2, because TC2's power controller queues requests and services them in order, so a new powerup request cannot race with a powerdown request in that way.We still rely on the power controller doing some serialisation.
Come to think of it, I should go and take a look at how
cpu_kill()should be implemented for DSCSB too.Quoted 6 lines
Quoted 4 lines
The reason why this isn't an issue for TC2 is because the request to power down request is sent from within the spinlock protected area which serializes all requests. Here
exynos_core_power_down()is invoked where there is no such protection.We don't wait for the requests to complete before dropping the lock, so we still rely on the SPC doing some serialisation.
Yes. But the request order is still preserved in that case.
In this case here, the
exynos_core_power_upcall is performed with a lock held, butexynos_core_power_downis not. This means that, by the timeexynos_core_power_downis about to be called, some other CPU might have decided that the current CPU should not power down after all and callexynos_core_power_up. Which one will win the race and execute before the other is up in the air.It is important that the actual power control be tightly related to the management of the usage count currently and properly done within the lock protected area. If the use count is zero in the
power_uprequest then the power has to be turned on.However here there is still a chance that the power will be turned off right away afterwards based on the
skip_wfivariable which is wrong.Quoted 5 lines
Quoted 2 lines
The simple fix would be to simply move this call up, assuming that the power is actually turned off only when the WFI signal is asserted.
Can you explain? I'm not sure I get this -- once the outbound CPU has gone into blackout there's no way to know when it's finished except to wait.
The issue here is not about whether or not the outbound has finished killing itself. It is about making sure that the actual power knob is on or off according to the use count. Therefore the power knob has to be toggled from within the same lock protected area as the use count for coherency to be preserved. If
exynos_core_power_downis called outside of the lock protected area, it is well possible that the use count might have gone back to 1 in the mean time.Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Maybe we should always just poll and wait, though.
exynos_power_up()should never be called for a CPU that the kernel thinks is already up, so it should either be down already (in which case we will poll the status once and then continue), or a power down is pending (in which case we must wait, but we know the wait will terminate). This would be simpler than tracking a "power down pending" flag for each CPU.That is also a good way to avoid the race.
Quoted 9 lines
Quoted 1 line
I guess it will depend on exactly what the power controller does.
Right.
Samsung people: could you give us more info on the behavior of the power controller please?
Nicolas
This is how the power controller works on exynos5410. For example for CORE0.
ARM_CORE0_STATUS register indicates the power state of Core 0 part of processor core.0x3 indicates that power to Core 0 is turned-on. 0x0 indicates that power to Core 0 is turned-off.
All other values indicate that the power On/Off sequence of Core 0 in progress.
To turn Off the power of Core 0 power domain:
1. Set the LOCAL_POWER_CFG field of ARM_CORE0_CONFIGURATION register to 0x3.
2. After PMU detects a change in the LOCAL_POWER_CFG field, it waits for the execution of WFI.
3. After Core 0 executes the WFI instruction, PMU starts the power-down sequence.
4. The Status field of ARM_CORE0_STATUS register indicates the completion of the sequence.
That's why in the v1 of this patch exynos_core_power_control function was implemented as:
static int exynos_core_power_control(unsigned int cpu, unsigned int cluster, int enable)
{
unsigned long timeout = jiffies + msecs_to_jiffies(10);
unsigned int offset = cluster * MAX_CPUS_PER_CLUSTER + cpu;
int value = enable ? S5P_CORE_LOCAL_PWR_EN : 0;
if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value)
return 0;
__raw_writel(value, EXYNOS5410_CORE_CONFIGURATION(offset));
do {
if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3)
== value)
return 0;
} while (time_before(jiffies, timeout));
return -EDEADLK;
}But, as i mentioned, this is no good using while here. Now thinking about the problem.
Thank you,
Tarek Dakhran
Hi,
Quoted 52 lines · Tarek Dakhran
Quoted 8 lines · Nicolas Pitre
Samsung people: could you give us more info on the behavior of the power controller please?
Nicolas
This is how the power controller works on exynos5410. For example for CORE0.
ARM_CORE0_STATUSregister indicates the power state of Core 0 part of processor core.0x3indicates that power to Core 0 is turned-on.0x0indicates that power to Core 0 is turned-off.
All other values indicate that the power On/Off sequence of Core 0 in progress.To turn Off the power of Core 0 power domain:
1. Set the
LOCAL_POWER_CFGfield ofARM_CORE0_CONFIGURATIONregister to0x3.
2. After PMU detects a change in theLOCAL_POWER_CFGfield, it waits for the execution of WFI.
3. After Core 0 executes the WFI instruction, PMU starts the power-down sequence.
4. The Status field ofARM_CORE0_STATUSregister indicates the completion of the sequence.That's why in the v1 of this patch
exynos_core_power_controlfunction was implemented as:static int
exynos_core_power_control(unsigned int cpu, unsigned int cluster, int enable){ unsigned long timeout = jiffies + msecs_to_jiffies(10); unsigned int offset = cluster * MAX_CPUS_PER_CLUSTER + cpu; int value = enable ? S5P_CORE_LOCAL_PWR_EN : 0; if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value) return 0; __raw_writel(value, EXYNOS5410_CORE_CONFIGURATION(offset)); do { if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value) return 0; } while (time_before(jiffies, timeout)); return -EDEADLK; }
Quoted 5 lines
But, as i mentioned, this is no good using while here. Now thinking about the problem.
Thank you,
Tarek Dakhran
What do you think about this way of solving the problem with races?
Add new edcs_power_controller_wait function.
static void edcs_power_controller_wait(unsigned int cpu, unsigned int cluster){
unsigned long timeout = jiffies + msecs_to_jiffies(10);
unsigned int offset = cluster * EDCS_CPUS_PER_CLUSTER + cpu;
void __iomem *status_reg = EDCS_CORE_STATUS(offset);
/* wait till core power controller finish the work */
do {
if ((readl_relaxed(status_reg) & 3) ==
edcs_use_count[cpu][cluster] ? 3 : 0)
return;
} while (time_before(jiffies, timeout));
/* Should never get here */
BUG();
}Use it in:
static void exynos_core_power_up(unsigned int cpu, unsigned int cluster)
{
exynos_core_power_control(cpu, cluster, true);
edcs_power_controller_wait(cpu, cluster);
}and in:
static void exynos_power_down(void)
{
bool last_man = false, skip_wfi = false;
unsigned int mpidr = read_cpuid_mpidr();
unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
pr_debug("%s: CORE%d on CLUSTER %d\n", __func__, cpu, cluster);
BUG_ON(cpu >= EDCS_CPUS_PER_CLUSTER || cluster >= EDCS_CLUSTERS);
__mcpm_cpu_going_down(cpu, cluster);
arch_spin_lock(&edcs_lock);
BUG_ON(__mcpm_cluster_state(cluster) != CLUSTER_UP);
edcs_use_count[cpu][cluster]--;
if (edcs_use_count[cpu][cluster] == 0) {
exynos_core_power_down(cpu, cluster);
--core_count[cluster];
if (core_count[cluster] == 0)
last_man = true;
[snip]
__mcpm_cpu_down(cpu, cluster);
if (!skip_wfi){
wfi();
}
edcs_power_controller_wait(cpu, cluster);
}Comments appreciated. Thanks.
Best regards,
Tarek Dakhran.
PATCH v3 3/4 ARM: EXYNOS: add Exynos Dual Cluster Support
Quoted 113 lines · Tarek Dakhran
Hi,
Quoted 50 lines · Tarek Dakhran
Quoted 8 lines · Nicolas Pitre
Samsung people: could you give us more info on the behavior of the power controller please?
Nicolas
This is how the power controller works on exynos5410. For example for CORE0.
ARM_CORE0_STATUSregister indicates the power state of Core 0 part of processor core.0x3indicates that power to Core 0 is turned-on.0x0indicates that power to Core 0 is turned-off.
All other values indicate that the power On/Off sequence of Core 0 in progress.To turn Off the power of Core 0 power domain:
1. Set the
LOCAL_POWER_CFGfield ofARM_CORE0_CONFIGURATIONregister to0x3.
2. After PMU detects a change in theLOCAL_POWER_CFGfield, it waits for the execution of WFI.
3. After Core 0 executes the WFI instruction, PMU starts the power-down sequence.
4. The Status field ofARM_CORE0_STATUSregister indicates the completion of the sequence.That's why in the v1 of this patch
exynos_core_power_controlfunction was implemented as:static int
exynos_core_power_control(unsigned int cpu, unsigned int cluster, int enable){ unsigned long timeout = jiffies + msecs_to_jiffies(10); unsigned int offset = cluster * MAX_CPUS_PER_CLUSTER + cpu; int value = enable ? S5P_CORE_LOCAL_PWR_EN : 0; if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value) return 0; __raw_writel(value, EXYNOS5410_CORE_CONFIGURATION(offset)); do { if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value) return 0; } while (time_before(jiffies, timeout)); return -EDEADLK; }Quoted 5 lines
But, as i mentioned, this is no good using while here. Now thinking about the problem.
Thank you,
Tarek DakhranWhat do you think about this way of solving the problem with races?
Add new
edcs_power_controller_waitfunction.static void
edcs_power_controller_wait(unsigned int cpu, unsigned int cluster){unsigned long timeout = jiffies + msecs_to_jiffies(10); unsigned int offset = cluster * EDCS_CPUS_PER_CLUSTER + cpu; void __iomem *status_reg = EDCS_CORE_STATUS(offset); /* wait till core power controller finish the work */ do { if ((readl_relaxed(status_reg) & 3) == edcs_use_count[cpu][cluster] ? 3 : 0) return; } while (time_before(jiffies, timeout)); /* Should never get here */ BUG(); }Use it in:
static void
exynos_core_power_up(unsigned int cpu, unsigned int cluster){ exynos_core_power_control(cpu, cluster, true); edcs_power_controller_wait(cpu, cluster); }and in:
static void
exynos_power_down(void){ bool last_man = false, skip_wfi = false; unsigned int mpidr = read_cpuid_mpidr(); unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: CORE%d on CLUSTER %d\n", __func__, cpu, cluster); BUG_ON(cpu >= EDCS_CPUS_PER_CLUSTER || cluster >= EDCS_CLUSTERS); __mcpm_cpu_going_down(cpu, cluster); arch_spin_lock(&edcs_lock); BUG_ON(__mcpm_cluster_state(cluster) != CLUSTER_UP); edcs_use_count[cpu][cluster]--; if (edcs_use_count[cpu][cluster] == 0) { exynos_core_power_down(cpu, cluster); --core_count[cluster]; if (core_count[cluster] == 0) last_man = true;
Quoted 8 lines
[snip]
__mcpm_cpu_down(cpu, cluster); if (!skip_wfi){ wfi(); } edcs_power_controller_wait(cpu, cluster); }
It is preferable if the power_up and power_down don't wait.
No need to wait for a power_up to be complete as the only CPU that can do a power_down is the CPU being powered up itself.
The exynos_core_power_down call is now appropriately located i.e. within the lock protected area. That's fine because we know power won't be cut until the lock is released and WFI is executed.
Also, if exynos_core_power_up() is called from another CPU right after the lock is released on the CPU trying to shut itself down but before it actually executes WFI then the WFI will not be effective and the power_down method is expected to return in that case. So no problem there either.
The only case where it is important to really wait for the power down to be effective is for kexec. This is why Dave introduced the power_down_finish method (you may find this in linux-next at the moment). That would be the place where to use your controller_wait code.
Nicolas
PATCH v3 3/4 ARM: EXYNOS: add Exynos Dual Cluster Support
Quoted 72 lines · Nicolas Pitre
Quoted 70 lines · Tarek Dakhran
Hi,
Quoted 50 lines · Tarek Dakhran
Quoted 8 lines · Nicolas Pitre
Samsung people: could you give us more info on the behavior of the power controller please?
Nicolas
This is how the power controller works on exynos5410. For example for CORE0.
ARM_CORE0_STATUSregister indicates the power state of Core 0 part of processor core.0x3indicates that power to Core 0 is turned-on.0x0indicates that power to Core 0 is turned-off.
All other values indicate that the power On/Off sequence of Core 0 in progress.To turn Off the power of Core 0 power domain:
1. Set the
LOCAL_POWER_CFGfield ofARM_CORE0_CONFIGURATIONregister to0x3.
2. After PMU detects a change in theLOCAL_POWER_CFGfield, it waits for the execution of WFI.
3. After Core 0 executes the WFI instruction, PMU starts the power-down sequence.
4. The Status field ofARM_CORE0_STATUSregister indicates the completion of the sequence.That's why in the v1 of this patch
exynos_core_power_controlfunction was implemented as:static int
exynos_core_power_control(unsigned int cpu, unsigned int cluster, int enable){ unsigned long timeout = jiffies + msecs_to_jiffies(10); unsigned int offset = cluster * MAX_CPUS_PER_CLUSTER + cpu; int value = enable ? S5P_CORE_LOCAL_PWR_EN : 0; if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value) return 0; __raw_writel(value, EXYNOS5410_CORE_CONFIGURATION(offset)); do { if ((__raw_readl(EXYNOS5410_CORE_STATUS(offset)) & 0x3) == value) return 0; } while (time_before(jiffies, timeout)); return -EDEADLK; }Quoted 5 lines
But, as i mentioned, this is no good using while here. Now thinking about the problem.
Thank you,
Tarek DakhranWhat do you think about this way of solving the problem with races?
Add new
edcs_power_controller_waitfunction.static void
edcs_power_controller_wait(unsigned int cpu, unsigned int cluster){unsigned long timeout = jiffies + msecs_to_jiffies(10); unsigned int offset = cluster * EDCS_CPUS_PER_CLUSTER + cpu; void __iomem *status_reg = EDCS_CORE_STATUS(offset);
Quoted 5 lines
Quoted 5 lines
/* wait till core power controller finish the work */ do { if ((readl_relaxed(status_reg) & 3) ==edcs_use_count[cpu][cluster] ? 3 : 0)
While we're making these changes, it would be good to take to opportunity to add a #define for these bits too.
The magic numbers here meant that I had to do some guesswork to understand the real behaviour here, and someone reading the code in the future is likely to have the same problem...
Quoted 41 lines
Quoted 41 lines
return; } while (time_before(jiffies, timeout)); /* Should never get here */ BUG(); }Use it in:
static void
exynos_core_power_up(unsigned int cpu, unsigned int cluster){ exynos_core_power_control(cpu, cluster, true); edcs_power_controller_wait(cpu, cluster); }and in:
static void
exynos_power_down(void){ bool last_man = false, skip_wfi = false; unsigned int mpidr = read_cpuid_mpidr(); unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: CORE%d on CLUSTER %d\n", __func__, cpu, cluster); BUG_ON(cpu >= EDCS_CPUS_PER_CLUSTER || cluster >= EDCS_CLUSTERS); __mcpm_cpu_going_down(cpu, cluster); arch_spin_lock(&edcs_lock); BUG_ON(__mcpm_cluster_state(cluster) != CLUSTER_UP); edcs_use_count[cpu][cluster]--; if (edcs_use_count[cpu][cluster] == 0) { exynos_core_power_down(cpu, cluster); --core_count[cluster]; if (core_count[cluster] == 0) last_man = true; [snip] __mcpm_cpu_down(cpu, cluster);
Quoted 7 lines
Quoted 5 lines
if (!skip_wfi){ wfi(); } edcs_power_controller_wait(cpu, cluster); }It is preferable if the
power_upandpower_downdon't wait.
I agree with this.
If a wait is needed anywhere, it is
a) in power_down_finish(), and
b) *before* the call to exynos_core_power_control() in exynos_core_power_up() (see below for explanation)
Any waits should not be busy-waits either: we should use msleep or similar. This is fine that we only wait from contexts that can sleep -- I think this is OK for the power_up() and power_down_finish() paths (which aren't executed on the target CPU), but not on the power_down() path.
Busy-waiting for 1ms every time we power a CPU down is not great for power-saving...
In both cases, we should check the PMU status bits first, and only wait if they are not already in the desired state. The most likely case will always by that the target CPU already caught up.
Nico currently disagrees with me on (b), so we need to explore that (below).
Quoted 2 lines
No need to wait for a
power_upto be complete as the only CPU that can do apower_downis the CPU being powered up itself.
To extend this argument further, there is no conceiveable situation where we would need to wait for power_up to complete explicitly.
We will only ever need to wait for power_down to complete.
Quoted 11 lines
The
exynos_core_power_downcall is now appropriately located i.e. within the lock protected area. That's fine because we know power won't be cut until the lock is released and WFI is executed.Also, if
exynos_core_power_up()is called from another CPU right after the lock is released on the CPU trying to shut itself down but before it actually executes WFI then the WFI will not be effective and thepower_downmethod is expected to return in that case. So no problem there either.
Quoted 5 lines
The only case where it is important to really wait for the power down to be effective is for kexec. This is why Dave introduced the
power_down_finishmethod (you may find this in linux-next at the moment). That would be the place where to use yourcontroller_waitcode.
For (b), I think we're still missing some information here...
Suppose CPU0 is powering down. The PMU has been told to power the CPU down, and CPU0 has released edcs_lock. Suppose soon afterwards, CPU1 wants to turn CPU0 back on again.
Now, unless CPU1 checks the power controller status, CPU1 has no way to know whether the power-down request is still in progress before CPU1 issues a new power-up request for CPU0.
Now, what behaviour does the power controller guarantee when it is still in this state, and a new power-up request is issued to it?
I worry that the power controller may not cope with a new request while in this state, or may not guarantee predictable behaviour. If so then the new power-up request may just get lost -- avoiding that problem requires power_up() to wait for a pending power_down() to finish before issuing a new command to the power controller.
Only the hardware documentation can answer this question.
Cheers
---Dave
PATCH v3 3/4 ARM: EXYNOS: add Exynos Dual Cluster Support
Quoted 11 lines · Dave Martin
Quoted 1 line · Nicolas Pitre
It is preferable if the
power_upandpower_downdon't wait.I agree with this.
If a wait is needed anywhere, it is
a) in
power_down_finish(), and
b) *before* the call toexynos_core_power_control()inexynos_core_power_up()(see below for explanation)
Quoted 5 lines
Any waits should not be busy-waits either: we should use msleep or similar. This is fine that we only wait from contexts that can sleep -- I think this is OK for the
power_up()andpower_down_finish()paths (which aren't executed on the target CPU), but not on thepower_down()path.
Beware.. exynos_core_power_up() is called with a lock held.
Quoted 6 lines
Busy-waiting for 1ms every time we power a CPU down is not great for power-saving...
In both cases, we should check the PMU status bits first, and only wait if they are not already in the desired state. The most likely case will always by that the target CPU already caught up.
There is no need for the CPU going down to check the PMU status. It can only have one state at that point.
Quoted 10 lines
Nico currently disagrees with me on (b), so we need to explore that (below).
Quoted 2 lines
No need to wait for a
power_upto be complete as the only CPU that can do apower_downis the CPU being powered up itself.To extend this argument further, there is no conceiveable situation where we would need to wait for
power_upto complete explicitly.We will only ever need to wait for
power_downto complete.
Exact.
Quoted 19 lines
Quoted 11 lines
The
exynos_core_power_downcall is now appropriately located i.e. within the lock protected area. That's fine because we know power won't be cut until the lock is released and WFI is executed.Also, if
exynos_core_power_up()is called from another CPU right after the lock is released on the CPU trying to shut itself down but before it actually executes WFI then the WFI will not be effective and thepower_downmethod is expected to return in that case. So no problem there either.Quoted 5 lines
The only case where it is important to really wait for the power down to be effective is for kexec. This is why Dave introduced the
power_down_finishmethod (you may find this in linux-next at the moment). That would be the place where to use yourcontroller_waitcode.For (b), I think we're still missing some information here...
Quoted 7 lines
Suppose CPU0 is powering down. The PMU has been told to power the CPU down, and CPU0 has released
edcs_lock. Suppose soon afterwards, CPU1 wants to turn CPU0 back on again.Now, unless CPU1 checks the power controller status, CPU1 has no way to know whether the power-down request is still in progress before CPU1 issues a new power-up request for CPU0.
Does it matter? As you say ...
Quoted 6 lines
Now, what behaviour does the power controller guarantee when it is still in this state, and a new power-up request is issued to it?
I worry that the power controller may not cope with a new request while in this state, or may not guarantee predictable behaviour. If so then the new power-up request may just get lost
This is not the case on TC2 it seems. We never check if a power-down sequence has completed before issuing a power-up request. Given each CPU has its own request bit then this might not matter.
Where this matters is when you really want to ensure a given CPU is not executing code anymore and therefore need to know when power-down has effectively completed, hence the power_down_finish method.
Nicolas