Skip to contentSkip to conversation

Standard/common method for booting secondary cores

DISCUSSION Mason 3 participants 5 messages Apr 20, 2015 – Apr 21, 2015

lore
Share & tools
lore

Mason

author
#0 lore raw

Hello,

With the current push for CONFIG_ARCH_MULTIPLATFORM, I'm wondering if things like starting secondary cores have been "standardized"/factorized to the point where I can just use some default implementation?

I think the implementation I'm using as a starting point uses SMC calls. I think we are using "TrustZone" where Linux runs in NS (non secure) mode, and a tiny proprietary OS runs in secure mode.

IIUC (which is probably NOT the case), when Linux runs in NS mode, some operations that are typically carried out at boot/init are not allowed, such as

- starting secondary cores
- configuring the L2 cache controller

and this must be done by the secure OS via SMC?

I'd be happy to be given pointers to internet references and do my own reading. I've bookmarked a few on related subjects:

http://events.linuxfoundation.org/sites/events/files/slides/clement-smp-bring-up-on-arm-soc.pdf
http://www.linux-arm.org/pub/LinuxPlatform/RealViewLink/Booting_ARM_Linux_SMP_on_MPCore.doc
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0388g/Beihjjgb.html
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.prd29-genc-009492c/index.html

Are the arch/arm/common/mcpm_* files relevant?

Regards.

#1 lore raw
Quoted 11 lines · Mason

Hello,

With the current push for CONFIG_ARCH_MULTIPLATFORM, I'm wondering if things like starting secondary cores have been "standardized"/factorized to the point where I can just use some default implementation?

I think the implementation I'm using as a starting point uses SMC calls. I think we are using "TrustZone" where Linux runs in NS (non secure) mode, and a tiny proprietary OS runs in secure mode.

_If_ you're implementing something new and have a say in what gets implemented in the firmware, please consider PSCI.

Without this, little standardisation exists. Low level CPU power management must typically involve SMCs, but there's no standardisation of their exact semantics, which implies that some platform-specific glue will likely be needed. The best you can do is look for one or more backends in the kernel that are close to what you need (if any), and if so propose some refactoring to extend support to your platform.

Quoted 8 lines

IIUC (which is probably NOT the case), when Linux runs in NS mode, some operations that are typically carried out at boot/init are not allowed, such as

- starting secondary cores
- configuring the L2 cache controller

and this must be done by the secure OS via SMC?

Generally, yes.

Quoted 8 lines

I'd be happy to be given pointers to internet references and do my own reading. I've bookmarked a few on related subjects:

http://events.linuxfoundation.org/sites/events/files/slides/clement-smp-bring-up-on-arm-soc.pdf
http://www.linux-arm.org/pub/LinuxPlatform/RealViewLink/Booting_ARM_Linux_SMP_on_MPCore.doc
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0388g/Beihjjgb.html
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.prd29-genc-009492c/index.html

For PSCI, you can look at http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/index.html.

Quoted 2 lines

Are the arch/arm/common/mcpm_* files relevant?

MCPM is infrastructure for handling _cluster_ powerup/powerdown, in kernels where Linux runs in Secure (or otherwise has a high level of access to power controls).

If unsure, say N.

[...]

Cheers
---Dave

author
#2 lore raw

Hello Dave,

It seems you and Mark posted within seconds of each other :-)

Quoted 8 lines · Dave Martin
Quoted 7 lines · Mason

Hello,

With the current push for CONFIG_ARCH_MULTIPLATFORM, I'm wondering if things like starting secondary cores have been "standardized"/factorized to the point where I can just use some default implementation?

Quoted 6 lines
Quoted 4 lines

I think the implementation I'm using as a starting point uses SMC calls. I think we are using "TrustZone" where Linux runs in NS (non secure) mode, and a tiny proprietary OS runs in secure mode.

_If_ you're implementing something new

You're talking about software, right?
(The hardware already exists.)
As I mentioned we do have a working implementation using SMC to request service from the secure OS, but I have some time to evaluate "better" strategies, as I port the platform to a newer kernel.

