From c1565b1a48db60bb86d83ec00c86b6ddfaf12d62 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 2 Sep 2013 13:26:16 +0200
Subject: [PATCH 10/29] rhel6 compat: usb serial numbers

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1378128376-25930-3-git-send-email-kraxel@redhat.com>
Patchwork-id: 53987
O-Subject: [RHEL-7 qemu-kvm PATCH 2/2] rhel6 compat: usb serial numbers
Bugzilla: 953304
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Add serial number compat properties to the rhel6 machine types,
to match rhel6 behavior.  Two things we have to watch out here:

First the HID devices flipped serial from "1" to "42" to indicate
remote wakeup capability, in RHEL-6.2.

rhel6 commit 85ae0a096fdbc4a6f5a660bf60a74c092f9c0f7a

Second devices get unique serial numbers, by appending host adapter
pci address and port path, in RHEL-6.4, for usb-hub and usb-storage.
Also usb-net + usb-serial + usb-wacom, but those are disabled in RHEL.

rhel6 commit e91156bc452250291f72b82b43654540be7101be

usb-ccid has a unique serial in RHEL-7 but not in RHEL-6, so we need
a compat property for all RHEL-6.x machine types.

bugzilla: 953304

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/pc_piix.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/i386/pc_piix.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index da7701c..a19f155 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -860,6 +860,10 @@ static QEMUMachine pc_machine_rhel700 = {
         .driver = "486-" TYPE_X86_CPU,\
         .property = "level",\
         .value = stringify(0),\
+    },{\
+        .driver   = "usb-ccid",\
+        .property = "serial",\
+        .value    = "1",\
     }
 
 static void pc_init_rhel650(QEMUMachineInitArgs *args)
@@ -959,6 +963,14 @@ static QEMUMachine pc_machine_rhel640 = {
         .driver = TYPE_X86_CPU,\
         .property = "pmu",\
         .value = "on",\
+    },{\
+        .driver   = "usb-hub",\
+        .property = "serial",\
+        .value    = "314159",\
+    },{\
+        .driver   = "usb-storage",\
+        .property = "serial",\
+        .value    = "1",\
     }
 
 static void pc_init_rhel630(QEMUMachineInitArgs *args)
@@ -1041,6 +1053,18 @@ static QEMUMachine pc_machine_rhel620 = {
         .driver   = "virtio-balloon-pci",\
         .property = "event_idx",\
         .value    = "off",\
+    },{\
+        .driver   = "usb-kbd",\
+        .property = "serial",\
+        .value    = "1",\
+    },{\
+        .driver   = "usb-mouse",\
+        .property = "serial",\
+        .value    = "1",\
+    },{\
+        .driver   = "usb-tablet",\
+        .property = "serial",\
+        .value    = "1",\
     }
 
 static void pc_init_rhel610(QEMUMachineInitArgs *args)
-- 
1.7.1