xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Xen Devel <xen-devel@lists.xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: [PATCH 7/7] xen: Implement hot_add_cpu hook.
Date: Mon, 17 Jun 2013 15:15:49 +0100	[thread overview]
Message-ID: <1371478549-28527-7-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1371478549-28527-1-git-send-email-anthony.perard@citrix.com>

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/acpi_piix4.c | 21 +++++++++++++++++++++
 hw/pc_piix.c    |  1 +
 sysemu.h        |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 56d7c2c..059b64f 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -662,6 +662,26 @@ static void piix4_cpu_hotplug_req(PIIX4PMState *s, int64_t cpu_id,
     pm_update_sci(s);
 }
 
+static PIIX4PMState *piix4pm_state;
+void piix4_cpu_hotplug_add(const int64_t cpu_id, Error **errp)
+{
+    CPUStatus *g = &piix4pm_state->gpe_cpu;
+
+    if (cpu_id >= max_cpus) {
+        error_setg(errp, "Unable to add CPU: %" PRIi64
+                   ", max allowed: %d", cpu_id, max_cpus - 1);
+        return;
+    }
+    if (g->sts[cpu_id / 8] & (1 << (cpu_id % 8))) {
+        /* Already requested to be hotplug. */
+        error_setg(errp, "Unable to add CPU: %" PRIi64
+                   ", it already exists", cpu_id);
+        return;
+    }
+
+    piix4_cpu_hotplug_req(piix4pm_state, cpu_id, PLUG);
+}
+
 static void piix4_init_cpu_status(CPUState *cpu, void *data)
 {
     CPUStatus *g = (CPUStatus *)data;
@@ -697,6 +717,7 @@ static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
                           PIIX4_PROC_LEN);
     memory_region_add_subregion(pci_address_space_io(&s->dev),
                                 PIIX4_PROC_BASE, &s->io_cpu);
+    piix4pm_state = s;
 }
 
 static void enable_device(PIIX4PMState *s, int slot)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index aa3e7f4..7e12f5d 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -621,6 +621,7 @@ static QEMUMachine xenfv_machine = {
     .init = pc_xen_hvm_init,
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
+    .hot_add_cpu = piix4_cpu_hotplug_add,
 };
 #endif
 
diff --git a/sysemu.h b/sysemu.h
index f5ac664..b71f244 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -183,4 +183,6 @@ char *get_boot_devices_list(uint32_t *size);
 
 bool usb_enabled(bool default_usb);
 
+void piix4_cpu_hotplug_add(const int64_t cpu_id, Error **errp);
+
 #endif
-- 
Anthony PERARD

  parent reply	other threads:[~2013-06-17 14:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 14:13 [PATCH v2 0/7] CPU hotplug for qemu-xen for 4.3 Anthony PERARD
2013-06-17 14:15 ` [PATCH 1/7] cpu: Introduce get_arch_id() method and override it for X86CPU Anthony PERARD
2013-06-17 14:15   ` [PATCH 2/7] cpu: Add qemu_for_each_cpu() Anthony PERARD
2013-06-17 14:15   ` [PATCH 3/7] acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest Anthony PERARD
2013-06-17 14:15   ` [PATCH 4/7] Add hot_add_cpu hook to QEMUMachine Anthony PERARD
2013-06-17 14:15   ` [PATCH 5/7] QMP: Add cpu-add command Anthony PERARD
2013-06-17 14:15   ` [PATCH 6/7] xen: Fix vcpus initialisation Anthony PERARD
2013-06-20 11:14     ` Stefano Stabellini
2013-06-17 14:15   ` Anthony PERARD [this message]
2013-06-20 11:21     ` [PATCH 7/7] xen: Implement hot_add_cpu hook Stefano Stabellini
2013-06-20 13:19       ` Anthony PERARD
2013-06-20 13:40     ` Stefano Stabellini
2013-06-21 17:40       ` Anthony PERARD
2013-06-17 14:20 ` [PATCH v2 1/2] libxl: Add "cpu-add" QMP command Anthony PERARD
2013-06-17 14:20   ` [PATCH v2 2/2] libxl: Use QMP cpu-add to hotplug CPU with qemu-xen Anthony PERARD
2013-06-17 15:31     ` Ian Campbell
2013-06-17 15:50       ` Anthony PERARD
2013-06-20 11:12         ` Stefano Stabellini
2013-06-17 15:25   ` [PATCH v2 1/2] libxl: Add "cpu-add" QMP command Ian Campbell
2013-06-17 15:28     ` Anthony PERARD
2013-06-17 15:31       ` Ian Campbell
2013-06-17 14:22 ` [PATCH v2] xen: Allow CPU to be counted than currently "plugged" Anthony PERARD
2013-06-17 15:24   ` Ian Campbell
2013-06-17 15:44     ` Anthony PERARD
2013-06-24 16:57 ` [PATCH v2 0/7] CPU hotplug for qemu-xen for 4.3 Stefano Stabellini
2013-06-24 17:21   ` Stefano Stabellini
2013-06-24 17:28     ` Anthony PERARD
2013-06-25  9:19   ` George Dunlap
2013-06-25 11:40     ` Stefano Stabellini

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=1371478549-28527-7-git-send-email-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.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 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).