From patchwork Fri Sep 21 11:17:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 185700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6C2352C0088 for ; Fri, 21 Sep 2012 21:21:11 +1000 (EST) Received: from localhost ([::1]:58185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1ID-0006g0-FY for incoming@patchwork.ozlabs.org; Fri, 21 Sep 2012 07:21:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1FH-0000aM-7U for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:18:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF1F7-000446-E0 for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:18:07 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:58755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1F7-0003rI-85 for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:57 -0400 Received: by mail-bk0-f45.google.com with SMTP id jg9so1317042bkc.4 for ; Fri, 21 Sep 2012 04:17:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=D6XLI0isIIOJ0Aryz8gq8dxntLzeGK9haPynCJgA2fo=; b=BXCpOWFo8ScYv77+9IC1oO+ZUvp/OXUVVWyCnsihiIc6Ihj4bQ3iQ5rk9gAN1sB0ft lvl1T6ysLy9VNJBl5B55gwTfoa3LyFt6tyNameCx4wRLcyu9R5ppqVK4bdyBDMFAdGAN htUW6c8WkyKQnxwb+8vMThk5dgQ8o7IVJ9MRRdApJwBFmbIbJY9JswhoXBjxEJp4JrEz FhOCHEWs7m5mxufRIDZvlSj6SL1CAWQSwxa+5cmxqqhLYTacquOWxl85/uksXdJeMoV4 30y7+DzQb9aQLJj7arzZ4nGZF7vvr6lNTk4EoxFnntOBqH79jRM9hY+b5sbYCyWNXstK NfNQ== Received: by 10.204.4.129 with SMTP id 1mr2044807bkr.58.1348226276664; Fri, 21 Sep 2012 04:17:56 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id x13sm5271435bkv.16.2012.09.21.04.17.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:17:56 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Date: Fri, 21 Sep 2012 13:17:32 +0200 Message-Id: <1348226255-4226-17-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQkiW8DT1Y3VaxqzoE09CMwVH6FkPl4M9WkP3gZW8VnmbZrJxb5+eSm1aVykFF66iLLTztLT X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.45 Cc: Vasilis Liaskovitis , gleb@redhat.com, blauwirbel@gmail.com, kevin@koconnor.net, avi@redhat.com, anthony@codemonkey.ws, imammedo@redhat.com, eblake@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [RFC PATCH v3 16/19] Update dimm state on reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org in case of hot-remove failure on a guest that does not implement _OST, the dimm bitmaps in qemu and Seabios show the dimm as unplugged, but the dimm is still present on the qdev/memory bus. To avoid this inconsistency, we set the dimm state to active/hot-plugged on a reset of the associated acpi_pm device. This way the dimm is still active after a VM reboot and dimm visibility has always the same behaviour, regardless of _OST support in the guest. Signed-off-by: Vasilis Liaskovitis --- hw/acpi_piix4.c | 1 + hw/dimm.c | 20 ++++++++++++++++++++ hw/dimm.h | 1 + 3 files changed, 22 insertions(+), 0 deletions(-) diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index f7220d4..8bf58a6 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -373,6 +373,7 @@ static void piix4_reset(void *opaque) pci_conf[0x5B] = 0x02; } piix4_update_hotplug(s); + dimm_state_sync(); } static void piix4_powerdown(void *opaque, int irq, int power_failing) diff --git a/hw/dimm.c b/hw/dimm.c index 1521462..b993668 100644 --- a/hw/dimm.c +++ b/hw/dimm.c @@ -182,6 +182,26 @@ static DimmDevice *dimm_find_from_idx(uint32_t idx) return NULL; } +void dimm_state_sync(void) +{ + DimmBus *bus = main_memory_bus; + DimmDevice *slot; + + /* if a hot-remove operation is pending on reset, it means the hot-remove + * operation has failed, but the guest hasn't notified us e.g. because the + * guest does not provide _OST notifications. The device is still present on + * the dimmbus, but the qemu and Seabios dimm bitmaps show this device as + * unplugged. To avoid this inconsistency, we set the dimm bits to active + * i.e. hot-plugged for each dimm present on the dimmbus. + */ + QTAILQ_FOREACH(slot, &bus->dimmlist, nextdimm) { + if (slot->pending == DIMM_REMOVE_PENDING) { + if (bus->dimm_revert) + bus->dimm_revert(bus->dimm_hotplug_qdev, slot, 0); + } + } +} + /* used to create a dimm device, only on incoming migration of a hotplugged * RAMBlock */ diff --git a/hw/dimm.h b/hw/dimm.h index a6c6e6f..ce091fe 100644 --- a/hw/dimm.h +++ b/hw/dimm.h @@ -95,5 +95,6 @@ void main_memory_bus_create(Object *parent); void dimm_config_create(char *id, uint64_t size, uint64_t node, uint32_t dimm_idx, uint32_t populated); uint64_t get_hp_memory_total(void); +void dimm_state_sync(void); #endif