diff mbox

[RFC,0/7] hw/arm/virt: Add cpu-add way cpu hotplug support

Message ID 54E4C99F.7070403@redhat.com
State New
Headers show

Commit Message

Wei Huang Feb. 18, 2015, 5:19 p.m. UTC
Nice work. I will help review the patches.

Other than the CPU hotplug support, we are also seeking the guest VM
powerdown support via ACPI. This feature is important for management
tool to control guest VMs. In fact I had a similar GPIO patch for
powerdown recently. Given that you already posted a more complete
version, I wonder if you can add this feature to your patchset? FYI, I
attached my powerdown patch in this email. Here is a brief list of items:

* DSDT description of power button (to-be-done)
* Hook up with qemu_qemu_register_powerdown_notifier() with the GPIO IRQ

Feel free to add my name as signed-off-by in this feature if you decide
to add it.

Thanks,
-Wei

On 02/17/2015 04:09 AM, Shannon Zhao wrote:
> Add cpu-add hotplug support in machine virt. As there are some properties
> which are set out of arm_cpu_initfn, so the way of device_add is not
> supported now. This will add at next version. Some good suggestion?
> 
> This patchset is based on below patch:
> [RFC PATCH v3 00/11] Generate ACPI v5.1 tables and	expose it to guest over fw_cfg on ARM
> http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg03290.html
> 
> Have done compile test and start a Linux guest, execute cpu-add in monitor, use info cpu
> to check a new cpu created. But as the guest kernel driver is not ready, so it can't be
> used by guest now.
> 
> Any comments are welcome.
> Thanks,
> Shannon
> 
> Shannon Zhao (7):
>   hw/arm/virt: Add a GPIO controller
>   hw/arm/virt-acpi-build: Add GPIO controller in ACPI DSDT table
>   hw/acpi/virt-hotplug: Add a hotplug device for machine virt
>   topology: Move topology.h to an arch-independent location
>   target-arm/cpu: Add apic_id property for ARMCPU
>   hw/arm/virt: Add cpu hotplug support
>   hw/arm/virt-acpi-build: Add cpu hotplug support in ACPI
> 
>  default-configs/arm-softmmu.mak  |    2 +
>  hw/acpi/Makefile.objs            |    1 +
>  hw/acpi/aml-build.c              |  135 ++++++++++++++++++++++++++
>  hw/acpi/cpu_hotplug.c            |   16 +---
>  hw/acpi/ich9.c                   |   12 +++
>  hw/acpi/piix4.c                  |   12 +++
>  hw/acpi/virt-hotplug.c           |  141 +++++++++++++++++++++++++++
>  hw/arm/virt-acpi-build.c         |  198 +++++++++++++++++++++++++++++++++++++-
>  hw/arm/virt.c                    |  190 ++++++++++++++++++++++++++++++++++++-
>  include/hw/acpi/aml-build.h      |   13 +++
>  include/hw/acpi/cpu_hotplug.h    |    6 +-
>  include/hw/acpi/topology.h       |  134 +++++++++++++++++++++++++
>  include/hw/acpi/virt-hotplug.h   |   11 ++
>  include/hw/arm/virt-acpi-build.h |    3 +
>  target-arm/cpu-qom.h             |    1 +
>  target-arm/cpu.c                 |   77 +++++++++++++++
>  target-arm/cpu.h                 |    2 +
>  target-i386/cpu.c                |    4 +-
>  target-i386/topology.h           |  134 -------------------------
>  tests/test-x86-cpuid.c           |   10 +-
>  20 files changed, 940 insertions(+), 162 deletions(-)
>  create mode 100644 hw/acpi/virt-hotplug.c
>  create mode 100644 include/hw/acpi/topology.h
>  create mode 100644 include/hw/acpi/virt-hotplug.h
>  delete mode 100644 target-i386/topology.h
> 
> 
>

Comments

Wei Huang Feb. 18, 2015, 5:22 p.m. UTC | #1
On 02/18/2015 11:19 AM, Wei Huang wrote:
> Nice work. I will help review the patches.
> 
> Other than the CPU hotplug support, we are also seeking the guest VM
> powerdown support via ACPI. This feature is important for management
> tool to control guest VMs. In fact I had a similar GPIO patch for
> powerdown recently. Given that you already posted a more complete
> version, I wonder if you can add this feature to your patchset? FYI, I
> attached my powerdown patch in this email. Here is a brief list of items:
> 
> * DSDT description of power button (to-be-done)
This is the fix (or something similar) to be added to DSDT table:
http://lists.linaro.org/pipermail/linaro-acpi/2014-July/002357.html

> * Hook up with qemu_qemu_register_powerdown_notifier() with the GPIO IRQ
> 
> Feel free to add my name as signed-off-by in this feature if you decide
> to add it.
> 
> Thanks,
> -Wei
> 
> On 02/17/2015 04:09 AM, Shannon Zhao wrote:
>> Add cpu-add hotplug support in machine virt. As there are some properties
>> which are set out of arm_cpu_initfn, so the way of device_add is not
>> supported now. This will add at next version. Some good suggestion?
>>
>> This patchset is based on below patch:
>> [RFC PATCH v3 00/11] Generate ACPI v5.1 tables and	expose it to guest over fw_cfg on ARM
>> http://lists.gnu.org/archive/html/qemu-devel/2015-02/msg03290.html
>>
>> Have done compile test and start a Linux guest, execute cpu-add in monitor, use info cpu
>> to check a new cpu created. But as the guest kernel driver is not ready, so it can't be
>> used by guest now.
>>
>> Any comments are welcome.
>> Thanks,
>> Shannon
>>
>> Shannon Zhao (7):
>>   hw/arm/virt: Add a GPIO controller
>>   hw/arm/virt-acpi-build: Add GPIO controller in ACPI DSDT table
>>   hw/acpi/virt-hotplug: Add a hotplug device for machine virt
>>   topology: Move topology.h to an arch-independent location
>>   target-arm/cpu: Add apic_id property for ARMCPU
>>   hw/arm/virt: Add cpu hotplug support
>>   hw/arm/virt-acpi-build: Add cpu hotplug support in ACPI
>>
>>  default-configs/arm-softmmu.mak  |    2 +
>>  hw/acpi/Makefile.objs            |    1 +
>>  hw/acpi/aml-build.c              |  135 ++++++++++++++++++++++++++
>>  hw/acpi/cpu_hotplug.c            |   16 +---
>>  hw/acpi/ich9.c                   |   12 +++
>>  hw/acpi/piix4.c                  |   12 +++
>>  hw/acpi/virt-hotplug.c           |  141 +++++++++++++++++++++++++++
>>  hw/arm/virt-acpi-build.c         |  198 +++++++++++++++++++++++++++++++++++++-
>>  hw/arm/virt.c                    |  190 ++++++++++++++++++++++++++++++++++++-
>>  include/hw/acpi/aml-build.h      |   13 +++
>>  include/hw/acpi/cpu_hotplug.h    |    6 +-
>>  include/hw/acpi/topology.h       |  134 +++++++++++++++++++++++++
>>  include/hw/acpi/virt-hotplug.h   |   11 ++
>>  include/hw/arm/virt-acpi-build.h |    3 +
>>  target-arm/cpu-qom.h             |    1 +
>>  target-arm/cpu.c                 |   77 +++++++++++++++
>>  target-arm/cpu.h                 |    2 +
>>  target-i386/cpu.c                |    4 +-
>>  target-i386/topology.h           |  134 -------------------------
>>  tests/test-x86-cpuid.c           |   10 +-
>>  20 files changed, 940 insertions(+), 162 deletions(-)
>>  create mode 100644 hw/acpi/virt-hotplug.c
>>  create mode 100644 include/hw/acpi/topology.h
>>  create mode 100644 include/hw/acpi/virt-hotplug.h
>>  delete mode 100644 target-i386/topology.h
>>
>>
>>
Shannon Zhao Feb. 26, 2015, 7:32 a.m. UTC | #2
On 2015/2/19 1:19, Wei Huang wrote:
> Nice work. I will help review the patches.
> 
Thanks for your help :-)

