[RFC PATCH v2 16/21] acpi_piix4: Update dimm state on VM reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in case of hot-remove or hot-add failure, the dimm bitmaps in qemu and Seabios
are inconsistent with the true state of the DIMM devices. The "populated" field
of the DimmState reflects the true state of the device. This inconsistency means
that a failed operation cannot be retried.

Ths patch updates the bit array to the true state of the dimms on VM reboot.
This allows retry of failed hot-add or hot-remove operations after a reboot.

Retrying a failed hot operation is not yet possible before reboot (the following
patch removes this limitation for guests with _OST acpi support)

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@xxxxxxxxxxxxxxxx>
---
 hw/acpi_piix4.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index d8e2c22..ebc5de7 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -91,6 +91,7 @@ typedef struct PIIX4PMState {
 } PIIX4PMState;
 
 static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s);
+static void piix4_dimm_state_sync(PIIX4PMState *s);
 
 #define ACPI_ENABLE 0xf1
 #define ACPI_DISABLE 0xf0
@@ -369,6 +370,7 @@ static void piix4_reset(void *opaque)
         /* Mark SMM as already inited (until KVM supports SMM). */
         pci_conf[0x5B] = 0x02;
     }
+    piix4_dimm_state_sync(s);
     piix4_update_hotplug(s);
 }
 
@@ -671,6 +673,29 @@ static int piix4_dimm_hotplug(DeviceState *qdev, SysBusDevice *dev, int
     return 0;
 }
 
+void piix4_dimm_state_sync(PIIX4PMState *s)
+{
+    struct gpe_regs *g = &s->gperegs;
+    DimmState *slot = NULL;
+    uint32_t i, temp = 1;
+
+    for(i = 0; i < MAX_DIMMS; i++) {
+        slot = dimm_find_from_idx(i);
+        if (!slot)
+            break;
+        if (i % 8 == 0) {
+            temp = 1;
+            g->mems_sts[i / 8] = 0;
+        }
+        else
+            temp = temp << 1;
+        if (slot->populated) {
+            g->mems_sts[i / 8] |= temp;
+        }
+        slot->pending = false;
+    }
+}
+
 static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,
 				PCIHotplugState state)
 {
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux