Skip to contentSkip to conversation

Virtual Machine Generation ID

PATCH Superseded Gal Hammer 2 participants 7 messages Nov 16, 2014 – Nov 17, 2014

v8 of 16 Superseded Latest is v16 →

lore
Share & tools
lore

Gal Hammer

author
#0 lore raw

v8 cover Virtual Machine Generation ID

Hi,

The patch grow to three parts now. Although it is still add a QEmu support for Microsoft's Virtual Machine Generation ID device.

The first is a short device's description, then the ACPI tables changes and the actual device and the last patch updates the tests' ACPI tables.

Your comment are welcomed.

Thanks,

Gal.

V8 - Add a device's description file.
- GUID is stored in fw cfg file and the guest writes the physical address to the device (reduces vmexits).

V7 - Move the device's description back to the static SSDT table.
- The GUID is store in a "hard coded" physical address and not in the ACPI table itself.
- ACPI notification is triggered when the GUID is changed.

V6 - include the pre-compiled ASL file
- remove an empty line at end of files.

V5 - Move device's description to SSDT table (dynamic).

V4 - Fix a typo in error message string.
- Move device's description from DSDT back to SSDT table.

V3 - Remove "-uuid" command line parameter.
- Move device's description from SSDT to DSDT table.
- Add new "vmgenid" sysbus device.

Gal Hammer (3):
docs: vm generation id device's description
i386: Add a Virtual Machine Generation ID device
tests: update acpi tables after adding the vmgenid device

 default-configs/i386-softmmu.mak     |   1 +
 default-configs/x86_64-softmmu.mak   |   1 +
 docs/specs/vmgenid.txt               |  27 ++++++++
 hw/acpi/core.c                       |   8 +++
 hw/acpi/ich9.c                       |   8 +++
 hw/acpi/piix4.c                      |   8 +++
 hw/i386/acpi-build.c                 |  26 +++++++
 hw/i386/acpi-dsdt.dsl                |   4 +-
 hw/i386/acpi-dsdt.hex.generated      |   6 +-
 hw/i386/pc.c                         |   8 +++
 hw/i386/q35-acpi-dsdt.dsl            |   5 +-
 hw/i386/q35-acpi-dsdt.hex.generated  |   8 +--
 hw/i386/ssdt-misc.dsl                |  43 ++++++++++++
 hw/i386/ssdt-misc.hex.generated      |   8 +--
 hw/isa/lpc_ich9.c                    |   1 +
 hw/misc/Makefile.objs                |   1 +
 hw/misc/vmgenid.c                    | 131 +++++++++++++++++++++++++++++++++++
 include/hw/acpi/acpi.h               |   2 +
 include/hw/acpi/acpi_dev_interface.h |   4 ++
 include/hw/acpi/ich9.h               |   2 +
 include/hw/i386/pc.h                 |   3 +
 include/hw/misc/vmgenid.h            |  21 ++++++
 tests/acpi-test-data/pc/DSDT         | Bin 2807 -> 2820 bytes
 tests/acpi-test-data/pc/SSDT         | Bin 3065 -> 3268 bytes
 tests/acpi-test-data/q35/DSDT        | Bin 7397 -> 7410 bytes
 tests/acpi-test-data/q35/SSDT        | Bin 1346 -> 1549 bytes
 26 files changed, 313 insertions(+), 13 deletions(-)
 create mode 100644 docs/specs/vmgenid.txt
 create mode 100644 hw/misc/vmgenid.c
 create mode 100644 include/hw/misc/vmgenid.h
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH v8 1/3 docs: vm generation id device's description

---
 docs/specs/vmgenid.txt | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 docs/specs/vmgenid.txt
