Commit f93b4ac
iommu/vt-d: Use ida to manage domain id
Switch the intel iommu driver to use the ida mechanism for managing domain
IDs, replacing the previous fixed-size bitmap.
The previous approach allocated a bitmap large enough to cover the maximum
number of domain IDs supported by the hardware, regardless of the actual
number of domains in use. This led to unnecessary memory consumption,
especially on systems supporting a large number of iommu units but only
utilizing a small number of domain IDs.
The ida allocator dynamically manages the allocation and freeing of integer
IDs, only consuming memory for the IDs that are currently in use. This
significantly optimizes memory usage compared to the fixed-size bitmap.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20250430021135.2370244-2-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>1 parent 6f5dc76 commit f93b4ac
3 files changed
+34
-68
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
| 1102 | + | |
| 1103 | + | |
1102 | 1104 | | |
1103 | 1105 | | |
1104 | 1106 | | |
| |||
1195 | 1197 | | |
1196 | 1198 | | |
1197 | 1199 | | |
| 1200 | + | |
1198 | 1201 | | |
1199 | 1202 | | |
1200 | 1203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1289 | 1289 | | |
1290 | 1290 | | |
1291 | 1291 | | |
1292 | | - | |
1293 | | - | |
1294 | | - | |
1295 | | - | |
1296 | | - | |
1297 | | - | |
1298 | | - | |
1299 | | - | |
1300 | | - | |
1301 | | - | |
1302 | | - | |
1303 | | - | |
1304 | | - | |
1305 | | - | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
1316 | | - | |
1317 | | - | |
1318 | | - | |
1319 | | - | |
1320 | | - | |
1321 | | - | |
1322 | | - | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
1327 | 1292 | | |
1328 | 1293 | | |
1329 | | - | |
1330 | | - | |
1331 | | - | |
1332 | 1294 | | |
1333 | 1295 | | |
1334 | 1296 | | |
1335 | 1297 | | |
1336 | | - | |
1337 | | - | |
| 1298 | + | |
1338 | 1299 | | |
1339 | 1300 | | |
1340 | 1301 | | |
| |||
1343 | 1304 | | |
1344 | 1305 | | |
1345 | 1306 | | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | 1307 | | |
1352 | 1308 | | |
1353 | 1309 | | |
| |||
1380 | 1336 | | |
1381 | 1337 | | |
1382 | 1338 | | |
1383 | | - | |
1384 | 1339 | | |
1385 | 1340 | | |
1386 | 1341 | | |
| |||
1399 | 1354 | | |
1400 | 1355 | | |
1401 | 1356 | | |
1402 | | - | |
1403 | | - | |
1404 | | - | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1405 | 1360 | | |
1406 | 1361 | | |
1407 | 1362 | | |
1408 | 1363 | | |
1409 | | - | |
1410 | 1364 | | |
1411 | 1365 | | |
1412 | 1366 | | |
| |||
1421 | 1375 | | |
1422 | 1376 | | |
1423 | 1377 | | |
1424 | | - | |
| 1378 | + | |
1425 | 1379 | | |
1426 | 1380 | | |
1427 | 1381 | | |
| |||
1438 | 1392 | | |
1439 | 1393 | | |
1440 | 1394 | | |
1441 | | - | |
| 1395 | + | |
1442 | 1396 | | |
1443 | 1397 | | |
1444 | 1398 | | |
| |||
2041 | 1995 | | |
2042 | 1996 | | |
2043 | 1997 | | |
2044 | | - | |
| 1998 | + | |
2045 | 1999 | | |
2046 | 2000 | | |
2047 | 2001 | | |
| |||
2168 | 2122 | | |
2169 | 2123 | | |
2170 | 2124 | | |
2171 | | - | |
2172 | | - | |
2173 | | - | |
2174 | | - | |
2175 | | - | |
2176 | 2125 | | |
2177 | 2126 | | |
2178 | 2127 | | |
| |||
2650 | 2599 | | |
2651 | 2600 | | |
2652 | 2601 | | |
2653 | | - | |
2654 | | - | |
2655 | | - | |
| 2602 | + | |
2656 | 2603 | | |
2657 | 2604 | | |
2658 | 2605 | | |
| |||
2971 | 2918 | | |
2972 | 2919 | | |
2973 | 2920 | | |
2974 | | - | |
2975 | | - | |
2976 | | - | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
2977 | 2929 | | |
2978 | 2930 | | |
2979 | 2931 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
725 | | - | |
| 725 | + | |
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
| |||
809 | 809 | | |
810 | 810 | | |
811 | 811 | | |
812 | | - | |
813 | | - | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
814 | 825 | | |
815 | 826 | | |
816 | | - | |
| 827 | + | |
817 | 828 | | |
818 | 829 | | |
819 | 830 | | |
| |||
0 commit comments