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

[Xen-changelog] [xen-unstable] amd iommu: Fix output and coding style



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1296029834 0
# Node ID f28ab5926896afbe4b0246bfcd09e6aba466fc47
# Parent  73b3debb90cfe4d811596a7cea83ff6389728c80
amd iommu: Fix output and coding style

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_acpi.c     |   57 +++++++++++++--------------
 xen/drivers/passthrough/amd/iommu_init.c     |   25 ++++++-----
 xen/drivers/passthrough/amd/iommu_intr.c     |   13 ++----
 xen/drivers/passthrough/amd/iommu_map.c      |    2 
 xen/drivers/passthrough/amd/pci_amd_iommu.c  |   41 ++++++++++---------
 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h |    2 
 6 files changed, 72 insertions(+), 68 deletions(-)

diff -r 73b3debb90cf -r f28ab5926896 xen/drivers/passthrough/amd/iommu_acpi.c
--- a/xen/drivers/passthrough/amd/iommu_acpi.c  Tue Jan 25 18:27:43 2011 +0000
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c  Wed Jan 26 08:17:14 2011 +0000
@@ -289,16 +289,16 @@ static int __init parse_ivmd_device_rang
     first_bdf = ivmd_block->header.dev_id;
     if ( first_bdf >= ivrs_bdf_entries )
     {
-        AMD_IOMMU_DEBUG(
-            "IVMD Error: Invalid Range_First Dev_Id 0x%x\n", first_bdf);
+        AMD_IOMMU_DEBUG("IVMD Error: "
+                        "Invalid Range_First Dev_Id 0x%x\n", first_bdf);
         return -ENODEV;
     }
 
     last_bdf = ivmd_block->last_dev_id;
     if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) )
     {
-        AMD_IOMMU_DEBUG(
-            "IVMD Error: Invalid Range_Last Dev_Id 0x%x\n", last_bdf);
+        AMD_IOMMU_DEBUG("IVMD Error: "
+                        "Invalid Range_Last Dev_Id 0x%x\n", last_bdf);
         return -ENODEV;
     }
 
@@ -321,7 +321,7 @@ static int __init parse_ivmd_device_iomm
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("IVMD Error: No IOMMU for Dev_Id 0x%x  Cap 0x%x\n",
-                ivmd_block->header.dev_id, ivmd_block->cap_offset);
+                        ivmd_block->header.dev_id, ivmd_block->cap_offset);
         return -ENODEV;
     }
 
@@ -441,24 +441,24 @@ static u16 __init parse_ivhd_device_rang
          AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END )
     {
         AMD_IOMMU_DEBUG("IVHD Error: "
-                "Invalid Range: End_Type 0x%x\n",
-                ivhd_device->range.trailer.type);
+                        "Invalid Range: End_Type 0x%x\n",
+                        ivhd_device->range.trailer.type);
         return 0;
     }
 
     first_bdf = ivhd_device->header.dev_id;
     if ( first_bdf >= ivrs_bdf_entries )
     {
-        AMD_IOMMU_DEBUG(
-            "IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf);
+        AMD_IOMMU_DEBUG("IVHD Error: "
+                        "Invalid Range: First Dev_Id 0x%x\n", first_bdf);
         return 0;
     }
 
     last_bdf = ivhd_device->range.trailer.dev_id;
     if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) )
     {
-        AMD_IOMMU_DEBUG(
-            "IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
+        AMD_IOMMU_DEBUG("IVHD Error: "
+                        "Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
         return 0;
     }
 
@@ -522,16 +522,16 @@ static u16 __init parse_ivhd_device_alia
          AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END )
     {
         AMD_IOMMU_DEBUG("IVHD Error: "
-                "Invalid Range: End_Type 0x%x\n",
-                ivhd_device->alias_range.trailer.type);
+                        "Invalid Range: End_Type 0x%x\n",
+                        ivhd_device->alias_range.trailer.type);
         return 0;
     }
 
     first_bdf = ivhd_device->header.dev_id;
     if ( first_bdf >= ivrs_bdf_entries )
     {
-        AMD_IOMMU_DEBUG(
-            "IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf);
+        AMD_IOMMU_DEBUG("IVHD Error: "
+                        "Invalid Range: First Dev_Id 0x%x\n", first_bdf);
         return 0;
     }
 
@@ -601,29 +601,29 @@ static u16 __init parse_ivhd_device_exte
          AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END )
     {
         AMD_IOMMU_DEBUG("IVHD Error: "
-                "Invalid Range: End_Type 0x%x\n",
-                ivhd_device->extended_range.trailer.type);
+                        "Invalid Range: End_Type 0x%x\n",
+                        ivhd_device->extended_range.trailer.type);
         return 0;
     }
 
     first_bdf = ivhd_device->header.dev_id;
     if ( first_bdf >= ivrs_bdf_entries )
     {
-        AMD_IOMMU_DEBUG(
-            "IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf);
+        AMD_IOMMU_DEBUG("IVHD Error: "
+                        "Invalid Range: First Dev_Id 0x%x\n", first_bdf);
         return 0;
     }
 
     last_bdf = ivhd_device->extended_range.trailer.dev_id;
     if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) )
     {
-        AMD_IOMMU_DEBUG(
-            "IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
+        AMD_IOMMU_DEBUG("IVHD Error: "
+                        "Invalid Range: Last Dev_Id 0x%x\n", last_bdf);
         return 0;
     }
 
     AMD_IOMMU_DEBUG(" Dev_Id Range: 0x%x -> 0x%x\n",
-            first_bdf, last_bdf);
+                    first_bdf, last_bdf);
 
     for ( bdf = first_bdf; bdf <= last_bdf; bdf++ )
         add_ivrs_mapping_entry(bdf, bdf, ivhd_device->header.flags, iommu);
