From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1FB-0000IT-ES for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:18:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF1F9-00047L-Mq for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:18:01 -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 1TF1F9-0003rI-G5 for qemu-devel@nongnu.org; Fri, 21 Sep 2012 07:17:59 -0400 Received: by mail-bk0-f45.google.com with SMTP id jg9so1317042bkc.4 for ; Fri, 21 Sep 2012 04:17:59 -0700 (PDT) From: Vasilis Liaskovitis Date: Fri, 21 Sep 2012 13:17:34 +0200 Message-Id: <1348226255-4226-19-git-send-email-vasilis.liaskovitis@profitbricks.com> In-Reply-To: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1348226255-4226-1-git-send-email-vasilis.liaskovitis@profitbricks.com> Subject: [Qemu-devel] [RFC PATCH v3 18/19] Implement _PS3 for dimm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org 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 This will allow us to update dimm state on OSPM-initiated eject operations e.g. with "echo 1 > /sys/bus/acpi/devices/PNP0C80\:00/eject" Signed-off-by: Vasilis Liaskovitis --- docs/specs/acpi_hotplug.txt | 7 +++++++ hw/acpi_piix4.c | 5 +++++ hw/dimm.c | 3 +++ hw/dimm.h | 3 ++- 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/docs/specs/acpi_hotplug.txt b/docs/specs/acpi_hotplug.txt index 536da16..69868fe 100644 --- a/docs/specs/acpi_hotplug.txt +++ b/docs/specs/acpi_hotplug.txt @@ -45,3 +45,10 @@ insertion failed. Written by ACPI memory device _OST method to notify qemu of failed hot-add. Write-only. +Memory Dimm _PS3 power-off initiated by OSPM (IO port 0xafa4, 1-byte access): +--------------------------------------------------------------- +Dimm hot-add _PS3 initiated by OSPM. Byte value indicates Dimm slot which +entered D3 state. + +Written by ACPI memory device _PS3 method to notify qemu of power-off state for +the dimm. Write-only. diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 8bf58a6..aad78ca 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -52,6 +52,7 @@ #define MEM_OST_REMOVE_FAIL 0xafa1 #define MEM_OST_ADD_SUCCESS 0xafa2 #define MEM_OST_ADD_FAIL 0xafa3 +#define MEM_PS3 0xafa4 #define PIIX4_MEM_HOTPLUG_STATUS 8 #define PIIX4_PCI_HOTPLUG_STATUS 2 @@ -545,6 +546,9 @@ static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val) case MEM_OST_ADD_FAIL: dimm_notify(val, DIMM_ADD_FAIL); break; + case MEM_PS3: + dimm_notify(val, DIMM_OSPM_POWEROFF); + break; default: acpi_gpe_ioport_writeb(&s->ar, addr, val); } @@ -621,6 +625,7 @@ static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s) register_ioport_write(MEM_OST_REMOVE_FAIL, 1, 1, gpe_writeb, s); register_ioport_write(MEM_OST_ADD_SUCCESS, 1, 1, gpe_writeb, s); register_ioport_write(MEM_OST_ADD_FAIL, 1, 1, gpe_writeb, s); + register_ioport_write(MEM_PS3, 1, 1, gpe_writeb, s); for(i = 0; i < DIMM_BITMAP_BYTES; i++) { s->gperegs.mems_sts[i] = 0; diff --git a/hw/dimm.c b/hw/dimm.c index b993668..08f66d5 100644 --- a/hw/dimm.c +++ b/hw/dimm.c @@ -319,6 +319,9 @@ void dimm_notify(uint32_t idx, uint32_t event) qdev_simple_unplug_cb((DeviceState*)s); QTAILQ_INSERT_TAIL(&bus->dimm_hp_result_queue, result, next); break; + case DIMM_OSPM_POWEROFF: + if (bus->dimm_revert) + bus->dimm_revert(bus->dimm_hotplug_qdev, s, 1); default: g_free(result); break; diff --git a/hw/dimm.h b/hw/dimm.h index ce091fe..8d73b8f 100644 --- a/hw/dimm.h +++ b/hw/dimm.h @@ -15,7 +15,8 @@ typedef enum { DIMM_REMOVE_SUCCESS = 0, DIMM_REMOVE_FAIL = 1, DIMM_ADD_SUCCESS = 2, - DIMM_ADD_FAIL = 3 + DIMM_ADD_FAIL = 3, + DIMM_OSPM_POWEROFF = 4 } dimm_hp_result_code; typedef enum { -- 1.7.9