iommu/amd: Add PCI segment support for ivrs_[ioapic/hpet/acpihid] commands
[ Upstream commit bbe3a106580c21bc883fb0c9fa3da01534392fe8 ] By default, PCI segment is zero and can be omitted. To support system with non-zero PCI segment ID, modify the parsing functions to allow PCI segment ID. Co-developed-by: Vasant Hegde <vasant.hegde@amd.com> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Link: https://lore.kernel.org/r/20220706113825.25582-33-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de> Stable-dep-of: b6b26d86c61c ("iommu/amd: Add a length limitation for the ivrs_acpihid command-line parameter") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3cdf19a29c
commit
11852cc78f
@ -1944,23 +1944,39 @@
|
||||
|
||||
ivrs_ioapic [HW,X86_64]
|
||||
Provide an override to the IOAPIC-ID<->DEVICE-ID
|
||||
mapping provided in the IVRS ACPI table. For
|
||||
example, to map IOAPIC-ID decimal 10 to
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
mapping provided in the IVRS ACPI table.
|
||||
By default, PCI segment is 0, and can be omitted.
|
||||
For example:
|
||||
* To map IOAPIC-ID decimal 10 to PCI device 00:14.0
|
||||
write the parameter as:
|
||||
ivrs_ioapic[10]=00:14.0
|
||||
* To map IOAPIC-ID decimal 10 to PCI segment 0x1 and
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
ivrs_ioapic[10]=0001:00:14.0
|
||||
|
||||
ivrs_hpet [HW,X86_64]
|
||||
Provide an override to the HPET-ID<->DEVICE-ID
|
||||
mapping provided in the IVRS ACPI table. For
|
||||
example, to map HPET-ID decimal 0 to
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
mapping provided in the IVRS ACPI table.
|
||||
By default, PCI segment is 0, and can be omitted.
|
||||
For example:
|
||||
* To map HPET-ID decimal 0 to PCI device 00:14.0
|
||||
write the parameter as:
|
||||
ivrs_hpet[0]=00:14.0
|
||||
* To map HPET-ID decimal 10 to PCI segment 0x1 and
|
||||
PCI device 00:14.0 write the parameter as:
|
||||
ivrs_ioapic[10]=0001:00:14.0
|
||||
|
||||
ivrs_acpihid [HW,X86_64]
|
||||
Provide an override to the ACPI-HID:UID<->DEVICE-ID
|
||||
mapping provided in the IVRS ACPI table. For
|
||||
example, to map UART-HID:UID AMD0020:0 to
|
||||
PCI device 00:14.5 write the parameter as:
|
||||
mapping provided in the IVRS ACPI table.
|
||||
|
||||
For example, to map UART-HID:UID AMD0020:0 to
|
||||
PCI segment 0x1 and PCI device ID 00:14.5,
|
||||
write the parameter as:
|
||||
ivrs_acpihid[0001:00:14.5]=AMD0020:0
|
||||
|
||||
By default, PCI segment is 0, and can be omitted.
|
||||
For example, PCI device 00:14.5 write the parameter as:
|
||||
ivrs_acpihid[00:14.5]=AMD0020:0
|
||||
|
||||
js= [HW,JOY] Analog joystick
|
||||
|
@ -84,6 +84,10 @@
|
||||
#define ACPI_DEVFLAG_ATSDIS 0x10000000
|
||||
|
||||
#define LOOP_TIMEOUT 2000000
|
||||
|
||||
#define IVRS_GET_SBDF_ID(seg, bus, dev, fd) (((seg & 0xffff) << 16) | ((bus & 0xff) << 8) \
|
||||
| ((dev & 0x1f) << 3) | (fn & 0x7))
|
||||
|
||||
/*
|
||||
* ACPI table definitions
|
||||
*
|
||||
@ -2971,16 +2975,18 @@ static int __init parse_amd_iommu_options(char *str)
|
||||
|
||||
static int __init parse_ivrs_ioapic(char *str)
|
||||
{
|
||||
unsigned int bus, dev, fn;
|
||||
u32 seg = 0, bus, dev, fn;
|
||||
int ret, id, i;
|
||||
u16 devid;
|
||||
u32 devid;
|
||||
|
||||
ret = sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn);
|
||||
|
||||
if (ret != 4) {
|
||||
ret = sscanf(str, "[%d]=%x:%x:%x.%x", &id, &seg, &bus, &dev, &fn);
|
||||
if (ret != 5) {
|
||||
pr_err("Invalid command line: ivrs_ioapic%s\n", str);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (early_ioapic_map_size == EARLY_MAP_SIZE) {
|
||||
pr_err("Early IOAPIC map overflow - ignoring ivrs_ioapic%s\n",
|
||||
@ -2988,7 +2994,7 @@ static int __init parse_ivrs_ioapic(char *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
|
||||
devid = IVRS_GET_SBDF_ID(seg, bus, dev, fn);
|
||||
|
||||
cmdline_maps = true;
|
||||
i = early_ioapic_map_size++;
|
||||
@ -3001,16 +3007,18 @@ static int __init parse_ivrs_ioapic(char *str)
|
||||
|
||||
static int __init parse_ivrs_hpet(char *str)
|
||||
{
|
||||
unsigned int bus, dev, fn;
|
||||
u32 seg = 0, bus, dev, fn;
|
||||
int ret, id, i;
|
||||
u16 devid;
|
||||
u32 devid;
|
||||
|
||||
ret = sscanf(str, "[%d]=%x:%x.%x", &id, &bus, &dev, &fn);
|
||||
|
||||
if (ret != 4) {
|
||||
ret = sscanf(str, "[%d]=%x:%x:%x.%x", &id, &seg, &bus, &dev, &fn);
|
||||
if (ret != 5) {
|
||||
pr_err("Invalid command line: ivrs_hpet%s\n", str);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (early_hpet_map_size == EARLY_MAP_SIZE) {
|
||||
pr_err("Early HPET map overflow - ignoring ivrs_hpet%s\n",
|
||||
@ -3018,7 +3026,7 @@ static int __init parse_ivrs_hpet(char *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
devid = ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
|
||||
devid = IVRS_GET_SBDF_ID(seg, bus, dev, fn);
|
||||
|
||||
cmdline_maps = true;
|
||||
i = early_hpet_map_size++;
|
||||
@ -3031,16 +3039,19 @@ static int __init parse_ivrs_hpet(char *str)
|
||||
|
||||
static int __init parse_ivrs_acpihid(char *str)
|
||||
{
|
||||
u32 bus, dev, fn;
|
||||
u32 seg = 0, bus, dev, fn;
|
||||
char *hid, *uid, *p;
|
||||
char acpiid[ACPIHID_UID_LEN + ACPIHID_HID_LEN] = {0};
|
||||
int ret, i;
|
||||
|
||||
ret = sscanf(str, "[%x:%x.%x]=%s", &bus, &dev, &fn, acpiid);
|
||||
if (ret != 4) {
|
||||
ret = sscanf(str, "[%x:%x:%x.%x]=%s", &seg, &bus, &dev, &fn, acpiid);
|
||||
if (ret != 5) {
|
||||
pr_err("Invalid command line: ivrs_acpihid(%s)\n", str);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
p = acpiid;
|
||||
hid = strsep(&p, ":");
|
||||
@ -3061,8 +3072,7 @@ static int __init parse_ivrs_acpihid(char *str)
|
||||
i = early_acpihid_map_size++;
|
||||
memcpy(early_acpihid_map[i].hid, hid, strlen(hid));
|
||||
memcpy(early_acpihid_map[i].uid, uid, strlen(uid));
|
||||
early_acpihid_map[i].devid =
|
||||
((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7);
|
||||
early_acpihid_map[i].devid = IVRS_GET_SBDF_ID(seg, bus, dev, fn);
|
||||
early_acpihid_map[i].cmd_line = true;
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user