Skip to contentSkip to conversation

SOC-specific action for irq_set_wake

DISCUSSION Sören Brinkmann 4 participants 11 messages Jul 19, 2016 – Jul 20, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.
2. Stuff things into the secure monitor
I guess we could read the GIC registers once we enter the secure monitor and do the communication with the companion core from there by identifying unmasked IRQs as wake IRQs. My concern here is that it might introduce additional hardcoded mappings that are much more dynamic in Linux thanks to the DT description.

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

Thanks,
S?ren

#1 lore raw
Quoted 5 lines · S?ren Brinkmann

Hi,

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

Quoted 8 lines

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

On Qualcomm platforms there is something similar. When the system is power collapsed, the GIC loses context and can no longer handle/generate IRQs. There is a separate block called the MPM that provides some registers that the user can program. These registers allow for up to 64 wake IRQs, each of which can map to either a GPIO pin or an GIC IRQ. The MPM also has a timer that can generate a wake IRQ so that the system can wake up and maintain the time.

Quoted 10 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

So not too long ago there were irq extensions that you could add in to an irq controller that would allow for intercepting the set wake calls. This went away and was replaced by the hierarchical irq design.

The way I am currently implementing the MPM for Qualcomm, I am defining the MPM as a IRQ controller and creating relationships between the MPM and the GPIO controller (source of irqs) and the GIC. As irqs are set wake and cleared the calls go up through the hierarchy and they call each irqchips functions (if you have it setup to do that).

Quoted 6 lines

2. Stuff things into the secure monitor
I guess we could read the GIC registers once we enter the secure monitor and do the communication with the companion core from there by identifying unmasked IRQs as wake IRQs. My concern here is that it might introduce additional hardcoded mappings that are much more dynamic in Linux thanks to the DT description.

This could work, but you'd have to have control of the secure monitor code. In Qualcomm's case, that wouldn't work or couldn't because they won't change that code. And you'd have to have calls into the monitor to turn on/off the lines.

Quoted 4 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

Regards,

Andy Gross

#2 lore raw

Hi Andy,

Quoted 15 lines · Andy Gross
Quoted 5 lines · S?ren Brinkmann

Hi,

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

Quoted 8 lines

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

Quoted 6 lines

On Qualcomm platforms there is something similar. When the system is power collapsed, the GIC loses context and can no longer handle/generate IRQs. There is a separate block called the MPM that provides some registers that the user can program. These registers allow for up to 64 wake IRQs, each of which can map to either a GPIO pin or an GIC IRQ. The MPM also has a timer that can generate a wake IRQ so that the system can wake up and maintain the time.

We have a full companion core running firmware. As in your case, we can use any IRQ source and some additional IOs as wake event. So, it's fundamentally very similar. Main difference is probably the interface. In our case, we have some platform-specific FW interfaces that we need to call. Basically, Linux doing an SMC call and then the secure monitor handling the rest. And for that we may also have to do some additional mapping of the IRQ number to something the FW interface understands.

Quoted 12 lines
Quoted 11 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

Quoted 3 lines

So not too long ago there were irq extensions that you could add in to an irq controller that would allow for intercepting the set wake calls. This went away and was replaced by the hierarchical irq design.

Yeah, I though I remembered that and wanted to use it now and was slightly disappointed when I couldn't find the code anymore.

Quoted 6 lines

The way I am currently implementing the MPM for Qualcomm, I am defining the MPM as a IRQ controller and creating relationships between the MPM and the GPIO controller (source of irqs) and the GIC. As irqs are set wake and cleared the calls go up through the hierarchy and they call each irqchips functions (if you have it setup to do that).

I suspected that some sort of dummy interrupt controller might be one way to do it. I was hoping to find a simpler way, but maybe this is the way to go. One concern could be that this might require adding something into the DT that doesn't really exist.

Quoted 9 lines
Quoted 8 lines

2. Stuff things into the secure monitor
I guess we could read the GIC registers once we enter the secure monitor and do the communication with the companion core from there by identifying unmasked IRQs as wake IRQs. My concern here is that it might introduce additional hardcoded mappings that are much more dynamic in Linux thanks to the DT description.

