[PATCH] PCI dmar: Cleanup error reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Backtrace/WARN() at these places does not help.
DMAR is not essential and the system can be booted with DMAR
disabled (in BIOS or kernel) and dmi info can be obtained then.

Use PREFIX for "DMAR:"
Use FW_BUG to mark BIOS bugs.

References: Compare with dmesg of:
https://bugzilla.kernel.org/show_bug.cgi?id=15665
There the wrong dmar table is handled gracefully.
A printk/warning for the BIOS writers is still a good idea,
the machine should not provide any dmar table.

Signed-off-by: Thomas Renninger <trenn@xxxxxxx>
CC: linux-pci@xxxxxxxxxxxxxxx
CC: jbarnes@xxxxxxxxxxxxxxxx
---
 drivers/pci/dmar.c |   61 ++++++++++++---------------------------------------
 1 files changed, 15 insertions(+), 46 deletions(-)

diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 33ead97..8c3cde4 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -358,13 +358,8 @@ dmar_parse_one_rhsa(struct acpi_dmar_header *header)
 			return 0;
 		}
 	}
-	WARN(1, "Your BIOS is broken; RHSA refers to non-existent DMAR unit at %llx\n"
-	     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
-	     drhd->reg_base_addr,
-	     dmi_get_system_info(DMI_BIOS_VENDOR),
-	     dmi_get_system_info(DMI_BIOS_VERSION),
-	     dmi_get_system_info(DMI_PRODUCT_VERSION));
-
+	printk(KERN_ERR FW_BUG PREFIX "RHSA refers to non-existent DMAR unit at"
+	       " %llx\n", drhd->reg_base_addr);
 	return 0;
 }
 #endif
@@ -465,7 +460,7 @@ parse_dmar_table(void)
 			(((unsigned long)dmar) + dmar_tbl->length)) {
 		/* Avoid looping forever on bad ACPI tables */
 		if (entry_header->length == 0) {
-			printk(KERN_WARNING PREFIX
+			printk(KERN_WARNING FW_BUG PREFIX
 				"Invalid 0-length structure\n");
 			ret = -EINVAL;
 			break;
@@ -614,8 +609,6 @@ int __init dmar_table_init(void)
 	return 0;
 }
 
-static int bios_warned;
-
 int __init check_zero_address(void)
 {
 	struct acpi_table_dmar *dmar;
@@ -629,7 +622,7 @@ int __init check_zero_address(void)
 			(((unsigned long)dmar) + dmar_tbl->length)) {
 		/* Avoid looping forever on bad ACPI tables */
 		if (entry_header->length == 0) {
-			printk(KERN_WARNING PREFIX
+			printk(KERN_WARNING FW_BUG PREFIX
 				"Invalid 0-length structure\n");
 			return 0;
 		}
@@ -640,13 +633,8 @@ int __init check_zero_address(void)
 
 			drhd = (void *)entry_header;
 			if (!drhd->address) {
-				/* Promote an attitude of violence to a BIOS engineer today */
-				WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
-				     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
-				     dmi_get_system_info(DMI_BIOS_VENDOR),
-				     dmi_get_system_info(DMI_BIOS_VERSION),
-				     dmi_get_system_info(DMI_PRODUCT_VERSION));
-				bios_warned = 1;
+				printk(KERN_ERR FW_BUG PREFIX
+				       "reported at address zero!\n");
 				goto failed;
 			}
 
@@ -659,14 +647,9 @@ int __init check_zero_address(void)
 			ecap = dmar_readq(addr + DMAR_ECAP_REG);
 			early_iounmap(addr, VTD_PAGE_SIZE);
 			if (cap == (uint64_t)-1 && ecap == (uint64_t)-1) {
-				/* Promote an attitude of violence to a BIOS engineer today */
-				WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
-				     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
-				      drhd->address,
-				      dmi_get_system_info(DMI_BIOS_VENDOR),
-				      dmi_get_system_info(DMI_BIOS_VERSION),
-				      dmi_get_system_info(DMI_PRODUCT_VERSION));
-				bios_warned = 1;
+				printk (KERN_ERR FW_BUG PREFIX "reported at "
+					"address %llx returns all ones!\n",
+					drhd->address);
 				goto failed;
 			}
 		}
@@ -731,14 +714,7 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
 	int msagaw = 0;
 
 	if (!drhd->reg_base_addr) {
-		if (!bios_warned) {
-			WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
-			     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
-			     dmi_get_system_info(DMI_BIOS_VENDOR),
-			     dmi_get_system_info(DMI_BIOS_VERSION),
-			     dmi_get_system_info(DMI_PRODUCT_VERSION));
-			bios_warned = 1;
-		}
+		printk(KERN_ERR FW_BUG PREFIX "reported at address zero!\n");
 		return -EINVAL;
 	}
 
@@ -758,16 +734,9 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
 	iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
 
 	if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
-		if (!bios_warned) {
-			/* Promote an attitude of violence to a BIOS engineer today */
-			WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
-			     "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
-			     drhd->reg_base_addr,
-			     dmi_get_system_info(DMI_BIOS_VENDOR),
-			     dmi_get_system_info(DMI_BIOS_VERSION),
-			     dmi_get_system_info(DMI_PRODUCT_VERSION));
-			bios_warned = 1;
-		}
+		/* Promote an attitude of violence to a BIOS engineer today */
+		printk(KERN_ERR FW_BUG PREFIX "reported at address %llx returns"
+		       " all ones!\n", drhd->reg_base_addr);
 		goto err_unmap;
 	}
 
@@ -1298,9 +1267,9 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
 			fault_reason, reason);
 	else
 		printk(KERN_ERR
-		       "DMAR:[%s] Request device [%02x:%02x.%d] "
+		       PREFIX "[%s] Request device [%02x:%02x.%d] "
 		       "fault addr %llx \n"
-		       "DMAR:[fault reason %02d] %s\n",
+		       PREFIX "[fault reason %02d] %s\n",
 		       (type ? "DMA Read" : "DMA Write"),
 		       (source_id >> 8), PCI_SLOT(source_id & 0xFF),
 		       PCI_FUNC(source_id & 0xFF), addr, fault_reason, reason);
-- 
1.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux