diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/iommu/amd_iommu.c | 26 | ||||
| -rw-r--r-- | drivers/iommu/amd_iommu_init.c | 20 |
2 files changed, 22 insertions, 24 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 675f7027aa04..c0dc7c33335e 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #define pr_fmt(fmt) "AMD-Vi: " fmt | 20 | #define pr_fmt(fmt) "AMD-Vi: " fmt |
| 21 | #define dev_fmt(fmt) pr_fmt(fmt) | ||
| 21 | 22 | ||
| 22 | #include <linux/ratelimit.h> | 23 | #include <linux/ratelimit.h> |
| 23 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
| @@ -279,10 +280,10 @@ static u16 get_alias(struct device *dev) | |||
| 279 | return pci_alias; | 280 | return pci_alias; |
| 280 | } | 281 | } |
| 281 | 282 | ||
| 282 | pr_info("Using IVRS reported alias %02x:%02x.%d " | 283 | pci_info(pdev, "Using IVRS reported alias %02x:%02x.%d " |
| 283 | "for device %s[%04x:%04x], kernel reported alias " | 284 | "for device [%04x:%04x], kernel reported alias " |
| 284 | "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias), | 285 | "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias), |
| 285 | PCI_FUNC(ivrs_alias), dev_name(dev), pdev->vendor, pdev->device, | 286 | PCI_FUNC(ivrs_alias), pdev->vendor, pdev->device, |
| 286 | PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias), | 287 | PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias), |
| 287 | PCI_FUNC(pci_alias)); | 288 | PCI_FUNC(pci_alias)); |
| 288 | 289 | ||
| @@ -293,9 +294,8 @@ static u16 get_alias(struct device *dev) | |||
| 293 | if (pci_alias == devid && | 294 | if (pci_alias == devid && |
| 294 | PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) { | 295 | PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) { |
| 295 | pci_add_dma_alias(pdev, ivrs_alias & 0xff); | 296 | pci_add_dma_alias(pdev, ivrs_alias & 0xff); |
| 296 | pr_info("Added PCI DMA alias %02x.%d for %s\n", | 297 | pci_info(pdev, "Added PCI DMA alias %02x.%d\n", |
| 297 | PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias), | 298 | PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias)); |
| 298 | dev_name(dev)); | ||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | return ivrs_alias; | 301 | return ivrs_alias; |
| @@ -545,7 +545,7 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id, | |||
| 545 | dev_data = get_dev_data(&pdev->dev); | 545 | dev_data = get_dev_data(&pdev->dev); |
| 546 | 546 | ||
| 547 | if (dev_data && __ratelimit(&dev_data->rs)) { | 547 | if (dev_data && __ratelimit(&dev_data->rs)) { |
| 548 | dev_err(&pdev->dev, "Event logged [IO_PAGE_FAULT domain=0x%04x address=0x%llx flags=0x%04x]\n", | 548 | pci_err(pdev, "Event logged [IO_PAGE_FAULT domain=0x%04x address=0x%llx flags=0x%04x]\n", |
| 549 | domain_id, address, flags); | 549 | domain_id, address, flags); |
| 550 | } else if (printk_ratelimit()) { | 550 | } else if (printk_ratelimit()) { |
| 551 | pr_err("Event logged [IO_PAGE_FAULT device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n", | 551 | pr_err("Event logged [IO_PAGE_FAULT device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n", |
| @@ -2251,8 +2251,7 @@ static int amd_iommu_add_device(struct device *dev) | |||
| 2251 | ret = iommu_init_device(dev); | 2251 | ret = iommu_init_device(dev); |
| 2252 | if (ret) { | 2252 | if (ret) { |
| 2253 | if (ret != -ENOTSUPP) | 2253 | if (ret != -ENOTSUPP) |
| 2254 | pr_err("Failed to initialize device %s - trying to proceed anyway\n", | 2254 | dev_err(dev, "Failed to initialize - trying to proceed anyway\n"); |
| 2255 | dev_name(dev)); | ||
| 2256 | 2255 | ||
| 2257 | iommu_ignore_device(dev); | 2256 | iommu_ignore_device(dev); |
| 2258 | dev->dma_ops = NULL; | 2257 | dev->dma_ops = NULL; |
| @@ -2605,8 +2604,8 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, | |||
| 2605 | return nelems; | 2604 | return nelems; |
| 2606 | 2605 | ||
| 2607 | out_unmap: | 2606 | out_unmap: |
| 2608 | pr_err("%s: IOMMU mapping error in %s (io-pages: %d) reason: %d\n", | 2607 | dev_err(dev, "IOMMU mapping error in map_sg (io-pages: %d reason: %d)\n", |
| 2609 | dev_name(dev), __func__, npages, ret); | 2608 | npages, ret); |
| 2610 | 2609 | ||
| 2611 | for_each_sg(sglist, s, nelems, i) { | 2610 | for_each_sg(sglist, s, nelems, i) { |
| 2612 | int j, pages = iommu_num_pages(sg_phys(s), s->length, PAGE_SIZE); | 2611 | int j, pages = iommu_num_pages(sg_phys(s), s->length, PAGE_SIZE); |
| @@ -2800,7 +2799,7 @@ static int init_reserved_iova_ranges(void) | |||
| 2800 | IOVA_PFN(r->start), | 2799 | IOVA_PFN(r->start), |
| 2801 | IOVA_PFN(r->end)); | 2800 | IOVA_PFN(r->end)); |
| 2802 | if (!val) { | 2801 | if (!val) { |
| 2803 | pr_err("Reserve pci-resource range failed\n"); | 2802 | pci_err(pdev, "Reserve pci-resource range %pR failed\n", r); |
| 2804 | return -ENOMEM; | 2803 | return -ENOMEM; |
| 2805 | } | 2804 | } |
| 2806 | } | 2805 | } |
| @@ -3170,8 +3169,7 @@ static void amd_iommu_get_resv_regions(struct device *dev, | |||
| 3170 | length, prot, | 3169 | length, prot, |
| 3171 | IOMMU_RESV_DIRECT); | 3170 | IOMMU_RESV_DIRECT); |
| 3172 | if (!region) { | 3171 | if (!region) { |
| 3173 | pr_err("Out of memory allocating dm-regions for %s\n", | 3172 | dev_err(dev, "Out of memory allocating dm-regions\n"); |
| 3174 | dev_name(dev)); | ||
| 3175 | return; | 3173 | return; |
| 3176 | } | 3174 | } |
| 3177 | list_add_tail(®ion->list, head); | 3175 | list_add_tail(®ion->list, head); |
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 66123b911ec8..f773792d77fd 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #define pr_fmt(fmt) "AMD-Vi: " fmt | 20 | #define pr_fmt(fmt) "AMD-Vi: " fmt |
| 21 | #define dev_fmt(fmt) pr_fmt(fmt) | ||
| 21 | 22 | ||
| 22 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
| 23 | #include <linux/acpi.h> | 24 | #include <linux/acpi.h> |
| @@ -1457,8 +1458,7 @@ static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu) | |||
| 1457 | pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8)); | 1458 | pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8)); |
| 1458 | 1459 | ||
| 1459 | pci_write_config_dword(iommu->dev, 0xf4, value | 0x4); | 1460 | pci_write_config_dword(iommu->dev, 0xf4, value | 0x4); |
| 1460 | pr_info("Applying erratum 746 workaround for IOMMU at %s\n", | 1461 | pci_info(iommu->dev, "Applying erratum 746 workaround\n"); |
| 1461 | dev_name(&iommu->dev->dev)); | ||
| 1462 | 1462 | ||
| 1463 | /* Clear the enable writing bit */ | 1463 | /* Clear the enable writing bit */ |
| 1464 | pci_write_config_dword(iommu->dev, 0xf0, 0x90); | 1464 | pci_write_config_dword(iommu->dev, 0xf0, 0x90); |
| @@ -1488,8 +1488,7 @@ static void amd_iommu_ats_write_check_workaround(struct amd_iommu *iommu) | |||
| 1488 | /* Set L2_DEBUG_3[AtsIgnoreIWDis] = 1 */ | 1488 | /* Set L2_DEBUG_3[AtsIgnoreIWDis] = 1 */ |
| 1489 | iommu_write_l2(iommu, 0x47, value | BIT(0)); | 1489 | iommu_write_l2(iommu, 0x47, value | BIT(0)); |
| 1490 | 1490 | ||
| 1491 | pr_info("Applying ATS write check workaround for IOMMU at %s\n", | 1491 | pci_info(iommu->dev, "Applying ATS write check workaround\n"); |
| 1492 | dev_name(&iommu->dev->dev)); | ||
| 1493 | } | 1492 | } |
| 1494 | 1493 | ||
| 1495 | /* | 1494 | /* |
| @@ -1665,6 +1664,7 @@ static int iommu_pc_get_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, | |||
| 1665 | 1664 | ||
| 1666 | static void init_iommu_perf_ctr(struct amd_iommu *iommu) | 1665 | static void init_iommu_perf_ctr(struct amd_iommu *iommu) |
| 1667 | { | 1666 | { |
| 1667 | struct pci_dev *pdev = iommu->dev; | ||
| 1668 | u64 val = 0xabcd, val2 = 0; | 1668 | u64 val = 0xabcd, val2 = 0; |
| 1669 | 1669 | ||
| 1670 | if (!iommu_feature(iommu, FEATURE_PC)) | 1670 | if (!iommu_feature(iommu, FEATURE_PC)) |
| @@ -1676,12 +1676,12 @@ static void init_iommu_perf_ctr(struct amd_iommu *iommu) | |||
| 1676 | if ((iommu_pc_get_set_reg(iommu, 0, 0, 0, &val, true)) || | 1676 | if ((iommu_pc_get_set_reg(iommu, 0, 0, 0, &val, true)) || |
| 1677 | (iommu_pc_get_set_reg(iommu, 0, 0, 0, &val2, false)) || | 1677 | (iommu_pc_get_set_reg(iommu, 0, 0, 0, &val2, false)) || |
| 1678 | (val != val2)) { | 1678 | (val != val2)) { |
| 1679 | pr_err("Unable to write to IOMMU perf counter.\n"); | 1679 | pci_err(pdev, "Unable to write to IOMMU perf counter.\n"); |
| 1680 | amd_iommu_pc_present = false; | 1680 | amd_iommu_pc_present = false; |
| 1681 | return; | 1681 | return; |
| 1682 | } | 1682 | } |
| 1683 | 1683 | ||
| 1684 | pr_info("IOMMU performance counters supported\n"); | 1684 | pci_info(pdev, "IOMMU performance counters supported\n"); |
| 1685 | 1685 | ||
| 1686 | val = readl(iommu->mmio_base + MMIO_CNTR_CONF_OFFSET); | 1686 | val = readl(iommu->mmio_base + MMIO_CNTR_CONF_OFFSET); |
| 1687 | iommu->max_banks = (u8) ((val >> 12) & 0x3f); | 1687 | iommu->max_banks = (u8) ((val >> 12) & 0x3f); |
| @@ -1840,14 +1840,14 @@ static void print_iommu_info(void) | |||
| 1840 | struct amd_iommu *iommu; | 1840 | struct amd_iommu *iommu; |
| 1841 | 1841 | ||
| 1842 | for_each_iommu(iommu) { | 1842 | for_each_iommu(iommu) { |
| 1843 | struct pci_dev *pdev = iommu->dev; | ||
| 1843 | int i; | 1844 | int i; |
| 1844 | 1845 | ||
| 1845 | pr_info("Found IOMMU at %s cap 0x%hx\n", | 1846 | pci_info(pdev, "Found IOMMU cap 0x%hx\n", iommu->cap_ptr); |
| 1846 | dev_name(&iommu->dev->dev), iommu->cap_ptr); | ||
| 1847 | 1847 | ||
| 1848 | if (iommu->cap & (1 << IOMMU_CAP_EFR)) { | 1848 | if (iommu->cap & (1 << IOMMU_CAP_EFR)) { |
| 1849 | pr_info("Extended features (%#llx):\n", | 1849 | pci_info(pdev, "Extended features (%#llx):\n", |
| 1850 | iommu->features); | 1850 | iommu->features); |
| 1851 | for (i = 0; i < ARRAY_SIZE(feat_str); ++i) { | 1851 | for (i = 0; i < ARRAY_SIZE(feat_str); ++i) { |
| 1852 | if (iommu_feature(iommu, (1ULL << i))) | 1852 | if (iommu_feature(iommu, (1ULL << i))) |
| 1853 | pr_cont(" %s", feat_str[i]); | 1853 | pr_cont(" %s", feat_str[i]); |