Quoted 3 lines

This could work, but you'd have to have control of the secure monitor code. In Qualcomm's case, that wouldn't work or couldn't because they won't change that code. And you'd have to have calls into the monitor to turn on/off the lines.

We fully control our secure monitor. That should not be an issue for us. What do you mean we'd need to call into the monitor? Linux masks all wake IRQs when going into suspend. Everything unmasked should be a wake IRQ, or am I missing something? I thought we could simply read the enable/disable status of all IRQs in the secure monitor suspend path and do the needed communication with the companion core.

Quoted 10 lines
Quoted 5 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

We have essentially a whole second interrupt controller. All IRQs are connected to the A53 GIC and this second interrupt controller that is controlled by the companion core. The companion core is supposed to be informed about what source the A53 needs to wake up on and will program this second IRQ controller, etc.

Thanks,
S?ren

#3 lore raw
Quoted 46 lines · S?ren Brinkmann

Hi Andy,

Quoted 15 lines · Andy Gross
Quoted 5 lines · S?ren Brinkmann

Hi,

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

Quoted 8 lines

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

Quoted 6 lines

On Qualcomm platforms there is something similar. When the system is power collapsed, the GIC loses context and can no longer handle/generate IRQs. There is a separate block called the MPM that provides some registers that the user can program. These registers allow for up to 64 wake IRQs, each of which can map to either a GPIO pin or an GIC IRQ. The MPM also has a timer that can generate a wake IRQ so that the system can wake up and maintain the time.

We have a full companion core running firmware. As in your case, we can use any IRQ source and some additional IOs as wake event. So, it's fundamentally very similar. Main difference is probably the interface. In our case, we have some platform-specific FW interfaces that we need to call. Basically, Linux doing an SMC call and then the secure monitor handling the rest. And for that we may also have to do some additional mapping of the IRQ number to something the FW interface understands.

Quoted 12 lines
Quoted 11 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

Quoted 6 lines
Quoted 3 lines

So not too long ago there were irq extensions that you could add in to an irq controller that would allow for intercepting the set wake calls. This went away and was replaced by the hierarchical irq design.

Yeah, I though I remembered that and wanted to use it now and was slightly disappointed when I couldn't find the code anymore.

It was slaughtered for a good reason: It was unmaintainable, had horrible performance issues, wasn't described in any of DT or ACPI, and didn't fit any of the core code idioms. It has been replaced by something we that is supported in the code code and that is working for all current users of the GIC that have similar requirements to yours.

Quoted 10 lines
Quoted 5 lines

The way I am currently implementing the MPM for Qualcomm, I am defining the MPM as a IRQ controller and creating relationships between the MPM and the GPIO controller (source of irqs) and the GIC. As irqs are set wake and cleared the calls go up through the hierarchy and they call each irqchips functions (if you have it setup to do that).

I suspected that some sort of dummy interrupt controller might be one way to do it. I was hoping to find a simpler way, but maybe this is the way to go. One concern could be that this might require adding something into the DT that doesn't really exist.

It is not "dummy". It drives an actual piece of HW (the wake up interrupts) and a piece of ****ware (the secure monitor side). And since when the DT has become something that we cannot change? Last time I checked, people were still adding 20 new bindings per merge window.

Quoted 14 lines
Quoted 10 lines
Quoted 9 lines

2. Stuff things into the secure monitor
I guess we could read the GIC registers once we enter the secure monitor and do the communication with the companion core from there by identifying unmasked IRQs as wake IRQs. My concern here is that it might introduce additional hardcoded mappings that are much more dynamic in Linux thanks to the DT description.

Quoted 3 lines

This could work, but you'd have to have control of the secure monitor code. In Qualcomm's case, that wouldn't work or couldn't because they won't change that code. And you'd have to have calls into the monitor to turn on/off the lines.

Quoted 6 lines

We fully control our secure monitor. That should not be an issue for us. What do you mean we'd need to call into the monitor? Linux masks all wake IRQs when going into suspend. Everything unmasked should be a wake IRQ, or am I missing something? I thought we could simply read the enable/disable status of all IRQs in the secure monitor suspend path and do the needed communication with the companion core.

That's also a possibility. If you do that, you really have to wonder why you're not implementing this as part of PSCI, because it seems a bit silly to have two interfaces for the same thing.

Quoted 12 lines
Quoted 11 lines
Quoted 6 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

Quoted 5 lines

We have essentially a whole second interrupt controller. All IRQs are connected to the A53 GIC and this second interrupt controller that is controlled by the companion core. The companion core is supposed to be informed about what source the A53 needs to wake up on and will program this second IRQ controller, etc.

So your "special case" is exactly like everyone else's. Implement it as a hierarchical chip on top of the GIC, just like Tegra, OMAP, iMX6, Exynos and a few others. Unless you implement PSCI.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#4 lore raw

Hi Marc,

Quoted 71 lines · Marc Zyngier
Quoted 46 lines · S?ren Brinkmann

Hi Andy,

Quoted 15 lines · Andy Gross
Quoted 5 lines · S?ren Brinkmann

Hi,

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

Quoted 8 lines

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

Quoted 6 lines

On Qualcomm platforms there is something similar. When the system is power collapsed, the GIC loses context and can no longer handle/generate IRQs. There is a separate block called the MPM that provides some registers that the user can program. These registers allow for up to 64 wake IRQs, each of which can map to either a GPIO pin or an GIC IRQ. The MPM also has a timer that can generate a wake IRQ so that the system can wake up and maintain the time.

We have a full companion core running firmware. As in your case, we can use any IRQ source and some additional IOs as wake event. So, it's fundamentally very similar. Main difference is probably the interface. In our case, we have some platform-specific FW interfaces that we need to call. Basically, Linux doing an SMC call and then the secure monitor handling the rest. And for that we may also have to do some additional mapping of the IRQ number to something the FW interface understands.

Quoted 12 lines
Quoted 11 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

Quoted 6 lines
Quoted 3 lines

So not too long ago there were irq extensions that you could add in to an irq controller that would allow for intercepting the set wake calls. This went away and was replaced by the hierarchical irq design.

Yeah, I though I remembered that and wanted to use it now and was slightly disappointed when I couldn't find the code anymore.

It was slaughtered for a good reason: It was unmaintainable, had horrible performance issues, wasn't described in any of DT or ACPI, and didn't fit any of the core code idioms. It has been replaced by something we that is supported in the code code and that is working for all current users of the GIC that have similar requirements to yours.

Quoted 10 lines
Quoted 5 lines

The way I am currently implementing the MPM for Qualcomm, I am defining the MPM as a IRQ controller and creating relationships between the MPM and the GPIO controller (source of irqs) and the GIC. As irqs are set wake and cleared the calls go up through the hierarchy and they call each irqchips functions (if you have it setup to do that).

I suspected that some sort of dummy interrupt controller might be one way to do it. I was hoping to find a simpler way, but maybe this is the way to go. One concern could be that this might require adding something into the DT that doesn't really exist.

Quoted 4 lines

It is not "dummy". It drives an actual piece of HW (the wake up interrupts) and a piece of ****ware (the secure monitor side). And since when the DT has become something that we cannot change? Last time I checked, people were still adding 20 new bindings per merge window.

I'm not afraid of changing the DT. But the described hierarchy etc. would not reflect the actual HW implementation. I'm generally fine with exploring this route.

Quoted 22 lines
Quoted 15 lines
Quoted 11 lines
Quoted 10 lines

2. Stuff things into the secure monitor
I guess we could read the GIC registers once we enter the secure monitor and do the communication with the companion core from there by identifying unmasked IRQs as wake IRQs. My concern here is that it might introduce additional hardcoded mappings that are much more dynamic in Linux thanks to the DT description.

Quoted 3 lines

This could work, but you'd have to have control of the secure monitor code. In Qualcomm's case, that wouldn't work or couldn't because they won't change that code. And you'd have to have calls into the monitor to turn on/off the lines.

Quoted 6 lines