> Other than the CPU hotplug support, we are also seeking the guest VM
> powerdown support via ACPI. This feature is important for management
> tool to control guest VMs. In fact I had a similar GPIO patch for
> powerdown recently. Given that you already posted a more complete
> version, I wonder if you can add this feature to your patchset? FYI, I
> attached my powerdown patch in this email. Here is a brief list of items:
> 
> * DSDT description of power button (to-be-done)
> * Hook up with qemu_qemu_register_powerdown_notifier() with the GPIO IRQ
> 
> Feel free to add my name as signed-off-by in this feature if you decide
> to add it.

Yes, I think the powerdown support is very useful, but maybe this feature can be
added by a new patchset as this patchset cares about CPU hotplug.

We can add powerdown, memory hotplug, cpu remove and memory remove support step
by step if the approach of this patchset is accepted. I can make a patch to add
powerdown support based on this patchset and your attached patch if you want to
test this feature. How do you think about this?
Wei Huang Feb. 28, 2015, 4:46 a.m. UTC | #3
On 02/26/2015 01:32 AM, Shannon Zhao wrote:
> On 2015/2/19 1:19, Wei Huang wrote:
>> Nice work. I will help review the patches.
>>
> Thanks for your help :-)
> 
>> Other than the CPU hotplug support, we are also seeking the guest VM
>> powerdown support via ACPI. This feature is important for management
>> tool to control guest VMs. In fact I had a similar GPIO patch for
>> powerdown recently. Given that you already posted a more complete
>> version, I wonder if you can add this feature to your patchset? FYI, I
>> attached my powerdown patch in this email. Here is a brief list of items:
>>
>> * DSDT description of power button (to-be-done)
>> * Hook up with qemu_qemu_register_powerdown_notifier() with the GPIO IRQ
>>
>> Feel free to add my name as signed-off-by in this feature if you decide
>> to add it.
> 
> Yes, I think the powerdown support is very useful, but maybe this feature can be
> added by a new patchset as this patchset cares about CPU hotplug.
> 
> We can add powerdown, memory hotplug, cpu remove and memory remove support step
> by step if the approach of this patchset is accepted. I can make a patch to add
> powerdown support based on this patchset and your attached patch if you want to
> test this feature. How do you think about this?
That sounds good to me. It does make sense to separate them. Keep me in
loop.

Thanks,
-Wei
>
diff mbox

Patch

From 17e5319419d845fc5a5e95b1577c38bc2958d633 Mon Sep 17 00:00:00 2001
From: Wei Huang <wei@redhat.com>
Date: Mon, 16 Feb 2015 16:56:12 -0500
Subject: [mach-virt GPIO RFC 2/2] arm: Hook up QEMU powerdown notifier to GPIO
 interrupt line

Currently mach-virt model doesn't support powerdown request. Guest VM
doesn't react to system_powerdown from monitor console (or QMP) because
there is no communication mechanism for such requests. This patch registers
GPIO IRQ with powerdown notification. So guest VM can receive notification
when such powerdown request is triggered.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/arm/virt.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 1e5d792..7234044 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -440,6 +440,16 @@  static void create_rtc(const VirtBoardInfo *vbi, qemu_irq *pic)
     g_free(nodename);
 }
 
+static qemu_irq virt_system_powerdown;
+static void virt_powerdown_req(Notifier *n, void *opaque)
+{
+    qemu_irq_raise(virt_system_powerdown);
+}
+
+static Notifier virt_system_powerdown_notifier = {
+    .notify = virt_powerdown_req
+};
+
 static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic)
 {
     char *nodename;
@@ -461,6 +471,10 @@  static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic)
     qemu_fdt_setprop_cell(vbi->fdt, nodename, "clocks", vbi->clock_phandle);
     qemu_fdt_setprop_string(vbi->fdt, nodename, "clock-names", "apb_pclk");
 
+    /* connect powerdown request */
+    virt_system_powerdown = pic[irq];
+    qemu_register_powerdown_notifier(&virt_system_powerdown_notifier);
+
     g_free(nodename);
 }
 
-- 
1.8.3.1