-
Notifications
You must be signed in to change notification settings - Fork 126
fix(starry): support eBPF ringbuf mmap on LoongArch DMW #1208
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # LoongArch64 DMW and Kernel Address Space | ||
|
|
||
| LoongArch64 platforms may enable DMW (Direct Mapping Window) for the cached | ||
| physical direct map. In the QEMU virt platform, `phys_to_virt()` uses the | ||
| `0x9000_0000_0000_0000` DMW window: | ||
|
|
||
| ```text | ||
| VA = 0x9000_0000_0000_0000 + PA | ||
| ``` | ||
|
|
||
| This range is translated by DMW hardware and does not consult the kernel page | ||
| table. Therefore it must not be treated as ordinary page-table-backed kernel | ||
| virtual memory. | ||
|
|
||
| The page-table-backed kernel address space should use a non-DMW address range, | ||
| and must still be a legal mapped virtual address. With the current | ||
| LoongArch64 page-table configuration (`VALEN = 48`), bits `[63:48]` must be a | ||
| sign extension of bit 47. For example: | ||
|
|
||
| ```toml | ||
| kernel-aspace-base = "0xFFFF_8000_0000_0000" | ||
| kernel-aspace-size = "0x0000_7fff_ffff_f000" | ||
| ``` | ||
|
|
||
| Temporary kernel mappings such as `vmap`, eBPF ring-buffer aliases, MMIO | ||
| `iomap` ranges, module memory, and trampoline pages should be allocated from | ||
| this page-table-backed kernel address space. | ||
|
|
||
| Do not add a second page-table mapping for DMW direct-map RAM. Besides being | ||
| redundant, it can conflict with real kernel virtual mappings because the current | ||
| LoongArch64 page-table implementation indexes only the low 48 virtual-address | ||
| bits. For example, mappings in `0x9000_...` and page-table-backed mappings can | ||
| share the same page-table indexes if their low 48 bits are equal. | ||
|
|
||
| `ax-mm` therefore maps a physical memory region through `phys_to_virt()` only | ||
| when the resulting virtual range is contained in the configured kernel address | ||
| space. On DMW platforms this skips the hardware direct-map range; on platforms | ||
| where the direct map is page-table-backed, the existing mapping behavior is | ||
| preserved. | ||
|
|
||
|
|
||
| ## References | ||
| https://www.kernel.org/doc/html/v6.1/loongarch/introduction.html#virtual-memory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.