8000 boards: linker: remove MPU alignment by bradjc · Pull Request #3198 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

boards: linker: remove MPU alignment #3198

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

Merged
merged 1 commit into from
Sep 23, 2022
Merged

boards: linker: remove MPU alignment #3198

merged 1 commit into from
Sep 23, 2022

Conversation

bradjc
Copy link
Contributor
@bradjc bradjc commented Sep 7, 2022

As far as I know, the MPU_MIN_ALIGN alignment directive is very old in Tock, probably from a much simpler MPU implementation. I'm not sure why we still have it, as the MPU implementation should handle alignment, not the linker.

Testing Strategy

I tested this on hail, and the MPU app memory code sets up the same regions before and after this change since the mpu implementation first sets the region to a power of two and then aligns to that region size.

TODO or Help Wanted

Does this cause any issue for RISC-V platforms?

Documentation Updated

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

Formatting

  • Ran make prepush.

As far as I know, the `MPU_MIN_ALIGN` alignment directive is very old in
Tock, probably from a much simpler MPU implementation. I'm not sure why
we still have it, as the MPU implementation should handle alignment, not
the linker.
@github-actions github-actions bot added the WG-OpenTitan In the purview of the OpenTitan working group. label Sep 7, 2022
Copy link
Contributor
@brghena brghena left a comment

Choose a reason for hiding this comment

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

This makes sense to me. The start of app memory can be at any possible address, and then the kernel can decide from there where it actually wants to grab chunks and allocate them based on MPU requirements.

@hudson-ayers
Copy link
Contributor

Removing this would mean that _sappmem could be placed not aligned with an MPU region, such that the some portion of "app_memory" would not actually be usable for applications, which is semantically a bit weird, but I guess not a big deal.

I do think this would break anyone that statically places applications (cc @jettr / @a-pronin ) and uses our kernel_layout.ld as a starting point for that, but I suspect most users who do so would be using a modified copy our of our layout rather than including our layout and building on it.

@bradjc
Copy link
Contributor Author
bradjc commented Sep 7, 2022

Removing this would mean that _sappmem could be placed not aligned with an MPU region, such that the some portion of "app_memory" would not actually be usable for applications, which is semantically a bit weird, but I guess not a big deal.

We could set the alignment to 256 bytes on cortex-m platforms, so that it is technically possible it could be used. However, that seems like something we would do since we already have the variable, and not something we would add if this variable had never existed.

@hudson-ayers
Copy link
Contributor

If MPU_MIN_ALIGN never existed, would _sappmem instead be named _ekernelmem? (since it doesn't actually show the location of the first app, just the last address used by the kernel). With this change, it seems like _sappmem and _ezero should always be the same address anyway.

@bradjc
Copy link
Contributor Author
bradjc commented Sep 8, 2022

If MPU_MIN_ALIGN never existed, would _sappmem instead be named _ekernelmem? (since it doesn't actually show the location of the first app, just the last address used by the kernel). With this change, it seems like _sappmem and _ezero should always be the same address anyway.

We don't necessarily want to preclude users from putting in other sections by embedding assumptions about where app mem starts.

Copy link
Contributor
@hudson-ayers hudson-ayers left a comment

Choose a reason for hiding this comment

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

LGTM

@ppannuto
Copy link
Member

bors r+

I dug back in history a bit: it looks like this dates back to when userland was in this repo and built together, and it was used to place the beginning of applications. Definitely not needed now :)

@bors
Copy link
Contributor
bors bot commented Sep 23, 2022

@bors bors bot merged commit a1f8ddc into master Sep 23, 2022
@bors bors bot deleted the no-mpu-align-linker branch September 23, 2022 18:27
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.

4 participants
0