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

Rpi 6.7.y iommu support #5833

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Rpi 6.7.y iommu support #5833

merged 2 commits into from
Jan 23, 2024

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Jan 5, 2024

Based the changes on the matching upstream commits, but not tested on hardware yet (it does build now).

@6by9
Copy link
Contributor Author

6by9 commented Jan 5, 2024

@njhollinghurst FYI

@njhollinghurst
Copy link
Contributor

I am surprised that the count argument is not used (in the exynos example). It looks like it ought to be important!

@6by9
Copy link
Contributor Author

6by9 commented Jan 8, 2024

I am surprised that the count argument is not used (in the exynos example). It looks like it ought to be important!

The commit text does include

Trivially update map/unmap to the new interface, which is quite happy for drivers to still process just one page per call.

so I'm assuming it is processing one page per call and hence can ignore count.
I was going to try running it today to see if it works.

@njhollinghurst
Copy link
Contributor

njhollinghurst commented Jan 8, 2024

I see: so that return value suffices to say "I only did one of the pages you asked for"?

Anyway, I think the quick hack / fix-up might be as simple as inserting bytes *= count; at the top of the function (since we already have a loop to break the given page size into 4K basic units). That might be more efficient.

I suppose we should handle the (very unexpected) case where only some of the pages fit below APERTURE_TOP.

@6by9
Copy link
Contributor Author

6by9 commented Jan 8, 2024

Anyway, I think the quick hack / fix-up might be as simple as inserting bytes *= count; at the top of the function (since we already have a loop to break the given page size into 4K basic units). That might be more efficient.

Probably, I just haven't looked into the API closely enough to determine the detail of it.

@njhollinghurst
Copy link
Contributor

I expect the fix-up is fine as it is! I might try to optimize the count > 1 case at a later date in a separate PR.

@popcornmix popcornmix force-pushed the rpi-6.7.y branch 2 times, most recently from 478e4f8 to f82d357 Compare January 22, 2024 12:51
6by9 added 2 commits January 23, 2024 17:19
Based on upstream commits
983efef ("iommu/exynos: Update to {map,unmap}_pages")
fa4c450 ("iommu: Allow .iotlb_sync_map to fail and handle s390's -ENOMEM return")

Signed-off-by: Dave Stevenson <[email protected]>
@6by9
Copy link
Contributor Author

6by9 commented Jan 23, 2024

Rebased. I'll do a test, but @njhollinghurst has said it works for him.

@6by9
Copy link
Contributor Author

6by9 commented Jan 23, 2024

Checked this tree, and the dlist pointer words include an address up at 0xAxxxxxxxx, which is correct for the iommu virtual address.
libcamera also works, so that checks out RP1 for the CFE, and ISPBE.

I think that makes me happy with this - dropping the Draft tag.

@6by9 6by9 marked this pull request as ready for review January 23, 2024 18:07
@njhollinghurst
Copy link
Contributor

LGTM (I'll have a go at my subsequent "optimization" later).

@pelwell pelwell merged commit 11e8442 into raspberrypi:rpi-6.7.y Jan 23, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants