All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs
@ 2016-06-16 16:55 Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 01/10] docs: update ACPI CPU hotplug spec with new protocol Igor Mammedov
                   ` (11 more replies)
  0 siblings, 12 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

Changelog:                                                                       
 v1->v2:                                                                         
  - dropped consolidate legacy ACPI CPU hotplug as they are in master by now     
  - pc: start with legacy hotplug and let 2.7 machine type and older             
    to switch inot new hotplug mode. That way legacy BIOS will                   
    still work fine as it uses built in ACPI tables and will continue            
    to use legacy CPU hotplug interface.                                         
  - poll for CPU objects with events (insert/remove) instead of                  
    looping over all CPUs to find CPUs with events.                              
  - drop dynamic PXM support as it could be implemented in static way            
    at acpi tabels build time. It will be an additional series on top of this.   
  - resplit patches on basic present CPU support, hot-add and hot-remove parts   
    Patches:                                                                     
        1-7: add new CPU hotplug impl.                                           
          8: makes 2.7 machine type to use new AML code that                     
             will switch piix4/ich9 into new mode +                              
             switching logic with migration glue for piix4/ich9                  
          9: drops the last dependency in ACPI parts on apic_id_limit            
             sized map.                                                          
 RFC->v1:                                                                        
  - drop machine.cpu-hotplug property and leave CPU hotplug                      
    always enabled as it used to be.                                             
    (it also simplifies, series a bit)                                           
  - reshuffle/squash some patches to make series bisectable                      
    wrt 'make check' failures                                                    
  - add doc comment in qapi schema                                               
  - fix 'make check' error for mips target, disableCPU hotplug                   
    code path in piix4_pm for mips                                               
  - drop some intermediate expected ACPI tables updates                          
  - replace _MAT method with named buffer object                                 
                                                                                 
Current ACPI interface for CPU hotplug supports hoti-adding                      
only upto 255 CPUs and lacks means to convey additional                          
information needed _OST methods support.                                         
Also being bitmap based with bit position specifying APIC ID                     
it doesn't scale up well for 32-bit APIC IDs that will come                      
with x2APIC support.                                                             
                                                                                 
So add another QEMU-guest interface using as model memory-hotplug.               
New interface will be used since 2.7 machine types and will                      
support:                                                                         
    - more than 255 CPUs with 32-bit APIC ID value                               
    - a registers set to communicate OST information                             
      (extendable without breaking IO layout)                                    
    - possible to reuse for ARM's 'virt' machine type                            
      with minimal tweaks (add init for MMIO, add                                
      ACPI hooks on CPU hotplug path, MADT generation)                           
                                                                                 
                                                                                 
Tested with following guests: RHEL7, WS2003EEx64, WS2012R2x64                    
 * unplug is tested only with RHEL7 as Windows doesn't support it.               
 * tested that migration works as well.                                          
                                                                                 
git tree for testing:                                                            
    git@github.com:imammedo/qemu.git modern_cpu_hotplug_v2                       
viewing:                                                                         
    https://github.com/imammedo/qemu/commits/modern_cpu_hotplug_v2               

Igor Mammedov (10):
  docs: update ACPI CPU hotplug spec with new protocol
  pc: piix4/ich9: add 'cpu-hotplug-legacy' property
  acpi: cpuhp: add CPU devices AML with _STA method
  pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
  acpi: cpuhp: implement hot-add parts of CPU hotplug interface
  acpi: cpuhp: implement hot-remove parts of CPU hotplug interface
  acpi: cpuhp: add cpu._OST handling
  pc: use new CPU hotplug interface since 2.7 machine type
  tests: acpi: add CPU hotplug testcase
  pc: acpi: drop intermediate PCMachineState.node_cpu

 docs/specs/acpi_cpu_hotplug.txt      |  94 +++++-
 hw/acpi/Makefile.objs                |   1 +
 hw/acpi/cpu.c                        | 561 +++++++++++++++++++++++++++++++++++
 hw/acpi/cpu_hotplug.c                |  21 +-
 hw/acpi/ich9.c                       |  69 ++++-
 hw/acpi/piix4.c                      |  71 ++++-
 hw/i386/acpi-build.c                 |  68 +++--
 hw/i386/pc.c                         |  63 +++-
 hw/i386/pc_piix.c                    |   2 +
 hw/i386/pc_q35.c                     |   2 +
 hw/isa/lpc_ich9.c                    |   1 +
 include/hw/acpi/acpi_dev_interface.h |   7 +
 include/hw/acpi/cpu.h                |  67 +++++
 include/hw/acpi/cpu_hotplug.h        |   6 +
 include/hw/acpi/ich9.h               |   3 +
 include/hw/i386/pc.h                 |   8 +-
 qapi-schema.json                     |   3 +-
 stubs/Makefile.objs                  |   1 +
 stubs/pc_madt_cpu_entry.c            |   7 +
 tests/bios-tables-test.c             |  28 ++
 trace-events                         |  14 +
 21 files changed, 1043 insertions(+), 54 deletions(-)
 create mode 100644 hw/acpi/cpu.c
 create mode 100644 include/hw/acpi/cpu.h
 create mode 100644 stubs/pc_madt_cpu_entry.c

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 01/10] docs: update ACPI CPU hotplug spec with new protocol
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 02/10] pc: piix4/ich9: add 'cpu-hotplug-legacy' property Igor Mammedov
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

Add description of new CPU hotplug interface.

To switch from from legacy mode into new mode use fact
that write accesses into CPU present bitmap were never
used before and were ignored by QEMU.
So use it to as a way to switch from legacy mode.
That way pc/q35 machine starts in legacy mode and
QEMU generated ACPI tables will switch to new CPU
hotplug interface during runtime.
In case QEMU is started with legacy BIOS (that doesn't
support QEMU generated ACPI tables), legacy CPU hotplug
will remain active and could be used by BIOS built in
ACPI tables for CPU hotplug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 docs/specs/acpi_cpu_hotplug.txt | 94 +++++++++++++++++++++++++++++++++++------
 1 file changed, 82 insertions(+), 12 deletions(-)

diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.txt
index 340b751..ee219c8 100644
--- a/docs/specs/acpi_cpu_hotplug.txt
+++ b/docs/specs/acpi_cpu_hotplug.txt
@@ -4,21 +4,91 @@ QEMU<->ACPI BIOS CPU hotplug interface
 QEMU supports CPU hotplug via ACPI. This document
 describes the interface between QEMU and the ACPI BIOS.
 
-ACPI GPE block (IO ports 0xafe0-0xafe3, byte access):
------------------------------------------
-
-Generic ACPI GPE block. Bit 2 (GPE.2) used to notify CPU
-hot-add/remove event to ACPI BIOS, via SCI interrupt.
+ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add
+and hot-remove events.
 
+============================================
+Legacy ACPI CPU hotplug interface registers:
+--------------------------------------------
 CPU present bitmap for:
   ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access)
   PIIX-PM  (IO port 0xaf00-0xaf1f, 1-byte access)
+  One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only.
+  The first DWORD in bitmap is used in write mode to switch from legacy
+  to new CPU hotplug interface, write 0 into it to do switch.
 ---------------------------------------------------------------
-One bit per CPU. Bit position reflects corresponding CPU APIC ID.
-Read-only.
+QEMU sets corresponding CPU bit on hot-add event and issues SCI
+with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler
+to notify OS about CPU hot-add events. CPU hot-remove isn't supported.
+
+=====================================
+ACPI CPU hotplug interface registers:
+-------------------------------------
+Register block base address:
+    ICH9-LPC IO port 0x0cd8
+    PIIX-PM  IO port 0xaf00
+Register block size:
+    ACPI_CPU_HOTPLUG_REG_LEN = 12
+
+read access:
+    offset:
+    [0x0-0x3] reserved
+    [0x4] CPU device status fields: (1 byte access)
+        bits:
+           0: Device is enabled and may be used by guest
+           1: Device insert event, used to distinguish device for which
+              no device check event to OSPM was issued.
+              It's valid only when bit 0 is set.
+           2: Device remove event, used to distinguish device for which
+              no device eject request to OSPM was issued.
+           3-7: reserved and should be ignored by OSPM
+    [0x5-0x7] reserved
+    [0x8] Command data: (DWORD access)
+          in case of error or unsupported command reads is 0xFFFFFFFF
+          current 'Command field' value:
+              0: returns PXM value corresponding to device
+
+write access:
+    offset:
+    [0x0-0x3] CPU selector: (DWORD access)
+              selects active CPU device. All following accesses to other
+              registers will read/store data from/to selected CPU.
+    [0x4] CPU device control fields: (1 byte access)
+        bits:
+            0: reserved, OSPM must clear it before writing to register.
+            1: if set to 1 clears device insert event, set by OSPM
+               after it has emitted device check event for the
+               selected CPU device
+            2: if set to 1 clears device remove event, set by OSPM
+               after it has emitted device eject request for the
+               selected CPU device
+            3: if set to 1 initiates device eject, set by OSPM when it
+               triggers CPU device removal and calls _EJ0 method
+            4-7: reserved, OSPM must clear them before writing to register
+    [0x5] Command field: (1 byte access)
+          value:
+            0: selects a CPU device with inserting/removing events and
+               following reads from 'Command data' register return
+               selected CPU (CPU selector value). If no CPU with events
+               found, the current CPU selector doesn't change and
+               corresponding insert/remove event flags are not set.
+            1: following writes to 'Command data' register set OST event
+               register in QEMU
+            2: following writes to 'Command data' register set OST status
+               register in QEMU
+            other values: reserved
+    [0x6-0x7] reserved
+    [0x8] Command data: (DWORD access)
+          current 'Command field' value:
+              0: OSPM reads value of CPU selector
+              1: stores value into OST event register
+              2: stores value into OST status register, triggers
+                 ACPI_DEVICE_OST QMP event from QEMU to external applications
+                 with current values of OST event and status registers.
+            other values: reserved
 
-CPU hot-add/remove notification:
------------------------------------------------------
-QEMU sets/clears corresponding CPU bit on hot-add/remove event.
-CPU present map read by ACPI BIOS GPE.2 handler to notify OS of CPU
-hot-(un)plug events.
+Selecting CPU device beyond possible range has no effect on platform:
+   - write accesses to CPU hot-plug registers not documented above are
+     ignored
+   - read accesses to CPU hot-plug registers not documented above return
+     all bits set to 0.
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 02/10] pc: piix4/ich9: add 'cpu-hotplug-legacy' property
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 01/10] docs: update ACPI CPU hotplug spec with new protocol Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-23 12:38   ` Marcel Apfelbaum
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 03/10] acpi: cpuhp: add CPU devices AML with _STA method Igor Mammedov
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

It will be used to select which hotplug call-back is called
and for switching from legacy mode into new one.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/ich9.c         | 23 ++++++++++++++++++++++-
 hw/acpi/piix4.c        | 24 +++++++++++++++++++++++-
 include/hw/acpi/ich9.h |  1 +
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 853c9c4..ed16940 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -306,6 +306,21 @@ static void ich9_pm_set_memory_hotplug_support(Object *obj, bool value,
     s->pm.acpi_memory_hotplug.is_enabled = value;
 }
 
+static bool ich9_pm_get_cpu_hotplug_legacy(Object *obj, Error **errp)
+{
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+
+    return s->pm.cpu_hotplug_legacy;
+}
+
+static void ich9_pm_set_cpu_hotplug_legacy(Object *obj, bool value,
+                                           Error **errp)
+{
+    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+
+    s->pm.cpu_hotplug_legacy = value;
+}
+
 static void ich9_pm_get_disable_s3(Object *obj, Visitor *v, const char *name,
                                    void *opaque, Error **errp)
 {
@@ -397,6 +412,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
 {
     static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
     pm->acpi_memory_hotplug.is_enabled = true;
+    pm->cpu_hotplug_legacy = true;
     pm->disable_s3 = 0;
     pm->disable_s4 = 0;
     pm->s4_val = 2;
@@ -412,6 +428,10 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
                              ich9_pm_get_memory_hotplug_support,
                              ich9_pm_set_memory_hotplug_support,
                              NULL);
+    object_property_add_bool(obj, "cpu-hotplug-legacy",
+                             ich9_pm_get_cpu_hotplug_legacy,
+                             ich9_pm_set_cpu_hotplug_legacy,
+                             NULL);
     object_property_add(obj, ACPI_PM_PROP_S3_DISABLED, "uint8",
                         ich9_pm_get_disable_s3,
                         ich9_pm_set_disable_s3,
@@ -439,7 +459,8 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
         object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,
                             dev, errp);
-    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+    } else if (lpc->pm.cpu_hotplug_legacy &&
+               object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
         legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
     } else {
         error_setg(errp, "acpi: device plug request for not supported device"
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index c48cb1b..9ae3964 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -86,6 +86,7 @@ typedef struct PIIX4PMState {
     uint8_t disable_s4;
     uint8_t s4_val;
 
+    bool cpu_hotplug_legacy;
     AcpiCpuHotplug gpe_cpu;
 
     MemHotplugState acpi_memory_hotplug;
@@ -351,7 +352,8 @@ static void piix4_device_plug_cb(HotplugHandler *hotplug_dev,
         acpi_memory_plug_cb(hotplug_dev, &s->acpi_memory_hotplug, dev, errp);
     } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
         acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
-    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+    } else if (s->cpu_hotplug_legacy &&
+               object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
         legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
     } else {
         error_setg(errp, "acpi: device plug request for not supported device"
@@ -560,6 +562,21 @@ static const MemoryRegionOps piix4_gpe_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
+
+static bool piix4_get_cpu_hotplug_legacy(Object *obj, Error **errp)
+{
+    PIIX4PMState *s = PIIX4_PM(obj);
+
+    return s->cpu_hotplug_legacy;
+}
+
+static void piix4_set_cpu_hotplug_legacy(Object *obj, bool value, Error **errp)
+{
+    PIIX4PMState *s = PIIX4_PM(obj);
+
+    s->cpu_hotplug_legacy = value;
+}
+
 static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
                                            PCIBus *bus, PIIX4PMState *s)
 {
@@ -570,6 +587,11 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
     acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent,
                     s->use_acpi_pci_hotplug);
 
+    s->cpu_hotplug_legacy = true;
+    object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",
+                             piix4_get_cpu_hotplug_legacy,
+                             piix4_set_cpu_hotplug_legacy,
+                             NULL);
     legacy_acpi_cpu_hotplug_init(parent, OBJECT(s), &s->gpe_cpu,
                                  PIIX4_CPU_HOTPLUG_IO_BASE);
 
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index bbd657c..e29a856 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -48,6 +48,7 @@ typedef struct ICH9LPCPMRegs {
     uint32_t pm_io_base;
     Notifier powerdown_notifier;
 
+    bool cpu_hotplug_legacy;
     AcpiCpuHotplug gpe_cpu;
 
     MemHotplugState acpi_memory_hotplug;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 03/10] acpi: cpuhp: add CPU devices AML with _STA method
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 01/10] docs: update ACPI CPU hotplug spec with new protocol Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 02/10] pc: piix4/ich9: add 'cpu-hotplug-legacy' property Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 04/10] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook Igor Mammedov
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

it adds CPU objects to DSDT with _STA method
and QEMU side of CPU hotplug interface initialization
with registers sufficient to handle _STA requests,
including necessary hotplug callbacks in piix4,ich9 code.

Hot-(un)plug hw/acpi parts will be added by
corresponding follow up patches.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
 - merge relevant hw and AML togethe on one patch
 - use UID in Device(CPUxxx) instead of apic id,
   i.e. do the same as for Processor object
---
 hw/acpi/Makefile.objs  |   1 +
 hw/acpi/cpu.c          | 240 +++++++++++++++++++++++++++++++++++++++++++++++++
 hw/acpi/ich9.c         |   9 +-
 hw/acpi/piix4.c        |  11 ++-
 include/hw/acpi/cpu.h  |  51 +++++++++++
 include/hw/acpi/ich9.h |   2 +
 trace-events           |   5 ++
 7 files changed, 313 insertions(+), 6 deletions(-)
 create mode 100644 hw/acpi/cpu.c
 create mode 100644 include/hw/acpi/cpu.h

diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index 66bd727..f200419 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -2,6 +2,7 @@ common-obj-$(CONFIG_ACPI_X86) += core.o piix4.o pcihp.o
 common-obj-$(CONFIG_ACPI_X86_ICH) += ich9.o tco.o
 common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o
 common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
+common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
 obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
 common-obj-$(CONFIG_ACPI) += acpi_interface.o
 common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
