iommu/amd: Extend IVRS special device data structure
This patch extends the devid_map data structure to allow ioapic and hpet entries in ivrs to be overridden on the kernel command line. Reviewed-by: Shuah Khan <shuahkhan@gmail.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>hifive-unleashed-5.1
parent
d3da2200d0
commit
31cff67f6b
|
@ -703,25 +703,35 @@ static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu,
|
||||||
set_iommu_for_device(iommu, devid);
|
set_iommu_for_device(iommu, devid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init add_special_device(u8 type, u8 id, u16 devid)
|
static int __init add_special_device(u8 type, u8 id, u16 devid, bool cmd_line)
|
||||||
{
|
{
|
||||||
struct devid_map *entry;
|
struct devid_map *entry;
|
||||||
struct list_head *list;
|
struct list_head *list;
|
||||||
|
|
||||||
if (type != IVHD_SPECIAL_IOAPIC && type != IVHD_SPECIAL_HPET)
|
if (type == IVHD_SPECIAL_IOAPIC)
|
||||||
|
list = &ioapic_map;
|
||||||
|
else if (type == IVHD_SPECIAL_HPET)
|
||||||
|
list = &hpet_map;
|
||||||
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
list_for_each_entry(entry, list, list) {
|
||||||
|
if (!(entry->id == id && entry->cmd_line))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pr_info("AMD-Vi: Command-line override present for %s id %d - ignoring\n",
|
||||||
|
type == IVHD_SPECIAL_IOAPIC ? "IOAPIC" : "HPET", id);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
entry->id = id;
|
entry->id = id;
|
||||||
entry->devid = devid;
|
entry->devid = devid;
|
||||||
|
entry->cmd_line = cmd_line;
|
||||||
if (type == IVHD_SPECIAL_IOAPIC)
|
|
||||||
list = &ioapic_map;
|
|
||||||
else
|
|
||||||
list = &hpet_map;
|
|
||||||
|
|
||||||
list_add_tail(&entry->list, list);
|
list_add_tail(&entry->list, list);
|
||||||
|
|
||||||
|
@ -929,7 +939,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
|
||||||
PCI_FUNC(devid));
|
PCI_FUNC(devid));
|
||||||
|
|
||||||
set_dev_entry_from_acpi(iommu, devid, e->flags, 0);
|
set_dev_entry_from_acpi(iommu, devid, e->flags, 0);
|
||||||
ret = add_special_device(type, handle, devid);
|
ret = add_special_device(type, handle, devid, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -592,6 +592,7 @@ struct devid_map {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
u8 id;
|
u8 id;
|
||||||
u16 devid;
|
u16 devid;
|
||||||
|
bool cmd_line;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Map HPET and IOAPIC ids to the devid used by the IOMMU */
|
/* Map HPET and IOAPIC ids to the devid used by the IOMMU */
|
||||||
|
|
Loading…
Reference in New Issue