9ae3a8
From 2f16dbb9130d90415c9db17ac8d28a196515b109 Mon Sep 17 00:00:00 2001
9ae3a8
From: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Date: Tue, 5 Nov 2013 15:37:40 +0100
9ae3a8
Subject: [PATCH 15/25] vfio-pci: Cleanup error_reports
9ae3a8
9ae3a8
RH-Author: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Message-id: <20131105153740.16057.95138.stgit@bling.home>
9ae3a8
Patchwork-id: 55424
9ae3a8
O-Subject: [RHEL7 qemu-kvm PATCH 3/5] vfio-pci: Cleanup error_reports
9ae3a8
Bugzilla: 1026550
9ae3a8
RH-Acked-by: Bandan Das <bsd@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 1026550
9ae3a8
Upstream commit: 8fbf47c3a8a7f37a11268a07290d20a325ba4cb6
9ae3a8
9ae3a8
Remove carriage returns and tweak formatting for error_reports.
9ae3a8
9ae3a8
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
---
9ae3a8
 hw/misc/vfio.c |   24 ++++++++++++------------
9ae3a8
 1 file changed, 12 insertions(+), 12 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/misc/vfio.c |   24 ++++++++++++------------
9ae3a8
 1 files changed, 12 insertions(+), 12 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
9ae3a8
index 8d84891..e336021 100644
9ae3a8
--- a/hw/misc/vfio.c
9ae3a8
+++ b/hw/misc/vfio.c
9ae3a8
@@ -3050,13 +3050,15 @@ static int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vdev)
9ae3a8
     ret = ioctl(vdev->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info);
9ae3a8
     if (ret) {
9ae3a8
         /* This can fail for an old kernel or legacy PCI dev */
9ae3a8
-        DPRINTF("VFIO_DEVICE_GET_IRQ_INFO failure ret=%d\n", ret);
9ae3a8
+        DPRINTF("VFIO_DEVICE_GET_IRQ_INFO failure: %m\n");
9ae3a8
         ret = 0;
9ae3a8
     } else if (irq_info.count == 1) {
9ae3a8
         vdev->pci_aer = true;
9ae3a8
     } else {
9ae3a8
-        error_report("vfio: Warning: "
9ae3a8
-                     "Could not enable error recovery for the device\n");
9ae3a8
+        error_report("vfio: %04x:%02x:%02x.%x "
9ae3a8
+                     "Could not enable error recovery for the device",
9ae3a8
+                     vdev->host.domain, vdev->host.bus, vdev->host.slot,
9ae3a8
+                     vdev->host.function);
9ae3a8
     }
9ae3a8
 
9ae3a8
 error:
9ae3a8
@@ -3097,11 +3099,10 @@ static void vfio_err_notifier_handler(void *opaque)
9ae3a8
      * guest to contain the error.
9ae3a8
      */
9ae3a8
 
9ae3a8
-    error_report("%s (%04x:%02x:%02x.%x)"
9ae3a8
-        "Unrecoverable error detected...\n"
9ae3a8
-        "Please collect any data possible and then kill the guest",
9ae3a8
-        __func__, vdev->host.domain, vdev->host.bus,
9ae3a8
-        vdev->host.slot, vdev->host.function);
9ae3a8
+    error_report("%s(%04x:%02x:%02x.%x) Unrecoverable error detected.  "
9ae3a8
+                 "Please collect any data possible and then kill the guest",
9ae3a8
+                 __func__, vdev->host.domain, vdev->host.bus,
9ae3a8
+                 vdev->host.slot, vdev->host.function);
9ae3a8
 
9ae3a8
     vm_stop(RUN_STATE_IO_ERROR);
9ae3a8
 }
9ae3a8
@@ -3124,8 +3125,7 @@ static void vfio_register_err_notifier(VFIODevice *vdev)
9ae3a8
     }
9ae3a8
 
9ae3a8
     if (event_notifier_init(&vdev->err_notifier, 0)) {
9ae3a8
-        error_report("vfio: Warning: "
9ae3a8
-                     "Unable to init event notifier for error detection\n");
9ae3a8
+        error_report("vfio: Unable to init event notifier for error detection");
9ae3a8
         vdev->pci_aer = false;
9ae3a8
         return;
9ae3a8
     }
9ae3a8
@@ -3146,7 +3146,7 @@ static void vfio_register_err_notifier(VFIODevice *vdev)
9ae3a8
 
9ae3a8
     ret = ioctl(vdev->fd, VFIO_DEVICE_SET_IRQS, irq_set);
9ae3a8
     if (ret) {
9ae3a8
-        error_report("vfio: Failed to set up error notification\n");
9ae3a8
+        error_report("vfio: Failed to set up error notification");
9ae3a8
         qemu_set_fd_handler(*pfd, NULL, NULL, vdev);
9ae3a8
         event_notifier_cleanup(&vdev->err_notifier);
9ae3a8
         vdev->pci_aer = false;
9ae3a8
@@ -3179,7 +3179,7 @@ static void vfio_unregister_err_notifier(VFIODevice *vdev)
9ae3a8
 
9ae3a8
     ret = ioctl(vdev->fd, VFIO_DEVICE_SET_IRQS, irq_set);
9ae3a8
     if (ret) {
9ae3a8
-        error_report("vfio: Failed to de-assign error fd: %d\n", ret);
9ae3a8
+        error_report("vfio: Failed to de-assign error fd: %m");
9ae3a8
     }
9ae3a8
     g_free(irq_set);
9ae3a8
     qemu_set_fd_handler(event_notifier_get_fd(&vdev->err_notifier),
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8