@@ -675,7 +675,7 @@ static int __init parse_ivhd_block(struc
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("IVHD Error: No IOMMU for Dev_Id 0x%x  Cap 0x%x\n",
-                ivhd_block->header.dev_id, ivhd_block->cap_offset);
+                        ivhd_block->header.dev_id, ivhd_block->cap_offset);
         return -ENODEV;
     }
 
@@ -809,7 +809,7 @@ static void __init dump_acpi_table_heade
     printk("\n");
 
     AMD_IOMMU_DEBUG(" Creator_Revision 0x%x\n",
-           table->asl_compiler_revision);
+                    table->asl_compiler_revision);
 
 }
 
@@ -841,9 +841,9 @@ static int __init parse_ivrs_table(struc
         if ( table->length < (length + ivrs_block->length) )
         {
             AMD_IOMMU_DEBUG("IVRS Error: "
-                    "Table Length Exceeded: 0x%x -> 0x%lx\n",
-                    table->length,
-                    (length + ivrs_block->length));
+                            "Table Length Exceeded: 0x%x -> 0x%lx\n",
+                            table->length,
+                            (length + ivrs_block->length));
             return -ENODEV;
         }
 
@@ -869,8 +869,7 @@ static int __init detect_iommu_acpi(stru
         checksum += raw_table[i];
     if ( checksum )
     {
-        AMD_IOMMU_DEBUG("IVRS Error: "
-                "Invalid Checksum 0x%x\n", checksum);
+        AMD_IOMMU_DEBUG("IVRS Error: Invalid Checksum 0x%x\n", checksum);
         return -ENODEV;
     }
 
diff -r 73b3debb90cf -r f28ab5926896 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c  Tue Jan 25 18:27:43 2011 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c  Wed Jan 26 08:17:14 2011 +0000
@@ -324,7 +324,7 @@ static void amd_iommu_reset_event_log(st
     if ( log_run )
     {
         AMD_IOMMU_DEBUG("Warning: EventLogRun bit is not cleared"
-                       "before reset!\n");
+                        "before reset!\n");
         return;
     }
 
@@ -357,7 +357,9 @@ static void iommu_msi_set_affinity(unsig
     u8 func = PCI_FUNC(iommu->bdf & 0xff);
 
     dest = set_desc_affinity(desc, &mask);
-    if (dest == BAD_APICID){
+
+    if ( dest == BAD_APICID )
+    {
         dprintk(XENLOG_ERR, "Set iommu interrupt affinity error!\n");
         return;
     }
@@ -448,7 +450,7 @@ static void iommu_msi_end(unsigned int i
 
 
 static hw_irq_controller iommu_msi_type = {
-    .typename = "AMD_IOV_MSI",
+    .typename = "AMD-IOMMU-MSI",
     .startup = iommu_msi_startup,
     .shutdown = iommu_msi_mask,
     .enable = iommu_msi_unmask,
@@ -464,7 +466,7 @@ static void parse_event_log_entry(u32 en
     u32 code;
     u64 *addr;
     char * event_str[] = {"ILLEGAL_DEV_TABLE_ENTRY",
-                          "IO_PAGE_FALT",
+                          "IO_PAGE_FAULT",
                           "DEV_TABLE_HW_ERROR",
                           "PAGE_TABLE_HW_ERROR",
                           "ILLEGAL_COMMAND_ERROR",
@@ -482,7 +484,7 @@ static void parse_event_log_entry(u32 en
         return;
     }
 
-    if ( code == IOMMU_EVENT_IO_PAGE_FALT )
+    if ( code == IOMMU_EVENT_IO_PAGE_FAULT )
     {
         device_id = get_field_from_reg_u32(entry[0],
                                            IOMMU_EVENT_DEVICE_ID_MASK,
@@ -491,9 +493,10 @@ static void parse_event_log_entry(u32 en
                                            IOMMU_EVENT_DOMAIN_ID_MASK,
                                            IOMMU_EVENT_DOMAIN_ID_SHIFT);
         addr= (u64*) (entry + 2);
-        printk(XENLOG_ERR "AMD_IOV: "
-            "%s: domain:%d, device id:0x%x, fault address:0x%"PRIx64"\n",
-            event_str[code-1], domain_id, device_id, *addr);
+        printk(XENLOG_ERR "AMD-Vi: "
+               "%s: domain = %d, device id = 0x%04x, "
+               "fault address = 0x%"PRIx64"\n",
+               event_str[code-1], domain_id, device_id, *addr);
     }
     else
     {
@@ -810,9 +813,9 @@ static int __init amd_iommu_setup_device
             amd_iommu_set_intremap_table(
                 dte, (u64)virt_to_maddr(intr_tb), iommu_intremap);
 
-            AMD_IOMMU_DEBUG("Add device table entry at DTE:0x%x, "
-                "intremap_table:%"PRIx64"\n", bdf,
-                (u64)virt_to_maddr(intr_tb));
+            AMD_IOMMU_DEBUG("Add device table entry: device id = 0x%04x, "
+                            "interupt table = 0x%"PRIx64"\n", bdf,
+                            (u64)virt_to_maddr(intr_tb));
         }
     }
 
diff -r 73b3debb90cf -r f28ab5926896 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c  Tue Jan 25 18:27:43 2011 +0000
+++ b/xen/drivers/passthrough/amd/iommu_intr.c  Wed Jan 26 08:17:14 2011 +0000
@@ -183,8 +183,8 @@ int __init amd_iommu_setup_ioapic_remapp
             iommu = find_iommu_for_device(bdf);
             if ( !iommu )
             {
-                AMD_IOMMU_DEBUG(
-                "Fail to find iommu for ioapic device id = 0x%x\n", bdf);
+                AMD_IOMMU_DEBUG("Fail to find iommu for ioapic "
+                                "device id = 0x%x\n", bdf);
                 continue;
             }
 
@@ -233,8 +233,8 @@ void amd_iommu_ioapic_update_ire(
     iommu = find_iommu_for_device(bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG(
-            "Fail to find iommu for ioapic device id = 0x%x\n", bdf);
+        AMD_IOMMU_DEBUG("Fail to find iommu for ioapic device id = 0x%x\n",
+                        bdf);
         return;
     }
     if ( rte_upper )
@@ -350,9 +350,8 @@ void amd_iommu_msi_msg_update_ire(
 
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG(
-            "Fail to find iommu for MSI device id = 0x%x\n",
-            (pdev->bus << 8) | pdev->devfn);
+        AMD_IOMMU_DEBUG("Fail to find iommu for MSI device id = 0x%x\n",
+                       (pdev->bus << 8) | pdev->devfn);
         return;
     }
 
diff -r 73b3debb90cf -r f28ab5926896 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c   Tue Jan 25 18:27:43 2011 +0000
+++ b/xen/drivers/passthrough/amd/iommu_map.c   Wed Jan 26 08:17:14 2011 +0000
@@ -535,7 +535,7 @@ int amd_iommu_reserve_domain_unity_map(
         {
             spin_unlock(&hd->mapping_lock);
             AMD_IOMMU_DEBUG("Invalid IO pagetable entry phys_addr = %lx\n",
-                          phys_addr);
+                            phys_addr);
             domain_crash(domain);
             return -EFAULT;
         }
diff -r 73b3debb90cf -r f28ab5926896 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Tue Jan 25 18:27:43 
2011 +0000
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Jan 26 08:17:14 
2011 +0000
@@ -109,9 +109,11 @@ static void amd_iommu_setup_domain_devic
         invalidate_dev_table_entry(iommu, req_id);
         flush_command_buffer(iommu);
 
-        AMD_IOMMU_DEBUG("Setup I/O page table at DTE:0x%x, 
root_table:%"PRIx64","
-        "domain_id:%d, paging_mode:%d\n", req_id,
-        page_to_maddr(hd->root_table), hd->domain_id, hd->paging_mode);
+        AMD_IOMMU_DEBUG("Setup I/O page table: device id = 0x%04x, "
+                        "root table = 0x%"PRIx64", "
+                        "domain = %d, paging mode = %d\n", req_id,
+                        page_to_maddr(hd->root_table),
+                        hd->domain_id, hd->paging_mode);
     }
 
     spin_unlock_irqrestore(&iommu->lock, flags);
@@ -160,7 +162,7 @@ int __init amd_iov_detect(void)
 
     if ( amd_iommu_init() != 0 )
     {
-        printk("Error initialization\n");
+        printk("AMD-Vi: Error initialization\n");
         return -ENODEV;
     }
 
@@ -262,10 +264,10 @@ static void amd_iommu_disable_domain_dev
         disable_translation((u32 *)dte);
         invalidate_dev_table_entry(iommu, req_id);
         flush_command_buffer(iommu);
-        AMD_IOMMU_DEBUG("Disable DTE:0x%x,"
-                " domain_id:%d, paging_mode:%d\n",
-                req_id,  domain_hvm_iommu(domain)->domain_id,
-                domain_hvm_iommu(domain)->paging_mode);
+        AMD_IOMMU_DEBUG("Disable: device id = 0x%04x, "
+                        "domain = %d, paging mode = %d\n",
+                        req_id,  domain_hvm_iommu(domain)->domain_id,
+                        domain_hvm_iommu(domain)->paging_mode);
     }
     spin_unlock_irqrestore(&iommu->lock, flags);
 }
@@ -287,8 +289,9 @@ static int reassign_device( struct domai
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu."
-            " %x:%x.%x cannot be assigned to domain %d\n", 
-            bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id);
+                        " %02x:%x02.%x cannot be assigned to domain %d\n", 
+                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                        target->domain_id);
         return -ENODEV;
     }
 
@@ -298,9 +301,9 @@ static int reassign_device( struct domai
     pdev->domain = target;
 
     amd_iommu_setup_domain_device(target, iommu, bdf);
-    AMD_IOMMU_DEBUG("reassign %x:%x.%x domain %d -> domain %d\n",
-                 bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                 source->domain_id, target->domain_id);
+    AMD_IOMMU_DEBUG("Re-assign %02x:%02x.%x from domain %d to domain %d\n",
+                    bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                    source->domain_id, target->domain_id);
 
     return 0;
 }
@@ -387,9 +390,9 @@ static int amd_iommu_add_device(struct p
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu."
-            " %x:%x.%x cannot be assigned to domain %d\n", 
-            pdev->bus, PCI_SLOT(pdev->devfn),
-            PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
+                        " %02x:%02x.%x cannot be assigned to domain %d\n", 
+                        pdev->bus, PCI_SLOT(pdev->devfn),
+                        PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
         return -ENODEV;
     }
 
@@ -409,9 +412,9 @@ static int amd_iommu_remove_device(struc
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu."
-            " %x:%x.%x cannot be removed from domain %d\n", 
-            pdev->bus, PCI_SLOT(pdev->devfn),
-            PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
+                        " %02x:%02x.%x cannot be removed from domain %d\n", 
+                        pdev->bus, PCI_SLOT(pdev->devfn),
+                        PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
         return -ENODEV;
     }
 
diff -r 73b3debb90cf -r f28ab5926896 
xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h      Tue Jan 25 18:27:43 
2011 +0000
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h      Wed Jan 26 08:17:14 
2011 +0000
@@ -256,7 +256,7 @@
 #define IOMMU_EVENT_CODE_MASK                  0xF0000000
 #define IOMMU_EVENT_CODE_SHIFT                 28
 #define IOMMU_EVENT_ILLEGAL_DEV_TABLE_ENTRY    0x1
-#define IOMMU_EVENT_IO_PAGE_FALT               0x2
+#define IOMMU_EVENT_IO_PAGE_FAULT              0x2
 #define IOMMU_EVENT_DEV_TABLE_HW_ERROR         0x3
 #define IOMMU_EVENT_PAGE_TABLE_HW_ERROR                0x4
 #define IOMMU_EVENT_ILLEGAL_COMMAND_ERROR      0x5

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.