Quoted 2 lines

and have a say in what gets implemented in the firmware, please consider PSCI.

In this context, firmware would be the code run by the secure OS?

Quoted 7 lines

Without this, little standardisation exists. Low level CPU power management must typically involve SMCs, but there's no standardisation of their exact semantics, which implies that some platform-specific glue will likely be needed. The best you can do is look for one or more backends in the kernel that are close to what you need (if any), and if so propose some refactoring to extend support to your platform.

My objective is to minimize platform-specific code, I will look into PSCI.

Quoted 10 lines
Quoted 8 lines

IIUC (which is probably NOT the case), when Linux runs in NS mode, some operations that are typically carried out at boot/init are not allowed, such as

- starting secondary cores
- configuring the L2 cache controller

and this must be done by the secure OS via SMC?

Generally, yes.

Is PSCI involved in L2$ configuration?

Quoted 12 lines
Quoted 8 lines

I'd be happy to be given pointers to internet references and do my own reading. I've bookmarked a few on related subjects:

http://events.linuxfoundation.org/sites/events/files/slides/clement-smp-bring-up-on-arm-soc.pdf
http://www.linux-arm.org/pub/LinuxPlatform/RealViewLink/Booting_ARM_Linux_SMP_on_MPCore.doc
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0388g/Beihjjgb.html
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.prd29-genc-009492c/index.html

For PSCI, you can look at http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/index.html.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Are the arch/arm/common/mcpm_* files relevant?

MCPM is infrastructure for handling _cluster_ powerup/powerdown, in kernels where Linux runs in Secure (or otherwise has a high level of access to power controls).

If unsure, say N.

Thanks.

#3 lore raw
Quoted 3 lines · Mason

Hello Dave,

It seems you and Mark posted within seconds of each other :-)

Seems so... fortunately we didn't argue the opposite to each other.

Quoted 14 lines · Dave Martin
Quoted 13 lines · Mason
Quoted 11 lines

Hello,

With the current push for CONFIG_ARCH_MULTIPLATFORM, I'm wondering if things like starting secondary cores have been "standardized"/factorized to the point where I can just use some default implementation?

I think the implementation I'm using as a starting point uses SMC calls. I think we are using "TrustZone" where Linux runs in NS (non secure) mode, and a tiny proprietary OS runs in secure mode.

Quoted 4 lines
Quoted 1 line

_If_ you're implementing something new

You're talking about software, right?
(The hardware already exists.)

Yes, PSCI is a software interface.

Quoted 10 lines

As I mentioned we do have a working implementation using SMC to request service from the secure OS, but I have some time to evaluate "better" strategies, as I port the platform to a newer kernel.

Quoted 2 lines

and have a say in what gets implemented in the firmware, please consider PSCI.

In this context, firmware would be the code run by the secure OS?

Yes, or at least those parts of the Secure World software that provide essential services to the main OS.

Quoted 15 lines
Quoted 7 lines

Without this, little standardisation exists. Low level CPU power management must typically involve SMCs, but there's no standardisation of their exact semantics, which implies that some platform-specific glue will likely be needed. The best you can do is look for one or more backends in the kernel that are close to what you need (if any), and if so propose some refactoring to extend support to your platform.

My objective is to minimize platform-specific code, I will look into PSCI.

Quoted 4 lines
Quoted 4 lines

IIUC (which is probably NOT the case), when Linux runs in NS mode, some operations that are typically carried out at boot/init are not allowed, such as

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

- starting secondary cores
- configuring the L2 cache controller

and this must be done by the secure OS via SMC?

Generally, yes.

Is PSCI involved in L2$ configuration?

That depends on the platform. Single-cluster systems might not have to do very much L2 configuration, but it depends on the hardware -- particularly of the L2 is external.

I suggest you take a look at the PSCI spec first -- this should make is clearer what the firmware is expected to do.

Cheers
---Dave