diff mbox

[v19,9/9] pc/q53: by default put vmgenid device as an function of ISA bridge

Message ID 1453978470-222624-9-git-send-email-imammedo@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Igor Mammedov Jan. 28, 2016, 10:54 a.m. UTC
it will save a PCI slot that would be used otherwise.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/pc_piix.c      | 10 ++++++++++
 hw/i386/pc_q35.c       |  9 +++++++++
 include/hw/i386/ich9.h |  3 ++-
 include/hw/i386/pc.h   |  1 +
 4 files changed, 22 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 2ea3d84..e51e885 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -54,6 +54,7 @@ 
 #endif
 #include "migration/migration.h"
 #include "kvm_i386.h"
+#include "hw/misc/vmgenid.h"
 
 #define MAX_IDE_BUS 2
 
@@ -412,8 +413,17 @@  static void pc_xen_hvm_init(MachineState *machine)
     } \
     DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
 
+#define DEFAULT_PC_PROPS \
+    { \
+        .driver   = VMGENID_DEVICE, \
+        .property = "addr", \
+        .value    = stringify(PIIX3_PCI_SLOT) "."  \
+                    stringify(PIIX3_VMGENID_FUNC), \
+    }, \
+
 static void pc_i440fx_machine_options(MachineClass *m)
 {
+    SET_MACHINE_COMPAT(m, DEFAULT_PC_PROPS);
     m->family = "pc_piix";
     m->desc = "Standard PC (i440FX + PIIX, 1996)";
     m->hot_add_cpu = pc_hot_add_cpu;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 6128b02..8c8d4ab 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -45,6 +45,7 @@ 
 #include "hw/usb.h"
 #include "qemu/error-report.h"
 #include "migration/migration.h"
+#include "hw/misc/vmgenid.h"
 
 /* ICH9 AHCI has 6 ports */
 #define MAX_SATA_PORTS     6
@@ -335,9 +336,17 @@  static void pc_compat_1_4(MachineState *machine)
     } \
     DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
 
+#define DEFAULT_Q35_PROPS \
+    { \
+        .driver   = VMGENID_DEVICE, \
+        .property = "addr",         \
+        .value    = stringify(ICH9_LPC_DEV) "."       \
+                    stringify(ICH9_LPC_VMGENID_FUNC), \
+    }, \
 
 static void pc_q35_machine_options(MachineClass *m)
 {
+    SET_MACHINE_COMPAT(m, DEFAULT_Q35_PROPS);
     m->family = "pc_q35";
     m->desc = "Standard PC (Q35 + ICH9, 2009)";
     m->hot_add_cpu = pc_hot_add_cpu;
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index b9d2b04..271b0c7 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -129,8 +129,9 @@  Object *ich9_lpc_find(void);
 #define ICH9_A2_LPC                             "ICH9 A2 LPC"
 #define ICH9_A2_LPC_SAVEVM_VERSION              0
 
-#define ICH9_LPC_DEV                            31
+#define ICH9_LPC_DEV                            0x1f
 #define ICH9_LPC_FUNC                           0
+#define ICH9_LPC_VMGENID_FUNC                   6
 
 #define ICH9_A2_LPC_REVISION                    0x2
 #define ICH9_LPC_NB_PIRQS                       8       /* PCI A-H */
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 69ed687..af3a74a 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -296,6 +296,7 @@  typedef struct PCII440FXState PCII440FXState;
 #define PIIX3_IDE_FUNC                       1
 #define PIIX3_USB_FUNC                       2
 #define PIIX3_PIIX4_PM_FUNC                  3
+#define PIIX3_VMGENID_FUNC                   7
 
 PCIBus *i440fx_init(const char *host_type, const char *pci_type,
                     PCII440FXState **pi440fx_state,