Page MenuHomeFreeBSD

DMAR2IODOM
ClosedPublic

Authored by br on Aug 3 2020, 1:30 PM.

Details

Summary

o Add DMAR2IODOM() macro;
o Add IODOM2DMAR() macro.

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.Aug 3 2020, 1:30 PM
br created this revision.

Basically I want to get rid of all conversion relying on the layout. And add macros for common conversions e.g. from domain to dmar unit etc.

sys/x86/iommu/intel_ctx.c
181 ↗(On Diff #75299)

Can you add CTX2DMARDOM ?

182 ↗(On Diff #75299)

This expression should be macro-ified as well (domain->dmar unit)

sys/x86/iommu/intel_dmar.h
94 ↗(On Diff #75299)

I want this to look like &((domain)->iodom), i.e. stop relying on the dmar_domain layout whre iodom is the first member.

95 ↗(On Diff #75299)

And this would be __container_of((iodom), struct dmar_domain, iodom). Unless I mixed arg order.

Add macroses:

DMAR2IOMMU()
IOMMU2DMAR()

DOM2IODOM()
IODOM2DOM()

CTX2IOCTX()
IOCTX2CTX()

kib added inline comments.
sys/dev/iommu/iommu_gas.c
177 ↗(On Diff #75348)

Commit these assert improvements for gas.c separately.

sys/x86/iommu/intel_ctx.c
339 ↗(On Diff #75348)

Do we want a constructor and destructor for iommu_domain ? I believe it makes sense.

This revision is now accepted and ready to land.Aug 4 2020, 8:24 PM