We fully control our secure monitor. That should not be an issue for us. What do you mean we'd need to call into the monitor? Linux masks all wake IRQs when going into suspend. Everything unmasked should be a wake IRQ, or am I missing something? I thought we could simply read the enable/disable status of all IRQs in the secure monitor suspend path and do the needed communication with the companion core.

Quoted 3 lines

That's also a possibility. If you do that, you really have to wonder why you're not implementing this as part of PSCI, because it seems a bit silly to have two interfaces for the same thing.

Absolutely, that was my thinking. The suspend path is implemented using PSCI and we could potentially add this in there. I never said it wouldn't be part of the PSCI implementation.

Quoted 19 lines
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 8 lines
Quoted 3 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

Quoted 5 lines

We have essentially a whole second interrupt controller. All IRQs are connected to the A53 GIC and this second interrupt controller that is controlled by the companion core. The companion core is supposed to be informed about what source the A53 needs to wake up on and will program this second IRQ controller, etc.

Quoted 3 lines

So your "special case" is exactly like everyone else's. Implement it as a hierarchical chip on top of the GIC, just like Tegra, OMAP, iMX6, Exynos and a few others. Unless you implement PSCI.

I didn't really think that our case is unique. I was just looking for some pointers into the right direction as the extension mechanism that I remembered disappeared and I haven't been following the development closely enough to just know what alternatives are available. So, you say the approach of letting the secure monitor infer the wake IRQ by reading the GIC config is preferred over handling it as hierarchical chip within Linux?

Thanks,
S?ren

#5 lore raw
Quoted 74 lines · S?ren Brinkmann

Hi Marc,

Quoted 71 lines · Marc Zyngier
Quoted 46 lines · S?ren Brinkmann

Hi Andy,

Quoted 15 lines · Andy Gross
Quoted 5 lines · S?ren Brinkmann

Hi,

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

Quoted 8 lines

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

Quoted 6 lines

On Qualcomm platforms there is something similar. When the system is power collapsed, the GIC loses context and can no longer handle/generate IRQs. There is a separate block called the MPM that provides some registers that the user can program. These registers allow for up to 64 wake IRQs, each of which can map to either a GPIO pin or an GIC IRQ. The MPM also has a timer that can generate a wake IRQ so that the system can wake up and maintain the time.

We have a full companion core running firmware. As in your case, we can use any IRQ source and some additional IOs as wake event. So, it's fundamentally very similar. Main difference is probably the interface. In our case, we have some platform-specific FW interfaces that we need to call. Basically, Linux doing an SMC call and then the secure monitor handling the rest. And for that we may also have to do some additional mapping of the IRQ number to something the FW interface understands.

Quoted 12 lines
Quoted 11 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

Quoted 6 lines
Quoted 3 lines

So not too long ago there were irq extensions that you could add in to an irq controller that would allow for intercepting the set wake calls. This went away and was replaced by the hierarchical irq design.

Yeah, I though I remembered that and wanted to use it now and was slightly disappointed when I couldn't find the code anymore.

It was slaughtered for a good reason: It was unmaintainable, had horrible performance issues, wasn't described in any of DT or ACPI, and didn't fit any of the core code idioms. It has been replaced by something we that is supported in the code code and that is working for all current users of the GIC that have similar requirements to yours.

Quoted 10 lines
Quoted 5 lines

The way I am currently implementing the MPM for Qualcomm, I am defining the MPM as a IRQ controller and creating relationships between the MPM and the GPIO controller (source of irqs) and the GIC. As irqs are set wake and cleared the calls go up through the hierarchy and they call each irqchips functions (if you have it setup to do that).

I suspected that some sort of dummy interrupt controller might be one way to do it. I was hoping to find a simpler way, but maybe this is the way to go. One concern could be that this might require adding something into the DT that doesn't really exist.

Quoted 30 lines
Quoted 4 lines

It is not "dummy". It drives an actual piece of HW (the wake up interrupts) and a piece of ****ware (the secure monitor side). And since when the DT has become something that we cannot change? Last time I checked, people were still adding 20 new bindings per merge window.

