From: Tang Chen <tangchen@cn.fujitsu.com>
To: qemu-devel@nongnu.org, imammedo@redhat.com, mst@redhat.com,
pbonzini@redhat.com
Cc: hutao@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
zhugh.fnst@cn.fujitsu.com, tangchen@cn.fujitsu.com
Subject: [Qemu-devel] [RFC PATCH v1 2/4] Add event handling for memory device insertion.
Date: Wed, 27 Aug 2014 16:09:46 +0800 [thread overview]
Message-ID: <1409126988-22287-3-git-send-email-tangchen@cn.fujitsu.com> (raw)
In-Reply-To: <1409126988-22287-1-git-send-email-tangchen@cn.fujitsu.com>
Define device insertion OST event and status, and add a function to
handle memory insertion.
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
---
hw/acpi/memory_hotplug.c | 18 ++++++++++++++++++
include/hw/acpi/acpi.h | 10 +++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 1b21191..fddb0fd 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -85,6 +85,20 @@ static uint64_t acpi_memory_hotplug_read(void *opaque, hwaddr addr,
return val;
}
+static void acpi_handle_insert(MemStatus *mdev)
+{
+ switch (mdev->ost_status) {
+ case ACPI_SUCCESS:
+ case ACPI_FAILURE:
+ case ACPI_UNRECOGNIZED_NOTIFY:
+ case ACPI_INSERT_DRIVER_LOAD_FAILURE:
+ case ACPI_INSERT_NOT_SUPPORTED:
+ case ACPI_INSERT_IN_PROGRESS:
+ default:
+ break;
+ }
+}
+
static void acpi_handle_eject(MemStatus *mdev)
{
switch (mdev->ost_status) {
@@ -121,6 +135,10 @@ static void acpi_handle_eject(MemStatus *mdev)
static void acpi_handle_ost_event(MemStatus *mdev)
{
switch (mdev->ost_event) {
+ case ACPI_NOTIFY_DEVICE_CHECK:
+ case ACPI_OSPM_INSERT:
+ acpi_handle_insert(mdev);
+ break;
case ACPI_NOTIFY_EJECT_REQUEST: /* Ejection triggered by hardware. */
case ACPI_OSPM_EJECT: /* Ejection triggered by guest OS. */
acpi_handle_eject(mdev);
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index e8499f6..ad706d8 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -93,21 +93,29 @@
/* OST_EVENT */
#define ACPI_OSPM_EJECT 0x103
+#define ACPI_OSPM_INSERT 0x200
/* NOTIFY_EVENT */
#define ACPI_NOTIFY_DEVICE_CHECK 0x1
#define ACPI_NOTIFY_EJECT_REQUEST 0x3
-/* OST_STATUS */
+/* general processing OST_STATUS */
#define ACPI_SUCCESS 0x0
#define ACPI_FAILURE 0x1
#define ACPI_UNRECOGNIZED_NOTIFY 0x2
+
+/* ejection processing OST_STATUS */
#define ACPI_EJECT_NOT_SUPPORTED 0x80
#define ACPI_EJECT_DEVICE_IN_USE 0x81
#define ACPI_EJECT_DEVICE_BUSY 0x82
#define ACPI_EJECT_DEPENDENCY_BUSY 0x83
#define ACPI_EJECT_IN_PROGRESS 0x84
+/* insertion processing OST_STATUS */
+#define ACPI_INSERT_IN_PROGRESS 0x80
+#define ACPI_INSERT_DRIVER_LOAD_FAILURE 0x81
+#define ACPI_INSERT_NOT_SUPPORTED 0x82
+
/* structs */
typedef struct ACPIPMTimer ACPIPMTimer;
typedef struct ACPIPM1EVT ACPIPM1EVT;
--
1.8.4.2
next prev parent reply other threads:[~2014-08-27 8:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 8:09 [Qemu-devel] [RFC PATCH v1 0/4] Handle memory hotplug errors from guest OS Tang Chen
2014-08-27 8:09 ` [Qemu-devel] [RFC PATCH v1 1/4] Use macro to define ACPI notification event Tang Chen
2014-08-27 8:09 ` Tang Chen [this message]
2014-08-27 8:09 ` [Qemu-devel] [RFC PATCH v1 3/4] Introduce wait condition to catch guest OS memory hotplug error Tang Chen
2014-08-27 8:09 ` [Qemu-devel] [RFC PATCH v1 4/4] Handle memory hotplug error from guest OS in QEmu Tang Chen
2014-08-27 8:14 ` [Qemu-devel] [RFC PATCH v1 0/4] Handle memory hotplug errors from guest OS tangchen
2014-09-03 9:05 ` tangchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409126988-22287-3-git-send-email-tangchen@cn.fujitsu.com \
--to=tangchen@cn.fujitsu.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhugh.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).