* [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug
@ 2015-04-28 8:24 Zhu Guihua
2015-04-28 8:32 ` Michael S. Tsirkin
2015-04-28 8:52 ` Igor Mammedov
0 siblings, 2 replies; 4+ messages in thread
From: Zhu Guihua @ 2015-04-28 8:24 UTC (permalink / raw)
To: qemu-devel, mst; +Cc: Zhu Guihua
Add a new API named acpi_send_gpe_event() to send hotplug SCI.
This API can be used by pci, cpu and memory hotplug.
This patch is rebased on pci branch in mst's tree.
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git
Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
---
v3:
-rebase on pci branch in mst's tree
-use the new API for memory hot unplug
v2:
-fix the coding style
---
hw/acpi/core.c | 7 +++++++
hw/acpi/cpu_hotplug.c | 3 +--
hw/acpi/memory_hotplug.c | 6 ++----
hw/acpi/pcihp.c | 7 ++-----
include/hw/acpi/acpi.h | 9 +++++++++
include/hw/acpi/memory_hotplug.h | 2 --
include/hw/acpi/pc-hotplug.h | 1 -
7 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 51913d6..b52be95 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -666,6 +666,13 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
return val;
}
+void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
+ AcpiHotplugStatus status)
+{
+ ar->gpe.sts[0] |= status;
+ acpi_update_sci(ar, irq);
+}
+
void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
{
int sci_level, pm1a_sts;
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index b8ebfad..f5b9972 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -59,8 +59,7 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq,
return;
}
- ar->gpe.sts[0] |= ACPI_CPU_HOTPLUG_STATUS;
- acpi_update_sci(ar, irq);
+ acpi_send_gpe_event(ar, irq, ACPI_CPU_HOTPLUG_STATUS);
}
void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index 34cef1e..2ff0d5c 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -241,8 +241,7 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
mdev->is_inserting = true;
/* do ACPI magic */
- ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
- acpi_update_sci(ar, irq);
+ acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
return;
}
@@ -260,8 +259,7 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
mdev->is_removing = true;
/* Do ACPI magic */
- ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
- acpi_update_sci(ar, irq);
+ acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
}
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 612fec0..4b9b2b0 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -46,7 +46,6 @@
# define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
#endif
-#define ACPI_PCI_HOTPLUG_STATUS 2
#define ACPI_PCIHP_ADDR 0xae00
#define ACPI_PCIHP_SIZE 0x0014
#define ACPI_PCIHP_LEGACY_SIZE 0x000f
@@ -203,8 +202,7 @@ void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
s->acpi_pcihp_pci_status[bsel].up |= (1U << slot);
- ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
- acpi_update_sci(ar, irq);
+ acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
}
void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
@@ -221,8 +219,7 @@ void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
- ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
- acpi_update_sci(ar, irq);
+ acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
}
static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index 1f678b4..7a712b3 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -91,6 +91,12 @@
/* PM2_CNT */
#define ACPI_BITMASK_ARB_DISABLE 0x0001
+typedef enum {
+ ACPI_PCI_HOTPLUG_STATUS = 2,
+ ACPI_CPU_HOTPLUG_STATUS = 4,
+ ACPI_MEMORY_HOTPLUG_STATUS = 8,
+} AcpiHotplugStatus;
+
/* structs */
typedef struct ACPIPMTimer ACPIPMTimer;
typedef struct ACPIPM1EVT ACPIPM1EVT;
@@ -172,6 +178,9 @@ void acpi_gpe_reset(ACPIREGS *ar);
void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val);
uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr);
+void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
+ AcpiHotplugStatus status);
+
void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq);
/* acpi.c */
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index 986223b..1342adb 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -5,8 +5,6 @@
#include "hw/acpi/acpi.h"
#include "migration/vmstate.h"
-#define ACPI_MEMORY_HOTPLUG_STATUS 8
-
/**
* MemStatus:
* @is_removing: the memory device in slot has been requested to be ejected.
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index 0513c1c..77b1569 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -16,7 +16,6 @@
* ONLY DEFINEs are permited in this file since it's shared
* between C and ASL code.
*/
-#define ACPI_CPU_HOTPLUG_STATUS 4
/* Limit for CPU arch IDs for CPU hotplug. All hotpluggable CPUs should
* have CPUClass.get_arch_id() < ACPI_CPU_HOTPLUG_ID_LIMIT.
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug
2015-04-28 8:24 [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug Zhu Guihua
@ 2015-04-28 8:32 ` Michael S. Tsirkin
2015-04-28 8:52 ` Igor Mammedov
1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-04-28 8:32 UTC (permalink / raw)
To: Zhu Guihua; +Cc: qemu-devel
On Tue, Apr 28, 2015 at 04:24:02PM +0800, Zhu Guihua wrote:
> Add a new API named acpi_send_gpe_event() to send hotplug SCI.
> This API can be used by pci, cpu and memory hotplug.
>
> This patch is rebased on pci branch in mst's tree.
> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git
>
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
> v3:
> -rebase on pci branch in mst's tree
> -use the new API for memory hot unplug
>
> v2:
> -fix the coding style
> ---
> hw/acpi/core.c | 7 +++++++
> hw/acpi/cpu_hotplug.c | 3 +--
> hw/acpi/memory_hotplug.c | 6 ++----
> hw/acpi/pcihp.c | 7 ++-----
> include/hw/acpi/acpi.h | 9 +++++++++
> include/hw/acpi/memory_hotplug.h | 2 --
> include/hw/acpi/pc-hotplug.h | 1 -
> 7 files changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> index 51913d6..b52be95 100644
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -666,6 +666,13 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
> return val;
> }
>
> +void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
> + AcpiHotplugStatus status)
> +{
> + ar->gpe.sts[0] |= status;
> + acpi_update_sci(ar, irq);
> +}
> +
> void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
> {
> int sci_level, pm1a_sts;
> diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
> index b8ebfad..f5b9972 100644
> --- a/hw/acpi/cpu_hotplug.c
> +++ b/hw/acpi/cpu_hotplug.c
> @@ -59,8 +59,7 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq,
> return;
> }
>
> - ar->gpe.sts[0] |= ACPI_CPU_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_CPU_HOTPLUG_STATUS);
> }
>
> void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index 34cef1e..2ff0d5c 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -241,8 +241,7 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> mdev->is_inserting = true;
>
> /* do ACPI magic */
> - ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
> return;
> }
>
> @@ -260,8 +259,7 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
> mdev->is_removing = true;
>
> /* Do ACPI magic */
> - ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
> }
>
> void acpi_memory_unplug_cb(MemHotplugState *mem_st,
> diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
> index 612fec0..4b9b2b0 100644
> --- a/hw/acpi/pcihp.c
> +++ b/hw/acpi/pcihp.c
> @@ -46,7 +46,6 @@
> # define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
> #endif
>
> -#define ACPI_PCI_HOTPLUG_STATUS 2
> #define ACPI_PCIHP_ADDR 0xae00
> #define ACPI_PCIHP_SIZE 0x0014
> #define ACPI_PCIHP_LEGACY_SIZE 0x000f
> @@ -203,8 +202,7 @@ void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>
> s->acpi_pcihp_pci_status[bsel].up |= (1U << slot);
>
> - ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
> }
>
> void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
> @@ -221,8 +219,7 @@ void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>
> s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
>
> - ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
> }
>
> static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
> diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
> index 1f678b4..7a712b3 100644
> --- a/include/hw/acpi/acpi.h
> +++ b/include/hw/acpi/acpi.h
> @@ -91,6 +91,12 @@
> /* PM2_CNT */
> #define ACPI_BITMASK_ARB_DISABLE 0x0001
>
> +typedef enum {
> + ACPI_PCI_HOTPLUG_STATUS = 2,
> + ACPI_CPU_HOTPLUG_STATUS = 4,
> + ACPI_MEMORY_HOTPLUG_STATUS = 8,
> +} AcpiHotplugStatus;
> +
> /* structs */
> typedef struct ACPIPMTimer ACPIPMTimer;
> typedef struct ACPIPM1EVT ACPIPM1EVT;
Please add a comment explaining these are
part of guest ABI and can not be changed.
> @@ -172,6 +178,9 @@ void acpi_gpe_reset(ACPIREGS *ar);
> void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val);
> uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr);
>
> +void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
> + AcpiHotplugStatus status);
> +
> void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq);
>
> /* acpi.c */
> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
> index 986223b..1342adb 100644
> --- a/include/hw/acpi/memory_hotplug.h
> +++ b/include/hw/acpi/memory_hotplug.h
> @@ -5,8 +5,6 @@
> #include "hw/acpi/acpi.h"
> #include "migration/vmstate.h"
>
> -#define ACPI_MEMORY_HOTPLUG_STATUS 8
> -
> /**
> * MemStatus:
> * @is_removing: the memory device in slot has been requested to be ejected.
> diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
> index 0513c1c..77b1569 100644
> --- a/include/hw/acpi/pc-hotplug.h
> +++ b/include/hw/acpi/pc-hotplug.h
> @@ -16,7 +16,6 @@
> * ONLY DEFINEs are permited in this file since it's shared
> * between C and ASL code.
> */
> -#define ACPI_CPU_HOTPLUG_STATUS 4
>
> /* Limit for CPU arch IDs for CPU hotplug. All hotpluggable CPUs should
> * have CPUClass.get_arch_id() < ACPI_CPU_HOTPLUG_ID_LIMIT.
> --
> 1.9.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug
2015-04-28 8:24 [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug Zhu Guihua
2015-04-28 8:32 ` Michael S. Tsirkin
@ 2015-04-28 8:52 ` Igor Mammedov
2015-04-28 9:04 ` Zhu Guihua
1 sibling, 1 reply; 4+ messages in thread
From: Igor Mammedov @ 2015-04-28 8:52 UTC (permalink / raw)
To: Zhu Guihua; +Cc: qemu-devel, mst
On Tue, 28 Apr 2015 16:24:02 +0800
Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:
> Add a new API named acpi_send_gpe_event() to send hotplug SCI.
> This API can be used by pci, cpu and memory hotplug.
>
> This patch is rebased on pci branch in mst's tree.
> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git
>
> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
> ---
> v3:
> -rebase on pci branch in mst's tree
> -use the new API for memory hot unplug
>
> v2:
> -fix the coding style
> ---
> hw/acpi/core.c | 7 +++++++
> hw/acpi/cpu_hotplug.c | 3 +--
> hw/acpi/memory_hotplug.c | 6 ++----
> hw/acpi/pcihp.c | 7 ++-----
> include/hw/acpi/acpi.h | 9 +++++++++
> include/hw/acpi/memory_hotplug.h | 2 --
> include/hw/acpi/pc-hotplug.h | 1 -
> 7 files changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> index 51913d6..b52be95 100644
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -666,6 +666,13 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
> return val;
> }
>
> +void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
> + AcpiHotplugStatus status)
> +{
> + ar->gpe.sts[0] |= status;
> + acpi_update_sci(ar, irq);
> +}
> +
> void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
> {
> int sci_level, pm1a_sts;
> diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
> index b8ebfad..f5b9972 100644
> --- a/hw/acpi/cpu_hotplug.c
> +++ b/hw/acpi/cpu_hotplug.c
> @@ -59,8 +59,7 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq,
> return;
> }
>
> - ar->gpe.sts[0] |= ACPI_CPU_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_CPU_HOTPLUG_STATUS);
> }
>
> void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
> index 34cef1e..2ff0d5c 100644
> --- a/hw/acpi/memory_hotplug.c
> +++ b/hw/acpi/memory_hotplug.c
> @@ -241,8 +241,7 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
> mdev->is_inserting = true;
>
> /* do ACPI magic */
> - ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
> return;
> }
>
> @@ -260,8 +259,7 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
> mdev->is_removing = true;
>
> /* Do ACPI magic */
> - ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
> }
>
> void acpi_memory_unplug_cb(MemHotplugState *mem_st,
> diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
> index 612fec0..4b9b2b0 100644
> --- a/hw/acpi/pcihp.c
> +++ b/hw/acpi/pcihp.c
> @@ -46,7 +46,6 @@
> # define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
> #endif
>
> -#define ACPI_PCI_HOTPLUG_STATUS 2
> #define ACPI_PCIHP_ADDR 0xae00
> #define ACPI_PCIHP_SIZE 0x0014
> #define ACPI_PCIHP_LEGACY_SIZE 0x000f
> @@ -203,8 +202,7 @@ void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>
> s->acpi_pcihp_pci_status[bsel].up |= (1U << slot);
>
> - ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
> }
>
> void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
> @@ -221,8 +219,7 @@ void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>
> s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
>
> - ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
> - acpi_update_sci(ar, irq);
> + acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
> }
>
> static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
> diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
> index 1f678b4..7a712b3 100644
> --- a/include/hw/acpi/acpi.h
> +++ b/include/hw/acpi/acpi.h
> @@ -91,6 +91,12 @@
> /* PM2_CNT */
> #define ACPI_BITMASK_ARB_DISABLE 0x0001
>
> +typedef enum {
> + ACPI_PCI_HOTPLUG_STATUS = 2,
> + ACPI_CPU_HOTPLUG_STATUS = 4,
> + ACPI_MEMORY_HOTPLUG_STATUS = 8,
> +} AcpiHotplugStatus;
maybe AcpiGPEStatusBits?
> +
> /* structs */
> typedef struct ACPIPMTimer ACPIPMTimer;
> typedef struct ACPIPM1EVT ACPIPM1EVT;
> @@ -172,6 +178,9 @@ void acpi_gpe_reset(ACPIREGS *ar);
> void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val);
> uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr);
>
> +void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
> + AcpiHotplugStatus status);
> +
> void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq);
>
> /* acpi.c */
> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
> index 986223b..1342adb 100644
> --- a/include/hw/acpi/memory_hotplug.h
> +++ b/include/hw/acpi/memory_hotplug.h
> @@ -5,8 +5,6 @@
> #include "hw/acpi/acpi.h"
> #include "migration/vmstate.h"
>
> -#define ACPI_MEMORY_HOTPLUG_STATUS 8
> -
> /**
> * MemStatus:
> * @is_removing: the memory device in slot has been requested to be ejected.
> diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
> index 0513c1c..77b1569 100644
> --- a/include/hw/acpi/pc-hotplug.h
> +++ b/include/hw/acpi/pc-hotplug.h
> @@ -16,7 +16,6 @@
> * ONLY DEFINEs are permited in this file since it's shared
> * between C and ASL code.
> */
> -#define ACPI_CPU_HOTPLUG_STATUS 4
>
> /* Limit for CPU arch IDs for CPU hotplug. All hotpluggable CPUs should
> * have CPUClass.get_arch_id() < ACPI_CPU_HOTPLUG_ID_LIMIT.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug
2015-04-28 8:52 ` Igor Mammedov
@ 2015-04-28 9:04 ` Zhu Guihua
0 siblings, 0 replies; 4+ messages in thread
From: Zhu Guihua @ 2015-04-28 9:04 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-devel, mst
On 04/28/2015 04:52 PM, Igor Mammedov wrote:
> On Tue, 28 Apr 2015 16:24:02 +0800
> Zhu Guihua <zhugh.fnst@cn.fujitsu.com> wrote:
>
>> Add a new API named acpi_send_gpe_event() to send hotplug SCI.
>> This API can be used by pci, cpu and memory hotplug.
>>
>> This patch is rebased on pci branch in mst's tree.
>> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git
>>
>> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
>> ---
>> v3:
>> -rebase on pci branch in mst's tree
>> -use the new API for memory hot unplug
>>
>> v2:
>> -fix the coding style
>> ---
>> hw/acpi/core.c | 7 +++++++
>> hw/acpi/cpu_hotplug.c | 3 +--
>> hw/acpi/memory_hotplug.c | 6 ++----
>> hw/acpi/pcihp.c | 7 ++-----
>> include/hw/acpi/acpi.h | 9 +++++++++
>> include/hw/acpi/memory_hotplug.h | 2 --
>> include/hw/acpi/pc-hotplug.h | 1 -
>> 7 files changed, 21 insertions(+), 14 deletions(-)
>>
>> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
>> index 51913d6..b52be95 100644
>> --- a/hw/acpi/core.c
>> +++ b/hw/acpi/core.c
>> @@ -666,6 +666,13 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
>> return val;
>> }
>>
>> +void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
>> + AcpiHotplugStatus status)
>> +{
>> + ar->gpe.sts[0] |= status;
>> + acpi_update_sci(ar, irq);
>> +}
>> +
>> void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
>> {
>> int sci_level, pm1a_sts;
>> diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
>> index b8ebfad..f5b9972 100644
>> --- a/hw/acpi/cpu_hotplug.c
>> +++ b/hw/acpi/cpu_hotplug.c
>> @@ -59,8 +59,7 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq,
>> return;
>> }
>>
>> - ar->gpe.sts[0] |= ACPI_CPU_HOTPLUG_STATUS;
>> - acpi_update_sci(ar, irq);
>> + acpi_send_gpe_event(ar, irq, ACPI_CPU_HOTPLUG_STATUS);
>> }
>>
>> void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
>> diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
>> index 34cef1e..2ff0d5c 100644
>> --- a/hw/acpi/memory_hotplug.c
>> +++ b/hw/acpi/memory_hotplug.c
>> @@ -241,8 +241,7 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
>> mdev->is_inserting = true;
>>
>> /* do ACPI magic */
>> - ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
>> - acpi_update_sci(ar, irq);
>> + acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
>> return;
>> }
>>
>> @@ -260,8 +259,7 @@ void acpi_memory_unplug_request_cb(ACPIREGS *ar, qemu_irq irq,
>> mdev->is_removing = true;
>>
>> /* Do ACPI magic */
>> - ar->gpe.sts[0] |= ACPI_MEMORY_HOTPLUG_STATUS;
>> - acpi_update_sci(ar, irq);
>> + acpi_send_gpe_event(ar, irq, ACPI_MEMORY_HOTPLUG_STATUS);
>> }
>>
>> void acpi_memory_unplug_cb(MemHotplugState *mem_st,
>> diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
>> index 612fec0..4b9b2b0 100644
>> --- a/hw/acpi/pcihp.c
>> +++ b/hw/acpi/pcihp.c
>> @@ -46,7 +46,6 @@
>> # define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
>> #endif
>>
>> -#define ACPI_PCI_HOTPLUG_STATUS 2
>> #define ACPI_PCIHP_ADDR 0xae00
>> #define ACPI_PCIHP_SIZE 0x0014
>> #define ACPI_PCIHP_LEGACY_SIZE 0x000f
>> @@ -203,8 +202,7 @@ void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>>
>> s->acpi_pcihp_pci_status[bsel].up |= (1U << slot);
>>
>> - ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
>> - acpi_update_sci(ar, irq);
>> + acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
>> }
>>
>> void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>> @@ -221,8 +219,7 @@ void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
>>
>> s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
>>
>> - ar->gpe.sts[0] |= ACPI_PCI_HOTPLUG_STATUS;
>> - acpi_update_sci(ar, irq);
>> + acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS);
>> }
>>
>> static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
>> diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
>> index 1f678b4..7a712b3 100644
>> --- a/include/hw/acpi/acpi.h
>> +++ b/include/hw/acpi/acpi.h
>> @@ -91,6 +91,12 @@
>> /* PM2_CNT */
>> #define ACPI_BITMASK_ARB_DISABLE 0x0001
>>
>> +typedef enum {
>> + ACPI_PCI_HOTPLUG_STATUS = 2,
>> + ACPI_CPU_HOTPLUG_STATUS = 4,
>> + ACPI_MEMORY_HOTPLUG_STATUS = 8,
>> +} AcpiHotplugStatus;
> maybe AcpiGPEStatusBits?
Yes, this looks better. I will change it.
Thanks,
Zhu
>
>> +
>> /* structs */
>> typedef struct ACPIPMTimer ACPIPMTimer;
>> typedef struct ACPIPM1EVT ACPIPM1EVT;
>> @@ -172,6 +178,9 @@ void acpi_gpe_reset(ACPIREGS *ar);
>> void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val);
>> uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr);
>>
>> +void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
>> + AcpiHotplugStatus status);
>> +
>> void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq);
>>
>> /* acpi.c */
>> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
>> index 986223b..1342adb 100644
>> --- a/include/hw/acpi/memory_hotplug.h
>> +++ b/include/hw/acpi/memory_hotplug.h
>> @@ -5,8 +5,6 @@
>> #include "hw/acpi/acpi.h"
>> #include "migration/vmstate.h"
>>
>> -#define ACPI_MEMORY_HOTPLUG_STATUS 8
>> -
>> /**
>> * MemStatus:
>> * @is_removing: the memory device in slot has been requested to be ejected.
>> diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
>> index 0513c1c..77b1569 100644
>> --- a/include/hw/acpi/pc-hotplug.h
>> +++ b/include/hw/acpi/pc-hotplug.h
>> @@ -16,7 +16,6 @@
>> * ONLY DEFINEs are permited in this file since it's shared
>> * between C and ASL code.
>> */
>> -#define ACPI_CPU_HOTPLUG_STATUS 4
>>
>> /* Limit for CPU arch IDs for CPU hotplug. All hotpluggable CPUs should
>> * have CPUClass.get_arch_id() < ACPI_CPU_HOTPLUG_ID_LIMIT.
> .
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-28 9:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 8:24 [Qemu-devel] [PATCH v3] acpi: add acpi_send_gpe_event() to rise sci for hotplug Zhu Guihua
2015-04-28 8:32 ` Michael S. Tsirkin
2015-04-28 8:52 ` Igor Mammedov
2015-04-28 9:04 ` Zhu Guihua
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.