Skip to content

Commit d799a18

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Add command-line option to enable different page table
Enhance amd_iommu command line option to specify v1 or v2 page table. By default system will boot in V1 page table mode. Co-developed-by: Suravee Suthikulpanit <[email protected]> Signed-off-by: Suravee Suthikulpanit <[email protected]> Signed-off-by: Vasant Hegde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4db6c41 commit d799a18

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@
321321
force_enable - Force enable the IOMMU on platforms known
322322
to be buggy with IOMMU enabled. Use this
323323
option with care.
324+
pgtbl_v1 - Use v1 page table for DMA-API (Default).
325+
pgtbl_v2 - Use v2 page table for DMA-API.
324326

325327
amd_iommu_dump= [HW,X86-64]
326328
Enable AMD IOMMU driver option to dump the ACPI table

drivers/iommu/amd/init.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,17 +3379,30 @@ static int __init parse_amd_iommu_intr(char *str)
33793379

33803380
static int __init parse_amd_iommu_options(char *str)
33813381
{
3382-
for (; *str; ++str) {
3382+
if (!str)
3383+
return -EINVAL;
3384+
3385+
while (*str) {
33833386
if (strncmp(str, "fullflush", 9) == 0) {
33843387
pr_warn("amd_iommu=fullflush deprecated; use iommu.strict=1 instead\n");
33853388
iommu_set_dma_strict();
3386-
}
3387-
if (strncmp(str, "force_enable", 12) == 0)
3389+
} else if (strncmp(str, "force_enable", 12) == 0) {
33883390
amd_iommu_force_enable = true;
3389-
if (strncmp(str, "off", 3) == 0)
3391+
} else if (strncmp(str, "off", 3) == 0) {
33903392
amd_iommu_disabled = true;
3391-
if (strncmp(str, "force_isolation", 15) == 0)
3393+
} else if (strncmp(str, "force_isolation", 15) == 0) {
33923394
amd_iommu_force_isolation = true;
3395+
} else if (strncmp(str, "pgtbl_v1", 8) == 0) {
3396+
amd_iommu_pgtable = AMD_IOMMU_V1;
3397+
} else if (strncmp(str, "pgtbl_v2", 8) == 0) {
3398+
amd_iommu_pgtable = AMD_IOMMU_V2;
3399+
} else {
3400+
pr_notice("Unknown option - '%s'\n", str);
3401+
}
3402+
3403+
str += strcspn(str, ",");
3404+
while (*str == ',')
3405+
str++;
33933406
}
33943407

33953408
return 1;

0 commit comments

Comments
 (0)