Re: [Qemu-devel] [RFC PATCH 11/11] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables

2015-01-25 Thread Shannon Zhao
On 2015/1/25 2:56, Laszlo Ersek wrote:
 On 01/24/15 10:21, Shannon Zhao wrote:
 Expose the needed device information to the table generation
 insfrastructure and register a machine_init_done notify to
 call virt_acpi_build().

 Add CONFIG_ACPI to arm-softmmu.mak, but there is compile error.
 Don't include unnecessary file for ARM. Maybe this way is not
 right, fix me please.

 Signed-off-by: Shannon Zhao zhaoshengl...@huawei.com
 ---
  default-configs/arm-softmmu.mak  |1 +
  default-configs/i386-softmmu.mak |3 ++
  default-configs/mips-softmmu.mak |3 ++
  default-configs/mips64-softmmu.mak   |3 ++
  default-configs/mips64el-softmmu.mak |3 ++
  default-configs/mipsel-softmmu.mak   |3 ++
  default-configs/x86_64-softmmu.mak   |3 ++
  hw/acpi/Makefile.objs|5 ++-
  hw/arm/virt.c|   59 
 +++--
  hw/i2c/Makefile.objs |2 +-
  10 files changed, 78 insertions(+), 7 deletions(-)
 
 diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
 index cad0355..4e3f15f 100644
 --- a/hw/acpi/Makefile.objs
 +++ b/hw/acpi/Makefile.objs
 @@ -1,5 +1,6 @@
 -common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o
 -common-obj-$(CONFIG_ACPI) += memory_hotplug.o
 +common-obj-$(CONFIG_ACPI_CORE) += core.o piix4.o ich9.o pcihp.o
 +common-obj-$(CONFIG_ACPI_HOTPLUG) += cpu_hotplug.o
 
 This line has a typo and it breaks the linking of qemu-system-x86_64.
 You need to say
 
   CONFIG_ACPI_CPU_HOTPLUG
 
 here, not
 
   CONFIG_ACPI_HOTPLUG
 

Laszlo, Thanks. Will fix this.
Thanks,
Shannon




Re: [Qemu-devel] [RFC PATCH 11/11] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables

2015-01-24 Thread Laszlo Ersek
On 01/24/15 10:21, Shannon Zhao wrote:
 Expose the needed device information to the table generation
 insfrastructure and register a machine_init_done notify to
 call virt_acpi_build().
 
 Add CONFIG_ACPI to arm-softmmu.mak, but there is compile error.
 Don't include unnecessary file for ARM. Maybe this way is not
 right, fix me please.
 
 Signed-off-by: Shannon Zhao zhaoshengl...@huawei.com
 ---
  default-configs/arm-softmmu.mak  |1 +
  default-configs/i386-softmmu.mak |3 ++
  default-configs/mips-softmmu.mak |3 ++
  default-configs/mips64-softmmu.mak   |3 ++
  default-configs/mips64el-softmmu.mak |3 ++
  default-configs/mipsel-softmmu.mak   |3 ++
  default-configs/x86_64-softmmu.mak   |3 ++
  hw/acpi/Makefile.objs|5 ++-
  hw/arm/virt.c|   59 +++--
  hw/i2c/Makefile.objs |2 +-
  10 files changed, 78 insertions(+), 7 deletions(-)

 diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
 index cad0355..4e3f15f 100644
 --- a/hw/acpi/Makefile.objs
 +++ b/hw/acpi/Makefile.objs
 @@ -1,5 +1,6 @@
 -common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o
 -common-obj-$(CONFIG_ACPI) += memory_hotplug.o
 +common-obj-$(CONFIG_ACPI_CORE) += core.o piix4.o ich9.o pcihp.o
 +common-obj-$(CONFIG_ACPI_HOTPLUG) += cpu_hotplug.o

This line has a typo and it breaks the linking of qemu-system-x86_64.
You need to say

  CONFIG_ACPI_CPU_HOTPLUG

here, not

  CONFIG_ACPI_HOTPLUG

Thanks
Laszlo




[Qemu-devel] [RFC PATCH 11/11] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables

2015-01-24 Thread Shannon Zhao
Expose the needed device information to the table generation
insfrastructure and register a machine_init_done notify to
call virt_acpi_build().