new file mode 100644
index 0000000..d99002c
--- /dev/null
+++ b/hw/acpi/cpu.c
@@ -0,0 +1,240 @@
+#include "qemu/osdep.h"
+#include "hw/boards.h"
+#include "hw/acpi/cpu.h"
+#include "qapi/error.h"
+#include "trace.h"
+
+#define ACPI_CPU_HOTPLUG_REG_LEN 12
+#define ACPI_CPU_SELECTOR_OFFSET_WR 0
+#define ACPI_CPU_FLAGS_OFFSET_RW 4
+
+static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
+{
+    uint64_t val = 0;
+    CPUHotplugState *cpu_st = opaque;
+    AcpiCpuStatus *cdev;
+
+    if (cpu_st->selector >= cpu_st->dev_count) {
+        return val;
+    }
+
+    cdev = &cpu_st->devs[cpu_st->selector];
+    switch (addr) {
+    case ACPI_CPU_FLAGS_OFFSET_RW: /* pack and return is_* fields */
+        val |= cdev->cpu ? 1 : 0;
+        trace_cpuhp_acpi_read_flags(cpu_st->selector, val);
+        break;
+    default:
+        break;
+    }
+    return val;
+}
+
+static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
+                           unsigned int size)
+{
+    CPUHotplugState *cpu_st = opaque;
+
+    assert(cpu_st->dev_count);
+
+    if (addr) {
+        if (cpu_st->selector >= cpu_st->dev_count) {
+            trace_cpuhp_acpi_invalid_idx_selected(cpu_st->selector);
+            return;
+        }
+    }
+
+    switch (addr) {
+    case ACPI_CPU_SELECTOR_OFFSET_WR: /* current CPU selector */
+        cpu_st->selector = data;
+        trace_cpuhp_acpi_write_idx(cpu_st->selector);
+        break;
+    default:
+        break;
+    }
+}
+
+static const MemoryRegionOps cpu_hotplug_ops = {
+    .read = cpu_hotplug_rd,
+    .write = cpu_hotplug_wr,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+    .valid = {
+        .min_access_size = 1,
+        .max_access_size = 4,
+    },
+};
+
+void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
+                         CPUHotplugState *state, hwaddr base_addr)
+{
+    MachineState *machine = MACHINE(qdev_get_machine());
+    MachineClass *mc = MACHINE_GET_CLASS(machine);
+    CPUArchIdList *id_list;
+    int i;
+
+    assert(mc->possible_cpu_arch_ids);
+    id_list = mc->possible_cpu_arch_ids(machine);
+    state->dev_count = id_list->len;
+    state->devs = g_new0(typeof(*state->devs), state->dev_count);
+    for (i = 0; i < id_list->len; i++) {
+        state->devs[i].cpu =  id_list->cpus[i].cpu;
+        state->devs[i].arch_id = id_list->cpus[i].arch_id;
+    }
+    g_free(id_list);
+    memory_region_init_io(&state->ctrl_reg, owner, &cpu_hotplug_ops, state,
+                          "acpi-mem-hotplug", ACPI_CPU_HOTPLUG_REG_LEN);
+    memory_region_add_subregion(as, base_addr, &state->ctrl_reg);
+}
+
+static AcpiCpuStatus *get_cpu_status(CPUHotplugState *cpu_st, DeviceState *dev)
+{
+    CPUClass *k = CPU_GET_CLASS(dev);
+    uint64_t cpu_arch_id = k->get_arch_id(CPU(dev));
+    int i;
+
+    for (i = 0; i < cpu_st->dev_count; i++) {
+        if (cpu_arch_id == cpu_st->devs[i].arch_id) {
+            return &cpu_st->devs[i];
+        }
+    }
+    return NULL;
+}
+
+void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+                      CPUHotplugState *cpu_st, DeviceState *dev, Error **errp)
+{
+    AcpiCpuStatus *cdev;
+
+    cdev = get_cpu_status(cpu_st, dev);
+    if (!cdev) {
+        return;
+    }
+
+    cdev->cpu = CPU(dev);
+}
+
+const VMStateDescription vmstate_cpu_hotplug = {
+    .name = "CPU hotplug state",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_UINT32(selector, CPUHotplugState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+#define CPU_NAME_FMT      "C%.03X"
+#define CPUHP_RES_DEVICE  "PRES"
+#define CPU_LOCK          "CPLK"
+#define CPU_STS_METHOD    "CSTA"
+
+#define CPU_ENABLED       "CPEN"
+#define CPU_SELECTOR      "CSEL"
+
+void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
+                    hwaddr io_base,
+                    const char *res_root)
+{
+    Aml *ifctx;
+    Aml *field;
+    Aml *method;
+    Aml *cpu_ctrl_dev;
+    Aml *cpus_dev;
+    Aml *zero = aml_int(0);
+    Aml *one = aml_int(1);
+    Aml *sb_scope = aml_scope("_SB");
+    MachineClass *mc = MACHINE_GET_CLASS(machine);
+    CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(machine);
+    char *cphp_res_path = g_strdup_printf("%s." CPUHP_RES_DEVICE, res_root);
+
+    cpu_ctrl_dev = aml_device("%s", cphp_res_path);
+    {
+        Aml *crs;
+
+        aml_append(cpu_ctrl_dev,
+            aml_name_decl("_HID", aml_eisaid("PNP0A06")));
+        aml_append(cpu_ctrl_dev,
+            aml_name_decl("_UID", aml_string("CPU Hotplug resources")));
+        aml_append(cpu_ctrl_dev, aml_mutex(CPU_LOCK, 0));
+
+        crs = aml_resource_template();
+        aml_append(crs, aml_io(AML_DECODE16, io_base, io_base, 1,
+                               ACPI_CPU_HOTPLUG_REG_LEN));
+        aml_append(cpu_ctrl_dev, aml_name_decl("_CRS", crs));
+
+        /* declare CPU hotplug MMIO region with related access fields */
+        aml_append(cpu_ctrl_dev,
+            aml_operation_region("PRST", AML_SYSTEM_IO, aml_int(io_base),
+                                 ACPI_CPU_HOTPLUG_REG_LEN));
+
+        field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK,
+                          AML_WRITE_AS_ZEROS);
+        aml_append(field, aml_reserved_field(ACPI_CPU_FLAGS_OFFSET_RW * 8));
+        /* 1 if enabled, read only */
+        aml_append(field, aml_named_field(CPU_ENABLED, 1));
+        aml_append(cpu_ctrl_dev, field);
+
+        field = aml_field("PRST", AML_DWORD_ACC, AML_NOLOCK, AML_PRESERVE);
+        /* CPU selector, write only */
+        aml_append(field, aml_named_field(CPU_SELECTOR, 32));
+        aml_append(cpu_ctrl_dev, field);
+
+    }
+    aml_append(sb_scope, cpu_ctrl_dev);
+
+    cpus_dev = aml_device("\\_SB.CPUS");
+    {
+        int i;
+        Aml *ctrl_lock = aml_name("%s.%s", cphp_res_path, CPU_LOCK);
+        Aml *cpu_selector = aml_name("%s.%s", cphp_res_path, CPU_SELECTOR);
+        Aml *is_enabled = aml_name("%s.%s", cphp_res_path, CPU_ENABLED);
+
+        aml_append(cpus_dev, aml_name_decl("_HID", aml_string("ACPI0010")));
+        aml_append(cpus_dev, aml_name_decl("_CID", aml_eisaid("PNP0A05")));
+
+        method = aml_method(CPU_STS_METHOD, 1, AML_SERIALIZED);
+        {
+            Aml *idx = aml_arg(0);
+            Aml *sta = aml_local(0);
+
+            aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(idx, cpu_selector));
+            aml_append(method, aml_store(zero, sta));
+            ifctx = aml_if(aml_equal(is_enabled, one));
+            {
+                aml_append(ifctx, aml_store(aml_int(0xF), sta));
+            }
+            aml_append(method, ifctx);
+            aml_append(method, aml_release(ctrl_lock));
+            aml_append(method, aml_return(sta));
+        }
+        aml_append(cpus_dev, method);
+
+        /* build Processor object for each processor */
+        for (i = 0; i < arch_ids->len; i++) {
+            Aml *dev;
+            Aml *uid = aml_int(i);
+            int arch_id = arch_ids->cpus[i].arch_id;
+
+            if (opts.apci_1_compatible && arch_id < 255) {
+                dev = aml_processor(i, 0, 0, CPU_NAME_FMT, i);
+            } else {
+                dev = aml_device(CPU_NAME_FMT, i);
+                aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
+                aml_append(dev, aml_name_decl("_UID", uid));
+            }
+
+            method = aml_method("_STA", 0, AML_SERIALIZED);
+            aml_append(method, aml_return(aml_call1(CPU_STS_METHOD, uid)));
+            aml_append(dev, method);
+
+            aml_append(cpus_dev, dev);
+        }
+    }
+    aml_append(sb_scope, cpus_dev);
+    aml_append(table, sb_scope);
+
+    g_free(cphp_res_path);
+    g_free(arch_ids);
+}
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index ed16940..9a81da8 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -459,9 +459,12 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
         object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,
                             dev, errp);
-    } else if (lpc->pm.cpu_hotplug_legacy &&
-               object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
-        legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+        if (lpc->pm.cpu_hotplug_legacy) {
+            legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
+        } else {
+            acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp_state, dev, errp);
+        }
     } else {
         error_setg(errp, "acpi: device plug request for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 9ae3964..6351d2e 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -34,6 +34,7 @@
 #include "hw/acpi/piix4.h"
 #include "hw/acpi/pcihp.h"
 #include "hw/acpi/cpu_hotplug.h"
+#include "hw/acpi/cpu.h"
 #include "hw/hotplug.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/acpi/memory_hotplug.h"
@@ -88,6 +89,7 @@ typedef struct PIIX4PMState {
 
     bool cpu_hotplug_legacy;
     AcpiCpuHotplug gpe_cpu;
+    CPUHotplugState cpuhp_state;
 
     MemHotplugState acpi_memory_hotplug;
 } PIIX4PMState;
@@ -352,9 +354,12 @@ static void piix4_device_plug_cb(HotplugHandler *hotplug_dev,
         acpi_memory_plug_cb(hotplug_dev, &s->acpi_memory_hotplug, dev, errp);
     } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
         acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
-    } else if (s->cpu_hotplug_legacy &&
-               object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
-        legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+        if (s->cpu_hotplug_legacy) {
+            legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
+        } else {
+            acpi_cpu_plug_cb(hotplug_dev, &s->cpuhp_state, dev, errp);
+        }
     } else {
         error_setg(errp, "acpi: device plug request for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
new file mode 100644
index 0000000..f345447
--- /dev/null
+++ b/include/hw/acpi/cpu.h
@@ -0,0 +1,51 @@
+/*
+ * QEMU ACPI hotplug utilities
+ *
+ * Copyright (C) 2016 Red Hat Inc
+ *
+ * Authors:
+ *   Igor Mammedov <imammedo@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef ACPI_CPU_H
+#define ACPI_CPU_H
+
+#include "hw/qdev-core.h"
+#include "hw/acpi/acpi.h"
+#include "hw/acpi/aml-build.h"
+#include "hw/hotplug.h"
+
+typedef struct AcpiCpuStatus {
+    struct CPUState *cpu;
+    uint64_t arch_id;
+} AcpiCpuStatus;
+
+typedef struct CPUHotplugState {
+    MemoryRegion ctrl_reg;
+    uint32_t selector;
+    uint32_t dev_count;
+    AcpiCpuStatus *devs;
+} CPUHotplugState;
+
+void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+                      CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
+
+void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
+                         CPUHotplugState *state, hwaddr base_addr);
+
+typedef struct CPUHotplugFeatures {
+    bool apci_1_compatible;
+} CPUHotplugFeatures;
+
+void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
+                    hwaddr io_base,
+                    const char *res_root);
+
+extern const VMStateDescription vmstate_cpu_hotplug;
+#define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
+    VMSTATE_STRUCT(cpuhp, state, 1, \
+                   vmstate_cpu_hotplug, CPUHotplugState)
+
+#endif
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index e29a856..a352c94 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -23,6 +23,7 @@
 
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/cpu_hotplug.h"
+#include "hw/acpi/cpu.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/tco.h"
@@ -50,6 +51,7 @@ typedef struct ICH9LPCPMRegs {
 
     bool cpu_hotplug_legacy;
     AcpiCpuHotplug gpe_cpu;
+    CPUHotplugState cpuhp_state;
 
     MemHotplugState acpi_memory_hotplug;
 
diff --git a/trace-events b/trace-events
index 2f14205..66ec813 100644
--- a/trace-events
+++ b/trace-events
@@ -2164,3 +2164,8 @@ e1000e_cfg_support_virtio(bool support) "Virtio header supported: %d"
 
 e1000e_vm_state_running(void) "VM state is running"
 e1000e_vm_state_stopped(void) "VM state is stopped"
+
+# hw/acpi/cpu.c
+cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32
+cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0x%"PRIx32"] flags: 0x%"PRIx8
+cpuhp_acpi_write_idx(uint32_t idx) "set active cpu idx: 0x%"PRIx32
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 04/10] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (2 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 03/10] acpi: cpuhp: add CPU devices AML with _STA method Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 05/10] acpi: cpuhp: implement hot-add parts of CPU hotplug interface Igor Mammedov
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

Add madt_cpu callback to AcpiDeviceIfClass and use
it for generating LAPIC MADT entries for CPUs.

Later it will be used for generating x2APIC
entries in case of more than 255 CPUs and also
would be reused by ARM target when ACPI CPU hotplug
is introduced there.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/piix4.c                      |  1 +
 hw/i386/acpi-build.c                 | 45 +++++++++++++++++++++---------------
 hw/isa/lpc_ich9.c                    |  1 +
 include/hw/acpi/acpi_dev_interface.h |  7 ++++++
 include/hw/i386/pc.h                 |  5 ++++
 stubs/Makefile.objs                  |  1 +
 stubs/pc_madt_cpu_entry.c            |  7 ++++++
 7 files changed, 49 insertions(+), 18 deletions(-)
 create mode 100644 stubs/pc_madt_cpu_entry.c

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 6351d2e..6d24cb5 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -658,6 +658,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
     hc->unplug = piix4_device_unplug_cb;
     adevc->ospm_status = piix4_ospm_status;
     adevc->send_event = piix4_send_gpe;
+    adevc->madt_cpu = pc_madt_cpu_entry;
 }
 
 static const TypeInfo piix4_pm_info = {
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 8ca2032..3e1afe2 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -327,12 +327,38 @@ build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,
                  (void *)fadt, "FACP", sizeof(*fadt), 1, oem_id, oem_table_id);
 }
 
+void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
+                       CPUArchIdList *apic_ids, GArray *entry)
+{
+    int apic_id;
+    AcpiMadtProcessorApic *apic = acpi_data_push(entry, sizeof *apic);
+
+    apic_id = apic_ids->cpus[uid].arch_id;
+    apic->type = ACPI_APIC_PROCESSOR;
+    apic->length = sizeof(*apic);
+    apic->processor_id = uid;
+    apic->local_apic_id = apic_id;
+    if (apic_ids->cpus[uid].cpu != NULL) {
+        apic->flags = cpu_to_le32(1);
+    } else {
+        /* ACPI spec says that LAPIC entry for non present
+         * CPU may be omitted from MADT or it must be marked
+         * as disabled. However omitting non present CPU from
+         * MADT breaks hotplug on linux. So possible CPUs
+         * should be put in MADT but kept disabled.
+         */
+        apic->flags = cpu_to_le32(0);
+    }
+}
+
 static void
 build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
 {
     MachineClass *mc = MACHINE_GET_CLASS(pcms);
     CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(pcms));
     int madt_start = table_data->len;
+    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(pcms->acpi_dev);
+    AcpiDeviceIf *adev = ACPI_DEVICE_IF(pcms->acpi_dev);
 
     AcpiMultipleApicTable *madt;
     AcpiMadtIoApic *io_apic;
@@ -345,24 +371,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
     madt->flags = cpu_to_le32(1);
 
     for (i = 0; i < apic_ids->len; i++) {
-        AcpiMadtProcessorApic *apic = acpi_data_push(table_data, sizeof *apic);
-        int apic_id = apic_ids->cpus[i].arch_id;
-
-        apic->type = ACPI_APIC_PROCESSOR;
-        apic->length = sizeof(*apic);
-        apic->processor_id = i;
-        apic->local_apic_id = apic_id;
-        if (apic_ids->cpus[i].cpu != NULL) {
-            apic->flags = cpu_to_le32(1);
-        } else {
-            /* ACPI spec says that LAPIC entry for non present
-             * CPU may be omitted from MADT or it must be marked
-             * as disabled. However omitting non present CPU from
-             * MADT breaks hotplug on linux. So possible CPUs
-             * should be put in MADT but kept disabled.
-             */
-            apic->flags = cpu_to_le32(0);
-        }
+        adevc->madt_cpu(adev, i, apic_ids, table_data);
     }
     g_free(apic_ids);
 
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 213741b..c1a4f1b 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -714,6 +714,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
     hc->unplug = ich9_pm_device_unplug_cb;
     adevc->ospm_status = ich9_pm_ospm_status;
     adevc->send_event = ich9_send_gpe;
+    adevc->madt_cpu = pc_madt_cpu_entry;
 }
 
 static const TypeInfo ich9_lpc_info = {
diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h
index a0c4a33..da4ef7f 100644
--- a/include/hw/acpi/acpi_dev_interface.h
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -3,6 +3,7 @@
 
 #include "qom/object.h"
 #include "qapi-types.h"
+#include "hw/boards.h"
 
 /* These values are part of guest ABI, and can not be changed */
 typedef enum {
@@ -37,6 +38,10 @@ void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event);
  * ospm_status: returns status of ACPI device objects, reported
  *              via _OST method if device supports it.
  * send_event: inject a specified event into guest
+ * madt_cpu: fills @entry with Interrupt Controller Structure
+ *           for CPU indexed by @uid in @apic_ids array,
+ *           returned structure types are:
+ *           0 - Local APIC, 9 - Local x2APIC, 0xB - GICC
  *
  * Interface is designed for providing unified interface
  * to generic ACPI functionality that could be used without
@@ -50,5 +55,7 @@ typedef struct AcpiDeviceIfClass {
     /* <public> */
     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
     void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev);
+    void (*madt_cpu)(AcpiDeviceIf *adev, int uid,
+                     CPUArchIdList *apic_ids, GArray *entry);
 } AcpiDeviceIfClass;
 #endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 49566c8..9e23929 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -17,6 +17,7 @@
 #include "hw/compat.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/nvdimm.h"
+#include "hw/acpi/acpi_dev_interface.h"
 
 #define HPET_INTCAP "hpet-intcap"
 
@@ -345,6 +346,10 @@ void pc_system_firmware_init(MemoryRegion *rom_memory,
 /* pvpanic.c */
 uint16_t pvpanic_port(void);
 
+/* acpi-build.c */
+void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
+                       CPUArchIdList *apic_ids, GArray *entry);
+
 /* e820 types */
 #define E820_RAM        1
 #define E820_RESERVED   2
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 4b258a6..e8ff38d 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -41,3 +41,4 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
+stub-obj-y += pc_madt_cpu_entry.o
diff --git a/stubs/pc_madt_cpu_entry.c b/stubs/pc_madt_cpu_entry.c
new file mode 100644
index 0000000..427e772
--- /dev/null
+++ b/stubs/pc_madt_cpu_entry.c
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/i386/pc.h"
+
+void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
+                       CPUArchIdList *apic_ids, GArray *entry)
+{
+}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 05/10] acpi: cpuhp: implement hot-add parts of CPU hotplug interface
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (3 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 04/10] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 06/10] acpi: cpuhp: implement hot-remove " Igor Mammedov
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

it adds hw registers needed for handling CPU hot-add and
corresponding AML methods to handle hot-add events on
guest side.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu.c         | 150 +++++++++++++++++++++++++++++++++++++++++++++++++-
 include/hw/acpi/cpu.h |   5 +-
 trace-events          |   4 ++
 3 files changed, 157 insertions(+), 2 deletions(-)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index d99002c..811be8a 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -7,6 +7,13 @@
 #define ACPI_CPU_HOTPLUG_REG_LEN 12
 #define ACPI_CPU_SELECTOR_OFFSET_WR 0
 #define ACPI_CPU_FLAGS_OFFSET_RW 4
