All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zhang <zhlcindy@gmail.com>
To: peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Li Zhang <li.zhang@hxt-semitech.com>
Subject: [Qemu-devel] [PATCH 3/3] arm/virt: Implement hot_add_cpu interface
Date: Fri, 26 May 2017 17:21:08 +0800	[thread overview]
Message-ID: <1495790468-23862-4-git-send-email-zhlcindy@gmail.com> (raw)
In-Reply-To: <1495790468-23862-1-git-send-email-zhlcindy@gmail.com>

From: Li Zhang <li.zhang@hxt-semitech.com>

This patch is to add add_hot_cpu interface.

Signed-off-by: Li Zhang <li.zhang@hxt-semitech.com>
---
 hw/arm/virt.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 31314c1..c7e8322 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -527,6 +527,24 @@ out:
     error_propagate(errp, err);
 }
 
+static void virt_hot_add_cpu(const int64_t id, Error **errp)
+{
+    MachineState *ms = MACHINE(qdev_get_machine());
+    VirtMachineState *vms = VIRT_MACHINE(ms);
+
+    if (id < 0 || id >= max_cpus) {
+        error_setg(errp, "Invalid CPU id: %" PRIi64, id);
+        return;
+    }
+
+    virt_new_cpu(ms, id, errp);
+    if (errp) {
+        return;
+    }
+
+    fdt_add_cpu_node(vms, id);
+}
+
 static void fdt_add_its_gic_node(VirtMachineState *vms)
 {
     vms->msi_phandle = qemu_fdt_alloc_phandle(vms->fdt);
@@ -1654,6 +1672,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
     mc->minimum_page_bits = 12;
     mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
     mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
+    mc->hot_add_cpu = virt_hot_add_cpu;
 }
 
 static const TypeInfo virt_machine_info = {
-- 
2.7.4

  parent reply	other threads:[~2017-05-26  9:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26  9:21 [Qemu-devel] [PATCH 0/3] arm/virt: refine virt.c code and implement hot_add_cpu interface Li Zhang
2017-05-26  9:21 ` [Qemu-devel] [PATCH 1/3] arm/virt: Refine fdt_add_cpu_nodes code Li Zhang
2017-05-26  9:21 ` [Qemu-devel] [PATCH 2/3] arm/virt: Refine code of machvirt_init Li Zhang
2017-05-26  9:21 ` Li Zhang [this message]
2017-05-26 11:21 ` [Qemu-devel] [PATCH 0/3] arm/virt: refine virt.c code and implement hot_add_cpu interface Igor Mammedov
2017-05-27  2:32   ` Li Zhang
2017-05-29 10:43     ` Igor Mammedov
2017-05-30  3:43       ` Li Zhang

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=1495790468-23862-4-git-send-email-zhlcindy@gmail.com \
    --to=zhlcindy@gmail.com \
    --cc=li.zhang@hxt-semitech.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.