Add CONFIG_ACPI to arm-softmmu.mak, but there is compile error.
Don't include unnecessary file for ARM. Maybe this way is not
right, fix me please.

Signed-off-by: Shannon Zhao zhaoshengl...@huawei.com
---
 default-configs/arm-softmmu.mak  |1 +
 default-configs/i386-softmmu.mak |3 ++
 default-configs/mips-softmmu.mak |3 ++
 default-configs/mips64-softmmu.mak   |3 ++
 default-configs/mips64el-softmmu.mak |3 ++
 default-configs/mipsel-softmmu.mak   |3 ++
 default-configs/x86_64-softmmu.mak   |3 ++
 hw/acpi/Makefile.objs|5 ++-
 hw/arm/virt.c|   59 +++--
 hw/i2c/Makefile.objs |2 +-
 10 files changed, 78 insertions(+), 7 deletions(-)

diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index f3513fa..3c89f53 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -88,3 +88,4 @@ CONFIG_INTEGRATOR_DEBUG=y
 CONFIG_ALLWINNER_A10_PIT=y
 CONFIG_ALLWINNER_A10_PIC=y
 CONFIG_ALLWINNER_A10=y
+CONFIG_ACPI=y
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 8e08841..3a5fe74 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -17,6 +17,9 @@ CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
+CONFIG_ACPI_CORE=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 2a80b04..d37ada7 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -17,6 +17,9 @@ CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
+CONFIG_ACPI_CORE=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_PIIX4=y
diff --git a/default-configs/mips64-softmmu.mak 
b/default-configs/mips64-softmmu.mak
index f1f933b..b15d6c0 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -17,6 +17,9 @@ CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
+CONFIG_ACPI_CORE=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_PIIX4=y
diff --git a/default-configs/mips64el-softmmu.mak 
b/default-configs/mips64el-softmmu.mak
index 317b151..494a7e7 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -17,6 +17,9 @@ CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
+CONFIG_ACPI_CORE=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_PIIX4=y
diff --git a/default-configs/mipsel-softmmu.mak 
b/default-configs/mipsel-softmmu.mak
index 7708185..0d2173b 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -17,6 +17,9 @@ CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
+CONFIG_ACPI_CORE=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_PIIX4=y
diff --git a/default-configs/x86_64-softmmu.mak 
b/default-configs/x86_64-softmmu.mak
index 66557ac..79eb980 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -17,6 +17,9 @@ CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_ACPI=y
+CONFIG_ACPI_CORE=y
+CONFIG_ACPI_MEMORY_HOTPLUG=y
+CONFIG_ACPI_CPU_HOTPLUG=y
 CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_IDE_ISA=y
diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index cad0355..4e3f15f 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -1,5 +1,6 @@
-common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o
-common-obj-$(CONFIG_ACPI) += memory_hotplug.o
+common-obj-$(CONFIG_ACPI_CORE) += core.o piix4.o ich9.o pcihp.o
+common-obj-$(CONFIG_ACPI_HOTPLUG) += cpu_hotplug.o
+common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
 common-obj-$(CONFIG_ACPI) += acpi_interface.o
 common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
 common-obj-$(CONFIG_ACPI) += acpi-build-utils.o
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 2353440..63ee9b3 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -42,6 +42,7 @@
 #include exec/address-spaces.h
 #include qemu/bitops.h
 #include qemu/error-report.h
+#include hw/arm/virt-acpi-build.h
 
 #define NUM_VIRTIO_TRANSPORTS 32
 
@@ -59,6 +60,11 @@
 #define GIC_FDT_IRQ_PPI_CPU_START 8
 #define GIC_FDT_IRQ_PPI_CPU_WIDTH 8
 
+#define ARCH_TIMER_VIRT_IRQ   11
+#define ARCH_TIMER_S_EL1_IRQ  13
+#define ARCH_TIMER_NS_EL1_IRQ 14
+#define ARCH_TIMER_NS_EL2_IRQ 10
+
 enum {
 VIRT_FLASH,
 VIRT_MEM,
@@ -139,6 +145,29 @@ static const int a15irqmap[] = {
 [VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
 };
 
+static const struct acpi_madt_info madt_info = {
+