docs/specs/vmgenid.txt new file +27 -0
new file mode 100644
index 0000000..9a09d11
@@ -0,0 +1,27 @@
+VIRTUAL MACHINE GENERATION ID
+=============================
+
+The VM generation ID (vmgenid) device is an emulated device which
+expose a 128-bit, cryptographically random, integer value identifier.
+This allows management applications (e.g. libvirt) to notify the guest
+operating system when the virtual machine is executed with a different
+configuration (e.g. snapshot execution or creation from a template).
+
+Specs is on the web at: http://go.microsoft.com/fwlink/?LinkId=260709
+
+---
+
+The vmgenid device is a sysbus device with the following ACPI ID:
+"QEMU0002".
+
+The device adds a "vmgenid.uuid" property, which can be modifed using
+the -global command line argument or the QMP interface.
+
+The device uses a fixed memory resource: 0xfedf0000-0xfedf0003. The
+guest is expected to write the physical address of the GUID's buffer
+to that memory resource. This allows the device to modify the GUID if
+requested by the management application.
+
+According to the specification, any change to the GUID executes an
+ACPI notification. The vmgenid device triggers the GPE._E00 which
+executes the ACPI Notify operation.
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH v8 2/3 i386: Add a Virtual Machine Generation ID device

In reply to Gal Hammer

Based on Microsoft's sepecifications (paper can be dowloaded from
http://go.microsoft.com/fwlink/?LinkId=260709), add a device description to the SSDT ACPI table and its implementation.

The GUID is set using a global "vmgenid.uuid" parameter.

---
 default-configs/i386-softmmu.mak     |   1 +
 default-configs/x86_64-softmmu.mak   |   1 +
 hw/acpi/core.c                       |   8 +++
 hw/acpi/ich9.c                       |   8 +++
 hw/acpi/piix4.c                      |   8 +++
 hw/i386/acpi-build.c                 |  26 +++++++
 hw/i386/acpi-dsdt.dsl                |   4 +-
 hw/i386/acpi-dsdt.hex.generated      |   6 +-
 hw/i386/pc.c                         |   8 +++
 hw/i386/q35-acpi-dsdt.dsl            |   5 +-
 hw/i386/q35-acpi-dsdt.hex.generated  |   8 +--
 hw/i386/ssdt-misc.dsl                |  43 ++++++++++++
 hw/i386/ssdt-misc.hex.generated      |   8 +--
 hw/isa/lpc_ich9.c                    |   1 +
 hw/misc/Makefile.objs                |   1 +
 hw/misc/vmgenid.c                    | 131 +++++++++++++++++++++++++++++++++++
 include/hw/acpi/acpi.h               |   2 +
 include/hw/acpi/acpi_dev_interface.h |   4 ++
 include/hw/acpi/ich9.h               |   2 +
 include/hw/i386/pc.h                 |   3 +
 include/hw/misc/vmgenid.h            |  21 ++++++
 21 files changed, 286 insertions(+), 13 deletions(-)
 create mode 100644 hw/misc/vmgenid.c
 create mode 100644 include/hw/misc/vmgenid.h
default-configs/i386-softmmu.mak +1 -0
index 8e08841..bd33c75 100644
@@ -45,3 +45,4 @@ CONFIG_IOAPIC=y
 CONFIG_ICC_BUS=y
 CONFIG_PVPANIC=y
 CONFIG_MEM_HOTPLUG=y
+CONFIG_VMGENID=y
default-configs/x86_64-softmmu.mak +1 -0
index 66557ac..006fc7c 100644
@@ -45,3 +45,4 @@ CONFIG_IOAPIC=y
 CONFIG_ICC_BUS=y
 CONFIG_PVPANIC=y
 CONFIG_MEM_HOTPLUG=y
+CONFIG_VMGENID=y
hw/acpi/core.c +8 -0
index 51913d6..d4597c6 100644
@@ -28,6 +28,8 @@
 #include "qapi-visit.h"
 #include "qapi-event.h"
 
+#define ACPI_VM_GENERATION_ID_CHANGED_STATUS 1
+
 struct acpi_table_header {
     uint16_t _length;         /* our length, not actual part of the hdr */
                               /* allows easier parsing for fw_cfg clients */
@@ -683,3 +685,9 @@ void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
                        (regs->pm1.evt.en & ACPI_BITMASK_TIMER_ENABLE) &&
                        !(pm1a_sts & ACPI_BITMASK_TIMER_STATUS));
 }
+
+void acpi_vm_generation_id_changed(ACPIREGS *acpi_regs, qemu_irq irq)
+{
+    acpi_regs->gpe.sts[0] |= ACPI_VM_GENERATION_ID_CHANGED_STATUS;
+    acpi_update_sci(acpi_regs, irq);
+}
hw/acpi/ich9.c +8 -0
index ea991a3..12a9387 100644
@@ -307,3 +307,11 @@ void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
 
     acpi_memory_ospm_status(&s->pm.acpi_memory_hotplug, list);
 }
+
+void ich9_vm_generation_id_changed(AcpiDeviceIf *adev)
+{
+    ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
+    ICH9LPCPMRegs *pm = &s->pm;
+
+    acpi_vm_generation_id_changed(&pm->acpi_regs, pm->irq);
+}
hw/acpi/piix4.c +8 -0
index 481a16c..41b6eb6 100644
@@ -574,6 +574,13 @@ static void piix4_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
     acpi_memory_ospm_status(&s->acpi_memory_hotplug, list);
 }
 
+static void piix4_vm_generation_id_changed(AcpiDeviceIf *adev)
+{
+    PIIX4PMState *s = PIIX4_PM(adev);
+
+    acpi_vm_generation_id_changed(&s->ar, s->irq);
+}
+
 static Property piix4_pm_properties[] = {
     DEFINE_PROP_UINT32("smb_io_base", PIIX4PMState, smb_io_base, 0),
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S3_DISABLED, PIIX4PMState, disable_s3, 0),
@@ -611,6 +618,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
     hc->plug = piix4_device_plug_cb;
     hc->unplug_request = piix4_device_unplug_request_cb;
     adevc->ospm_status = piix4_ospm_status;
+    adevc->vm_generation_id_changed = piix4_vm_generation_id_changed;
 }
 
 static const TypeInfo piix4_pm_info = {
hw/i386/acpi-build.c +26 -0
index 4003b6b..0cfa598 100644
@@ -250,6 +250,7 @@ static void acpi_get_pci_info(PcPciInfo *info)
 #define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
 #define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
 #define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
+#define ACPI_BUILD_VMGENID_FILE "etc/vm-generation-id"
 
 static void
 build_header(GArray *linker, GArray *table_data,
@@ -1061,6 +1062,8 @@ build_ssdt(GArray *table_data, GArray *linker,
 {
     MachineState *machine = MACHINE(qdev_get_machine());
     uint32_t nr_mem = machine->ram_slots;
+    uint32_t vm_gid_physical_address;
+    uint32_t vm_gid_offset = 0;
     unsigned acpi_cpus = guest_info->apic_id_limit;
     int ssdt_start = table_data->len;
     uint8_t *ssdt_ptr;
@@ -1089,6 +1092,21 @@ build_ssdt(GArray *table_data, GArray *linker,
     ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml),
                       ssdt_isa_pest[0], 16, misc->pvpanic_port);
 
+    if (vm_generation_id_set()) {
+        vm_gid_physical_address = ssdt_start + ssdt_acpi_vm_gid_addr[0];
+        bios_linker_loader_alloc(linker, ACPI_BUILD_VMGENID_FILE, 8, true);
+        bios_linker_loader_add_pointer(linker, ACPI_BUILD_VMGENID_FILE,
+                                       ACPI_BUILD_TABLE_FILE,
+                                       table_data,
+                                       &vm_gid_offset,
+                                       sizeof(vm_gid_offset));
+    } else {
+        vm_gid_physical_address = 0;
+    }
+
+    ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml),
+                      ssdt_acpi_vm_gid_addr[0], 32, vm_gid_physical_address);
+
     ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml),
                       ssdt_mctrl_nr_slots[0], 32, nr_mem);
 
@@ -1488,6 +1506,7 @@ struct AcpiBuildTables {
     GArray *table_data;
     GArray *rsdp;
     GArray *tcpalog;
+    GArray *vmgenid;
     GArray *linker;
 } AcpiBuildTables;
 
@@ -1496,6 +1515,7 @@ static inline void acpi_build_tables_init(AcpiBuildTables *tables)
     tables->rsdp = g_array_new(false, true /* clear */, 1);
     tables->table_data = g_array_new(false, true /* clear */, 1);
     tables->tcpalog = g_array_new(false, true /* clear */, 1);
+    tables->vmgenid = g_array_new(false, true /* clear */, 1);
     tables->linker = bios_linker_loader_init();
 }
 
