From patchwork Fri Sep 21 11:17:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 185707 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 433502C007C for ; Fri, 21 Sep 2012 21:44:20 +1000 (EST) Received: from localhost ([::1]:54375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF1HN-0004aW-J0 for incoming@patchwork.ozlabs.org; Fri, 21 Sep 2012 07:20:17 -0400 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) 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=d6CX9QyIU6Wh9IuEQMRDUWOYsXdr0kjjsxgmNNc0pPc=; b=l8BfYPP69Q4DowEo0R0SHLEzwuJvbPBtPFuyLqzVnoRKtPkGbPaUK/jedglk7ksTW/ 96rp9gIRGNHiRPBM+cKch2z+V9hJaTPBafVhWBQlrR/T+R3DowyBeJxdM1vdFoOlKZTW f32dKYm1AHnBGcteZTkjSFNj51vsdEkK3Kr4PI1Sx7bEXZu92dRWIhfZM00l4jSQiYMq wb/oZMRfvuHMo1LQkp2I7aimnS3DDoYvBY7+uZY80+l2vbhwjMtYUh5SJVoArNK4o3Rr 4lmlHrkVLDgQFn2RleUQAjaMNywhFWjR8hduecJwdDA0l/VaYE3dwaW63NQLNoa+sivK 8/2g== Received: by 10.204.8.17 with SMTP id f17mr2063901bkf.15.1348226278838; Fri, 21 Sep 2012 04:17:58 -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.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Sep 2012 04:17:58 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Date: Fri, 21 Sep 2012 13:17:34 +0200 Message-Id: <1348226255-4226-19-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: ALoCoQnbnGkaHZZ/PgrIERoazPOuA64UwudUaedlypEXaYP7oOt7VheMWrLIbZxK5iVF/SHt3fhU 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 18/19] Implement _PS3 for dimm 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 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 {