+#define ACPI_CPU_CMD_OFFSET_WR 5
+#define ACPI_CPU_CMD_DATA_OFFSET_RW 8
+
+enum {
+    CPHP_GET_NEXT_CPU_WITH_EVENT_CMD = 0,
+    CPHP_CMD_MAX
+};
 
 static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
 {
@@ -22,8 +29,19 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
     switch (addr) {
     case ACPI_CPU_FLAGS_OFFSET_RW: /* pack and return is_* fields */
         val |= cdev->cpu ? 1 : 0;
+        val |= cdev->is_inserting ? 2 : 0;
         trace_cpuhp_acpi_read_flags(cpu_st->selector, val);
         break;
+    case ACPI_CPU_CMD_DATA_OFFSET_RW:
+        switch (cpu_st->command) {
+        case CPHP_GET_NEXT_CPU_WITH_EVENT_CMD:
+           val = cpu_st->selector;
+           break;
+        default:
+           break;
+        }
+        trace_cpuhp_acpi_read_cmd_data(cpu_st->selector, val);
+        break;
     default:
         break;
     }
@@ -34,6 +52,7 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
                            unsigned int size)
 {
     CPUHotplugState *cpu_st = opaque;
+    AcpiCpuStatus *cdev;
 
     assert(cpu_st->dev_count);
 
@@ -49,6 +68,33 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
         cpu_st->selector = data;
         trace_cpuhp_acpi_write_idx(cpu_st->selector);
         break;
+    case ACPI_CPU_FLAGS_OFFSET_RW: /* set is_* fields  */
+        cdev = &cpu_st->devs[cpu_st->selector];
+        if (data & 2) { /* clear insert event */
+            cdev->is_inserting = false;
+            trace_cpuhp_acpi_clear_inserting_evt(cpu_st->selector);
+        }
+        break;
+    case ACPI_CPU_CMD_OFFSET_WR:
+        trace_cpuhp_acpi_write_cmd(cpu_st->selector, data);
+        if (data < CPHP_CMD_MAX) {
+            cpu_st->command = data;
+            if (cpu_st->command == CPHP_GET_NEXT_CPU_WITH_EVENT_CMD) {
+                uint32_t iter = cpu_st->selector;
+
+                do {
+                    cdev = &cpu_st->devs[iter];
+                    if (cdev->is_inserting) {
+                        cpu_st->selector = iter;
+                        trace_cpuhp_acpi_cpu_has_events(cpu_st->selector,
+                            cdev->is_inserting);
+                        break;
+                    }
+                    iter = iter + 1 < cpu_st->dev_count ? iter + 1 : 0;
+                } while (iter != cpu_st->selector);
+            }
+        }
+        break;
     default:
         break;
     }
@@ -111,8 +157,23 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
     }
 
     cdev->cpu = CPU(dev);
+    if (dev->hotplugged) {
+        cdev->is_inserting = true;
+        acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+    }
 }
 
+static const VMStateDescription vmstate_cpuhp_sts = {
+    .name = "CPU hotplug device state",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_BOOL(is_inserting, AcpiCpuStatus),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 const VMStateDescription vmstate_cpu_hotplug = {
     .name = "CPU hotplug state",
     .version_id = 1,
@@ -120,6 +181,9 @@ const VMStateDescription vmstate_cpu_hotplug = {
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
         VMSTATE_UINT32(selector, CPUHotplugState),
+        VMSTATE_UINT8(command, CPUHotplugState),
+        VMSTATE_STRUCT_VARRAY_POINTER_UINT32(devs, CPUHotplugState, dev_count,
+                                             vmstate_cpuhp_sts, AcpiCpuStatus),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -128,13 +192,19 @@ const VMStateDescription vmstate_cpu_hotplug = {
 #define CPUHP_RES_DEVICE  "PRES"
 #define CPU_LOCK          "CPLK"
 #define CPU_STS_METHOD    "CSTA"
+#define CPU_SCAN_METHOD   "CSCN"
+#define CPU_NOTIFY_METHOD "CTFY"
 
 #define CPU_ENABLED       "CPEN"
 #define CPU_SELECTOR      "CSEL"
+#define CPU_COMMAND       "CCMD"
+#define CPU_DATA          "CDAT"
+#define CPU_INSERT_EVENT  "CINS"
 
 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                     hwaddr io_base,
-                    const char *res_root)
+                    const char *res_root,
+                    const char *event_handler_method)
 {
     Aml *ifctx;
     Aml *field;
@@ -147,6 +217,9 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
     MachineClass *mc = MACHINE_GET_CLASS(machine);
     CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(machine);
     char *cphp_res_path = g_strdup_printf("%s." CPUHP_RES_DEVICE, res_root);
+    Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, NULL);
+    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
+    AcpiDeviceIf *adev = ACPI_DEVICE_IF(obj);
 
     cpu_ctrl_dev = aml_device("%s", cphp_res_path);
     {
@@ -173,11 +246,18 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         aml_append(field, aml_reserved_field(ACPI_CPU_FLAGS_OFFSET_RW * 8));
         /* 1 if enabled, read only */
         aml_append(field, aml_named_field(CPU_ENABLED, 1));
+        /* (read) 1 if has a insert event. (write) 1 to clear event */
+        aml_append(field, aml_named_field(CPU_INSERT_EVENT, 1));
+        aml_append(field, aml_reserved_field(6));
+        aml_append(field, aml_named_field(CPU_COMMAND, 8));
         aml_append(cpu_ctrl_dev, field);
 
         field = aml_field("PRST", AML_DWORD_ACC, AML_NOLOCK, AML_PRESERVE);
         /* CPU selector, write only */
         aml_append(field, aml_named_field(CPU_SELECTOR, 32));
+        /* flags + cmd + 2byte align */
+        aml_append(field, aml_reserved_field(4 * 8));
+        aml_append(field, aml_named_field(CPU_DATA, 32));
         aml_append(cpu_ctrl_dev, field);
 
     }
@@ -189,10 +269,27 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         Aml *ctrl_lock = aml_name("%s.%s", cphp_res_path, CPU_LOCK);
         Aml *cpu_selector = aml_name("%s.%s", cphp_res_path, CPU_SELECTOR);
         Aml *is_enabled = aml_name("%s.%s", cphp_res_path, CPU_ENABLED);
+        Aml *cpu_cmd = aml_name("%s.%s", cphp_res_path, CPU_COMMAND);
+        Aml *cpu_data = aml_name("%s.%s", cphp_res_path, CPU_DATA);
+        Aml *ins_evt = aml_name("%s.%s", cphp_res_path, CPU_INSERT_EVENT);
 
         aml_append(cpus_dev, aml_name_decl("_HID", aml_string("ACPI0010")));
         aml_append(cpus_dev, aml_name_decl("_CID", aml_eisaid("PNP0A05")));
 
+        method = aml_method(CPU_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
+        for (i = 0; i < arch_ids->len; i++) {
+            Aml *cpu = aml_name(CPU_NAME_FMT, i);
+            Aml *uid = aml_arg(0);
+            Aml *event = aml_arg(1);
+
+            ifctx = aml_if(aml_equal(uid, aml_int(i)));
+            {
+                aml_append(ifctx, aml_notify(cpu, event));
+            }
+            aml_append(method, ifctx);
+        }
+        aml_append(cpus_dev, method);
+
         method = aml_method(CPU_STS_METHOD, 1, AML_SERIALIZED);
         {
             Aml *idx = aml_arg(0);
@@ -211,10 +308,41 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         }
         aml_append(cpus_dev, method);
 
+        method = aml_method(CPU_SCAN_METHOD, 0, AML_SERIALIZED);
+        {
+            Aml *while_ctx;
+            Aml *has_event = aml_local(0);
+            Aml *dev_chk = aml_int(1);
+            Aml *next_cpu_cmd = aml_int(CPHP_GET_NEXT_CPU_WITH_EVENT_CMD);
+
+            aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(one, has_event));
+            while_ctx = aml_while(aml_equal(has_event, one));
+            {
+                 /* clear loop exit condition, ins_evt check
+                  * will set it to 1 while next_cpu_cmd returns a CPU
+                  * with events */
+                 aml_append(while_ctx, aml_store(zero, has_event));
+                 aml_append(while_ctx, aml_store(next_cpu_cmd, cpu_cmd));
+                 ifctx = aml_if(aml_equal(ins_evt, one));
+                 {
+                     aml_append(ifctx,
+                         aml_call2(CPU_NOTIFY_METHOD, cpu_data, dev_chk));
+                     aml_append(ifctx, aml_store(one, ins_evt));
+                     aml_append(ifctx, aml_store(one, has_event));
+                 }
+                 aml_append(while_ctx, ifctx);
+            }
+            aml_append(method, while_ctx);
+            aml_append(method, aml_release(ctrl_lock));
+        }
+        aml_append(cpus_dev, method);
+
         /* build Processor object for each processor */
         for (i = 0; i < arch_ids->len; i++) {
             Aml *dev;
             Aml *uid = aml_int(i);
+            GArray *madt_buf = g_array_new(0, 1, 1);
             int arch_id = arch_ids->cpus[i].arch_id;
 
             if (opts.apci_1_compatible && arch_id < 255) {
@@ -229,12 +357,32 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
             aml_append(method, aml_return(aml_call1(CPU_STS_METHOD, uid)));
             aml_append(dev, method);
 
+            /* build _MAT object */
+            assert(adevc && adevc->madt_cpu);
+            adevc->madt_cpu(adev, i, arch_ids, madt_buf);
+            switch (madt_buf->data[0]) {
+            case ACPI_APIC_PROCESSOR: {
+                AcpiMadtProcessorApic *apic = (void *)madt_buf->data;
+                apic->flags = cpu_to_le32(1);
+                break;
+            }
+            default:
+                assert(0);
+            }
+            aml_append(dev, aml_name_decl("_MAT",
+                aml_buffer(madt_buf->len, (uint8_t *)madt_buf->data)));
+            g_array_free(madt_buf, true);
+
             aml_append(cpus_dev, dev);
         }
     }
     aml_append(sb_scope, cpus_dev);
     aml_append(table, sb_scope);
 
+    method = aml_method(event_handler_method, 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_call0("\\_SB.CPUS." CPU_SCAN_METHOD));
+    aml_append(table, method);
+
     g_free(cphp_res_path);
     g_free(arch_ids);
 }
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index f345447..55c3166 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -20,11 +20,13 @@
 typedef struct AcpiCpuStatus {
     struct CPUState *cpu;
     uint64_t arch_id;
+    bool is_inserting;
 } AcpiCpuStatus;
 
 typedef struct CPUHotplugState {
     MemoryRegion ctrl_reg;
     uint32_t selector;
+    uint8_t command;
     uint32_t dev_count;
     AcpiCpuStatus *devs;
 } CPUHotplugState;
@@ -41,7 +43,8 @@ typedef struct CPUHotplugFeatures {
 
 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                     hwaddr io_base,
-                    const char *res_root);
+                    const char *res_root,
+                    const char *event_handler_method);
 
 extern const VMStateDescription vmstate_cpu_hotplug;
 #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
diff --git a/trace-events b/trace-events
index 66ec813..fac1f51 100644
--- a/trace-events
+++ b/trace-events
@@ -2169,3 +2169,7 @@ e1000e_vm_state_stopped(void) "VM state is stopped"
 cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32
 cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0x%"PRIx32"] flags: 0x%"PRIx8
 cpuhp_acpi_write_idx(uint32_t idx) "set active cpu idx: 0x%"PRIx32
+cpuhp_acpi_write_cmd(uint32_t idx, uint8_t cmd) "idx[0x%"PRIx32"] cmd: 0x%"PRIx8
+cpuhp_acpi_read_cmd_data(uint32_t idx, uint32_t data) "idx[0x%"PRIx32"] data: 0x%"PRIx32
+cpuhp_acpi_cpu_has_events(uint32_t idx, bool ins) "idx[0x%"PRIx32"] inserting: %d"
+cpuhp_acpi_clear_inserting_evt(uint32_t idx) "idx[0x%"PRIx32"]"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 06/10] acpi: cpuhp: implement hot-remove parts of CPU hotplug interface
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (4 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 05/10] acpi: cpuhp: implement hot-add parts of CPU hotplug interface Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 07/10] acpi: cpuhp: add cpu._OST handling Igor Mammedov
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

it adds hw registers needed for handling CPU hot-remove and
corresponding AML methods to request and eject a CPU with
necessary hotplug callbacks in pc,piix4,ich9 code.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu.c         | 90 ++++++++++++++++++++++++++++++++++++++++++++++++---
 hw/acpi/ich9.c        |  7 ++++
 hw/acpi/piix4.c       |  6 ++++
 hw/i386/pc.c          | 47 +++++++++++++++++++++++++++
 include/hw/acpi/cpu.h |  8 +++++
 trace-events          |  5 ++-
 6 files changed, 158 insertions(+), 5 deletions(-)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 811be8a..483b808 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -30,6 +30,7 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
     case ACPI_CPU_FLAGS_OFFSET_RW: /* pack and return is_* fields */
         val |= cdev->cpu ? 1 : 0;
         val |= cdev->is_inserting ? 2 : 0;
+        val |= cdev->is_removing  ? 4 : 0;
         trace_cpuhp_acpi_read_flags(cpu_st->selector, val);
         break;
     case ACPI_CPU_CMD_DATA_OFFSET_RW:
@@ -73,6 +74,22 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
         if (data & 2) { /* clear insert event */
             cdev->is_inserting = false;
             trace_cpuhp_acpi_clear_inserting_evt(cpu_st->selector);
+        } else if (data & 4) { /* clear remove event */
+            cdev->is_removing = false;
+            trace_cpuhp_acpi_clear_remove_evt(cpu_st->selector);
+        } else if (data & 8) {
+            DeviceState *dev = NULL;
+            HotplugHandler *hotplug_ctrl = NULL;
+
+            if (!cdev->cpu) {
+                trace_cpuhp_acpi_ejecting_invalid_cpu(cpu_st->selector);
+                break;
+            }
+
+            trace_cpuhp_acpi_ejecting_cpu(cpu_st->selector);
+            dev = DEVICE(cdev->cpu);
+            hotplug_ctrl = qdev_get_hotplug_handler(dev);
+            hotplug_handler_unplug(hotplug_ctrl, dev, NULL);
         }
         break;
     case ACPI_CPU_CMD_OFFSET_WR:
@@ -84,10 +101,10 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
 
                 do {
                     cdev = &cpu_st->devs[iter];
-                    if (cdev->is_inserting) {
+                    if (cdev->is_inserting || cdev->is_removing) {
                         cpu_st->selector = iter;
                         trace_cpuhp_acpi_cpu_has_events(cpu_st->selector,
-                            cdev->is_inserting);
+                            cdev->is_inserting, cdev->is_removing);
                         break;
                     }
                     iter = iter + 1 < cpu_st->dev_count ? iter + 1 : 0;
@@ -163,6 +180,34 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
     }
 }
 
+void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+                                CPUHotplugState *cpu_st,
+                                DeviceState *dev, Error **errp)
+{
+    AcpiCpuStatus *cdev;
+
+    cdev = get_cpu_status(cpu_st, dev);
+    if (!cdev) {
+        return;
+    }
+
+    cdev->is_removing = true;
+    acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS);
+}
+
+void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
+                        DeviceState *dev, Error **errp)
+{
+    AcpiCpuStatus *cdev;
+
+    cdev = get_cpu_status(cpu_st, dev);
+    if (!cdev) {
+        return;
+    }
+
+    cdev->cpu = NULL;
+}
+
 static const VMStateDescription vmstate_cpuhp_sts = {
     .name = "CPU hotplug device state",
     .version_id = 1,
@@ -170,6 +215,7 @@ static const VMStateDescription vmstate_cpuhp_sts = {
     .minimum_version_id_old = 1,
     .fields      = (VMStateField[]) {
         VMSTATE_BOOL(is_inserting, AcpiCpuStatus),
+        VMSTATE_BOOL(is_removing, AcpiCpuStatus),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -194,12 +240,15 @@ const VMStateDescription vmstate_cpu_hotplug = {
 #define CPU_STS_METHOD    "CSTA"
 #define CPU_SCAN_METHOD   "CSCN"
 #define CPU_NOTIFY_METHOD "CTFY"
+#define CPU_EJECT_METHOD  "CEJ0"
 
 #define CPU_ENABLED       "CPEN"
 #define CPU_SELECTOR      "CSEL"
 #define CPU_COMMAND       "CCMD"
 #define CPU_DATA          "CDAT"
 #define CPU_INSERT_EVENT  "CINS"
+#define CPU_REMOVE_EVENT  "CRMV"
+#define CPU_EJECT_EVENT   "CEJ0"
 
 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                     hwaddr io_base,
@@ -248,7 +297,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         aml_append(field, aml_named_field(CPU_ENABLED, 1));
         /* (read) 1 if has a insert event. (write) 1 to clear event */
         aml_append(field, aml_named_field(CPU_INSERT_EVENT, 1));
-        aml_append(field, aml_reserved_field(6));
+        /* (read) 1 if has a remove event. (write) 1 to clear event */
+        aml_append(field, aml_named_field(CPU_REMOVE_EVENT, 1));
+        /* initiates device eject, write only */
+        aml_append(field, aml_named_field(CPU_EJECT_EVENT, 1));
+        aml_append(field, aml_reserved_field(4));
         aml_append(field, aml_named_field(CPU_COMMAND, 8));
         aml_append(cpu_ctrl_dev, field);
 
@@ -272,6 +325,8 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         Aml *cpu_cmd = aml_name("%s.%s", cphp_res_path, CPU_COMMAND);
         Aml *cpu_data = aml_name("%s.%s", cphp_res_path, CPU_DATA);
         Aml *ins_evt = aml_name("%s.%s", cphp_res_path, CPU_INSERT_EVENT);
+        Aml *rm_evt = aml_name("%s.%s", cphp_res_path, CPU_REMOVE_EVENT);
+        Aml *ej_evt = aml_name("%s.%s", cphp_res_path, CPU_EJECT_EVENT);
 
         aml_append(cpus_dev, aml_name_decl("_HID", aml_string("ACPI0010")));
         aml_append(cpus_dev, aml_name_decl("_CID", aml_eisaid("PNP0A05")));
@@ -308,18 +363,31 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         }
         aml_append(cpus_dev, method);
 
+        method = aml_method(CPU_EJECT_METHOD, 1, AML_SERIALIZED);
+        {
+            Aml *idx = aml_arg(0);
+
+            aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(idx, cpu_selector));
+            aml_append(method, aml_store(one, ej_evt));
+            aml_append(method, aml_release(ctrl_lock));
+        }
+        aml_append(cpus_dev, method);
+
         method = aml_method(CPU_SCAN_METHOD, 0, AML_SERIALIZED);
         {
+            Aml *else_ctx;
             Aml *while_ctx;
             Aml *has_event = aml_local(0);
             Aml *dev_chk = aml_int(1);
+            Aml *eject_req = aml_int(3);
             Aml *next_cpu_cmd = aml_int(CPHP_GET_NEXT_CPU_WITH_EVENT_CMD);
 
             aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
             aml_append(method, aml_store(one, has_event));
             while_ctx = aml_while(aml_equal(has_event, one));
             {
-                 /* clear loop exit condition, ins_evt check
+                 /* clear loop exit condition, ins_evt/rm_evt checks
                   * will set it to 1 while next_cpu_cmd returns a CPU
                   * with events */
                  aml_append(while_ctx, aml_store(zero, has_event));
@@ -332,6 +400,16 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                      aml_append(ifctx, aml_store(one, has_event));
                  }
                  aml_append(while_ctx, ifctx);
+                 else_ctx = aml_else();
+                 ifctx = aml_if(aml_equal(rm_evt, one));
+                 {
+                     aml_append(ifctx,
+                         aml_call2(CPU_NOTIFY_METHOD, cpu_data, eject_req));
+                     aml_append(ifctx, aml_store(one, rm_evt));
+                     aml_append(ifctx, aml_store(one, has_event));
+                 }
+                 aml_append(else_ctx, ifctx);
+                 aml_append(while_ctx, else_ctx);
             }
             aml_append(method, while_ctx);
             aml_append(method, aml_release(ctrl_lock));
@@ -373,6 +451,10 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                 aml_buffer(madt_buf->len, (uint8_t *)madt_buf->data)));
             g_array_free(madt_buf, true);
 