@@ -1506,6 +1526,7 @@ static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
     g_array_free(tables->rsdp, mfre);
     g_array_free(tables->table_data, true);
     g_array_free(tables->tcpalog, mfre);
+    g_array_free(tables->vmgenid, mfre);
 }
 
 typedef
@@ -1784,6 +1805,11 @@ void acpi_setup(PcGuestInfo *guest_info)
     fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
                     tables.tcpalog->data, acpi_data_len(tables.tcpalog));
 
+    /* Add a 128-bit fw cfg file which stores the VM generation id. */
+    g_array_set_size(tables.vmgenid, 16);
+    fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_VMGENID_FILE,
+                    tables.vmgenid->data, tables.vmgenid->len);
+
     /*
      * RSDP is small so it's easy to keep it immutable, no need to
      * bother with ROM blobs.
hw/i386/acpi-dsdt.dsl +3 -1
index 559f4b6..10b4afb 100644
@@ -307,7 +307,9 @@ DefinitionBlock (
     Scope(\_GPE) {
         Name(_HID, "ACPI0006")
 
-        Method(_L00) {
+        External(\_SB.VMGI, DeviceObj)
+        Method(_E00) {
+            Notify(\_SB.VMGI, 0x80)
         }
         Method(_E01) {
             // PCI hotplug event
hw/i386/acpi-dsdt.hex.generated +3 -3
index a21bf41..3fd06d2 100644
@@ -8,7 +8,7 @@ static unsigned char AcpiDsdtAmlCode[] = {
 0x0,
 0x0,
 0x1,
-0x1f,
+0x18,
 0x42,
 0x58,
 0x50,
@@ -32,8 +32,8 @@ static unsigned char AcpiDsdtAmlCode[] = {
 0x54,
 0x4c,
 0x28,
-0x5,
-0x10,
+0x8,
+0x14,
 0x20,
 0x10,
 0x49,
hw/i386/pc.c +8 -0
index 1205db8..a5d773e 100644
@@ -59,6 +59,7 @@
 #include "hw/pci/pci_host.h"
 #include "acpi-build.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/misc/vmgenid.h"
 #include "trace.h"
 #include "qapi/visitor.h"
 
@@ -1350,6 +1351,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
     int i;
     DriveInfo *fd[MAX_FD];
     DeviceState *hpet = NULL;
+    DeviceState *vmgenid;
     int pit_isa_irq = 0;
     qemu_irq pit_alt_irq = NULL;
     qemu_irq rtc_irq = NULL;
@@ -1448,6 +1450,12 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
         fd[i] = drive_get(IF_FLOPPY, 0, i);
     }
     *floppy = fdctrl_init_isa(isa_bus, fd);
+
+    vmgenid = qdev_try_create(NULL, VMGENID_DEVICE);
+    if (vmgenid) {
+        qdev_init_nofail(vmgenid);
+        sysbus_mmio_map(SYS_BUS_DEVICE(vmgenid), 0, VMGENID_BASE_ADDRESS);
+    }
 }
 
 void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
hw/i386/q35-acpi-dsdt.dsl +4 -1
index 054b035..b1d04e2 100644
@@ -415,7 +415,10 @@ DefinitionBlock (
     Scope(\_GPE) {
         Name(_HID, "ACPI0006")
 
-        Method(_L00) {
+        External(\_SB.VMGI, DeviceObj)
+        Method(_E00)
+        {
+            Notify(\_SB.VMGI, 0x80)
         }
         Method(_L01) {
         }
hw/i386/q35-acpi-dsdt.hex.generated +4 -4
index c9eb4ac..866e648 100644
@@ -8,7 +8,7 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
 0x0,
 0x0,
 0x1,
-0xb7,
+0xac,
 0x42,
 0x58,
 0x50,
@@ -31,9 +31,9 @@ static unsigned char Q35AcpiDsdtAmlCode[] = {
 0x4e,
 0x54,
 0x4c,
-0x15,
-0x11,
-0x13,
+0x28,
+0x8,
+0x14,
 0x20,
 0x10,
 0x49,
hw/i386/ssdt-misc.dsl +43 -0

55 lines not on this page · raw message

hw/i386/ssdt-misc.hex.generated +4 -4
index ba4268a..f0b7a27 100644
@@ -26,7 +26,7 @@ static unsigned char ssdp_misc_aml[] = {
 0x0,
 0x0,
 0x1,
-0x8b,
+0x80,
 0x42,
 0x58,
 0x50,
@@ -49,9 +49,9 @@ static unsigned char ssdp_misc_aml[] = {
 0x4e,
 0x54,
 0x4c,
-0x15,
-0x11,
-0x13,
+0x28,
+0x8,
+0x14,
 0x20,
 0x10,
 0x42,
hw/isa/lpc_ich9.c +1 -0
index 530b074..3a012fa 100644
@@ -678,6 +678,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
     hc->plug = ich9_device_plug_cb;
     hc->unplug_request = ich9_device_unplug_request_cb;
     adevc->ospm_status = ich9_pm_ospm_status;
+    adevc->vm_generation_id_changed = ich9_vm_generation_id_changed;
 }
 
 static const TypeInfo ich9_lpc_info = {
hw/misc/Makefile.objs +1 -0
index 979e532..c18b800 100644
@@ -41,3 +41,4 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+obj-$(CONFIG_VMGENID) += vmgenid.o
hw/misc/vmgenid.c new file +131 -0

131 lines not on this page · raw message

include/hw/acpi/acpi.h +2 -0
index 1f678b4..9373b4d 100644
@@ -185,4 +185,6 @@ unsigned acpi_table_len(void *current);
 void acpi_table_add(const QemuOpts *opts, Error **errp);
 void acpi_table_add_builtin(const QemuOpts *opts, Error **errp);
 
+void acpi_vm_generation_id_changed(ACPIREGS *acpi_regs, qemu_irq irq);
+
 #endif /* !QEMU_HW_ACPI_H */
