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

[Xen-devel] [PATCH 15/15] [swiotlb] Take advantage of iommu_sw->name and add %s to printk's.



Make the printk usage more generic in the SWIOTLB library.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 lib/swiotlb-default.c |    6 +++---
 lib/swiotlb.c         |   26 ++++++++++++++++----------
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/lib/swiotlb-default.c b/lib/swiotlb-default.c
index c490fcf..ebee540 100644
--- a/lib/swiotlb-default.c
+++ b/lib/swiotlb-default.c
@@ -51,7 +51,7 @@ swiotlb_init_with_default_size(struct swiotlb_engine 
*iommu_sw,
         */
        iommu_sw->start = alloc_bootmem_low_pages(bytes);
        if (!iommu_sw->start)
-               panic("Cannot allocate SWIOTLB buffer");
+               panic("Cannot allocate %s buffer", iommu_sw->name);
        iommu_sw->end = iommu_sw->start + bytes;
 
        /*
@@ -71,7 +71,7 @@ swiotlb_init_with_default_size(struct swiotlb_engine 
*iommu_sw,
         */
        iommu_sw->overflow_buffer = alloc_bootmem_low(iommu_sw->overflow);
        if (!iommu_sw->overflow_buffer)
-               panic("Cannot allocate SWIOTLB overflow buffer!\n");
+               panic("Cannot allocate %s overflow buffer!\n", iommu_sw->name);
        if (verbose)
                swiotlb_print_info();
 
@@ -176,7 +176,7 @@ swiotlb_late_init_with_default_size(struct swiotlb_engine 
*iommu_sw,
 
        if (order != get_order(bytes)) {
                printk(KERN_WARNING "Warning: only able to allocate %ld MB "
-                      "for software IO TLB\n", (PAGE_SIZE << order) >> 20);
+                      "for %s\n", (PAGE_SIZE << order) >> 20, iommu_sw->name);
                iommu_sw->nslabs = SLABS_PER_PAGE << order;
                bytes = iommu_sw->nslabs << IO_TLB_SHIFT;
        }
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 9e72d21..1f17be0 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -138,9 +138,10 @@ void swiotlb_print_info(void)
        pstart = virt_to_phys(iommu_sw->start);
        pend = virt_to_phys(iommu_sw->end);
 
-       printk(KERN_INFO "Placing %luMB software IO TLB between %p - %p\n",
-              bytes >> 20, iommu_sw->start, iommu_sw->end);
-       printk(KERN_INFO "software IO TLB at phys %#llx - %#llx\n",
+       printk(KERN_INFO "Placing %luMB %s between %p - %p\n",
+              bytes >> 20, iommu_sw->name, iommu_sw->start, iommu_sw->end);
+       printk(KERN_INFO "%s at phys %#llx - %#llx\n",
+              iommu_sw->name,
               (unsigned long long)pstart,
               (unsigned long long)pend);
 }
@@ -408,7 +409,8 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
 
        /* Confirm address can be DMA'd by device */
        if (dev_addr + size - 1 > dma_mask) {
-               printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n",
+               printk(KERN_ERR "%s:hwdev DMA mask = 0x%016Lx, " \
+                      "dev_addr = 0x%016Lx\n", iommu_sw->name,
                       (unsigned long long)dma_mask,
                       (unsigned long long)dev_addr);
 
@@ -446,18 +448,21 @@ swiotlb_full(struct device *dev, size_t size, int dir, 
int do_panic)
         * When the mapping is small enough return a static buffer to limit
         * the damage, or panic when the transfer is too big.
         */
-       printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at "
-              "device %s\n", size, dev ? dev_name(dev) : "?");
+       printk(KERN_ERR "%s: Out of space for %zu bytes at "
+              "device %s\n", iommu_sw->name, size, dev ? dev_name(dev) : "?");
 
        if (size <= iommu_sw->overflow || !do_panic)
                return;
 
        if (dir == DMA_BIDIRECTIONAL)
-               panic("DMA: Random memory could be DMA accessed\n");
+               panic("%s: Random memory could be DMA accessed\n",
+                     iommu_sw->name);
        if (dir == DMA_FROM_DEVICE)
-               panic("DMA: Random memory could be DMA written\n");
+               panic("%s: Random memory could be DMA written\n",
+                     iommu_sw->name);
        if (dir == DMA_TO_DEVICE)
-               panic("DMA: Random memory could be DMA read\n");
+               panic("%s: Random memory could be DMA read\n",
+                     iommu_sw->name);
 }
 
 /*
@@ -500,7 +505,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page 
*page,
         * Ensure that the address returned is DMA'ble
         */
        if (!iommu_sw->dma_capable(dev, dev_addr, phys, size))
-               panic("map_single: bounce buffer is not DMA'ble");
+               panic("%s map_single: bounce buffer is not DMA'ble",
+                     iommu_sw->name);
 
        return dev_addr;
 }
-- 
1.6.2.5


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


 


Rackspace

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