+            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
+            aml_append(method, aml_call1(CPU_EJECT_METHOD, uid));
+            aml_append(dev, method);
+
             aml_append(cpus_dev, dev);
         }
     }
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 9a81da8..0abe2ce 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -481,6 +481,10 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev,
         acpi_memory_unplug_request_cb(hotplug_dev,
                                       &lpc->pm.acpi_memory_hotplug, dev,
                                       errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
+               !lpc->pm.cpu_hotplug_legacy) {
+        acpi_cpu_unplug_request_cb(hotplug_dev, &lpc->pm.cpuhp_state,
+                                   dev, errp);
     } else {
         error_setg(errp, "acpi: device unplug request for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
@@ -495,6 +499,9 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     if (lpc->pm.acpi_memory_hotplug.is_enabled &&
         object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         acpi_memory_unplug_cb(&lpc->pm.acpi_memory_hotplug, dev, errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
+               !lpc->pm.cpu_hotplug_legacy) {
+        acpi_cpu_unplug_cb(&lpc->pm.cpuhp_state, dev, errp);
     } else {
         error_setg(errp, "acpi: device unplug for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 6d24cb5..8cdc1da 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -378,6 +378,9 @@ static void piix4_device_unplug_request_cb(HotplugHandler *hotplug_dev,
     } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
         acpi_pcihp_device_unplug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev,
                                     errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
+               !s->cpu_hotplug_legacy) {
+        acpi_cpu_unplug_request_cb(hotplug_dev, &s->cpuhp_state, dev, errp);
     } else {
         error_setg(errp, "acpi: device unplug request for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
@@ -392,6 +395,9 @@ static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev,
     if (s->acpi_memory_hotplug.is_enabled &&
         object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         acpi_memory_unplug_cb(&s->acpi_memory_hotplug, dev, errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU) &&
+               !s->cpu_hotplug_legacy) {
+        acpi_cpu_unplug_cb(&s->cpuhp_state, dev, errp);
     } else {
         error_setg(errp, "acpi: device unplug for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 7198ed5..dbfba5c 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1707,6 +1707,49 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
 out:
     error_propagate(errp, local_err);
 }
+static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+                                     DeviceState *dev, Error **errp)
+{
+    HotplugHandlerClass *hhc;
+    Error *local_err = NULL;
+    PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+
+    hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
+    hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+
+    if (local_err) {
+        goto out;
+    }
+
+ out:
+    error_propagate(errp, local_err);
+
+}
+
+static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
+                             DeviceState *dev, Error **errp)
+{
+    HotplugHandlerClass *hhc;
+    Error *local_err = NULL;
+    PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+
+    hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
+    hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
+
+    if (local_err) {
+        goto out;
+    }
+
+    /*
+     * TODO: enable unplug once generic CPU remove bits land
+     * for now guest will be able to eject CPU ACPI wise but
+     * it will come back again on machine reset.
+     */
+    /*  object_unparent(OBJECT(dev)); */
+
+ out:
+    error_propagate(errp, local_err);
+}
 
 static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
                                       DeviceState *dev, Error **errp)
@@ -1723,6 +1766,8 @@ static void pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
 {
     if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         pc_dimm_unplug_request(hotplug_dev, dev, errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+        pc_cpu_unplug_request_cb(hotplug_dev, dev, errp);
     } else {
         error_setg(errp, "acpi: device unplug request for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
@@ -1734,6 +1779,8 @@ static void pc_machine_device_unplug_cb(HotplugHandler *hotplug_dev,
 {
     if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
         pc_dimm_unplug(hotplug_dev, dev, errp);
+    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
+        pc_cpu_unplug_cb(hotplug_dev, dev, errp);
     } else {
         error_setg(errp, "acpi: device unplug for not supported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index 55c3166..f334221 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -21,6 +21,7 @@ typedef struct AcpiCpuStatus {
     struct CPUState *cpu;
     uint64_t arch_id;
     bool is_inserting;
+    bool is_removing;
 } AcpiCpuStatus;
 
 typedef struct CPUHotplugState {
@@ -34,6 +35,13 @@ typedef struct CPUHotplugState {
 void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
                       CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
 
+void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+                                CPUHotplugState *cpu_st,
+                                DeviceState *dev, Error **errp);
+
+void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
+                        DeviceState *dev, Error **errp);
+
 void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
                          CPUHotplugState *state, hwaddr base_addr);
 
diff --git a/trace-events b/trace-events
index fac1f51..53ad387 100644
--- a/trace-events
+++ b/trace-events
@@ -2171,5 +2171,8 @@ cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0x%"PRIx32"] flags: 0x%"
 cpuhp_acpi_write_idx(uint32_t idx) "set active cpu idx: 0x%"PRIx32
 cpuhp_acpi_write_cmd(uint32_t idx, uint8_t cmd) "idx[0x%"PRIx32"] cmd: 0x%"PRIx8
 cpuhp_acpi_read_cmd_data(uint32_t idx, uint32_t data) "idx[0x%"PRIx32"] data: 0x%"PRIx32
-cpuhp_acpi_cpu_has_events(uint32_t idx, bool ins) "idx[0x%"PRIx32"] inserting: %d"
+cpuhp_acpi_cpu_has_events(uint32_t idx, bool ins, bool rm) "idx[0x%"PRIx32"] inserting: %d, removing: %d"
 cpuhp_acpi_clear_inserting_evt(uint32_t idx) "idx[0x%"PRIx32"]"
+cpuhp_acpi_clear_remove_evt(uint32_t idx) "idx[0x%"PRIx32"]"
+cpuhp_acpi_ejecting_invalid_cpu(uint32_t idx) "0x%"PRIx32
+cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 07/10] acpi: cpuhp: add cpu._OST handling
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (5 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 06/10] acpi: cpuhp: implement hot-remove " Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 08/10] pc: use new CPU hotplug interface since 2.7 machine type Igor Mammedov
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

it adds HW and AML parts for CPU_Device._OST method
handling to allow OSPM reports status of hot-(un)plug
operation.
And extends QMP command query-acpi-ospm-status to report
CPU's OST info along with already reported PC-DIMM devices.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu.c         | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/acpi/ich9.c        |  3 ++
 hw/acpi/piix4.c       |  3 ++
 include/hw/acpi/cpu.h |  4 +++
 qapi-schema.json      |  3 +-
 trace-events          |  2 ++
 6 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 483b808..401ac0d 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -2,6 +2,7 @@
 #include "hw/boards.h"
 #include "hw/acpi/cpu.h"
 #include "qapi/error.h"
+#include "qapi-event.h"
 #include "trace.h"
 
 #define ACPI_CPU_HOTPLUG_REG_LEN 12
@@ -12,9 +13,42 @@
 
 enum {
     CPHP_GET_NEXT_CPU_WITH_EVENT_CMD = 0,
+    CPHP_OST_EVENT_CMD = 1,
+    CPHP_OST_STATUS_CMD = 2,
     CPHP_CMD_MAX
 };
 
+static ACPIOSTInfo *acpi_cpu_device_status(int idx, AcpiCpuStatus *cdev)
+{
+    ACPIOSTInfo *info = g_new0(ACPIOSTInfo, 1);
+
+    info->slot_type = ACPI_SLOT_TYPE_CPU;
+    info->slot = g_strdup_printf("%d", idx);
+    info->source = cdev->ost_event;
+    info->status = cdev->ost_status;
+    if (cdev->cpu) {
+        DeviceState *dev = DEVICE(cdev->cpu);
+        if (dev->id) {
+            info->device = g_strdup(dev->id);
+            info->has_device = true;
+        }
+    }
+    return info;
+}
+
+void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list)
+{
+    int i;
+
+    for (i = 0; i < cpu_st->dev_count; i++) {
+        ACPIOSTInfoList *elem = g_new0(ACPIOSTInfoList, 1);
+        elem->value = acpi_cpu_device_status(i, &cpu_st->devs[i]);
+        elem->next = NULL;
+        **list = elem;
+        *list = &elem->next;
+    }
+}
+
 static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size)
 {
     uint64_t val = 0;
@@ -54,6 +88,7 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
 {
     CPUHotplugState *cpu_st = opaque;
     AcpiCpuStatus *cdev;
+    ACPIOSTInfo *info;
 
     assert(cpu_st->dev_count);
 
@@ -112,6 +147,28 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data,
             }
         }
         break;
+    case ACPI_CPU_CMD_DATA_OFFSET_RW:
+        switch (cpu_st->command) {
+        case CPHP_OST_EVENT_CMD: {
+           cdev = &cpu_st->devs[cpu_st->selector];
+           cdev->ost_event = data;
+           trace_cpuhp_acpi_write_ost_ev(cpu_st->selector, cdev->ost_event);
+           break;
+        }
+        case CPHP_OST_STATUS_CMD: {
+           cdev = &cpu_st->devs[cpu_st->selector];
+           cdev->ost_status = data;
+           info = acpi_cpu_device_status(cpu_st->selector, cdev);
+           qapi_event_send_acpi_device_ost(info, &error_abort);
+           qapi_free_ACPIOSTInfo(info);
+           trace_cpuhp_acpi_write_ost_status(cpu_st->selector,
+                                             cdev->ost_status);
+           break;
+        }
+        default:
+           break;
+        }
+        break;
     default:
         break;
     }
@@ -216,6 +273,8 @@ static const VMStateDescription vmstate_cpuhp_sts = {
     .fields      = (VMStateField[]) {
         VMSTATE_BOOL(is_inserting, AcpiCpuStatus),
         VMSTATE_BOOL(is_removing, AcpiCpuStatus),
+        VMSTATE_UINT32(ost_event, AcpiCpuStatus),
+        VMSTATE_UINT32(ost_status, AcpiCpuStatus),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -241,6 +300,7 @@ const VMStateDescription vmstate_cpu_hotplug = {
 #define CPU_SCAN_METHOD   "CSCN"
 #define CPU_NOTIFY_METHOD "CTFY"
 #define CPU_EJECT_METHOD  "CEJ0"
+#define CPU_OST_METHOD    "COST"
 
 #define CPU_ENABLED       "CPEN"
 #define CPU_SELECTOR      "CSEL"
@@ -416,6 +476,22 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         }
         aml_append(cpus_dev, method);
 
+        method = aml_method(CPU_OST_METHOD, 4, AML_SERIALIZED);
+        {
+            Aml *uid = aml_arg(0);
+            Aml *ev_cmd = aml_int(CPHP_OST_EVENT_CMD);
+            Aml *st_cmd = aml_int(CPHP_OST_STATUS_CMD);
+
+            aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(uid, cpu_selector));
+            aml_append(method, aml_store(ev_cmd, cpu_cmd));
+            aml_append(method, aml_store(aml_arg(1), cpu_data));
+            aml_append(method, aml_store(st_cmd, cpu_cmd));
+            aml_append(method, aml_store(aml_arg(2), cpu_data));
+            aml_append(method, aml_release(ctrl_lock));
+        }
+        aml_append(cpus_dev, method);
+
         /* build Processor object for each processor */
         for (i = 0; i < arch_ids->len; i++) {
             Aml *dev;
@@ -455,6 +531,12 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
             aml_append(method, aml_call1(CPU_EJECT_METHOD, uid));
             aml_append(dev, method);
 
+            method = aml_method("_OST", 3, AML_SERIALIZED);
+            aml_append(method,
+                aml_call4(CPU_OST_METHOD, uid, aml_arg(0),
+                          aml_arg(1), aml_arg(2))
+            );
+            aml_append(dev, method);
             aml_append(cpus_dev, dev);
         }
     }
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 0abe2ce..d12cc62 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -513,4 +513,7 @@ void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
     ICH9LPCState *s = ICH9_LPC_DEVICE(adev);
 
     acpi_memory_ospm_status(&s->pm.acpi_memory_hotplug, list);
+    if (!s->pm.cpu_hotplug_legacy) {
+        acpi_cpu_ospm_status(&s->pm.cpuhp_state, list);
+    }
 }
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 8cdc1da..858244a 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -616,6 +616,9 @@ static void piix4_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list)
     PIIX4PMState *s = PIIX4_PM(adev);
 
     acpi_memory_ospm_status(&s->acpi_memory_hotplug, list);
+    if (!s->cpu_hotplug_legacy) {
+        acpi_cpu_ospm_status(&s->cpuhp_state, list);
+    }
 }
 
 static void piix4_send_gpe(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index f334221..980a83c 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -22,6 +22,8 @@ typedef struct AcpiCpuStatus {
     uint64_t arch_id;
     bool is_inserting;
     bool is_removing;
+    uint32_t ost_event;
+    uint32_t ost_status;
 } AcpiCpuStatus;
 
 typedef struct CPUHotplugState {
@@ -54,6 +56,8 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
                     const char *res_root,
                     const char *event_handler_method);
 
+void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
+
 extern const VMStateDescription vmstate_cpu_hotplug;
 #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
     VMSTATE_STRUCT(cpuhp, state, 1, \
diff --git a/qapi-schema.json b/qapi-schema.json
index 40b1db4..d9e8c1b 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -4079,8 +4079,9 @@
 ## @ACPISlotType
 #
 # @DIMM: memory slot
+# @CPU: logical CPU slot (since 2.7)
 #
-{ 'enum': 'ACPISlotType', 'data': [ 'DIMM' ] }
+{ 'enum': 'ACPISlotType', 'data': [ 'DIMM', 'CPU' ] }
 
 ## @ACPIOSTInfo
 #
diff --git a/trace-events b/trace-events
index 53ad387..f4dbedb 100644
--- a/trace-events
+++ b/trace-events
@@ -2176,3 +2176,5 @@ cpuhp_acpi_clear_inserting_evt(uint32_t idx) "idx[0x%"PRIx32"]"
 cpuhp_acpi_clear_remove_evt(uint32_t idx) "idx[0x%"PRIx32"]"
 cpuhp_acpi_ejecting_invalid_cpu(uint32_t idx) "0x%"PRIx32
 cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32
+cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32
+cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 08/10] pc: use new CPU hotplug interface since 2.7 machine type
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (6 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 07/10] acpi: cpuhp: add cpu._OST handling Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase Igor Mammedov
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

For compatibility reasons PC/Q35 will start with legacy
CPU hotplug interface by default but with new CPU hotplug
AML code since 2.7 machine type. That way legacy firmware
that doesn't use QEMU generated ACPI tables will be
able to continue using legacy CPU hotplug interface.

While new machine type, with firmware supporting QEMU
provided ACPI tables, will generate new CPU hotplug AML,
which will switch to new CPU hotplug interface when
guest OS executes its _INI method on ACPI tables
loading.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu.c                 |  9 +++++++++
 hw/acpi/cpu_hotplug.c         | 21 ++++++++++++++++++++-
 hw/acpi/ich9.c                | 33 +++++++++++++++++++++++++++++++++
 hw/acpi/piix4.c               | 32 ++++++++++++++++++++++++++++++++
 hw/i386/acpi-build.c          | 12 +++++++++++-
 hw/i386/pc_piix.c             |  2 ++
 hw/i386/pc_q35.c              |  2 ++
 include/hw/acpi/cpu.h         |  1 +
 include/hw/acpi/cpu_hotplug.h |  6 ++++++
 include/hw/i386/pc.h          |  2 ++
 10 files changed, 118 insertions(+), 2 deletions(-)

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 401ac0d..c13b65c 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -373,6 +373,15 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
         aml_append(field, aml_named_field(CPU_DATA, 32));
         aml_append(cpu_ctrl_dev, field);
 
+        if (opts.has_legacy_cphp) {
+            method = aml_method("_INI", 0, AML_SERIALIZED);
+            /* switch off legacy CPU hotplug HW and use new one,
+             * on reboot system is in new mode and writing 0
+             * in CPU_SELECTOR selects BSP, which is NOP at
+             * the time _INI is called */
+            aml_append(method, aml_store(zero, aml_name(CPU_SELECTOR)));
+            aml_append(cpu_ctrl_dev, method);
+        }
     }
     aml_append(sb_scope, cpu_ctrl_dev);
 
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index fe75bd9..e19d902 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -34,7 +34,15 @@ static uint64_t cpu_status_read(void *opaque, hwaddr addr, unsigned int size)
 static void cpu_status_write(void *opaque, hwaddr addr, uint64_t data,
                              unsigned int size)
 {
-    /* TODO: implement VCPU removal on guest signal that CPU can be removed */
+    /* firmware never used to write in CPU present bitmap so use
+       this fact as means to switch QEMU into modern CPU hotplug
+       mode by writing 0 at the beginning of legacy CPU bitmap
+     */
+    if (addr == 0 && data == 0) {
+        AcpiCpuHotplug *cpus = opaque;
+        object_property_set_bool(cpus->device, false, "cpu-hotplug-legacy",
+                                 &error_abort);
+    }
 }
 
 static const MemoryRegionOps AcpiCpuHotplug_ops = {
@@ -83,6 +91,17 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
     memory_region_init_io(&gpe_cpu->io, owner, &AcpiCpuHotplug_ops,
                           gpe_cpu, "acpi-cpu-hotplug", ACPI_GPE_PROC_LEN);
     memory_region_add_subregion(parent, base, &gpe_cpu->io);
+    gpe_cpu->device = owner;
+}
+
+void acpi_switch_to_modern_cphp(AcpiCpuHotplug *gpe_cpu,
+                                CPUHotplugState *cpuhp_state,
+                                uint16_t io_port)
+{
+    MemoryRegion *parent = pci_address_space_io(PCI_DEVICE(gpe_cpu->device));
+
+    memory_region_del_subregion(parent, &gpe_cpu->io);
+    cpu_hotplug_hw_init(parent, gpe_cpu->device, cpuhp_state, io_port);
 }
 
 void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index d12cc62..e5a3c18 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -189,6 +189,33 @@ static const VMStateDescription vmstate_tco_io_state = {
     }
 };
 