I'm not afraid of changing the DT. But the described hierarchy etc. would not reflect the actual HW implementation. I'm generally fine with exploring this route.

Quoted 21 lines
Quoted 21 lines
Quoted 11 lines
Quoted 10 lines

2. Stuff things into the secure monitor
I guess we could read the GIC registers once we enter the secure monitor and do the communication with the companion core from there by identifying unmasked IRQs as wake IRQs. My concern here is that it might introduce additional hardcoded mappings that are much more dynamic in Linux thanks to the DT description.

Quoted 3 lines

This could work, but you'd have to have control of the secure monitor code. In Qualcomm's case, that wouldn't work or couldn't because they won't change that code. And you'd have to have calls into the monitor to turn on/off the lines.

We fully control our secure monitor. That should not be an issue for us. What do you mean we'd need to call into the monitor? Linux masks all wake IRQs when going into suspend. Everything unmasked should be a wake IRQ, or am I missing something? I thought we could simply read the enable/disable status of all IRQs in the secure monitor suspend path and do the needed communication with the companion core.

I was thinking of scm calls or whatnot, but it actually makes more sense for the monitor to just to all of it at suspend time. That makes it transparent to Linux.

Quoted 32 lines
Quoted 4 lines

That's also a possibility. If you do that, you really have to wonder why you're not implementing this as part of PSCI, because it seems a bit silly to have two interfaces for the same thing.

Absolutely, that was my thinking. The suspend path is implemented using PSCI and we could potentially add this in there. I never said it wouldn't be part of the PSCI implementation.

Quoted 19 lines
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 8 lines
Quoted 3 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

Quoted 5 lines

We have essentially a whole second interrupt controller. All IRQs are connected to the A53 GIC and this second interrupt controller that is controlled by the companion core. The companion core is supposed to be informed about what source the A53 needs to wake up on and will program this second IRQ controller, etc.

Quoted 3 lines

So your "special case" is exactly like everyone else's. Implement it as a hierarchical chip on top of the GIC, just like Tegra, OMAP, iMX6, Exynos and a few others. Unless you implement PSCI.

Quoted 7 lines

I didn't really think that our case is unique. I was just looking for some pointers into the right direction as the extension mechanism that I remembered disappeared and I haven't been following the development closely enough to just know what alternatives are available. So, you say the approach of letting the secure monitor infer the wake IRQ by reading the GIC config is preferred over handling it as hierarchical chip within Linux?

If you can do it in PSCI, that makes things much simpler. I don't think he is saying it's preferred. Just choose the solution that makes sense for you.

Regards,

Andy

#6 lore raw
In reply to Sören Brinkmann

Hi S?ren,

Quoted 21 lines · S?ren Brinkmann

Hi Marc,

Quoted 15 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

Quoted 5 lines

We have essentially a whole second interrupt controller. All IRQs are connected to the A53 GIC and this second interrupt controller that is controlled by the companion core. The companion core is supposed to be informed about what source the A53 needs to wake up on and will program this second IRQ controller, etc.

Quoted 3 lines

So your "special case" is exactly like everyone else's. Implement it as a hierarchical chip on top of the GIC, just like Tegra, OMAP, iMX6, Exynos and a few others. Unless you implement PSCI.

Quoted 7 lines

I didn't really think that our case is unique. I was just looking for some pointers into the right direction as the extension mechanism that I remembered disappeared and I haven't been following the development closely enough to just know what alternatives are available. So, you say the approach of letting the secure monitor infer the wake IRQ by reading the GIC config is preferred over handling it as hierarchical chip within Linux?

The in-kernel approach is a consequence of the firmware-less 32bit configuration. Hopefully, we won't see anything like that anymore. Fingers crossed.

So the firmware approach is clearly the preferred one on arm64, as it simplifies absolutely everything (and your power management has to know about all of this anyway).

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#7 lore raw
Quoted 32 lines · Marc Zyngier

Hi S?ren,

Quoted 21 lines · S?ren Brinkmann

Hi Marc,

Quoted 15 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Does anybody have similar problems and probably already solved it? Any other suggestions for approaching the problem? Any preferred solution?

