From patchwork Wed Jul 11 10:31:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasilis Liaskovitis X-Patchwork-Id: 1181471 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5F2A8DF25A for ; Wed, 11 Jul 2012 10:33:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757170Ab2GKKc4 (ORCPT ); Wed, 11 Jul 2012 06:32:56 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:40424 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757104Ab2GKKcT (ORCPT ); Wed, 11 Jul 2012 06:32:19 -0400 Received: by mail-bk0-f46.google.com with SMTP id j10so891613bkw.19 for ; Wed, 11 Jul 2012 03:32:18 -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=m7qEiL/sNl2k4m2qs08jnNGL2WutTd6+95gDua2ZU68=; b=PGA+anXEArryeN703sKAT4mU+NyUl2Jqv/VDhl0GGhWX+7VN3ACR9jrPyMlpppXhV4 W1Lm/lIwvSLCWRI0/RY2IbSdpzOS7ial20EM9cSug2Zw1ynOBBowle7YaB3zDpO+w4fP rVUDgLFEgYB0OyffBSgn8YTRu1pptAQX2KyOC+s2PK9b+shBiP3OtzKXgCZ9ds22dq0e lqtRRsd4XhWeNCRTcVoGe+WfvB0U5PR9nlngUyuth/hBgJN0kC+EhXb6nyAH8jo5pd64 Equ6AOjlYYnHI/WXu/d7PN0m+PjN3sZq4dOXSK39JaugBaItup0CZ48sJ2asLFAHv+gq l2Cg== Received: by 10.204.156.10 with SMTP id u10mr2702363bkw.11.1342002738669; Wed, 11 Jul 2012 03:32:18 -0700 (PDT) Received: from dhcp-192-168-178-175.ri.profitbricks.localdomain ([62.217.45.26]) by mx.google.com with ESMTPS id e20sm794740bkv.10.2012.07.11.03.32.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 03:32:18 -0700 (PDT) From: Vasilis Liaskovitis To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org Cc: avi@redhat.com, anthony@codemonkey.ws, gleb@redhat.com, imammedo@redhat.com, kevin@koconnor.net, wency@cn.fujitsu.com, Vasilis Liaskovitis Subject: [RFC PATCH v2 11/21] Implement dimm_add and dimm_del hmp/qmp commands Date: Wed, 11 Jul 2012 12:31:56 +0200 Message-Id: <1342002726-18258-12-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> References: <1342002726-18258-1-git-send-email-vasilis.liaskovitis@profitbricks.com> X-Gm-Message-State: ALoCoQmEddQprA6Cwjvoe46EdLMP9KUNwYXJV4vaP5V2wYXnGNQ2bHrZEJowNyicMJl3UzzPgcr+ Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hot-add hmp syntax: dimm_add dimmid Hot-remove hmp syntax: dimm_del dimmid Respective qmp commands are "dimm-add", "dimm-del". Signed-off-by: Vasilis Liaskovitis --- hmp-commands.hx | 32 ++++++++++++++++++++++++++++++++ monitor.c | 11 +++++++++++ monitor.h | 3 +++ qmp-commands.hx | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 0 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index f5d9d91..012c150 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -618,6 +618,38 @@ Add device. ETEXI { + .name = "dimm_del", + .args_type = "id:s", + .params = "id", + .help = "hot-remove memory (dimm device)", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_dimm_del, + }, + +STEXI +@item dimm_del @var{config} +@findex dimm_del + +Hot-remove dimm. +ETEXI + + { + .name = "dimm_add", + .args_type = "id:s", + .params = "id", + .help = "hot-add memory (dimm device)", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_dimm_add, + }, + +STEXI +@item dimm_add @var{config} +@findex dimm_add + +Hot-add dimm. +ETEXI + + { .name = "device_del", .args_type = "id:s", .params = "device", diff --git a/monitor.c b/monitor.c index f6107ba..d3d95a6 100644 --- a/monitor.c +++ b/monitor.c @@ -67,6 +67,7 @@ #include "qmp-commands.h" #include "hmp.h" #include "qemu-thread.h" +#include "hw/dimm.h" /* for pic/irq_info */ #if defined(TARGET_SPARC) @@ -4813,3 +4814,13 @@ int monitor_read_block_device_key(Monitor *mon, const char *device, return monitor_read_bdrv_key_start(mon, bs, completion_cb, opaque); } + +int do_dimm_add(Monitor *mon, const QDict *qdict, QObject **ret_data) +{ + return dimm_do(mon, qdict, true); +} + +int do_dimm_del(Monitor *mon, const QDict *qdict, QObject **ret_data) +{ + return dimm_do(mon, qdict, false); +} diff --git a/monitor.h b/monitor.h index 5f4de1b..afdd721 100644 --- a/monitor.h +++ b/monitor.h @@ -86,4 +86,7 @@ int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); +int do_dimm_add(Monitor *mon, const QDict *qdict, QObject **ret_data); +int do_dimm_del(Monitor *mon, const QDict *qdict, QObject **ret_data); + #endif /* !MONITOR_H */ diff --git a/qmp-commands.hx b/qmp-commands.hx index 2e1a38e..7efd628 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -2209,3 +2209,42 @@ EQMP .args_type = "implements:s?,abstract:b?", .mhandler.cmd_new = qmp_marshal_input_qom_list_types, }, + { + .name = "dimm-add", + .args_type = "id:s", + .mhandler.cmd_new = do_dimm_add, + }, +SQMP +dimm-add +------------- + +Hot-add memory DIMM + +Will hotplug memory DIMMs with given id. + +Example: + +-> { "execute": "dimm-add", "arguments": { "id": "dimm0" } } +<- { "return": {} } + +EQMP + + { + .name = "dimm-del", + .args_type = "id:s", + .mhandler.cmd_new = do_dimm_del, + }, +SQMP +dimm-del +------------- + +Hot-remove memory DIMM + +Will hot-unplug memory DIMMs with given id. + +Example: + +-> { "execute": "dimm-del", "arguments": { "id": "dimm0" } } +<- { "return": {} } + +EQMP