+static bool vmstate_test_use_cpuhp(void *opaque)
+{
+    ICH9LPCPMRegs *s = opaque;
+    return !s->cpu_hotplug_legacy;
+}
+
+static int vmstate_cpuhp_pre_load(void *opaque)
+{
+    ICH9LPCPMRegs *s = opaque;
+    Object *obj = OBJECT(s->gpe_cpu.device);
+    object_property_set_bool(obj, false, "cpu-hotplug-legacy", &error_abort);
+    return 0;
+}
+
+static const VMStateDescription vmstate_cpuhp_state = {
+    .name = "ich9_pm/cpuhp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .needed = vmstate_test_use_cpuhp,
+    .pre_load = vmstate_cpuhp_pre_load,
+    .fields      = (VMStateField[]) {
+        VMSTATE_CPU_HOTPLUG(cpuhp_state, ICH9LPCPMRegs),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 const VMStateDescription vmstate_ich9_pm = {
     .name = "ich9_pm",
     .version_id = 1,
@@ -209,6 +236,7 @@ const VMStateDescription vmstate_ich9_pm = {
     .subsections = (const VMStateDescription*[]) {
         &vmstate_memhp_state,
         &vmstate_tco_io_state,
+        &vmstate_cpuhp_state,
         NULL
     }
 };
@@ -318,6 +346,11 @@ static void ich9_pm_set_cpu_hotplug_legacy(Object *obj, bool value,
 {
     ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
 
+    assert(!value);
+    if (s->pm.cpu_hotplug_legacy && value == false) {
+        acpi_switch_to_modern_cphp(&s->pm.gpe_cpu, &s->pm.cpuhp_state,
+                                   ICH9_CPU_HOTPLUG_IO_BASE);
+    }
     s->pm.cpu_hotplug_legacy = value;
 }
 
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 858244a..2adc246 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -276,6 +276,32 @@ static const VMStateDescription vmstate_memhp_state = {
     }
 };
 
+static bool vmstate_test_use_cpuhp(void *opaque)
+{
+    PIIX4PMState *s = opaque;
+    return !s->cpu_hotplug_legacy;
+}
+
+static int vmstate_cpuhp_pre_load(void *opaque)
+{
+    Object *obj = OBJECT(opaque);
+    object_property_set_bool(obj, false, "cpu-hotplug-legacy", &error_abort);
+    return 0;
+}
+
+static const VMStateDescription vmstate_cpuhp_state = {
+    .name = "piix4_pm/cpuhp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .needed = vmstate_test_use_cpuhp,
+    .pre_load = vmstate_cpuhp_pre_load,
+    .fields      = (VMStateField[]) {
+        VMSTATE_CPU_HOTPLUG(cpuhp_state, PIIX4PMState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 /* qemu-kvm 1.2 uses version 3 but advertised as 2
  * To support incoming qemu-kvm 1.2 migration, change version_id
  * and minimum_version_id to 2 below (which breaks migration from
@@ -310,6 +336,7 @@ static const VMStateDescription vmstate_acpi = {
     },
     .subsections = (const VMStateDescription*[]) {
          &vmstate_memhp_state,
+         &vmstate_cpuhp_state,
          NULL
     }
 };
@@ -585,6 +612,11 @@ static void piix4_set_cpu_hotplug_legacy(Object *obj, bool value, Error **errp)
 {
     PIIX4PMState *s = PIIX4_PM(obj);
 
+    assert(!value);
+    if (s->cpu_hotplug_legacy && value == false) {
+        acpi_switch_to_modern_cphp(&s->gpe_cpu, &s->cpuhp_state,
+                                   PIIX4_CPU_HOTPLUG_IO_BASE);
+    }
     s->cpu_hotplug_legacy = value;
 }
 
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 3e1afe2..0642cf8 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -33,6 +33,7 @@
 #include "hw/timer/hpet.h"
 #include "hw/acpi/acpi-defs.h"
 #include "hw/acpi/acpi.h"
+#include "hw/acpi/cpu.h"
 #include "hw/nvram/fw_cfg.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/loader.h"
@@ -1883,6 +1884,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
     GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free);
     GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free);
     PCMachineState *pcms = PC_MACHINE(machine);
+    PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine);
     uint32_t nr_mem = machine->ram_slots;
     int root_bus_limit = 0xFF;
     PCIBus *bus = NULL;
@@ -1938,7 +1940,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
         build_q35_pci0_int(dsdt);
     }
 
-    build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
+    if (pcmc->legacy_cpu_hotplug) {
+        build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
+    } else {
+        CPUHotplugFeatures opts = {
+            .apci_1_compatible = true, .has_legacy_cphp = true
+        };
+        build_cpus_aml(dsdt, machine, opts, pm->cpu_hp_io_base,
+                       "\\_SB.PCI0", "\\_GPE._E02");
+    }
     build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
 
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 53bc968..c7d70af 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -445,9 +445,11 @@ DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL,
 
 static void pc_i440fx_2_6_machine_options(MachineClass *m)
 {
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
     pc_i440fx_2_7_machine_options(m);
     m->is_default = 0;
     m->alias = NULL;
+    pcmc->legacy_cpu_hotplug = true;
     SET_MACHINE_COMPAT(m, PC_COMPAT_2_6);
 }
 
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index e4b541f..97a8835 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -294,8 +294,10 @@ DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL,
 
 static void pc_q35_2_6_machine_options(MachineClass *m)
 {
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
     pc_q35_2_7_machine_options(m);
     m->alias = NULL;
+    pcmc->legacy_cpu_hotplug = true;
     SET_MACHINE_COMPAT(m, PC_COMPAT_2_6);
 }
 
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index 980a83c..89ce172 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -49,6 +49,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
 
 typedef struct CPUHotplugFeatures {
     bool apci_1_compatible;
+    bool has_legacy_cphp;
 } CPUHotplugFeatures;
 
 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 6fef67e..b995ef2 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -16,8 +16,10 @@
 #include "hw/acpi/pc-hotplug.h"
 #include "hw/acpi/aml-build.h"
 #include "hw/hotplug.h"
+#include "hw/acpi/cpu.h"
 
 typedef struct AcpiCpuHotplug {
+    Object *device;
     MemoryRegion io;
     uint8_t sts[ACPI_GPE_PROC_LEN];
 } AcpiCpuHotplug;
@@ -28,6 +30,10 @@ void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
 void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
                                   AcpiCpuHotplug *gpe_cpu, uint16_t base);
 
+void acpi_switch_to_modern_cphp(AcpiCpuHotplug *gpe_cpu,
+                                CPUHotplugState *cpuhp_state,
+                                uint16_t io_port);
+
 void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
                                   uint16_t io_base);
 #endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9e23929..884224e 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -137,6 +137,8 @@ struct PCMachineClass {
 
     /* TSC rate migration: */
     bool save_tsc_khz;
+    /* generate legacy CPU hotplug AML */
+    bool legacy_cpu_hotplug;
 };
 
 #define TYPE_PC_MACHINE "generic-pc-machine"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (7 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 08/10] pc: use new CPU hotplug interface since 2.7 machine type Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-23 13:08   ` Marcel Apfelbaum
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 10/10] pc: acpi: drop intermediate PCMachineState.node_cpu Igor Mammedov
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

Test with:

    -smp 2,cores=3,sockets=2,maxcpus=6

to capture sparse APIC ID values that default
AMD CPU has in above configuration.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 16d11aa..a7abe91 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
     free_test_data(&data);
 }
 
+static void test_acpi_piix4_tcg_cphp(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_PC;
+    data.variant = ".cphp";
+    test_acpi_one("-machine accel=tcg"
+                  " -smp 2,cores=3,sockets=2,maxcpus=6",
+                  &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_q35_tcg_cphp(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".cphp";
+    test_acpi_one("-machine q35,accel=tcg"
+                  " -smp 2,cores=3,sockets=2,maxcpus=6",
+                  &data);
+    free_test_data(&data);
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -804,6 +830,8 @@ int main(int argc, char *argv[])
         qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
         qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
         qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
+        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
+        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
     }
     ret = g_test_run();
     boot_sector_cleanup(disk);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 10/10] pc: acpi: drop intermediate PCMachineState.node_cpu
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (8 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase Igor Mammedov
@ 2016-06-16 16:55 ` Igor Mammedov
  2016-06-21  7:12 ` [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
  2016-06-24  6:18 ` [Qemu-devel] [PATCH v2 11/10] pc: acpi: update expected DSDT blobs with new CPU hotplug AML Igor Mammedov
  11 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-16 16:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake, marcel

PCMachineState.node_cpu was used for mapping APIC ID
to numa node id as CPU entries in SRAT used to be
built on sparse APIC ID bitmap (up to apic_id_limit).
However since commit
  5803fce pc: acpi: SRAT: create only valid processor lapic entries
CPU entries in SRAT aren't build using apic bitmap
but using 0..maxcpus index instead which is also used
for creating numa_info[x].node_cpu map.
So instead of doing useless intermediate conversion from
  1. node by cpu index -> node by apic id
       i.e. numa_info[x].node_cpu -> PCMachineState.node_cpu
  2. apic id -> srat entry PMX
       PCMachineState.node_cpu[apic id] -> PMX value
use numa_info[x].node_cpu map directly like ARM does and do
  1. numa_info[x].node_cpu -> PMX value using index
     in range 0..maxcpus
and drop not necessary PCMachineState.node_cpu and related
code.

That also removes the last (not counting legacy hotplug)
dependency of ACPI code on apic_id_limit and need to allocate
huge sparse PCMachineState.node_cpu array in case of 32-bit
APIC IDs.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c | 11 ++++++++---
 hw/i386/pc.c         | 16 +---------------
 include/hw/i386/pc.h |  1 -
 3 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 0642cf8..3f7e9fb 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -44,6 +44,7 @@
 #include "hw/acpi/tpm.h"
 #include "sysemu/tpm_backend.h"
 #include "hw/timer/mc146818rtc_regs.h"
+#include "sysemu/numa.h"
 
 /* Supported chipsets: */
 #include "hw/acpi/piix4.h"
@@ -2316,7 +2317,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
     AcpiSratMemoryAffinity *numamem;
 
     int i;
-    uint64_t curnode;
     int srat_start, numa_start, slots;
     uint64_t mem_len, mem_base, next_base;
     MachineClass *mc = MACHINE_GET_CLASS(machine);
@@ -2332,14 +2332,19 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
     srat->reserved1 = cpu_to_le32(1);
 
     for (i = 0; i < apic_ids->len; i++) {
+        int j;
         int apic_id = apic_ids->cpus[i].arch_id;
 
         core = acpi_data_push(table_data, sizeof *core);
         core->type = ACPI_SRAT_PROCESSOR_APIC;
         core->length = sizeof(*core);
         core->local_apic_id = apic_id;
-        curnode = pcms->node_cpu[apic_id];
-        core->proximity_lo = curnode;
+        for (j = 0; j < nb_numa_nodes; j++) {
+            if (test_bit(i, numa_info[j].node_cpu)) {
+                core->proximity_lo = j;
+                break;
+            }
+        }
         memset(core->proximity_hi, 0, 3);
         core->local_sapic_eid = 0;
         core->flags = cpu_to_le32(1);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index dbfba5c..b8fead3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1179,7 +1179,7 @@ void pc_machine_done(Notifier *notifier, void *data)
 
 void pc_guest_info_init(PCMachineState *pcms)
 {
-    int i, j;
+    int i;
 
     pcms->apic_xrupt_override = kvm_allows_irq0_override();
     pcms->numa_nodes = nb_numa_nodes;
@@ -1189,20 +1189,6 @@ void pc_guest_info_init(PCMachineState *pcms)
         pcms->node_mem[i] = numa_info[i].node_mem;
     }
 
-    pcms->node_cpu = g_malloc0(pcms->apic_id_limit *
-                                     sizeof *pcms->node_cpu);
-
-    for (i = 0; i < max_cpus; i++) {
-        unsigned int apic_id = x86_cpu_apic_id_from_index(i);
-        assert(apic_id < pcms->apic_id_limit);
-        for (j = 0; j < nb_numa_nodes; j++) {
-            if (test_bit(i, numa_info[j].node_cpu)) {
-                pcms->node_cpu[apic_id] = j;
-                break;
-            }
-        }
-    }
-
     pcms->machine_done.notify = pc_machine_done;
     qemu_add_machine_init_done_notifier(&pcms->machine_done);
 }
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 884224e..948ed0c 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -72,7 +72,6 @@ struct PCMachineState {
     /* NUMA information: */
     uint64_t numa_nodes;
     uint64_t *node_mem;
-    uint64_t *node_cpu;
 };
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (9 preceding siblings ...)
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 10/10] pc: acpi: drop intermediate PCMachineState.node_cpu Igor Mammedov
@ 2016-06-21  7:12 ` Igor Mammedov
  2016-06-21 16:50   ` Michael S. Tsirkin
  2016-06-24  6:18 ` [Qemu-devel] [PATCH v2 11/10] pc: acpi: update expected DSDT blobs with new CPU hotplug AML Igor Mammedov
  11 siblings, 1 reply; 24+ messages in thread
From: Igor Mammedov @ 2016-06-21  7:12 UTC (permalink / raw)
  To: mst; +Cc: qemu-devel, ehabkost, marcel, pbonzini, rth

On Thu, 16 Jun 2016 18:55:33 +0200
Igor Mammedov <imammedo@redhat.com> wrote:

Michael,
Do you think that this series will make into 2.7?

> Changelog:                                                                       
>  v1->v2:                                                                         
>   - dropped consolidate legacy ACPI CPU hotplug as they are in master
> by now     
>   - pc: start with legacy hotplug and let 2.7 machine type and
> older to switch inot new hotplug mode. That way legacy BIOS
> will still work fine as it uses built in ACPI tables and will
> continue to use legacy CPU hotplug
> interface.                                         
>   - poll for CPU objects with events (insert/remove) instead
> of looping over all CPUs to find CPUs with
> events.                              
>   - drop dynamic PXM support as it could be implemented in static
> way at acpi tabels build time. It will be an additional series on top
> of this.   
>   - resplit patches on basic present CPU support, hot-add and
> hot-remove parts
> Patches: 1-7: add new CPU hotplug
> impl. 8: makes 2.7 machine type to use new AML code
> that will switch piix4/ich9 into new mode
> + switching logic with migration glue for piix4/ich9                  
>           9: drops the last dependency in ACPI parts on
> apic_id_limit sized
> map.
> RFC->v1:                                                                        
>   - drop machine.cpu-hotplug property and leave CPU
> hotplug always enabled as it used to
> be. (it also simplifies, series a
> bit)                                           
>   - reshuffle/squash some patches to make series
> bisectable wrt 'make check'
> failures                                                    
>   - add doc comment in qapi
> schema                                               
>   - fix 'make check' error for mips target, disableCPU
> hotplug code path in piix4_pm for
> mips                                               
>   - drop some intermediate expected ACPI tables
> updates                          
>   - replace _MAT method with named buffer
> object 
> Current ACPI interface for CPU hotplug supports
> hoti-adding only upto 255 CPUs and lacks means to convey
> additional information needed _OST methods
> support. Also being bitmap based with bit position specifying APIC
> ID it doesn't scale up well for 32-bit APIC IDs that will
> come with x2APIC
> support. 
> So add another QEMU-guest interface using as model
> memory-hotplug. New interface will be used since 2.7 machine types
> and will
> support:                                                                         
>     - more than 255 CPUs with 32-bit APIC ID
> value                               
>     - a registers set to communicate OST
> information (extendable without breaking IO
> layout)                                    
>     - possible to reuse for ARM's 'virt' machine
> type with minimal tweaks (add init for MMIO,
> add ACPI hooks on CPU hotplug path, MADT
> generation) 
>                                                                                  
> Tested with following guests: RHEL7, WS2003EEx64,
> WS2012R2x64                    
>  * unplug is tested only with RHEL7 as Windows doesn't support
> it.               
>  * tested that migration works as
> well. 
> git tree for
> testing: git@github.com:imammedo/qemu.git
> modern_cpu_hotplug_v2
> viewing:
> https://github.com/imammedo/qemu/commits/modern_cpu_hotplug_v2               
> 
> Igor Mammedov (10):
>   docs: update ACPI CPU hotplug spec with new protocol
>   pc: piix4/ich9: add 'cpu-hotplug-legacy' property
>   acpi: cpuhp: add CPU devices AML with _STA method
>   pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
>   acpi: cpuhp: implement hot-add parts of CPU hotplug interface
>   acpi: cpuhp: implement hot-remove parts of CPU hotplug interface
>   acpi: cpuhp: add cpu._OST handling
>   pc: use new CPU hotplug interface since 2.7 machine type
>   tests: acpi: add CPU hotplug testcase
>   pc: acpi: drop intermediate PCMachineState.node_cpu
> 
>  docs/specs/acpi_cpu_hotplug.txt      |  94 +++++-
>  hw/acpi/Makefile.objs                |   1 +
>  hw/acpi/cpu.c                        | 561
> +++++++++++++++++++++++++++++++++++
> hw/acpi/cpu_hotplug.c                |  21 +-
> hw/acpi/ich9.c                       |  69 ++++-
> hw/acpi/piix4.c                      |  71 ++++-
> hw/i386/acpi-build.c                 |  68 +++--
> hw/i386/pc.c                         |  63 +++-
> hw/i386/pc_piix.c                    |   2 +
> hw/i386/pc_q35.c                     |   2 +
> hw/isa/lpc_ich9.c                    |   1 +
> include/hw/acpi/acpi_dev_interface.h |   7 +
> include/hw/acpi/cpu.h                |  67 +++++
> include/hw/acpi/cpu_hotplug.h        |   6 +
> include/hw/acpi/ich9.h               |   3 +
> include/hw/i386/pc.h                 |   8 +-
> qapi-schema.json                     |   3 +-
> stubs/Makefile.objs                  |   1 +
> stubs/pc_madt_cpu_entry.c            |   7 +
> tests/bios-tables-test.c             |  28 ++
> trace-events                         |  14 + 21 files changed, 1043
> insertions(+), 54 deletions(-) create mode 100644 hw/acpi/cpu.c
>  create mode 100644 include/hw/acpi/cpu.h
>  create mode 100644 stubs/pc_madt_cpu_entry.c
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs
  2016-06-21  7:12 ` [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
@ 2016-06-21 16:50   ` Michael S. Tsirkin
  2016-06-21 16:58     ` Igor Mammedov
  2016-06-23 11:07     ` Igor Mammedov
  0 siblings, 2 replies; 24+ messages in thread
From: Michael S. Tsirkin @ 2016-06-21 16:50 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, ehabkost, marcel, pbonzini, rth

On Tue, Jun 21, 2016 at 09:12:38AM +0200, Igor Mammedov wrote:
> On Thu, 16 Jun 2016 18:55:33 +0200
> Igor Mammedov <imammedo@redhat.com> wrote:
> 
> Michael,
> Do you think that this series will make into 2.7?

Yes, I think it will. I'll try to prioritize review.

> > Changelog:                                                                       
> >  v1->v2:                                                                         
> >   - dropped consolidate legacy ACPI CPU hotplug as they are in master
> > by now     
> >   - pc: start with legacy hotplug and let 2.7 machine type and
> > older to switch inot new hotplug mode. That way legacy BIOS
> > will still work fine as it uses built in ACPI tables and will
> > continue to use legacy CPU hotplug
> > interface.                                         
> >   - poll for CPU objects with events (insert/remove) instead
> > of looping over all CPUs to find CPUs with
> > events.                              
> >   - drop dynamic PXM support as it could be implemented in static
> > way at acpi tabels build time. It will be an additional series on top
> > of this.   
> >   - resplit patches on basic present CPU support, hot-add and
> > hot-remove parts
> > Patches: 1-7: add new CPU hotplug
> > impl. 8: makes 2.7 machine type to use new AML code
> > that will switch piix4/ich9 into new mode
> > + switching logic with migration glue for piix4/ich9                  
> >           9: drops the last dependency in ACPI parts on
> > apic_id_limit sized
> > map.
> > RFC->v1:                                                                        
> >   - drop machine.cpu-hotplug property and leave CPU
> > hotplug always enabled as it used to
> > be. (it also simplifies, series a
> > bit)                                           
> >   - reshuffle/squash some patches to make series
> > bisectable wrt 'make check'
> > failures                                                    
> >   - add doc comment in qapi
> > schema                                               
> >   - fix 'make check' error for mips target, disableCPU
> > hotplug code path in piix4_pm for
> > mips                                               
> >   - drop some intermediate expected ACPI tables
> > updates                          
> >   - replace _MAT method with named buffer
> > object 
> > Current ACPI interface for CPU hotplug supports
> > hoti-adding only upto 255 CPUs and lacks means to convey
> > additional information needed _OST methods
> > support. Also being bitmap based with bit position specifying APIC
> > ID it doesn't scale up well for 32-bit APIC IDs that will
> > come with x2APIC
> > support. 
> > So add another QEMU-guest interface using as model
> > memory-hotplug. New interface will be used since 2.7 machine types
> > and will
> > support:                                                                         
> >     - more than 255 CPUs with 32-bit APIC ID
> > value                               
> >     - a registers set to communicate OST
> > information (extendable without breaking IO
> > layout)                                    
> >     - possible to reuse for ARM's 'virt' machine
> > type with minimal tweaks (add init for MMIO,
> > add ACPI hooks on CPU hotplug path, MADT
> > generation) 
> >                                                                                  
> > Tested with following guests: RHEL7, WS2003EEx64,
> > WS2012R2x64                    
> >  * unplug is tested only with RHEL7 as Windows doesn't support
> > it.               
> >  * tested that migration works as
> > well. 
> > git tree for
> > testing: git@github.com:imammedo/qemu.git
> > modern_cpu_hotplug_v2
> > viewing:
> > https://github.com/imammedo/qemu/commits/modern_cpu_hotplug_v2               
> > 
> > Igor Mammedov (10):
> >   docs: update ACPI CPU hotplug spec with new protocol
> >   pc: piix4/ich9: add 'cpu-hotplug-legacy' property
> >   acpi: cpuhp: add CPU devices AML with _STA method
> >   pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
> >   acpi: cpuhp: implement hot-add parts of CPU hotplug interface
> >   acpi: cpuhp: implement hot-remove parts of CPU hotplug interface
> >   acpi: cpuhp: add cpu._OST handling
> >   pc: use new CPU hotplug interface since 2.7 machine type
> >   tests: acpi: add CPU hotplug testcase
> >   pc: acpi: drop intermediate PCMachineState.node_cpu
> > 
> >  docs/specs/acpi_cpu_hotplug.txt      |  94 +++++-
> >  hw/acpi/Makefile.objs                |   1 +
> >  hw/acpi/cpu.c                        | 561
> > +++++++++++++++++++++++++++++++++++
> > hw/acpi/cpu_hotplug.c                |  21 +-
> > hw/acpi/ich9.c                       |  69 ++++-
> > hw/acpi/piix4.c                      |  71 ++++-
> > hw/i386/acpi-build.c                 |  68 +++--
> > hw/i386/pc.c                         |  63 +++-
> > hw/i386/pc_piix.c                    |   2 +
> > hw/i386/pc_q35.c                     |   2 +
> > hw/isa/lpc_ich9.c                    |   1 +
> > include/hw/acpi/acpi_dev_interface.h |   7 +
> > include/hw/acpi/cpu.h                |  67 +++++
> > include/hw/acpi/cpu_hotplug.h        |   6 +
> > include/hw/acpi/ich9.h               |   3 +
> > include/hw/i386/pc.h                 |   8 +-
> > qapi-schema.json                     |   3 +-
> > stubs/Makefile.objs                  |   1 +
> > stubs/pc_madt_cpu_entry.c            |   7 +
> > tests/bios-tables-test.c             |  28 ++
> > trace-events                         |  14 + 21 files changed, 1043
> > insertions(+), 54 deletions(-) create mode 100644 hw/acpi/cpu.c
> >  create mode 100644 include/hw/acpi/cpu.h
> >  create mode 100644 stubs/pc_madt_cpu_entry.c
> > 
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs
  2016-06-21 16:50   ` Michael S. Tsirkin
@ 2016-06-21 16:58     ` Igor Mammedov
  2016-06-23 11:07     ` Igor Mammedov
  1 sibling, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-21 16:58 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, ehabkost, marcel, pbonzini, rth

On Tue, 21 Jun 2016 19:50:14 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Jun 21, 2016 at 09:12:38AM +0200, Igor Mammedov wrote:
> > On Thu, 16 Jun 2016 18:55:33 +0200
> > Igor Mammedov <imammedo@redhat.com> wrote:
> > 
> > Michael,
> > Do you think that this series will make into 2.7?
> 
> Yes, I think it will. I'll try to prioritize review.
Thanks,

then I'll try to post dependent x2APIC and 'device-add cpu' series
ASAP.

> 
> > > Changelog:                                                                       
> > >  v1->v2:                                                                         
> > >   - dropped consolidate legacy ACPI CPU hotplug as they are in
> > > master by now     
> > >   - pc: start with legacy hotplug and let 2.7 machine type and
> > > older to switch inot new hotplug mode. That way legacy BIOS
> > > will still work fine as it uses built in ACPI tables and will
> > > continue to use legacy CPU hotplug
> > > interface.                                         
> > >   - poll for CPU objects with events (insert/remove) instead
> > > of looping over all CPUs to find CPUs with
> > > events.                              
> > >   - drop dynamic PXM support as it could be implemented in static
> > > way at acpi tabels build time. It will be an additional series on
> > > top of this.   
> > >   - resplit patches on basic present CPU support, hot-add and
> > > hot-remove parts
> > > Patches: 1-7: add new CPU hotplug
> > > impl. 8: makes 2.7 machine type to use new AML code
> > > that will switch piix4/ich9 into new mode
> > > + switching logic with migration glue for
> > > piix4/ich9 9: drops the last dependency in ACPI parts on
> > > apic_id_limit sized
> > > map.
> > > RFC->v1:                                                                        
> > >   - drop machine.cpu-hotplug property and leave CPU
> > > hotplug always enabled as it used to
> > > be. (it also simplifies, series a
> > > bit)                                           
> > >   - reshuffle/squash some patches to make series
> > > bisectable wrt 'make check'
> > > failures                                                    
> > >   - add doc comment in qapi
> > > schema                                               
> > >   - fix 'make check' error for mips target, disableCPU
> > > hotplug code path in piix4_pm for
> > > mips                                               
> > >   - drop some intermediate expected ACPI tables
> > > updates                          
> > >   - replace _MAT method with named buffer
> > > object 
> > > Current ACPI interface for CPU hotplug supports
> > > hoti-adding only upto 255 CPUs and lacks means to convey
> > > additional information needed _OST methods
> > > support. Also being bitmap based with bit position specifying APIC
> > > ID it doesn't scale up well for 32-bit APIC IDs that will
> > > come with x2APIC
> > > support. 
> > > So add another QEMU-guest interface using as model
> > > memory-hotplug. New interface will be used since 2.7 machine types
> > > and will
> > > support:                                                                         
> > >     - more than 255 CPUs with 32-bit APIC ID
> > > value                               
> > >     - a registers set to communicate OST
> > > information (extendable without breaking IO
> > > layout)                                    
> > >     - possible to reuse for ARM's 'virt' machine
> > > type with minimal tweaks (add init for MMIO,
> > > add ACPI hooks on CPU hotplug path, MADT
> > > generation) 
> > >                                                                                  
> > > Tested with following guests: RHEL7, WS2003EEx64,
> > > WS2012R2x64                    
> > >  * unplug is tested only with RHEL7 as Windows doesn't support
> > > it.               
> > >  * tested that migration works as
> > > well. 
> > > git tree for
> > > testing: git@github.com:imammedo/qemu.git
> > > modern_cpu_hotplug_v2
> > > viewing:
> > > https://github.com/imammedo/qemu/commits/modern_cpu_hotplug_v2               
> > > 
> > > Igor Mammedov (10):
> > >   docs: update ACPI CPU hotplug spec with new protocol
> > >   pc: piix4/ich9: add 'cpu-hotplug-legacy' property
> > >   acpi: cpuhp: add CPU devices AML with _STA method
> > >   pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
> > >   acpi: cpuhp: implement hot-add parts of CPU hotplug interface
> > >   acpi: cpuhp: implement hot-remove parts of CPU hotplug interface
> > >   acpi: cpuhp: add cpu._OST handling
> > >   pc: use new CPU hotplug interface since 2.7 machine type
> > >   tests: acpi: add CPU hotplug testcase
> > >   pc: acpi: drop intermediate PCMachineState.node_cpu
> > > 
> > >  docs/specs/acpi_cpu_hotplug.txt      |  94 +++++-
> > >  hw/acpi/Makefile.objs                |   1 +
> > >  hw/acpi/cpu.c                        | 561
> > > +++++++++++++++++++++++++++++++++++
> > > hw/acpi/cpu_hotplug.c                |  21 +-
> > > hw/acpi/ich9.c                       |  69 ++++-
> > > hw/acpi/piix4.c                      |  71 ++++-
> > > hw/i386/acpi-build.c                 |  68 +++--
> > > hw/i386/pc.c                         |  63 +++-
> > > hw/i386/pc_piix.c                    |   2 +
> > > hw/i386/pc_q35.c                     |   2 +
> > > hw/isa/lpc_ich9.c                    |   1 +
> > > include/hw/acpi/acpi_dev_interface.h |   7 +
> > > include/hw/acpi/cpu.h                |  67 +++++
> > > include/hw/acpi/cpu_hotplug.h        |   6 +
> > > include/hw/acpi/ich9.h               |   3 +
> > > include/hw/i386/pc.h                 |   8 +-
> > > qapi-schema.json                     |   3 +-
> > > stubs/Makefile.objs                  |   1 +
> > > stubs/pc_madt_cpu_entry.c            |   7 +
> > > tests/bios-tables-test.c             |  28 ++
> > > trace-events                         |  14 + 21 files changed,
> > > 1043 insertions(+), 54 deletions(-) create mode 100644
> > > hw/acpi/cpu.c create mode 100644 include/hw/acpi/cpu.h
> > >  create mode 100644 stubs/pc_madt_cpu_entry.c
> > > 
> > 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs
  2016-06-21 16:50   ` Michael S. Tsirkin
  2016-06-21 16:58     ` Igor Mammedov
@ 2016-06-23 11:07     ` Igor Mammedov
  1 sibling, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-23 11:07 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: marcel, pbonzini, rth, qemu-devel, ehabkost

On Tue, 21 Jun 2016 19:50:14 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Jun 21, 2016 at 09:12:38AM +0200, Igor Mammedov wrote:
> > On Thu, 16 Jun 2016 18:55:33 +0200
> > Igor Mammedov <imammedo@redhat.com> wrote:
> > 
> > Michael,
> > Do you think that this series will make into 2.7?
> 
> Yes, I think it will. I'll try to prioritize review.
Michael,

v2 no longer applies to master cleanly due to trivial
conflicts because of trace-events file split.
I've rebased it on top of current master so you can fetch
series with resolved conflicts from following tree:

  https://github.com/imammedo/qemu.git modern_cpu_hotplug_v3

> 
> > > Changelog:                                                                       
> > >  v1->v2:                                                                         
> > >   - dropped consolidate legacy ACPI CPU hotplug as they are in
> > > master by now     
> > >   - pc: start with legacy hotplug and let 2.7 machine type and
> > > older to switch inot new hotplug mode. That way legacy BIOS
> > > will still work fine as it uses built in ACPI tables and will
> > > continue to use legacy CPU hotplug
> > > interface.                                         
> > >   - poll for CPU objects with events (insert/remove) instead
> > > of looping over all CPUs to find CPUs with
> > > events.                              
> > >   - drop dynamic PXM support as it could be implemented in static
> > > way at acpi tabels build time. It will be an additional series on
> > > top of this.   
> > >   - resplit patches on basic present CPU support, hot-add and
> > > hot-remove parts
> > > Patches: 1-7: add new CPU hotplug
> > > impl. 8: makes 2.7 machine type to use new AML code
> > > that will switch piix4/ich9 into new mode
> > > + switching logic with migration glue for
> > > piix4/ich9 9: drops the last dependency in ACPI parts on
> > > apic_id_limit sized
> > > map.
> > > RFC->v1:                                                                        
> > >   - drop machine.cpu-hotplug property and leave CPU
> > > hotplug always enabled as it used to
> > > be. (it also simplifies, series a
> > > bit)                                           
> > >   - reshuffle/squash some patches to make series
> > > bisectable wrt 'make check'
> > > failures                                                    
> > >   - add doc comment in qapi
> > > schema                                               
> > >   - fix 'make check' error for mips target, disableCPU
> > > hotplug code path in piix4_pm for
> > > mips                                               
> > >   - drop some intermediate expected ACPI tables
> > > updates                          
> > >   - replace _MAT method with named buffer
> > > object 
> > > Current ACPI interface for CPU hotplug supports
> > > hoti-adding only upto 255 CPUs and lacks means to convey
> > > additional information needed _OST methods
> > > support. Also being bitmap based with bit position specifying APIC
> > > ID it doesn't scale up well for 32-bit APIC IDs that will
> > > come with x2APIC
> > > support. 
> > > So add another QEMU-guest interface using as model
> > > memory-hotplug. New interface will be used since 2.7 machine types
> > > and will
> > > support:                                                                         
> > >     - more than 255 CPUs with 32-bit APIC ID
> > > value                               
> > >     - a registers set to communicate OST
> > > information (extendable without breaking IO
> > > layout)                                    
> > >     - possible to reuse for ARM's 'virt' machine
> > > type with minimal tweaks (add init for MMIO,
> > > add ACPI hooks on CPU hotplug path, MADT
> > > generation) 
> > >                                                                                  
> > > Tested with following guests: RHEL7, WS2003EEx64,
> > > WS2012R2x64                    
> > >  * unplug is tested only with RHEL7 as Windows doesn't support
> > > it.               
> > >  * tested that migration works as
> > > well. 
> > > git tree for
> > > testing: git@github.com:imammedo/qemu.git
> > > modern_cpu_hotplug_v2
> > > viewing:
> > > https://github.com/imammedo/qemu/commits/modern_cpu_hotplug_v2               
> > > 
> > > Igor Mammedov (10):
> > >   docs: update ACPI CPU hotplug spec with new protocol
> > >   pc: piix4/ich9: add 'cpu-hotplug-legacy' property
> > >   acpi: cpuhp: add CPU devices AML with _STA method
> > >   pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
> > >   acpi: cpuhp: implement hot-add parts of CPU hotplug interface
> > >   acpi: cpuhp: implement hot-remove parts of CPU hotplug interface
> > >   acpi: cpuhp: add cpu._OST handling
> > >   pc: use new CPU hotplug interface since 2.7 machine type
> > >   tests: acpi: add CPU hotplug testcase
> > >   pc: acpi: drop intermediate PCMachineState.node_cpu
> > > 
> > >  docs/specs/acpi_cpu_hotplug.txt      |  94 +++++-
> > >  hw/acpi/Makefile.objs                |   1 +
> > >  hw/acpi/cpu.c                        | 561
> > > +++++++++++++++++++++++++++++++++++
> > > hw/acpi/cpu_hotplug.c                |  21 +-
> > > hw/acpi/ich9.c                       |  69 ++++-
> > > hw/acpi/piix4.c                      |  71 ++++-
> > > hw/i386/acpi-build.c                 |  68 +++--
> > > hw/i386/pc.c                         |  63 +++-
> > > hw/i386/pc_piix.c                    |   2 +
> > > hw/i386/pc_q35.c                     |   2 +
> > > hw/isa/lpc_ich9.c                    |   1 +
> > > include/hw/acpi/acpi_dev_interface.h |   7 +
> > > include/hw/acpi/cpu.h                |  67 +++++
> > > include/hw/acpi/cpu_hotplug.h        |   6 +
> > > include/hw/acpi/ich9.h               |   3 +
> > > include/hw/i386/pc.h                 |   8 +-
> > > qapi-schema.json                     |   3 +-
> > > stubs/Makefile.objs                  |   1 +
> > > stubs/pc_madt_cpu_entry.c            |   7 +
> > > tests/bios-tables-test.c             |  28 ++
> > > trace-events                         |  14 + 21 files changed,
> > > 1043 insertions(+), 54 deletions(-) create mode 100644
> > > hw/acpi/cpu.c create mode 100644 include/hw/acpi/cpu.h
> > >  create mode 100644 stubs/pc_madt_cpu_entry.c
> > > 
> > 
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 02/10] pc: piix4/ich9: add 'cpu-hotplug-legacy' property
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 02/10] pc: piix4/ich9: add 'cpu-hotplug-legacy' property Igor Mammedov
@ 2016-06-23 12:38   ` Marcel Apfelbaum
  0 siblings, 0 replies; 24+ messages in thread
From: Marcel Apfelbaum @ 2016-06-23 12:38 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake

On 06/16/2016 07:55 PM, Igor Mammedov wrote:
> It will be used to select which hotplug call-back is called
> and for switching from legacy mode into new one.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/ich9.c         | 23 ++++++++++++++++++++++-
>   hw/acpi/piix4.c        | 24 +++++++++++++++++++++++-
>   include/hw/acpi/ich9.h |  1 +
>   3 files changed, 46 insertions(+), 2 deletions(-)
>
> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
> index 853c9c4..ed16940 100644
> --- a/hw/acpi/ich9.c
> +++ b/hw/acpi/ich9.c
> @@ -306,6 +306,21 @@ static void ich9_pm_set_memory_hotplug_support(Object *obj, bool value,
>       s->pm.acpi_memory_hotplug.is_enabled = value;
>   }
>
> +static bool ich9_pm_get_cpu_hotplug_legacy(Object *obj, Error **errp)
> +{
> +    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
> +
> +    return s->pm.cpu_hotplug_legacy;
> +}
> +
> +static void ich9_pm_set_cpu_hotplug_legacy(Object *obj, bool value,
> +                                           Error **errp)
> +{
> +    ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
> +
> +    s->pm.cpu_hotplug_legacy = value;
> +}
> +
>   static void ich9_pm_get_disable_s3(Object *obj, Visitor *v, const char *name,
>                                      void *opaque, Error **errp)
>   {
> @@ -397,6 +412,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
>   {
>       static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
>       pm->acpi_memory_hotplug.is_enabled = true;
> +    pm->cpu_hotplug_legacy = true;
>       pm->disable_s3 = 0;
>       pm->disable_s4 = 0;
>       pm->s4_val = 2;
> @@ -412,6 +428,10 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
>                                ich9_pm_get_memory_hotplug_support,
>                                ich9_pm_set_memory_hotplug_support,
>                                NULL);
> +    object_property_add_bool(obj, "cpu-hotplug-legacy",
> +                             ich9_pm_get_cpu_hotplug_legacy,
> +                             ich9_pm_set_cpu_hotplug_legacy,
> +                             NULL);
>       object_property_add(obj, ACPI_PM_PROP_S3_DISABLED, "uint8",
>                           ich9_pm_get_disable_s3,
>                           ich9_pm_set_disable_s3,
> @@ -439,7 +459,8 @@ void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
>           object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
>           acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,
>                               dev, errp);
> -    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
> +    } else if (lpc->pm.cpu_hotplug_legacy &&
> +               object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
>           legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);
>       } else {
>           error_setg(errp, "acpi: device plug request for not supported device"
> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> index c48cb1b..9ae3964 100644
> --- a/hw/acpi/piix4.c
> +++ b/hw/acpi/piix4.c
> @@ -86,6 +86,7 @@ typedef struct PIIX4PMState {
>       uint8_t disable_s4;
>       uint8_t s4_val;
>
> +    bool cpu_hotplug_legacy;
>       AcpiCpuHotplug gpe_cpu;
>
>       MemHotplugState acpi_memory_hotplug;
> @@ -351,7 +352,8 @@ static void piix4_device_plug_cb(HotplugHandler *hotplug_dev,
>           acpi_memory_plug_cb(hotplug_dev, &s->acpi_memory_hotplug, dev, errp);
>       } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
>           acpi_pcihp_device_plug_cb(hotplug_dev, &s->acpi_pci_hotplug, dev, errp);
> -    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
> +    } else if (s->cpu_hotplug_legacy &&
> +               object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
>           legacy_acpi_cpu_plug_cb(hotplug_dev, &s->gpe_cpu, dev, errp);
>       } else {
>           error_setg(errp, "acpi: device plug request for not supported device"
> @@ -560,6 +562,21 @@ static const MemoryRegionOps piix4_gpe_ops = {
>       .endianness = DEVICE_LITTLE_ENDIAN,
>   };
>
> +
> +static bool piix4_get_cpu_hotplug_legacy(Object *obj, Error **errp)
> +{
> +    PIIX4PMState *s = PIIX4_PM(obj);
> +
> +    return s->cpu_hotplug_legacy;
> +}
> +
> +static void piix4_set_cpu_hotplug_legacy(Object *obj, bool value, Error **errp)
> +{
> +    PIIX4PMState *s = PIIX4_PM(obj);
> +
> +    s->cpu_hotplug_legacy = value;
> +}
> +
>   static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
>                                              PCIBus *bus, PIIX4PMState *s)
>   {
> @@ -570,6 +587,11 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
>       acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent,
>                       s->use_acpi_pci_hotplug);
>
> +    s->cpu_hotplug_legacy = true;
> +    object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",
> +                             piix4_get_cpu_hotplug_legacy,
> +                             piix4_set_cpu_hotplug_legacy,
> +                             NULL);
>       legacy_acpi_cpu_hotplug_init(parent, OBJECT(s), &s->gpe_cpu,
>                                    PIIX4_CPU_HOTPLUG_IO_BASE);
>
> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
> index bbd657c..e29a856 100644
> --- a/include/hw/acpi/ich9.h
> +++ b/include/hw/acpi/ich9.h
> @@ -48,6 +48,7 @@ typedef struct ICH9LPCPMRegs {
>       uint32_t pm_io_base;
>       Notifier powerdown_notifier;
>
> +    bool cpu_hotplug_legacy;
>       AcpiCpuHotplug gpe_cpu;
>
>       MemHotplugState acpi_memory_hotplug;
>


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase Igor Mammedov
@ 2016-06-23 13:08   ` Marcel Apfelbaum
  2016-06-23 13:47     ` Igor Mammedov
  0 siblings, 1 reply; 24+ messages in thread
From: Marcel Apfelbaum @ 2016-06-23 13:08 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, eblake

On 06/16/2016 07:55 PM, Igor Mammedov wrote:
> Test with:
>
>      -smp 2,cores=3,sockets=2,maxcpus=6
>
> to capture sparse APIC ID values that default
> AMD CPU has in above configuration.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
>
> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index 16d11aa..a7abe91 100644
> --- a/tests/bios-tables-test.c
> +++ b/tests/bios-tables-test.c
> @@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
>       free_test_data(&data);
>   }
>
> +static void test_acpi_piix4_tcg_cphp(void)
> +{
> +    test_data data;
> +
> +    memset(&data, 0, sizeof(data));
> +    data.machine = MACHINE_PC;
> +    data.variant = ".cphp";
> +    test_acpi_one("-machine accel=tcg"
> +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> +                  &data);
> +    free_test_data(&data);
> +}
> +
> +static void test_acpi_q35_tcg_cphp(void)
> +{
> +    test_data data;
> +
> +    memset(&data, 0, sizeof(data));
> +    data.machine = MACHINE_Q35;
> +    data.variant = ".cphp";
> +    test_acpi_one("-machine q35,accel=tcg"
> +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> +                  &data);
> +    free_test_data(&data);
> +}
> +
>   int main(int argc, char *argv[])
>   {
>       const char *arch = qtest_get_arch();
> @@ -804,6 +830,8 @@ int main(int argc, char *argv[])
>           qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
>           qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
>           qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
> +        qtest_add_func("acpi/piix4/tcg/cpuhp", test_acpi_piix4_tcg_cphp);
> +        qtest_add_func("acpi/q35/tcg/cpuhp", test_acpi_q35_tcg_cphp);
>       }
>       ret = g_test_run();
>       boot_sector_cleanup(disk);
>

It looks good, but did you miss the .cphp variant expected files on purpose?


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Thanks,
Marcel

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-23 13:08   ` Marcel Apfelbaum
@ 2016-06-23 13:47     ` Igor Mammedov
  2016-06-24  5:53       ` Michael S. Tsirkin
  0 siblings, 1 reply; 24+ messages in thread
From: Igor Mammedov @ 2016-06-23 13:47 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel, mst, pbonzini, rth, ehabkost, eblake

On Thu, 23 Jun 2016 16:08:38 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:

> On 06/16/2016 07:55 PM, Igor Mammedov wrote:
> > Test with:
> >
> >      -smp 2,cores=3,sockets=2,maxcpus=6
> >
> > to capture sparse APIC ID values that default
> > AMD CPU has in above configuration.
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
> >   1 file changed, 28 insertions(+)
> >
> > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > index 16d11aa..a7abe91 100644
> > --- a/tests/bios-tables-test.c
> > +++ b/tests/bios-tables-test.c
> > @@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
> >       free_test_data(&data);
> >   }
> >
> > +static void test_acpi_piix4_tcg_cphp(void)
> > +{
> > +    test_data data;
> > +
> > +    memset(&data, 0, sizeof(data));
> > +    data.machine = MACHINE_PC;
> > +    data.variant = ".cphp";
> > +    test_acpi_one("-machine accel=tcg"
> > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > +                  &data);
> > +    free_test_data(&data);
> > +}
> > +
> > +static void test_acpi_q35_tcg_cphp(void)
> > +{
> > +    test_data data;
> > +
> > +    memset(&data, 0, sizeof(data));
> > +    data.machine = MACHINE_Q35;
> > +    data.variant = ".cphp";
> > +    test_acpi_one("-machine q35,accel=tcg"
> > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > +                  &data);
> > +    free_test_data(&data);
> > +}
> > +
> >   int main(int argc, char *argv[])
> >   {
> >       const char *arch = qtest_get_arch();
> > @@ -804,6 +830,8 @@ int main(int argc, char *argv[])
> >           qtest_add_func("acpi/piix4/tcg/bridge",
> > test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35/tcg",
> > test_acpi_q35_tcg); qtest_add_func("acpi/q35/tcg/bridge",
> > test_acpi_q35_tcg_bridge);
> > +        qtest_add_func("acpi/piix4/tcg/cpuhp",
> > test_acpi_piix4_tcg_cphp);
> > +        qtest_add_func("acpi/q35/tcg/cpuhp",
> > test_acpi_q35_tcg_cphp); }
> >       ret = g_test_run();
> >       boot_sector_cleanup(disk);
> >
> 
> It looks good, but did you miss the .cphp variant expected files on
> purpose?
yes, it was in separate commit and I've dropped it before publishing
tree, per Michael's suggestion not to post ACPI tables blobs since he
updates them himself.
I can regenerate blob and post it any time as commit on top of this if
needed.

> 
> 
> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
> Thanks,
> Marcel
Thanks!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-23 13:47     ` Igor Mammedov
@ 2016-06-24  5:53       ` Michael S. Tsirkin
  2016-06-24  6:00         ` Igor Mammedov
  0 siblings, 1 reply; 24+ messages in thread
From: Michael S. Tsirkin @ 2016-06-24  5:53 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Marcel Apfelbaum, qemu-devel, pbonzini, rth, ehabkost, eblake

On Thu, Jun 23, 2016 at 03:47:36PM +0200, Igor Mammedov wrote:
> On Thu, 23 Jun 2016 16:08:38 +0300
> Marcel Apfelbaum <marcel@redhat.com> wrote:
> 
> > On 06/16/2016 07:55 PM, Igor Mammedov wrote:
> > > Test with:
> > >
> > >      -smp 2,cores=3,sockets=2,maxcpus=6
> > >
> > > to capture sparse APIC ID values that default
> > > AMD CPU has in above configuration.
> > >
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > >   tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
> > >   1 file changed, 28 insertions(+)
> > >
> > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > index 16d11aa..a7abe91 100644
> > > --- a/tests/bios-tables-test.c
> > > +++ b/tests/bios-tables-test.c
> > > @@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
> > >       free_test_data(&data);
> > >   }
> > >
> > > +static void test_acpi_piix4_tcg_cphp(void)
> > > +{
> > > +    test_data data;
> > > +
> > > +    memset(&data, 0, sizeof(data));
> > > +    data.machine = MACHINE_PC;
> > > +    data.variant = ".cphp";
> > > +    test_acpi_one("-machine accel=tcg"
> > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > +                  &data);
> > > +    free_test_data(&data);
> > > +}
> > > +
> > > +static void test_acpi_q35_tcg_cphp(void)
> > > +{
> > > +    test_data data;
> > > +
> > > +    memset(&data, 0, sizeof(data));
> > > +    data.machine = MACHINE_Q35;
> > > +    data.variant = ".cphp";
> > > +    test_acpi_one("-machine q35,accel=tcg"
> > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > +                  &data);
> > > +    free_test_data(&data);
> > > +}
> > > +
> > >   int main(int argc, char *argv[])
> > >   {
> > >       const char *arch = qtest_get_arch();
> > > @@ -804,6 +830,8 @@ int main(int argc, char *argv[])
> > >           qtest_add_func("acpi/piix4/tcg/bridge",
> > > test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35/tcg",
> > > test_acpi_q35_tcg); qtest_add_func("acpi/q35/tcg/bridge",
> > > test_acpi_q35_tcg_bridge);
> > > +        qtest_add_func("acpi/piix4/tcg/cpuhp",
> > > test_acpi_piix4_tcg_cphp);
> > > +        qtest_add_func("acpi/q35/tcg/cpuhp",
> > > test_acpi_q35_tcg_cphp); }
> > >       ret = g_test_run();
> > >       boot_sector_cleanup(disk);
> > >
> > 
> > It looks good, but did you miss the .cphp variant expected files on
> > purpose?
> yes, it was in separate commit and I've dropped it before publishing
> tree, per Michael's suggestion not to post ACPI tables blobs since he
> updates them himself.
> I can regenerate blob and post it any time as commit on top of this if
> needed.

you need to patch the script that updates the blob.
I can run it myself but you should mention it in commit log.

> > 
> > 
> > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
> > Thanks,
> > Marcel
> Thanks!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-24  5:53       ` Michael S. Tsirkin
@ 2016-06-24  6:00         ` Igor Mammedov
  2016-06-24 21:58           ` Michael S. Tsirkin
  0 siblings, 1 reply; 24+ messages in thread
From: Igor Mammedov @ 2016-06-24  6:00 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Marcel Apfelbaum, qemu-devel, pbonzini, rth, ehabkost, eblake

On Fri, 24 Jun 2016 08:53:25 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Jun 23, 2016 at 03:47:36PM +0200, Igor Mammedov wrote:
> > On Thu, 23 Jun 2016 16:08:38 +0300
> > Marcel Apfelbaum <marcel@redhat.com> wrote:
> > 
> > > On 06/16/2016 07:55 PM, Igor Mammedov wrote:
> > > > Test with:
> > > >
> > > >      -smp 2,cores=3,sockets=2,maxcpus=6
> > > >
> > > > to capture sparse APIC ID values that default
> > > > AMD CPU has in above configuration.
> > > >
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > ---
> > > >   tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
> > > >   1 file changed, 28 insertions(+)
> > > >
> > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > > index 16d11aa..a7abe91 100644
> > > > --- a/tests/bios-tables-test.c
> > > > +++ b/tests/bios-tables-test.c
> > > > @@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
> > > >       free_test_data(&data);
> > > >   }
> > > >
> > > > +static void test_acpi_piix4_tcg_cphp(void)
> > > > +{
> > > > +    test_data data;
> > > > +
> > > > +    memset(&data, 0, sizeof(data));
> > > > +    data.machine = MACHINE_PC;
> > > > +    data.variant = ".cphp";
> > > > +    test_acpi_one("-machine accel=tcg"
> > > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > > +                  &data);
> > > > +    free_test_data(&data);
> > > > +}
> > > > +
> > > > +static void test_acpi_q35_tcg_cphp(void)
> > > > +{
> > > > +    test_data data;
> > > > +
> > > > +    memset(&data, 0, sizeof(data));
> > > > +    data.machine = MACHINE_Q35;
> > > > +    data.variant = ".cphp";
> > > > +    test_acpi_one("-machine q35,accel=tcg"
> > > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > > +                  &data);
> > > > +    free_test_data(&data);
> > > > +}
> > > > +
> > > >   int main(int argc, char *argv[])
> > > >   {
> > > >       const char *arch = qtest_get_arch();
> > > > @@ -804,6 +830,8 @@ int main(int argc, char *argv[])
> > > >           qtest_add_func("acpi/piix4/tcg/bridge",
> > > > test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35/tcg",
> > > > test_acpi_q35_tcg); qtest_add_func("acpi/q35/tcg/bridge",
> > > > test_acpi_q35_tcg_bridge);
> > > > +        qtest_add_func("acpi/piix4/tcg/cpuhp",
> > > > test_acpi_piix4_tcg_cphp);
> > > > +        qtest_add_func("acpi/q35/tcg/cpuhp",
> > > > test_acpi_q35_tcg_cphp); }
> > > >       ret = g_test_run();
> > > >       boot_sector_cleanup(disk);
> > > >
> > > 
> > > It looks good, but did you miss the .cphp variant expected files
> > > on purpose?
> > yes, it was in separate commit and I've dropped it before publishing
> > tree, per Michael's suggestion not to post ACPI tables blobs since
> > he updates them himself.
> > I can regenerate blob and post it any time as commit on top of this
> > if needed.
> 
> you need to patch the script that updates the blob.
> I can run it myself but you should mention it in commit log.
I guess I've misunderstood.
I'll post extra patch here with blob update.

> 
> > > 
> > > 
> > > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
> > > Thanks,
> > > Marcel
> > Thanks!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 11/10] pc: acpi: update expected DSDT blobs with new CPU hotplug AML
  2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
                   ` (10 preceding siblings ...)
  2016-06-21  7:12 ` [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
@ 2016-06-24  6:18 ` Igor Mammedov
  2016-06-24  6:18   ` [Qemu-devel] [PATCH v2 12/10] pc: acpi: add expected DSDT/MADT blobs for CPU hotplug testscase Igor Mammedov
  11 siblings, 1 reply; 24+ messages in thread
From: Igor Mammedov @ 2016-06-24  6:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/acpi-test-data/pc/DSDT         | Bin 5503 -> 6008 bytes
 tests/acpi-test-data/pc/DSDT.bridge  | Bin 7362 -> 7867 bytes
 tests/acpi-test-data/q35/DSDT        | Bin 8265 -> 8770 bytes
 tests/acpi-test-data/q35/DSDT.bridge | Bin 8282 -> 8787 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/acpi-test-data/pc/DSDT b/tests/acpi-test-data/pc/DSDT
index 8b4f1a09b87f8361fb572022f69d304ddeeace99..8053d711058c0f9541d6d97690819f9de697751c 100644
GIT binary patch
delta 907
zcmb7D&2G~`5Z-NEx>>tLsVpJEfk-_dA(Sp$dNyM>F^y9z>ms3zWFM2B_DE0ekHib)
z1ya;|gm@7iqz}L?%otSBO)m9mJv;h-X1-m${oRwXj*G7^7~}Up<i$=WJu3Cb(p-a_
z9Jc5<KNG#$aL9)zOq4Lzon0yWoGsas2N%p-=3`xOpDkrzt`6uYVqM6S5r=f7IgGQ<
z9Fk9pGY=q(g}K_NrWWXA*u~B`D!O4%rlV9?Mn!Wyd^hP4HRNYnl!G*`cO%GC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NWzVwR)|$W*YPS4z6g7j=WkG<38Hx8yy*U5ZuckKB{bVYy@+?
zAbGU*Zm>9|u4(>$npD}K<3pAY27u^!znpnK$Scb>ktCK43904wiVT#%W3Io^sM{Di
cdn!U?|GLHcuEi|#801!tT3XQ$qj6IH0lN=q*#H0l

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Qemu-devel] [PATCH v2 12/10] pc: acpi: add expected DSDT/MADT blobs for CPU hotplug testscase
  2016-06-24  6:18 ` [Qemu-devel] [PATCH v2 11/10] pc: acpi: update expected DSDT blobs with new CPU hotplug AML Igor Mammedov
@ 2016-06-24  6:18   ` Igor Mammedov
  0 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-24  6:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/acpi-test-data/pc/APIC.cphp  | Bin 0 -> 160 bytes
 tests/acpi-test-data/pc/DSDT.cphp  | Bin 0 -> 6435 bytes
 tests/acpi-test-data/q35/APIC.cphp | Bin 0 -> 160 bytes
 tests/acpi-test-data/q35/DSDT.cphp | Bin 0 -> 9197 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tests/acpi-test-data/pc/APIC.cphp
 create mode 100644 tests/acpi-test-data/pc/DSDT.cphp
 create mode 100644 tests/acpi-test-data/q35/APIC.cphp
 create mode 100644 tests/acpi-test-data/q35/DSDT.cphp

diff --git a/tests/acpi-test-data/pc/APIC.cphp b/tests/acpi-test-data/pc/APIC.cphp
new file mode 100644
index 0000000000000000000000000000000000000000..1bf8a0a63bc1c9b716d937b96eb34b05016b9366
GIT binary patch
literal 160
zcmXwx!3}^Q3`JW6f}%UP3UJYrBwpObWgNv(oJ8%n@zB24pP!~WmxG9S&r6xsF>kdb
z$yhQtNOavFgY<9)W~DJWDKu7Tozi)bd+hVZHk}Lv=1?18ZTnj%1<hjo%=$-Oyrt<4
A0RR91

