Skip to content
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

chips: ibex: Enable low power state #1882

Merged
merged 2 commits into from Jun 12, 2020

Conversation

alistair23
Copy link
Contributor

Pull Request Overview

This PR configures the OpenTitan Power Management IP to enter low power mode before calling the WFI.

Testing Strategy

This pull request was tested by running Tock and apps on the FPGA OT instance.

TODO or Help Wanted

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make format.
  • Fixed errors surfaced by make clippy.

Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have an understanding of how peripherals interact with the power manager on this core (i.e. if waiting for a GPIO event or I2C event, do we have to go to a different power state)?

chips/lowrisc/src/pwrmgr.rs Outdated Show resolved Hide resolved
chips/lowrisc/src/pwrmgr.rs Outdated Show resolved Hide resolved
chips/lowrisc/src/pwrmgr.rs Outdated Show resolved Hide resolved
chips/lowrisc/src/pwrmgr.rs Outdated Show resolved Hide resolved
@bradjc bradjc added the WG-OpenTitan In the purview of the OpenTitan working group. label May 28, 2020
@alistair23
Copy link
Contributor Author

I have updated this addressing comments and rebasing it on #1886

@alistair23 alistair23 force-pushed the alistair/opentitan-pwrmgr branch 3 times, most recently from 4d01641 to e185596 Compare June 3, 2020 02:38
@ppannuto
Copy link
Member

ppannuto commented Jun 5, 2020

I think this is blocked on #1886 for now.

In the meantime, I'm still slightly worried about understanding how peripherals interact with the power manager. For example, on the SAM4L there is fairly complex logic that checks which sleep state is safe to enter based on the peripherals that are active. Does ibex manage the various sleep states automatically, or is this something that Tock will need to manage?

@ppannuto ppannuto added the blocked Waiting on something, like a different PR or a dependency. label Jun 5, 2020
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@alistair23
Copy link
Contributor Author

I have updated this and it's no longer blocking.

As for if the sleep state is safe to enter I don't see anything in the documentation describing that we need to check anything.

@alistair23 alistair23 removed the blocked Waiting on something, like a different PR or a dependency. label Jun 9, 2020
@bradjc bradjc requested a review from ppannuto June 12, 2020 17:28
Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors bors bot merged commit 253f6f7 into tock:master Jun 12, 2020
@alistair23 alistair23 deleted the alistair/opentitan-pwrmgr branch June 12, 2020 18:12
bors bot added a commit that referenced this pull request Jul 16, 2020
1887: sched: Add a watchdog r=bradjc a=alistair23

### Pull Request Overview

As part of #1882 we started talking about safe waits (#1552).

I have a PR with some initial safe wait support (#1886) in that we can be interrupted while looping on a hardware condition. The idea here is that while entering low power mode we can skip the infinite loop if we get an interrupt.

#1886 doesn't address a large number of loops in the driver capsules as they don't have access to `Chip` so it's more difficult to wait on interrupts. The harder part is what to do when a wait "fails". What happens when returning to full power fails to occur in a specific time, what happens when a bus fails to respond in a reasonable amount of time? How do we gracefully handle this and continue running in some capacity.

This PR starts to implement a watchdog functionality. This is not instead of a safe wait (in lots of cases a safe wait would be more graceful) but is generally to help avoid infinite loops and help debugging. It is also something that has come up to help make Tock more reliable.

It is up to `Chips` and boards to handle the watchdog interrupt and decided how to act.

Currently we tickle the watch dog when iterating on each process and at the start of each kernel loop.

### Testing Strategy

None

### TODO or Help Wanted

Feedback

### Documentation Updated

- [X] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [X] Ran `make format`.
- [X] Fixed errors surfaced by `make clippy`.


Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
Co-authored-by: Brad Campbell <bradjc5@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WG-OpenTitan In the purview of the OpenTitan working group.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants