WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 15/15] [swiotlb] Take advantage of iommu_sw->name and

To: fujita.tomonori@xxxxxxxxxxxxx, alex.williamson@xxxxxx, joerg.roedel@xxxxxxx, dwmw2@xxxxxxxxxxxxx, chrisw@xxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 15/15] [swiotlb] Take advantage of iommu_sw->name and add %s to printk's.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Thu, 14 Jan 2010 18:01:04 -0500
Cc: Ian.Campbell@xxxxxxxxxxxxx, jeremy@xxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Thu, 14 Jan 2010 15:08:53 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1263510064-16788-15-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1263510064-16788-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-3-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-4-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-5-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-6-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-7-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-8-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-9-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-10-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-11-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-12-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-13-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-14-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-15-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>