literal 0
HcmV?d00001

diff --git a/tests/acpi-test-data/pc/DSDT.cphp b/tests/acpi-test-data/pc/DSDT.cphp
new file mode 100644
index 0000000000000000000000000000000000000000..e8b146208eb3877e1cde2cc361c5afd270d194c6
GIT binary patch
literal 6435
zcmb7IUvC@75#PN#O2;KB9i_7@TXsyyPSUt_%s;Y{phaQwjuL6{s56gpU7XQ7$_h#u
zX?;*^Ac_z`VgSX-TfjPK-)KY6_D5(xLOwzY^b@3L;-{!Hciba=(g6tpQ8PQg{q4-|
z?CdUeOK)F3M+p5-WnHUTxyoHr)1i$LLQuy4N?p1~?0vnm>d=%RQTrg}%kWi^)!*oq
zjaB;huKSJaKKjC?9gl22SDtQmyw9Jwn*>3RH$BEsP!=7l;@G_fQ>*7?r&ia~<!_lN
zJ7v8^WM`wUQ^k-2OjWL#)iwuF0D&3YsF`hpqzU=<rxcOw0|oWjJJqJ1Gh4coQ<oj9
zT_zs3xE?ljK6RPm4$@!uUD9_`$HzxxF!go6L;luDlYjp&aYT;TwCrdtE1P9ghe?PS
z$caSAE>Yfm7rjAu?cO=_ZlUD+nidHKSIk0569_w2ZYIWHnpC&SPJn}nMch(e6PU}u
z-M9YqF0x=xLTcB^WW%gBDS4lWS{VgVtH3`+yL4UT10$Q=yVh!JKpIS03MLEvoo8oO
zsYg7b2#bWS(jBrxgo#~Z_ugBp=pkGb)ucZwVW56Tm$-yNuPw3#{}%;_*Y3S-tZ#%J
zr)Q%bWtLbZ3IfaWimru=I63rafz7Yd@5S#$BCXON#UEj!7H^WPlFwaOX_#fc*eiN{
zCZ`aVVCyVT*-Iv{H{oxFEwE$u5&MBnGg)?4^lJ7jQ!x$4KLRLr@AnO}9r`K}bv{^n
zoKkl%0n2?vo=IWM3d^k0PsC3|Szg@t{i#aYx>4YhnxH`javEHaIGR`DE0M^HichnG
zG{p!F6G9$X(O4egl>j_4@F+ETltlZcX0>UGykIh<I4T<C;6@I<^qjqKRd2yolwV**
zrBKl-`RXk&RGLPMrj)>didJcE7&)6(8rm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3vZBSFOTOfg})!3LzGBsG%qnxllsE?!99b-iMCXMsxU^4|EZUI^!Q}
z_%y`<(2UR`(jpWN9T*Cr@WPLQa#lE10%#%*TH>s5rw*VKu~5!B$)S^R&?U|azgPsU
zax9dyCOI@22fe{r8Hci1C})M;5IB&EgD!K{G>4{Rp`10tp_w@7dz^KOL#JY)oE6^8
zfv?kX(Dym3!l6nml(S|zG#dx~fV0kU=u9k>v(9qpY#g-ASt0X-u+&&6XFbEAXX2n0
z&N|1TbFom)dX_`a#z8gCI?ti=u~5!>jziDIL3Pf0o<q;aLOJUKhc3iHtDN-$hhB(<
za@LC+dNB^V!dc(o&^KbCob?iiUOEk`))w?T&9*Q|?{(n`afr2U+gB7&pqd3r4i#>>
z2?|uCz_O1DS~7dx6udtUEhsBPO+YQQNuWV-7}{{G8=(ycgDpO^;b_aD4Tpn`I<(<<
z@1bpauM5=`j<!P!HXPUCa07j0ha>LLf~~{t@J0fCWLHp!O~CCrUmw|Tq7LcI?fbqy
zvilK3VsbkiCWn?bX2+-@#X>vAt&iC;a!8iYo<n`ieiL+9_RzkMI@r}qcu#^K(ec+%
OTtYbOHt0~$nfQP4P$F9Z

literal 0
HcmV?d00001

diff --git a/tests/acpi-test-data/q35/APIC.cphp b/tests/acpi-test-data/q35/APIC.cphp
new file mode 100644
index 0000000000000000000000000000000000000000..1bf8a0a63bc1c9b716d937b96eb34b05016b9366
GIT binary patch
literal 160
zcmXwx!3}^Q3`JW6f}%UP3UJYrBwpObWgNv(oJ8%n@zB24pP!~WmxG9S&r6xsF>kdb
z$yhQtNOavFgY<9)W~DJWDKu7Tozi)bd+hVZHk}Lv=1?18ZTnj%1<hjo%=$-Oyrt<4
A0RR91

literal 0
HcmV?d00001

diff --git a/tests/acpi-test-data/q35/DSDT.cphp b/tests/acpi-test-data/q35/DSDT.cphp
new file mode 100644
index 0000000000000000000000000000000000000000..6cc28c6daec2b331030ab0600a4d79034c1dfc40
GIT binary patch
literal 9197
zcmb7KU2hx56`duQ)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s!;kW#c#2QsfAy2=;-u2AUHVH2K0*_h{=Pas{`+^s=JWJYJ+Lub
z<-czvrXlrf+ZX(MM7!wb<c6BJFDu!Vtc5r8-cz?Rb6e}(xvWj=DB9P%bB^t%Tr8J}
zo}(jF)ceJW<j&zU8!rZO>o~Pjj&5PCUn6v)ikI;+v`O-U>D&BvJaV+{7q20_8fXK<
z&wW=c(Y~tMh?@967S~<s94u3irh9*dW&%Fy)T*O}TVkbiaG3x_ant45jC&1h1TP7=
z#Q5iz1<9u^7u_BBXay^NmKKbZw_(eF)yTC91^kZ!{o_mL@ab0JXEMMgvjjHTt<@0A
R7B$vXW1Sn>MzGZu{|B7Hnt1>K

literal 0
HcmV?d00001

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-24  6:00         ` Igor Mammedov
@ 2016-06-24 21:58           ` Michael S. Tsirkin
  2016-06-27 12:30             ` Igor Mammedov
  0 siblings, 1 reply; 24+ messages in thread
From: Michael S. Tsirkin @ 2016-06-24 21:58 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Marcel Apfelbaum, qemu-devel, pbonzini, rth, ehabkost, eblake

On Fri, Jun 24, 2016 at 08:00:20AM +0200, Igor Mammedov wrote:
> On Fri, 24 Jun 2016 08:53:25 +0300
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Jun 23, 2016 at 03:47:36PM +0200, Igor Mammedov wrote:
> > > On Thu, 23 Jun 2016 16:08:38 +0300
> > > Marcel Apfelbaum <marcel@redhat.com> wrote:
> > > 
> > > > On 06/16/2016 07:55 PM, Igor Mammedov wrote:
> > > > > Test with:
> > > > >
> > > > >      -smp 2,cores=3,sockets=2,maxcpus=6
> > > > >
> > > > > to capture sparse APIC ID values that default
> > > > > AMD CPU has in above configuration.
> > > > >
> > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > ---
> > > > >   tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
> > > > >   1 file changed, 28 insertions(+)
> > > > >
> > > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > > > index 16d11aa..a7abe91 100644
> > > > > --- a/tests/bios-tables-test.c
> > > > > +++ b/tests/bios-tables-test.c
> > > > > @@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
> > > > >       free_test_data(&data);
> > > > >   }
> > > > >
> > > > > +static void test_acpi_piix4_tcg_cphp(void)
> > > > > +{
> > > > > +    test_data data;
> > > > > +
> > > > > +    memset(&data, 0, sizeof(data));
> > > > > +    data.machine = MACHINE_PC;
> > > > > +    data.variant = ".cphp";
> > > > > +    test_acpi_one("-machine accel=tcg"
> > > > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > > > +                  &data);
> > > > > +    free_test_data(&data);
> > > > > +}
> > > > > +
> > > > > +static void test_acpi_q35_tcg_cphp(void)
> > > > > +{
> > > > > +    test_data data;
> > > > > +
> > > > > +    memset(&data, 0, sizeof(data));
> > > > > +    data.machine = MACHINE_Q35;
> > > > > +    data.variant = ".cphp";
> > > > > +    test_acpi_one("-machine q35,accel=tcg"
> > > > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > > > +                  &data);
> > > > > +    free_test_data(&data);
> > > > > +}
> > > > > +
> > > > >   int main(int argc, char *argv[])
> > > > >   {
> > > > >       const char *arch = qtest_get_arch();
> > > > > @@ -804,6 +830,8 @@ int main(int argc, char *argv[])
> > > > >           qtest_add_func("acpi/piix4/tcg/bridge",
> > > > > test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35/tcg",
> > > > > test_acpi_q35_tcg); qtest_add_func("acpi/q35/tcg/bridge",
> > > > > test_acpi_q35_tcg_bridge);
> > > > > +        qtest_add_func("acpi/piix4/tcg/cpuhp",
> > > > > test_acpi_piix4_tcg_cphp);
> > > > > +        qtest_add_func("acpi/q35/tcg/cpuhp",
> > > > > test_acpi_q35_tcg_cphp); }
> > > > >       ret = g_test_run();
> > > > >       boot_sector_cleanup(disk);
> > > > >
> > > > 
> > > > It looks good, but did you miss the .cphp variant expected files
> > > > on purpose?
> > > yes, it was in separate commit and I've dropped it before publishing
> > > tree, per Michael's suggestion not to post ACPI tables blobs since
> > > he updates them himself.
> > > I can regenerate blob and post it any time as commit on top of this
> > > if needed.
> > 
> > you need to patch the script that updates the blob.
> > I can run it myself but you should mention it in commit log.
> I guess I've misunderstood.
> I'll post extra patch here with blob update.

No that's ok, point was to include
tests/acpi-test-data/rebuild-expected-aml.sh
if you add new files.

> > 
> > > > 
> > > > 
> > > > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
> > > > Thanks,
> > > > Marcel
> > > Thanks!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase
  2016-06-24 21:58           ` Michael S. Tsirkin
@ 2016-06-27 12:30             ` Igor Mammedov
  0 siblings, 0 replies; 24+ messages in thread
From: Igor Mammedov @ 2016-06-27 12:30 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: ehabkost, qemu-devel, Marcel Apfelbaum, pbonzini, rth

On Sat, 25 Jun 2016 00:58:14 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Fri, Jun 24, 2016 at 08:00:20AM +0200, Igor Mammedov wrote:
> > On Fri, 24 Jun 2016 08:53:25 +0300
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> >   
> > > On Thu, Jun 23, 2016 at 03:47:36PM +0200, Igor Mammedov wrote:  
> > > > On Thu, 23 Jun 2016 16:08:38 +0300
> > > > Marcel Apfelbaum <marcel@redhat.com> wrote:
> > > >   
> > > > > On 06/16/2016 07:55 PM, Igor Mammedov wrote:  
> > > > > > Test with:
> > > > > >
> > > > > >      -smp 2,cores=3,sockets=2,maxcpus=6
> > > > > >
> > > > > > to capture sparse APIC ID values that default
> > > > > > AMD CPU has in above configuration.
> > > > > >
> > > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > > ---
> > > > > >   tests/bios-tables-test.c | 28 ++++++++++++++++++++++++++++
> > > > > >   1 file changed, 28 insertions(+)
> > > > > >
> > > > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > > > > index 16d11aa..a7abe91 100644
> > > > > > --- a/tests/bios-tables-test.c
> > > > > > +++ b/tests/bios-tables-test.c
> > > > > > @@ -788,6 +788,32 @@ static void test_acpi_q35_tcg_bridge(void)
> > > > > >       free_test_data(&data);
> > > > > >   }
> > > > > >
> > > > > > +static void test_acpi_piix4_tcg_cphp(void)
> > > > > > +{
> > > > > > +    test_data data;
> > > > > > +
> > > > > > +    memset(&data, 0, sizeof(data));
> > > > > > +    data.machine = MACHINE_PC;
> > > > > > +    data.variant = ".cphp";
> > > > > > +    test_acpi_one("-machine accel=tcg"
> > > > > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > > > > +                  &data);
> > > > > > +    free_test_data(&data);
> > > > > > +}
> > > > > > +
> > > > > > +static void test_acpi_q35_tcg_cphp(void)
> > > > > > +{
> > > > > > +    test_data data;
> > > > > > +
> > > > > > +    memset(&data, 0, sizeof(data));
> > > > > > +    data.machine = MACHINE_Q35;
> > > > > > +    data.variant = ".cphp";
> > > > > > +    test_acpi_one("-machine q35,accel=tcg"
> > > > > > +                  " -smp 2,cores=3,sockets=2,maxcpus=6",
> > > > > > +                  &data);
> > > > > > +    free_test_data(&data);
> > > > > > +}
> > > > > > +
> > > > > >   int main(int argc, char *argv[])
> > > > > >   {
> > > > > >       const char *arch = qtest_get_arch();
> > > > > > @@ -804,6 +830,8 @@ int main(int argc, char *argv[])
> > > > > >           qtest_add_func("acpi/piix4/tcg/bridge",
> > > > > > test_acpi_piix4_tcg_bridge); qtest_add_func("acpi/q35/tcg",
> > > > > > test_acpi_q35_tcg); qtest_add_func("acpi/q35/tcg/bridge",
> > > > > > test_acpi_q35_tcg_bridge);
> > > > > > +        qtest_add_func("acpi/piix4/tcg/cpuhp",
> > > > > > test_acpi_piix4_tcg_cphp);
> > > > > > +        qtest_add_func("acpi/q35/tcg/cpuhp",
> > > > > > test_acpi_q35_tcg_cphp); }
> > > > > >       ret = g_test_run();
> > > > > >       boot_sector_cleanup(disk);
> > > > > >  
> > > > > 
> > > > > It looks good, but did you miss the .cphp variant expected files
> > > > > on purpose?  
> > > > yes, it was in separate commit and I've dropped it before publishing
> > > > tree, per Michael's suggestion not to post ACPI tables blobs since
> > > > he updates them himself.
> > > > I can regenerate blob and post it any time as commit on top of this
> > > > if needed.  
> > > 
> > > you need to patch the script that updates the blob.
> > > I can run it myself but you should mention it in commit log.  
> > I guess I've misunderstood.
> > I'll post extra patch here with blob update.  
> 
> No that's ok, point was
look like I'm still missing point,

> to include
> tests/acpi-test-data/rebuild-expected-aml.sh
> if you add new files.
what does above mean?

as I see, there aren't any blobs mentioned in rebuild-expected-aml.sh

Anyway I need to respin this patch as it doesn't apply doe conflicts
with ipmi patches.

> > >   
> > > > > 
> > > > > 
> > > > > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
> > > > > Thanks,
> > > > > Marcel  
> > > > Thanks!  
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-06-27 12:30 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-16 16:55 [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 01/10] docs: update ACPI CPU hotplug spec with new protocol Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 02/10] pc: piix4/ich9: add 'cpu-hotplug-legacy' property Igor Mammedov
2016-06-23 12:38   ` Marcel Apfelbaum
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 03/10] acpi: cpuhp: add CPU devices AML with _STA method Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 04/10] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 05/10] acpi: cpuhp: implement hot-add parts of CPU hotplug interface Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 06/10] acpi: cpuhp: implement hot-remove " Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 07/10] acpi: cpuhp: add cpu._OST handling Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 08/10] pc: use new CPU hotplug interface since 2.7 machine type Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 09/10] tests: acpi: add CPU hotplug testcase Igor Mammedov
2016-06-23 13:08   ` Marcel Apfelbaum
2016-06-23 13:47     ` Igor Mammedov
2016-06-24  5:53       ` Michael S. Tsirkin
2016-06-24  6:00         ` Igor Mammedov
2016-06-24 21:58           ` Michael S. Tsirkin
2016-06-27 12:30             ` Igor Mammedov
2016-06-16 16:55 ` [Qemu-devel] [PATCH v2 10/10] pc: acpi: drop intermediate PCMachineState.node_cpu Igor Mammedov
2016-06-21  7:12 ` [Qemu-devel] [PATCH v2 00/10] ACPI CPU hotplug refactoring to support unplug and more than 255 CPUs Igor Mammedov
2016-06-21 16:50   ` Michael S. Tsirkin
2016-06-21 16:58     ` Igor Mammedov
2016-06-23 11:07     ` Igor Mammedov
2016-06-24  6:18 ` [Qemu-devel] [PATCH v2 11/10] pc: acpi: update expected DSDT blobs with new CPU hotplug AML Igor Mammedov
2016-06-24  6:18   ` [Qemu-devel] [PATCH v2 12/10] pc: acpi: add expected DSDT/MADT blobs for CPU hotplug testscase Igor Mammedov

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.