Page MenuHomeFreeBSD

domain map/unmap vtable
ClosedPublic

Authored by br on Jul 30 2020, 12:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 6:49 AM
Unknown Object (File)
Wed, Apr 17, 6:48 AM
Unknown Object (File)
Wed, Apr 17, 6:47 AM
Unknown Object (File)
Wed, Apr 17, 5:14 AM
Unknown Object (File)
Wed, Apr 17, 4:59 AM
Unknown Object (File)
Tue, Apr 16, 5:54 AM
Unknown Object (File)
Feb 28 2024, 7:50 PM
Unknown Object (File)
Feb 25 2024, 12:31 AM
Subscribers

Details

Summary

Provide the map/unmap function pointers so we can use different iommus (Intel IOMMU or AMD iommu) on the same platform

Diff Detail

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

Event Timeline

br requested review of this revision.Jul 30 2020, 12:03 PM
br created this revision.
sys/dev/iommu/iommu.h
126 ↗(On Diff #75162)

IMO it is better to define struct iommu_domain_map_ops which would contain the function pointers, and store the pointer to the structure in domain.

sys/dev/iommu/iommu_gas.c
659 ↗(On Diff #75162)

I do not think these asserts are useful.

o Add struct iommu_domain_map_ops
o Remove useless kasserts

sys/dev/iommu/iommu.h
119 ↗(On Diff #75166)

No, I mean that we put a pointer to the struct ops, and then specific IOMMU driver defines const struct ops, pointer to which is stored in the domain. This is how we typically handle all virtual tables.

struct iommu_domain_map_ops is a pointer, table provided by the driver

rename dmar_domain_ops -> dmar_domain_map_ops

sys/x86/iommu/intel_ctx.c
323 ↗(On Diff #75226)

static const struct ... ?

sys/x86/iommu/intel_dmar.h
249 ↗(On Diff #75226)

Do you need these prototypes after functions are referenced by pointers ?

sys/x86/iommu/intel_idpgtbl.c
688 ↗(On Diff #75226)

Can map/unmap now become static ?

make domain_map/domain_unmap static

sys/x86/iommu/intel_idpgtbl.c
688 ↗(On Diff #75226)

they are in different file. So I added domain_pgtbl_init()

I am looking at all lines like this:
iodom = (struct iommu_domain *)domain;
and think we need macros like DMAR2IODOM etc.

This revision is now accepted and ready to land.Jul 31 2020, 9:13 PM