Page MenuHomeFreeBSD

domain map/unmap vtable
ClosedPublic

Authored by br on Thu, Jul 30, 12:03 PM.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

br requested review of this revision.Thu, Jul 30, 12:03 PM
br created this revision.
kib added inline comments.Thu, Jul 30, 1:59 PM
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.

br updated this revision to Diff 75166.Thu, Jul 30, 2:56 PM

o Add struct iommu_domain_map_ops
o Remove useless kasserts

kib added inline comments.Thu, Jul 30, 10:42 PM
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.

br updated this revision to Diff 75225.Fri, Jul 31, 6:38 PM

struct iommu_domain_map_ops is a pointer, table provided by the driver

br updated this revision to Diff 75226.Fri, Jul 31, 6:52 PM

rename dmar_domain_ops -> dmar_domain_map_ops

kib added inline comments.Fri, Jul 31, 6:54 PM
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 ?

br updated this revision to Diff 75232.Fri, Jul 31, 9:04 PM

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()

kib accepted this revision.Fri, Jul 31, 9:13 PM

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.Fri, Jul 31, 9:13 PM
This revision was automatically updated to reflect the committed changes.