I think we have the same problem. Can you provide more detail on the hardware implementation of your wake irq controller? I presume you have some set of registers, an irq maybe, and some other stuff? And how does it fit into the overall architecture from a hardware perspective?

Quoted 5 lines

We have essentially a whole second interrupt controller. All IRQs are connected to the A53 GIC and this second interrupt controller that is controlled by the companion core. The companion core is supposed to be informed about what source the A53 needs to wake up on and will program this second IRQ controller, etc.

Quoted 3 lines

So your "special case" is exactly like everyone else's. Implement it as a hierarchical chip on top of the GIC, just like Tegra, OMAP, iMX6, Exynos and a few others. Unless you implement PSCI.

Quoted 7 lines

I didn't really think that our case is unique. I was just looking for some pointers into the right direction as the extension mechanism that I remembered disappeared and I haven't been following the development closely enough to just know what alternatives are available. So, you say the approach of letting the secure monitor infer the wake IRQ by reading the GIC config is preferred over handling it as hierarchical chip within Linux?

Quoted 7 lines

The in-kernel approach is a consequence of the firmware-less 32bit configuration. Hopefully, we won't see anything like that anymore. Fingers crossed.

So the firmware approach is clearly the preferred one on arm64, as it simplifies absolutely everything (and your power management has to know about all of this anyway).

Thanks for your input. We'll do it this way then. Thanks, everybody.

S?ren

#8 lore raw
In reply to Andy Gross
Quoted 3 lines · Andy Gross

So not too long ago there were irq extensions that you could add in to an irq controller that would allow for intercepting the set wake calls. This went away and was replaced by the hierarchical irq design.

For a very good reason. The 'extensions' were a horrible hack and an unmaintainable mess. This problem is not that hard to solve w/o these hacks.

Thanks,

tglx

#9 lore raw
In reply to Sören Brinkmann
Quoted 12 lines · S?ren Brinkmann

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

Quoted 4 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or

Don't even think about notifier chains.

Quoted 5 lines

similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

So and because it requires changes in the common code you think aboiut notifiers and other absurdities. Come on, common code is not a sacred cow. It can be modified and if you need for your particular platform that SKIP_IRQ_SET_WAKE is cleared, then there are a gazillion of sane ways to do that.

Thanks,

tglx

#10 lore raw

Hi Thomas,

Quoted 26 lines · Thomas Gleixner
Quoted 12 lines · S?ren Brinkmann

we are working on the PM solution for Zynq MPSOC and ran into some problem when setting the wake source.

The situation is that when the A53 is in suspend, the GIC(v2) may be powered down. In that state a companion core is handling wake events/IRQs, but we expect the OS/Linux to notify the companion core about what device/IRQ is a wake up source. Hence, my idea was to capture enabling/disabling wake IRQs in our platform PM code and then communicate with the FW as needed during suspend operations. The problem
is: I don't see a good way to notify the platform code about these events.

Quoted 4 lines

My ideas were:
1. Use the irq_chip irq_set_wake function
My thought was to implement the irq_set_wake function in a SOC-specific way (could even be generic and call some notifier chain or

Don't even think about notifier chains.

Quoted 5 lines

similar) to notify the platform PM code when a device/IRQ is enabled/disabled as wake up source.
My problem is that the SKIP_IRQ_SET_WAKE flag is set in the generic driver (drivers/irqchip/irq-gic.c) and platforms cannot implement irq_set_wake without changes in the common code.

Quoted 5 lines

So and because it requires changes in the common code you think aboiut notifiers and other absurdities. Come on, common code is not a sacred cow. It can be modified and if you need for your particular platform that SKIP_IRQ_SET_WAKE is cleared, then there are a gazillion of sane ways to do that.

I'm not afraid of changing it, but I was hoping to get an idea of what an acceptable solution would look like, as I don't want to run of into any of the directions that are not sane and have it shoot down in the end (like my notifier approach apparently would). I remembered the mentioned extensions mechanism which disappeared. Hence, I thought it might be a better idea to check beforehand why and what happened and what alternative approach may be an acceptable solution for that problem.

Thanks,
S?ren