forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 10
drm/verisilicon: properly implement vmap #30
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
Closed
Closed
Conversation
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
On 6.6 kernel, the address returned by dma_alloc_attrs() is directly from the linear mapping and not mapped with the expected page attribute. Properly implement a vmap (and corresponding vunmap) to ensure the virtual address set by it is mapped with the expect write-combining page attributes. Signed-off-by: Icenowy Zheng <[email protected]>
Reviewer's GuideThis PR replaces direct linear DMA mappings with explicit vmap/vunmap calls to ensure write-combining page attributes by adding a vaddr field for tracking and updating both prime_vmap and prime_vunmap implementations. Class diagram for updated vs_gem_object and vmap/vunmap logicclassDiagram
class vs_gem_object {
drm_gem_object base
size_t size
void *cookie
void *vaddr
dma_addr_t dma_addr
u32 iova
unsigned long dma_attrs
}
class vs_gem_prime_vmap {
+int vs_gem_prime_vmap(drm_gem_object *obj, iosys_map *map)
}
class vs_gem_prime_vunmap {
+void vs_gem_prime_vunmap(drm_gem_object *obj, iosys_map *map)
}
vs_gem_object <.. vs_gem_prime_vmap : uses
vs_gem_object <.. vs_gem_prime_vunmap : uses
Flow diagram for vmap/vunmap implementation in vs_gem_prime_vmap/vunmapflowchart TD
A[vs_gem_prime_vmap called] --> B{vs_obj->vaddr exists?}
B -- Yes --> C[Set iosys_map to vs_obj->vaddr]
B -- No --> D[Calculate nr_pages]
D --> E[Call vmap with write-combining attributes]
E --> F{vmap success?}
F -- Yes --> G[Set vs_obj->vaddr]
F -- No --> H[Return -ENOMEM]
G --> C
C --> I[Return 0]
subgraph Unmapping
J[vs_gem_prime_vunmap called] --> K{vs_obj->vaddr exists?}
K -- No --> L[Return]
K -- Yes --> M[Call vunmap on vs_obj->vaddr]
M --> N[Set vs_obj->vaddr to NULL]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superseded by #31 . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On 6.6 kernel, the address returned by dma_alloc_attrs() is directly from the linear mapping and not mapped with the expected page attribute.
Properly implement a vmap (and corresponding vunmap) to ensure the virtual address set by it is mapped with the expect write-combining page attributes.
===============
This PR fixes fbcon refreshing issue on (at least) Lichee Console 4A.
Summary by Sourcery
Apply proper vmap/vunmap mapping with write-combining attributes for Verisilicon GEM objects to ensure correct kernel mappings and resolve framebuffer refresh issues.
Bug Fixes:
Enhancements: