pass cpu online/offline event bewteen QEMU and linux kernel by ACPI Embedded Controller
cover pass cpu online/offline event bewteen QEMU and linux kernel by ACPI Embedded Controller
patch 1 adds ACPI Embedded Controller (EC), refer-to:
ACPI SPEC v5 chapter 12
"ACPI Embedded Controller Interface Specification"
EC is a standard ACPI device, it plays flexible roles, especially be event carrier, it can pass events between platform and OS, so OS can execute _Qxx method which defined
by yourself and query EC's ACPI space which can be a buffer for many purposes
here, I want to deliver CPU online/offline event between OS and QEMU for CPU hotplug feature, then we will don't need to "echo 1 > /sys/devices/system/cpu/cpu1/online" again after 'cpu-add' and also for offline to do real cpu removal.
what I am trying to do is emulated physical addition/removal (like described by linux kernel document for cpu hotplug -- linux-2.6/Documentation/cpu-hotplug.txt) for QEMU.
these RFC patches are sent for demo what I am trying to do.
the design process simply like following:
cpu-add/del --> EC space & sci setting --> kernel EC driver gpe handler
I
V
listen cpu hotplug event
I
V
query EC space for cpu status
I
V
trigger cpu online/offline process
Li Guang (7)
acpi: add ACPI Embedded Controller support
ich9: add notifer for ec to generate sci
ec: add operations for _Qxx events
piix4: add notifer for ec to generate sci
piix4: add events for cpu hotplug
qmp: add 'cpu-del' command
pc: add EC qdev init for piix & q35
default-configs/x86_64-softmmu.mak | 1 + hw/acpi/Makefile.objs | 1 + hw/acpi/ec.c | 225 ++++++++++++++++++++++++++++++++++++ hw/acpi/ich9.c | 15 +++++++++++++++ hw/acpi/piix4.c | 22 ++++++++++++++ hw/i386/pc.c | 30 ++++++++++++++++++++++++++++-- hw/i386/pc_piix.c | 7 + hw/i386/pc_q35.c | 6 + include/hw/acpi/ec.h | 39 ++++++ include/hw/acpi/ich9.h | 1 + include/hw/boards.h | 5 +++-- include/hw/i386/pc.h | 1 + qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 23 +++++++++++++++++++++++ qmp.c | 9 +++++++++ 15 files changed, 390 insertions(+), 8 deletions(-) create mode 100644 hw/acpi/ec.c create mode 100644 include/hw/acpi/ec.h
RFC PATCH 1/7 acpi: add ACPI Embedded Controller support
this work implemented Embedded Controller chip emulation which was defined at ACPI SEPC v5 chapter 12:
"ACPI Embedded Controller Interface Specification"
commonly Embedded Controller will emulate keyboard, mouse, handle ACPI defined operations and some low-speed devices like SMbus.
--- default-configs/x86_64-softmmu.mak | 1 + hw/acpi/Makefile.objs | 1 + hw/acpi/ec.c | 193 ++++++++++++++++++++++++++++++++++++ include/hw/acpi/ec.h | 29 ++++++ 4 files changed, 224 insertions(+), 0 deletions(-) create mode 100644 hw/acpi/ec.c create mode 100644 include/hw/acpi/ec.h
default-configs/x86_64-softmmu.mak +1 -0
@@ -46,3 +46,4 @@ CONFIG_APIC=y CONFIG_IOAPIC=y CONFIG_ICC_BUS=y CONFIG_PVPANIC=y +CONFIG_ACPI_EC=y
hw/acpi/Makefile.objs +1 -0
@@ -1,2 +1,3 @@ common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o +common-obj-$(CONFIG_ACPI_EC) += ec.o
hw/acpi/ec.c new file +193 -0
193 lines not on this page · raw message
include/hw/acpi/ec.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef __EC_H +#define __EC_H + +#include "hw/i386/pc.h" +#include "qemu/notify.h" + +#define EC_ACPI_SPACE_SIZE 0x80 + +#define EC_ACPI_CMD_PORT 0x66 +#define EC_ACPI_DATA_PORT 0x62 + +#define EC_ACPI_OBF 0x1 +#define EC_ACPI_IBF 0x2 +#define EC_ACPI_CMD 0x8 +#define EC_ACPI_BST 0x10 +#define EC_ACPI_SCI 0x20 + +#define EC_ACPI_CMD_READ 0x80 +#define EC_ACPI_CMD_WRITE 0x81 +#define EC_ACPI_BURST_EN 0x82 +#define EC_ACPI_BURST_DN 0x83 +#define EC_ACPI_CMD_QUERY 0x84 + +void qemu_register_ec_sci_notifier (Notifier *notifier); +bool qemu_ec_enabled (void ); +void ec_dev_init (ISABus *isabus); +void ec_acpi_event (uint8_t evt); + +#endif
Signature · 1 line
1.7.2.5
RFC PATCH 2/7 ich9: add notifer for ec to generate sci
In reply to liguang--- hw/acpi/ich9.c | 15 +++++++++++++++ include/hw/acpi/ich9.h | 1 + 2 files changed, 16 insertions(+), 0 deletions(-)
hw/acpi/ich9.c +15 -0
@@ -33,6 +33,7 @@#include "exec/address-spaces.h" #include "hw/i386/ich9.h" +#include "hw/acpi/ec.h" //#define DEBUG
@@ -43,6 +44,8 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } while (0)#define ICH9_DEBUG (fmt, ...) do { } while (0)#endif +#define GPE_EC_SCI_STATUS 8 +static void pm_update_sci (ICH9LPCPMRegs *pm) {int sci_level, pm1a_sts;
@@ -202,6 +205,15 @@ static void pm_powerdown_req(Notifier *n, void *opaque)acpi_pm1_evt_power_down (&pm->acpi_regs); } +static void pm_ec_sci_req (Notifier *n,void *opaque) +{ +ICH9LPCPMRegs *pm =container_of (n, ICH9LPCPMRegs, ec_sci_notifier); +ACPIGPE *gpe = &pm->acpi_regs.gpe; + + *gpe->sts |=GPE_EC_SCI_STATUS ; +pm_update_sci (pm); +} +void ich9_pm_init (PCIDevice *lpc_pci,ICH9LPCPMRegs *pm,qemu_irq sci_irq) {
@@ -227,4 +239,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,qemu_register_reset (pm_reset, pm); pm->powerdown_notifier.notify = pm_powerdown_req;qemu_register_powerdown_notifier (&pm->powerdown_notifier); + + pm->ec_sci_notifier.notify = pm_ec_sci_req; +qemu_register_ec_sci_notifier (&pm->ec_sci_notifier); }
include/hw/acpi/ich9.h +1 -0
@@ -42,6 +42,7 @@ typedef struct ICH9LPCPMRegs {uint32_t pm_io_base;Notifier powerdown_notifier; +Notifier ec_sci_notifier; } ICH9LPCPMRegs; void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
Signature · 1 line
1.7.2.5
RFC PATCH 3/7 ec: add operations for _Qxx events
In reply to liguang--- hw/acpi/ec.c | 32 ++++++++++++++++++++++++++++---- include/hw/acpi/ec.h | 10 ++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-)
hw/acpi/ec.c +28 -4
@@ -22,6 +22,9 @@ typedef struct ECState {MemoryRegion io[2 ]; } ECState; +static void ec_generate_sci (ECState *); +static ECState *ecs; +static NotifierList ec_sci_notifiers =NOTIFIER_LIST_INITIALIZER (ec_sci_notifiers);void qemu_register_ec_sci_notifier (Notifier *notifier)
@@ -44,8 +47,26 @@ void ec_acpi_event(uint8_t evt) sci_event = evt; } -static void ec_generate_sci (void ) +void ec_acpi_space_poke (uint8_t idx,uint8_t val) +{ +if (idx <EC_ACPI_SPACE_SIZE ) { + ec_acpi_space[idx] = val; +ec_generate_sci (ecs); + } +} + +uint8_t ec_acpi_space_peek (uint8_t idx) { +if (idx <EC_ACPI_SPACE_SIZE ) { +return ec_acpi_space[idx]; + }else { +return 0 ; + } +} + +static void ec_generate_sci (ECState *s) +{ + s->status |=EC_ACPI_SCI ;notifier_list_notify (&ec_sci_notifiers,NULL ); }
@@ -72,12 +93,11 @@ static void acpi_data_write(void *opaque, hwaddr addr, uint64_t val, }break ;case EC_ACPI_CMD_QUERY : - s->data = sci_event;default :break ; } } -ec_generate_sci (); +ec_generate_sci (s); }static uint64_t acpi_data_read (void *opaque,hwaddr addr,unsigned size)
@@ -112,13 +132,15 @@ static void acpi_cmd_write(void *opaque, hwaddr addr, uint64_t val, is_cmd = true;break ;case EC_ACPI_CMD_QUERY : + s->data = sci_event; + s->status |=EC_ACPI_OBF ; is_cmd = true;default :break ; }if (is_cmd) { s->cmd = val &0xff ; -ec_generate_sci (); +ec_generate_sci (s); s->status |=EC_ACPI_SCI ; }else { s->cmd =0 ;
@@ -165,6 +187,8 @@ static int ec_dev_initfn(ISADevice *dev)memory_region_init_io (s->io +1 , &io66_io_ops, s,"ec-acpi-cmd" ,1 );isa_register_ioport (isadev, s->io +1 ,0x66 ); + ecs = s; +return 0 ; }
include/hw/acpi/ec.h +10 -0
@@ -21,9 +21,19 @@#define EC_ACPI_BURST_DN 0x83#define EC_ACPI_CMD_QUERY 0x84 +/* event no. */ +#define EVENT_CPU_ONLINE 0x1 +#define EVENT_CPU_OFFLINE 0x2 + +/* index of acpi space*/ +#define EC_ACPI_SPACE_CPUS 1 +#define EC_ACPI_SPACE_CPUN 2 +void qemu_register_ec_sci_notifier (Notifier *notifier);bool qemu_ec_enabled (void );void ec_dev_init (ISABus *isabus);void ec_acpi_event (uint8_t evt); +void ec_acpi_space_poke (uint8_t idx,uint8_t val); +uint8_t ec_acpi_space_peek (uint8_t idx);#endif
Signature · 1 line
1.7.2.5
RFC PATCH 4/7 piix4: add notifer for ec to generate sci
In reply to liguang--- hw/acpi/piix4.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
hw/acpi/piix4.c +14 -0
@@ -29,6 +29,7 @@#include "exec/ioport.h" #include "hw/nvram/fw_cfg.h" #include "exec/address-spaces.h" +#include "hw/acpi/ec.h" //#define DEBUG
@@ -53,6 +54,7 @@#define PIIX4_PCI_HOTPLUG_STATUS 2#define PIIX4_CPU_HOTPLUG_STATUS 4 +#define GPE_EC_SCI_STATUS 8struct pci_status {uint32_t up;/* deprecated, maintained for migration compatibility */
@@ -94,6 +96,7 @@ typedef struct PIIX4PMState {CPUStatus gpe_cpu;Notifier cpu_added_notifier; +Notifier ec_sci_notifier; } PIIX4PMState; static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
@@ -622,6 +625,15 @@ static const MemoryRegionOps cpu_hotplug_ops = { }, }; +static void pm_ec_sci_req (Notifier *n,void *opaque) +{ +PIIX4PMState *s =container_of (n, PIIX4PMState, ec_sci_notifier); +ACPIGPE *gpe = &s->ar.gpe; + + *gpe->sts |=GPE_EC_SCI_STATUS ; +pm_update_sci (s); +} + typedef enum { PLUG, UNPLUG,
@@ -686,6 +698,8 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,memory_region_add_subregion (parent,PIIX4_PROC_BASE , &s->io_cpu); s->cpu_added_notifier.notify = piix4_cpu_added_req;qemu_register_cpu_added_notifier (&s->cpu_added_notifier); + s->ec_sci_notifier.notify = pm_ec_sci_req; +qemu_register_ec_sci_notifier (&s->ec_sci_notifier); }static void enable_device (PIIX4PMState *s,int slot)
Signature · 1 line
1.7.2.5
RFC PATCH 5/7 piix4: add events for cpu hotplug
In reply to liguang--- hw/acpi/piix4.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
hw/acpi/piix4.c +8 -0
@@ -657,6 +657,14 @@ static void piix4_cpu_hotplug_req(PIIX4PMState *s, CPUState *cpu, g->sts[cpu_id /8 ] &= ~(1 << (cpu_id %8 )); }pm_update_sci (s); + +if (qemu_ec_enabled ()) { +uint8_t cpu_sts =ec_acpi_space_peek (EC_ACPI_SPACE_CPUS ); + +ec_acpi_event (EVENT_CPU_ONLINE ); +ec_acpi_space_poke (EC_ACPI_SPACE_CPUS ,1 << cpu_id | cpu_sts); +ec_acpi_space_poke (EC_ACPI_SPACE_CPUN , cpu_id); + } }static void piix4_cpu_added_req (Notifier *n,void *opaque)
Signature · 1 line
1.7.2.5
RFC PATCH 6/7 qmp: add 'cpu-del' command
In reply to liguangadd 'cpu-del' as complementary of 'cpu-add', cpu-del doesn't really delete a previous created cpu for it depends on CPU-QOM which it's un-finished yet to unrealize it.
cpu-del just records the cpu-id that guest want to remove to keep status of ACPI cpu hot-remove process.
--- hw/i386/pc.c | 30 ++++++++++++++++++++++++++++-- hw/i386/pc_piix.c | 1 + hw/i386/pc_q35.c | 1 + include/hw/boards.h | 5 +++-- include/hw/i386/pc.h | 1 + qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 23 +++++++++++++++++++++++ qmp.c | 9 +++++++++ 8 files changed, 79 insertions(+), 4 deletions(-)
hw/i386/pc.c +28 -2
@@ -55,6 +55,7 @@#include "hw/acpi/acpi.h" #include "hw/cpu/icc_bus.h" #include "hw/boards.h" +#include "hw/acpi/ec.h" /* debug PC/ISA interrupts */ //#define DEBUG_IRQ
@@ -926,10 +927,15 @@ void pc_hot_add_cpu(const int64_t id, Error **errp) {DeviceState *icc_bridge;int64_t apic_id =x86_cpu_apic_id_from_index (id); +uint8_t cpu_sts =ec_acpi_space_peek (EC_ACPI_SPACE_CPUS );if (cpu_exists (apic_id)) { -error_setg (errp,"Unable to add CPU: %" PRIi64 -", it already exists" , id); +if (cpu_sts &1 << id) { +error_setg (errp,"Unable to add CPU: %" PRIi64 +", it already exists" , id); + }else { +ec_acpi_space_poke (EC_ACPI_SPACE_CPUS , cpu_sts |1 << id); + }return ; }
@@ -939,11 +945,31 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)return ; } +ec_acpi_space_poke (EC_ACPI_SPACE_CPUS , cpu_sts |1 << id); icc_bridge =DEVICE (object_resolve_path_type ("icc-bridge" ,TYPE_ICC_BRIDGE ,NULL ));pc_new_cpu (current_cpu_model, apic_id, icc_bridge, errp); } +void pc_hot_del_cpu (const int64_t id,Error **errp) +{ +uint8_t cpu_sts =ec_acpi_space_peek (EC_ACPI_SPACE_CPUS ); + +if (id >= max_cpus) { +error_setg (errp,"Unable to del CPU: %" PRIi64 +", max allowed: %d" , id, max_cpus -1 ); +return ; + } + +if (cpu_sts &1 << id) { +ec_acpi_space_poke (EC_ACPI_SPACE_CPUS , cpu_sts & ~(1 << id)); +ec_acpi_space_poke (EC_ACPI_SPACE_CPUN , id); + }else { +error_setg (errp,"Unable to del CPU: %" PRIi64 +", it was not added before." , id); + } +} +void pc_cpus_init (const char *cpu_model,DeviceState *icc_bridge) {int i;
hw/i386/pc_piix.c +1 -0
@@ -334,6 +334,7 @@ static QEMUMachine pc_i440fx_machine_v1_5 = { .desc = "Standard PC (i440FX + PIIX, 1996)", .init = pc_init_pci, .hot_add_cpu = pc_hot_add_cpu, + .hot_del_cpu = pc_hot_del_cpu, .max_cpus = 255, .is_default =1 , DEFAULT_MACHINE_OPTIONS,
hw/i386/pc_q35.c +1 -0
@@ -221,6 +221,7 @@ static QEMUMachine pc_q35_machine_v1_5 = { .desc = "Standard PC (Q35 + ICH9, 2009)", .init = pc_q35_init, .hot_add_cpu = pc_hot_add_cpu, + .hot_del_cpu = pc_hot_del_cpu, .max_cpus = 255, DEFAULT_MACHINE_OPTIONS, };
include/hw/boards.h +3 -2
@@ -22,7 +22,7 @@ typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);typedef void QEMUMachineResetFunc (void ); -typedef void QEMUMachineHotAddCPUFunc (const int64_t id,Error **errp); +typedef void QEMUMachineHotAddDelCPUFunc (const int64_t id,Error **errp); typedef struct QEMUMachine { const char *name;
@@ -30,7 +30,8 @@ typedef struct QEMUMachine {const char *desc;QEMUMachineInitFunc *init;QEMUMachineResetFunc *reset; -QEMUMachineHotAddCPUFunc *hot_add_cpu; +QEMUMachineHotAddDelCPUFunc *hot_add_cpu; +QEMUMachineHotAddDelCPUFunc *hot_del_cpu;BlockInterfaceType block_default_type;int max_cpus; unsigned int no_serial:1,
include/hw/i386/pc.h +1 -0
@@ -79,6 +79,7 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);void pc_cpus_init (const char *cpu_model,DeviceState *icc_bridge);void pc_hot_add_cpu (const int64_t id,Error **errp); +void pc_hot_del_cpu (const int64_t id,Error **errp);void pc_acpi_init (const char *default_dsdt); void *pc_memory_init(MemoryRegion *system_memory, const char *kernel_filename,
qapi-schema.json +13 -0
@@ -1403,6 +1403,19 @@ { 'command': 'cpu-add', 'data': {'id': 'int'} } ## +# @cpu-del +# +# Deletes CPU with specified ID +# +# @id: ID of CPU to be created, valid values [0..max_cpus) +# +# Returns: Nothing on success +# +# Since 1.6 +## +{ 'command': 'cpu-del', 'data': {'id': 'int'} } + +## # @memsave: # # Save a portion of guest memory to a file.
qmp-commands.hx +23 -0
@@ -408,6 +408,29 @@ Example: EQMP { + .name = "cpu-del", + .args_type = "id:i", + .mhandler.cmd_new = qmp_marshal_input_cpu_del, + }, + +SQMP +cpu-del +------- + +Deletes virtual cpu + +Arguments: + +- "id": cpu id (json-int) + +Example: + +-> { "execute": "cpu-del", "arguments": { "id": 2 } } +<- { "return": {} } + +EQMP + + { .name = "memsave", .args_type = "val:l,size:i,filename:s,cpu:i?", .mhandler.cmd_new = qmp_marshal_input_memsave,
qmp.c +9 -0
@@ -118,6 +118,15 @@ void qmp_cpu_add(int64_t id, Error **errp) } } +void qmp_cpu_del (int64_t id,Error **errp) +{ +if (current_machine->hot_del_cpu) { + current_machine->hot_del_cpu (id, errp); + }else { +error_setg (errp,"Not supported" ); + } +} +#ifndef CONFIG_VNC /* If VNC support is enabled, the "true" query-vnc command is defined in the VNC subsystem */
Signature · 1 line
1.7.2.5
Re: [Qemu-devel] [PATCH RFC 6/7] qmp: add 'cpu-del' command
Quoted 12 lines · liguang
add 'cpu-del' as complementary of 'cpu-add', cpu-del doesn't really delete a previous created cpu for it depends on CPU-QOM which it's un-finished yet to unrealize it.
cpu-del just records the cpu-id that guest want to remove to keep status of ACPI cpu hot-remove process.Signed-off-by liguang <[email protected]>---
+++
b/qapi-schema.json
qapi-schema.json line 1410
Quoted 8 lines
qapi-schema.json +5
-0@@ -1403,6 +1403,19 @@ { 'command': 'cpu-add', 'data': {'id': 'int'} } ## +# @cpu-del +# +# Deletes CPU with specified ID +# +# @id: ID of CPU to be created, valid values [0..max_cpus)
s/created/unplugged/
Quoted 7 lines
qapi-schema.json +7
-0+# +# Returns: Nothing on success +# +# Since 1.6 +## +{ 'command': 'cpu-del', 'data': {'id': 'int'} } +
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH RFC 6/7] qmp: add 'cpu-del' command
Quoted 15 lines · 在 2013-05-28二的 20:33 -0600,Eric Blake写道:
Quoted 14 lines · liguang
add 'cpu-del' as complementary of 'cpu-add', cpu-del doesn't really delete a previous created cpu for it depends on CPU-QOM which it's un-finished yet to unrealize it.
cpu-del just records the cpu-id that guest want to remove to keep status of ACPI cpu hot-remove process.Signed-off-by liguang <[email protected]>---
+++
b/qapi-schema.jsonqapi-schema.json +0
-0@@ -1403,6 +1403,19 @@ { 'command': 'cpu-add', 'data': {'id': 'int'} }
Quoted 8 lines
qapi-schema.json line 1410
Quoted 6 lines
qapi-schema.json +5
-0## +# @cpu-del +# +# Deletes CPU with specified ID +# +# @id: ID of CPU to be created, valid values [0..max_cpus)s/created/unplugged/
OK, Thanks!
Quoted 9 lines
Quoted 8 lines
qapi-schema.json +7
-0+# +# Returns: Nothing on success +# +# Since 1.6 +## +{ 'command': 'cpu-del', 'data': {'id': 'int'} } +
RFC PATCH 7/7 pc: add EC qdev init for piix & q35
In reply to liguang--- hw/i386/pc_piix.c | 6 ++++++ hw/i386/pc_q35.c | 5 +++++ 2 files changed, 11 insertions(+), 0 deletions(-)
hw/i386/pc_piix.c +6 -0
@@ -46,6 +46,8 @@#include "exec/address-spaces.h" #include "hw/acpi/acpi.h" #include "cpu.h" +#include "hw/acpi/ec.h" +#ifdef CONFIG_XEN # include <xen/hvm/hvm_info_table.h> #endif
@@ -229,6 +231,10 @@ static void pc_init1(MemoryRegion *system_memory,if (has_pvpanic) {pvpanic_init (isa_bus); } + +if (qemu_ec_enabled ()) { +ec_dev_init (isa_bus); + } }static void pc_init_pci (QEMUMachineInitArgs *args)
hw/i386/pc_q35.c +5 -0
@@ -42,6 +42,7 @@#include "hw/ide/ahci.h" #include "hw/usb.h" #include "hw/cpu/icc_bus.h" +#include "hw/acpi/ec.h" /* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6
@@ -206,6 +207,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)if (has_pvpanic) {pvpanic_init (isa_bus); } + +if (qemu_ec_enabled ()) { +ec_dev_init (isa_bus); + } }static void pc_q35_init_1_4 (QEMUMachineInitArgs *args)
Signature · 1 line
1.7.2.5
Quoted 9 lines · On Wed, 29 May 2013 09:47:35 +0800 liguang <[email protected]> wrote:
patch 1 adds ACPI Embedded Controller (EC), refer-to:
ACPI SPEC v5 chapter 12
"ACPI Embedded Controller Interface Specification"EC is a standard ACPI device, it plays flexible roles, especially be event carrier, it can pass events between platform and OS, so OS can execute
_Qxxmethod which defined
by yourself and query EC's ACPI space which can be a buffer for
_Qxx is defined in ACPI tables (i.e. firmware) and OS can just execute it.
Quoted 11 lines
many purposes
here, I want to deliver CPU online/offline event between OS and QEMU for CPU hotplug feature, then we will don't need to "echo 1 >
/sys/devices/system/cpu/cpu1/online" again after 'cpu-add' and also for offline to do real cpu removal.
what I am trying to do is emulated physical addition/removal (like described by linux kernel document for cpu hotplug --linux-2.6/Documentation/cpu-hotplug.txt) for QEMU.
Quoted 8 lines
these RFC patches are sent for demo what I am trying to do.
the design process simply like following:
cpu-add/del --> EC space & sci setting --> kernel EC driver gpe handler
I
V
listen cpu hotplug event
Does this and following parts mean that guest OS must have platform specific driver to handle custom event?
Is there OS that can do it and below without a new driver?
Quoted 36 lines
I
V
query EC space for cpu status
I
V
trigger cpu online/offline processLi Guang (7)
acpi: add ACPI Embedded Controller support
ich9: add notifer for ec to generate sci
ec: add operations for_Qxxevents
piix4: add notifer for ec to generate sci
piix4: add events for cpu hotplug
qmp: add 'cpu-del' command
pc: add EC qdev init for piix & q35default-configs/x86_64-softmmu.mak | 1 + hw/acpi/Makefile.objs | 1 + hw/acpi/ec.c | 225 ++++++++++++++++++++++++++++++++++++ hw/acpi/ich9.c | 15 +++++++++++++++ hw/acpi/piix4.c | 22 ++++++++++++++ hw/i386/pc.c | 30 ++++++++++++++++++++++++++++-- hw/i386/pc_piix.c | 7 + hw/i386/pc_q35.c | 6 + include/hw/acpi/ec.h | 39 ++++++ include/hw/acpi/ich9.h | 1 + include/hw/boards.h | 5 +++-- include/hw/i386/pc.h | 1 + qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 23 +++++++++++++++++++++++ qmp.c | 9 +++++++++ 15 files changed, 390 insertions(+), 8 deletions(-) create mode 100644 hw/acpi/ec.c create mode 100644 include/hw/acpi/ec.h
Quoted 8 lines · 在 2013-05-30四的 16:14 +0200,Igor Mammedov写道:
Quoted 5 lines · On Wed, 29 May 2013 09:47:35 +0800 liguang <[email protected]> wrote:
patch 1 adds ACPI Embedded Controller (EC), refer-to:
ACPI SPEC v5 chapter 12
"ACPI Embedded Controller Interface Specification"
Quoted 6 lines
Quoted 4 lines
EC is a standard ACPI device, it plays flexible roles, especially be event carrier, it can pass events between platform and OS, so OS can execute
_Qxxmethod which defined
by yourself and query EC's ACPI space which can be a buffer for
_Qxxis defined in ACPI tables (i.e. firmware) and OS can just execute it.
Yes, but we decide what to there ourselves.
Quoted 14 lines
Quoted 14 lines
many purposes
here, I want to deliver CPU online/offline event between OS and QEMU for CPU hotplug feature, then we will don't need to "echo 1 >
/sys/devices/system/cpu/cpu1/online" again after 'cpu-add' and also for offline to do real cpu removal.
what I am trying to do is emulated physical addition/removal (like described by linux kernel document for cpu hotplug --linux-2.6/Documentation/cpu-hotplug.txt) for QEMU.these RFC patches are sent for demo what I am trying to do.
Quoted 8 lines
Quoted 6 lines
the design process simply like following:
cpu-add/del --> EC space & sci setting --> kernel EC driver gpe handler
I
V
listen cpu hotplug eventDoes this and following parts mean that guest OS must have platform specific driver to handle custom event?
Hmm..., I'm not quite sure, in my mind now, it do require a specific driver, but I think we can do all the things in _Qxx method if possible.
Quoted 39 lines
Is there OS that can do it and below without a new driver?
Quoted 36 lines
I
V
query EC space for cpu status
I
V
trigger cpu online/offline processLi Guang (7)
acpi: add ACPI Embedded Controller support
ich9: add notifer for ec to generate sci
ec: add operations for_Qxxevents
piix4: add notifer for ec to generate sci
piix4: add events for cpu hotplug
qmp: add 'cpu-del' command
pc: add EC qdev init for piix & q35default-configs/x86_64-softmmu.mak | 1 + hw/acpi/Makefile.objs | 1 + hw/acpi/ec.c | 225 ++++++++++++++++++++++++++++++++++++ hw/acpi/ich9.c | 15 +++++++++++++++ hw/acpi/piix4.c | 22 ++++++++++++++ hw/i386/pc.c | 30 ++++++++++++++++++++++++++++-- hw/i386/pc_piix.c | 7 + hw/i386/pc_q35.c | 6 + include/hw/acpi/ec.h | 39 ++++++ include/hw/acpi/ich9.h | 1 + include/hw/boards.h | 5 +++-- include/hw/i386/pc.h | 1 + qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 23 +++++++++++++++++++++++ qmp.c | 9 +++++++++ 15 files changed, 390 insertions(+), 8 deletions(-) create mode 100644 hw/acpi/ec.c create mode 100644 include/hw/acpi/ec.h