include/hw/acpi/acpi_dev_interface.h +4 -0
index f245f8d..757ce60 100644
@@ -28,6 +28,9 @@ typedef struct AcpiDeviceIf {
  * ospm_status: returns status of ACPI device objects, reported
  *              via _OST method if device supports it.
  *
+ * vm_generation_id_changed: notify the guest that it generation
+ *                           id was changed.
+ *
  * Interface is designed for providing unified interface
  * to generic ACPI functionality that could be used without
  * knowledge about internals of actual device that implements
@@ -39,5 +42,6 @@ typedef struct AcpiDeviceIfClass {
 
     /* <public> */
     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
+    void (*vm_generation_id_changed)(AcpiDeviceIf *adev);
 } AcpiDeviceIfClass;
 #endif
include/hw/acpi/ich9.h +2 -0
index fe975e6..923e711 100644
@@ -61,4 +61,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp);
 void ich9_pm_device_plug_cb(ICH9LPCPMRegs *pm, DeviceState *dev, Error **errp);
 
 void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
+
+void ich9_vm_generation_id_changed(AcpiDeviceIf *adev);
 #endif /* HW_ACPI_ICH9_H */
include/hw/i386/pc.h +3 -0
index 7c3731f..f6fc55c 100644
@@ -294,6 +294,9 @@ void pc_system_firmware_init(MemoryRegion *rom_memory,
 /* pvpanic.c */
 uint16_t pvpanic_port(void);
 
+/* vmgenid.c */
+bool vm_generation_id_set(void);
+
 /* e820 types */
 #define E820_RAM        1
 #define E820_RESERVED   2
include/hw/misc/vmgenid.h new file +21 -0
new file mode 100644
index 0000000..7b9a2b2
@@ -0,0 +1,21 @@
+/*
+ *  Virtual Machine Generation ID Device
+ *
+ *  Copyright (C) 2014 Red Hat Inc.
+ *
+ *  Authors: Gal Hammer <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef HW_MISC_VMGENID_H
+#define HW_MISC_VMGENID_H
+
+#define VMGENID_DEVICE "vmgenid"
+
+#define VMGENID_BASE_ADDRESS    0xfedf0000
+#define VMGENID_BASE_ADDR_LEN   4
+
+#endif
Signature · 1 line
1.9.3
author
#3 lore raw

PATCH v8 3/3 tests: update acpi tables after adding the vmgenid device

In reply to Gal Hammer
---
 tests/acpi-test-data/pc/DSDT  | Bin 2807 -> 2820 bytes
 tests/acpi-test-data/pc/SSDT  | Bin 3065 -> 3268 bytes
 tests/acpi-test-data/q35/DSDT | Bin 7397 -> 7410 bytes
 tests/acpi-test-data/q35/SSDT | Bin 1346 -> 1549 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/DSDT binary +0 -0
index d37ec34454e6f3db5e91b777f94e03be67a5f583..8c86b1e39454f611ee25ababe0ef429956ba7562 100644
GIT binary patch
tests/acpi-test-data/pc/SSDT binary +0 -0
index eb2d8b698ce6a3a910a05244a3b6cf80bf818fb9..ab75f3f382a16ec4af3a8e73e8ed9cfdab2c4599 100644
GIT binary patch
tests/acpi-test-data/q35/DSDT binary +0 -0
index 2d2bc4adaf54666fe7864e7f39203411b7c308f7..b45f6065ad6140bd987550cc22ff38b09243188f 100644
GIT binary patch
tests/acpi-test-data/q35/SSDT binary +0 -0
index 778b79bf428b5d7602b7b80c9434e38c79718bb2..dffee695109a7d97e1d15994aae4207f47639389 100644
GIT binary patch
Signature · 1 line
1.9.3
#4 lore raw
In reply to Gal Hammer
Quoted 9 lines · Gal Hammer

Hi,

The patch grow to three parts now. Although it is still add a QEmu support for Microsoft's Virtual Machine Generation ID device.

The first is a short device's description, then the ACPI tables changes and the actual device and the last patch updates the tests' ACPI tables.

Quoted 5 lines

Your comment are welcomed.

Thanks,

Gal.

Looks good, but how about a unit test? Should be easy: give device a physical address, read back memory to see that it's been written to.

Quoted 59 lines

V8 - Add a device's description file.
- GUID is stored in fw cfg file and the guest writes the physical address to the device (reduces vmexits).

V7 - Move the device's description back to the static SSDT table.
- The GUID is store in a "hard coded" physical address and not in the ACPI table itself.
- ACPI notification is triggered when the GUID is changed.

V6 - include the pre-compiled ASL file
- remove an empty line at end of files.

V5 - Move device's description to SSDT table (dynamic).

V4 - Fix a typo in error message string.
- Move device's description from DSDT back to SSDT table.

V3 - Remove "-uuid" command line parameter.
- Move device's description from SSDT to DSDT table.
- Add new "vmgenid" sysbus device.

Gal Hammer (3):
docs: vm generation id device's description
i386: Add a Virtual Machine Generation ID device
tests: update acpi tables after adding the vmgenid device

 default-configs/i386-softmmu.mak     |   1 +
 default-configs/x86_64-softmmu.mak   |   1 +
 docs/specs/vmgenid.txt               |  27 ++++++++
 hw/acpi/core.c                       |   8 +++
 hw/acpi/ich9.c                       |   8 +++
 hw/acpi/piix4.c                      |   8 +++
 hw/i386/acpi-build.c                 |  26 +++++++
 hw/i386/acpi-dsdt.dsl                |   4 +-
 hw/i386/acpi-dsdt.hex.generated      |   6 +-
 hw/i386/pc.c                         |   8 +++
 hw/i386/q35-acpi-dsdt.dsl            |   5 +-
 hw/i386/q35-acpi-dsdt.hex.generated  |   8 +--
 hw/i386/ssdt-misc.dsl                |  43 ++++++++++++
 hw/i386/ssdt-misc.hex.generated      |   8 +--
 hw/isa/lpc_ich9.c                    |   1 +
 hw/misc/Makefile.objs                |   1 +
 hw/misc/vmgenid.c                    | 131 +++++++++++++++++++++++++++++++++++
 include/hw/acpi/acpi.h               |   2 +
 include/hw/acpi/acpi_dev_interface.h |   4 ++
 include/hw/acpi/ich9.h               |   2 +
 include/hw/i386/pc.h                 |   3 +
 include/hw/misc/vmgenid.h            |  21 ++++++
 tests/acpi-test-data/pc/DSDT         | Bin 2807 -> 2820 bytes
 tests/acpi-test-data/pc/SSDT         | Bin 3065 -> 3268 bytes
 tests/acpi-test-data/q35/DSDT        | Bin 7397 -> 7410 bytes
 tests/acpi-test-data/q35/SSDT        | Bin 1346 -> 1549 bytes
 26 files changed, 313 insertions(+), 13 deletions(-)
 create mode 100644 docs/specs/vmgenid.txt
 create mode 100644 hw/misc/vmgenid.c
 create mode 100644 include/hw/misc/vmgenid.h
Signature · 1 line
1.9.3
author
#5 lore raw

----- Original Message -----

Quoted 18 lines

From: "Michael S. Tsirkin" <[email protected]>
To: "Gal Hammer" <[email protected]>
Cc: [email protected], [email protected]
Sent: Sunday, November 16, 2014 9:49:37 PM
Subject: Re: [Qemu-devel] [PATCH V8 0/3] Virtual Machine Generation ID

Quoted 11 lines · Gal Hammer

Hi,

The patch grow to three parts now. Although it is still add a QEmu support for Microsoft's Virtual Machine Generation ID device.

The first is a short device's description, then the ACPI tables changes and the actual device and the last patch updates the tests' ACPI tables.

Your comment are welcomed.

Quoted 7 lines
Quoted 3 lines

Thanks,

Gal.

Looks good, but how about a unit test? Should be easy: give device a physical address, read back memory to see that it's been written to.

I thought it would make sense to add the tests only after the patch is accepted and the device's implementation is final.

Quoted 65 lines
Quoted 63 lines

V8 - Add a device's description file.
- GUID is stored in fw cfg file and the guest writes the physical address to the device (reduces vmexits).

V7 - Move the device's description back to the static SSDT table.
- The GUID is store in a "hard coded" physical address and not in the ACPI table itself.
- ACPI notification is triggered when the GUID is changed.

V6 - include the pre-compiled ASL file
- remove an empty line at end of files.

V5 - Move device's description to SSDT table (dynamic).

V4 - Fix a typo in error message string.
- Move device's description from DSDT back to SSDT table.

V3 - Remove "-uuid" command line parameter.
- Move device's description from SSDT to DSDT table.
- Add new "vmgenid" sysbus device.

Gal Hammer (3):
docs: vm generation id device's description
i386: Add a Virtual Machine Generation ID device
tests: update acpi tables after adding the vmgenid device

 default-configs/i386-softmmu.mak     |   1 +
 default-configs/x86_64-softmmu.mak   |   1 +
 docs/specs/vmgenid.txt               |  27 ++++++++
 hw/acpi/core.c                       |   8 +++
 hw/acpi/ich9.c                       |   8 +++
 hw/acpi/piix4.c                      |   8 +++
 hw/i386/acpi-build.c                 |  26 +++++++
 hw/i386/acpi-dsdt.dsl                |   4 +-
 hw/i386/acpi-dsdt.hex.generated      |   6 +-
 hw/i386/pc.c                         |   8 +++
 hw/i386/q35-acpi-dsdt.dsl            |   5 +-
 hw/i386/q35-acpi-dsdt.hex.generated  |   8 +--
 hw/i386/ssdt-misc.dsl                |  43 ++++++++++++
 hw/i386/ssdt-misc.hex.generated      |   8 +--
 hw/isa/lpc_ich9.c                    |   1 +
 hw/misc/Makefile.objs                |   1 +
 hw/misc/vmgenid.c                    | 131
 +++++++++++++++++++++++++++++++++++
 include/hw/acpi/acpi.h               |   2 +
 include/hw/acpi/acpi_dev_interface.h |   4 ++
 include/hw/acpi/ich9.h               |   2 +
 include/hw/i386/pc.h                 |   3 +
 include/hw/misc/vmgenid.h            |  21 ++++++
 tests/acpi-test-data/pc/DSDT         | Bin 2807 -> 2820 bytes
 tests/acpi-test-data/pc/SSDT         | Bin 3065 -> 3268 bytes
 tests/acpi-test-data/q35/DSDT        | Bin 7397 -> 7410 bytes
 tests/acpi-test-data/q35/SSDT        | Bin 1346 -> 1549 bytes
 26 files changed, 313 insertions(+), 13 deletions(-)
 create mode 100644 docs/specs/vmgenid.txt
 create mode 100644 hw/misc/vmgenid.c
 create mode 100644 include/hw/misc/vmgenid.h

--
1.9.3

#6 lore raw
Quoted 23 lines · Gal Hammer

----- Original Message -----

Quoted 20 lines

From: "Michael S. Tsirkin" <[email protected]>
To: "Gal Hammer" <[email protected]>
Cc: [email protected], [email protected]
Sent: Sunday, November 16, 2014 9:49:37 PM
Subject: Re: [Qemu-devel] [PATCH V8 0/3] Virtual Machine Generation ID

Quoted 13 lines · Gal Hammer

Hi,

The patch grow to three parts now. Although it is still add a QEmu support for Microsoft's Virtual Machine Generation ID device.

The first is a short device's description, then the ACPI tables changes and the actual device and the last patch updates the tests' ACPI tables.

Your comment are welcomed.

Thanks,

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Gal.

Looks good, but how about a unit test? Should be easy: give device a physical address, read back memory to see that it's been written to.

I thought it would make sense to add the tests only after the patch is accepted and the device's implementation is final.

OK so please add this as TODO in the cover letter, so we remember to address this before merging. We can't merge new functionality before 2.2 is out, so there's still time.

Quoted 65 lines
Quoted 65 lines
Quoted 63 lines

V8 - Add a device's description file.
- GUID is stored in fw cfg file and the guest writes the physical address to the device (reduces vmexits).

V7 - Move the device's description back to the static SSDT table.
- The GUID is store in a "hard coded" physical address and not in the ACPI table itself.
- ACPI notification is triggered when the GUID is changed.

V6 - include the pre-compiled ASL file
- remove an empty line at end of files.

V5 - Move device's description to SSDT table (dynamic).

V4 - Fix a typo in error message string.
- Move device's description from DSDT back to SSDT table.

V3 - Remove "-uuid" command line parameter.
- Move device's description from SSDT to DSDT table.
- Add new "vmgenid" sysbus device.

Gal Hammer (3):
docs: vm generation id device's description
i386: Add a Virtual Machine Generation ID device
tests: update acpi tables after adding the vmgenid device

 default-configs/i386-softmmu.mak     |   1 +
 default-configs/x86_64-softmmu.mak   |   1 +
 docs/specs/vmgenid.txt               |  27 ++++++++
 hw/acpi/core.c                       |   8 +++
 hw/acpi/ich9.c                       |   8 +++
 hw/acpi/piix4.c                      |   8 +++
 hw/i386/acpi-build.c                 |  26 +++++++
 hw/i386/acpi-dsdt.dsl                |   4 +-
 hw/i386/acpi-dsdt.hex.generated      |   6 +-
 hw/i386/pc.c                         |   8 +++
 hw/i386/q35-acpi-dsdt.dsl            |   5 +-
 hw/i386/q35-acpi-dsdt.hex.generated  |   8 +--
 hw/i386/ssdt-misc.dsl                |  43 ++++++++++++
 hw/i386/ssdt-misc.hex.generated      |   8 +--
 hw/isa/lpc_ich9.c                    |   1 +
 hw/misc/Makefile.objs                |   1 +
 hw/misc/vmgenid.c                    | 131
 +++++++++++++++++++++++++++++++++++
 include/hw/acpi/acpi.h               |   2 +
 include/hw/acpi/acpi_dev_interface.h |   4 ++
 include/hw/acpi/ich9.h               |   2 +
 include/hw/i386/pc.h                 |   3 +
 include/hw/misc/vmgenid.h            |  21 ++++++
 tests/acpi-test-data/pc/DSDT         | Bin 2807 -> 2820 bytes
 tests/acpi-test-data/pc/SSDT         | Bin 3065 -> 3268 bytes
 tests/acpi-test-data/q35/DSDT        | Bin 7397 -> 7410 bytes
 tests/acpi-test-data/q35/SSDT        | Bin 1346 -> 1549 bytes
 26 files changed, 313 insertions(+), 13 deletions(-)
 create mode 100644 docs/specs/vmgenid.txt
 create mode 100644 hw/misc/vmgenid.c
 create mode 100644 include/hw/misc/vmgenid.h

--
1.9.3