Page MenuHomeFreeBSD

SMMU pmap routines added
ClosedPublic

Authored by br on Oct 20 2020, 9:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 6:38 AM
Unknown Object (File)
Tue, Nov 19, 2:38 AM
Unknown Object (File)
Sat, Nov 16, 2:31 PM
Unknown Object (File)
Oct 5 2024, 3:29 AM
Unknown Object (File)
Oct 5 2024, 12:58 AM
Unknown Object (File)
Oct 4 2024, 10:03 PM
Unknown Object (File)
Oct 3 2024, 7:44 PM
Unknown Object (File)
Oct 2 2024, 1:17 PM
Subscribers

Details

Summary

Add routines to manage SMMU page tables

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

br requested review of this revision.Oct 20 2020, 9:52 AM
sys/arm64/arm64/pmap.c
3702 ↗(On Diff #78499)

pmap_sremove_pages() would better match the names of the native routines. pmap_remove_all() removes all managed mappings of a given page.

3749 ↗(On Diff #78499)

Can we have a block here? pmap_senter() does not create them.

3763 ↗(On Diff #78499)

Debug printf

Also don't we need to unwire the L3 page once for each valid entry?

o Rename pmap_sremove_all() to pmap_sremove_pages()
o Remove unneeded check for L2_BLOCK in pmap_sremove_pages()

sys/arm64/arm64/pmap.c
3702 ↗(On Diff #78499)

Thanks, renamed!

3749 ↗(On Diff #78499)

Not needed. So I removed it.
Thanks!

3763 ↗(On Diff #78499)

I could not find any debug printf macro, do we have any ?

This function is called when no L3 pages are mapped, so if any valid L3 page present it just returns error and pmap will not be released by IOMMU code.
(we can replace to panic, any other ideas ?)

sys/arm64/arm64/pmap.c
3630 ↗(On Diff #78592)

Why is the user bit being set?

3690 ↗(On Diff #78592)

It's not necessary to do any kind of TLB invalidation here?

3713 ↗(On Diff #78592)

These declarations of type vm_page_t can be in a single line.

3719 ↗(On Diff #78592)

Can't we stop iterating once sva > VM_MAXUSER_ADDRESS?

3763 ↗(On Diff #78499)

I see. If this condition is not expected to occur it should be a panic(). If you want to keep the printf() I'd put it under ifdef DIAGNOSTIC.

sys/arm64/arm64/pmap.c
3630 ↗(On Diff #78592)

Maybe because iommu addresses are below VM_MAXUSER_ADDRESS ?

I receive this event otherwise (i.e. without ATTR_S1_AP_USER bit):
smmu0: Event F_PERMISSION (Permission fault occurred on page access.) received.

3690 ↗(On Diff #78592)

SMMU has its own TLB that can be invalidated in the SMMU driver only, so we proceed invalidatation in the driver just after calling this function.

3713 ↗(On Diff #78592)

Fixed.

3719 ↗(On Diff #78592)

Sure!

3763 ↗(On Diff #78499)

Ok, I've replaced the printf call with panic()

I have no objection to the change. I'm not really convinced it needs to be part of the pmap code, instead of a self-contained module in the SMMU driver, but I can see why it's convenient.

sys/arm64/arm64/pmap.c
3659 ↗(On Diff #78837)

We should modify the pmap's resident count here.

3630 ↗(On Diff #78592)

The bit controls access permission from EL0. I'm not sure how that meaning is translated when using the SMMU.

Manage resident count for L3 pages of SMMU pmap

sys/arm64/arm64/pmap.c
3659 ↗(On Diff #78837)

Added here and in pmap_sremove().

3630 ↗(On Diff #78592)

Yes, I think ATTR_S1_AP_USER instructs SMMU to use page table base register from TTB0 register.
We only set pointer to page directory in TTB0 register of a context descriptor, and TTB1 is zero.

This revision is now accepted and ready to land.Nov 2 2020, 6:03 PM
This revision was automatically updated to reflect the committed changes.