aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorDonald Dutile <ddutile@redhat.com>2012-06-04 17:29:01 -0400
committerIngo Molnar <mingo@kernel.org>2012-06-08 06:14:57 -0400
commitbf947fcb77ff858f223c49c76e2d130095fa2585 (patch)
treea56d4e3637a7bd14fccc0c76f98caac97e674a0b /drivers/iommu
parent48d212a2eecaca2e1875925837ad27b2f43f48a3 (diff)
iommu/dmar: Replace printks with appropriate pr_*()
Just some cleanup so next patch can keep the info printing the same way throughout the file. Replace printk(KERN_* with pr_*() functions. Signed-off-by: Donald Dutile <ddutile@redhat.com> Cc: iommu@lists.linux-foundation.org Cc: chrisw@redhat.com Cc: suresh.b.siddha@intel.com Cc: dwmw2@infradead.org Link: http://lkml.kernel.org/r/1338845342-12464-2-git-send-email-ddutile@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/dmar.c83
1 files changed, 35 insertions, 48 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 3a74e4410fc0..1e5a10de3471 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -83,15 +83,14 @@ static int __init dmar_parse_one_dev_scope(struct acpi_dmar_device_scope *scope,
83 * ignore it 83 * ignore it
84 */ 84 */
85 if (!bus) { 85 if (!bus) {
86 printk(KERN_WARNING 86 pr_warn(PREFIX "Device scope bus [%d] not found\n",
87 PREFIX "Device scope bus [%d] not found\n", 87 scope->bus);
88 scope->bus);
89 break; 88 break;
90 } 89 }
91 pdev = pci_get_slot(bus, PCI_DEVFN(path->dev, path->fn)); 90 pdev = pci_get_slot(bus, PCI_DEVFN(path->dev, path->fn));
92 if (!pdev) { 91 if (!pdev) {
93 printk(KERN_WARNING PREFIX 92 pr_warn(PREFIX "Device scope device"
94 "Device scope device [%04x:%02x:%02x.%02x] not found\n", 93 "[%04x:%02x:%02x.%02x] not found\n",
95 segment, bus->number, path->dev, path->fn); 94 segment, bus->number, path->dev, path->fn);
96 break; 95 break;
97 } 96 }
@@ -100,9 +99,9 @@ static int __init dmar_parse_one_dev_scope(struct acpi_dmar_device_scope *scope,
100 bus = pdev->subordinate; 99 bus = pdev->subordinate;
101 } 100 }
102 if (!pdev) { 101 if (!pdev) {
103 printk(KERN_WARNING PREFIX 102 pr_warn(PREFIX
104 "Device scope device [%04x:%02x:%02x.%02x] not found\n", 103 "Device scope device [%04x:%02x:%02x.%02x] not found\n",
105 segment, scope->bus, path->dev, path->fn); 104 segment, scope->bus, path->dev, path->fn);
106 *dev = NULL; 105 *dev = NULL;
107 return 0; 106 return 0;
108 } 107 }
@@ -110,8 +109,7 @@ static int __init dmar_parse_one_dev_scope(struct acpi_dmar_device_scope *scope,
110 pdev->subordinate) || (scope->entry_type == \ 109 pdev->subordinate) || (scope->entry_type == \
111 ACPI_DMAR_SCOPE_TYPE_BRIDGE && !pdev->subordinate)) { 110 ACPI_DMAR_SCOPE_TYPE_BRIDGE && !pdev->subordinate)) {
112 pci_dev_put(pdev); 111 pci_dev_put(pdev);
113 printk(KERN_WARNING PREFIX 112 pr_warn(PREFIX "Device scope type does not match for %s\n",
114 "Device scope type does not match for %s\n",
115 pci_name(pdev)); 113 pci_name(pdev));
116 return -EINVAL; 114 return -EINVAL;
117 } 115 }
@@ -134,8 +132,7 @@ int __init dmar_parse_dev_scope(void *start, void *end, int *cnt,
134 scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE) 132 scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE)
135 (*cnt)++; 133 (*cnt)++;
136 else if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_IOAPIC) { 134 else if (scope->entry_type != ACPI_DMAR_SCOPE_TYPE_IOAPIC) {
137 printk(KERN_WARNING PREFIX 135 pr_warn(PREFIX "Unsupported device scope\n");
138 "Unsupported device scope\n");
139 } 136 }
140 start += scope->length; 137 start += scope->length;
141 } 138 }
@@ -261,25 +258,23 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
261 case ACPI_DMAR_TYPE_HARDWARE_UNIT: 258 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
262 drhd = container_of(header, struct acpi_dmar_hardware_unit, 259 drhd = container_of(header, struct acpi_dmar_hardware_unit,
263 header); 260 header);
264 printk (KERN_INFO PREFIX 261 pr_info(PREFIX "DRHD base: %#016Lx flags: %#x\n",
265 "DRHD base: %#016Lx flags: %#x\n",
266 (unsigned long long)drhd->address, drhd->flags); 262 (unsigned long long)drhd->address, drhd->flags);
267 break; 263 break;
268 case ACPI_DMAR_TYPE_RESERVED_MEMORY: 264 case ACPI_DMAR_TYPE_RESERVED_MEMORY:
269 rmrr = container_of(header, struct acpi_dmar_reserved_memory, 265 rmrr = container_of(header, struct acpi_dmar_reserved_memory,
270 header); 266 header);
271 printk (KERN_INFO PREFIX 267 pr_info(PREFIX "RMRR base: %#016Lx end: %#016Lx\n",
272 "RMRR base: %#016Lx end: %#016Lx\n",
273 (unsigned long long)rmrr->base_address, 268 (unsigned long long)rmrr->base_address,
274 (unsigned long long)rmrr->end_address); 269 (unsigned long long)rmrr->end_address);
275 break; 270 break;
276 case ACPI_DMAR_TYPE_ATSR: 271 case ACPI_DMAR_TYPE_ATSR:
277 atsr = container_of(header, struct acpi_dmar_atsr, header); 272 atsr = container_of(header, struct acpi_dmar_atsr, header);
278 printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags); 273 pr_info(PREFIX "ATSR flags: %#x\n", atsr->flags);
279 break; 274 break;
280 case ACPI_DMAR_HARDWARE_AFFINITY: 275 case ACPI_DMAR_HARDWARE_AFFINITY:
281 rhsa = container_of(header, struct acpi_dmar_rhsa, header); 276 rhsa = container_of(header, struct acpi_dmar_rhsa, header);
282 printk(KERN_INFO PREFIX "RHSA base: %#016Lx proximity domain: %#x\n", 277 pr_info(PREFIX "RHSA base: %#016Lx proximity domain: %#x\n",
283 (unsigned long long)rhsa->base_address, 278 (unsigned long long)rhsa->base_address,
284 rhsa->proximity_domain); 279 rhsa->proximity_domain);
285 break; 280 break;
@@ -299,7 +294,7 @@ static int __init dmar_table_detect(void)
299 &dmar_tbl_size); 294 &dmar_tbl_size);
300 295
301 if (ACPI_SUCCESS(status) && !dmar_tbl) { 296 if (ACPI_SUCCESS(status) && !dmar_tbl) {
302 printk (KERN_WARNING PREFIX "Unable to map DMAR\n"); 297 pr_warn(PREFIX "Unable to map DMAR\n");
303 status = AE_NOT_FOUND; 298 status = AE_NOT_FOUND;
304 } 299 }
305 300
@@ -333,20 +328,18 @@ parse_dmar_table(void)
333 return -ENODEV; 328 return -ENODEV;
334 329
335 if (dmar->width < PAGE_SHIFT - 1) { 330 if (dmar->width < PAGE_SHIFT - 1) {
336 printk(KERN_WARNING PREFIX "Invalid DMAR haw\n"); 331 pr_warn(PREFIX "Invalid DMAR haw\n");
337 return -EINVAL; 332 return -EINVAL;
338 } 333 }
339 334
340 printk (KERN_INFO PREFIX "Host address width %d\n", 335 pr_info(PREFIX "Host address width %d\n", dmar->width + 1);
341 dmar->width + 1);
342 336
343 entry_header = (struct acpi_dmar_header *)(dmar + 1); 337 entry_header = (struct acpi_dmar_header *)(dmar + 1);
344 while (((unsigned long)entry_header) < 338 while (((unsigned long)entry_header) <
345 (((unsigned long)dmar) + dmar_tbl->length)) { 339 (((unsigned long)dmar) + dmar_tbl->length)) {
346 /* Avoid looping forever on bad ACPI tables */ 340 /* Avoid looping forever on bad ACPI tables */
347 if (entry_header->length == 0) { 341 if (entry_header->length == 0) {
348 printk(KERN_WARNING PREFIX 342 pr_warn(PREFIX "Invalid 0-length structure\n");
349 "Invalid 0-length structure\n");
350 ret = -EINVAL; 343 ret = -EINVAL;
351 break; 344 break;
352 } 345 }
@@ -369,8 +362,7 @@ parse_dmar_table(void)
369#endif 362#endif
370 break; 363 break;
371 default: 364 default:
372 printk(KERN_WARNING PREFIX 365 pr_warn(PREFIX "Unknown DMAR structure type %d\n",
373 "Unknown DMAR structure type %d\n",
374 entry_header->type); 366 entry_header->type);
375 ret = 0; /* for forward compatibility */ 367 ret = 0; /* for forward compatibility */
376 break; 368 break;
@@ -469,12 +461,12 @@ int __init dmar_table_init(void)
469 ret = parse_dmar_table(); 461 ret = parse_dmar_table();
470 if (ret) { 462 if (ret) {
471 if (ret != -ENODEV) 463 if (ret != -ENODEV)
472 printk(KERN_INFO PREFIX "parse DMAR table failure.\n"); 464 pr_info(PREFIX "parse DMAR table failure.\n");
473 return ret; 465 return ret;
474 } 466 }
475 467
476 if (list_empty(&dmar_drhd_units)) { 468 if (list_empty(&dmar_drhd_units)) {
477 printk(KERN_INFO PREFIX "No DMAR devices found\n"); 469 pr_info(PREFIX "No DMAR devices found\n");
478 return -ENODEV; 470 return -ENODEV;
479 } 471 }
480 472
@@ -506,8 +498,7 @@ int __init check_zero_address(void)
506 (((unsigned long)dmar) + dmar_tbl->length)) { 498 (((unsigned long)dmar) + dmar_tbl->length)) {
507 /* Avoid looping forever on bad ACPI tables */ 499 /* Avoid looping forever on bad ACPI tables */
508 if (entry_header->length == 0) { 500 if (entry_header->length == 0) {
509 printk(KERN_WARNING PREFIX 501 pr_warn(PREFIX "Invalid 0-length structure\n");
510 "Invalid 0-length structure\n");
511 return 0; 502 return 0;
512 } 503 }
513 504
@@ -558,8 +549,8 @@ int __init detect_intel_iommu(void)
558 549
559 if (ret && irq_remapping_enabled && cpu_has_x2apic && 550 if (ret && irq_remapping_enabled && cpu_has_x2apic &&
560 dmar->flags & 0x1) 551 dmar->flags & 0x1)
561 printk(KERN_INFO 552 pr_info("Queued invalidation will be enabled to "
562 "Queued invalidation will be enabled to support x2apic and Intr-remapping.\n"); 553 "support x2apic and Intr-remapping.\n");
563 554
564 if (ret && !no_iommu && !iommu_detected && !dmar_disabled) { 555 if (ret && !no_iommu && !iommu_detected && !dmar_disabled) {
565 iommu_detected = 1; 556 iommu_detected = 1;
@@ -602,7 +593,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
602 593
603 iommu->reg = ioremap(drhd->reg_base_addr, VTD_PAGE_SIZE); 594 iommu->reg = ioremap(drhd->reg_base_addr, VTD_PAGE_SIZE);
604 if (!iommu->reg) { 595 if (!iommu->reg) {
605 printk(KERN_ERR "IOMMU: can't map the region\n"); 596 pr_err("IOMMU: can't map the region\n");
606 goto error; 597 goto error;
607 } 598 }
608 iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG); 599 iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
@@ -615,15 +606,13 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
615 606
616 agaw = iommu_calculate_agaw(iommu); 607 agaw = iommu_calculate_agaw(iommu);
617 if (agaw < 0) { 608 if (agaw < 0) {
618 printk(KERN_ERR 609 pr_err("Cannot get a valid agaw for iommu (seq_id = %d)\n",
619 "Cannot get a valid agaw for iommu (seq_id = %d)\n", 610 iommu->seq_id);
620 iommu->seq_id);
621 goto err_unmap; 611 goto err_unmap;
622 } 612 }
623 msagaw = iommu_calculate_max_sagaw(iommu); 613 msagaw = iommu_calculate_max_sagaw(iommu);
624 if (msagaw < 0) { 614 if (msagaw < 0) {
625 printk(KERN_ERR 615 pr_err("Cannot get a valid max agaw for iommu (seq_id = %d)\n",
626 "Cannot get a valid max agaw for iommu (seq_id = %d)\n",
627 iommu->seq_id); 616 iommu->seq_id);
628 goto err_unmap; 617 goto err_unmap;
629 } 618 }
@@ -640,7 +629,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
640 iounmap(iommu->reg); 629 iounmap(iommu->reg);
641 iommu->reg = ioremap(drhd->reg_base_addr, map_size); 630 iommu->reg = ioremap(drhd->reg_base_addr, map_size);
642 if (!iommu->reg) { 631 if (!iommu->reg) {
643 printk(KERN_ERR "IOMMU: can't map the region\n"); 632 pr_err("IOMMU: can't map the region\n");
644 goto error; 633 goto error;
645 } 634 }
646 } 635 }
@@ -710,7 +699,7 @@ static int qi_check_fault(struct intel_iommu *iommu, int index)
710 if (fault & DMA_FSTS_IQE) { 699 if (fault & DMA_FSTS_IQE) {
711 head = readl(iommu->reg + DMAR_IQH_REG); 700 head = readl(iommu->reg + DMAR_IQH_REG);
712 if ((head >> DMAR_IQ_SHIFT) == index) { 701 if ((head >> DMAR_IQ_SHIFT) == index) {
713 printk(KERN_ERR "VT-d detected invalid descriptor: " 702 pr_err("VT-d detected invalid descriptor: "
714 "low=%llx, high=%llx\n", 703 "low=%llx, high=%llx\n",
715 (unsigned long long)qi->desc[index].low, 704 (unsigned long long)qi->desc[index].low,
716 (unsigned long long)qi->desc[index].high); 705 (unsigned long long)qi->desc[index].high);
@@ -1129,15 +1118,14 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
1129 reason = dmar_get_fault_reason(fault_reason, &fault_type); 1118 reason = dmar_get_fault_reason(fault_reason, &fault_type);
1130 1119
1131 if (fault_type == INTR_REMAP) 1120 if (fault_type == INTR_REMAP)
1132 printk(KERN_ERR "INTR-REMAP: Request device [[%02x:%02x.%d] " 1121 pr_err("INTR-REMAP: Request device [[%02x:%02x.%d] "
1133 "fault index %llx\n" 1122 "fault index %llx\n"
1134 "INTR-REMAP:[fault reason %02d] %s\n", 1123 "INTR-REMAP:[fault reason %02d] %s\n",
1135 (source_id >> 8), PCI_SLOT(source_id & 0xFF), 1124 (source_id >> 8), PCI_SLOT(source_id & 0xFF),
1136 PCI_FUNC(source_id & 0xFF), addr >> 48, 1125 PCI_FUNC(source_id & 0xFF), addr >> 48,
1137 fault_reason, reason); 1126 fault_reason, reason);
1138 else 1127 else
1139 printk(KERN_ERR 1128 pr_err("DMAR:[%s] Request device [%02x:%02x.%d] "
1140 "DMAR:[%s] Request device [%02x:%02x.%d] "
1141 "fault addr %llx \n" 1129 "fault addr %llx \n"
1142 "DMAR:[fault reason %02d] %s\n", 1130 "DMAR:[fault reason %02d] %s\n",
1143 (type ? "DMA Read" : "DMA Write"), 1131 (type ? "DMA Read" : "DMA Write"),
@@ -1157,8 +1145,7 @@ irqreturn_t dmar_fault(int irq, void *dev_id)
1157 raw_spin_lock_irqsave(&iommu->register_lock, flag); 1145 raw_spin_lock_irqsave(&iommu->register_lock, flag);
1158 fault_status = readl(iommu->reg + DMAR_FSTS_REG); 1146 fault_status = readl(iommu->reg + DMAR_FSTS_REG);
1159 if (fault_status) 1147 if (fault_status)
1160 printk(KERN_ERR "DRHD: handling fault status reg %x\n", 1148 pr_err("DRHD: handling fault status reg %x\n", fault_status);
1161 fault_status);
1162 1149
1163 /* TBD: ignore advanced fault log currently */ 1150 /* TBD: ignore advanced fault log currently */
1164 if (!(fault_status & DMA_FSTS_PPF)) 1151 if (!(fault_status & DMA_FSTS_PPF))
@@ -1224,7 +1211,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
1224 1211
1225 irq = create_irq(); 1212 irq = create_irq();
1226 if (!irq) { 1213 if (!irq) {
1227 printk(KERN_ERR "IOMMU: no free vectors\n"); 1214 pr_err("IOMMU: no free vectors\n");
1228 return -EINVAL; 1215 return -EINVAL;
1229 } 1216 }
1230 1217
@@ -1241,7 +1228,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
1241 1228
1242 ret = request_irq(irq, dmar_fault, IRQF_NO_THREAD, iommu->name, iommu); 1229 ret = request_irq(irq, dmar_fault, IRQF_NO_THREAD, iommu->name, iommu);
1243 if (ret) 1230 if (ret)
1244 printk(KERN_ERR "IOMMU: can't request irq\n"); 1231 pr_err("IOMMU: can't request irq\n");
1245 return ret; 1232 return ret;
1246} 1233}
1247 1234
@@ -1258,7 +1245,7 @@ int __init enable_drhd_fault_handling(void)
1258 ret = dmar_set_interrupt(iommu); 1245 ret = dmar_set_interrupt(iommu);
1259 1246
1260 if (ret) { 1247 if (ret) {
1261 printk(KERN_ERR "DRHD %Lx: failed to enable fault, " 1248 pr_err("DRHD %Lx: failed to enable fault, "
1262 " interrupt, ret %d\n", 1249 " interrupt, ret %d\n",
1263 (unsigned long long)drhd->reg_base_addr, ret); 1250 (unsigned long long)drhd->reg_base_addr, ret);
1264 return -1; 1251 return -1;