Skip to contentSkip to conversation

arm: psci: implement cpuidle_ops

RFC Jisheng Zhang 4 participants 7 messages Jul 2, 2015 – Jul 7, 2015

lore
Share & tools
lore
#0 lore raw

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for arm psci, I dunno whether this is the correct direction, could you please give suggestions?

Thanks,
Jisheng

#1 lore raw
Quoted 6 lines · Jisheng Zhang

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for arm psci, I dunno whether this is the correct direction, could you please give suggestions?

You should look at the macro

arch/arm/include/asm/cpuidle.h:

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#2 lore raw
Quoted 11 lines · Daniel Lezcano
Quoted 9 lines · Jisheng Zhang

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For
arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for
arm psci, I dunno whether this is the correct direction, could you please give
suggestions?

Quoted 5 lines

You should look at the macro

arch/arm/include/asm/cpuidle.h:

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)

And more precisely, you can look at the code using it.

https://git.kernel.org/cgit/linux/kernel/git/galak/linux-qcom.git/tree/drivers/soc/qcom/spm.c?h=qcom/all#n282

Signature · 5 lines
  <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#4 lore raw
In reply to Daniel Lezcano

Dear Daniel,

Quoted 8 lines · On Thu, 2 Jul 2015 10:07:11 +0200 Daniel Lezcano <[email protected]>…
Quoted 6 lines · Jisheng Zhang

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for arm psci, I dunno whether this is the correct direction, could you please give suggestions?

Quoted 5 lines

You should look at the macro

arch/arm/include/asm/cpuidle.h:

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)

Yep, this is what I want to use. I want to use this MACRO to implement cpuidle_ops for arm, but I dunno whether this is the correct direction. And I'd like to reuse cpu_psci_cpu_init_idle() function in arch/arm64/kernel/psci.c to parse the DT, but I'm not sure where to put cpu_psci_cpu_init_idle() so that can be shared between arm and arm64. Also I noticed that there's a psci unification work from Mark Rutland, does it make sense to put it in drivers/firmware/psci.c?

Thanks a lot,
Jisheng

#3 lore raw
In reply to Daniel Lezcano
Quoted 14 lines · On Thu, 2 Jul 2015 10:16:08 +0200 Daniel Lezcano <[email protected]>…
Quoted 13 lines · Daniel Lezcano
Quoted 9 lines · Jisheng Zhang

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For
arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for
arm psci, I dunno whether this is the correct direction, could you please give
suggestions?

You should look at the macro

Quoted 8 lines
Quoted 3 lines

arch/arm/include/asm/cpuidle.h:

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)

And more precisely, you can look at the code using it.

https://git.kernel.org/cgit/linux/kernel/git/galak/linux-qcom.git/tree/drivers/soc/qcom/spm.c?h=qcom/all#n282

Thanks for this URL. I'll cook similar patches for arm psci cpuidle_ops.

Thanks

#5 lore raw
In reply to Jisheng Zhang
Quoted 17 lines · Jisheng Zhang

Dear Daniel,

Quoted 12 lines · On Thu, 2 Jul 2015 10:07:11 +0200 Daniel Lezcano <[email protected]>…
Quoted 6 lines · Jisheng Zhang

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for arm psci, I dunno whether this is the correct direction, could you please give suggestions?

You should look at the macro

arch/arm/include/asm/cpuidle.h:

Quoted 8 lines
Quoted 1 line

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)

Yep, this is what I want to use. I want to use this MACRO to implement cpuidle_ops for arm, but I dunno whether this is the correct direction. And I'd like to reuse cpu_psci_cpu_init_idle() function in arch/arm64/kernel/psci.c to parse the DT, but I'm not sure where to put cpu_psci_cpu_init_idle() so that can be shared between arm and arm64. Also I noticed that there's a psci unification work from Mark Rutland, does it make sense to put it in drivers/firmware/psci.c?

I think cpu_psci_cpu_init_idle() should live in drivers/firmware/psci.c. I also think that Lorenzo had an idea as to what should be done regarding unifying the arm and arm64 approaches, but he's currently away and I'm not all that familiar with cpuidle.

Thanks,
Mark.

#6 lore raw
Quoted 27 lines · Mark Rutland
Quoted 17 lines · Jisheng Zhang

Dear Daniel,

Quoted 12 lines · On Thu, 2 Jul 2015 10:07:11 +0200 Daniel Lezcano <[email protected]>…
Quoted 6 lines · Jisheng Zhang

Hi all,

we'd like to use cpuidle-arm.c for both arm and arm64 with psci as backend. For arm64, it works. But for arm, we miss cpuidle_ops. I want to add cpuidle_ops for arm psci, I dunno whether this is the correct direction, could you please give suggestions?

You should look at the macro

arch/arm/include/asm/cpuidle.h:

Quoted 8 lines
Quoted 1 line

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)

Yep, this is what I want to use. I want to use this MACRO to implement cpuidle_ops for arm, but I dunno whether this is the correct direction. And I'd like to reuse cpu_psci_cpu_init_idle() function in arch/arm64/kernel/psci.c to parse the DT, but I'm not sure where to put cpu_psci_cpu_init_idle() so that can be shared between arm and arm64. Also I noticed that there's a psci unification work from Mark Rutland, does it make sense to put it in drivers/firmware/psci.c?

Quoted 4 lines

I think cpu_psci_cpu_init_idle() should live in drivers/firmware/psci.c. I also think that Lorenzo had an idea as to what should be done regarding unifying the arm and arm64 approaches, but he's currently away and I'm not all that familiar with cpuidle.

Yes, PSCI idle states initialization must be common between arm and arm64, and also cpu_psci_cpu_suspend now that the cpu_suspend() API was made common.

The drivers/firmware PSCI implementation for those hooks can be used to inizialize the respective arm/arm64 structures then, as highlighted in this thread. I will review the series.

Thanks,
Lorenzo