1diff --git a/hw/device-assignment.c b/hw/device-assignment.c
2index 4af9ff6..aae2d8a 100644
3--- a/hw/device-assignment.c
4+++ b/hw/device-assignment.c
5@@ -25,8 +25,10 @@
6  *  Copyright (C) 2008, Red Hat, Amit Shah (amit.shah@redhat.com)
7  *  Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com)
8  */
9+
10 #include <stdio.h>
11 #include <unistd.h>
12+#include <time.h>
13 #include <sys/io.h>
14 #include <sys/types.h>
15 #include <sys/stat.h>
16@@ -50,9 +52,15 @@
17 #define DEVICE_ASSIGNMENT_DEBUG 1
18
19 #ifdef DEVICE_ASSIGNMENT_DEBUG
20-#define DEBUG(fmt, ...)                                       \
21-    do {                                                      \
22-      fprintf(stderr, "%s: " fmt, __func__ , __VA_ARGS__);    \
23+static FILE *debugfp = NULL;
24+
25+#define DEBUG(fmt, ...)                                                 \
26+    do {                                                                \
27+      if (!debugfp)							\
28+		debugfp = fopen("/var/log/qemu_hw_pci.log", "a+");	\
29+      if (debugfp)						        \
30+	      fprintf(debugfp, "%ld %s: " fmt, (long)time(NULL),	\
31+		      __func__ , __VA_ARGS__);				\
32     } while (0)
33 #else
34 #define DEBUG(fmt, ...) do { } while(0)
35@@ -560,6 +568,10 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
36                 ? PCI_BASE_ADDRESS_MEM_PREFETCH
37                 : PCI_BASE_ADDRESS_SPACE_MEMORY;
38
39+#ifdef DEVICE_ASSIGNMENT_DEBUG
40+	    slow_map = 1;
41+#endif
42+
43             if (cur_region->size & 0xFFF) {
44 #if 0
45                 fprintf(stderr, "PCI region %d at address 0x%llx "
46@@ -1453,6 +1465,9 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
47         if (assigned_dev_register_msix_mmio(dev))
48             goto assigned_out;
49
50+    DEBUG("Assigned device 0000:%02x:%02x.%01x/rom",
51+          dev->host.bus, dev->host.dev, dev->host.func);
52+
53     assigned_dev_load_option_rom(dev);
54     QLIST_INSERT_HEAD(&devs, dev, next);
55     return 0;
56