Page MenuHomeFreeBSD

Add a dmardump utility to dump the VT-d context tables.
ClosedPublic

Authored by jhb on Aug 8 2016, 8:49 PM.

Details

Summary

Add a dmardump utility to dump the VT-d context tables.

This tool parses the ACPI DMAR table looking for DMA remapping devices.
For each device it walks the root table and any context tables
referenced to display mapping info for PCI devices.

Test Plan
  • Run with VT-d enabled under bhyve using PCI passthrough.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb retitled this revision from to Add a dmardump utility to dump the VT-d context tables..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added reviewers: kib, grehan.
jhb added a subscriber: np.

It's in tools/tools so it isn't highly refined. It does not support extended context tables, but neither bhyve or ACPI_DMAR create those types of tables yet. Sample output below:

# ./dmardump
drhd @ 0xfbffc000 (version 1.0) PCI segment 0:
    root table @ 0x0x183a3f000
        PCI bus 0:
            { 0,0 } (hostb0) TR SLPT 0x123a0e000 domain 1
            { 1,0 } (pcib2) TR SLPT 0x123a0e000 domain 1
            { 2,0 } (pcib3) TR SLPT 0x123a0e000 domain 1
            { 3,0 } (pcib4) TR SLPT 0x123a0e000 domain 1
            { 3,2 } (pcib5) TR SLPT 0x123a0e000 domain 1
            { 3,3 } (pcib6) TR SLPT 0x123a0e000 domain 1
            { 4,0 } TR SLPT 0x123a0e000 domain 1
            { 4,1 } TR SLPT 0x123a0e000 domain 1
            { 4,2 } TR SLPT 0x123a0e000 domain 1
            { 4,3 } TR SLPT 0x123a0e000 domain 1
            { 4,4 } TR SLPT 0x123a0e000 domain 1
            { 4,5 } TR SLPT 0x123a0e000 domain 1
            { 4,6 } TR SLPT 0x123a0e000 domain 1
            { 4,7 } TR SLPT 0x123a0e000 domain 1
            { 5,0 } TR SLPT 0x123a0e000 domain 1
            { 5,1 } TR SLPT 0x123a0e000 domain 1
            { 5,2 } TR SLPT 0x123a0e000 domain 1
            { 5,4 } (ioapic0) TR SLPT 0x123a0e000 domain 1
            { 17,0 } TR SLPT 0x123a0e000 domain 1
            { 17,4 } (ahci0) TR SLPT 0x123a0e000 domain 1
            { 20,0 } (xhci0) TR SLPT 0x123a0e000 domain 1
            { 22,0 } TR SLPT 0x123a0e000 domain 1
            { 22,1 } TR SLPT 0x123a0e000 domain 1
            { 26,0 } (ehci0) TR SLPT 0x123a0e000 domain 1
            { 28,0 } (pcib7) TR SLPT 0x123a0e000 domain 1
            { 28,6 } (pcib8) TR SLPT 0x123a0e000 domain 1
            { 29,0 } (ehci1) TR SLPT 0x123a0e000 domain 1
            { 31,0 } (isab0) TR SLPT 0x123a0e000 domain 1
            { 31,2 } (ahci1) TR SLPT 0x123a0e000 domain 1
            { 31,3 } TR SLPT 0x123a0e000 domain 1
            { 31,6 } TR SLPT 0x123a0e000 domain 1
        PCI bus 1:
        PCI bus 2:
        PCI bus 3:
            { 0,0 } (t5iov0) TR SLPT 0x123a0e000 domain 1
            { 0,1 } (t5iov1) TR SLPT 0x123a0e000 domain 1
            { 0,2 } (t5iov2) TR SLPT 0x123a0e000 domain 1
            { 0,3 } (t5iov3) TR SLPT 0x123a0e000 domain 1
            { 0,4 } (t5nex0) TR SLPT 0x123a0e000 domain 1
            { 0,5 } TR SLPT 0x123a0e000 domain 1
            { 0,6 } TR SLPT 0x123a0e000 domain 1
            { 0,8 } (ppt0) TR SLPT 0x197f3b000 domain 2
        PCI bus 4:
        PCI bus 5:
            { 0,0 } (igb0) TR SLPT 0x123a0e000 domain 1
            { 0,1 } (igb1) TR SLPT 0x123a0e000 domain 1
        PCI bus 6:
        PCI bus 7:
            { 0,0 } (pcib9) TR SLPT 0x123a0e000 domain 1
        PCI bus 8:
            { 0,0 } (vgapci0) TR SLPT 0x123a0e000 domain 1
        PCI bus 9:
        PCI bus 10:
        PCI bus 11:
        PCI bus 12:
        PCI bus 13:
        PCI bus 14:
        PCI bus 15:
        PCI bus 16:
        PCI bus 17:
        PCI bus 18:
        PCI bus 19:
        PCI bus 20:
        PCI bus 21:
        PCI bus 22:
        PCI bus 23:
        PCI bus 24:
        PCI bus 25:
        PCI bus 26:
        PCI bus 27:
        PCI bus 28:
        PCI bus 29:
        PCI bus 30:
        PCI bus 31:
        PCI bus 32:
        PCI bus 33:
        PCI bus 34:
        PCI bus 35:
        PCI bus 36:
        PCI bus 37:
        PCI bus 38:
        PCI bus 39:
        PCI bus 40:
        PCI bus 41:
        PCI bus 42:
        PCI bus 43:
        PCI bus 44:
        PCI bus 45:
        PCI bus 46:
        PCI bus 47:
        PCI bus 48:
        PCI bus 49:
        PCI bus 50:
        PCI bus 51:
        PCI bus 52:
        PCI bus 53:
        PCI bus 54:
        PCI bus 55:
        PCI bus 56:
        PCI bus 57:
        PCI bus 58:
        PCI bus 59:
        PCI bus 60:
        PCI bus 61:
        PCI bus 62:
        PCI bus 63:
        PCI bus 64:
        PCI bus 65:
        PCI bus 66:
        PCI bus 67:
        PCI bus 68:
        PCI bus 69:
        PCI bus 70:
        PCI bus 71:
        PCI bus 72:
        PCI bus 73:
        PCI bus 74:
        PCI bus 75:
        PCI bus 76:
        PCI bus 77:
        PCI bus 78:
        PCI bus 79:
        PCI bus 80:
        PCI bus 81:
        PCI bus 82:
        PCI bus 83:
        PCI bus 84:
        PCI bus 85:
        PCI bus 86:
        PCI bus 87:
        PCI bus 88:
        PCI bus 89:
        PCI bus 90:
        PCI bus 91:
        PCI bus 92:
        PCI bus 93:
        PCI bus 94:
        PCI bus 95:
        PCI bus 96:
        PCI bus 97:
        PCI bus 98:
        PCI bus 99:
        PCI bus 100:
        PCI bus 101:
        PCI bus 102:
        PCI bus 103:
        PCI bus 104:
        PCI bus 105:
        PCI bus 106:
        PCI bus 107:
        PCI bus 108:
        PCI bus 109:
        PCI bus 110:
        PCI bus 111:
        PCI bus 112:
        PCI bus 113:
        PCI bus 114:
        PCI bus 115:
        PCI bus 116:
        PCI bus 117:
        PCI bus 118:
        PCI bus 119:
        PCI bus 120:
        PCI bus 121:
        PCI bus 122:
        PCI bus 123:
        PCI bus 124:
        PCI bus 125:
        PCI bus 126:
        PCI bus 127:
        PCI bus 128:
        PCI bus 129:
        PCI bus 130:
        PCI bus 131:
        PCI bus 132:
        PCI bus 133:
        PCI bus 134:
        PCI bus 135:
        PCI bus 136:
        PCI bus 137:
        PCI bus 138:
        PCI bus 139:
        PCI bus 140:
        PCI bus 141:
        PCI bus 142:
        PCI bus 143:
        PCI bus 144:
        PCI bus 145:
        PCI bus 146:
        PCI bus 147:
        PCI bus 148:
        PCI bus 149:
        PCI bus 150:
        PCI bus 151:
        PCI bus 152:
        PCI bus 153:
        PCI bus 154:
        PCI bus 155:
        PCI bus 156:
        PCI bus 157:
        PCI bus 158:
        PCI bus 159:
        PCI bus 160:
        PCI bus 161:
        PCI bus 162:
        PCI bus 163:
        PCI bus 164:
        PCI bus 165:
        PCI bus 166:
        PCI bus 167:
        PCI bus 168:
        PCI bus 169:
        PCI bus 170:
        PCI bus 171:
        PCI bus 172:
        PCI bus 173:
        PCI bus 174:
        PCI bus 175:
        PCI bus 176:
        PCI bus 177:
        PCI bus 178:
        PCI bus 179:
        PCI bus 180:
        PCI bus 181:
        PCI bus 182:
        PCI bus 183:
        PCI bus 184:
        PCI bus 185:
        PCI bus 186:
        PCI bus 187:
        PCI bus 188:
        PCI bus 189:
        PCI bus 190:
        PCI bus 191:
        PCI bus 192:
        PCI bus 193:
        PCI bus 194:
        PCI bus 195:
        PCI bus 196:
        PCI bus 197:
        PCI bus 198:
        PCI bus 199:
        PCI bus 200:
        PCI bus 201:
        PCI bus 202:
        PCI bus 203:
        PCI bus 204:
        PCI bus 205:
        PCI bus 206:
        PCI bus 207:
        PCI bus 208:
        PCI bus 209:
        PCI bus 210:
        PCI bus 211:
        PCI bus 212:
        PCI bus 213:
        PCI bus 214:
        PCI bus 215:
        PCI bus 216:
        PCI bus 217:
        PCI bus 218:
        PCI bus 219:
        PCI bus 220:
        PCI bus 221:
        PCI bus 222:
        PCI bus 223:
        PCI bus 224:
        PCI bus 225:
        PCI bus 226:
        PCI bus 227:
        PCI bus 228:
        PCI bus 229:
        PCI bus 230:
        PCI bus 231:
        PCI bus 232:
        PCI bus 233:
        PCI bus 234:
        PCI bus 235:
        PCI bus 236:
        PCI bus 237:
        PCI bus 238:
        PCI bus 239:
        PCI bus 240:
        PCI bus 241:
        PCI bus 242:
        PCI bus 243:
        PCI bus 244:
        PCI bus 245:
        PCI bus 246:
        PCI bus 247:
        PCI bus 248:
        PCI bus 249:
        PCI bus 250:
        PCI bus 251:
        PCI bus 252:
        PCI bus 253:
        PCI bus 254:
