]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'xen-tip/linux-next'
authorThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:58:49 +0000 (14:58 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:58:49 +0000 (14:58 +0200)
arch/x86/xen/mmu.c
drivers/tty/hvc/hvc_xen.c
drivers/xen/swiotlb-xen.c
include/trace/events/swiotlb.h [new file with mode: 0644]
lib/swiotlb.c

index fdc3ba28ca38d2a89eb3e59e6bca73b692f84945..c9631e73a09043f0d55f176bda9f1ba66aa91800 100644 (file)
@@ -468,8 +468,8 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val);
  * 3        PCD PWT      UC       UC     UC
  * 4    PAT              WB       WC     WB
  * 5    PAT     PWT      WC       WP     WT
- * 6    PAT PCD          UC-      UC     UC-
- * 7    PAT PCD PWT      UC       UC     UC
+ * 6    PAT PCD          UC-      rsv    UC-
+ * 7    PAT PCD PWT      UC       rsv    UC
  */
 
 void xen_set_pat(u64 pat)
index c193af6a628f45758a7fcd59b1b0823e57327655..636c9baad7a58b76fc740bd49794303cfcc472ef 100644 (file)
@@ -183,7 +183,7 @@ static int dom0_write_console(uint32_t vtermno, const char *str, int len)
 {
        int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str);
        if (rc < 0)
-               return 0;
+               return rc;
 
        return len;
 }
@@ -642,7 +642,22 @@ struct console xenboot_console = {
 
 void xen_raw_console_write(const char *str)
 {
-       dom0_write_console(0, str, strlen(str));
+       ssize_t len = strlen(str);
+       int rc = 0;
+
+       if (xen_domain()) {
+               rc = dom0_write_console(0, str, len);
+#ifdef CONFIG_X86
+               if (rc == -ENOSYS && xen_hvm_domain())
+                       goto outb_print;
+
+       } else if (xen_cpuid_base()) {
+               int i;
+outb_print:
+               for (i = 0; i < len; i++)
+                       outb(str[i], 0xe9);
+#endif
+       }
 }
 
 void xen_raw_printk(const char *fmt, ...)
index 1b2277c311d22e31fc276b09cb6bd1ce3b783e39..b31081007a810cfcaf81d47d8ea07eae41eb8a00 100644 (file)
@@ -42,6 +42,9 @@
 #include <xen/page.h>
 #include <xen/xen-ops.h>
 #include <xen/hvc-console.h>
+
+#define CREATE_TRACE_POINTS
+#include <trace/events/swiotlb.h>
 /*
  * Used to do a quick range check in swiotlb_tbl_unmap_single and
  * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this
@@ -358,6 +361,8 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
        /*
         * Oh well, have to allocate and map a bounce buffer.
         */
+       trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
+
        map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir);
        if (map == SWIOTLB_MAP_ERROR)
                return DMA_ERROR_CODE;
diff --git a/include/trace/events/swiotlb.h b/include/trace/events/swiotlb.h
new file mode 100644 (file)
index 0000000..7ea4c5e
--- /dev/null
@@ -0,0 +1,46 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM swiotlb
+
+#if !defined(_TRACE_SWIOTLB_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_SWIOTLB_H
+
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(swiotlb_bounced,
+
+       TP_PROTO(struct device *dev,
+                dma_addr_t dev_addr,
+                size_t size,
+                int swiotlb_force),
+
+       TP_ARGS(dev, dev_addr, size, swiotlb_force),
+
+       TP_STRUCT__entry(
+               __string(       dev_name,       dev_name(dev)   )
+               __field(        u64,    dma_mask                )
+               __field(        dma_addr_t,     dev_addr        )
+               __field(        size_t, size                    )
+               __field(        int,    swiotlb_force           )
+       ),
+
+       TP_fast_assign(
+               __assign_str(dev_name, dev_name(dev));
+               __entry->dma_mask = (dev->dma_mask ? *dev->dma_mask : 0);
+               __entry->dev_addr = dev_addr;
+               __entry->size = size;
+               __entry->swiotlb_force = swiotlb_force;
+       ),
+
+       TP_printk("dev_name: %s dma_mask=%llx dev_addr=%llx "
+               "size=%zu %s",
+               __get_str(dev_name),
+               __entry->dma_mask,
+               (unsigned long long)__entry->dev_addr,
+               __entry->size,
+               __entry->swiotlb_force ? "swiotlb_force" : "" )
+);
+
+#endif /*  _TRACE_SWIOTLB_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
index 4e8686c7e5a4085753121337755bf522ccfe6300..f0d841907da662cce80c1f9ac6e1fece6234357d 100644 (file)
@@ -38,6 +38,8 @@
 #include <linux/bootmem.h>
 #include <linux/iommu-helper.h>
 
+#include <trace/events/swiotlb.h>
+
 #define OFFSET(val,align) ((unsigned long)     \
                           ( (val) & ( (align) - 1)))
 
@@ -726,6 +728,8 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
        if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
                return dev_addr;
 
+       trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
+
        /* Oh well, have to allocate and map a bounce buffer. */
        map = map_single(dev, phys, size, dir);
        if (map == SWIOTLB_MAP_ERROR) {