tools/tools/dmardump/dmardump.c
110 ↗(On Diff #19140)

Could the 'PCI bus %d' printf be moved to here with a do-once guard ? This would prevent the printing of busses without any context entries.

tools/tools/dmardump/dmardump.c
141 ↗(On Diff #19140)

I can add some extractors to intel_reg.h. They just were not needed for the driver, but I think there is some value in having these bit manipulations left in the single place.

I already did two updates of the intel_reg.h after Intel spec update, and I do prefer to only update intel_reg.h instead of trying to catch all constants spread in source.

167 ↗(On Diff #19140)

This is just missed bit in intel_reg.h.

jhb marked 3 inline comments as done.Aug 9 2016, 6:34 PM
jhb added inline comments.
tools/tools/dmardump/dmardump.c
141 ↗(On Diff #19140)

Ok, I've taken a stab at adding these. Let me know if you want changes to the names, etc.

jhb marked an inline comment as done.
  • Only print PCI bus if there is at least one context entry.
  • Add constants for fields in the RTADDR register.
  • Add MASK and extractor macros for domain ID in ctx2.
kib edited edge metadata.

Please commit intel_reg.h change separately.

This revision is now accepted and ready to land.Aug 9 2016, 6:39 PM
grehan edited edge metadata.
This revision was automatically updated to reflect the committed changes.