All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
@ 2015-12-09 23:40 Igor Mammedov
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
                   ` (76 more replies)
  0 siblings, 77 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

Due to huge size, CCing only cover letter instead of individual patches.

Series consist of 2 parts the 1st part prefixed 'acpi:' adds necessary
AML API functions and the second part converts DSDT using existing and
new AML API.

Series does exact byte by byte conversion and passes ACPI tables
'make check' tests.
The conversion first moves common for PIIX4/Q35 parts, getting rid of *.dsl
includes and then converts PIIX4 and Q35 parts of DSDT.

Diff-stat looks nice but actual code base is reduced by ~2000LOC
while the rest of 10000 removals is dropping precompiled AML
templates from tree.

There are some AML parts that could be optimized/simplified and shared
between PIIX4/Q35/ARM but doing it will break exact match with original
tests, hence it's left out of the scope of this series.

CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
CC: Peter Maydell <peter.maydell@linaro.org> (maintainer:ARM)
CC: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
CC: Richard Henderson <rth@twiddle.net> (maintainer:X86)
CC: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
CC: qemu-arm@nongnu.org (open list:ARM ACPI Subsystem)

Igor Mammedov (70):
  tests: acpi: print ASL diff in verbose mode
  acpi: add aml_lgreater_equal()
  acpi: add aml_create_qword_field()
  acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
  acpi: extend aml_add() to accept target argument
  acpi: add aml_decrement() and aml_subtract()
  acpi: add aml_call0() helper
  acpi: add aml_to_integer()
  acpi: extend aml_shiftright() to accept target argument
  acpi: add aml_alias()
  acpi: add aml_sleep()
  acpi: add aml_lor()
  acpi: add aml_lgreater()
  acpi: extend aml_field() to support LockRule
  acpi: add aml_to_hexstring()
  acpi: add aml_to_buffer()
  acpi add aml_dma()
  acpi: extend aml_or() to accept target argument
  acpi: extend aml_and() to accept target argument
  acpi: extend aml_interrupt() to support multiple irqs
  pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  pc: acpi: memhp: move MHPD._STA method into SSDT
  pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
  pc: acpi: memhp: move MHPD.MSCN method into SSDT
  pc: acpi: memhp: move MHPD.MRST method into SSDT
  pc: acpi: memhp: move MHPD.MPXM method into SSDT
  pc: acpi: memhp: move MHPD.MOST method into SSDT
  pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
  pc: acpi: memhp: move MHPD.MCRS method into SSDT
  pc: acpi: memhp: move MHPD Device into SSDT
  pc: acpi: factor out memhp code from build_ssdt() into separate
    function
  pc: acpi: memhp: move \_GPE._E03 into SSDT
  pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
  pc: acpi: drop unused CPU_STATUS_LEN from DSDT
  pc: acpi: cpuhp: move CPEJ() method to SSDT
  pc: acpi: cpuhp: move CPMA() method into SSDT
  pc: acpi: cpuhp: move CPST() method into SSDT
  pc: acpi: cpuhp: move PRSC() method into SSDT
  pc: acpi: cpuhp: move \_GPE._E02() into SSDT
  pc: acpi: factor out cpu hotplug code from build_ssdt() into separate
    function
  pc: acpi: move HPET from DSDT to SSDT
  pc: acpi: move DBUG() from DSDT to SSDT
  pc: acpi: move RTC device from DSDT to SSDT
  pc: acpi: move KBD device from DSDT to SSDT
  pc: acpi: move MOU device from DSDT to SSDT
  pc: acpi: move FDC0 device from DSDT to SSDT
  pc: acpi: move LPT device from DSDT to SSDT
  pc: acpi: move COM devices from DSDT to SSDT
  pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
  pc: acpi: move remaining GPE handlers into SSDT
  pc: acpi: pci: move link devices into SSDT
  pc: acpi: piix4: move IQCR() into SSDT
  pc: acpi: piix4: move IQST() into SSDT
  pc: acpi: piix4: move PCI0._PRT() into SSDT
  pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
  pc: acpi: piix4: acpi move PCI0 device to SSDT
  pc: acpi: q35: move GSI links to SSDT
  pc: acpi: q35: move link devices to SSDT
  pc: acpi: q35: move IQCR() into SSDT
  pc: acpi: q35: move IQST() into SSDT
  pc: acpi: q35: move ISA bridge into SSDT
  pc: acpi: q35: move _PRT() into SSDT
  pc: acpi: q35: move PRTA routing table into SSDT
  pc: acpi: q35: move PRTP routing table into SSDT
  pc: acpi: q35: move _PIC() method into SSDT
  pc: acpi: q35: move PCI0._OSC() method into SSDT
  pc: acpi: q35: move PCI0 device definition into SSDT
  pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
  pc: acpi: switch to AML API composed DSDT
  pc: acpi: remove unused ASL templates and related blobs/utils

Xiao Guangrong (4):
  acpi: add aml_derefof
  acpi: add aml_sizeof
  acpi: add aml_mutex(), aml_acquire(), aml_release()
  acpi: support serialized method

 hw/acpi/Makefile.objs               |    4 +-
 hw/acpi/aml-build.c                 |  294 +-
 hw/acpi/cpu_hotplug_acpi_table.c    |  124 +
 hw/acpi/memory_hotplug_acpi_table.c |  249 ++
 hw/arm/virt-acpi-build.c            |   41 +-
 hw/i386/Makefile.objs               |   31 +-
 hw/i386/acpi-build.c                | 1329 ++++--
 hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   90 -
 hw/i386/acpi-dsdt-dbug.dsl          |   41 -
 hw/i386/acpi-dsdt-hpet.dsl          |   48 -
 hw/i386/acpi-dsdt-isa.dsl           |  117 -
 hw/i386/acpi-dsdt-mem-hotplug.dsl   |  171 -
 hw/i386/acpi-dsdt.dsl               |  303 --
 hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
 hw/i386/q35-acpi-dsdt.dsl           |  436 --
 hw/i386/q35-acpi-dsdt.hex.generated | 7610 -----------------------------------
 hw/timer/hpet.c                     |    2 +-
 include/hw/acpi/aml-build.h         |   66 +-
 include/hw/acpi/cpu_hotplug.h       |   10 +
 include/hw/acpi/memory_hotplug.h    |    9 +
 include/hw/acpi/pc-hotplug.h        |   44 +-
 include/hw/timer/hpet.h             |    1 +
 scripts/acpi_extract.py             |  367 --
 scripts/acpi_extract_preprocess.py  |   51 -
 scripts/update-acpi.sh              |    4 -
 tests/bios-tables-test.c            |    7 +
 26 files changed, 1848 insertions(+), 12573 deletions(-)
 create mode 100644 hw/acpi/cpu_hotplug_acpi_table.c
 create mode 100644 hw/acpi/memory_hotplug_acpi_table.c
 delete mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl
 delete mode 100644 hw/i386/acpi-dsdt-dbug.dsl
 delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl
 delete mode 100644 hw/i386/acpi-dsdt-isa.dsl
 delete mode 100644 hw/i386/acpi-dsdt-mem-hotplug.dsl
 delete mode 100644 hw/i386/acpi-dsdt.dsl
 delete mode 100644 hw/i386/acpi-dsdt.hex.generated
 delete mode 100644 hw/i386/q35-acpi-dsdt.dsl
 delete mode 100644 hw/i386/q35-acpi-dsdt.hex.generated
 delete mode 100755 scripts/acpi_extract.py
 delete mode 100755 scripts/acpi_extract_preprocess.py
 delete mode 100644 scripts/update-acpi.sh

-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
@ 2015-12-09 23:40 ` Igor Mammedov
  2015-12-10 12:50   ` Marcel Apfelbaum
  2015-12-22 15:28   ` Michael S. Tsirkin
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 02/74] acpi: add aml_derefof Igor Mammedov
                   ` (75 subsequent siblings)
  76 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 6d37332..50678b5 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
                         (gchar *)&signature,
                         sdt->asl_file, sdt->aml_file,
                         exp_sdt->asl_file, exp_sdt->aml_file);
+                if (getenv("V")) {
+                    int ret G_GNUC_UNUSED;
+                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
+                        exp_sdt->asl_file, sdt->asl_file);
+                    ret = system(diff) ;
+                    g_free(diff);
+                }
           }
         }
         g_string_free(asl, true);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 02/74] acpi: add aml_derefof
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
@ 2015-12-09 23:40 ` Igor Mammedov
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 03/74] acpi: add aml_sizeof Igor Mammedov
                   ` (74 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiao Guangrong

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

Implement DeRefOf term which is used by NVDIMM _DSM method in later patch

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
---
 hw/acpi/aml-build.c         | 8 ++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index a00a0ab..90e3130 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1135,6 +1135,14 @@ Aml *aml_unicode(const char *str)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefDerefOf */
+Aml *aml_derefof(Aml *arg)
+{
+    Aml *var = aml_opcode(0x83 /* DerefOfOp */);
+    aml_append(var, arg);
+    return var;
+}
+
 void
 build_header(GArray *linker, GArray *table_data,
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 1b632dc..5a03d33 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -274,6 +274,7 @@ Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
 Aml *aml_varpackage(uint32_t num_elements);
 Aml *aml_touuid(const char *uuid);
 Aml *aml_unicode(const char *str);
+Aml *aml_derefof(Aml *arg);
 
 void
 build_header(GArray *linker, GArray *table_data,
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 03/74] acpi: add aml_sizeof
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 02/74] acpi: add aml_derefof Igor Mammedov
@ 2015-12-09 23:40 ` Igor Mammedov
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal() Igor Mammedov
                   ` (73 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiao Guangrong

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

Implement SizeOf term which is used by NVDIMM _DSM method in later patch

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 8 ++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 90e3130..dc59c08 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1143,6 +1143,14 @@ Aml *aml_derefof(Aml *arg)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefSizeOf */
+Aml *aml_sizeof(Aml *arg)
+{
+    Aml *var = aml_opcode(0x87 /* SizeOfOp */);
+    aml_append(var, arg);
+    return var;
+}
+
 void
 build_header(GArray *linker, GArray *table_data,
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 5a03d33..7296efb 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -275,6 +275,7 @@ Aml *aml_varpackage(uint32_t num_elements);
 Aml *aml_touuid(const char *uuid);
 Aml *aml_unicode(const char *str);
 Aml *aml_derefof(Aml *arg);
+Aml *aml_sizeof(Aml *arg);
 
 void
 build_header(GArray *linker, GArray *table_data,
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (2 preceding siblings ...)
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 03/74] acpi: add aml_sizeof Igor Mammedov
@ 2015-12-09 23:40 ` Igor Mammedov
  2015-12-10 12:52   ` Marcel Apfelbaum
  2015-12-11  2:39   ` Shannon Zhao
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 05/74] acpi: add aml_mutex(), aml_acquire(), aml_release() Igor Mammedov
                   ` (72 subsequent siblings)
  76 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 11 +++++++++++
 include/hw/acpi/aml-build.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index dc59c08..c1a30a3 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -672,6 +672,17 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreaterEqual */
+Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2)
+{
+    /* LGreaterEqualOp := LNotOp LLessOp */
+    Aml *var = aml_opcode(0x92 /* LNotOp */);
+    build_append_byte(var->buf, 0x95 /* LLessOp */);
+    aml_append(var, arg1);
+    aml_append(var, arg2);
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
 Aml *aml_if(Aml *predicate)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 7296efb..2a4f815 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -229,6 +229,7 @@ Aml *aml_local(int num);
 Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
 Aml *aml_lnot(Aml *arg);
 Aml *aml_equal(Aml *arg1, Aml *arg2);
+Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
 Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
                    const char *name_format, ...) GCC_FMT_ATTR(4, 5);
 Aml *aml_eisaid(const char *str);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 05/74] acpi: add aml_mutex(), aml_acquire(), aml_release()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (3 preceding siblings ...)
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal() Igor Mammedov
@ 2015-12-09 23:40 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field() Igor Mammedov
                   ` (71 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiao Guangrong

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 33 +++++++++++++++++++++++++++++++++
 include/hw/acpi/aml-build.h |  3 +++
 2 files changed, 36 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index c1a30a3..bb2c9f7 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1162,6 +1162,39 @@ Aml *aml_sizeof(Aml *arg)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMutex */
+Aml *aml_mutex(const char *name, uint8_t sync_level)
+{
+    Aml *var = aml_alloc();
+    build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */
+    build_append_byte(var->buf, 0x01); /* MutexOp */
+    build_append_namestring(var->buf, "%s", name);
+    assert(!(sync_level & 0xF0));
+    build_append_byte(var->buf, sync_level);
+    return var;
+}
+
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAcquire */
+Aml *aml_acquire(Aml *mutex, uint16_t timeout)
+{
+    Aml *var = aml_alloc();
+    build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */
+    build_append_byte(var->buf, 0x23); /* AcquireOp */
+    aml_append(var, mutex);
+    build_append_int_noprefix(var->buf, timeout, sizeof(timeout));
+    return var;
+}
+
+/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefRelease */
+Aml *aml_release(Aml *mutex)
+{
+    Aml *var = aml_alloc();
+    build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */
+    build_append_byte(var->buf, 0x27); /* ReleaseOp */
+    aml_append(var, mutex);
+    return var;
+}
+
 void
 build_header(GArray *linker, GArray *table_data,
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 2a4f815..b220b12 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -271,6 +271,9 @@ Aml *aml_package(uint8_t num_elements);
 Aml *aml_buffer(int buffer_size, uint8_t *byte_list);
 Aml *aml_resource_template(void);
 Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
+Aml *aml_mutex(const char *name, uint8_t sync_level);
+Aml *aml_acquire(Aml *mutex, uint16_t timeout);
+Aml *aml_release(Aml *mutex);
 Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
 Aml *aml_varpackage(uint32_t num_elements);
 Aml *aml_touuid(const char *uuid);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (4 preceding siblings ...)
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 05/74] acpi: add aml_mutex(), aml_acquire(), aml_release() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 12:53   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
                   ` (70 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 21 +++++++++++++++++----
 include/hw/acpi/aml-build.h |  1 +
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index bb2c9f7..a6e4c54 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -805,17 +805,30 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule)
     return var;
 }
 
-/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefCreateDWordField */
-Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name)
+static
+Aml *create_field_common(int opcode, Aml *srcbuf, Aml *index, const char *name)
 {
-    Aml *var = aml_alloc();
-    build_append_byte(var->buf, 0x8A); /* CreateDWordFieldOp */
+    Aml *var = aml_opcode(opcode);
     aml_append(var, srcbuf);
     aml_append(var, index);
     build_append_namestring(var->buf, "%s", name);
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefCreateDWordField */
+Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name)
+{
+    return create_field_common(0x8A /* CreateDWordFieldOp */,
+                               srcbuf, index, name);
+}
+
+/* ACPI 2.0a: 17.2.4.2 Named Objects Encoding: DefCreateQWordField */
+Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name)
+{
+    return create_field_common(0x8F /* CreateQWordFieldOp */,
+                               srcbuf, index, name);
+}
+
 /* ACPI 1.0b: 16.2.3 Data Objects Encoding: String */
 Aml *aml_string(const char *name_format, ...)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index b220b12..c113b17 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -275,6 +275,7 @@ Aml *aml_mutex(const char *name, uint8_t sync_level);
 Aml *aml_acquire(Aml *mutex, uint16_t timeout);
 Aml *aml_release(Aml *mutex);
 Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
+Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name);
 Aml *aml_varpackage(uint32_t num_elements);
 Aml *aml_touuid(const char *uuid);
 Aml *aml_unicode(const char *str);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (5 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10  1:59   ` Shannon Zhao
                     ` (2 more replies)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument Igor Mammedov
                   ` (69 subsequent siblings)
  76 siblings, 3 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Currently AML API doesn't compose terms in form of
following pattern:

   Opcode Arg2 Arg2 [Dst]

but ASL used in piix4/q35 DSDT ACPI tables uses that
form, so for clean conversion of it, AML API should
be able to handle an optional 'Dst' argumet used there.

Since above pattern is used by arithmetic/bit ops,
introduce helper that they could reuse.
It reduces code duplication in existing 5 aml_foo()
functions and also will prevent more duplication
when exiting functions are extended to support
optional 'Dst' argument.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c | 61 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 32 insertions(+), 29 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index a6e4c54..22015d2 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -436,44 +436,55 @@ Aml *aml_store(Aml *val, Aml *target)
     return var;
 }
 
-/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
-Aml *aml_and(Aml *arg1, Aml *arg2)
+/**
+ * build_opcode_2arg_dst:
+ * @op: 1-byte opcode
+ * @arg1: 1st operand
+ * @arg2: 2nd operand
+ * @dst: optional target to store to, set to NULL if it's not required
+ *
+ * An internal helper to compose AML terms that have
+ *   "Op Operand Operand Target"
+ * pattern.
+ *
+ * Returns: The newly allocated and composed according to patter Aml object.
+ */
+static Aml *
+build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
 {
-    Aml *var = aml_opcode(0x7B /* AndOp */);
+    Aml *var = aml_opcode(op);
     aml_append(var, arg1);
     aml_append(var, arg2);
-    build_append_byte(var->buf, 0x00 /* NullNameOp */);
+    if (dst) {
+        aml_append(var, dst);
+    } else {
+        build_append_byte(var->buf, 0x00 /* NullNameOp */);
+    }
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
+Aml *aml_and(Aml *arg1, Aml *arg2)
+{
+    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, NULL);
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
 Aml *aml_or(Aml *arg1, Aml *arg2)
 {
-    Aml *var = aml_opcode(0x7D /* OrOp */);
-    aml_append(var, arg1);
-    aml_append(var, arg2);
-    build_append_byte(var->buf, 0x00 /* NullNameOp */);
-    return var;
+    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftLeft */
 Aml *aml_shiftleft(Aml *arg1, Aml *count)
 {
-    Aml *var = aml_opcode(0x79 /* ShiftLeftOp */);
-    aml_append(var, arg1);
-    aml_append(var, count);
-    build_append_byte(var->buf, 0x00); /* NullNameOp */
-    return var;
+    return build_opcode_2arg_dst(0x79 /* ShiftLeftOp */, arg1, count, NULL);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftRight */
 Aml *aml_shiftright(Aml *arg1, Aml *count)
 {
-    Aml *var = aml_opcode(0x7A /* ShiftRightOp */);
-    aml_append(var, arg1);
-    aml_append(var, count);
-    build_append_byte(var->buf, 0x00); /* NullNameOp */
-    return var;
+    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, NULL);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */
@@ -488,11 +499,7 @@ Aml *aml_lless(Aml *arg1, Aml *arg2)
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */
 Aml *aml_add(Aml *arg1, Aml *arg2)
 {
-    Aml *var = aml_opcode(0x72 /* AddOp */);
-    aml_append(var, arg1);
-    aml_append(var, arg2);
-    build_append_byte(var->buf, 0x00 /* NullNameOp */);
-    return var;
+    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, NULL);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
@@ -506,11 +513,7 @@ Aml *aml_increment(Aml *arg)
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */
 Aml *aml_index(Aml *arg1, Aml *idx)
 {
-    Aml *var = aml_opcode(0x88 /* IndexOp */);
-    aml_append(var, arg1);
-    aml_append(var, idx);
-    build_append_byte(var->buf, 0x00 /* NullNameOp */);
-    return var;
+    return build_opcode_2arg_dst(0x88 /* IndexOp */, arg1, idx, NULL);
 }
 
 /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (6 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 12:59   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract() Igor Mammedov
                   ` (68 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

it allows to express following ASL expression:
 Add(arg1, arg2, result)

usecases that do not need to store result
should pass NULL as 3rd arg that would express
 Add(arg1, arg2,)
construct.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 4 ++--
 hw/i386/acpi-build.c        | 2 +-
 include/hw/acpi/aml-build.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 22015d2..3bb19bf 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -497,9 +497,9 @@ Aml *aml_lless(Aml *arg1, Aml *arg2)
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */
-Aml *aml_add(Aml *arg1, Aml *arg2)
+Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst)
 {
-    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, NULL);
+    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, dst);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 95e0c65..bce0252 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -669,7 +669,7 @@ static Aml *build_prt(void)
                    aml_store(aml_shiftright(pin, aml_int(2)), slot));
         /* lnk_idx = (slot + pin) & 3 */
         aml_append(while_ctx,
-                   aml_store(aml_and(aml_add(pin, slot), aml_int(3)), lnk_idx));
+            aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3)), lnk_idx));
 
         /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
         aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index c113b17..da38c92 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -204,7 +204,7 @@ Aml *aml_or(Aml *arg1, Aml *arg2);
 Aml *aml_shiftleft(Aml *arg1, Aml *count);
 Aml *aml_shiftright(Aml *arg1, Aml *count);
 Aml *aml_lless(Aml *arg1, Aml *arg2);
-Aml *aml_add(Aml *arg1, Aml *arg2);
+Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_increment(Aml *arg);
 Aml *aml_index(Aml *arg1, Aml *idx);
 Aml *aml_notify(Aml *arg1, Aml *arg2);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (7 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:01   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper Igor Mammedov
                   ` (67 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 14 ++++++++++++++
 include/hw/acpi/aml-build.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 3bb19bf..ee34771 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -502,6 +502,12 @@ Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst)
     return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, dst);
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefSubtract */
+Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst)
+{
+    return build_opcode_2arg_dst(0x74 /* SubtractOp */, arg1, arg2, dst);
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
 Aml *aml_increment(Aml *arg)
 {
@@ -510,6 +516,14 @@ Aml *aml_increment(Aml *arg)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefDecrement */
+Aml *aml_decrement(Aml *arg)
+{
+    Aml *var = aml_opcode(0x76 /* DecrementOp */);
+    aml_append(var, arg);
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */
 Aml *aml_index(Aml *arg1, Aml *idx)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index da38c92..9761438 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -205,7 +205,9 @@ Aml *aml_shiftleft(Aml *arg1, Aml *count);
 Aml *aml_shiftright(Aml *arg1, Aml *count);
 Aml *aml_lless(Aml *arg1, Aml *arg2);
 Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
+Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_increment(Aml *arg);
+Aml *aml_decrement(Aml *arg);
 Aml *aml_index(Aml *arg1, Aml *idx);
 Aml *aml_notify(Aml *arg1, Aml *arg2);
 Aml *aml_call1(const char *method, Aml *arg1);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (8 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:04   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer() Igor Mammedov
                   ` (66 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

it will help to call a method with 0 arguments

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 8 ++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index ee34771..50587de 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -540,6 +540,14 @@ Aml *aml_notify(Aml *arg1, Aml *arg2)
 }
 
 /* helper to call method with 1 argument */
+Aml *aml_call0(const char *method)
+{
+    Aml *var = aml_alloc();
+    build_append_namestring(var->buf, "%s", method);
+    return var;
+}
+
+/* helper to call method with 1 argument */
 Aml *aml_call1(const char *method, Aml *arg1)
 {
     Aml *var = aml_alloc();
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 9761438..117ef46 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -210,6 +210,7 @@ Aml *aml_increment(Aml *arg);
 Aml *aml_decrement(Aml *arg);
 Aml *aml_index(Aml *arg1, Aml *idx);
 Aml *aml_notify(Aml *arg1, Aml *arg2);
+Aml *aml_call0(const char *method);
 Aml *aml_call1(const char *method, Aml *arg1);
 Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
 Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (9 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:05   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument Igor Mammedov
                   ` (65 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 9 +++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 50587de..1f599e3 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -427,6 +427,15 @@ Aml *aml_arg(int pos)
     return var;
 }
 
+/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToInteger */
+Aml *aml_to_integer(Aml *arg)
+{
+    Aml *var = aml_opcode(0x99 /* ToIntegerOp */);
+    aml_append(var, arg);
+    build_append_byte(var->buf, 0x00 /* NullNameOp */);
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
 Aml *aml_store(Aml *val, Aml *target)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 117ef46..d28bfe6 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -198,6 +198,7 @@ Aml *aml_name_decl(const char *name, Aml *val);
 Aml *aml_return(Aml *val);
 Aml *aml_int(const uint64_t val);
 Aml *aml_arg(int pos);
+Aml *aml_to_integer(Aml *arg);
 Aml *aml_store(Aml *val, Aml *target);
 Aml *aml_and(Aml *arg1, Aml *arg2);
 Aml *aml_or(Aml *arg1, Aml *arg2);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (10 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:08   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 13/74] acpi: add aml_alias() Igor Mammedov
                   ` (64 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

it allows to express ShiftRight(A,B,C) syntax

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 4 ++--
 hw/i386/acpi-build.c        | 2 +-
 include/hw/acpi/aml-build.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 1f599e3..dcaa7e9 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -491,9 +491,9 @@ Aml *aml_shiftleft(Aml *arg1, Aml *count)
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftRight */
-Aml *aml_shiftright(Aml *arg1, Aml *count)
+Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst)
 {
-    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, NULL);
+    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, dst);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index bce0252..8f7b95a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -666,7 +666,7 @@ static Aml *build_prt(void)
 
         /* slot = pin >> 2 */
         aml_append(while_ctx,
-                   aml_store(aml_shiftright(pin, aml_int(2)), slot));
+                   aml_store(aml_shiftright(pin, aml_int(2), NULL), slot));
         /* lnk_idx = (slot + pin) & 3 */
         aml_append(while_ctx,
             aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3)), lnk_idx));
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index d28bfe6..a694a67 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -203,7 +203,7 @@ Aml *aml_store(Aml *val, Aml *target);
 Aml *aml_and(Aml *arg1, Aml *arg2);
 Aml *aml_or(Aml *arg1, Aml *arg2);
 Aml *aml_shiftleft(Aml *arg1, Aml *count);
-Aml *aml_shiftright(Aml *arg1, Aml *count);
+Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
 Aml *aml_lless(Aml *arg1, Aml *arg2);
 Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 13/74] acpi: add aml_alias()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (11 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:13   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep() Igor Mammedov
                   ` (63 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 9 +++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index dcaa7e9..6a63477 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1242,6 +1242,15 @@ Aml *aml_release(Aml *mutex)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.1 Name Space Modifier Objects Encoding: DefAlias */
+Aml *aml_alias(const char *source_object, const char *alias_object)
+{
+    Aml *var = aml_opcode(0x06 /* AliasOp */);
+    aml_append(var, aml_name("%s", source_object));
+    aml_append(var, aml_name("%s", alias_object));
+    return var;
+}
+
 void
 build_header(GArray *linker, GArray *table_data,
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index a694a67..cd3f3b7 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -278,6 +278,7 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
 Aml *aml_mutex(const char *name, uint8_t sync_level);
 Aml *aml_acquire(Aml *mutex, uint16_t timeout);
 Aml *aml_release(Aml *mutex);
+Aml *aml_alias(const char *source_object, const char *alias_object);
 Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
 Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name);
 Aml *aml_varpackage(uint32_t num_elements);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (12 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 13/74] acpi: add aml_alias() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:14   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 15/74] acpi: support serialized method Igor Mammedov
                   ` (62 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 10 ++++++++++
 include/hw/acpi/aml-build.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 6a63477..e36b546 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1123,6 +1123,16 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                              addr_trans, len, flags);
 }
 
+/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefSleep */
+Aml *aml_sleep(uint64_t msec)
+{
+    Aml *var = aml_alloc();
+    build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */
+    build_append_byte(var->buf, 0x22); /* SleepOp */
+    aml_append(var, aml_int(msec));
+    return var;
+}
+
 static uint8_t Hex2Byte(const char *src)
 {
     int hi, lo;
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index cd3f3b7..944b001 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -263,6 +263,7 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                       uint64_t addr_gran, uint64_t addr_min,
                       uint64_t addr_max, uint64_t addr_trans,
                       uint64_t len);
+Aml *aml_sleep(uint64_t msec);
 
 /* Block AML object primitives */
 Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 15/74] acpi: support serialized method
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (13 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-11  2:58   ` Shannon Zhao
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 16/74] acpi: add aml_lor() Igor Mammedov
                   ` (61 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiao Guangrong

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

Add serialized method support so that explicit Mutex can be
avoided

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 17 +++++++++++++++--
 hw/arm/virt-acpi-build.c    | 10 +++++-----
 hw/i386/acpi-build.c        | 41 +++++++++++++++++++++--------------------
 include/hw/acpi/aml-build.h |  8 +++++++-
 4 files changed, 48 insertions(+), 28 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index e36b546..5094826 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -741,11 +741,24 @@ Aml *aml_while(Aml *predicate)
 }
 
 /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */
-Aml *aml_method(const char *name, int arg_count)
+Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag)
 {
     Aml *var = aml_bundle(0x14 /* MethodOp */, AML_PACKAGE);
+    int methodflags;
+
+    /*
+     * MethodFlags:
+     *   bit 0-2: ArgCount (0-7)
+     *   bit 3: SerializeFlag
+     *     0: NotSerialized
+     *     1: Serialized
+     *   bit 4-7: reserved (must be 0)
+     */
+    assert(arg_count < 8);
+    methodflags = arg_count | (sflag << 3);
+
     build_append_namestring(var->buf, "%s", name);
-    build_append_byte(var->buf, arg_count); /* MethodFlags: ArgCount */
+    build_append_byte(var->buf, methodflags); /* MethodFlags: ArgCount */
     return var;
 }
 
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 3c2c5d6..38ab844 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -212,16 +212,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
                                  AML_EXCLUSIVE, irq + i));
         aml_append(dev_gsi, aml_name_decl("_CRS", crs));
-        method = aml_method("_SRS", 1);
+        method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
         aml_append(dev_gsi, method);
         aml_append(dev, dev_gsi);
     }
 
-    method = aml_method("_CBA", 0);
+    method = aml_method("_CBA", 0, AML_NOTSERIALIZED);
     aml_append(method, aml_return(aml_int(base_ecam)));
     aml_append(dev, method);
 
-    method = aml_method("_CRS", 0);
+    method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
     Aml *rbuf = aml_resource_template();
     aml_append(rbuf,
         aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE,
@@ -254,7 +254,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
     /* Declare an _OSC (OS Control Handoff) method */
     aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
     aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
-    method = aml_method("_OSC", 4);
+    method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
     aml_append(method,
         aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
 
@@ -296,7 +296,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
     aml_append(method, elsectx);
     aml_append(dev, method);
 
-    method = aml_method("_DSM", 4);
+    method = aml_method("_DSM", 4, AML_NOTSERIALIZED);
 
     /* PCI Firmware Specification 3.0
      * 4.6.1. _DSM for PCI Express Slot Information
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 8f7b95a..62afe5a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -487,7 +487,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
         int64_t bsel_val = qint_get_int(qobject_to_qint(bsel));
 
         aml_append(parent_scope, aml_name_decl("BSEL", aml_int(bsel_val)));
-        notify_method = aml_method("DVNT", 2);
+        notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED);
     }
 
     for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
@@ -503,7 +503,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                 dev = aml_device("S%.02X", PCI_DEVFN(slot, 0));
                 aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
                 aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
-                method = aml_method("_EJ0", 1);
+                method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
                 aml_append(method,
                     aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
                 );
@@ -546,22 +546,22 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                 s3d = 0;
             }
 
-            method = aml_method("_S1D", 0);
+            method = aml_method("_S1D", 0, AML_NOTSERIALIZED);
             aml_append(method, aml_return(aml_int(0)));
             aml_append(dev, method);
 
-            method = aml_method("_S2D", 0);
+            method = aml_method("_S2D", 0, AML_NOTSERIALIZED);
             aml_append(method, aml_return(aml_int(0)));
             aml_append(dev, method);
 
-            method = aml_method("_S3D", 0);
+            method = aml_method("_S3D", 0, AML_NOTSERIALIZED);
             aml_append(method, aml_return(aml_int(s3d)));
             aml_append(dev, method);
         } else if (hotplug_enabled_dev) {
             /* add _SUN/_EJ0 to make slot hotpluggable  */
             aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
 
-            method = aml_method("_EJ0", 1);
+            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
             aml_append(method,
                 aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
             );
@@ -590,7 +590,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
     /* Append PCNT method to notify about events on local and child buses.
      * Add unconditionally for root since DSDT expects it.
      */
-    method = aml_method("PCNT", 0);
+    method = aml_method("PCNT", 0, AML_NOTSERIALIZED);
 
     /* If bus supports hotplug select it and notify about local events */
     if (bsel) {
@@ -651,7 +651,7 @@ static Aml *build_prt(void)
 {
     Aml *method, *while_ctx, *pin, *res;
 
-    method = aml_method("_PRT", 0);
+    method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
     res = aml_local(0);
     pin = aml_local(1);
     aml_append(method, aml_store(aml_package(128), res));
@@ -1112,12 +1112,12 @@ build_ssdt(GArray *table_data, GArray *linker,
         /* device present, functioning, decoding, shown in UI */
         aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
 
-        method = aml_method("RDPT", 0);
+        method = aml_method("RDPT", 0, AML_NOTSERIALIZED);
         aml_append(method, aml_store(aml_name("PEPT"), aml_local(0)));
         aml_append(method, aml_return(aml_local(0)));
         aml_append(dev, method);
 
-        method = aml_method("WRPT", 1);
+        method = aml_method("WRPT", 1, AML_NOTSERIALIZED);
         aml_append(method, aml_store(aml_arg(0), aml_name("PEPT")));
         aml_append(dev, method);
 
@@ -1153,15 +1153,15 @@ build_ssdt(GArray *table_data, GArray *linker,
         for (i = 0; i < acpi_cpus; i++) {
             dev = aml_processor(i, 0, 0, "CP%.02X", i);
 
-            method = aml_method("_MAT", 0);
+            method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
             aml_append(method, aml_return(aml_call1("CPMA", aml_int(i))));
             aml_append(dev, method);
 
-            method = aml_method("_STA", 0);
+            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
             aml_append(method, aml_return(aml_call1("CPST", aml_int(i))));
             aml_append(dev, method);
 
-            method = aml_method("_EJ0", 1);
+            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
             aml_append(method,
                 aml_return(aml_call2("CPEJ", aml_int(i), aml_arg(0)))
             );
@@ -1174,7 +1174,7 @@ build_ssdt(GArray *table_data, GArray *linker,
          *   Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...}
          */
         /* Arg0 = Processor ID = APIC ID */
-        method = aml_method("NTFY", 2);
+        method = aml_method("NTFY", 2, AML_NOTSERIALIZED);
         for (i = 0; i < acpi_cpus; i++) {
             ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
             aml_append(ifctx,
@@ -1269,29 +1269,29 @@ build_ssdt(GArray *table_data, GArray *linker,
             aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
             aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
 
-            method = aml_method("_CRS", 0);
+            method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
             s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
             aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
             aml_append(dev, method);
 
-            method = aml_method("_STA", 0);
+            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
             s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
             aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
             aml_append(dev, method);
 
-            method = aml_method("_PXM", 0);
+            method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
             s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
             aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
             aml_append(dev, method);
 
-            method = aml_method("_OST", 3);
+            method = aml_method("_OST", 3, AML_NOTSERIALIZED);
             s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
             aml_append(method, aml_return(aml_call4(
                 s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
             )));
             aml_append(dev, method);
 
-            method = aml_method("_EJ0", 1);
+            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
             s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
             aml_append(method, aml_return(aml_call2(
                        s, aml_name("_UID"), aml_arg(0))));
@@ -1303,7 +1303,8 @@ build_ssdt(GArray *table_data, GArray *linker,
         /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
          *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
          */
-        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2);
+        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
+                            AML_NOTSERIALIZED);
         for (i = 0; i < nr_mem; i++) {
             ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
             aml_append(ifctx,
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 944b001..cd82065 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -148,6 +148,12 @@ typedef enum {
     AML_SHARED_AND_WAKE = 3,
 } AmlShared;
 
+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: MethodFlags */
+typedef enum {
+    AML_NOTSERIALIZED = 0,
+    AML_SERIALIZED = 1,
+} AmlSerializeFlag;
+
 typedef
 struct AcpiBuildTables {
     GArray *table_data;
@@ -268,7 +274,7 @@ Aml *aml_sleep(uint64_t msec);
 /* Block AML object primitives */
 Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
 Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
-Aml *aml_method(const char *name, int arg_count);
+Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag);
 Aml *aml_if(Aml *predicate);
 Aml *aml_else(void);
 Aml *aml_while(Aml *predicate);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 16/74] acpi: add aml_lor()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (14 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 15/74] acpi: support serialized method Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:25   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater() Igor Mammedov
                   ` (60 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 9 +++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 5094826..8cfa65c 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -484,6 +484,15 @@ Aml *aml_or(Aml *arg1, Aml *arg2)
     return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLOr */
+Aml *aml_lor(Aml *arg1, Aml *arg2)
+{
+    Aml *var = aml_opcode(0x91 /* LOrOp */);
+    aml_append(var, arg1);
+    aml_append(var, arg2);
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftLeft */
 Aml *aml_shiftleft(Aml *arg1, Aml *count)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index cd82065..897e093 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -208,6 +208,7 @@ Aml *aml_to_integer(Aml *arg);
 Aml *aml_store(Aml *val, Aml *target);
 Aml *aml_and(Aml *arg1, Aml *arg2);
 Aml *aml_or(Aml *arg1, Aml *arg2);
+Aml *aml_lor(Aml *arg1, Aml *arg2);
 Aml *aml_shiftleft(Aml *arg1, Aml *count);
 Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
 Aml *aml_lless(Aml *arg1, Aml *arg2);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (15 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 16/74] acpi: add aml_lor() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:26   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 18/74] acpi: extend aml_field() to support LockRule Igor Mammedov
                   ` (59 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 9 +++++++++
 include/hw/acpi/aml-build.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 8cfa65c..b22e7da 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -715,6 +715,15 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
     return var;
 }
 
+/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreater */
+Aml *aml_lgreater(Aml *arg1, Aml *arg2)
+{
+    Aml *var = aml_opcode(0x94 /* LGreaterOp */);
+    aml_append(var, arg1);
+    aml_append(var, arg2);
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreaterEqual */
 Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 897e093..238a9dc 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -240,6 +240,7 @@ Aml *aml_local(int num);
 Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
 Aml *aml_lnot(Aml *arg);
 Aml *aml_equal(Aml *arg1, Aml *arg2);
+Aml *aml_lgreater(Aml *arg1, Aml *arg2);
 Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
 Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
                    const char *name_format, ...) GCC_FMT_ATTR(4, 5);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 18/74] acpi: extend aml_field() to support LockRule
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (16 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring() Igor Mammedov
                   ` (58 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         |  5 ++++-
 hw/i386/acpi-build.c        | 10 +++++-----
 include/hw/acpi/aml-build.h |  8 +++++++-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index b22e7da..7500474 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -860,11 +860,14 @@ Aml *aml_reserved_field(unsigned length)
 }
 
 /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefField */
-Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule)
+Aml *aml_field(const char *name, AmlAccessType type, AmlLockRule lock,
+               AmlUpdateRule rule)
 {
     Aml *var = aml_bundle(0x81 /* FieldOp */, AML_EXT_PACKAGE);
     uint8_t flags = rule << 5 | type;
 
+    flags |= lock << 4; /* LockRule at 4 bit offset */
+
     build_append_namestring(var->buf, "%s", name);
     build_append_byte(var->buf, flags);
     return var;
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 62afe5a..a705e96 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1105,7 +1105,7 @@ build_ssdt(GArray *table_data, GArray *linker,
 
         aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO,
                                               misc->pvpanic_port, 1));
-        field = aml_field("PEOR", AML_BYTE_ACC, AML_PRESERVE);
+        field = aml_field("PEOR", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
         aml_append(field, aml_named_field("PEPT", 8));
         aml_append(dev, field);
 
@@ -1145,7 +1145,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         /* declare CPU hotplug MMIO region and PRS field to access it */
         aml_append(sb_scope, aml_operation_region(
             "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len));
-        field = aml_field("PRST", AML_BYTE_ACC, AML_PRESERVE);
+        field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
         aml_append(field, aml_named_field("PRS", 256));
         aml_append(sb_scope, field);
 
@@ -1220,7 +1220,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         );
 
         field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
-                          AML_PRESERVE);
+                          AML_NOLOCK, AML_PRESERVE);
         aml_append(field, /* read only */
             aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
         aml_append(field, /* read only */
@@ -1234,7 +1234,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_append(scope, field);
 
         field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
-                          AML_WRITE_AS_ZEROS);
+                          AML_NOLOCK, AML_WRITE_AS_ZEROS);
         aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
         aml_append(field, /* 1 if enabled, read only */
             aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
@@ -1250,7 +1250,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_append(scope, field);
 
         field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
-                          AML_PRESERVE);
+                          AML_NOLOCK, AML_PRESERVE);
         aml_append(field, /* DIMM selector, write only */
             aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
         aml_append(field, /* _OST event code, write only */
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 238a9dc..679812b 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -49,6 +49,11 @@ typedef enum {
 } AmlAccessType;
 
 typedef enum {
+    AML_NOLOCK = 0,
+    AML_LOCK = 1,
+} AmlLockRule;
+
+typedef enum {
     AML_PRESERVE = 0,
     AML_WRITE_AS_ONES = 1,
     AML_WRITE_AS_ZEROS = 2,
@@ -283,7 +288,8 @@ Aml *aml_while(Aml *predicate);
 Aml *aml_package(uint8_t num_elements);
 Aml *aml_buffer(int buffer_size, uint8_t *byte_list);
 Aml *aml_resource_template(void);
-Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
+Aml *aml_field(const char *name, AmlAccessType type, AmlLockRule lock,
+               AmlUpdateRule rule);
 Aml *aml_mutex(const char *name, uint8_t sync_level);
 Aml *aml_acquire(Aml *mutex, uint16_t timeout);
 Aml *aml_release(Aml *mutex);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (17 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 18/74] acpi: extend aml_field() to support LockRule Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:41   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer() Igor Mammedov
                   ` (57 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 13 +++++++++++++
 include/hw/acpi/aml-build.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 7500474..c025801 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -436,6 +436,19 @@ Aml *aml_to_integer(Aml *arg)
     return var;
 }
 
+/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToHexString */
+Aml *aml_to_hexstring(Aml *src, Aml *dst)
+{
+    Aml *var = aml_opcode(0x98 /* ToHexStringOp */);
+    aml_append(var, src);
+    if (dst) {
+        aml_append(var, dst);
+    } else {
+        build_append_byte(var->buf, 0x00 /* NullNameOp */);
+    }
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
 Aml *aml_store(Aml *val, Aml *target)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 679812b..77bfe0c 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -210,6 +210,7 @@ Aml *aml_return(Aml *val);
 Aml *aml_int(const uint64_t val);
 Aml *aml_arg(int pos);
 Aml *aml_to_integer(Aml *arg);
+Aml *aml_to_hexstring(Aml *src, Aml *dst);
 Aml *aml_store(Aml *val, Aml *target);
 Aml *aml_and(Aml *arg1, Aml *arg2);
 Aml *aml_or(Aml *arg1, Aml *arg2);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (18 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:42   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 21/74] acpi add aml_dma() Igor Mammedov
                   ` (56 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 13 +++++++++++++
 include/hw/acpi/aml-build.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index c025801..4b1b496 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -449,6 +449,19 @@ Aml *aml_to_hexstring(Aml *src, Aml *dst)
     return var;
 }
 
+/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToBuffer */
+Aml *aml_to_buffer(Aml *src, Aml *dst)
+{
+    Aml *var = aml_opcode(0x96 /* ToBufferOp */);
+    aml_append(var, src);
+    if (dst) {
+        aml_append(var, dst);
+    } else {
+        build_append_byte(var->buf, 0x00 /* NullNameOp */);
+    }
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
 Aml *aml_store(Aml *val, Aml *target)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 77bfe0c..04ef25e 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -211,6 +211,7 @@ Aml *aml_int(const uint64_t val);
 Aml *aml_arg(int pos);
 Aml *aml_to_integer(Aml *arg);
 Aml *aml_to_hexstring(Aml *src, Aml *dst);
+Aml *aml_to_buffer(Aml *src, Aml *dst);
 Aml *aml_store(Aml *val, Aml *target);
 Aml *aml_and(Aml *arg1, Aml *arg2);
 Aml *aml_or(Aml *arg1, Aml *arg2);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 21/74] acpi add aml_dma()
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (19 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument Igor Mammedov
                   ` (55 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 14 ++++++++++++++
 include/hw/acpi/aml-build.h | 20 ++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 4b1b496..8347299 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1183,6 +1183,20 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                              addr_trans, len, flags);
 }
 
+/* ACPI 1.0b: 6.4.2.2 DMA Format/6.4.2.2.1 ASL Macro for DMA Descriptor */
+Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz,
+             uint8_t channel)
+{
+    Aml *var = aml_alloc();
+    uint8_t flags = sz | bm << 2 | typ << 5;
+
+    assert(channel < 8);
+    build_append_byte(var->buf, 0x2A);    /* Byte 0: DMA Descriptor */
+    build_append_byte(var->buf, 1U << channel); /* Byte 1: _DMA - DmaChannel */
+    build_append_byte(var->buf, flags);   /* Byte 2 */
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefSleep */
 Aml *aml_sleep(uint64_t msec)
 {
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 04ef25e..9dd8370 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -35,6 +35,24 @@ struct Aml {
 typedef struct Aml Aml;
 
 typedef enum {
+    AML_COMPATIBILITY = 0,
+    AML_TYPEA = 1,
+    AML_TYPEB = 2,
+    AML_TYPEF = 3,
+} AmlDmaType;
+
+typedef enum {
+    AML_NOTBUSMASTER = 0,
+    AML_BUSMASTER = 1,
+} AmlDmaBusMaster;
+
+typedef enum {
+    AML_TRANSFER8 = 0,
+    AML_TRANSFER8_16 = 1,
+    AML_TRANSFER16 = 2,
+} AmlTransferSize;
+
+typedef enum {
     AML_DECODE10 = 0,
     AML_DECODE16 = 1,
 } AmlIODecode;
@@ -278,6 +296,8 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
                       uint64_t addr_gran, uint64_t addr_min,
                       uint64_t addr_max, uint64_t addr_trans,
                       uint64_t len);
+Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz,
+             uint8_t channel);
 Aml *aml_sleep(uint64_t msec);
 
 /* Block AML object primitives */
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (20 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 21/74] acpi add aml_dma() Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 13:43   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() " Igor Mammedov
                   ` (54 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 4 ++--
 hw/arm/virt-acpi-build.c    | 6 +++---
 hw/i386/acpi-build.c        | 3 ++-
 include/hw/acpi/aml-build.h | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 8347299..4f62512 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -505,9 +505,9 @@ Aml *aml_and(Aml *arg1, Aml *arg2)
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
-Aml *aml_or(Aml *arg1, Aml *arg2)
+Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst)
 {
-    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
+    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, dst);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLOr */
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 38ab844..1cc98f5 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -276,12 +276,12 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
                                 aml_name("CTRL")));
 
     ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1))));
-    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x08)),
+    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x08), NULL),
                                  aml_name("CDW1")));
     aml_append(ifctx, ifctx1);
 
     ifctx1 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), aml_name("CTRL"))));
-    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x10)),
+    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x10), NULL),
                                  aml_name("CDW1")));
     aml_append(ifctx, ifctx1);
 
@@ -290,7 +290,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
     aml_append(method, ifctx);
 
     elsectx = aml_else();
-    aml_append(elsectx, aml_store(aml_or(aml_name("CDW1"), aml_int(4)),
+    aml_append(elsectx, aml_store(aml_or(aml_name("CDW1"), aml_int(4), NULL),
                                   aml_name("CDW1")));
     aml_append(elsectx, aml_return(aml_arg(3)));
     aml_append(method, elsectx);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a705e96..fd8ccfc 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -679,7 +679,8 @@ static Aml *build_prt(void)
 
         /* route[0] = 0x[slot]FFFF */
         aml_append(while_ctx,
-            aml_store(aml_or(aml_shiftleft(slot, aml_int(16)), aml_int(0xFFFF)),
+            aml_store(aml_or(aml_shiftleft(slot, aml_int(16)), aml_int(0xFFFF),
+                             NULL),
                       aml_index(route, aml_int(0))));
         /* route[1] = pin & 3 */
         aml_append(while_ctx,
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 9dd8370..3be727e 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -232,7 +232,7 @@ Aml *aml_to_hexstring(Aml *src, Aml *dst);
 Aml *aml_to_buffer(Aml *src, Aml *dst);
 Aml *aml_store(Aml *val, Aml *target);
 Aml *aml_and(Aml *arg1, Aml *arg2);
-Aml *aml_or(Aml *arg1, Aml *arg2);
+Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_lor(Aml *arg1, Aml *arg2);
 Aml *aml_shiftleft(Aml *arg1, Aml *count);
 Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() to accept target argument
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (21 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10  2:07   ` Shannon Zhao
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs Igor Mammedov
                   ` (53 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/aml-build.c         | 4 ++--
 hw/arm/virt-acpi-build.c    | 2 +-
 hw/i386/acpi-build.c        | 8 +++++---
 include/hw/acpi/aml-build.h | 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 4f62512..2ca9207 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -499,9 +499,9 @@ build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
-Aml *aml_and(Aml *arg1, Aml *arg2)
+Aml *aml_and(Aml *arg1, Aml *arg2, Aml *dst)
 {
-    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, NULL);
+    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, dst);
 }
 
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 1cc98f5..698b5f2 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -272,7 +272,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
         aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));
     aml_append(ifctx, aml_store(aml_name("CDW2"), aml_name("SUPP")));
     aml_append(ifctx, aml_store(aml_name("CDW3"), aml_name("CTRL")));
-    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1D)),
+    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1D), NULL),
                                 aml_name("CTRL")));
 
     ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1))));
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index fd8ccfc..bbd37e9 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -469,7 +469,7 @@ static void build_append_pcihp_notify_entry(Aml *method, int slot)
     Aml *if_ctx;
     int32_t devfn = PCI_DEVFN(slot, 0);
 
-    if_ctx = aml_if(aml_and(aml_arg(0), aml_int(0x1U << slot)));
+    if_ctx = aml_if(aml_and(aml_arg(0), aml_int(0x1U << slot), NULL));
     aml_append(if_ctx, aml_notify(aml_name("S%.02X", devfn), aml_arg(1)));
     aml_append(method, if_ctx);
 }
@@ -669,7 +669,8 @@ static Aml *build_prt(void)
                    aml_store(aml_shiftright(pin, aml_int(2), NULL), slot));
         /* lnk_idx = (slot + pin) & 3 */
         aml_append(while_ctx,
-            aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3)), lnk_idx));
+            aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3), NULL),
+                      lnk_idx));
 
         /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
         aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
@@ -684,7 +685,8 @@ static Aml *build_prt(void)
                       aml_index(route, aml_int(0))));
         /* route[1] = pin & 3 */
         aml_append(while_ctx,
-            aml_store(aml_and(pin, aml_int(3)), aml_index(route, aml_int(1))));
+            aml_store(aml_and(pin, aml_int(3), NULL),
+                      aml_index(route, aml_int(1))));
         /* res[pin] = route */
         aml_append(while_ctx, aml_store(route, aml_index(res, pin)));
         /* pin++ */
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 3be727e..ca365c9 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -231,7 +231,7 @@ Aml *aml_to_integer(Aml *arg);
 Aml *aml_to_hexstring(Aml *src, Aml *dst);
 Aml *aml_to_buffer(Aml *src, Aml *dst);
 Aml *aml_store(Aml *val, Aml *target);
-Aml *aml_and(Aml *arg1, Aml *arg2);
+Aml *aml_and(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst);
 Aml *aml_lor(Aml *arg1, Aml *arg2);
 Aml *aml_shiftleft(Aml *arg1, Aml *count);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (22 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10  1:50   ` Shannon Zhao
  2015-12-22 15:17   ` [Qemu-devel] [PATCH " Michael S. Tsirkin
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Igor Mammedov
                   ` (52 subsequent siblings)
  76 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, zhaoshenglong

ASL Interrupt() macro translates to Extended Interrupt Descriptor
which supports variable number of IRQs. It will be used for
conversion of ASL code for pc/q35 machines that use it for
returning several IRQs in _PSR object.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
CC: zhaoshenglong@huawei.com
CC: qemu-arm@nongnu.org
---
 hw/acpi/aml-build.c         | 22 +++++++++++++---------
 hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
 include/hw/acpi/aml-build.h |  2 +-
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 2ca9207..ee64d12 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
 Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
                    AmlLevelAndEdge level_and_edge,
                    AmlActiveHighAndLow high_and_low, AmlShared shared,
-                   uint32_t irq)
+                   uint32_t *irq_list, uint8_t irq_count)
 {
+    int i;
     Aml *var = aml_alloc();
     uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
                         | (high_and_low << 2) | (shared << 3);
+    const int header_bytes_in_len = 2;
+    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
+
+    assert(irq_count > 0);
 
     build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
-    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
-    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
+    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
+    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
     build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
-    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
+    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
 
-    /* Interrupt Number */
-    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
-    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
-    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
-    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
+    /* Interrupt Number List */
+    for (i = 0; i < irq_count; i++) {
+        build_append_int_noprefix(var->buf, irq_list[i], 4);
+    }
     return var;
 }
 
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 698b5f2..02ba822 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
 }
 
 static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
-                                           int uart_irq)
+                                           uint32_t uart_irq)
 {
     Aml *dev = aml_device("COM0");
     aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
@@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
                                        uart_memmap->size, AML_READ_WRITE));
     aml_append(crs,
                aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                             AML_EXCLUSIVE, uart_irq));
+                             AML_EXCLUSIVE, &uart_irq, 1));
     aml_append(dev, aml_name_decl("_CRS", crs));
 
     /* The _ADR entry is used to link this device to the UART described
@@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
 }
 
 static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
-                                          int rtc_irq)
+                                          uint32_t rtc_irq)
 {
     Aml *dev = aml_device("RTC0");
     aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
@@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
                                        rtc_memmap->size, AML_READ_WRITE));
     aml_append(crs,
                aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                             AML_EXCLUSIVE, rtc_irq));
+                             AML_EXCLUSIVE, &rtc_irq, 1));
     aml_append(dev, aml_name_decl("_CRS", crs));
     aml_append(scope, dev);
 }
@@ -136,11 +136,11 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
 
 static void acpi_dsdt_add_virtio(Aml *scope,
                                  const MemMapEntry *virtio_mmio_memmap,
-                                 int mmio_irq, int num)
+                                 uint32_t mmio_irq, int num)
 {
     hwaddr base = virtio_mmio_memmap->base;
     hwaddr size = virtio_mmio_memmap->size;
-    int irq = mmio_irq;
+    uint32_t irq = mmio_irq;
     int i;
 
     for (i = 0; i < num; i++) {
@@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
         aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
         aml_append(crs,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                                 AML_EXCLUSIVE, irq + i));
+                                 AML_EXCLUSIVE, &irq, 1));
         aml_append(dev, aml_name_decl("_CRS", crs));
         aml_append(scope, dev);
         base += size;
     }
 }
 
-static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
-                              bool use_highmem)
+static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
+                              uint32_t irq, bool use_highmem)
 {
     Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
     int i, bus_no;
@@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
 
     /* Create GSI link device */
     for (i = 0; i < PCI_NUM_PINS; i++) {
+        uint32_t irqs =  irq + i;
         Aml *dev_gsi = aml_device("GSI%d", i);
         aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
         aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
         crs = aml_resource_template();
         aml_append(crs,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                                 AML_EXCLUSIVE, irq + i));
+                                 AML_EXCLUSIVE, &irqs, 1));
         aml_append(dev_gsi, aml_name_decl("_PRS", crs));
         crs = aml_resource_template();
         aml_append(crs,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                                 AML_EXCLUSIVE, irq + i));
+                                 AML_EXCLUSIVE, &irqs, 1));
         aml_append(dev_gsi, aml_name_decl("_CRS", crs));
         method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
         aml_append(dev_gsi, method);
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index ca365c9..a3a058f 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
 Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
                    AmlLevelAndEdge level_and_edge,
                    AmlActiveHighAndLow high_and_low, AmlShared shared,
-                   uint32_t irq);
+                   uint32_t *irq_list, uint8_t irq_count);
 Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
             uint8_t aln, uint8_t len);
 Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (23 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 12:45   ` Marcel Apfelbaum
  2015-12-16 13:25   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT Igor Mammedov
                   ` (51 subsequent siblings)
  76 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/Makefile.objs               |  2 +-
 hw/acpi/memory_hotplug_acpi_table.c | 40 +++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-build.c                |  3 +++
 include/hw/acpi/memory_hotplug.h    |  4 ++++
 4 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 hw/acpi/memory_hotplug_acpi_table.c

diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index 7d3230c..c04064e 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -1,7 +1,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
+common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
 common-obj-$(CONFIG_ACPI) += acpi_interface.o
 common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
 common-obj-$(CONFIG_ACPI) += aml-build.o
diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
new file mode 100644
index 0000000..25bbf5e
--- /dev/null
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -0,0 +1,40 @@
+/*
+ * Memory hotplug AML code of DSDT ACPI table
+ *
+ * Copyright (C) 2013 Red Hat Inc
+ *
+ * Author: Igor Mammedov <imammedo@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdbool.h>
+#include "hw/acpi/memory_hotplug.h"
+#include "include/hw/acpi/pc-hotplug.h"
+#include "hw/boards.h"
+
+void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
+                              uint16_t io_base, uint16_t io_len)
+{
+    Aml *pci_scope;
+    Aml *ctrl_dev;
+
+    /* scope for memory hotplug controller device node */
+    pci_scope = aml_scope("_SB.PCI0");
+    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
+    {
+    }
+    aml_append(pci_scope, ctrl_dev);
+    aml_append(ctx, pci_scope);
+}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index bbd37e9..1b609e6 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
     /* Reserve space for header */
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
+    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
+                             pm->mem_hp_io_len);
+
     /* Extra PCI root buses are implemented  only for i440fx */
     bus = find_i440fx();
     if (bus) {
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index 1342adb..b6e9f50 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -4,6 +4,7 @@
 #include "hw/qdev-core.h"
 #include "hw/acpi/acpi.h"
 #include "migration/vmstate.h"
+#include "hw/acpi/aml-build.h"
 
 /**
  * MemStatus:
@@ -45,4 +46,7 @@ extern const VMStateDescription vmstate_memory_hotplug;
                    vmstate_memory_hotplug, MemHotplugState)
 
 void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
+
+void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
+                              uint16_t io_base, uint16_t io_len);
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (24 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-16 12:08   ` Marcel Apfelbaum
  2015-12-16 14:47   ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 27/74] pc: acpi: memhp: move MHPD.MLCK mutex " Igor Mammedov
                   ` (50 subsequent siblings)
  76 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 12 ++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 25bbf5e..de51717 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -29,11 +29,23 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
 {
     Aml *pci_scope;
     Aml *ctrl_dev;
+    Aml *method;
+    Aml *ifctx;
+    Aml *a_zero = aml_int(0);
+    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
 
     /* scope for memory hotplug controller device node */
     pci_scope = aml_scope("_SB.PCI0");
     ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
     {
+        /* MHPD._STA() method */
+        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
+            aml_append(ifctx, aml_return(a_zero));
+        aml_append(method, ifctx);
+        /* present, functioning, decoding, not shown in UI */
+        aml_append(method, aml_return(aml_int(0xB)));
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index c2bb6a1..b4eacc9 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -35,14 +35,6 @@
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
             External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
 
-            Method(_STA, 0) {
-                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
-                    Return(0x0)
-                }
-                /* present, functioning, decoding, not shown in UI */
-                Return(0xB)
-            }
-
             Mutex (MEMORY_SLOT_LOCK, 0)
 
             Method(MEMORY_SLOT_SCAN_METHOD, 0) {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 27/74] pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (25 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 28/74] pc: acpi: memhp: move MHPD.MSCN method " Igor Mammedov
                   ` (49 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 2 ++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index de51717..d389f73 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -46,6 +46,8 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         /* present, functioning, decoding, not shown in UI */
         aml_append(method, aml_return(aml_int(0xB)));
         aml_append(ctrl_dev, method);
+
+        aml_append(ctrl_dev, aml_mutex(stringify(MEMORY_SLOT_LOCK), 0));
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index b4eacc9..a1e519b 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -34,8 +34,7 @@
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
             External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
-
-            Mutex (MEMORY_SLOT_LOCK, 0)
+            External(MEMORY_SLOT_LOCK, MutexObj)
 
             Method(MEMORY_SLOT_SCAN_METHOD, 0) {
                 If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 28/74] pc: acpi: memhp: move MHPD.MSCN method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (26 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 27/74] pc: acpi: memhp: move MHPD.MLCK mutex " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 29/74] pc: acpi: memhp: move MHPD.MRST " Igor Mammedov
                   ` (48 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 48 +++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   | 27 +--------------------
 2 files changed, 49 insertions(+), 26 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index d389f73..cda05f4 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -31,13 +31,19 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
     Aml *ctrl_dev;
     Aml *method;
     Aml *ifctx;
+    Aml *else_ctx;
+    Aml *while_ctx;
     Aml *a_zero = aml_int(0);
+    Aml *a_one = aml_int(1);
     Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
 
     /* scope for memory hotplug controller device node */
     pci_scope = aml_scope("_SB.PCI0");
     ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
     {
+        Aml *a_ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK));
+        Aml *a_slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR));
+
         /* MHPD._STA() method */
         method = aml_method("_STA", 0, AML_NOTSERIALIZED);
         ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
@@ -48,6 +54,48 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         aml_append(ctrl_dev, method);
 
         aml_append(ctrl_dev, aml_mutex(stringify(MEMORY_SLOT_LOCK), 0));
+
+        method = aml_method(stringify(MEMORY_SLOT_SCAN_METHOD), 0,
+                            AML_NOTSERIALIZED);
+        {
+            Aml *a_idx = aml_local(0);
+
+            ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
+                aml_append(ifctx, aml_return(a_zero));
+            aml_append(method, ifctx);
+
+            aml_append(method, aml_store(aml_int(0), a_idx));
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            while_ctx = aml_while(
+                aml_lless(a_idx, a_slots_nr));
+            {
+                Aml *a_ins_evt = aml_name(stringify(MEMORY_SLOT_INSERT_EVENT));
+                Aml *a_rm_evt = aml_name(stringify(MEMORY_SLOT_REMOVE_EVENT));
+
+                aml_append(while_ctx, aml_store(a_idx, a_slot_selector));
+                ifctx = aml_if(aml_equal(a_ins_evt, a_one));
+                aml_append(ifctx,
+                    aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD),
+                              a_idx, a_one));
+                aml_append(ifctx, aml_store(a_one, a_ins_evt));
+                aml_append(while_ctx, ifctx);
+
+                else_ctx = aml_else();
+                ifctx = aml_if(aml_equal(a_rm_evt, a_one));
+                aml_append(ifctx,
+                    aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD),
+                              a_idx, aml_int(3)));
+                aml_append(ifctx, aml_store(a_one, a_rm_evt));
+                aml_append(else_ctx, ifctx);
+                aml_append(while_ctx, else_ctx);
+
+                aml_append(while_ctx, aml_add(a_idx, a_one, a_idx));
+            }
+            aml_append(method, while_ctx);
+            aml_append(method, aml_release(a_ctrl_lock));
+            aml_append(method, aml_return(a_one));
+        }
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index a1e519b..92baf87 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -13,13 +13,12 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-    External(MEMORY_SLOT_NOTIFY_METHOD, MethodObj)
+    External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj)
 
     Scope(\_SB.PCI0) {
         Device(MEMORY_HOTPLUG_DEVICE) {
             Name(_HID, "PNP0A06")
             Name(_UID, "Memory hotplug resources")
-            External(MEMORY_SLOTS_NUMBER, IntObj)
 
             /* Memory hotplug IO registers */
             External(MEMORY_SLOT_ADDR_LOW, FieldUnitObj) // read only
@@ -28,36 +27,12 @@
             External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
             External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only
             External(MEMORY_SLOT_ENABLED, FieldUnitObj) // 1 if enabled, read only
-            External(MEMORY_SLOT_INSERT_EVENT, FieldUnitObj) // (read) 1 if has a insert event. (write) 1 to clear event
-            External(MEMORY_SLOT_REMOVE_EVENT, FieldUnitObj) // (read) 1 if has a remove event. (write) 1 to clear event
             External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
             External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
             External(MEMORY_SLOT_LOCK, MutexObj)
 
-            Method(MEMORY_SLOT_SCAN_METHOD, 0) {
-                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
-                     Return(Zero)
-                }
-
-                Store(Zero, Local0) // Mem devs iterrator
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                while (LLess(Local0, MEMORY_SLOTS_NUMBER)) {
-                    Store(Local0, MEMORY_SLOT_SLECTOR) // select Local0 DIMM
-                    If (LEqual(MEMORY_SLOT_INSERT_EVENT, One)) { // Memory device needs check
-                        MEMORY_SLOT_NOTIFY_METHOD(Local0, 1)
-                        Store(1, MEMORY_SLOT_INSERT_EVENT)
-                    } Elseif (LEqual(MEMORY_SLOT_REMOVE_EVENT, One)) { // Ejection request
-                        MEMORY_SLOT_NOTIFY_METHOD(Local0, 3)
-                        Store(1, MEMORY_SLOT_REMOVE_EVENT)
-                    }
-                    Add(Local0, One, Local0) // goto next DIMM
-                }
-                Release(MEMORY_SLOT_LOCK)
-                Return(One)
-            }
-
             Method(MEMORY_SLOT_STATUS_METHOD, 1) {
                 Store(Zero, Local0)
 
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 29/74] pc: acpi: memhp: move MHPD.MRST method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (27 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 28/74] pc: acpi: memhp: move MHPD.MSCN method " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 30/74] pc: acpi: memhp: move MHPD.MPXM " Igor Mammedov
                   ` (47 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 21 +++++++++++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   | 15 ---------------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index cda05f4..b76694d 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -43,6 +43,8 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
     {
         Aml *a_ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK));
         Aml *a_slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR));
+        Aml *a_ret_val = aml_local(0);
+        Aml *a_slot_arg0 = aml_arg(0);
 
         /* MHPD._STA() method */
         method = aml_method("_STA", 0, AML_NOTSERIALIZED);
@@ -96,6 +98,25 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
             aml_append(method, aml_return(a_one));
         }
         aml_append(ctrl_dev, method);
+
+        method = aml_method(stringify(MEMORY_SLOT_STATUS_METHOD), 1,
+                            AML_NOTSERIALIZED);
+        {
+            Aml *a_slot_enabled = aml_name(stringify(MEMORY_SLOT_ENABLED));
+
+            aml_append(method, aml_store(a_zero, a_ret_val));
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
+                                         a_slot_selector));
+
+            ifctx = aml_if(aml_equal(a_slot_enabled, a_one));
+            aml_append(ifctx, aml_store(aml_int(0xF), a_ret_val));
+            aml_append(method, ifctx);
+
+            aml_append(method, aml_release(a_ctrl_lock));
+            aml_append(method, aml_return(a_ret_val));
+        }
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 92baf87..13e93dc 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -26,27 +26,12 @@
             External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
             External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only
-            External(MEMORY_SLOT_ENABLED, FieldUnitObj) // 1 if enabled, read only
             External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
             External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
             External(MEMORY_SLOT_LOCK, MutexObj)
 
-            Method(MEMORY_SLOT_STATUS_METHOD, 1) {
-                Store(Zero, Local0)
-
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-
-                If (LEqual(MEMORY_SLOT_ENABLED, One)) {
-                    Store(0xF, Local0)
-                }
-
-                Release(MEMORY_SLOT_LOCK)
-                Return(Local0)
-            }
-
             Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) {
                 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
                 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 30/74] pc: acpi: memhp: move MHPD.MPXM method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (28 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 29/74] pc: acpi: memhp: move MHPD.MRST " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 31/74] pc: acpi: memhp: move MHPD.MOST " Igor Mammedov
                   ` (46 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   |  9 ---------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index b76694d..92591f6 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -117,6 +117,20 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
             aml_append(method, aml_return(a_ret_val));
         }
         aml_append(ctrl_dev, method);
+
+        method = aml_method(stringify(MEMORY_SLOT_PROXIMITY_METHOD), 1,
+                            AML_NOTSERIALIZED);
+        {
+            Aml *a_proximity = aml_name(stringify(MEMORY_SLOT_PROXIMITY));
+
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
+                                         a_slot_selector));
+            aml_append(method, aml_store(a_proximity, a_ret_val));
+            aml_append(method, aml_release(a_ctrl_lock));
+            aml_append(method, aml_return(a_ret_val));
+        }
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 13e93dc..02fecf2 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -25,7 +25,6 @@
             External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
-            External(MEMORY_SLOT_PROXIMITY, FieldUnitObj) // read only
             External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
@@ -96,14 +95,6 @@
                 Return(MR64)
             }
 
-            Method(MEMORY_SLOT_PROXIMITY_METHOD, 1) {
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-                Store(MEMORY_SLOT_PROXIMITY, Local0)
-                Release(MEMORY_SLOT_LOCK)
-                Return(Local0)
-            }
-
             Method(MEMORY_SLOT_OST_METHOD, 4) {
                 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
                 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 31/74] pc: acpi: memhp: move MHPD.MOST method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (29 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 30/74] pc: acpi: memhp: move MHPD.MPXM " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 32/74] pc: acpi: memhp: move MHPD.MEJ0 " Igor Mammedov
                   ` (45 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 15 +++++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   | 10 ----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 92591f6..5dfdab7 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -131,6 +131,21 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
             aml_append(method, aml_return(a_ret_val));
         }
         aml_append(ctrl_dev, method);
+
+        method = aml_method(stringify(MEMORY_SLOT_OST_METHOD), 4,
+                            AML_NOTSERIALIZED);
+        {
+            Aml *a_ost_evt = aml_name(stringify(MEMORY_SLOT_OST_EVENT));
+            Aml *a_ost_status = aml_name(stringify(MEMORY_SLOT_OST_STATUS));
+
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
+                                         a_slot_selector));
+            aml_append(method, aml_store(aml_arg(1), a_ost_evt));
+            aml_append(method, aml_store(aml_arg(2), a_ost_status));
+            aml_append(method, aml_release(a_ctrl_lock));
+        }
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 02fecf2..8889eca 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -27,8 +27,6 @@
             External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
             External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
-            External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
-            External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
             External(MEMORY_SLOT_LOCK, MutexObj)
 
             Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) {
@@ -95,14 +93,6 @@
                 Return(MR64)
             }
 
-            Method(MEMORY_SLOT_OST_METHOD, 4) {
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-                Store(Arg1, MEMORY_SLOT_OST_EVENT)
-                Store(Arg2, MEMORY_SLOT_OST_STATUS)
-                Release(MEMORY_SLOT_LOCK)
-            }
-
             Method(MEMORY_SLOT_EJECT_METHOD, 2) {
                 Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
                 Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 32/74] pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (30 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 31/74] pc: acpi: memhp: move MHPD.MOST " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 33/74] pc: acpi: memhp: move MHPD.MCRS " Igor Mammedov
                   ` (44 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 13 +++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 5dfdab7..9795a9f 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -146,6 +146,19 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
             aml_append(method, aml_release(a_ctrl_lock));
         }
         aml_append(ctrl_dev, method);
+
+        method = aml_method(stringify(MEMORY_SLOT_EJECT_METHOD), 2,
+                            AML_NOTSERIALIZED);
+        {
+            Aml *a_eject = aml_name(stringify(MEMORY_SLOT_EJECT));
+
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
+                                         a_slot_selector));
+            aml_append(method, aml_store(a_one, a_eject));
+            aml_append(method, aml_release(a_ctrl_lock));
+        }
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 8889eca..87d8d66 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -25,7 +25,6 @@
             External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only
             External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
-            External(MEMORY_SLOT_EJECT, FieldUnitObj) // initiates device eject, write only
             External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
             External(MEMORY_SLOT_LOCK, MutexObj)
 
@@ -92,12 +91,5 @@
                 Release(MEMORY_SLOT_LOCK)
                 Return(MR64)
             }
-
-            Method(MEMORY_SLOT_EJECT_METHOD, 2) {
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-                Store(1, MEMORY_SLOT_EJECT)
-                Release(MEMORY_SLOT_LOCK)
-            }
         } // Device()
     } // Scope()
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 33/74] pc: acpi: memhp: move MHPD.MCRS method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (31 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 32/74] pc: acpi: memhp: move MHPD.MEJ0 " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 34/74] pc: acpi: memhp: move MHPD Device " Igor Mammedov
                   ` (43 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 85 +++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   | 72 -------------------------------
 2 files changed, 85 insertions(+), 72 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 9795a9f..622cd5c 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -118,6 +118,91 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         }
         aml_append(ctrl_dev, method);
 
+        method = aml_method(stringify(MEMORY_SLOT_CRS_METHOD), 1,
+                            AML_SERIALIZED);
+        {
+            Aml *a_mr64 = aml_name("MR64");
+            Aml *a_mr32 = aml_name("MR32");
+            Aml *a_crs_tmpl = aml_resource_template();
+            Aml *a_minl = aml_name("MINL");
+            Aml *a_minh = aml_name("MINH");
+            Aml *a_maxl =  aml_name("MAXL");
+            Aml *a_maxh =  aml_name("MAXH");
+            Aml *a_lenl = aml_name("LENL");
+            Aml *a_lenh = aml_name("LENH");
+
+            aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
+            aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
+                                         a_slot_selector));
+
+            aml_append(a_crs_tmpl,
+                aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
+                                 AML_CACHEABLE, AML_READ_WRITE,
+                                 0, 0x0, 0xFFFFFFFFFFFFFFFE, 0,
+                                 0xFFFFFFFFFFFFFFFF));
+            aml_append(method, aml_name_decl("MR64", a_crs_tmpl));
+            aml_append(method,
+                aml_create_dword_field(a_mr64, aml_int(14), "MINL"));
+            aml_append(method,
+                aml_create_dword_field(a_mr64, aml_int(18), "MINH"));
+            aml_append(method,
+                aml_create_dword_field(a_mr64, aml_int(38), "LENL"));
+            aml_append(method,
+                aml_create_dword_field(a_mr64, aml_int(42), "LENH"));
+            aml_append(method,
+                aml_create_dword_field(a_mr64, aml_int(22), "MAXL"));
+            aml_append(method,
+                aml_create_dword_field(a_mr64, aml_int(26), "MAXH"));
+
+            aml_append(method,
+                aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_HIGH)), a_minh));
+            aml_append(method,
+                aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_LOW)), a_minl));
+            aml_append(method,
+                aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_HIGH)), a_lenh));
+            aml_append(method,
+                aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_LOW)), a_lenl));
+
+            /* 64-bit math: MAX = MIN + LEN - 1 */
+            aml_append(method, aml_add(a_minl, a_lenl, a_maxl));
+            aml_append(method, aml_add(a_minh, a_lenh, a_maxh));
+            ifctx = aml_if(aml_lless(a_maxl, a_minl));
+            aml_append(ifctx, aml_add(a_maxh, a_one, a_maxh));
+            aml_append(method, ifctx);
+            ifctx = aml_if(aml_lless(a_maxl, a_one));
+            aml_append(ifctx, aml_subtract(a_maxh, a_one, a_maxh));
+            aml_append(method, ifctx);
+            aml_append(method, aml_subtract(a_maxl, a_one, a_maxl));
+
+            /* return 32-bit _CRS if addr/size is in low mem */
+            /* TODO: remove it since all hotplugged DIMMs are in high mem */
+            ifctx = aml_if(aml_equal(a_maxh, a_zero));
+            a_crs_tmpl = aml_resource_template();
+            aml_append(a_crs_tmpl,
+                aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
+                                 AML_CACHEABLE, AML_READ_WRITE,
+                                 0, 0x0, 0xFFFFFFFE, 0,
+                                 0xFFFFFFFF));
+            aml_append(ifctx, aml_name_decl("MR32", a_crs_tmpl));
+            aml_append(ifctx,
+                aml_create_dword_field(a_mr32, aml_int(10), "MIN"));
+            aml_append(ifctx,
+                aml_create_dword_field(a_mr32, aml_int(14), "MAX"));
+            aml_append(ifctx,
+                aml_create_dword_field(a_mr32, aml_int(22), "LEN"));
+            aml_append(ifctx, aml_store(a_minl, aml_name("MIN")));
+            aml_append(ifctx, aml_store(a_maxl, aml_name("MAX")));
+            aml_append(ifctx, aml_store(a_lenl, aml_name("LEN")));
+
+            aml_append(ifctx, aml_release(a_ctrl_lock));
+            aml_append(ifctx, aml_return(a_mr32));
+            aml_append(method, ifctx);
+
+            aml_append(method, aml_release(a_ctrl_lock));
+            aml_append(method, aml_return(a_mr64));
+        }
+        aml_append(ctrl_dev, method);
+
         method = aml_method(stringify(MEMORY_SLOT_PROXIMITY_METHOD), 1,
                             AML_NOTSERIALIZED);
         {
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 87d8d66..50b7541 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -19,77 +19,5 @@
         Device(MEMORY_HOTPLUG_DEVICE) {
             Name(_HID, "PNP0A06")
             Name(_UID, "Memory hotplug resources")
-
-            /* Memory hotplug IO registers */
-            External(MEMORY_SLOT_ADDR_LOW, FieldUnitObj) // read only
-            External(MEMORY_SLOT_ADDR_HIGH, FieldUnitObj) // read only
-            External(MEMORY_SLOT_SIZE_LOW, FieldUnitObj) // read only
-            External(MEMORY_SLOT_SIZE_HIGH, FieldUnitObj) // read only
-            External(MEMORY_SLOT_SLECTOR, FieldUnitObj) // DIMM selector, write only
-            External(MEMORY_SLOT_LOCK, MutexObj)
-
-            Method(MEMORY_SLOT_CRS_METHOD, 1, Serialized) {
-                Acquire(MEMORY_SLOT_LOCK, 0xFFFF)
-                Store(ToInteger(Arg0), MEMORY_SLOT_SLECTOR) // select DIMM
-
-                Name(MR64, ResourceTemplate() {
-                    QWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
-                    Cacheable, ReadWrite,
-                    0x0000000000000000,        // Address Space Granularity
-                    0x0000000000000000,        // Address Range Minimum
-                    0xFFFFFFFFFFFFFFFE,        // Address Range Maximum
-                    0x0000000000000000,        // Address Translation Offset
-                    0xFFFFFFFFFFFFFFFF,        // Address Length
-                    ,, MW64, AddressRangeMemory, TypeStatic)
-                })
-
-                CreateDWordField(MR64, 14, MINL)
-                CreateDWordField(MR64, 18, MINH)
-                CreateDWordField(MR64, 38, LENL)
-                CreateDWordField(MR64, 42, LENH)
-                CreateDWordField(MR64, 22, MAXL)
-                CreateDWordField(MR64, 26, MAXH)
-
-                Store(MEMORY_SLOT_ADDR_HIGH, MINH)
-                Store(MEMORY_SLOT_ADDR_LOW, MINL)
-                Store(MEMORY_SLOT_SIZE_HIGH, LENH)
-                Store(MEMORY_SLOT_SIZE_LOW, LENL)
-
-                // 64-bit math: MAX = MIN + LEN - 1
-                Add(MINL, LENL, MAXL)
-                Add(MINH, LENH, MAXH)
-                If (LLess(MAXL, MINL)) {
-                    Add(MAXH, One, MAXH)
-                }
-                If (LLess(MAXL, One)) {
-                    Subtract(MAXH, One, MAXH)
-                }
-                Subtract(MAXL, One, MAXL)
-
-                If (LEqual(MAXH, Zero)){
-                    Name(MR32, ResourceTemplate() {
-                        DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed,
-                        Cacheable, ReadWrite,
-                        0x00000000,        // Address Space Granularity
-                        0x00000000,        // Address Range Minimum
-                        0xFFFFFFFE,        // Address Range Maximum
-                        0x00000000,        // Address Translation Offset
-                        0xFFFFFFFF,        // Address Length
-                        ,, MW32, AddressRangeMemory, TypeStatic)
-                    })
-                    CreateDWordField(MR32, MW32._MIN, MIN)
-                    CreateDWordField(MR32, MW32._MAX, MAX)
-                    CreateDWordField(MR32, MW32._LEN, LEN)
-                    Store(MINL, MIN)
-                    Store(MAXL, MAX)
-                    Store(LENL, LEN)
-
-                    Release(MEMORY_SLOT_LOCK)
-                    Return(MR32)
-                }
-
-                Release(MEMORY_SLOT_LOCK)
-                Return(MR64)
-            }
         } // Device()
     } // Scope()
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 34/74] pc: acpi: memhp: move MHPD Device into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (32 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 33/74] pc: acpi: memhp: move MHPD.MCRS " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function Igor Mammedov
                   ` (42 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

move remnants of MHPD device from DSDT into SSDT.
 i.e. Device(MHPD), _UID, _HID

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 6 +++++-
 hw/i386/acpi-dsdt-mem-hotplug.dsl   | 7 -------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 622cd5c..b913edc 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -39,13 +39,17 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
 
     /* scope for memory hotplug controller device node */
     pci_scope = aml_scope("_SB.PCI0");
-    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
+    ctrl_dev = aml_device(stringify(MEMORY_HOTPLUG_DEVICE));
     {
         Aml *a_ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK));
         Aml *a_slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR));
         Aml *a_ret_val = aml_local(0);
         Aml *a_slot_arg0 = aml_arg(0);
 
+        aml_append(ctrl_dev, aml_name_decl("_HID", aml_string("PNP0A06")));
+        aml_append(ctrl_dev,
+            aml_name_decl("_UID", aml_string("Memory hotplug resources")));
+
         /* MHPD._STA() method */
         method = aml_method("_STA", 0, AML_NOTSERIALIZED);
         ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index 50b7541..20c5ec1 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -14,10 +14,3 @@
  */
 
     External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj)
-
-    Scope(\_SB.PCI0) {
-        Device(MEMORY_HOTPLUG_DEVICE) {
-            Name(_HID, "PNP0A06")
-            Name(_UID, "Memory hotplug resources")
-        } // Device()
-    } // Scope()
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (33 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 34/74] pc: acpi: memhp: move MHPD Device " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-19 20:18   ` Michael S. Tsirkin
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 36/74] pc: acpi: memhp: move \_GPE._E03 into SSDT Igor Mammedov
                   ` (41 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

before consolidating memhp code in memory_hotplug_acpi_table.c
and for simplifying review, first factor out memhp code into
new function build_memory_devices() in i386/acpi-build.c

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
----
PS:
   no functional change, only code movement.
---
 hw/i386/acpi-build.c | 239 +++++++++++++++++++++++++++------------------------
 1 file changed, 126 insertions(+), 113 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 1b609e6..765fccd 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -903,6 +903,130 @@ static Aml *build_crs(PCIHostState *host,
     return crs;
 }
 
+static void build_memory_devices(Aml *sb_scope, int nr_mem,
+                                 uint16_t io_base, uint16_t io_len)
+{
+    int i;
+    Aml *scope;
+    Aml *crs;
+    Aml *field;
+    Aml *dev;
+    Aml *method;
+    Aml *ifctx;
+
+    /* build memory devices */
+    assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
+    scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
+    aml_append(scope,
+        aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
+    );
+
+    crs = aml_resource_template();
+    aml_append(crs,
+        aml_io(AML_DECODE16, io_base, io_base, 0, io_len)
+    );
+    aml_append(scope, aml_name_decl("_CRS", crs));
+
+    aml_append(scope, aml_operation_region(
+        stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
+        io_base, io_len)
+    );
+
+    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
+                      AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, /* read only */
+        aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
+    aml_append(field, /* read only */
+        aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
+    aml_append(field, /* read only */
+        aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
+    aml_append(field, /* read only */
+        aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
+    aml_append(field, /* read only */
+        aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
+    aml_append(scope, field);
+
+    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
+                      AML_NOLOCK, AML_WRITE_AS_ZEROS);
+    aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
+    aml_append(field, /* 1 if enabled, read only */
+        aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
+    aml_append(field,
+        /*(read) 1 if has a insert event. (write) 1 to clear event */
+        aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
+    aml_append(field,
+        /* (read) 1 if has a remove event. (write) 1 to clear event */
+        aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
+    aml_append(field,
+        /* initiates device eject, write only */
+        aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
+    aml_append(scope, field);
+
+    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
+                      AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, /* DIMM selector, write only */
+        aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
+    aml_append(field, /* _OST event code, write only */
+        aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
+    aml_append(field, /* _OST status code, write only */
+        aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
+    aml_append(scope, field);
+    aml_append(sb_scope, scope);
+
+    for (i = 0; i < nr_mem; i++) {
+        #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
+        const char *s;
+
+        dev = aml_device("MP%02X", i);
+        aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
+
+        method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
+        s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
+        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
+        aml_append(dev, method);
+
+        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+        s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
+        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
+        aml_append(dev, method);
+
+        method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
+        s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
+        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
+        aml_append(dev, method);
+
+        method = aml_method("_OST", 3, AML_NOTSERIALIZED);
+        s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
+        aml_append(method, aml_return(aml_call4(
+            s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
+        )));
+        aml_append(dev, method);
+
+        method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
+        s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
+        aml_append(method, aml_return(aml_call2(
+                   s, aml_name("_UID"), aml_arg(0))));
+        aml_append(dev, method);
+
+        aml_append(sb_scope, dev);
+    }
+
+    /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
+     *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
+     */
+    method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
+                        AML_NOTSERIALIZED);
+    for (i = 0; i < nr_mem; i++) {
+        ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
+        aml_append(ifctx,
+            aml_notify(aml_name("MP%.02X", i), aml_arg(1))
+        );
+        aml_append(method, ifctx);
+    }
+    aml_append(sb_scope, method);
+}
+
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1206,119 +1330,8 @@ build_ssdt(GArray *table_data, GArray *linker,
         }
         aml_append(sb_scope, aml_name_decl("CPON", pkg));
 
-        /* build memory devices */
-        assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
-        scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
-        aml_append(scope,
-            aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
-        );
-
-        crs = aml_resource_template();
-        aml_append(crs,
-            aml_io(AML_DECODE16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0,
-                   pm->mem_hp_io_len)
-        );
-        aml_append(scope, aml_name_decl("_CRS", crs));
-
-        aml_append(scope, aml_operation_region(
-            stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
-            pm->mem_hp_io_base, pm->mem_hp_io_len)
-        );
-
-        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
-                          AML_NOLOCK, AML_PRESERVE);
-        aml_append(field, /* read only */
-            aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
-        aml_append(field, /* read only */
-            aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
-        aml_append(field, /* read only */
-            aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
-        aml_append(field, /* read only */
-            aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
-        aml_append(field, /* read only */
-            aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
-        aml_append(scope, field);
-
-        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
-                          AML_NOLOCK, AML_WRITE_AS_ZEROS);
-        aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
-        aml_append(field, /* 1 if enabled, read only */
-            aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
-        aml_append(field,
-            /*(read) 1 if has a insert event. (write) 1 to clear event */
-            aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
-        aml_append(field,
-            /* (read) 1 if has a remove event. (write) 1 to clear event */
-            aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
-        aml_append(field,
-            /* initiates device eject, write only */
-            aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
-        aml_append(scope, field);
-
-        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
-                          AML_NOLOCK, AML_PRESERVE);
-        aml_append(field, /* DIMM selector, write only */
-            aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
-        aml_append(field, /* _OST event code, write only */
-            aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
-        aml_append(field, /* _OST status code, write only */
-            aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
-        aml_append(scope, field);
-
-        aml_append(sb_scope, scope);
-
-        for (i = 0; i < nr_mem; i++) {
-            #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
-            const char *s;
-
-            dev = aml_device("MP%02X", i);
-            aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
-            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
-
-            method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
-            s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
-            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
-            aml_append(dev, method);
-
-            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
-            s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
-            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
-            aml_append(dev, method);
-
-            method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
-            s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
-            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
-            aml_append(dev, method);
-
-            method = aml_method("_OST", 3, AML_NOTSERIALIZED);
-            s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
-            aml_append(method, aml_return(aml_call4(
-                s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
-            )));
-            aml_append(dev, method);
-
-            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
-            s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
-            aml_append(method, aml_return(aml_call2(
-                       s, aml_name("_UID"), aml_arg(0))));
-            aml_append(dev, method);
-
-            aml_append(sb_scope, dev);
-        }
-
-        /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
-         *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
-         */
-        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
-                            AML_NOTSERIALIZED);
-        for (i = 0; i < nr_mem; i++) {
-            ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
-            aml_append(ifctx,
-                aml_notify(aml_name("MP%.02X", i), aml_arg(1))
-            );
-            aml_append(method, ifctx);
-        }
-        aml_append(sb_scope, method);
+        build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
+                             pm->mem_hp_io_len);
 
         {
             Object *pci_host;
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 36/74] pc: acpi: memhp: move \_GPE._E03 into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (34 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 37/74] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage Igor Mammedov
                   ` (40 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

in addition remove no longer needed acpi-dsdt-mem-hotplug.dsl.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c              |  6 ++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl | 16 ----------------
 hw/i386/acpi-dsdt.dsl             |  5 -----
 hw/i386/q35-acpi-dsdt.dsl         |  5 -----
 include/hw/acpi/memory_hotplug.h  |  5 +++++
 include/hw/acpi/pc-hotplug.h      |  2 --
 6 files changed, 11 insertions(+), 28 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt-mem-hotplug.dsl

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 765fccd..94371f7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1055,6 +1055,12 @@ build_ssdt(GArray *table_data, GArray *linker,
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
 
+    scope =  aml_scope("\\_GPE");
+    method = aml_method("_E03", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
+    aml_append(scope, method);
+    aml_append(ssdt, scope);
+
     /* Extra PCI root buses are implemented  only for i440fx */
     bus = find_i440fx();
     if (bus) {
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
deleted file mode 100644
index 20c5ec1..0000000
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-    External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj)
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 8dba096..9cf1b88 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -250,7 +250,6 @@ DefinitionBlock (
 #include "hw/acpi/pc-hotplug.h"
 #define CPU_STATUS_BASE PIIX4_CPU_HOTPLUG_IO_BASE
 #include "acpi-dsdt-cpu-hotplug.dsl"
-#include "acpi-dsdt-mem-hotplug.dsl"
 
 
 /****************************************************************
@@ -271,10 +270,6 @@ DefinitionBlock (
             // CPU hotplug event
             \_SB.PRSC()
         }
-        Method(_E03) {
-            // Memory hotplug event
-            \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD()
-        }
         Method(_L04) {
         }
         Method(_L05) {
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 7be7b37..f950f39 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -387,7 +387,6 @@ DefinitionBlock (
 #include "hw/acpi/pc-hotplug.h"
 #define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE
 #include "acpi-dsdt-cpu-hotplug.dsl"
-#include "acpi-dsdt-mem-hotplug.dsl"
 
 
 /****************************************************************
@@ -404,10 +403,6 @@ DefinitionBlock (
             // CPU hotplug event
             \_SB.PRSC()
         }
-        Method(_E03) {
-            // Memory hotplug event
-            \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD()
-        }
         Method(_L04) {
         }
         Method(_L05) {
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index b6e9f50..de164f2 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -47,6 +47,11 @@ extern const VMStateDescription vmstate_memory_hotplug;
 
 void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
 
+#define MEMORY_HOTPLUG_DEVICE        MHPD
+#define MEMORY_SLOT_SCAN_METHOD      MSCN
+#define MEMORY_HOTPLUG_HANDLER_PATH "\\_SB.PCI0." \
+     stringify(MEMORY_HOTPLUG_DEVICE) "." stringify(MEMORY_SLOT_SCAN_METHOD)
+
 void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
                               uint16_t io_base, uint16_t io_len);
 #endif
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index 77b1569..e5bb321 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -32,7 +32,6 @@
 #define ACPI_MEMORY_HOTPLUG_IO_LEN 24
 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00
 
-#define MEMORY_HOTPLUG_DEVICE        MHPD
 #define MEMORY_SLOTS_NUMBER          MDNR
 #define MEMORY_HOTPLUG_IO_REGION     HPMR
 #define MEMORY_SLOT_ADDR_LOW         MRBL
@@ -54,6 +53,5 @@
 #define MEMORY_SLOT_PROXIMITY_METHOD MPXM
 #define MEMORY_SLOT_EJECT_METHOD     MEJ0
 #define MEMORY_SLOT_NOTIFY_METHOD    MTFY
-#define MEMORY_SLOT_SCAN_METHOD      MSCN
 
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 37/74] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (35 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 36/74] pc: acpi: memhp: move \_GPE._E03 into SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 38/74] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Igor Mammedov
                   ` (39 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

most of MEMORY_foo defines are not shared
with ASL anymore and are used only inside of
memory_hotplug_acpi_table.c, so move them
there and make them strings. As result we
can replace stringify(MEMORY_foo) with just
MEMORY_foo, which makes code a bit cleaner.

No AML change introduced by this patch.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 53 +++++++++++++++++--------------------
 hw/i386/acpi-build.c                | 52 ++++++++++++++++++------------------
 include/hw/acpi/memory_hotplug.h    |  6 ++---
 include/hw/acpi/pc-hotplug.h        | 42 ++++++++++++++---------------
 4 files changed, 74 insertions(+), 79 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index b913edc..3e943c3 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -35,14 +35,14 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
     Aml *while_ctx;
     Aml *a_zero = aml_int(0);
     Aml *a_one = aml_int(1);
-    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
+    Aml *a_slots_nr = aml_name(MEMORY_SLOTS_NUMBER);
 
     /* scope for memory hotplug controller device node */
     pci_scope = aml_scope("_SB.PCI0");
-    ctrl_dev = aml_device(stringify(MEMORY_HOTPLUG_DEVICE));
+    ctrl_dev = aml_device(MEMORY_HOTPLUG_DEVICE);
     {
-        Aml *a_ctrl_lock = aml_name(stringify(MEMORY_SLOT_LOCK));
-        Aml *a_slot_selector = aml_name(stringify(MEMORY_SLOT_SLECTOR));
+        Aml *a_ctrl_lock = aml_name(MEMORY_SLOT_LOCK);
+        Aml *a_slot_selector = aml_name(MEMORY_SLOT_SLECTOR);
         Aml *a_ret_val = aml_local(0);
         Aml *a_slot_arg0 = aml_arg(0);
 
@@ -59,10 +59,9 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         aml_append(method, aml_return(aml_int(0xB)));
         aml_append(ctrl_dev, method);
 
-        aml_append(ctrl_dev, aml_mutex(stringify(MEMORY_SLOT_LOCK), 0));
+        aml_append(ctrl_dev, aml_mutex(MEMORY_SLOT_LOCK, 0));
 
-        method = aml_method(stringify(MEMORY_SLOT_SCAN_METHOD), 0,
-                            AML_NOTSERIALIZED);
+        method = aml_method(MEMORY_SLOT_SCAN_METHOD, 0, AML_NOTSERIALIZED);
         {
             Aml *a_idx = aml_local(0);
 
@@ -75,13 +74,13 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
             while_ctx = aml_while(
                 aml_lless(a_idx, a_slots_nr));
             {
-                Aml *a_ins_evt = aml_name(stringify(MEMORY_SLOT_INSERT_EVENT));
-                Aml *a_rm_evt = aml_name(stringify(MEMORY_SLOT_REMOVE_EVENT));
+                Aml *a_ins_evt = aml_name(MEMORY_SLOT_INSERT_EVENT);
+                Aml *a_rm_evt = aml_name(MEMORY_SLOT_REMOVE_EVENT);
 
                 aml_append(while_ctx, aml_store(a_idx, a_slot_selector));
                 ifctx = aml_if(aml_equal(a_ins_evt, a_one));
                 aml_append(ifctx,
-                    aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD),
+                    aml_call2(MEMORY_SLOT_NOTIFY_METHOD,
                               a_idx, a_one));
                 aml_append(ifctx, aml_store(a_one, a_ins_evt));
                 aml_append(while_ctx, ifctx);
@@ -89,7 +88,7 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
                 else_ctx = aml_else();
                 ifctx = aml_if(aml_equal(a_rm_evt, a_one));
                 aml_append(ifctx,
-                    aml_call2(stringify(MEMORY_SLOT_NOTIFY_METHOD),
+                    aml_call2(MEMORY_SLOT_NOTIFY_METHOD,
                               a_idx, aml_int(3)));
                 aml_append(ifctx, aml_store(a_one, a_rm_evt));
                 aml_append(else_ctx, ifctx);
@@ -103,10 +102,9 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         }
         aml_append(ctrl_dev, method);
 
-        method = aml_method(stringify(MEMORY_SLOT_STATUS_METHOD), 1,
-                            AML_NOTSERIALIZED);
+        method = aml_method(MEMORY_SLOT_STATUS_METHOD, 1, AML_NOTSERIALIZED);
         {
-            Aml *a_slot_enabled = aml_name(stringify(MEMORY_SLOT_ENABLED));
+            Aml *a_slot_enabled = aml_name(MEMORY_SLOT_ENABLED);
 
             aml_append(method, aml_store(a_zero, a_ret_val));
             aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
@@ -122,8 +120,7 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         }
         aml_append(ctrl_dev, method);
 
-        method = aml_method(stringify(MEMORY_SLOT_CRS_METHOD), 1,
-                            AML_SERIALIZED);
+        method = aml_method(MEMORY_SLOT_CRS_METHOD, 1, AML_SERIALIZED);
         {
             Aml *a_mr64 = aml_name("MR64");
             Aml *a_mr32 = aml_name("MR32");
@@ -159,13 +156,13 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
                 aml_create_dword_field(a_mr64, aml_int(26), "MAXH"));
 
             aml_append(method,
-                aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_HIGH)), a_minh));
+                aml_store(aml_name(MEMORY_SLOT_ADDR_HIGH), a_minh));
             aml_append(method,
-                aml_store(aml_name(stringify(MEMORY_SLOT_ADDR_LOW)), a_minl));
+                aml_store(aml_name(MEMORY_SLOT_ADDR_LOW), a_minl));
             aml_append(method,
-                aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_HIGH)), a_lenh));
+                aml_store(aml_name(MEMORY_SLOT_SIZE_HIGH), a_lenh));
             aml_append(method,
-                aml_store(aml_name(stringify(MEMORY_SLOT_SIZE_LOW)), a_lenl));
+                aml_store(aml_name(MEMORY_SLOT_SIZE_LOW), a_lenl));
 
             /* 64-bit math: MAX = MIN + LEN - 1 */
             aml_append(method, aml_add(a_minl, a_lenl, a_maxl));
@@ -207,10 +204,10 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         }
         aml_append(ctrl_dev, method);
 
-        method = aml_method(stringify(MEMORY_SLOT_PROXIMITY_METHOD), 1,
+        method = aml_method(MEMORY_SLOT_PROXIMITY_METHOD, 1,
                             AML_NOTSERIALIZED);
         {
-            Aml *a_proximity = aml_name(stringify(MEMORY_SLOT_PROXIMITY));
+            Aml *a_proximity = aml_name(MEMORY_SLOT_PROXIMITY);
 
             aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
             aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
@@ -221,11 +218,10 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         }
         aml_append(ctrl_dev, method);
 
-        method = aml_method(stringify(MEMORY_SLOT_OST_METHOD), 4,
-                            AML_NOTSERIALIZED);
+        method = aml_method(MEMORY_SLOT_OST_METHOD, 4, AML_NOTSERIALIZED);
         {
-            Aml *a_ost_evt = aml_name(stringify(MEMORY_SLOT_OST_EVENT));
-            Aml *a_ost_status = aml_name(stringify(MEMORY_SLOT_OST_STATUS));
+            Aml *a_ost_evt = aml_name(MEMORY_SLOT_OST_EVENT);
+            Aml *a_ost_status = aml_name(MEMORY_SLOT_OST_STATUS);
 
             aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
             aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
@@ -236,10 +232,9 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
         }
         aml_append(ctrl_dev, method);
 
-        method = aml_method(stringify(MEMORY_SLOT_EJECT_METHOD), 2,
-                            AML_NOTSERIALIZED);
+        method = aml_method(MEMORY_SLOT_EJECT_METHOD, 2, AML_NOTSERIALIZED);
         {
-            Aml *a_eject = aml_name(stringify(MEMORY_SLOT_EJECT));
+            Aml *a_eject = aml_name(MEMORY_SLOT_EJECT);
 
             aml_append(method, aml_acquire(a_ctrl_lock, 0xFFFF));
             aml_append(method, aml_store(aml_to_integer(a_slot_arg0),
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 94371f7..f6337ca 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -916,9 +916,9 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
 
     /* build memory devices */
     assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
-    scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
+    scope = aml_scope("\\_SB.PCI0." MEMORY_HOTPLUG_DEVICE);
     aml_append(scope,
-        aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
+        aml_name_decl(MEMORY_SLOTS_NUMBER, aml_int(nr_mem))
     );
 
     crs = aml_resource_template();
@@ -928,53 +928,53 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
     aml_append(scope, aml_name_decl("_CRS", crs));
 
     aml_append(scope, aml_operation_region(
-        stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
+        MEMORY_HOTPLUG_IO_REGION, AML_SYSTEM_IO,
         io_base, io_len)
     );
 
-    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
+    field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_DWORD_ACC,
                       AML_NOLOCK, AML_PRESERVE);
     aml_append(field, /* read only */
-        aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
+        aml_named_field(MEMORY_SLOT_ADDR_LOW, 32));
     aml_append(field, /* read only */
-        aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
+        aml_named_field(MEMORY_SLOT_ADDR_HIGH, 32));
     aml_append(field, /* read only */
-        aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
+        aml_named_field(MEMORY_SLOT_SIZE_LOW, 32));
     aml_append(field, /* read only */
-        aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
+        aml_named_field(MEMORY_SLOT_SIZE_HIGH, 32));
     aml_append(field, /* read only */
-        aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
+        aml_named_field(MEMORY_SLOT_PROXIMITY, 32));
     aml_append(scope, field);
 
-    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
+    field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_BYTE_ACC,
                       AML_NOLOCK, AML_WRITE_AS_ZEROS);
     aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
     aml_append(field, /* 1 if enabled, read only */
-        aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
+        aml_named_field(MEMORY_SLOT_ENABLED, 1));
     aml_append(field,
         /*(read) 1 if has a insert event. (write) 1 to clear event */
-        aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
+        aml_named_field(MEMORY_SLOT_INSERT_EVENT, 1));
     aml_append(field,
         /* (read) 1 if has a remove event. (write) 1 to clear event */
-        aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
+        aml_named_field(MEMORY_SLOT_REMOVE_EVENT, 1));
     aml_append(field,
         /* initiates device eject, write only */
-        aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
+        aml_named_field(MEMORY_SLOT_EJECT, 1));
     aml_append(scope, field);
 
-    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
+    field = aml_field(MEMORY_HOTPLUG_IO_REGION, AML_DWORD_ACC,
                       AML_NOLOCK, AML_PRESERVE);
     aml_append(field, /* DIMM selector, write only */
-        aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
+        aml_named_field(MEMORY_SLOT_SLECTOR, 32));
     aml_append(field, /* _OST event code, write only */
-        aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
+        aml_named_field(MEMORY_SLOT_OST_EVENT, 32));
     aml_append(field, /* _OST status code, write only */
-        aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
+        aml_named_field(MEMORY_SLOT_OST_STATUS, 32));
     aml_append(scope, field);
     aml_append(sb_scope, scope);
 
     for (i = 0; i < nr_mem; i++) {
-        #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
+        #define BASEPATH "\\_SB.PCI0." MEMORY_HOTPLUG_DEVICE "."
         const char *s;
 
         dev = aml_device("MP%02X", i);
@@ -982,29 +982,30 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
         aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
 
         method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
-        s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
+        s = BASEPATH MEMORY_SLOT_CRS_METHOD;
         aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
         aml_append(dev, method);
 
         method = aml_method("_STA", 0, AML_NOTSERIALIZED);
-        s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
+        s = BASEPATH MEMORY_SLOT_STATUS_METHOD;
         aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
         aml_append(dev, method);
 
         method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
-        s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
+        s = BASEPATH MEMORY_SLOT_PROXIMITY_METHOD;
         aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
         aml_append(dev, method);
 
         method = aml_method("_OST", 3, AML_NOTSERIALIZED);
-        s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
+        s = BASEPATH MEMORY_SLOT_OST_METHOD;
+
         aml_append(method, aml_return(aml_call4(
             s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
         )));
         aml_append(dev, method);
 
         method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
-        s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
+        s = BASEPATH MEMORY_SLOT_EJECT_METHOD;
         aml_append(method, aml_return(aml_call2(
                    s, aml_name("_UID"), aml_arg(0))));
         aml_append(dev, method);
@@ -1015,8 +1016,7 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
     /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
      *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
      */
-    method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
-                        AML_NOTSERIALIZED);
+    method = aml_method(MEMORY_SLOT_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
     for (i = 0; i < nr_mem; i++) {
         ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
         aml_append(ifctx,
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index de164f2..3a646b1 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -47,10 +47,10 @@ extern const VMStateDescription vmstate_memory_hotplug;
 
 void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
 
-#define MEMORY_HOTPLUG_DEVICE        MHPD
-#define MEMORY_SLOT_SCAN_METHOD      MSCN
+#define MEMORY_HOTPLUG_DEVICE        "MHPD"
+#define MEMORY_SLOT_SCAN_METHOD      "MSCN"
 #define MEMORY_HOTPLUG_HANDLER_PATH "\\_SB.PCI0." \
-     stringify(MEMORY_HOTPLUG_DEVICE) "." stringify(MEMORY_SLOT_SCAN_METHOD)
+     MEMORY_HOTPLUG_DEVICE "." MEMORY_SLOT_SCAN_METHOD
 
 void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
                               uint16_t io_base, uint16_t io_len);
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index e5bb321..6a8d268 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -32,26 +32,26 @@
 #define ACPI_MEMORY_HOTPLUG_IO_LEN 24
 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00
 
-#define MEMORY_SLOTS_NUMBER          MDNR
-#define MEMORY_HOTPLUG_IO_REGION     HPMR
-#define MEMORY_SLOT_ADDR_LOW         MRBL
-#define MEMORY_SLOT_ADDR_HIGH        MRBH
-#define MEMORY_SLOT_SIZE_LOW         MRLL
-#define MEMORY_SLOT_SIZE_HIGH        MRLH
-#define MEMORY_SLOT_PROXIMITY        MPX
-#define MEMORY_SLOT_ENABLED          MES
-#define MEMORY_SLOT_INSERT_EVENT     MINS
-#define MEMORY_SLOT_REMOVE_EVENT     MRMV
-#define MEMORY_SLOT_EJECT            MEJ
-#define MEMORY_SLOT_SLECTOR          MSEL
-#define MEMORY_SLOT_OST_EVENT        MOEV
-#define MEMORY_SLOT_OST_STATUS       MOSC
-#define MEMORY_SLOT_LOCK             MLCK
-#define MEMORY_SLOT_STATUS_METHOD    MRST
-#define MEMORY_SLOT_CRS_METHOD       MCRS
-#define MEMORY_SLOT_OST_METHOD       MOST
-#define MEMORY_SLOT_PROXIMITY_METHOD MPXM
-#define MEMORY_SLOT_EJECT_METHOD     MEJ0
-#define MEMORY_SLOT_NOTIFY_METHOD    MTFY
+#define MEMORY_SLOTS_NUMBER          "MDNR"
+#define MEMORY_HOTPLUG_IO_REGION     "HPMR"
+#define MEMORY_SLOT_ADDR_LOW         "MRBL"
+#define MEMORY_SLOT_ADDR_HIGH        "MRBH"
+#define MEMORY_SLOT_SIZE_LOW         "MRLL"
+#define MEMORY_SLOT_SIZE_HIGH        "MRLH"
+#define MEMORY_SLOT_PROXIMITY        "MPX"
+#define MEMORY_SLOT_ENABLED          "MES"
+#define MEMORY_SLOT_INSERT_EVENT     "MINS"
+#define MEMORY_SLOT_REMOVE_EVENT     "MRMV"
+#define MEMORY_SLOT_EJECT            "MEJ"
+#define MEMORY_SLOT_SLECTOR          "MSEL"
+#define MEMORY_SLOT_OST_EVENT        "MOEV"
+#define MEMORY_SLOT_OST_STATUS       "MOSC"
+#define MEMORY_SLOT_LOCK             "MLCK"
+#define MEMORY_SLOT_STATUS_METHOD    "MRST"
+#define MEMORY_SLOT_CRS_METHOD       "MCRS"
+#define MEMORY_SLOT_OST_METHOD       "MOST"
+#define MEMORY_SLOT_PROXIMITY_METHOD "MPXM"
+#define MEMORY_SLOT_EJECT_METHOD     "MEJ0"
+#define MEMORY_SLOT_NOTIFY_METHOD    "MTFY"
 
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 38/74] pc: acpi: drop unused CPU_STATUS_LEN from DSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (36 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 37/74] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 39/74] pc: acpi: cpuhp: move CPEJ() method to SSDT Igor Mammedov
                   ` (38 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-dsdt-cpu-hotplug.dsl | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index 1aff746..53e1389 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -53,7 +53,6 @@ Scope(\_SB) {
         Sleep(200)
     }
 
-#define CPU_STATUS_LEN ACPI_GPE_PROC_LEN
     Method(PRSC, 0) {
         // Local5 = active cpu bitmap
         Store(PRS, Local5)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 39/74] pc: acpi: cpuhp: move CPEJ() method to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (37 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 38/74] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 40/74] pc: acpi: cpuhp: move CPMA() method into SSDT Igor Mammedov
                   ` (37 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/Makefile.objs             |  2 +-
 hw/acpi/cpu_hotplug_acpi_table.c  | 28 ++++++++++++++++++++++++++++
 hw/i386/acpi-build.c              |  3 ++-
 hw/i386/acpi-dsdt-cpu-hotplug.dsl |  4 ----
 include/hw/acpi/cpu_hotplug.h     |  5 +++++
 5 files changed, 36 insertions(+), 6 deletions(-)
 create mode 100644 hw/acpi/cpu_hotplug_acpi_table.c

diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index c04064e..cd09d93 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -1,6 +1,6 @@
 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_CPU_HOTPLUG) += cpu_hotplug.o cpu_hotplug_acpi_table.o
 common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
 common-obj-$(CONFIG_ACPI) += acpi_interface.o
 common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
new file mode 100644
index 0000000..422e57b
--- /dev/null
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -0,0 +1,28 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "hw/acpi/cpu_hotplug.h"
+
+void build_cpu_hotplug_aml(Aml *ctx)
+{
+    Aml *method;
+    Aml *sb_scope = aml_scope("_SB");
+
+    method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
+    aml_append(method, aml_sleep(200));
+    aml_append(sb_scope, method);
+
+    aml_append(ctx, sb_scope);
+}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f6337ca..9f8f769 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1052,6 +1052,7 @@ build_ssdt(GArray *table_data, GArray *linker,
     /* Reserve space for header */
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
+    build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
 
@@ -1299,7 +1300,7 @@ build_ssdt(GArray *table_data, GArray *linker,
 
             method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
             aml_append(method,
-                aml_return(aml_call2("CPEJ", aml_int(i), aml_arg(0)))
+                aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0)))
             );
             aml_append(dev, method);
 
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index 53e1389..18331be 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -48,10 +48,6 @@ Scope(\_SB) {
             Return (0x0)
         }
     }
-    Method(CPEJ, 2, NotSerialized) {
-        // _EJ0 method - eject callback
-        Sleep(200)
-    }
 
     Method(PRSC, 0) {
         // Local5 = active cpu bitmap
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index f6d358d..87504be 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -14,6 +14,7 @@
 
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/pc-hotplug.h"
+#include "hw/acpi/aml-build.h"
 
 typedef struct AcpiCpuHotplug {
     MemoryRegion io;
@@ -25,4 +26,8 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq,
 
 void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
                            AcpiCpuHotplug *gpe_cpu, uint16_t base);
+
+#define CPU_EJECT_METHOD "CPEJ"
+
+void build_cpu_hotplug_aml(Aml *ctx);
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 40/74] pc: acpi: cpuhp: move CPMA() method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (38 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 39/74] pc: acpi: cpuhp: move CPEJ() method to SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 41/74] pc: acpi: cpuhp: move CPST() " Igor Mammedov
                   ` (36 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu_hotplug_acpi_table.c  | 23 +++++++++++++++++++++++
 hw/i386/acpi-build.c              |  5 +++--
 hw/i386/acpi-dsdt-cpu-hotplug.dsl | 13 -------------
 include/hw/acpi/cpu_hotplug.h     |  2 ++
 4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
index 422e57b..fd1f85e 100644
--- a/hw/acpi/cpu_hotplug_acpi_table.c
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -19,6 +19,29 @@ void build_cpu_hotplug_aml(Aml *ctx)
 {
     Aml *method;
     Aml *sb_scope = aml_scope("_SB");
+    uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0};
+    Aml *a_cpu_id = aml_arg(0);
+    Aml *a_cpu_on = aml_local(0);
+    Aml *a_madt = aml_local(1);
+    Aml *a_cpus_map = aml_name(CPU_CPU_ON_BITMAP);
+
+    /*
+     * _MAT method - creates an madt apic buffer
+     * a_cpu_id = Arg0 = Processor ID = Local APIC ID
+     * a_cpu_on = Local0 = CPON flag for this cpu
+     * a_madt = Local1 = Buffer (in madt apic form) to return
+     */
+    method = aml_method(CPU_MAT_METHOD, 1, AML_NOTSERIALIZED);
+    aml_append(method, aml_store(
+        aml_derefof(aml_index(a_cpus_map, a_cpu_id)), a_cpu_on));
+    aml_append(method, aml_store(
+        aml_buffer(sizeof(madt_tmpl), madt_tmpl), a_madt));
+    /* Update the processor id, lapic id, and enable/disable status */
+    aml_append(method, aml_store(a_cpu_id, aml_index(a_madt, aml_int(2))));
+    aml_append(method, aml_store(a_cpu_id, aml_index(a_madt, aml_int(3))));
+    aml_append(method, aml_store(a_cpu_on, aml_index(a_madt, aml_int(4))));
+    aml_append(method, aml_return(a_madt));
+    aml_append(sb_scope, method);
 
     method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
     aml_append(method, aml_sleep(200));
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9f8f769..eb1f90b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1291,7 +1291,8 @@ build_ssdt(GArray *table_data, GArray *linker,
             dev = aml_processor(i, 0, 0, "CP%.02X", i);
 
             method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
-            aml_append(method, aml_return(aml_call1("CPMA", aml_int(i))));
+            aml_append(method,
+                aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i))));
             aml_append(dev, method);
 
             method = aml_method("_STA", 0, AML_NOTSERIALIZED);
@@ -1335,7 +1336,7 @@ build_ssdt(GArray *table_data, GArray *linker,
             uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
             aml_append(pkg, aml_int(b));
         }
-        aml_append(sb_scope, aml_name_decl("CPON", pkg));
+        aml_append(sb_scope, aml_name_decl(CPU_CPU_ON_BITMAP, pkg));
 
         build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index 18331be..9739191 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -24,19 +24,6 @@ Scope(\_SB) {
     External(PRS, FieldUnitObj)
 
     /* Methods called by run-time generated SSDT Processor objects */
-    Method(CPMA, 1, NotSerialized) {
-        // _MAT method - create an madt apic buffer
-        // Arg0 = Processor ID = Local APIC ID
-        // Local0 = CPON flag for this cpu
-        Store(DerefOf(Index(CPON, Arg0)), Local0)
-        // Local1 = Buffer (in madt apic form) to return
-        Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
-        // Update the processor id, lapic id, and enable/disable status
-        Store(Arg0, Index(Local1, 2))
-        Store(Arg0, Index(Local1, 3))
-        Store(Local0, Index(Local1, 4))
-        Return (Local1)
-    }
     Method(CPST, 1, NotSerialized) {
         // _STA method - return ON status of cpu
         // Arg0 = Processor ID = Local APIC ID
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 87504be..d0b6d6b 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -28,6 +28,8 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
                            AcpiCpuHotplug *gpe_cpu, uint16_t base);
 
 #define CPU_EJECT_METHOD "CPEJ"
+#define CPU_MAT_METHOD "CPMA"
+#define CPU_CPU_ON_BITMAP "CPON"
 
 void build_cpu_hotplug_aml(Aml *ctx);
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 41/74] pc: acpi: cpuhp: move CPST() method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (39 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 40/74] pc: acpi: cpuhp: move CPMA() method into SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 42/74] pc: acpi: cpuhp: move PRSC() " Igor Mammedov
                   ` (35 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu_hotplug_acpi_table.c  | 18 ++++++++++++++++++
 hw/i386/acpi-build.c              |  3 ++-
 hw/i386/acpi-dsdt-cpu-hotplug.dsl | 12 ------------
 include/hw/acpi/cpu_hotplug.h     |  1 +
 4 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
index fd1f85e..8255937 100644
--- a/hw/acpi/cpu_hotplug_acpi_table.c
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -18,6 +18,8 @@
 void build_cpu_hotplug_aml(Aml *ctx)
 {
     Aml *method;
+    Aml *if_ctx;
+    Aml *else_ctx;
     Aml *sb_scope = aml_scope("_SB");
     uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0};
     Aml *a_cpu_id = aml_arg(0);
@@ -43,6 +45,22 @@ void build_cpu_hotplug_aml(Aml *ctx)
     aml_append(method, aml_return(a_madt));
     aml_append(sb_scope, method);
 
+    /*
+     * _STA method - return ON status of cpu
+     * a_cpu_id = Arg0 = Processor ID = Local APIC ID
+     * a_cpu_on = Local0 = CPON flag for this cpu
+     */
+    method = aml_method(CPU_STATUS_METHOD, 1, AML_NOTSERIALIZED);
+    aml_append(method, aml_store(
+        aml_derefof(aml_index(a_cpus_map, a_cpu_id)), a_cpu_on));
+    if_ctx = aml_if(a_cpu_on);
+    aml_append(if_ctx, aml_return(aml_int(0xF)));
+    aml_append(method, if_ctx);
+    else_ctx = aml_else();
+    aml_append(else_ctx, aml_return(aml_int(0x0)));
+    aml_append(method, else_ctx);
+    aml_append(sb_scope, method);
+
     method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
     aml_append(method, aml_sleep(200));
     aml_append(sb_scope, method);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index eb1f90b..3675928 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1296,7 +1296,8 @@ build_ssdt(GArray *table_data, GArray *linker,
             aml_append(dev, method);
 
             method = aml_method("_STA", 0, AML_NOTSERIALIZED);
-            aml_append(method, aml_return(aml_call1("CPST", aml_int(i))));
+            aml_append(method,
+                aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i))));
             aml_append(dev, method);
 
             method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index 9739191..fb75eda 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -24,18 +24,6 @@ Scope(\_SB) {
     External(PRS, FieldUnitObj)
 
     /* Methods called by run-time generated SSDT Processor objects */
-    Method(CPST, 1, NotSerialized) {
-        // _STA method - return ON status of cpu
-        // Arg0 = Processor ID = Local APIC ID
-        // Local0 = CPON flag for this cpu
-        Store(DerefOf(Index(CPON, Arg0)), Local0)
-        If (Local0) {
-            Return (0xF)
-        } Else {
-            Return (0x0)
-        }
-    }
-
     Method(PRSC, 0) {
         // Local5 = active cpu bitmap
         Store(PRS, Local5)
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index d0b6d6b..1ae3b29 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -30,6 +30,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
 #define CPU_EJECT_METHOD "CPEJ"
 #define CPU_MAT_METHOD "CPMA"
 #define CPU_CPU_ON_BITMAP "CPON"
+#define CPU_STATUS_METHOD "CPST"
 
 void build_cpu_hotplug_aml(Aml *ctx);
 #endif
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 42/74] pc: acpi: cpuhp: move PRSC() method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (40 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 41/74] pc: acpi: cpuhp: move CPST() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 43/74] pc: acpi: cpuhp: move \_GPE._E02() " Igor Mammedov
                   ` (34 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu_hotplug_acpi_table.c  | 55 +++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-build.c              |  2 +-
 hw/i386/acpi-dsdt-cpu-hotplug.dsl | 39 +--------------------------
 hw/i386/acpi-dsdt.dsl             |  2 +-
 hw/i386/q35-acpi-dsdt.dsl         |  2 +-
 include/hw/acpi/aml-build.h       |  2 ++
 include/hw/acpi/cpu_hotplug.h     |  1 +
 include/hw/acpi/pc-hotplug.h      |  1 +
 8 files changed, 63 insertions(+), 41 deletions(-)

diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
index 8255937..4ff444d 100644
--- a/hw/acpi/cpu_hotplug_acpi_table.c
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -26,6 +26,8 @@ void build_cpu_hotplug_aml(Aml *ctx)
     Aml *a_cpu_on = aml_local(0);
     Aml *a_madt = aml_local(1);
     Aml *a_cpus_map = aml_name(CPU_CPU_ON_BITMAP);
+    Aml *a_zero = aml_int(0);
+    Aml *a_one = aml_int(1);
 
     /*
      * _MAT method - creates an madt apic buffer
@@ -65,5 +67,58 @@ void build_cpu_hotplug_aml(Aml *ctx)
     aml_append(method, aml_sleep(200));
     aml_append(sb_scope, method);
 
+    method = aml_method(stringify(CPU_SCAN_METHOD), 0, AML_NOTSERIALIZED);
+    {
+        Aml *while_ctx, *if_ctx2;
+        Aml *a_bus_check_evt = aml_int(1);
+        Aml *a_remove_evt = aml_int(3);
+        Aml *a_status_map = aml_local(5); /* Local5 = active cpu bitmap */
+        Aml *a_byte = aml_local(2); /* Local2 = last read byte from bitmap */
+        Aml *a_idx = aml_local(0); /* Processor ID / APIC ID iterator */
+        Aml *a_is_cpu_on = aml_local(1); /* Local1 = CPON flag for cpu */
+        Aml *a_status = aml_local(3); /* Local3 = active state for cpu */
+
+        aml_append(method, aml_store(aml_name(CPU_STATUS_MAP), a_status_map));
+        aml_append(method, aml_store(a_zero, a_byte));
+        aml_append(method, aml_store(a_zero, a_idx));
+
+        /* While (a_idx < SizeOf(CPON)) */
+        while_ctx = aml_while(aml_lless(a_idx, aml_sizeof(a_cpus_map)));
+        aml_append(while_ctx, aml_store(
+            aml_derefof(aml_index(a_cpus_map, a_idx)), a_is_cpu_on));
+
+        if_ctx = aml_if(aml_and(a_idx, aml_int(0x07), NULL));
+        /* Shift down previously read bitmap byte */
+        aml_append(if_ctx, aml_shiftright(a_byte, a_one, a_byte));
+        aml_append(while_ctx, if_ctx);
+
+        else_ctx = aml_else();
+        /* Read next byte from cpu bitmap */
+        aml_append(else_ctx, aml_store(aml_derefof(
+            aml_index(a_status_map, aml_shiftright(a_idx, aml_int(3), NULL))),
+            a_byte));
+        aml_append(while_ctx, else_ctx);
+
+        aml_append(while_ctx,
+            aml_store(aml_and(a_byte, a_one, NULL), a_status));
+        if_ctx = aml_if(aml_lnot(aml_equal(a_is_cpu_on, a_status)));
+
+        /* State change - update CPON with new state */
+        aml_append(if_ctx, aml_store(a_status, aml_index(a_cpus_map, a_idx)));
+        if_ctx2 = aml_if(aml_equal(a_status, a_one));
+        aml_append(if_ctx2,
+            aml_call2(AML_NOTIFY_METHOD, a_idx, a_bus_check_evt));
+        aml_append(if_ctx, if_ctx2);
+        else_ctx = aml_else();
+        aml_append(else_ctx,
+            aml_call2(AML_NOTIFY_METHOD, a_idx, a_remove_evt));
+        aml_append(if_ctx, else_ctx);
+        aml_append(while_ctx, if_ctx);
+
+        aml_append(while_ctx, aml_increment(a_idx)); /* go to next cpu */
+        aml_append(method, while_ctx);
+    }
+    aml_append(sb_scope, method);
+
     aml_append(ctx, sb_scope);
 }
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 3675928..39e7434 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1313,7 +1313,7 @@ build_ssdt(GArray *table_data, GArray *linker,
          *   Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...}
          */
         /* Arg0 = Processor ID = APIC ID */
-        method = aml_method("NTFY", 2, AML_NOTSERIALIZED);
+        method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
         for (i = 0; i < acpi_cpus; i++) {
             ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
             aml_append(ifctx,
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index fb75eda..88c472b 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -19,42 +19,5 @@
 
 Scope(\_SB) {
     /* Objects filled in by run-time generated SSDT */
-    External(NTFY, MethodObj)
-    External(CPON, PkgObj)
-    External(PRS, FieldUnitObj)
-
-    /* Methods called by run-time generated SSDT Processor objects */
-    Method(PRSC, 0) {
-        // Local5 = active cpu bitmap
-        Store(PRS, Local5)
-        // Local2 = last read byte from bitmap
-        Store(Zero, Local2)
-        // Local0 = Processor ID / APIC ID iterator
-        Store(Zero, Local0)
-        While (LLess(Local0, SizeOf(CPON))) {
-            // Local1 = CPON flag for this cpu
-            Store(DerefOf(Index(CPON, Local0)), Local1)
-            If (And(Local0, 0x07)) {
-                // Shift down previously read bitmap byte
-                ShiftRight(Local2, 1, Local2)
-            } Else {
-                // Read next byte from cpu bitmap
-                Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
-            }
-            // Local3 = active state for this cpu
-            Store(And(Local2, 1), Local3)
-
-            If (LNotEqual(Local1, Local3)) {
-                // State change - update CPON with new state
-                Store(Local3, Index(CPON, Local0))
-                // Do CPU notify
-                If (LEqual(Local3, 1)) {
-                    NTFY(Local0, 1)
-                } Else {
-                    NTFY(Local0, 3)
-                }
-            }
-            Increment(Local0)
-        }
-    }
+    External(CPU_SCAN_METHOD, MethodObj)
 }
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 9cf1b88..6a0c656 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -268,7 +268,7 @@ DefinitionBlock (
         }
         Method(_E02) {
             // CPU hotplug event
-            \_SB.PRSC()
+            \_SB.CPU_SCAN_METHOD()
         }
         Method(_L04) {
         }
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index f950f39..7211665 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -401,7 +401,7 @@ DefinitionBlock (
         }
         Method(_E02) {
             // CPU hotplug event
-            \_SB.PRSC()
+            \_SB.CPU_SCAN_METHOD()
         }
         Method(_L04) {
         }
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index a3a058f..a23b8da 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -16,6 +16,8 @@
 #define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
 #define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
 
+#define AML_NOTIFY_METHOD "NTFY"
+
 typedef enum {
     AML_NO_OPCODE = 0,/* has only data */
     AML_OPCODE,       /* has opcode optionally followed by data */
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 1ae3b29..1c5f630 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -31,6 +31,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
 #define CPU_MAT_METHOD "CPMA"
 #define CPU_CPU_ON_BITMAP "CPON"
 #define CPU_STATUS_METHOD "CPST"
+#define CPU_STATUS_MAP "PRS"
 
 void build_cpu_hotplug_aml(Aml *ctx);
 #endif
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index 6a8d268..6522745 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -28,6 +28,7 @@
 #define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8
 #define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00
 #define CPU_HOTPLUG_RESOURCE_DEVICE PRES
+#define CPU_SCAN_METHOD PRSC
 
 #define ACPI_MEMORY_HOTPLUG_IO_LEN 24
 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 43/74] pc: acpi: cpuhp: move \_GPE._E02() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (41 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 42/74] pc: acpi: cpuhp: move PRSC() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 44/74] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Igor Mammedov
                   ` (33 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu_hotplug_acpi_table.c  |  2 +-
 hw/i386/acpi-build.c              | 12 +++++++++---
 hw/i386/acpi-dsdt-cpu-hotplug.dsl | 23 -----------------------
 hw/i386/acpi-dsdt.dsl             |  9 ---------
 hw/i386/q35-acpi-dsdt.dsl         |  9 ---------
 include/hw/acpi/cpu_hotplug.h     |  1 +
 include/hw/acpi/pc-hotplug.h      |  1 -
 7 files changed, 11 insertions(+), 46 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl

diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
index 4ff444d..b56f3d3 100644
--- a/hw/acpi/cpu_hotplug_acpi_table.c
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -67,7 +67,7 @@ void build_cpu_hotplug_aml(Aml *ctx)
     aml_append(method, aml_sleep(200));
     aml_append(sb_scope, method);
 
-    method = aml_method(stringify(CPU_SCAN_METHOD), 0, AML_NOTSERIALIZED);
+    method = aml_method(CPU_SCAN_METHOD, 0, AML_NOTSERIALIZED);
     {
         Aml *while_ctx, *if_ctx2;
         Aml *a_bus_check_evt = aml_int(1);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 39e7434..7ca38f0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1057,9 +1057,15 @@ build_ssdt(GArray *table_data, GArray *linker,
                              pm->mem_hp_io_len);
 
     scope =  aml_scope("\\_GPE");
-    method = aml_method("_E03", 0, AML_NOTSERIALIZED);
-    aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
-    aml_append(scope, method);
+    {
+        method = aml_method("_E02", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
+        aml_append(scope, method);
+
+        method = aml_method("_E03", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
+        aml_append(scope, method);
+    }
     aml_append(ssdt, scope);
 
     /* Extra PCI root buses are implemented  only for i440fx */
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
deleted file mode 100644
index 88c472b..0000000
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/****************************************************************
- * CPU hotplug
- ****************************************************************/
-
-Scope(\_SB) {
-    /* Objects filled in by run-time generated SSDT */
-    External(CPU_SCAN_METHOD, MethodObj)
-}
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 6a0c656..007d3c9 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -247,11 +247,6 @@ DefinitionBlock (
         }
     }
 
-#include "hw/acpi/pc-hotplug.h"
-#define CPU_STATUS_BASE PIIX4_CPU_HOTPLUG_IO_BASE
-#include "acpi-dsdt-cpu-hotplug.dsl"
-
-
 /****************************************************************
  * General purpose events
  ****************************************************************/
@@ -266,10 +261,6 @@ DefinitionBlock (
             \_SB.PCI0.PCNT()
             Release(\_SB.PCI0.BLCK)
         }
-        Method(_E02) {
-            // CPU hotplug event
-            \_SB.CPU_SCAN_METHOD()
-        }
         Method(_L04) {
         }
         Method(_L05) {
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 7211665..0511e26 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -384,11 +384,6 @@ DefinitionBlock (
         define_gsi_link(GSIH, 0, 0x17)
     }
 
-#include "hw/acpi/pc-hotplug.h"
-#define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE
-#include "acpi-dsdt-cpu-hotplug.dsl"
-
-
 /****************************************************************
  * General purpose events
  ****************************************************************/
@@ -399,10 +394,6 @@ DefinitionBlock (
         }
         Method(_L01) {
         }
-        Method(_E02) {
-            // CPU hotplug event
-            \_SB.CPU_SCAN_METHOD()
-        }
         Method(_L04) {
         }
         Method(_L05) {
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 1c5f630..bfa7e89 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -32,6 +32,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
 #define CPU_CPU_ON_BITMAP "CPON"
 #define CPU_STATUS_METHOD "CPST"
 #define CPU_STATUS_MAP "PRS"
+#define CPU_SCAN_METHOD "PRSC"
 
 void build_cpu_hotplug_aml(Aml *ctx);
 #endif
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index 6522745..6a8d268 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -28,7 +28,6 @@
 #define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8
 #define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00
 #define CPU_HOTPLUG_RESOURCE_DEVICE PRES
-#define CPU_SCAN_METHOD PRSC
 
 #define ACPI_MEMORY_HOTPLUG_IO_LEN 24
 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 44/74] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (42 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 43/74] pc: acpi: cpuhp: move \_GPE._E02() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT Igor Mammedov
                   ` (32 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c | 174 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 94 insertions(+), 80 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 7ca38f0..72883ad 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -765,6 +765,98 @@ static void crs_replace_with_free_ranges(GPtrArray *ranges,
     g_ptr_array_free(free_ranges, false);
 }
 
+static void build_processor_devices(Aml *sb_scope, unsigned acpi_cpus,
+                                    AcpiCpuInfo *cpu, AcpiPmInfo *pm)
+{
+    int i;
+    Aml *dev;
+    Aml *crs;
+    Aml *pkg;
+    Aml *field;
+    Aml *ifctx;
+    Aml *method;
+
+    /* The current AML generator can cover the APIC ID range [0..255],
+     * inclusive, for VCPU hotplug. */
+    QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
+    g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
+
+    /* create PCI0.PRES device and its _CRS to reserve CPU hotplug MMIO */
+    dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE));
+    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A06")));
+    aml_append(dev,
+        aml_name_decl("_UID", aml_string("CPU Hotplug resources"))
+    );
+    /* device present, functioning, decoding, not shown in UI */
+    aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
+    crs = aml_resource_template();
+    aml_append(crs,
+        aml_io(AML_DECODE16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1,
+               pm->cpu_hp_io_len)
+    );
+    aml_append(dev, aml_name_decl("_CRS", crs));
+    aml_append(sb_scope, dev);
+    /* declare CPU hotplug MMIO region and PRS field to access it */
+    aml_append(sb_scope, aml_operation_region(
+        "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len));
+    field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("PRS", 256));
+    aml_append(sb_scope, field);
+
+    /* build Processor object for each processor */
+    for (i = 0; i < acpi_cpus; i++) {
+        dev = aml_processor(i, 0, 0, "CP%.02X", i);
+
+        method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
+        aml_append(method,
+            aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i))));
+        aml_append(dev, method);
+
+        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+        aml_append(method,
+            aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i))));
+        aml_append(dev, method);
+
+        method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
+        aml_append(method,
+            aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0)))
+        );
+        aml_append(dev, method);
+
+        aml_append(sb_scope, dev);
+    }
+
+    /* build this code:
+     *   Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...}
+     */
+    /* Arg0 = Processor ID = APIC ID */
+    method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
+    for (i = 0; i < acpi_cpus; i++) {
+        ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
+        aml_append(ifctx,
+            aml_notify(aml_name("CP%.02X", i), aml_arg(1))
+        );
+        aml_append(method, ifctx);
+    }
+    aml_append(sb_scope, method);
+
+    /* build "Name(CPON, Package() { One, One, ..., Zero, Zero, ... })"
+     *
+     * Note: The ability to create variable-sized packages was first
+     * introduced in ACPI 2.0. ACPI 1.0 only allowed fixed-size packages
+     * ith up to 255 elements. Windows guests up to win2k8 fail when
+     * VarPackageOp is used.
+     */
+    pkg = acpi_cpus <= 255 ? aml_package(acpi_cpus) :
+                             aml_varpackage(acpi_cpus);
+
+    for (i = 0; i < acpi_cpus; i++) {
+        uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
+        aml_append(pkg, aml_int(b));
+    }
+    aml_append(sb_scope, aml_name_decl(CPU_CPU_ON_BITMAP, pkg));
+}
+
 static Aml *build_crs(PCIHostState *host,
                       GPtrArray *io_ranges, GPtrArray *mem_ranges)
 {
@@ -1034,8 +1126,7 @@ build_ssdt(GArray *table_data, GArray *linker,
 {
     MachineState *machine = MACHINE(qdev_get_machine());
     uint32_t nr_mem = machine->ram_slots;
-    unsigned acpi_cpus = guest_info->apic_id_limit;
-    Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx;
+    Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field;
     PCIBus *bus = NULL;
     GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free);
     GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free);
@@ -1044,10 +1135,6 @@ build_ssdt(GArray *table_data, GArray *linker,
     int i;
 
     ssdt = init_aml_allocator();
-    /* The current AML generator can cover the APIC ID range [0..255],
-     * inclusive, for VCPU hotplug. */
-    QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
-    g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
 
     /* Reserve space for header */
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
@@ -1270,80 +1357,7 @@ build_ssdt(GArray *table_data, GArray *linker,
 
     sb_scope = aml_scope("\\_SB");
     {
-        /* create PCI0.PRES device and its _CRS to reserve CPU hotplug MMIO */
-        dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE));
-        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A06")));
-        aml_append(dev,
-            aml_name_decl("_UID", aml_string("CPU Hotplug resources"))
-        );
-        /* device present, functioning, decoding, not shown in UI */
-        aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
-        crs = aml_resource_template();
-        aml_append(crs,
-            aml_io(AML_DECODE16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1,
-                   pm->cpu_hp_io_len)
-        );
-        aml_append(dev, aml_name_decl("_CRS", crs));
-        aml_append(sb_scope, dev);
-        /* declare CPU hotplug MMIO region and PRS field to access it */
-        aml_append(sb_scope, aml_operation_region(
-            "PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len));
-        field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
-        aml_append(field, aml_named_field("PRS", 256));
-        aml_append(sb_scope, field);
-
-        /* build Processor object for each processor */
-        for (i = 0; i < acpi_cpus; i++) {
-            dev = aml_processor(i, 0, 0, "CP%.02X", i);
-
-            method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
-            aml_append(method,
-                aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i))));
-            aml_append(dev, method);
-
-            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
-            aml_append(method,
-                aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(i))));
-            aml_append(dev, method);
-
-            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
-            aml_append(method,
-                aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0)))
-            );
-            aml_append(dev, method);
-
-            aml_append(sb_scope, dev);
-        }
-
-        /* build this code:
-         *   Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...}
-         */
-        /* Arg0 = Processor ID = APIC ID */
-        method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
-        for (i = 0; i < acpi_cpus; i++) {
-            ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
-            aml_append(ifctx,
-                aml_notify(aml_name("CP%.02X", i), aml_arg(1))
-            );
-            aml_append(method, ifctx);
-        }
-        aml_append(sb_scope, method);
-
-        /* build "Name(CPON, Package() { One, One, ..., Zero, Zero, ... })"
-         *
-         * Note: The ability to create variable-sized packages was first
-         * introduced in ACPI 2.0. ACPI 1.0 only allowed fixed-size packages
-         * ith up to 255 elements. Windows guests up to win2k8 fail when
-         * VarPackageOp is used.
-         */
-        pkg = acpi_cpus <= 255 ? aml_package(acpi_cpus) :
-                                 aml_varpackage(acpi_cpus);
-
-        for (i = 0; i < acpi_cpus; i++) {
-            uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
-            aml_append(pkg, aml_int(b));
-        }
-        aml_append(sb_scope, aml_name_decl(CPU_CPU_ON_BITMAP, pkg));
+        build_processor_devices(sb_scope, guest_info->apic_id_limit, cpu, pm);
 
         build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (43 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 44/74] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-19 19:50   ` Michael S. Tsirkin
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 46/74] pc: acpi: move DBUG() " Igor Mammedov
                   ` (31 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c       | 53 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt-hpet.dsl | 48 -----------------------------------------
 hw/i386/acpi-dsdt.dsl      |  2 --
 hw/i386/q35-acpi-dsdt.dsl  |  3 ---
 hw/timer/hpet.c            |  2 +-
 include/hw/timer/hpet.h    |  1 +
 6 files changed, 55 insertions(+), 54 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 72883ad..62f932e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -50,6 +50,7 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/pci-host/q35.h"
 #include "hw/i386/intel_iommu.h"
+#include "hw/timer/hpet.h"
 
 #include "hw/i386/q35-acpi-dsdt.hex"
 #include "hw/i386/acpi-dsdt.hex"
@@ -1119,6 +1120,57 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
     aml_append(sb_scope, method);
 }
 
+static void build_hpet_aml(Aml *table)
+{
+    Aml *crs;
+    Aml *field;
+    Aml *method;
+    Aml *if_ctx;
+    Aml *scope = aml_scope("_SB");
+    Aml *dev = aml_device("HPET");
+    Aml *a_zero = aml_int(0);
+    Aml *a_id = aml_local(0);
+    Aml *a_period = aml_local(1);
+
+    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0103")));
+    aml_append(dev, aml_name_decl("_UID", a_zero));
+
+    aml_append(dev, aml_operation_region("HPTM", AML_SYSTEM_MEMORY,
+                                         HPET_BASE, HPET_LEN));
+    field = aml_field("HPTM", AML_DWORD_ACC, AML_LOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("VEND", 32));
+    aml_append(field, aml_named_field("PRD", 32));
+    aml_append(dev, field);
+
+    method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_store(aml_name("VEND"), a_id));
+    aml_append(method, aml_store(aml_name("PRD"), a_period));
+    aml_append(method, aml_shiftright(a_id, aml_int(16), a_id));
+    if_ctx = aml_if(aml_lor(
+                            aml_equal(a_id, a_zero),
+                            aml_equal(a_id, aml_int(0xffff))));
+    aml_append(if_ctx, aml_return(a_zero));
+    aml_append(method, if_ctx);
+
+    if_ctx = aml_if(aml_lor(
+                            aml_equal(a_period, a_zero),
+                            aml_lgreater(a_period, aml_int(100000000))));
+    aml_append(if_ctx, aml_return(a_zero));
+    aml_append(method, if_ctx);
+
+    aml_append(method, aml_return(aml_int(0x0F)));
+    aml_append(dev, method);
+
+    crs = aml_resource_template();
+    aml_append(crs,
+        aml_memory32_fixed(HPET_BASE, HPET_LEN, AML_READ_ONLY)
+    );
+    aml_append(dev, aml_name_decl("_CRS", crs));
+
+    aml_append(scope, dev);
+    aml_append(table, scope);
+}
+
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1139,6 +1191,7 @@ build_ssdt(GArray *table_data, GArray *linker,
     /* Reserve space for header */
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
+    build_hpet_aml(ssdt);
     build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
diff --git a/hw/i386/acpi-dsdt-hpet.dsl b/hw/i386/acpi-dsdt-hpet.dsl
deleted file mode 100644
index 44961b8..0000000
--- a/hw/i386/acpi-dsdt-hpet.dsl
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/****************************************************************
- * HPET
- ****************************************************************/
-
-Scope(\_SB) {
-    Device(HPET) {
-        Name(_HID, EISAID("PNP0103"))
-        Name(_UID, 0)
-        OperationRegion(HPTM, SystemMemory, 0xFED00000, 0x400)
-        Field(HPTM, DWordAcc, Lock, Preserve) {
-            VEND, 32,
-            PRD, 32,
-        }
-        Method(_STA, 0, NotSerialized) {
-            Store(VEND, Local0)
-            Store(PRD, Local1)
-            ShiftRight(Local0, 16, Local0)
-            If (LOr(LEqual(Local0, 0), LEqual(Local0, 0xffff))) {
-                Return (0x0)
-            }
-            If (LOr(LEqual(Local1, 0), LGreater(Local1, 100000000))) {
-                Return (0x0)
-            }
-            Return (0x0F)
-        }
-        Name(_CRS, ResourceTemplate() {
-            Memory32Fixed(ReadOnly,
-                0xFED00000,         // Address Base
-                0x00000400,         // Address Length
-                )
-        })
-    }
-}
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 007d3c9..aa7f549 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -41,8 +41,6 @@ DefinitionBlock (
         }
     }
 
-#include "acpi-dsdt-hpet.dsl"
-
 /****************************************************************
  * PIIX4 PM
  ****************************************************************/
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 0511e26..e57adb8 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -115,9 +115,6 @@ DefinitionBlock (
         }
     }
 
-#include "acpi-dsdt-hpet.dsl"
-
-
 /****************************************************************
  * LPC ISA bridge
  ****************************************************************/
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index 7f0391c..d9d039b 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -713,7 +713,7 @@ static void hpet_init(Object *obj)
     HPETState *s = HPET(obj);
 
     /* HPET Area */
-    memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", 0x400);
+    memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", HPET_LEN);
     sysbus_init_mmio(sbd, &s->iomem);
 }
 
diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h
index d872909..f38bcfe 100644
--- a/include/hw/timer/hpet.h
+++ b/include/hw/timer/hpet.h
@@ -16,6 +16,7 @@
 #include "qom/object.h"
 
 #define HPET_BASE               0xfed00000
+#define HPET_LEN                0x400
 #define HPET_CLK_PERIOD         10 /* 10 ns*/
 
 #define FS_PER_NS 1000000       /* 1000000 femtoseconds == 1 ns */
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 46/74] pc: acpi: move DBUG() from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (44 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 47/74] pc: acpi: move RTC device " Igor Mammedov
                   ` (30 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c       | 36 ++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt-dbug.dsl | 41 -----------------------------------------
 hw/i386/acpi-dsdt.dsl      |  2 --
 hw/i386/q35-acpi-dsdt.dsl  |  2 --
 4 files changed, 36 insertions(+), 45 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt-dbug.dsl

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 62f932e..4b7229d 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1171,6 +1171,41 @@ static void build_hpet_aml(Aml *table)
     aml_append(table, scope);
 }
 
+static void build_dbg_aml(Aml *table)
+{
+    Aml *field;
+    Aml *method;
+    Aml *while_ctx;
+    Aml *scope = aml_scope("\\");
+    Aml *a_buf = aml_local(0);
+    Aml *a_len = aml_local(1);
+    Aml *a_idx = aml_local(2);
+
+    aml_append(scope, aml_operation_region("DBG", AML_SYSTEM_IO,
+                                         0x0402, 0x01));
+    field = aml_field("DBG", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("DBGB", 8));
+    aml_append(scope, field);
+
+    method = aml_method("DBUG", 1, AML_NOTSERIALIZED);
+
+    aml_append(method, aml_to_hexstring(aml_arg(0), a_buf));
+    aml_append(method, aml_to_buffer(a_buf, a_buf));
+    aml_append(method, aml_subtract(aml_sizeof(a_buf), aml_int(1), a_len));
+    aml_append(method, aml_store(aml_int(0), a_idx));
+
+    while_ctx = aml_while(aml_lless(a_idx, a_len));
+    aml_append(while_ctx,
+        aml_store(aml_derefof(aml_index(a_buf, a_idx)), aml_name("DBGB")));
+    aml_append(while_ctx, aml_increment(a_idx));
+    aml_append(method, while_ctx);
+
+    aml_append(method, aml_store(aml_int(0x0A), aml_name("DBGB")));
+    aml_append(scope, method);
+
+    aml_append(table, scope);
+}
+
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1191,6 +1226,7 @@ build_ssdt(GArray *table_data, GArray *linker,
     /* Reserve space for header */
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
+    build_dbg_aml(ssdt);
     build_hpet_aml(ssdt);
     build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
diff --git a/hw/i386/acpi-dsdt-dbug.dsl b/hw/i386/acpi-dsdt-dbug.dsl
deleted file mode 100644
index 86230f7..0000000
--- a/hw/i386/acpi-dsdt-dbug.dsl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/****************************************************************
- * Debugging
- ****************************************************************/
-
-Scope(\) {
-    /* Debug Output */
-    OperationRegion(DBG, SystemIO, 0x0402, 0x01)
-    Field(DBG, ByteAcc, NoLock, Preserve) {
-        DBGB,   8,
-    }
-
-    /* Debug method - use this method to send output to the QEMU
-     * BIOS debug port.  This method handles strings, integers,
-     * and buffers.  For example: DBUG("abc") DBUG(0x123) */
-    Method(DBUG, 1) {
-        ToHexString(Arg0, Local0)
-        ToBuffer(Local0, Local0)
-        Subtract(SizeOf(Local0), 1, Local1)
-        Store(Zero, Local2)
-        While (LLess(Local2, Local1)) {
-            Store(DerefOf(Index(Local0, Local2)), DBGB)
-            Increment(Local2)
-        }
-        Store(0x0A, DBGB)
-    }
-}
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index aa7f549..55c2220 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -29,8 +29,6 @@ DefinitionBlock (
     )
 {
 
-#include "acpi-dsdt-dbug.dsl"
-
     Scope(\_SB) {
         Device(PCI0) {
             Name(_HID, EisaId("PNP0A03"))
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index e57adb8..bf3f974 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -35,8 +35,6 @@ DefinitionBlock (
     )
 {
 
-#include "acpi-dsdt-dbug.dsl"
-
     Scope(\_SB) {
         OperationRegion(PCST, SystemIO, 0xae00, 0x0c)
         OperationRegion(PCSB, SystemIO, 0xae0c, 0x01)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 47/74] pc: acpi: move RTC device from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (45 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 46/74] pc: acpi: move DBUG() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 48/74] pc: acpi: move KBD " Igor Mammedov
                   ` (29 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 27 +++++++++++++++++++++++++++
 hw/i386/acpi-dsdt-isa.dsl |  9 ---------
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4b7229d..55bb466 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1171,6 +1171,32 @@ static void build_hpet_aml(Aml *table)
     aml_append(table, scope);
 }
 
+static Aml *build_eisa_device_aml(const char *name, const char *hid, Aml *crs)
+{
+    Aml *dev;
+
+    dev = aml_device("%s", name);
+    aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
+    aml_append(dev, aml_name_decl("_CRS", crs));
+
+    return dev;
+}
+
+static void build_isa_devices_aml(Aml *table)
+{
+    Aml *crs;
+    Aml *scope = aml_scope("_SB.PCI0.ISA");
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02));
+    aml_append(crs, aml_irq_no_flags(8));
+    aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
+    aml_append(scope, build_eisa_device_aml(
+        "RTC", "PNP0B00", crs));
+
+    aml_append(table, scope);
+}
+
 static void build_dbg_aml(Aml *table)
 {
     Aml *field;
@@ -1228,6 +1254,7 @@ build_ssdt(GArray *table_data, GArray *linker,
 
     build_dbg_aml(ssdt);
     build_hpet_aml(ssdt);
+    build_isa_devices_aml(ssdt);
     build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
index 89caa16..f2cbbea 100644
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ b/hw/i386/acpi-dsdt-isa.dsl
@@ -16,15 +16,6 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
-    Device(RTC) {
-        Name(_HID, EisaId("PNP0B00"))
-        Name(_CRS, ResourceTemplate() {
-            IO(Decode16, 0x0070, 0x0070, 0x10, 0x02)
-            IRQNoFlags() { 8 }
-            IO(Decode16, 0x0072, 0x0072, 0x02, 0x06)
-        })
-    }
-
     Device(KBD) {
         Name(_HID, EisaId("PNP0303"))
         Method(_STA, 0, NotSerialized) {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 48/74] pc: acpi: move KBD device from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (46 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 47/74] pc: acpi: move RTC device " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 49/74] pc: acpi: move MOU " Igor Mammedov
                   ` (28 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 20 ++++++++++++++++++--
 hw/i386/acpi-dsdt-isa.dsl | 12 ------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 55bb466..c485530 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1171,12 +1171,21 @@ static void build_hpet_aml(Aml *table)
     aml_append(table, scope);
 }
 
-static Aml *build_eisa_device_aml(const char *name, const char *hid, Aml *crs)
+static Aml *
+build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
+                      bool have_sta)
 {
     Aml *dev;
+    Aml *method;
+    Aml *a_device_present = aml_int(0x0f);
 
     dev = aml_device("%s", name);
     aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
+    if (have_sta) {
+        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_return(a_device_present));
+        aml_append(dev, method);
+    }
     aml_append(dev, aml_name_decl("_CRS", crs));
 
     return dev;
@@ -1192,7 +1201,14 @@ static void build_isa_devices_aml(Aml *table)
     aml_append(crs, aml_irq_no_flags(8));
     aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
     aml_append(scope, build_eisa_device_aml(
-        "RTC", "PNP0B00", crs));
+        "RTC", "PNP0B00", crs, false));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
+    aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
+    aml_append(crs, aml_irq_no_flags(1));
+    aml_append(scope, build_eisa_device_aml(
+        "KBD", "PNP0303", crs, true));
 
     aml_append(table, scope);
 }
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
index f2cbbea..f7a3c0a 100644
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ b/hw/i386/acpi-dsdt-isa.dsl
@@ -16,18 +16,6 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
-    Device(KBD) {
-        Name(_HID, EisaId("PNP0303"))
-        Method(_STA, 0, NotSerialized) {
-            Return (0x0f)
-        }
-        Name(_CRS, ResourceTemplate() {
-            IO(Decode16, 0x0060, 0x0060, 0x01, 0x01)
-            IO(Decode16, 0x0064, 0x0064, 0x01, 0x01)
-            IRQNoFlags() { 1 }
-        })
-    }
-
     Device(MOU) {
         Name(_HID, EisaId("PNP0F13"))
         Method(_STA, 0, NotSerialized) {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 49/74] pc: acpi: move MOU device from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (47 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 48/74] pc: acpi: move KBD " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 " Igor Mammedov
                   ` (27 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      |  5 +++++
 hw/i386/acpi-dsdt-isa.dsl | 10 ----------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c485530..e5ec6af 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1210,6 +1210,11 @@ static void build_isa_devices_aml(Aml *table)
     aml_append(scope, build_eisa_device_aml(
         "KBD", "PNP0303", crs, true));
 
+    crs = aml_resource_template();
+    aml_append(crs, aml_irq_no_flags(12));
+    aml_append(scope, build_eisa_device_aml(
+        "MOU", "PNP0F13", crs, true));
+
     aml_append(table, scope);
 }
 
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
index f7a3c0a..8936271 100644
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ b/hw/i386/acpi-dsdt-isa.dsl
@@ -16,16 +16,6 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
-    Device(MOU) {
-        Name(_HID, EisaId("PNP0F13"))
-        Method(_STA, 0, NotSerialized) {
-            Return (0x0f)
-        }
-        Name(_CRS, ResourceTemplate() {
-            IRQNoFlags() { 12 }
-        })
-    }
-
     Device(FDC0) {
         Name(_HID, EisaId("PNP0700"))
         Method(_STA, 0, NotSerialized) {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 device from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (48 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 49/74] pc: acpi: move MOU " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-19 19:44   ` Michael S. Tsirkin
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 51/74] pc: acpi: move LPT " Igor Mammedov
                   ` (26 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 38 ++++++++++++++++++++++++++++++++------
 hw/i386/acpi-dsdt-isa.dsl | 18 ------------------
 2 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index e5ec6af..2f0f2e1 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1173,17 +1173,34 @@ static void build_hpet_aml(Aml *table)
 
 static Aml *
 build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
-                      bool have_sta)
+                      bool have_sta, const char *present_field)
 {
     Aml *dev;
     Aml *method;
-    Aml *a_device_present = aml_int(0x0f);
 
     dev = aml_device("%s", name);
     aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
     if (have_sta) {
+        Aml *if_ctx;
+        Aml *else_ctx;
+        Aml *a_zero = aml_int(0);
+        Aml *a_is_present = aml_local(0);
+        Aml *a_device_present = aml_int(0x0f);
+        Aml *a_device_not_present = aml_int(0x00);
+
         method = aml_method("_STA", 0, AML_NOTSERIALIZED);
-        aml_append(method, aml_return(a_device_present));
+        if (!present_field) {
+            aml_append(method, aml_return(a_device_present));
+        } else {
+            aml_append(method,
+                aml_store(aml_name("%s", present_field), a_is_present));
+            if_ctx = aml_if(aml_equal(a_is_present, a_zero));
+            aml_append(if_ctx, aml_return(a_device_not_present));
+            aml_append(method, if_ctx);
+            else_ctx = aml_else();
+            aml_append(else_ctx, aml_return(a_device_present));
+            aml_append(method, else_ctx);
+        }
         aml_append(dev, method);
     }
     aml_append(dev, aml_name_decl("_CRS", crs));
@@ -1201,19 +1218,28 @@ static void build_isa_devices_aml(Aml *table)
     aml_append(crs, aml_irq_no_flags(8));
     aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
     aml_append(scope, build_eisa_device_aml(
-        "RTC", "PNP0B00", crs, false));
+        "RTC", "PNP0B00", crs, false, NULL));
 
     crs = aml_resource_template();
     aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
     aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
     aml_append(crs, aml_irq_no_flags(1));
     aml_append(scope, build_eisa_device_aml(
-        "KBD", "PNP0303", crs, true));
+        "KBD", "PNP0303", crs, true, NULL));
 
     crs = aml_resource_template();
     aml_append(crs, aml_irq_no_flags(12));
     aml_append(scope, build_eisa_device_aml(
-        "MOU", "PNP0F13", crs, true));
+        "MOU", "PNP0F13", crs, true, NULL));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
+    aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01));
+    aml_append(crs, aml_irq_no_flags(6));
+    aml_append(crs,
+        aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2));
+    aml_append(scope, build_eisa_device_aml(
+        "FDC0", "PNP0700", crs, true, "FDEN"));
 
     aml_append(table, scope);
 }
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
index 8936271..64dd4ac 100644
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ b/hw/i386/acpi-dsdt-isa.dsl
@@ -16,24 +16,6 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
-    Device(FDC0) {
-        Name(_HID, EisaId("PNP0700"))
-        Method(_STA, 0, NotSerialized) {
-            Store(FDEN, Local0)
-            If (LEqual(Local0, 0)) {
-                Return (0x00)
-            } Else {
-                Return (0x0F)
-            }
-        }
-        Name(_CRS, ResourceTemplate() {
-            IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
-            IO(Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
-            IRQNoFlags() { 6 }
-            DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
-        })
-    }
-
     Device(LPT) {
         Name(_HID, EisaId("PNP0400"))
         Method(_STA, 0, NotSerialized) {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 51/74] pc: acpi: move LPT device from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (49 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 52/74] pc: acpi: move COM devices " Igor Mammedov
                   ` (25 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      |  6 ++++++
 hw/i386/acpi-dsdt-isa.dsl | 16 ----------------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2f0f2e1..bd03491 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1241,6 +1241,12 @@ static void build_isa_devices_aml(Aml *table)
     aml_append(scope, build_eisa_device_aml(
         "FDC0", "PNP0700", crs, true, "FDEN"));
 
+    crs = aml_resource_template();
+    aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08));
+    aml_append(crs, aml_irq_no_flags(7));
+    aml_append(scope, build_eisa_device_aml(
+        "LPT", "PNP0400", crs, true, "LPEN"));
+
     aml_append(table, scope);
 }
 
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
index 64dd4ac..cc5e8f9 100644
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ b/hw/i386/acpi-dsdt-isa.dsl
@@ -16,22 +16,6 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
-    Device(LPT) {
-        Name(_HID, EisaId("PNP0400"))
-        Method(_STA, 0, NotSerialized) {
-            Store(LPEN, Local0)
-            If (LEqual(Local0, 0)) {
-                Return (0x00)
-            } Else {
-                Return (0x0F)
-            }
-        }
-        Name(_CRS, ResourceTemplate() {
-            IO(Decode16, 0x0378, 0x0378, 0x08, 0x08)
-            IRQNoFlags() { 7 }
-        })
-    }
-
     Device(COM1) {
         Name(_HID, EisaId("PNP0501"))
         Name(_UID, 0x01)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 52/74] pc: acpi: move COM devices from DSDT to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (50 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 51/74] pc: acpi: move LPT " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 53/74] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT Igor Mammedov
                   ` (24 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 27 ++++++++++++++++++------
 hw/i386/acpi-dsdt-isa.dsl | 52 -----------------------------------------------
 hw/i386/acpi-dsdt.dsl     |  3 ---
 hw/i386/q35-acpi-dsdt.dsl |  3 ---
 4 files changed, 21 insertions(+), 64 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt-isa.dsl

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index bd03491..9bb10d6 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1172,7 +1172,7 @@ static void build_hpet_aml(Aml *table)
 }
 
 static Aml *
-build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
+build_eisa_device_aml(const char *name, const char *hid, Aml *uid, Aml *crs,
                       bool have_sta, const char *present_field)
 {
     Aml *dev;
@@ -1180,6 +1180,9 @@ build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
 
     dev = aml_device("%s", name);
     aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
+    if (uid) {
+        aml_append(dev, aml_name_decl("_UID", uid));
+    }
     if (have_sta) {
         Aml *if_ctx;
         Aml *else_ctx;
@@ -1218,19 +1221,19 @@ static void build_isa_devices_aml(Aml *table)
     aml_append(crs, aml_irq_no_flags(8));
     aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
     aml_append(scope, build_eisa_device_aml(
-        "RTC", "PNP0B00", crs, false, NULL));
+        "RTC", "PNP0B00", NULL, crs, false, NULL));
 
     crs = aml_resource_template();
     aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
     aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
     aml_append(crs, aml_irq_no_flags(1));
     aml_append(scope, build_eisa_device_aml(
-        "KBD", "PNP0303", crs, true, NULL));
+        "KBD", "PNP0303", NULL, crs, true, NULL));
 
     crs = aml_resource_template();
     aml_append(crs, aml_irq_no_flags(12));
     aml_append(scope, build_eisa_device_aml(
-        "MOU", "PNP0F13", crs, true, NULL));
+        "MOU", "PNP0F13", NULL, crs, true, NULL));
 
     crs = aml_resource_template();
     aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
@@ -1239,13 +1242,25 @@ static void build_isa_devices_aml(Aml *table)
     aml_append(crs,
         aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2));
     aml_append(scope, build_eisa_device_aml(
-        "FDC0", "PNP0700", crs, true, "FDEN"));
+        "FDC0", "PNP0700", NULL, crs, true, "FDEN"));
 
     crs = aml_resource_template();
     aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08));
     aml_append(crs, aml_irq_no_flags(7));
     aml_append(scope, build_eisa_device_aml(
-        "LPT", "PNP0400", crs, true, "LPEN"));
+        "LPT", "PNP0400", NULL, crs, true, "LPEN"));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_io(AML_DECODE16, 0x03F8, 0x03F8, 0x00, 0x08));
+    aml_append(crs, aml_irq_no_flags(4));
+    aml_append(scope, build_eisa_device_aml(
+        "COM1", "PNP0501", aml_int(1), crs, true, "CAEN"));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_io(AML_DECODE16, 0x02F8, 0x02F8, 0x00, 0x08));
+    aml_append(crs, aml_irq_no_flags(3));
+    aml_append(scope, build_eisa_device_aml(
+        "COM2", "PNP0501", aml_int(2), crs, true, "CBEN"));
 
     aml_append(table, scope);
 }
diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
deleted file mode 100644
index cc5e8f9..0000000
--- a/hw/i386/acpi-dsdt-isa.dsl
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/* Common legacy ISA style devices. */
-Scope(\_SB.PCI0.ISA) {
-
-    Device(COM1) {
-        Name(_HID, EisaId("PNP0501"))
-        Name(_UID, 0x01)
-        Method(_STA, 0, NotSerialized) {
-            Store(CAEN, Local0)
-            If (LEqual(Local0, 0)) {
-                Return (0x00)
-            } Else {
-                Return (0x0F)
-            }
-        }
-        Name(_CRS, ResourceTemplate() {
-            IO(Decode16, 0x03F8, 0x03F8, 0x00, 0x08)
-            IRQNoFlags() { 4 }
-        })
-    }
-
-    Device(COM2) {
-        Name(_HID, EisaId("PNP0501"))
-        Name(_UID, 0x02)
-        Method(_STA, 0, NotSerialized) {
-            Store(CBEN, Local0)
-            If (LEqual(Local0, 0)) {
-                Return (0x00)
-            } Else {
-                Return (0x0F)
-            }
-        }
-        Name(_CRS, ResourceTemplate() {
-            IO(Decode16, 0x02F8, 0x02F8, 0x00, 0x08)
-            IRQNoFlags() { 3 }
-        })
-    }
-}
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 55c2220..6048cc7 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -80,9 +80,6 @@ DefinitionBlock (
         }
     }
 
-#include "acpi-dsdt-isa.dsl"
-
-
 /****************************************************************
  * PCI hotplug
  ****************************************************************/
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index bf3f974..4862ded 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -146,9 +146,6 @@ DefinitionBlock (
         }
     }
 
-#include "acpi-dsdt-isa.dsl"
-
-
 /****************************************************************
  * PCI IRQs
  ****************************************************************/
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 53/74] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (51 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 52/74] pc: acpi: move COM devices " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers " Igor Mammedov
                   ` (23 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

and also move PRQx fields declaration as it can't be
split out into separate patch since fields use
PCI0.ISA.P40C operation region and OperationRegion
must be declared in the same table as a Field that
uses it. If this condition is not statisfied Windows
will BSOD ans IASL (make check) will error out as well.

For the same reason pm is moved together with isa-bridge
as the later refernces P13C OperationRegion from pm device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c        | 77 +++++++++++++++++++++++++++++++++++++++++++--
 hw/i386/acpi-dsdt.dsl       | 52 +++---------------------------
 include/hw/acpi/aml-build.h |  1 +
 3 files changed, 81 insertions(+), 49 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9bb10d6..581ad98 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -107,6 +107,7 @@ typedef struct AcpiPmInfo {
 } AcpiPmInfo;
 
 typedef struct AcpiMiscInfo {
+    bool is_piix4;
     bool has_hpet;
     TPMVersion tpm_version;
     const unsigned char *dsdt_code;
@@ -129,10 +130,12 @@ static void acpi_get_dsdt(AcpiMiscInfo *info)
     assert(!!piix != !!lpc);
 
     if (piix) {
+        info->is_piix4 = true;
         info->dsdt_code = AcpiDsdtAmlCode;
         info->dsdt_size = sizeof AcpiDsdtAmlCode;
     }
     if (lpc) {
+        info->is_piix4 = false;
         info->dsdt_code = Q35AcpiDsdtAmlCode;
         info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
     }
@@ -1300,6 +1303,68 @@ static void build_dbg_aml(Aml *table)
     aml_append(table, scope);
 }
 
+static void build_piix4_pci0_int(Aml *table)
+{
+    Aml *field;
+    Aml *sb_scope = aml_scope("_SB");
+
+    field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("PRQ0", 8));
+    aml_append(field, aml_named_field("PRQ1", 8));
+    aml_append(field, aml_named_field("PRQ2", 8));
+    aml_append(field, aml_named_field("PRQ3", 8));
+    aml_append(sb_scope, field);
+
+    aml_append(table, sb_scope);
+}
+
+static void build_piix4_pm(Aml *table)
+{
+    Aml *dev;
+    Aml *scope;
+
+    scope =  aml_scope("_SB.PCI0");
+    dev = aml_device("PX13");
+    aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010003)));
+
+    aml_append(dev, aml_operation_region("P13C", AML_PCI_CONFIG,
+                                         0x00, 0xff));
+    aml_append(scope, dev);
+    aml_append(table, scope);
+}
+
+static void build_piix4_isa_bridge(Aml *table)
+{
+    Aml *dev;
+    Aml *scope;
+    Aml *field;
+
+    scope =  aml_scope("_SB.PCI0");
+    dev = aml_device("ISA");
+    aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010000)));
+
+    /* PIIX PCI to ISA irq remapping */
+    aml_append(dev, aml_operation_region("P40C", AML_PCI_CONFIG,
+                                         0x60, 0x04));
+    /* enable bits */
+    field = aml_field("^PX13.P13C", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE);
+    /* Offset(0x5f),, 7, */
+    aml_append(field, aml_reserved_field(0x2f8));
+    aml_append(field, aml_reserved_field(7));
+    aml_append(field, aml_named_field("LPEN", 1));
+    /* Offset(0x67),, 3, */
+    aml_append(field, aml_reserved_field(0x38));
+    aml_append(field, aml_reserved_field(3));
+    aml_append(field, aml_named_field("CAEN", 1));
+    aml_append(field, aml_reserved_field(3));
+    aml_append(field, aml_named_field("CBEN", 1));
+    aml_append(dev, field);
+    aml_append(dev, aml_name_decl("FDEN", aml_int(1)));
+
+    aml_append(scope, dev);
+    aml_append(table, scope);
+}
+
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1321,8 +1386,16 @@ build_ssdt(GArray *table_data, GArray *linker,
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
     build_dbg_aml(ssdt);
-    build_hpet_aml(ssdt);
-    build_isa_devices_aml(ssdt);
+    if (misc->is_piix4) {
+        build_hpet_aml(ssdt);
+        build_piix4_pm(ssdt);
+        build_piix4_isa_bridge(ssdt);
+        build_isa_devices_aml(ssdt);
+        build_piix4_pci0_int(ssdt);
+    } else {
+        build_hpet_aml(ssdt);
+        build_isa_devices_aml(ssdt);
+    }
     build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 6048cc7..11e2e61 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -40,47 +40,6 @@ DefinitionBlock (
     }
 
 /****************************************************************
- * PIIX4 PM
- ****************************************************************/
-
-    Scope(\_SB.PCI0) {
-        Device(PX13) {
-            Name(_ADR, 0x00010003)
-            OperationRegion(P13C, PCI_Config, 0x00, 0xff)
-        }
-    }
-
-
-/****************************************************************
- * PIIX3 ISA bridge
- ****************************************************************/
-
-    Scope(\_SB.PCI0) {
-
-        External(ISA, DeviceObj)
-
-        Device(ISA) {
-            Name(_ADR, 0x00010000)
-
-            /* PIIX PCI to ISA irq remapping */
-            OperationRegion(P40C, PCI_Config, 0x60, 0x04)
-
-            /* enable bits */
-            Field(\_SB.PCI0.PX13.P13C, AnyAcc, NoLock, Preserve) {
-                Offset(0x5f),
-                , 7,
-                LPEN, 1,         // LPT
-                Offset(0x67),
-                , 3,
-                CAEN, 1,         // COM1
-                , 3,
-                CBEN, 1,         // COM2
-            }
-            Name(FDEN, 1)
-        }
-    }
-
-/****************************************************************
  * PCI hotplug
  ****************************************************************/
 
@@ -168,12 +127,11 @@ DefinitionBlock (
             }
         }
 
-        Field(PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) {
-            PRQ0,   8,
-            PRQ1,   8,
-            PRQ2,   8,
-            PRQ3,   8
-        }
+
+        External(PRQ0, FieldUnitObj)
+        External(PRQ1, FieldUnitObj)
+        External(PRQ2, FieldUnitObj)
+        External(PRQ3, FieldUnitObj)
 
         Method(IQST, 1, NotSerialized) {
             // _STA method - get status
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index a23b8da..07ebc47 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -82,6 +82,7 @@ typedef enum {
 typedef enum {
     AML_SYSTEM_MEMORY = 0X00,
     AML_SYSTEM_IO = 0X01,
+    AML_PCI_CONFIG = 0X02,
 } AmlRegionSpace;
 
 typedef enum {
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (52 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 53/74] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-19 19:30   ` Michael S. Tsirkin
  2015-12-19 20:34   ` Michael S. Tsirkin
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 55/74] pc: acpi: pci: move link devices " Igor Mammedov
                   ` (22 subsequent siblings)
  76 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 26 +++++++++++++++++++++++++-
 hw/i386/acpi-dsdt.dsl     | 40 ----------------------------------------
 hw/i386/q35-acpi-dsdt.dsl | 36 ------------------------------------
 3 files changed, 25 insertions(+), 77 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 581ad98..99c0294 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1400,8 +1400,25 @@ build_ssdt(GArray *table_data, GArray *linker,
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
 
-    scope =  aml_scope("\\_GPE");
+    scope =  aml_scope("_GPE");
     {
+        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
+
+        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
+        aml_append(scope, method);
+
+        if (misc->is_piix4) {
+            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
+            aml_append(method,
+                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
+            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
+            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
+            aml_append(scope, method);
+        } else {
+            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
+            aml_append(scope, method);
+        }
+
         method = aml_method("_E02", 0, AML_NOTSERIALIZED);
         aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
         aml_append(scope, method);
@@ -1409,6 +1426,13 @@ build_ssdt(GArray *table_data, GArray *linker,
         method = aml_method("_E03", 0, AML_NOTSERIALIZED);
         aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
         aml_append(scope, method);
+
+        for (i = 4; i <= 0xF; i++) {
+            char *name = g_strdup_printf("_L0%X", i);
+            method = aml_method(name, 0, AML_NOTSERIALIZED);
+            aml_append(scope, method);
+            g_free(name);
+        }
     }
     aml_append(ssdt, scope);
 
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 11e2e61..c9b2725 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -197,44 +197,4 @@ DefinitionBlock (
             Method(_SRS, 1, NotSerialized) { }
         }
     }
-
-/****************************************************************
- * General purpose events
- ****************************************************************/
-    Scope(\_GPE) {
-        Name(_HID, "ACPI0006")
-
-        Method(_L00) {
-        }
-        Method(_E01) {
-            // PCI hotplug event
-            Acquire(\_SB.PCI0.BLCK, 0xFFFF)
-            \_SB.PCI0.PCNT()
-            Release(\_SB.PCI0.BLCK)
-        }
-        Method(_L04) {
-        }
-        Method(_L05) {
-        }
-        Method(_L06) {
-        }
-        Method(_L07) {
-        }
-        Method(_L08) {
-        }
-        Method(_L09) {
-        }
-        Method(_L0A) {
-        }
-        Method(_L0B) {
-        }
-        Method(_L0C) {
-        }
-        Method(_L0D) {
-        }
-        Method(_L0E) {
-        }
-        Method(_L0F) {
-        }
-    }
 }
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 4862ded..e157615 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -375,40 +375,4 @@ DefinitionBlock (
         define_gsi_link(GSIG, 0, 0x16)
         define_gsi_link(GSIH, 0, 0x17)
     }
-
-/****************************************************************
- * General purpose events
- ****************************************************************/
-    Scope(\_GPE) {
-        Name(_HID, "ACPI0006")
-
-        Method(_L00) {
-        }
-        Method(_L01) {
-        }
-        Method(_L04) {
-        }
-        Method(_L05) {
-        }
-        Method(_L06) {
-        }
-        Method(_L07) {
-        }
-        Method(_L08) {
-        }
-        Method(_L09) {
-        }
-        Method(_L0A) {
-        }
-        Method(_L0B) {
-        }
-        Method(_L0C) {
-        }
-        Method(_L0D) {
-        }
-        Method(_L0E) {
-        }
-        Method(_L0F) {
-        }
-    }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 55/74] pc: acpi: pci: move link devices into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (53 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 56/74] pc: acpi: piix4: move IQCR() " Igor Mammedov
                   ` (21 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt.dsl | 49 ++++----------------------------
 2 files changed, 82 insertions(+), 44 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 99c0294..f5e519b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1303,9 +1303,49 @@ static void build_dbg_aml(Aml *table)
     aml_append(table, scope);
 }
 
+static Aml *build_link_dev(const char *name, uint8_t uid, Aml *reg)
+{
+    Aml *dev;
+    Aml *crs;
+    Aml *method;
+    uint32_t irqs[] = {5, 10, 11};
+
+    dev = aml_device("%s", name);
+    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0F")));
+    aml_append(dev, aml_name_decl("_UID", aml_int(uid)));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
+                                  AML_SHARED, irqs, ARRAY_SIZE(irqs)));
+    aml_append(dev, aml_name_decl("_PRS", crs));
+
+    method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_return(aml_call1("IQST", reg)));
+    aml_append(dev, method);
+
+    method = aml_method("_DIS", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_or(reg, aml_int(0x80), reg));
+    aml_append(dev, method);
+
+    method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_return(aml_call1("IQCR", reg)));
+    aml_append(dev, method);
+
+    method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
+    aml_append(method, aml_create_dword_field(aml_arg(0), aml_int(5), "PRRI"));
+    aml_append(method, aml_store(aml_name("PRRI"), reg));
+    aml_append(dev, method);
+
+    return dev;
+ }
+
 static void build_piix4_pci0_int(Aml *table)
 {
+    Aml *dev;
+    Aml *crs;
     Aml *field;
+    Aml *method;
+    uint32_t irqs;
     Aml *sb_scope = aml_scope("_SB");
 
     field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
@@ -1315,6 +1355,43 @@ static void build_piix4_pci0_int(Aml *table)
     aml_append(field, aml_named_field("PRQ3", 8));
     aml_append(sb_scope, field);
 
+    aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0")));
+    aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1")));
+    aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQ2")));
+    aml_append(sb_scope, build_link_dev("LNKD", 3, aml_name("PRQ3")));
+
+    dev = aml_device("LNKS");
+    {
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0F")));
+        aml_append(dev, aml_name_decl("_UID", aml_int(4)));
+
+        crs = aml_resource_template();
+        irqs = 9;
+        aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL,
+                                      AML_ACTIVE_HIGH, AML_SHARED,
+                                      &irqs, 1));
+        aml_append(dev, aml_name_decl("_PRS", crs));
+
+        /* The SCI cannot be disabled and is always attached to GSI 9,
+         * so these are no-ops.  We only need this link to override the
+         * polarity to active high and match the content of the MADT.
+         */
+        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_return(aml_int(0x0b)));
+        aml_append(dev, method);
+
+        method = aml_method("_DIS", 0, AML_NOTSERIALIZED);
+        aml_append(dev, method);
+
+        method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_return(aml_name("_PRS")));
+        aml_append(dev, method);
+
+        method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
+        aml_append(dev, method);
+    }
+    aml_append(sb_scope, dev);
+
     aml_append(table, sb_scope);
 }
 
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index c9b2725..b74cffd 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -152,49 +152,10 @@ DefinitionBlock (
             Return (PRR0)
         }
 
-#define define_link(link, uid, reg)                             \
-        Device(link) {                                          \
-            Name(_HID, EISAID("PNP0C0F"))                       \
-            Name(_UID, uid)                                     \
-            Name(_PRS, ResourceTemplate() {                     \
-                Interrupt(, Level, ActiveHigh, Shared) {        \
-                    5, 10, 11                                   \
-                }                                               \
-            })                                                  \
-            Method(_STA, 0, NotSerialized) {                    \
-                Return (IQST(reg))                              \
-            }                                                   \
-            Method(_DIS, 0, NotSerialized) {                    \
-                Or(reg, 0x80, reg)                              \
-            }                                                   \
-            Method(_CRS, 0, NotSerialized) {                    \
-                Return (IQCR(reg))                              \
-            }                                                   \
-            Method(_SRS, 1, NotSerialized) {                    \
-                CreateDWordField(Arg0, 0x05, PRRI)              \
-                Store(PRRI, reg)                                \
-            }                                                   \
-        }
-
-        define_link(LNKA, 0, PRQ0)
-        define_link(LNKB, 1, PRQ1)
-        define_link(LNKC, 2, PRQ2)
-        define_link(LNKD, 3, PRQ3)
-
-        Device(LNKS) {
-            Name(_HID, EISAID("PNP0C0F"))
-            Name(_UID, 4)
-            Name(_PRS, ResourceTemplate() {
-                Interrupt(, Level, ActiveHigh, Shared) { 9 }
-            })
-
-            // The SCI cannot be disabled and is always attached to GSI 9,
-            // so these are no-ops.  We only need this link to override the
-            // polarity to active high and match the content of the MADT.
-            Method(_STA, 0, NotSerialized) { Return (0x0b) }
-            Method(_DIS, 0, NotSerialized) { }
-            Method(_CRS, 0, NotSerialized) { Return (_PRS) }
-            Method(_SRS, 1, NotSerialized) { }
-        }
+        External(LNKA, DeviceObj)
+        External(LNKB, DeviceObj)
+        External(LNKC, DeviceObj)
+        External(LNKD, DeviceObj)
+        External(LNKS, DeviceObj)
     }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 56/74] pc: acpi: piix4: move IQCR() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (54 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 55/74] pc: acpi: pci: move link devices " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 57/74] pc: acpi: piix4: move IQST() " Igor Mammedov
                   ` (20 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 20 ++++++++++++++++++++
 hw/i386/acpi-dsdt.dsl | 11 -----------
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f5e519b..2720262 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1344,6 +1344,7 @@ static void build_piix4_pci0_int(Aml *table)
     Aml *dev;
     Aml *crs;
     Aml *field;
+    Aml *if_ctx;
     Aml *method;
     uint32_t irqs;
     Aml *sb_scope = aml_scope("_SB");
@@ -1355,6 +1356,25 @@ static void build_piix4_pci0_int(Aml *table)
     aml_append(field, aml_named_field("PRQ3", 8));
     aml_append(sb_scope, field);
 
+    /* _CRS method - get current settings */
+    method = aml_method("IQCR", 1, AML_SERIALIZED);
+    {
+        crs = aml_resource_template();
+        irqs = 0;
+        aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL,
+                                      AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1));
+        aml_append(method, aml_name_decl("PRR0", crs));
+
+        aml_append(method,
+            aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI"));
+
+        if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80)));
+        aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI")));
+        aml_append(method, if_ctx);
+        aml_append(method, aml_return(aml_name("PRR0")));
+    }
+    aml_append(sb_scope, method);
+
     aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0")));
     aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1")));
     aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQ2")));
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index b74cffd..1f58ec4 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -140,17 +140,6 @@ DefinitionBlock (
             }
             Return (0x0B)
         }
-        Method(IQCR, 1, Serialized) {
-            // _CRS method - get current settings
-            Name(PRR0, ResourceTemplate() {
-                Interrupt(, Level, ActiveHigh, Shared) { 0 }
-            })
-            CreateDWordField(PRR0, 0x05, PRRI)
-            If (LLess(Arg0, 0x80)) {
-                Store(Arg0, PRRI)
-            }
-            Return (PRR0)
-        }
 
         External(LNKA, DeviceObj)
         External(LNKB, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 57/74] pc: acpi: piix4: move IQST() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (55 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 56/74] pc: acpi: piix4: move IQCR() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() " Igor Mammedov
                   ` (19 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 10 ++++++++++
 hw/i386/acpi-dsdt.dsl |  9 ---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2720262..cf98037 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1356,6 +1356,16 @@ static void build_piix4_pci0_int(Aml *table)
     aml_append(field, aml_named_field("PRQ3", 8));
     aml_append(sb_scope, field);
 
+    /* _STA method - get status */
+    method = aml_method("IQST", 1, AML_NOTSERIALIZED);
+    {
+        if_ctx = aml_if(aml_and(aml_int(0x80), aml_arg(0), NULL));
+        aml_append(if_ctx, aml_return(aml_int(0x09)));
+        aml_append(method, if_ctx);
+        aml_append(method, aml_return(aml_int(0x0B)));
+    }
+    aml_append(sb_scope, method);
+
     /* _CRS method - get current settings */
     method = aml_method("IQCR", 1, AML_SERIALIZED);
     {
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 1f58ec4..bc6bd45 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -132,15 +132,6 @@ DefinitionBlock (
         External(PRQ1, FieldUnitObj)
         External(PRQ2, FieldUnitObj)
         External(PRQ3, FieldUnitObj)
-
-        Method(IQST, 1, NotSerialized) {
-            // _STA method - get status
-            If (And(0x80, Arg0)) {
-                Return (0x09)
-            }
-            Return (0x0B)
-        }
-
         External(LNKA, DeviceObj)
         External(LNKB, DeviceObj)
         External(LNKC, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (56 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 57/74] pc: acpi: piix4: move IQST() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-10 12:32   ` Marcel Apfelbaum
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 59/74] pc: acpi: piix4: move remaining PCI hotplug bits " Igor Mammedov
                   ` (18 subsequent siblings)
  76 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt.dsl | 60 -------------------------------------
 2 files changed, 83 insertions(+), 60 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index cf98037..f0966b8 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1339,6 +1339,17 @@ static Aml *build_link_dev(const char *name, uint8_t uid, Aml *reg)
     return dev;
  }
 
+static Aml *build_prt_entry(const char *dev)
+{
+    Aml *a_zero = aml_int(0);
+    Aml *pkg = aml_package(4);
+    aml_append(pkg, a_zero);
+    aml_append(pkg, a_zero);
+    aml_append(pkg, aml_name("%s", dev));
+    aml_append(pkg, a_zero);
+    return pkg;
+}
+
 static void build_piix4_pci0_int(Aml *table)
 {
     Aml *dev;
@@ -1348,6 +1359,78 @@ static void build_piix4_pci0_int(Aml *table)
     Aml *method;
     uint32_t irqs;
     Aml *sb_scope = aml_scope("_SB");
+    Aml *pci0_scope = aml_scope("PCI0");
+
+    method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
+    {
+        Aml *w_ctx;
+        Aml *if_ctx2;
+        Aml *else_ctx2;
+        Aml *a_zero = aml_int(0);
+        Aml *a_prt = aml_local(0);
+        Aml *a_pin = aml_local(1);
+        Aml *a_lnk = aml_local(3);
+        Aml *a_slot = aml_local(2);
+        Aml *a_prt_ent = aml_local(4);
+
+        aml_append(method, aml_store(aml_package(128), a_prt));
+        aml_append(method, aml_store(a_zero, a_pin));
+        w_ctx = aml_while(aml_lless(a_pin, aml_int(128)));
+
+        /* slot = pin >> 2 */
+        aml_append(w_ctx,
+            aml_store(aml_shiftright(a_pin, aml_int(2), NULL), a_slot));
+
+        /* lnk = (slot + pin) & 3 */
+        aml_append(w_ctx,
+            aml_store(aml_and(aml_add(a_pin, a_slot, NULL), aml_int(3), NULL),
+                      a_lnk));
+
+        if_ctx = aml_if(aml_equal(a_lnk, a_zero));
+        aml_append(if_ctx, aml_store(build_prt_entry("LNKD"), a_prt_ent));
+        aml_append(w_ctx, if_ctx);
+
+        if_ctx = aml_if(aml_equal(a_lnk, aml_int(1)));
+        /* device 1 is the power-management device, needs SCI */
+        if_ctx2 = aml_if(aml_equal(a_pin, aml_int(4)));
+        aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), a_prt_ent));
+        aml_append(if_ctx, if_ctx2);
+        else_ctx2 = aml_else();
+        aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), a_prt_ent));
+        aml_append(if_ctx, else_ctx2);
+        aml_append(w_ctx, if_ctx);
+
+        if_ctx = aml_if(aml_equal(a_lnk, aml_int(2)));
+        aml_append(if_ctx, aml_store(build_prt_entry("LNKB"), a_prt_ent));
+        aml_append(w_ctx, if_ctx);
+
+        if_ctx = aml_if(aml_equal(a_lnk, aml_int(3)));
+        aml_append(if_ctx, aml_store(build_prt_entry("LNKC"), a_prt_ent));
+        aml_append(w_ctx, if_ctx);
+
+        /*
+         * Complete the interrupt routing entry:
+         *    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
+         */
+        aml_append(w_ctx,
+            aml_store(
+                aml_or(aml_shiftleft(a_slot, aml_int(16)),
+                       aml_int(0xFFFF), NULL),
+                aml_index(a_prt_ent, a_zero)
+            )
+        );
+        aml_append(w_ctx,
+            aml_store(aml_and(a_pin, aml_int(3), NULL),
+                      aml_index(a_prt_ent, aml_int(1))));
+        aml_append(w_ctx, aml_store(a_prt_ent, aml_index(a_prt, a_pin)));
+
+        aml_append(w_ctx, aml_increment(a_pin));
+        aml_append(method, w_ctx);
+
+        aml_append(method, aml_return(aml_local(0)));
+    }
+    aml_append(pci0_scope, method);
+    aml_append(sb_scope, pci0_scope);
 
     field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
     aml_append(field, aml_named_field("PRQ0", 8));
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index bc6bd45..5d741dd 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -78,64 +78,4 @@ DefinitionBlock (
         /* Hotplug notification method supplied by SSDT */
         External(\_SB.PCI0.PCNT, MethodObj)
     }
-
-
-/****************************************************************
- * PCI IRQs
- ****************************************************************/
-
-    Scope(\_SB) {
-        Scope(PCI0) {
-            Method (_PRT, 0) {
-                Store(Package(128) {}, Local0)
-                Store(Zero, Local1)
-                While(LLess(Local1, 128)) {
-                    // slot = pin >> 2
-                    Store(ShiftRight(Local1, 2), Local2)
-
-                    // lnk = (slot + pin) & 3
-                    Store(And(Add(Local1, Local2), 3), Local3)
-                    If (LEqual(Local3, 0)) {
-                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
-                    }
-                    If (LEqual(Local3, 1)) {
-                        // device 1 is the power-management device, needs SCI
-                        If (LEqual(Local1, 4)) {
-                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
-                        } Else {
-                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
-                        }
-                    }
-                    If (LEqual(Local3, 2)) {
-                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
-                    }
-                    If (LEqual(Local3, 3)) {
-                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
-                    }
-
-                    // Complete the interrupt routing entry:
-                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
-
-                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
-                    Store(And(Local1, 3),                    Index(Local4, 1))
-                    Store(Local4,                            Index(Local0, Local1))
-
-                    Increment(Local1)
-                }
-
-                Return(Local0)
-            }
-        }
-
-
-        External(PRQ0, FieldUnitObj)
-        External(PRQ1, FieldUnitObj)
-        External(PRQ2, FieldUnitObj)
-        External(PRQ3, FieldUnitObj)
-        External(LNKA, DeviceObj)
-        External(LNKB, DeviceObj)
-        External(LNKC, DeviceObj)
-        External(LNKD, DeviceObj)
-        External(LNKS, DeviceObj)
-    }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 59/74] pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (57 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 60/74] pc: acpi: piix4: acpi move PCI0 device to SSDT Igor Mammedov
                   ` (17 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 43 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-dsdt.dsl | 40 ----------------------------------------
 2 files changed, 43 insertions(+), 40 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f0966b8..ba941aa 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1555,6 +1555,48 @@ static void build_piix4_isa_bridge(Aml *table)
     aml_append(table, scope);
 }
 
+static void build_piix4_pci_hotplug(Aml *table)
+{
+    Aml *scope;
+    Aml *field;
+    Aml *method;
+
+    scope =  aml_scope("_SB.PCI0");
+
+    aml_append(scope,
+        aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x08));
+    field = aml_field("PCST", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS);
+    aml_append(field, aml_named_field("PCIU", 32));
+    aml_append(field, aml_named_field("PCID", 32));
+    aml_append(scope, field);
+
+    aml_append(scope,
+        aml_operation_region("SEJ", AML_SYSTEM_IO, 0xae08, 0x04));
+    field = aml_field("SEJ", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS);
+    aml_append(field, aml_named_field("B0EJ", 32));
+    aml_append(scope, field);
+
+    aml_append(scope,
+        aml_operation_region("BNMR", AML_SYSTEM_IO, 0xae10, 0x04));
+    field = aml_field("BNMR", AML_DWORD_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS);
+    aml_append(field, aml_named_field("BNUM", 32));
+    aml_append(scope, field);
+
+    aml_append(scope, aml_mutex("BLCK", 0));
+
+    method = aml_method("PCEJ", 2, AML_NOTSERIALIZED);
+    aml_append(method, aml_acquire(aml_name("BLCK"), 0xFFFF));
+    aml_append(method, aml_store(aml_arg(0), aml_name("BNUM")));
+    aml_append(method,
+        aml_store(aml_shiftleft(aml_int(1), aml_arg(1)), aml_name("B0EJ")));
+    aml_append(method, aml_release(aml_name("BLCK")));
+    aml_append(method, aml_return(aml_int(0)));
+    aml_append(scope, method);
+
+    aml_append(table, scope);
+}
+
+
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1581,6 +1623,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         build_piix4_pm(ssdt);
         build_piix4_isa_bridge(ssdt);
         build_isa_devices_aml(ssdt);
+        build_piix4_pci_hotplug(ssdt);
         build_piix4_pci0_int(ssdt);
     } else {
         build_hpet_aml(ssdt);
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 5d741dd..a7769fc 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -38,44 +38,4 @@ DefinitionBlock (
 //            External(PX13, DeviceObj)
         }
     }
-
-/****************************************************************
- * PCI hotplug
- ****************************************************************/
-
-    Scope(\_SB.PCI0) {
-        OperationRegion(PCST, SystemIO, 0xae00, 0x08)
-        Field(PCST, DWordAcc, NoLock, WriteAsZeros) {
-            PCIU, 32,
-            PCID, 32,
-        }
-
-        OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
-        Field(SEJ, DWordAcc, NoLock, WriteAsZeros) {
-            B0EJ, 32,
-        }
-
-        OperationRegion(BNMR, SystemIO, 0xae10, 0x04)
-        Field(BNMR, DWordAcc, NoLock, WriteAsZeros) {
-            BNUM, 32,
-        }
-
-        /* Lock to protect access to fields above. */
-        Mutex(BLCK, 0)
-
-        /* Methods called by bulk generated PCI devices below */
-
-        /* Methods called by hotplug devices */
-        Method(PCEJ, 2, NotSerialized) {
-            // _EJ0 method - eject callback
-            Acquire(BLCK, 0xFFFF)
-            Store(Arg0, BNUM)
-            Store(ShiftLeft(1, Arg1), B0EJ)
-            Release(BLCK)
-            Return (0x0)
-        }
-
-        /* Hotplug notification method supplied by SSDT */
-        External(\_SB.PCI0.PCNT, MethodObj)
-    }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 60/74] pc: acpi: piix4: acpi move PCI0 device to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (58 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 59/74] pc: acpi: piix4: move remaining PCI hotplug bits " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 61/74] pc: acpi: q35: move GSI links " Igor Mammedov
                   ` (16 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

leave Scope(\_SB) definition in DSDT so that iasl
would be able to compile DSDT since we are still
need definition block for table.
After Q35 ASL is converted, DSDT templates will
be completly replaced by AML API generated tables.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 8 ++++++++
 hw/i386/acpi-dsdt.dsl | 8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index ba941aa..4b1bd0b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1619,6 +1619,14 @@ build_ssdt(GArray *table_data, GArray *linker,
 
     build_dbg_aml(ssdt);
     if (misc->is_piix4) {
+        sb_scope = aml_scope("_SB");
+        dev = aml_device("PCI0");
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
+        aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
+        aml_append(dev, aml_name_decl("_UID", aml_int(1)));
+        aml_append(sb_scope, dev);
+        aml_append(ssdt, sb_scope);
+
         build_hpet_aml(ssdt);
         build_piix4_pm(ssdt);
         build_piix4_isa_bridge(ssdt);
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index a7769fc..82e4470 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -28,14 +28,6 @@ DefinitionBlock (
     0x1                 // OEM Revision
     )
 {
-
     Scope(\_SB) {
-        Device(PCI0) {
-            Name(_HID, EisaId("PNP0A03"))
-            Name(_ADR, 0x00)
-            Name(_UID, 1)
-//#define PX13 S0B_
-//            External(PX13, DeviceObj)
-        }
     }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 61/74] pc: acpi: q35: move GSI links to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (59 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 60/74] pc: acpi: piix4: acpi move PCI0 device to SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 62/74] pc: acpi: q35: move link devices " Igor Mammedov
                   ` (15 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/q35-acpi-dsdt.dsl | 34 ++++++++--------------------------
 2 files changed, 55 insertions(+), 26 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4b1bd0b..75a46c7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1339,6 +1339,31 @@ static Aml *build_link_dev(const char *name, uint8_t uid, Aml *reg)
     return dev;
  }
 
+static Aml *build_gsi_link_dev(const char *name, uint8_t uid, uint8_t gsi)
+{
+    Aml *dev;
+    Aml *crs;
+    Aml *method;
+    uint32_t irqs;
+
+    dev = aml_device("%s", name);
+    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C0F")));
+    aml_append(dev, aml_name_decl("_UID", aml_int(uid)));
+
+    crs = aml_resource_template();
+    irqs = gsi;
+    aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
+                                  AML_SHARED, &irqs, 1));
+    aml_append(dev, aml_name_decl("_PRS", crs));
+
+    aml_append(dev, aml_name_decl("_CRS", crs));
+
+    method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
+    aml_append(dev, method);
+
+    return dev;
+}
+
 static Aml *build_prt_entry(const char *dev)
 {
     Aml *a_zero = aml_int(0);
@@ -1508,6 +1533,26 @@ static void build_piix4_pci0_int(Aml *table)
     aml_append(table, sb_scope);
 }
 
+static void build_q35_pci0_int(Aml *table)
+{
+    Aml *sb_scope = aml_scope("_SB");
+
+    /*
+     * TODO: UID probably shouldn't be the same for GSIx devices
+     * but that's how it was in original ASL so keep it for now
+     */
+    aml_append(sb_scope, build_gsi_link_dev("GSIA", 0, 0x10));
+    aml_append(sb_scope, build_gsi_link_dev("GSIB", 0, 0x11));
+    aml_append(sb_scope, build_gsi_link_dev("GSIC", 0, 0x12));
+    aml_append(sb_scope, build_gsi_link_dev("GSID", 0, 0x13));
+    aml_append(sb_scope, build_gsi_link_dev("GSIE", 0, 0x14));
+    aml_append(sb_scope, build_gsi_link_dev("GSIF", 0, 0x15));
+    aml_append(sb_scope, build_gsi_link_dev("GSIG", 0, 0x16));
+    aml_append(sb_scope, build_gsi_link_dev("GSIH", 0, 0x17));
+
+    aml_append(table, sb_scope);
+}
+
 static void build_piix4_pm(Aml *table)
 {
     Aml *dev;
@@ -1636,7 +1681,9 @@ build_ssdt(GArray *table_data, GArray *linker,
     } else {
         build_hpet_aml(ssdt);
         build_isa_devices_aml(ssdt);
+        build_q35_pci0_int(ssdt);
     }
+
     build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index e157615..f2c154a 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -348,31 +348,13 @@ DefinitionBlock (
         define_link(LNKG, 6, PRQG)
         define_link(LNKH, 7, PRQH)
 
-#define define_gsi_link(link, uid, gsi)                         \
-        Device(link) {                                          \
-            Name(_HID, EISAID("PNP0C0F"))                       \
-            Name(_UID, uid)                                     \
-            Name(_PRS, ResourceTemplate() {                     \
-                Interrupt(, Level, ActiveHigh, Shared) {        \
-                    gsi                                         \
-                }                                               \
-            })                                                  \
-            Name(_CRS, ResourceTemplate() {                     \
-                Interrupt(, Level, ActiveHigh, Shared) {        \
-                    gsi                                         \
-                }                                               \
-            })                                                  \
-            Method(_SRS, 1, NotSerialized) {                    \
-            }                                                   \
-        }
-
-        define_gsi_link(GSIA, 0, 0x10)
-        define_gsi_link(GSIB, 0, 0x11)
-        define_gsi_link(GSIC, 0, 0x12)
-        define_gsi_link(GSID, 0, 0x13)
-        define_gsi_link(GSIE, 0, 0x14)
-        define_gsi_link(GSIF, 0, 0x15)
-        define_gsi_link(GSIG, 0, 0x16)
-        define_gsi_link(GSIH, 0, 0x17)
+        External(GSIA, DeviceObj)
+        External(GSIB, DeviceObj)
+        External(GSIC, DeviceObj)
+        External(GSID, DeviceObj)
+        External(GSIE, DeviceObj)
+        External(GSIF, DeviceObj)
+        External(GSIG, DeviceObj)
+        External(GSIH, DeviceObj)
     }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 62/74] pc: acpi: q35: move link devices to SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (60 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 61/74] pc: acpi: q35: move GSI links " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 63/74] pc: acpi: q35: move IQCR() into SSDT Igor Mammedov
                   ` (14 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      |  9 +++++++++
 hw/i386/q35-acpi-dsdt.dsl | 40 ++++++++--------------------------------
 2 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 75a46c7..51a07eb 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1537,6 +1537,15 @@ static void build_q35_pci0_int(Aml *table)
 {
     Aml *sb_scope = aml_scope("_SB");
 
+    aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA")));
+    aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQB")));
+    aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQC")));
+    aml_append(sb_scope, build_link_dev("LNKD", 3, aml_name("PRQD")));
+    aml_append(sb_scope, build_link_dev("LNKE", 4, aml_name("PRQE")));
+    aml_append(sb_scope, build_link_dev("LNKF", 5, aml_name("PRQF")));
+    aml_append(sb_scope, build_link_dev("LNKG", 6, aml_name("PRQG")));
+    aml_append(sb_scope, build_link_dev("LNKH", 7, aml_name("PRQH")));
+
     /*
      * TODO: UID probably shouldn't be the same for GSIx devices
      * but that's how it was in original ASL so keep it for now
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index f2c154a..2da3515 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -315,38 +315,14 @@ DefinitionBlock (
             Return (PRR0)
         }
 
-#define define_link(link, uid, reg)                             \
-        Device(link) {                                          \
-            Name(_HID, EISAID("PNP0C0F"))                       \
-            Name(_UID, uid)                                     \
-            Name(_PRS, ResourceTemplate() {                     \
-                Interrupt(, Level, ActiveHigh, Shared) {        \
-                    5, 10, 11                                   \
-                }                                               \
-            })                                                  \
-            Method(_STA, 0, NotSerialized) {                    \
-                Return (IQST(reg))                              \
-            }                                                   \
-            Method(_DIS, 0, NotSerialized) {                    \
-                Or(reg, 0x80, reg)                              \
-            }                                                   \
-            Method(_CRS, 0, NotSerialized) {                    \
-                Return (IQCR(reg))                              \
-            }                                                   \
-            Method(_SRS, 1, NotSerialized) {                    \
-                CreateDWordField(Arg0, 0x05, PRRI)              \
-                Store(PRRI, reg)                                \
-            }                                                   \
-        }
-
-        define_link(LNKA, 0, PRQA)
-        define_link(LNKB, 1, PRQB)
-        define_link(LNKC, 2, PRQC)
-        define_link(LNKD, 3, PRQD)
-        define_link(LNKE, 4, PRQE)
-        define_link(LNKF, 5, PRQF)
-        define_link(LNKG, 6, PRQG)
-        define_link(LNKH, 7, PRQH)
+        External(LNKA, DeviceObj)
+        External(LNKB, DeviceObj)
+        External(LNKC, DeviceObj)
+        External(LNKD, DeviceObj)
+        External(LNKE, DeviceObj)
+        External(LNKF, DeviceObj)
+        External(LNKG, DeviceObj)
+        External(LNKH, DeviceObj)
 
         External(GSIA, DeviceObj)
         External(GSIB, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 63/74] pc: acpi: q35: move IQCR() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (61 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 62/74] pc: acpi: q35: move link devices " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 64/74] pc: acpi: q35: move IQST() " Igor Mammedov
                   ` (13 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 51 ++++++++++++++++++++++++++++++-----------------
 hw/i386/q35-acpi-dsdt.dsl |  9 ---------
 2 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 51a07eb..a4c2b43 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1375,6 +1375,36 @@ static Aml *build_prt_entry(const char *dev)
     return pkg;
 }
 
+/* _CRS method - get current settings */
+static Aml *build_iqcr_method(bool is_piix4)
+{
+    Aml *if_ctx;
+    uint32_t irqs;
+    Aml *method = aml_method("IQCR", 1, AML_SERIALIZED);
+    Aml *crs = aml_resource_template();
+
+    irqs = 0;
+    aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL,
+                                  AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1));
+    aml_append(method, aml_name_decl("PRR0", crs));
+
+    aml_append(method,
+        aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI"));
+
+    if (is_piix4) {
+        if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80)));
+        aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI")));
+        aml_append(method, if_ctx);
+    } else {
+        aml_append(method,
+            aml_store(aml_and(aml_arg(0), aml_int(0xF), NULL),
+                      aml_name("PRRI")));
+    }
+
+    aml_append(method, aml_return(aml_name("PRR0")));
+    return method;
+}
+
 static void build_piix4_pci0_int(Aml *table)
 {
     Aml *dev;
@@ -1474,24 +1504,7 @@ static void build_piix4_pci0_int(Aml *table)
     }
     aml_append(sb_scope, method);
 
-    /* _CRS method - get current settings */
-    method = aml_method("IQCR", 1, AML_SERIALIZED);
-    {
-        crs = aml_resource_template();
-        irqs = 0;
-        aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL,
-                                      AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1));
-        aml_append(method, aml_name_decl("PRR0", crs));
-
-        aml_append(method,
-            aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI"));
-
-        if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80)));
-        aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI")));
-        aml_append(method, if_ctx);
-        aml_append(method, aml_return(aml_name("PRR0")));
-    }
-    aml_append(sb_scope, method);
+    aml_append(sb_scope, build_iqcr_method(true));
 
     aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0")));
     aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1")));
@@ -1537,6 +1550,8 @@ static void build_q35_pci0_int(Aml *table)
 {
     Aml *sb_scope = aml_scope("_SB");
 
+    aml_append(sb_scope, build_iqcr_method(false));
+
     aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA")));
     aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQB")));
     aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQC")));
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 2da3515..85b0a2c 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -305,15 +305,6 @@ DefinitionBlock (
             }
             Return (0x0B)
         }
-        Method(IQCR, 1, Serialized) {
-            // _CRS method - get current settings
-            Name(PRR0, ResourceTemplate() {
-                Interrupt(, Level, ActiveHigh, Shared) { 0 }
-            })
-            CreateDWordField(PRR0, 0x05, PRRI)
-            Store(And(Arg0, 0x0F), PRRI)
-            Return (PRR0)
-        }
 
         External(LNKA, DeviceObj)
         External(LNKB, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 64/74] pc: acpi: q35: move IQST() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (62 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 63/74] pc: acpi: q35: move IQCR() into SSDT Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 65/74] pc: acpi: q35: move ISA bridge " Igor Mammedov
                   ` (12 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 25 +++++++++++++++----------
 hw/i386/q35-acpi-dsdt.dsl |  8 --------
 2 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a4c2b43..2f0b9b7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1405,6 +1405,19 @@ static Aml *build_iqcr_method(bool is_piix4)
     return method;
 }
 
+/* _STA method - get status */
+static Aml *build_irq_status_method(void)
+{
+    Aml *if_ctx;
+    Aml *method = aml_method("IQST", 1, AML_NOTSERIALIZED);
+
+    if_ctx = aml_if(aml_and(aml_int(0x80), aml_arg(0), NULL));
+    aml_append(if_ctx, aml_return(aml_int(0x09)));
+    aml_append(method, if_ctx);
+    aml_append(method, aml_return(aml_int(0x0B)));
+    return method;
+}
+
 static void build_piix4_pci0_int(Aml *table)
 {
     Aml *dev;
@@ -1494,16 +1507,7 @@ static void build_piix4_pci0_int(Aml *table)
     aml_append(field, aml_named_field("PRQ3", 8));
     aml_append(sb_scope, field);
 
-    /* _STA method - get status */
-    method = aml_method("IQST", 1, AML_NOTSERIALIZED);
-    {
-        if_ctx = aml_if(aml_and(aml_int(0x80), aml_arg(0), NULL));
-        aml_append(if_ctx, aml_return(aml_int(0x09)));
-        aml_append(method, if_ctx);
-        aml_append(method, aml_return(aml_int(0x0B)));
-    }
-    aml_append(sb_scope, method);
-
+    aml_append(sb_scope, build_irq_status_method());
     aml_append(sb_scope, build_iqcr_method(true));
 
     aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0")));
@@ -1550,6 +1554,7 @@ static void build_q35_pci0_int(Aml *table)
 {
     Aml *sb_scope = aml_scope("_SB");
 
+    aml_append(sb_scope, build_irq_status_method());
     aml_append(sb_scope, build_iqcr_method(false));
 
     aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA")));
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 85b0a2c..ec8a48c 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -298,14 +298,6 @@ DefinitionBlock (
             PRQH,   8
         }
 
-        Method(IQST, 1, NotSerialized) {
-            // _STA method - get status
-            If (And(0x80, Arg0)) {
-                Return (0x09)
-            }
-            Return (0x0B)
-        }
-
         External(LNKA, DeviceObj)
         External(LNKB, DeviceObj)
         External(LNKC, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 65/74] pc: acpi: q35: move ISA bridge into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (63 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 64/74] pc: acpi: q35: move IQST() " Igor Mammedov
@ 2015-12-09 23:41 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 66/74] pc: acpi: q35: move _PRT() " Igor Mammedov
                   ` (11 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:41 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/q35-acpi-dsdt.dsl | 46 ----------------------------------------
 2 files changed, 54 insertions(+), 46 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2f0b9b7..876605d 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1552,8 +1552,21 @@ static void build_piix4_pci0_int(Aml *table)
 
 static void build_q35_pci0_int(Aml *table)
 {
+    Aml *field;
     Aml *sb_scope = aml_scope("_SB");
 
+    field = aml_field("PCI0.ISA.PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("PRQA", 8));
+    aml_append(field, aml_named_field("PRQB", 8));
+    aml_append(field, aml_named_field("PRQC", 8));
+    aml_append(field, aml_named_field("PRQD", 8));
+    aml_append(field, aml_reserved_field(0x20));
+    aml_append(field, aml_named_field("PRQE", 8));
+    aml_append(field, aml_named_field("PRQF", 8));
+    aml_append(field, aml_named_field("PRQG", 8));
+    aml_append(field, aml_named_field("PRQH", 8));
+    aml_append(sb_scope, field);
+
     aml_append(sb_scope, build_irq_status_method());
     aml_append(sb_scope, build_iqcr_method(false));
 
@@ -1582,6 +1595,46 @@ static void build_q35_pci0_int(Aml *table)
     aml_append(table, sb_scope);
 }
 
+static void build_q35_isa_bridge(Aml *table)
+{
+    Aml *dev;
+    Aml *scope;
+    Aml *field;
+
+    scope =  aml_scope("_SB.PCI0");
+    dev = aml_device("ISA");
+    aml_append(dev, aml_name_decl("_ADR", aml_int(0x001F0000)));
+
+    /* ICH9 PCI to ISA irq remapping */
+    aml_append(dev, aml_operation_region("PIRQ", AML_PCI_CONFIG,
+                                         0x60, 0x0C));
+
+    aml_append(dev, aml_operation_region("LPCD", AML_PCI_CONFIG,
+                                         0x80, 0x02));
+    field = aml_field("LPCD", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("COMA", 3));
+    aml_append(field, aml_reserved_field(1));
+    aml_append(field, aml_named_field("COMB", 3));
+    aml_append(field, aml_reserved_field(1));
+    aml_append(field, aml_named_field("LPTD", 2));
+    aml_append(field, aml_reserved_field(2));
+    aml_append(field, aml_named_field("FDCD", 2));
+    aml_append(dev, field);
+
+    aml_append(dev, aml_operation_region("LPCE", AML_PCI_CONFIG,
+                                         0x82, 0x02));
+    /* enable bits */
+    field = aml_field("LPCE", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("CAEN", 1));
+    aml_append(field, aml_named_field("CBEN", 1));
+    aml_append(field, aml_named_field("LPEN", 1));
+    aml_append(field, aml_named_field("FDEN", 1));
+    aml_append(dev, field);
+
+    aml_append(scope, dev);
+    aml_append(table, scope);
+}
+
 static void build_piix4_pm(Aml *table)
 {
     Aml *dev;
@@ -1709,6 +1762,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         build_piix4_pci0_int(ssdt);
     } else {
         build_hpet_aml(ssdt);
+        build_q35_isa_bridge(ssdt);
         build_isa_devices_aml(ssdt);
         build_q35_pci0_int(ssdt);
     }
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index ec8a48c..b01d4de 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -114,39 +114,6 @@ DefinitionBlock (
     }
 
 /****************************************************************
- * LPC ISA bridge
- ****************************************************************/
-
-    Scope(\_SB.PCI0) {
-        /* PCI D31:f0 LPC ISA bridge */
-        Device(ISA) {
-            Name (_ADR, 0x001F0000)  // _ADR: Address
-
-            /* ICH9 PCI to ISA irq remapping */
-            OperationRegion(PIRQ, PCI_Config, 0x60, 0x0C)
-
-            OperationRegion(LPCD, PCI_Config, 0x80, 0x2)
-            Field(LPCD, AnyAcc, NoLock, Preserve) {
-                COMA,   3,
-                    ,   1,
-                COMB,   3,
-
-                Offset(0x01),
-                LPTD,   2,
-                    ,   2,
-                FDCD,   2
-            }
-            OperationRegion(LPCE, PCI_Config, 0x82, 0x2)
-            Field(LPCE, AnyAcc, NoLock, Preserve) {
-                CAEN,   1,
-                CBEN,   1,
-                LPEN,   1,
-                FDEN,   1
-            }
-        }
-    }
-
-/****************************************************************
  * PCI IRQs
  ****************************************************************/
 
@@ -285,19 +252,6 @@ DefinitionBlock (
             }
         }
 
-        Field(PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
-            PRQA,   8,
-            PRQB,   8,
-            PRQC,   8,
-            PRQD,   8,
-
-            Offset(0x08),
-            PRQE,   8,
-            PRQF,   8,
-            PRQG,   8,
-            PRQH,   8
-        }
-
         External(LNKA, DeviceObj)
         External(LNKB, DeviceObj)
         External(LNKC, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 66/74] pc: acpi: q35: move _PRT() into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (64 preceding siblings ...)
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 65/74] pc: acpi: q35: move ISA bridge " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 67/74] pc: acpi: q35: move PRTA routing table " Igor Mammedov
                   ` (10 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 21 +++++++++++++++++++++
 hw/i386/q35-acpi-dsdt.dsl | 12 ------------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 876605d..744f047 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1553,7 +1553,28 @@ static void build_piix4_pci0_int(Aml *table)
 static void build_q35_pci0_int(Aml *table)
 {
     Aml *field;
+    Aml *method;
     Aml *sb_scope = aml_scope("_SB");
+    Aml *pci0_scope = aml_scope("PCI0");
+
+    method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
+    {
+        Aml *if_ctx;
+        Aml *else_ctx;
+
+        /* PCI IRQ routing table, example from ACPI 2.0a specification,
+           section 6.2.8.1 */
+        /* Note: we provide the same info as the PCI routing
+           table of the Bochs BIOS */
+        if_ctx = aml_if(aml_equal(aml_name("PICF"), aml_int(0)));
+        aml_append(if_ctx, aml_return(aml_name("PRTP")));
+        aml_append(method, if_ctx);
+        else_ctx = aml_else();
+        aml_append(else_ctx, aml_return(aml_name("PRTA")));
+        aml_append(method, else_ctx);
+    }
+    aml_append(pci0_scope, method);
+    aml_append(sb_scope, pci0_scope);
 
     field = aml_field("PCI0.ISA.PIRQ", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
     aml_append(field, aml_named_field("PRQA", 8));
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index b01d4de..f265583 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -238,18 +238,6 @@ DefinitionBlock (
 
                 prt_slot_gsiA(0x001f)
             })
-
-            Method(_PRT, 0, NotSerialized) {
-                /* PCI IRQ routing table, example from ACPI 2.0a specification,
-                   section 6.2.8.1 */
-                /* Note: we provide the same info as the PCI routing
-                   table of the Bochs BIOS */
-                If (LEqual(\PICF, Zero)) {
-                    Return (PRTP)
-                } Else {
-                    Return (PRTA)
-                }
-            }
         }
 
         External(LNKA, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 67/74] pc: acpi: q35: move PRTA routing table into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (65 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 66/74] pc: acpi: q35: move _PRT() " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 68/74] pc: acpi: q35: move PRTP " Igor Mammedov
                   ` (9 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 61 +++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/q35-acpi-dsdt.dsl | 57 -------------------------------------------
 2 files changed, 61 insertions(+), 57 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 744f047..0008d9f 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1550,6 +1550,64 @@ static void build_piix4_pci0_int(Aml *table)
     aml_append(table, sb_scope);
 }
 
+static void append_q35_prt_entry(Aml *ctx, uint32_t nr, const char *name)
+{
+    int i;
+    int head;
+    Aml *pkg;
+    char base = name[3] < 'E' ? 'A' : 'E';
+    char *s = g_strdup(name);
+    Aml *a_nr = aml_int((nr << 16) | 0xffff);
+
+    assert(strlen(s) == 4);
+
+    head = name[3] - base;
+    for (i = 0; i < 4; i++) {
+        if (head + i > 3) {
+            head = i * -1;
+        }
+        s[3] = base + head + i;
+        pkg = aml_package(4);
+        aml_append(pkg, a_nr);
+        aml_append(pkg, aml_int(i));
+        aml_append(pkg, aml_name("%s", s));
+        aml_append(pkg, aml_int(0));
+        aml_append(ctx, pkg);
+    }
+    g_free(s);
+}
+
+static Aml *build_q35_routing_table(const char *str)
+{
+    int i;
+    Aml *pkg;
+    char *name = g_strdup_printf("%s ", str);
+
+    pkg = aml_package(128);
+    for (i = 0; i < 0x18; i++) {
+            name[3] = 'E' + (i & 0x3);
+            append_q35_prt_entry(pkg, i, name);
+    }
+
+    name[3] = 'E';
+    append_q35_prt_entry(pkg, 0x18, name);
+
+    /* INTA -> PIRQA for slot 25 - 31, see the default value of D<N>IR */
+    for (i = 0x0019; i < 0x1e; i++) {
+        name[3] = 'A';
+        append_q35_prt_entry(pkg, i, name);
+    }
+
+    /* PCIe->PCI bridge. use PIRQ[E-H] */
+    name[3] = 'E';
+    append_q35_prt_entry(pkg, 0x1e, name);
+    name[3] = 'A';
+    append_q35_prt_entry(pkg, 0x1f, name);
+
+    g_free(name);
+    return pkg;
+}
+
 static void build_q35_pci0_int(Aml *table)
 {
     Aml *field;
@@ -1557,6 +1615,9 @@ static void build_q35_pci0_int(Aml *table)
     Aml *sb_scope = aml_scope("_SB");
     Aml *pci0_scope = aml_scope("PCI0");
 
+    aml_append(pci0_scope,
+        aml_name_decl("PRTA", build_q35_routing_table("GSI")));
+
     method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
     {
         Aml *if_ctx;
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index f265583..a3073ad 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -181,63 +181,6 @@ DefinitionBlock (
 
                 prt_slot_lnkA(0x001f)
             })
-
-#define prt_slot_gsi(nr, gsi0, gsi1, gsi2, gsi3)  \
-    Package() { nr##ffff, 0, gsi0, 0 },           \
-    Package() { nr##ffff, 1, gsi1, 0 },           \
-    Package() { nr##ffff, 2, gsi2, 0 },           \
-    Package() { nr##ffff, 3, gsi3, 0 }
-
-#define prt_slot_gsiA(nr) prt_slot_gsi(nr, GSIA, GSIB, GSIC, GSID)
-#define prt_slot_gsiB(nr) prt_slot_gsi(nr, GSIB, GSIC, GSID, GSIA)
-#define prt_slot_gsiC(nr) prt_slot_gsi(nr, GSIC, GSID, GSIA, GSIB)
-#define prt_slot_gsiD(nr) prt_slot_gsi(nr, GSID, GSIA, GSIB, GSIC)
-
-#define prt_slot_gsiE(nr) prt_slot_gsi(nr, GSIE, GSIF, GSIG, GSIH)
-#define prt_slot_gsiF(nr) prt_slot_gsi(nr, GSIF, GSIG, GSIH, GSIE)
-#define prt_slot_gsiG(nr) prt_slot_gsi(nr, GSIG, GSIH, GSIE, GSIF)
-#define prt_slot_gsiH(nr) prt_slot_gsi(nr, GSIH, GSIE, GSIF, GSIG)
-
-            Name(PRTA, package() {
-                prt_slot_gsiE(0x0000),
-                prt_slot_gsiF(0x0001),
-                prt_slot_gsiG(0x0002),
-                prt_slot_gsiH(0x0003),
-                prt_slot_gsiE(0x0004),
-                prt_slot_gsiF(0x0005),
-                prt_slot_gsiG(0x0006),
-                prt_slot_gsiH(0x0007),
-                prt_slot_gsiE(0x0008),
-                prt_slot_gsiF(0x0009),
-                prt_slot_gsiG(0x000a),
-                prt_slot_gsiH(0x000b),
-                prt_slot_gsiE(0x000c),
-                prt_slot_gsiF(0x000d),
-                prt_slot_gsiG(0x000e),
-                prt_slot_gsiH(0x000f),
-                prt_slot_gsiE(0x0010),
-                prt_slot_gsiF(0x0011),
-                prt_slot_gsiG(0x0012),
-                prt_slot_gsiH(0x0013),
-                prt_slot_gsiE(0x0014),
-                prt_slot_gsiF(0x0015),
-                prt_slot_gsiG(0x0016),
-                prt_slot_gsiH(0x0017),
-                prt_slot_gsiE(0x0018),
-
-                /* INTA -> PIRQA for slot 25 - 31, but 30
-                   see the default value of D<N>IR */
-                prt_slot_gsiA(0x0019),
-                prt_slot_gsiA(0x001a),
-                prt_slot_gsiA(0x001b),
-                prt_slot_gsiA(0x001c),
-                prt_slot_gsiA(0x001d),
-
-                /* PCIe->PCI bridge. use PIRQ[E-H] */
-                prt_slot_gsiE(0x001e),
-
-                prt_slot_gsiA(0x001f)
-            })
         }
 
         External(LNKA, DeviceObj)
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 68/74] pc: acpi: q35: move PRTP routing table into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (66 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 67/74] pc: acpi: q35: move PRTA routing table " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 69/74] pc: acpi: q35: move _PIC() method " Igor Mammedov
                   ` (8 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      |  2 ++
 hw/i386/q35-acpi-dsdt.dsl | 79 -----------------------------------------------
 2 files changed, 2 insertions(+), 79 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 0008d9f..b54fb0a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1616,6 +1616,8 @@ static void build_q35_pci0_int(Aml *table)
     Aml *pci0_scope = aml_scope("PCI0");
 
     aml_append(pci0_scope,
+        aml_name_decl("PRTP", build_q35_routing_table("LNK")));
+    aml_append(pci0_scope,
         aml_name_decl("PRTA", build_q35_routing_table("GSI")));
 
     method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index a3073ad..34485e7 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -122,83 +122,4 @@ DefinitionBlock (
     Method(\_PIC, 1, NotSerialized) {
         Store(Arg0, \PICF)
     }
-
-    Scope(\_SB) {
-        Scope(PCI0) {
-#define prt_slot_lnk(nr, lnk0, lnk1, lnk2, lnk3)  \
-    Package() { nr##ffff, 0, lnk0, 0 },           \
-    Package() { nr##ffff, 1, lnk1, 0 },           \
-    Package() { nr##ffff, 2, lnk2, 0 },           \
-    Package() { nr##ffff, 3, lnk3, 0 }
-
-#define prt_slot_lnkA(nr) prt_slot_lnk(nr, LNKA, LNKB, LNKC, LNKD)
-#define prt_slot_lnkB(nr) prt_slot_lnk(nr, LNKB, LNKC, LNKD, LNKA)
-#define prt_slot_lnkC(nr) prt_slot_lnk(nr, LNKC, LNKD, LNKA, LNKB)
-#define prt_slot_lnkD(nr) prt_slot_lnk(nr, LNKD, LNKA, LNKB, LNKC)
-
-#define prt_slot_lnkE(nr) prt_slot_lnk(nr, LNKE, LNKF, LNKG, LNKH)
-#define prt_slot_lnkF(nr) prt_slot_lnk(nr, LNKF, LNKG, LNKH, LNKE)
-#define prt_slot_lnkG(nr) prt_slot_lnk(nr, LNKG, LNKH, LNKE, LNKF)
-#define prt_slot_lnkH(nr) prt_slot_lnk(nr, LNKH, LNKE, LNKF, LNKG)
-
-            Name(PRTP, package() {
-                prt_slot_lnkE(0x0000),
-                prt_slot_lnkF(0x0001),
-                prt_slot_lnkG(0x0002),
-                prt_slot_lnkH(0x0003),
-                prt_slot_lnkE(0x0004),
-                prt_slot_lnkF(0x0005),
-                prt_slot_lnkG(0x0006),
-                prt_slot_lnkH(0x0007),
-                prt_slot_lnkE(0x0008),
-                prt_slot_lnkF(0x0009),
-                prt_slot_lnkG(0x000a),
-                prt_slot_lnkH(0x000b),
-                prt_slot_lnkE(0x000c),
-                prt_slot_lnkF(0x000d),
-                prt_slot_lnkG(0x000e),
-                prt_slot_lnkH(0x000f),
-                prt_slot_lnkE(0x0010),
-                prt_slot_lnkF(0x0011),
-                prt_slot_lnkG(0x0012),
-                prt_slot_lnkH(0x0013),
-                prt_slot_lnkE(0x0014),
-                prt_slot_lnkF(0x0015),
-                prt_slot_lnkG(0x0016),
-                prt_slot_lnkH(0x0017),
-                prt_slot_lnkE(0x0018),
-
-                /* INTA -> PIRQA for slot 25 - 31
-                   see the default value of D<N>IR */
-                prt_slot_lnkA(0x0019),
-                prt_slot_lnkA(0x001a),
-                prt_slot_lnkA(0x001b),
-                prt_slot_lnkA(0x001c),
-                prt_slot_lnkA(0x001d),
-
-                /* PCIe->PCI bridge. use PIRQ[E-H] */
-                prt_slot_lnkE(0x001e),
-
-                prt_slot_lnkA(0x001f)
-            })
-        }
-
-        External(LNKA, DeviceObj)
-        External(LNKB, DeviceObj)
-        External(LNKC, DeviceObj)
-        External(LNKD, DeviceObj)
-        External(LNKE, DeviceObj)
-        External(LNKF, DeviceObj)
-        External(LNKG, DeviceObj)
-        External(LNKH, DeviceObj)
-
-        External(GSIA, DeviceObj)
-        External(GSIB, DeviceObj)
-        External(GSIC, DeviceObj)
-        External(GSID, DeviceObj)
-        External(GSIE, DeviceObj)
-        External(GSIF, DeviceObj)
-        External(GSIG, DeviceObj)
-        External(GSIH, DeviceObj)
-    }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 69/74] pc: acpi: q35: move _PIC() method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (67 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 68/74] pc: acpi: q35: move PRTP " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 70/74] pc: acpi: q35: move PCI0._OSC() " Igor Mammedov
                   ` (7 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      |  8 ++++++++
 hw/i386/q35-acpi-dsdt.dsl | 10 ----------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index b54fb0a..bd8d864 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1615,6 +1615,14 @@ static void build_q35_pci0_int(Aml *table)
     Aml *sb_scope = aml_scope("_SB");
     Aml *pci0_scope = aml_scope("PCI0");
 
+    /* Zero => PIC mode, One => APIC Mode */
+    aml_append(table, aml_name_decl("PICF", aml_int(0)));
+    method = aml_method("_PIC", 1, AML_NOTSERIALIZED);
+    {
+        aml_append(method, aml_store(aml_arg(0), aml_name("PICF")));
+    }
+    aml_append(table, method);
+
     aml_append(pci0_scope,
         aml_name_decl("PRTP", build_q35_routing_table("LNK")));
     aml_append(pci0_scope,
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 34485e7..7c7aef7 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -112,14 +112,4 @@ DefinitionBlock (
             }
         }
     }
-
-/****************************************************************
- * PCI IRQs
- ****************************************************************/
-
-    /* Zero => PIC mode, One => APIC Mode */
-    Name(\PICF, Zero)
-    Method(\_PIC, 1, NotSerialized) {
-        Store(Arg0, \PICF)
-    }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 70/74] pc: acpi: q35: move PCI0._OSC() method into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (68 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 69/74] pc: acpi: q35: move _PIC() method " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 71/74] pc: acpi: q35: move PCI0 device definition " Igor Mammedov
                   ` (6 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 56 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/q35-acpi-dsdt.dsl | 57 -----------------------------------------------
 2 files changed, 56 insertions(+), 57 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index bd8d864..59041b3 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1815,6 +1815,54 @@ static void build_piix4_pci_hotplug(Aml *table)
     aml_append(table, scope);
 }
 
+static Aml *build_q35_osc_method(void)
+{
+    Aml *if_ctx;
+    Aml *if_ctx2;
+    Aml *else_ctx;
+    Aml *method;
+    Aml *a_cwd1 = aml_name("CDW1");
+    Aml *a_ctrl = aml_name("CTRL");
+
+    method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
+    aml_append(method, aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
+
+    if_ctx = aml_if(aml_equal(
+        aml_arg(0), aml_touuid("33DB4D5B-1FF7-401C-9657-7441C03DD766")));
+    aml_append(if_ctx, aml_create_dword_field(aml_arg(3), aml_int(4), "CDW2"));
+    aml_append(if_ctx, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));
+
+    aml_append(if_ctx, aml_store(aml_name("CDW2"), aml_name("SUPP")));
+    aml_append(if_ctx, aml_store(aml_name("CDW3"), a_ctrl));
+
+    /*
+     * Always allow native PME, AER (no dependencies)
+     * Never allow SHPC (no SHPC controller in this system)
+     */
+    aml_append(if_ctx, aml_and(a_ctrl, aml_int(0x1D), a_ctrl));
+
+    if_ctx2 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(1))));
+    /* Unknown revision */
+    aml_append(if_ctx2, aml_or(a_cwd1, aml_int(0x08), a_cwd1));
+    aml_append(if_ctx, if_ctx2);
+
+    if_ctx2 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), a_ctrl)));
+    /* Capabilities bits were masked */
+    aml_append(if_ctx2, aml_or(a_cwd1, aml_int(0x10), a_cwd1));
+    aml_append(if_ctx, if_ctx2);
+
+    /* Update DWORD3 in the buffer */
+    aml_append(if_ctx, aml_store(a_ctrl, aml_name("CDW3")));
+    aml_append(method, if_ctx);
+
+    else_ctx = aml_else();
+    /* Unrecognized UUID */
+    aml_append(else_ctx, aml_or(a_cwd1, aml_int(4), a_cwd1));
+    aml_append(method, else_ctx);
+
+    aml_append(method, aml_return(aml_arg(3)));
+    return method;
+}
 
 static void
 build_ssdt(GArray *table_data, GArray *linker,
@@ -1853,6 +1901,14 @@ build_ssdt(GArray *table_data, GArray *linker,
         build_piix4_pci_hotplug(ssdt);
         build_piix4_pci0_int(ssdt);
     } else {
+        sb_scope = aml_scope("_SB");
+        scope = aml_scope("PCI0");
+        aml_append(scope, aml_name_decl("SUPP", aml_int(0)));
+        aml_append(scope, aml_name_decl("CTRL", aml_int(0)));
+        aml_append(scope, build_q35_osc_method());
+        aml_append(sb_scope, scope);
+        aml_append(ssdt, sb_scope);
+
         build_hpet_aml(ssdt);
         build_q35_isa_bridge(ssdt);
         build_isa_devices_aml(ssdt);
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 7c7aef7..b53663c 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -53,63 +53,6 @@ DefinitionBlock (
             Name(_CID, EisaId("PNP0A03"))
             Name(_ADR, 0x00)
             Name(_UID, 1)
-
-            External(ISA, DeviceObj)
-
-            // _OSC: based on sample of ACPI3.0b spec
-            Name(SUPP, 0) // PCI _OSC Support Field value
-            Name(CTRL, 0) // PCI _OSC Control Field value
-            Method(_OSC, 4) {
-                // Create DWORD-addressable fields from the Capabilities Buffer
-                CreateDWordField(Arg3, 0, CDW1)
-
-                // Check for proper UUID
-                If (LEqual(Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
-                    // Create DWORD-addressable fields from the Capabilities Buffer
-                    CreateDWordField(Arg3, 4, CDW2)
-                    CreateDWordField(Arg3, 8, CDW3)
-
-                    // Save Capabilities DWORD2 & 3
-                    Store(CDW2, SUPP)
-                    Store(CDW3, CTRL)
-
-                    // Always allow native PME, AER (no dependencies)
-                    // Never allow SHPC (no SHPC controller in this system)
-                    And(CTRL, 0x1D, CTRL)
-
-#if 0 // For now, nothing to do
-                    If (Not(And(CDW1, 1))) { // Query flag clear?
-                        // Disable GPEs for features granted native control.
-                        If (And(CTRL, 0x01)) { // Hot plug control granted?
-                            Store(0, HPCE) // clear the hot plug SCI enable bit
-                            Store(1, HPCS) // clear the hot plug SCI status bit
-                        }
-                        If (And(CTRL, 0x04)) { // PME control granted?
-                            Store(0, PMCE) // clear the PME SCI enable bit
-                            Store(1, PMCS) // clear the PME SCI status bit
-                        }
-                        If (And(CTRL, 0x10)) { // OS restoring PCI Express cap structure?
-                            // Set status to not restore PCI Express cap structure
-                            // upon resume from S3
-                            Store(1, S3CR)
-                        }
-                    }
-#endif
-                    If (LNotEqual(Arg1, One)) {
-                        // Unknown revision
-                        Or(CDW1, 0x08, CDW1)
-                    }
-                    If (LNotEqual(CDW3, CTRL)) {
-                        // Capabilities bits were masked
-                        Or(CDW1, 0x10, CDW1)
-                    }
-                    // Update DWORD3 in the buffer
-                    Store(CTRL, CDW3)
-                } Else {
-                    Or(CDW1, 4, CDW1) // Unrecognized UUID
-                }
-                Return (Arg3)
-            }
         }
     }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 71/74] pc: acpi: q35: move PCI0 device definition into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (69 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 70/74] pc: acpi: q35: move PCI0._OSC() " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 72/74] pc: acpi: q35: PCST, PCSB opregions and PCIB field " Igor Mammedov
                   ` (5 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 14 +++++++++-----
 hw/i386/q35-acpi-dsdt.dsl | 13 -------------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 59041b3..b546516 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1902,11 +1902,15 @@ build_ssdt(GArray *table_data, GArray *linker,
         build_piix4_pci0_int(ssdt);
     } else {
         sb_scope = aml_scope("_SB");
-        scope = aml_scope("PCI0");
-        aml_append(scope, aml_name_decl("SUPP", aml_int(0)));
-        aml_append(scope, aml_name_decl("CTRL", aml_int(0)));
-        aml_append(scope, build_q35_osc_method());
-        aml_append(sb_scope, scope);
+        dev = aml_device("PCI0");
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
+        aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
+        aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
+        aml_append(dev, aml_name_decl("_UID", aml_int(1)));
+        aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
+        aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
+        aml_append(dev, build_q35_osc_method());
+        aml_append(sb_scope, dev);
         aml_append(ssdt, sb_scope);
 
         build_hpet_aml(ssdt);
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index b53663c..f234f5c 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -42,17 +42,4 @@ DefinitionBlock (
             PCIB, 8,
         }
     }
-
-
-/****************************************************************
- * PCI Bus definition
- ****************************************************************/
-    Scope(\_SB) {
-        Device(PCI0) {
-            Name(_HID, EisaId("PNP0A08"))
-            Name(_CID, EisaId("PNP0A03"))
-            Name(_ADR, 0x00)
-            Name(_UID, 1)
-        }
-    }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 72/74] pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (70 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 71/74] pc: acpi: q35: move PCI0 device definition " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 73/74] pc: acpi: switch to AML API composed DSDT Igor Mammedov
                   ` (4 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c      | 10 ++++++++++
 hw/i386/q35-acpi-dsdt.dsl |  5 -----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index b546516..4808a53 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1902,6 +1902,16 @@ build_ssdt(GArray *table_data, GArray *linker,
         build_piix4_pci0_int(ssdt);
     } else {
         sb_scope = aml_scope("_SB");
+        aml_append(sb_scope,
+            aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x0c));
+        aml_append(sb_scope,
+            aml_operation_region("PCSB", AML_SYSTEM_IO, 0xae0c, 0x01));
+        field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS);
+        aml_append(field, aml_named_field("PCIB", 8));
+        aml_append(sb_scope, field);
+        aml_append(ssdt, sb_scope);
+
+        sb_scope = aml_scope("_SB");
         dev = aml_device("PCI0");
         aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
         aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index f234f5c..3ecdb50 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -36,10 +36,5 @@ DefinitionBlock (
 {
 
     Scope(\_SB) {
-        OperationRegion(PCST, SystemIO, 0xae00, 0x0c)
-        OperationRegion(PCSB, SystemIO, 0xae0c, 0x01)
-        Field(PCSB, AnyAcc, NoLock, WriteAsZeros) {
-            PCIB, 8,
-        }
     }
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 73/74] pc: acpi: switch to AML API composed DSDT
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (71 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 72/74] pc: acpi: q35: PCST, PCSB opregions and PCIB field " Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 74/74] pc: acpi: remove unused ASL templates and related blobs/utils Igor Mammedov
                   ` (3 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c | 228 +++++++++++++++++++++++++--------------------------
 1 file changed, 112 insertions(+), 116 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4808a53..36c5a4e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -52,9 +52,6 @@
 #include "hw/i386/intel_iommu.h"
 #include "hw/timer/hpet.h"
 
-#include "hw/i386/q35-acpi-dsdt.hex"
-#include "hw/i386/acpi-dsdt.hex"
-
 #include "hw/acpi/aml-build.h"
 
 #include "qapi/qmp/qint.h"
@@ -123,24 +120,6 @@ typedef struct AcpiBuildPciBusHotplugState {
     bool pcihp_bridge_en;
 } AcpiBuildPciBusHotplugState;
 
-static void acpi_get_dsdt(AcpiMiscInfo *info)
-{
-    Object *piix = piix4_pm_find();
-    Object *lpc = ich9_lpc_find();
-    assert(!!piix != !!lpc);
-
-    if (piix) {
-        info->is_piix4 = true;
-        info->dsdt_code = AcpiDsdtAmlCode;
-        info->dsdt_size = sizeof AcpiDsdtAmlCode;
-    }
-    if (lpc) {
-        info->is_piix4 = false;
-        info->dsdt_code = Q35AcpiDsdtAmlCode;
-        info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
-    }
-}
-
 static
 int acpi_add_cpu_info(Object *o, void *opaque)
 {
@@ -239,6 +218,17 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
 
 static void acpi_get_misc_info(AcpiMiscInfo *info)
 {
+    Object *piix = piix4_pm_find();
+    Object *lpc = ich9_lpc_find();
+    assert(!!piix != !!lpc);
+
+    if (piix) {
+        info->is_piix4 = true;
+    }
+    if (lpc) {
+        info->is_piix4 = false;
+    }
+
     info->has_hpet = hpet_find();
     info->tpm_version = tpm_get_version();
     info->pvpanic_port = pvpanic_port();
@@ -1884,91 +1874,6 @@ build_ssdt(GArray *table_data, GArray *linker,
     /* Reserve space for header */
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
-    build_dbg_aml(ssdt);
-    if (misc->is_piix4) {
-        sb_scope = aml_scope("_SB");
-        dev = aml_device("PCI0");
-        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
-        aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
-        aml_append(dev, aml_name_decl("_UID", aml_int(1)));
-        aml_append(sb_scope, dev);
-        aml_append(ssdt, sb_scope);
-
-        build_hpet_aml(ssdt);
-        build_piix4_pm(ssdt);
-        build_piix4_isa_bridge(ssdt);
-        build_isa_devices_aml(ssdt);
-        build_piix4_pci_hotplug(ssdt);
-        build_piix4_pci0_int(ssdt);
-    } else {
-        sb_scope = aml_scope("_SB");
-        aml_append(sb_scope,
-            aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x0c));
-        aml_append(sb_scope,
-            aml_operation_region("PCSB", AML_SYSTEM_IO, 0xae0c, 0x01));
-        field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS);
-        aml_append(field, aml_named_field("PCIB", 8));
-        aml_append(sb_scope, field);
-        aml_append(ssdt, sb_scope);
-
-        sb_scope = aml_scope("_SB");
-        dev = aml_device("PCI0");
-        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
-        aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
-        aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
-        aml_append(dev, aml_name_decl("_UID", aml_int(1)));
-        aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
-        aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
-        aml_append(dev, build_q35_osc_method());
-        aml_append(sb_scope, dev);
-        aml_append(ssdt, sb_scope);
-
-        build_hpet_aml(ssdt);
-        build_q35_isa_bridge(ssdt);
-        build_isa_devices_aml(ssdt);
-        build_q35_pci0_int(ssdt);
-    }
-
-    build_cpu_hotplug_aml(ssdt);
-    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
-                             pm->mem_hp_io_len);
-
-    scope =  aml_scope("_GPE");
-    {
-        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
-
-        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
-        aml_append(scope, method);
-
-        if (misc->is_piix4) {
-            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
-            aml_append(method,
-                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
-            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
-            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
-            aml_append(scope, method);
-        } else {
-            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
-            aml_append(scope, method);
-        }
-
-        method = aml_method("_E02", 0, AML_NOTSERIALIZED);
-        aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
-        aml_append(scope, method);
-
-        method = aml_method("_E03", 0, AML_NOTSERIALIZED);
-        aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
-        aml_append(scope, method);
-
-        for (i = 4; i <= 0xF; i++) {
-            char *name = g_strdup_printf("_L0%X", i);
-            method = aml_method(name, 0, AML_NOTSERIALIZED);
-            aml_append(scope, method);
-            g_free(name);
-        }
-    }
-    aml_append(ssdt, scope);
-
     /* Extra PCI root buses are implemented  only for i440fx */
     bus = find_i440fx();
     if (bus) {
@@ -2439,18 +2344,110 @@ build_dmar_q35(GArray *table_data, GArray *linker)
 }
 
 static void
-build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
+build_dsdt(GArray *table_data, GArray *linker,
+           AcpiPmInfo *pm, AcpiMiscInfo *misc)
 {
-    AcpiTableHeader *dsdt;
+    int i;
+    Aml *dsdt, *sb_scope, *scope, *dev, *method, *field;
+    MachineState *machine = MACHINE(qdev_get_machine());
+    uint32_t nr_mem = machine->ram_slots;
 
-    assert(misc->dsdt_code && misc->dsdt_size);
+    dsdt = init_aml_allocator();
 
-    dsdt = acpi_data_push(table_data, misc->dsdt_size);
-    memcpy(dsdt, misc->dsdt_code, misc->dsdt_size);
+    /* Reserve space for header */
+    acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));
+
+    build_dbg_aml(dsdt);
+    if (misc->is_piix4) {
+        sb_scope = aml_scope("_SB");
+        dev = aml_device("PCI0");
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
+        aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
+        aml_append(dev, aml_name_decl("_UID", aml_int(1)));
+        aml_append(sb_scope, dev);
+        aml_append(dsdt, sb_scope);
+
+        build_hpet_aml(dsdt);
+        build_piix4_pm(dsdt);
+        build_piix4_isa_bridge(dsdt);
+        build_isa_devices_aml(dsdt);
+        build_piix4_pci_hotplug(dsdt);
+        build_piix4_pci0_int(dsdt);
+    } else {
+        sb_scope = aml_scope("_SB");
+        aml_append(sb_scope,
+            aml_operation_region("PCST", AML_SYSTEM_IO, 0xae00, 0x0c));
+        aml_append(sb_scope,
+            aml_operation_region("PCSB", AML_SYSTEM_IO, 0xae0c, 0x01));
+        field = aml_field("PCSB", AML_ANY_ACC, AML_NOLOCK, AML_WRITE_AS_ZEROS);
+        aml_append(field, aml_named_field("PCIB", 8));
+        aml_append(sb_scope, field);
+        aml_append(dsdt, sb_scope);
+
+        sb_scope = aml_scope("_SB");
+        dev = aml_device("PCI0");
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
+        aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
+        aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
+        aml_append(dev, aml_name_decl("_UID", aml_int(1)));
+        aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
+        aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
+        aml_append(dev, build_q35_osc_method());
+        aml_append(sb_scope, dev);
+        aml_append(dsdt, sb_scope);
 
-    memset(dsdt, 0, sizeof *dsdt);
-    build_header(linker, table_data, dsdt, "DSDT",
-                 misc->dsdt_size, 1);
+        build_hpet_aml(dsdt);
+        build_q35_isa_bridge(dsdt);
+        build_isa_devices_aml(dsdt);
+        build_q35_pci0_int(dsdt);
+    }
+
+    build_cpu_hotplug_aml(dsdt);
+    build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
+                             pm->mem_hp_io_len);
+
+    scope =  aml_scope("_GPE");
+    {
+        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
+
+        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
+        aml_append(scope, method);
+
+        if (misc->is_piix4) {
+            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
+            aml_append(method,
+                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
+            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
+            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
+            aml_append(scope, method);
+        } else {
+            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
+            aml_append(scope, method);
+        }
+
+        method = aml_method("_E02", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
+        aml_append(scope, method);
+
+        method = aml_method("_E03", 0, AML_NOTSERIALIZED);
+        aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
+        aml_append(scope, method);
+
+        for (i = 4; i <= 0xF; i++) {
+            char *name = g_strdup_printf("_L0%X", i);
+            method = aml_method(name, 0, AML_NOTSERIALIZED);
+            aml_append(scope, method);
+            g_free(name);
+        }
+    }
+    aml_append(dsdt, scope);
+
+    /* copy AML table into ACPI tables blob and patch header there */
+    g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
+    build_header(linker, table_data,
+        (void *)(table_data->data + table_data->len - dsdt->buf->len),
+        "DSDT", dsdt->buf->len, 1);
+    free_aml_allocator();
 }
 
 static GArray *
@@ -2537,7 +2534,6 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
 
     acpi_get_cpu_info(&cpu);
     acpi_get_pm_info(&pm);
-    acpi_get_dsdt(&misc);
     acpi_get_misc_info(&misc);
     acpi_get_pci_info(&pci);
 
@@ -2559,7 +2555,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
 
     /* DSDT is pointed to by FADT */
     dsdt = tables_blob->len;
-    build_dsdt(tables_blob, tables->linker, &misc);
+    build_dsdt(tables_blob, tables->linker, &pm, &misc);
 
     /* Count the size of the DSDT and SSDT, we will need it for legacy
      * sizing of ACPI tables.
-- 
1.8.3.1

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

* [Qemu-devel] [PATCH 74/74] pc: acpi: remove unused ASL templates and related blobs/utils
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (72 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 73/74] pc: acpi: switch to AML API composed DSDT Igor Mammedov
@ 2015-12-09 23:42 ` Igor Mammedov
  2015-12-10 15:53 ` [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Marcel Apfelbaum
                   ` (2 subsequent siblings)
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-09 23:42 UTC (permalink / raw)
  To: qemu-devel

QEMU now uses internally composed DSDT so drop now
empty *.dsl templates and related *.generated
binary blobs.

Also since templates are not used anymore/obolete
remove utility scripts used for extracting/patching
AML blobs compiled by IASL and for updating them
in git tree.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/Makefile.objs               |   31 +-
 hw/i386/acpi-dsdt.dsl               |   33 -
 hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
 hw/i386/q35-acpi-dsdt.dsl           |   40 -
 hw/i386/q35-acpi-dsdt.hex.generated | 7610 -----------------------------------
 scripts/acpi_extract.py             |  367 --
 scripts/acpi_extract_preprocess.py  |   51 -
 scripts/update-acpi.sh              |    4 -
 8 files changed, 1 insertion(+), 11107 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt.dsl
 delete mode 100644 hw/i386/acpi-dsdt.hex.generated
 delete mode 100644 hw/i386/q35-acpi-dsdt.dsl
 delete mode 100644 hw/i386/q35-acpi-dsdt.hex.generated
 delete mode 100755 scripts/acpi_extract.py
 delete mode 100755 scripts/acpi_extract_preprocess.py
 delete mode 100644 scripts/update-acpi.sh

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index c250deb..fd4a524 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -8,33 +8,4 @@ obj-$(CONFIG_XEN) += ../xenpv/ xen/
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
 obj-y += pci-assign-load-rom.o
-
-gen-hex-y += hw/i386/acpi-dsdt.hex
-gen-hex-y += hw/i386/q35-acpi-dsdt.hex
-
-hw/i386/acpi-build.o: hw/i386/acpi-build.c \
-	$(gen-hex-y)
-
--include $(gen-hex-y:.hex=.d)
-
-iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
-    ; then echo "$(2)"; else echo "$(3)"; fi ;)
-
-ifdef IASL
-#IASL Present. Generate hex files from .dsl
-hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py
-	$(call quiet-command, $(CPP) -x c -P $(QEMU_DGFLAGS) $(QEMU_INCLUDES) $< -o $*.dsl.i.orig, "  CPP $(TARGET_DIR)$*.dsl.i.orig")
-	$(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, "  ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i")
-	$(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ,"  IASL $(TARGET_DIR)$*.dsl.i")
-	$(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, "  ACPI_EXTRACT $(TARGET_DIR)$*.off")
-	$(call quiet-command, cat $*.off > $@, "  CAT $(TARGET_DIR)$@")
-else
-#IASL Not present. Restore pre-generated hex files.
-hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.hex.generated
-	$(call quiet-command, cp -f $< $@, "  CP $(TARGET_DIR)$@")
-endif
-
-.PHONY: cleanhex
-cleanhex:
-	rm -f hw/i386/*hex
-clean: cleanhex
+obj-y += acpi-build.o
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
deleted file mode 100644
index 82e4470..0000000
--- a/hw/i386/acpi-dsdt.dsl
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Bochs/QEMU ACPI DSDT ASL definition
- *
- * Copyright (c) 2006 Fabrice Bellard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-ACPI_EXTRACT_ALL_CODE AcpiDsdtAmlCode
-
-DefinitionBlock (
-    "acpi-dsdt.aml",    // Output Filename
-    "DSDT",             // Signature
-    0x01,               // DSDT Compliance Revision
-    "BXPC",             // OEMID
-    "BXDSDT",           // TABLE ID
-    0x1                 // OEM Revision
-    )
-{
-    Scope(\_SB) {
-    }
-}
diff --git a/hw/i386/acpi-dsdt.hex.generated b/hw/i386/acpi-dsdt.hex.generated
deleted file mode 100644
index ecaa4a5..0000000
--- a/hw/i386/acpi-dsdt.hex.generated
+++ /dev/null
@@ -1,2972 +0,0 @@
-static unsigned char AcpiDsdtAmlCode[] = {
-0x44,
-0x53,
-0x44,
-0x54,
-0x9a,
-0xb,
-0x0,
-0x0,
-0x1,
-0x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0x43,
-0x52,
-0x53,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x43,
-0x52,
-0x50,
-0x52,
-0x51,
-0x31,
-0x14,
-0x17,
-0x5f,
-0x53,
-0x52,
-0x53,
-0x1,
-0x8a,
-0x68,
-0xa,
-0x5,
-0x50,
-0x52,
-0x52,
-0x49,
-0x70,
-0x50,
-0x52,
-0x52,
-0x49,
-0x50,
-0x52,
-0x51,
-0x31,
-0x5b,
-0x82,
-0x4d,
-0x7,
-0x4c,
-0x4e,
-0x4b,
-0x43,
-0x8,
-0x5f,
-0x48,
-0x49,
-0x44,
-0xc,
-0x41,
-0xd0,
-0xc,
-0xf,
-0x8,
-0x5f,
-0x55,
-0x49,
-0x44,
-0xa,
-0x2,
-0x8,
-0x5f,
-0x50,
-0x52,
-0x53,
-0x11,
-0x16,
-0xa,
-0x13,
-0x89,
-0xe,
-0x0,
-0x9,
-0x3,
-0x5,
-0x0,
-0x0,
-0x0,
-0xa,
-0x0,
-0x0,
-0x0,
-0xb,
-0x0,
-0x0,
-0x0,
-0x79,
-0x0,
-0x14,
-0xf,
-0x5f,
-0x53,
-0x54,
-0x41,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x53,
-0x54,
-0x50,
-0x52,
-0x51,
-0x32,
-0x14,
-0x11,
-0x5f,
-0x44,
-0x49,
-0x53,
-0x0,
-0x7d,
-0x50,
-0x52,
-0x51,
-0x32,
-0xa,
-0x80,
-0x50,
-0x52,
-0x51,
-0x32,
-0x14,
-0xf,
-0x5f,
-0x43,
-0x52,
-0x53,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x43,
-0x52,
-0x50,
-0x52,
-0x51,
-0x32,
-0x14,
-0x17,
-0x5f,
-0x53,
-0x52,
-0x53,
-0x1,
-0x8a,
-0x68,
-0xa,
-0x5,
-0x50,
-0x52,
-0x52,
-0x49,
-0x70,
-0x50,
-0x52,
-0x52,
-0x49,
-0x50,
-0x52,
-0x51,
-0x32,
-0x5b,
-0x82,
-0x4d,
-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pi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
deleted file mode 100644
index 3ecdb50..0000000
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Bochs/QEMU ACPI DSDT ASL definition
- *
- * Copyright (c) 2006 Fabrice Bellard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
- */
-/*
- * Copyright (c) 2010 Isaku Yamahata
- *                    yamahata at valinux co jp
- * Based on acpi-dsdt.dsl, but heavily modified for q35 chipset.
- */
-
-
-ACPI_EXTRACT_ALL_CODE Q35AcpiDsdtAmlCode
-
-DefinitionBlock (
-    "q35-acpi-dsdt.aml",// Output Filename
-    "DSDT",             // Signature
-    0x01,               // DSDT Compliance Revision
-    "BXPC",             // OEMID
-    "BXDSDT",           // TABLE ID
-    0x2                 // OEM Revision
-    )
-{
-
-    Scope(\_SB) {
-    }
-}
diff --git a/hw/i386/q35-acpi-dsdt.hex.generated b/hw/i386/q35-acpi-dsdt.hex.generated
deleted file mode 100644
index ed9a2cc..0000000
--- a/hw/i386/q35-acpi-dsdt.hex.generated
+++ /dev/null
@@ -1,7610 +0,0 @@
-static unsigned char Q35AcpiDsdtAmlCode[] = {
-0x44,
-0x53,
-0x44,
-0x54,
-0xb8,
-0x1d,
-0x0,
-0x0,
-0x1,
-0x35,
-0x42,
-0x58,
-0x50,
-0x43,
-0x0,
-0x0,
-0x42,
-0x58,
-0x44,
-0x53,
-0x44,
-0x54,
-0x0,
-0x0,
-0x2,
-0x0,
-0x0,
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
-0x5f,
-0x55,
-0x49,
-0x44,
-0x1,
-0x8,
-0x53,
-0x55,
-0x50,
-0x50,
-0x0,
-0x8,
-0x43,
-0x54,
-0x52,
-0x4c,
-0x0,
-0x14,
-0x44,
-0x9,
-0x5f,
-0x4f,
-0x53,
-0x43,
-0x4,
-0x8a,
-0x6b,
-0x0,
-0x43,
-0x44,
-0x57,
-0x31,
-0xa0,
-0x46,
-0x7,
-0x93,
-0x68,
-0x11,
-0x13,
-0xa,
-0x10,
-0x5b,
-0x4d,
-0xdb,
-0x33,
-0xf7,
-0x1f,
-0x1c,
-0x40,
-0x96,
-0x57,
-0x74,
-0x41,
-0xc0,
-0x3d,
-0xd7,
-0x66,
-0x8a,
-0x6b,
-0xa,
-0x4,
-0x43,
-0x44,
-0x57,
-0x32,
-0x8a,
-0x6b,
-0xa,
-0x8,
-0x43,
-0x44,
-0x57,
-0x33,
-0x70,
-0x43,
-0x44,
-0x57,
-0x32,
-0x53,
-0x55,
-0x50,
-0x50,
-0x70,
-0x43,
-0x44,
-0x57,
-0x33,
-0x43,
-0x54,
-0x52,
-0x4c,
-0x7b,
-0x43,
-0x54,
-0x52,
-0x4c,
-0xa,
-0x1d,
-0x43,
-0x54,
-0x52,
-0x4c,
-0xa0,
-0x10,
-0x92,
-0x93,
-0x69,
-0x1,
-0x7d,
-0x43,
-0x44,
-0x57,
-0x31,
-0xa,
-0x8,
-0x43,
-0x44,
-0x57,
-0x31,
-0xa0,
-0x16,
-0x92,
-0x93,
-0x43,
-0x44,
-0x57,
-0x33,
-0x43,
-0x54,
-0x52,
-0x4c,
-0x7d,
-0x43,
-0x44,
-0x57,
-0x31,
-0xa,
-0x10,
-0x43,
-0x44,
-0x57,
-0x31,
-0x70,
-0x43,
-0x54,
-0x52,
-0x4c,
-0x43,
-0x44,
-0x57,
-0x33,
-0xa1,
-0xc,
-0x7d,
-0x43,
-0x44,
-0x57,
-0x31,
-0xa,
-0x4,
-0x43,
-0x44,
-0x57,
-0x31,
-0xa4,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0x53,
-0x54,
-0x41,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x53,
-0x54,
-0x50,
-0x52,
-0x51,
-0x41,
-0x14,
-0x11,
-0x5f,
-0x44,
-0x49,
-0x53,
-0x0,
-0x7d,
-0x50,
-0x52,
-0x51,
-0x41,
-0xa,
-0x80,
-0x50,
-0x52,
-0x51,
-0x41,
-0x14,
-0xf,
-0x5f,
-0x43,
-0x52,
-0x53,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x43,
-0x52,
-0x50,
-0x52,
-0x51,
-0x41,
-0x14,
-0x17,
-0x5f,
-0x53,
-0x52,
-0x53,
-0x1,
-0x8a,
-0x68,
-0xa,
-0x5,
-0x50,
-0x52,
-0x52,
-0x49,
-0x70,
-0x50,
-0x52,
-0x52,
-0x49,
-0x50,
-0x52,
-0x51,
-0x41,
-0x5b,
-0x82,
-0x4c,
-0x7,
-0x4c,
-0x4e,
-0x4b,
-0x42,
-0x8,
-0x5f,
-0x48,
-0x49,
-0x44,
-0xc,
-0x41,
-0xd0,
-0xc,
-0xf,
-0x8,
-0x5f,
-0x55,
-0x49,
-0x44,
-0x1,
-0x8,
-0x5f,
-0x50,
-0x52,
-0x53,
-0x11,
-0x16,
-0xa,
-0x13,
-0x89,
-0xe,
-0x0,
-0x9,
-0x3,
-0x5,
-0x0,
-0x0,
-0x0,
-0xa,
-0x0,
-0x0,
-0x0,
-0xb,
-0x0,
-0x0,
-0x0,
-0x79,
-0x0,
-0x14,
-0xf,
-0x5f,
-0x53,
-0x54,
-0x41,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x53,
-0x54,
-0x50,
-0x52,
-0x51,
-0x42,
-0x14,
-0x11,
-0x5f,
-0x44,
-0x49,
-0x53,
-0x0,
-0x7d,
-0x50,
-0x52,
-0x51,
-0x42,
-0xa,
-0x80,
-0x50,
-0x52,
-0x51,
-0x42,
-0x14,
-0xf,
-0x5f,
-0x43,
-0x52,
-0x53,
-0x0,
-0xa4,
-0x49,
-0x51,
-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-0x43,
-0x52,
-0x53,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x43,
-0x52,
-0x50,
-0x52,
-0x51,
-0x46,
-0x14,
-0x17,
-0x5f,
-0x53,
-0x52,
-0x53,
-0x1,
-0x8a,
-0x68,
-0xa,
-0x5,
-0x50,
-0x52,
-0x52,
-0x49,
-0x70,
-0x50,
-0x52,
-0x52,
-0x49,
-0x50,
-0x52,
-0x51,
-0x46,
-0x5b,
-0x82,
-0x4d,
-0x7,
-0x4c,
-0x4e,
-0x4b,
-0x47,
-0x8,
-0x5f,
-0x48,
-0x49,
-0x44,
-0xc,
-0x41,
-0xd0,
-0xc,
-0xf,
-0x8,
-0x5f,
-0x55,
-0x49,
-0x44,
-0xa,
-0x6,
-0x8,
-0x5f,
-0x50,
-0x52,
-0x53,
-0x11,
-0x16,
-0xa,
-0x13,
-0x89,
-0xe,
-0x0,
-0x9,
-0x3,
-0x5,
-0x0,
-0x0,
-0x0,
-0xa,
-0x0,
-0x0,
-0x0,
-0xb,
-0x0,
-0x0,
-0x0,
-0x79,
-0x0,
-0x14,
-0xf,
-0x5f,
-0x53,
-0x54,
-0x41,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x53,
-0x54,
-0x50,
-0x52,
-0x51,
-0x47,
-0x14,
-0x11,
-0x5f,
-0x44,
-0x49,
-0x53,
-0x0,
-0x7d,
-0x50,
-0x52,
-0x51,
-0x47,
-0xa,
-0x80,
-0x50,
-0x52,
-0x51,
-0x47,
-0x14,
-0xf,
-0x5f,
-0x43,
-0x52,
-0x53,
-0x0,
-0xa4,
-0x49,
-0x51,
-0x43,
-0x52,
-0x50,
-0x52,
-0x51,
-0x47,
-0x14,
-0x17,
-0x5f,
-0x53,
-0x52,
-0x53,
-0x1,
-0x8a,
-0x68,
-0xa,
-0x5,
-0x50,
-0x52,
-0x52,
-0x49,
-0x70,
-0x50,
-0x52,
-0x52,
-0x49,
-0x50,
-0x52,
-0x51,
-0x47,
-0x5b,
-0x82,
-0x4d,
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
-0x48,
-0x50,
-0x44,
-0x4d,
-0x53,
-0x43,
-0x4e,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x34,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x35,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x36,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x37,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x38,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x39,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x41,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x42,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x43,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x44,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x45,
-0x0,
-0x14,
-0x6,
-0x5f,
-0x4c,
-0x30,
-0x46,
-0x0
-};
diff --git a/scripts/acpi_extract.py b/scripts/acpi_extract.py
deleted file mode 100755
index 10c1ffb..0000000
--- a/scripts/acpi_extract.py
+++ /dev/null
@@ -1,367 +0,0 @@
-#!/usr/bin/python
-# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, see <http://www.gnu.org/licenses/>.
-
-# Process mixed ASL/AML listing (.lst file) produced by iasl -l
-# Locate and execute ACPI_EXTRACT directives, output offset info
-#
-# Documentation of ACPI_EXTRACT_* directive tags:
-#
-# These directive tags output offset information from AML for BIOS runtime
-# table generation.
-# Each directive is of the form:
-# ACPI_EXTRACT_<TYPE> <array_name> <Operator> (...)
-# and causes the extractor to create an array
-# named <array_name> with offset, in the generated AML,
-# of an object of a given type in the following <Operator>.
-#
-# A directive must fit on a single code line.
-#
-# Object type in AML is verified, a mismatch causes a build failure.
-#
-# Directives and operators currently supported are:
-# ACPI_EXTRACT_NAME_DWORD_CONST - extract a Dword Const object from Name()
-# ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name()
-# ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name()
-# ACPI_EXTRACT_METHOD_STRING - extract a NameString from Method()
-# ACPI_EXTRACT_NAME_STRING - extract a NameString from Name()
-# ACPI_EXTRACT_PROCESSOR_START - start of Processor() block
-# ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor()
-# ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1
-# ACPI_EXTRACT_PKG_START - start of Package block
-#
-# ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode
-#
-# ACPI_EXTRACT is not allowed anywhere else in code, except in comments.
-
-import re;
-import sys;
-import fileinput;
-
-aml = []
-asl = []
-output = {}
-debug = ""
-
-class asl_line:
-    line = None
-    lineno = None
-    aml_offset = None
-
-def die(diag):
-    sys.stderr.write("Error: %s; %s\n" % (diag, debug))
-    sys.exit(1)
-
-#Store an ASL command, matching AML offset, and input line (for debugging)
-def add_asl(lineno, line):
-    l = asl_line()
-    l.line = line
-    l.lineno = lineno
-    l.aml_offset = len(aml)
-    asl.append(l)
-
-#Store an AML byte sequence
-#Verify that offset output by iasl matches # of bytes so far
-def add_aml(offset, line):
-    o = int(offset, 16);
-    # Sanity check: offset must match size of code so far
-    if (o != len(aml)):
-        die("Offset 0x%x != 0x%x" % (o, len(aml)))
-    # Strip any trailing dots and ASCII dump after "
-    line = re.sub(r'\s*\.*\s*".*$',"", line)
-    # Strip traling whitespace
-    line = re.sub(r'\s+$',"", line)
-    # Strip leading whitespace
-    line = re.sub(r'^\s+',"", line)
-    # Split on whitespace
-    code = re.split(r'\s+', line)
-    for c in code:
-        # Require a legal hex number, two digits
-        if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))):
-            die("Unexpected octet %s" % c);
-        aml.append(int(c, 16));
-
-# Process aml bytecode array, decoding AML
-def aml_pkglen_bytes(offset):
-    # PkgLength can be multibyte. Bits 8-7 give the # of extra bytes.
-    pkglenbytes = aml[offset] >> 6;
-    return pkglenbytes + 1
-
-def aml_pkglen(offset):
-    pkgstart = offset
-    pkglenbytes = aml_pkglen_bytes(offset)
-    pkglen = aml[offset] & 0x3F
-    # If multibyte, first nibble only uses bits 0-3
-    if ((pkglenbytes > 1) and (pkglen & 0x30)):
-        die("PkgLen bytes 0x%x but first nibble 0x%x expected 0x0X" %
-            (pkglen, pkglen))
-    offset += 1
-    pkglenbytes -= 1
-    for i in range(pkglenbytes):
-        pkglen |= aml[offset + i] << (i * 8 + 4)
-    if (len(aml) < pkgstart + pkglen):
-        die("PckgLen 0x%x at offset 0x%x exceeds AML size 0x%x" %
-            (pkglen, offset, len(aml)))
-    return pkglen
-
-# Given method offset, find its NameString offset
-def aml_method_string(offset):
-    #0x14 MethodOp PkgLength NameString MethodFlags TermList
-    if (aml[offset] != 0x14):
-        die( "Method offset 0x%x: expected 0x14 actual 0x%x" %
-             (offset, aml[offset]));
-    offset += 1;
-    pkglenbytes = aml_pkglen_bytes(offset)
-    offset += pkglenbytes;
-    return offset;
-
-# Given name offset, find its NameString offset
-def aml_name_string(offset):
-    #0x08 NameOp NameString DataRef
-    if (aml[offset] != 0x08):
-        die( "Name offset 0x%x: expected 0x08 actual 0x%x" %
-             (offset, aml[offset]));
-    offset += 1
-    # Block Name Modifier. Skip it.
-    if (aml[offset] == 0x5c or aml[offset] == 0x5e):
-        offset += 1
-    return offset;
-
-# Given data offset, find variable length byte buffer offset
-def aml_data_buffer(offset, length):
-    #0x11 PkgLength BufferSize ByteList
-    if (length > 63):
-        die( "Name offset 0x%x: expected a one byte PkgLength (length<=63)" %
-             (offset));
-    expect = [0x11, length+3, 0x0A, length]
-    if (aml[offset:offset+4] != expect):
-        die( "Name offset 0x%x: expected %s actual %s" %
-             (offset, expect, aml[offset:offset+4]))
-    return offset + len(expect)
-
-# Given data offset, find dword const offset
-def aml_data_dword_const(offset):
-    #0x08 NameOp NameString DataRef
-    if (aml[offset] != 0x0C):
-        die( "Name offset 0x%x: expected 0x0C actual 0x%x" %
-             (offset, aml[offset]));
-    return offset + 1;
-
-# Given data offset, find word const offset
-def aml_data_word_const(offset):
-    #0x08 NameOp NameString DataRef
-    if (aml[offset] != 0x0B):
-        die( "Name offset 0x%x: expected 0x0B actual 0x%x" %
-             (offset, aml[offset]));
-    return offset + 1;
-
-# Given data offset, find byte const offset
-def aml_data_byte_const(offset):
-    #0x08 NameOp NameString DataRef
-    if (aml[offset] != 0x0A):
-        die( "Name offset 0x%x: expected 0x0A actual 0x%x" %
-             (offset, aml[offset]));
-    return offset + 1;
-
-# Find name'd buffer
-def aml_name_buffer(offset, length):
-    return aml_data_buffer(aml_name_string(offset) + 4, length)
-
-# Given name offset, find dword const offset
-def aml_name_dword_const(offset):
-    return aml_data_dword_const(aml_name_string(offset) + 4)
-
-# Given name offset, find word const offset
-def aml_name_word_const(offset):
-    return aml_data_word_const(aml_name_string(offset) + 4)
-
-# Given name offset, find byte const offset
-def aml_name_byte_const(offset):
-    return aml_data_byte_const(aml_name_string(offset) + 4)
-
-def aml_device_start(offset):
-    #0x5B 0x82 DeviceOp PkgLength NameString
-    if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)):
-        die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" %
-             (offset, aml[offset], aml[offset + 1]));
-    return offset
-
-def aml_device_string(offset):
-    #0x5B 0x82 DeviceOp PkgLength NameString
-    start = aml_device_start(offset)
-    offset += 2
-    pkglenbytes = aml_pkglen_bytes(offset)
-    offset += pkglenbytes
-    return offset
-
-def aml_device_end(offset):
-    start = aml_device_start(offset)
-    offset += 2
-    pkglenbytes = aml_pkglen_bytes(offset)
-    pkglen = aml_pkglen(offset)
-    return offset + pkglen
-
-def aml_processor_start(offset):
-    #0x5B 0x83 ProcessorOp PkgLength NameString ProcID
-    if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)):
-        die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" %
-             (offset, aml[offset], aml[offset + 1]));
-    return offset
-
-def aml_processor_string(offset):
-    #0x5B 0x83 ProcessorOp PkgLength NameString ProcID
-    start = aml_processor_start(offset)
-    offset += 2
-    pkglenbytes = aml_pkglen_bytes(offset)
-    offset += pkglenbytes
-    return offset
-
-def aml_processor_end(offset):
-    start = aml_processor_start(offset)
-    offset += 2
-    pkglenbytes = aml_pkglen_bytes(offset)
-    pkglen = aml_pkglen(offset)
-    return offset + pkglen
-
-def aml_package_start(offset):
-    offset = aml_name_string(offset) + 4
-    # 0x12 PkgLength NumElements PackageElementList
-    if (aml[offset] != 0x12):
-        die( "Name offset 0x%x: expected 0x12 actual 0x%x" %
-             (offset, aml[offset]));
-    offset += 1
-    return offset + aml_pkglen_bytes(offset) + 1
-
-lineno = 0
-for line in fileinput.input():
-    # Strip trailing newline
-    line = line.rstrip();
-    # line number and debug string to output in case of errors
-    lineno = lineno + 1
-    debug = "input line %d: %s" % (lineno, line)
-    #ASL listing: space, then line#, then ...., then code
-    pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*')
-    m = pasl.search(line)
-    if (m):
-        add_asl(lineno, pasl.sub("", line));
-    # AML listing: offset in hex, then ...., then code
-    paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*')
-    m = paml.search(line)
-    if (m):
-        add_aml(m.group(1), paml.sub("", line))
-
-# Now go over code
-# Track AML offset of a previous non-empty ASL command
-prev_aml_offset = -1
-for i in range(len(asl)):
-    debug = "input line %d: %s" % (asl[i].lineno, asl[i].line)
-
-    l = asl[i].line
-
-    # skip if not an extract directive
-    a = len(re.findall(r'ACPI_EXTRACT', l))
-    if (not a):
-        # If not empty, store AML offset. Will be used for sanity checks
-        # IASL seems to put {}. at random places in the listing.
-        # Ignore any non-words for the purpose of this test.
-        m = re.search(r'\w+', l)
-        if (m):
-                prev_aml_offset = asl[i].aml_offset
-        continue
-
-    if (a > 1):
-        die("Expected at most one ACPI_EXTRACT per line, actual %d" % a)
-
-    mext = re.search(r'''
-                      ^\s* # leading whitespace
-                      /\*\s* # start C comment
-                      (ACPI_EXTRACT_\w+) # directive: group(1)
-                      \s+ # whitspace separates directive from array name
-                      (\w+) # array name: group(2)
-                      \s*\*/ # end of C comment
-                      \s*$ # trailing whitespace
-                      ''', l, re.VERBOSE)
-    if (not mext):
-        die("Stray ACPI_EXTRACT in input")
-
-    # previous command must have produced some AML,
-    # otherwise we are in a middle of a block
-    if (prev_aml_offset == asl[i].aml_offset):
-        die("ACPI_EXTRACT directive in the middle of a block")
-
-    directive = mext.group(1)
-    array = mext.group(2)
-    offset = asl[i].aml_offset
-
-    if (directive == "ACPI_EXTRACT_ALL_CODE"):
-        if array in output:
-            die("%s directive used more than once" % directive)
-        output[array] = aml
-        continue
-    if (directive == "ACPI_EXTRACT_NAME_BUFFER8"):
-        offset = aml_name_buffer(offset, 8)
-    elif (directive == "ACPI_EXTRACT_NAME_BUFFER16"):
-        offset = aml_name_buffer(offset, 16)
-    elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"):
-        offset = aml_name_dword_const(offset)
-    elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"):
-        offset = aml_name_word_const(offset)
-    elif (directive == "ACPI_EXTRACT_NAME_BYTE_CONST"):
-        offset = aml_name_byte_const(offset)
-    elif (directive == "ACPI_EXTRACT_NAME_STRING"):
-        offset = aml_name_string(offset)
-    elif (directive == "ACPI_EXTRACT_METHOD_STRING"):
-        offset = aml_method_string(offset)
-    elif (directive == "ACPI_EXTRACT_DEVICE_START"):
-        offset = aml_device_start(offset)
-    elif (directive == "ACPI_EXTRACT_DEVICE_STRING"):
-        offset = aml_device_string(offset)
-    elif (directive == "ACPI_EXTRACT_DEVICE_END"):
-        offset = aml_device_end(offset)
-    elif (directive == "ACPI_EXTRACT_PROCESSOR_START"):
-        offset = aml_processor_start(offset)
-    elif (directive == "ACPI_EXTRACT_PROCESSOR_STRING"):
-        offset = aml_processor_string(offset)
-    elif (directive == "ACPI_EXTRACT_PROCESSOR_END"):
-        offset = aml_processor_end(offset)
-    elif (directive == "ACPI_EXTRACT_PKG_START"):
-        offset = aml_package_start(offset)
-    else:
-        die("Unsupported directive %s" % directive)
-
-    if array not in output:
-        output[array] = []
-    output[array].append(offset)
-
-debug = "at end of file"
-
-def get_value_type(maxvalue):
-    #Use type large enough to fit the table
-    if (maxvalue >= 0x10000):
-            return "int"
-    elif (maxvalue >= 0x100):
-            return "short"
-    else:
-            return "char"
-
-# Pretty print output
-for array in output.keys():
-    otype = get_value_type(max(output[array]))
-    odata = []
-    for value in output[array]:
-        odata.append("0x%x" % value)
-    sys.stdout.write("static unsigned %s %s[] = {\n" % (otype, array))
-    sys.stdout.write(",\n".join(odata))
-    sys.stdout.write('\n};\n');
diff --git a/scripts/acpi_extract_preprocess.py b/scripts/acpi_extract_preprocess.py
deleted file mode 100755
index 69d10d6..0000000
--- a/scripts/acpi_extract_preprocess.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, see <http://www.gnu.org/licenses/>.
-
-# Read a preprocessed ASL listing and put each ACPI_EXTRACT
-# directive in a comment, to make iasl skip it.
-# We also put each directive on a new line, the machinery
-# in tools/acpi_extract.py requires this.
-
-import re;
-import sys;
-import fileinput;
-
-def die(diag):
-    sys.stderr.write("Error: %s\n" % (diag))
-    sys.exit(1)
-
-# Note: () around pattern make split return matched string as part of list
-psplit = re.compile(r''' (
-                          \b # At word boundary
-                          ACPI_EXTRACT_\w+ # directive
-                          \s+ # some whitespace
-                          \w+ # array name
-                         )''', re.VERBOSE);
-
-lineno = 0
-for line in fileinput.input():
-    # line number and debug string to output in case of errors
-    lineno = lineno + 1
-    debug = "input line %d: %s" % (lineno, line.rstrip())
-
-    s = psplit.split(line);
-    # The way split works, each odd item is the matching ACPI_EXTRACT directive.
-    # Put each in a comment, and on a line by itself.
-    for i in range(len(s)):
-        if (i % 2):
-            sys.stdout.write("\n/* %s */\n" % s[i])
-        else:
-            sys.stdout.write(s[i])
diff --git a/scripts/update-acpi.sh b/scripts/update-acpi.sh
deleted file mode 100644
index b5f05ff..0000000
--- a/scripts/update-acpi.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-cd x86_64-softmmu
-for file in hw/i386/*.hex; do
-    cp -f $file ../$file.generated
-done
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs Igor Mammedov
@ 2015-12-10  1:50   ` Shannon Zhao
  2015-12-10 11:34     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  2015-12-22 15:17   ` [Qemu-devel] [PATCH " Michael S. Tsirkin
  1 sibling, 1 reply; 165+ messages in thread
From: Shannon Zhao @ 2015-12-10  1:50 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: qemu-arm



On 2015/12/10 7:41, Igor Mammedov wrote:
>  static void acpi_dsdt_add_virtio(Aml *scope,
>                                   const MemMapEntry *virtio_mmio_memmap,
> -                                 int mmio_irq, int num)
> +                                 uint32_t mmio_irq, int num)
>  {
>      hwaddr base = virtio_mmio_memmap->base;
>      hwaddr size = virtio_mmio_memmap->size;
> -    int irq = mmio_irq;
> +    uint32_t irq = mmio_irq;
>      int i;
>  
>      for (i = 0; i < num; i++) {
> @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
>          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irq, 1));

This looks not right. You could move uint32_t irq = mmio_irq; into the
for loop and make it as uint32_t irq = mmio_irq + i;

Thanks,
-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
@ 2015-12-10  1:59   ` Shannon Zhao
  2015-12-10 11:08     ` Igor Mammedov
  2015-12-10 13:12   ` Marcel Apfelbaum
  2015-12-11  2:36   ` Shannon Zhao
  2 siblings, 1 reply; 165+ messages in thread
From: Shannon Zhao @ 2015-12-10  1:59 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel



On 2015/12/10 7:41, Igor Mammedov wrote:
> Currently AML API doesn't compose terms in form of
> following pattern:
> 
>    Opcode Arg2 Arg2 [Dst]
> 
> but ASL used in piix4/q35 DSDT ACPI tables uses that
> form, so for clean conversion of it, AML API should
> be able to handle an optional 'Dst' argumet used there.
> 
> Since above pattern is used by arithmetic/bit ops,
> introduce helper that they could reuse.
> It reduces code duplication in existing 5 aml_foo()
> functions and also will prevent more duplication
> when exiting functions are extended to support
> optional 'Dst' argument.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/acpi/aml-build.c | 61 ++++++++++++++++++++++++++++-------------------------
>  1 file changed, 32 insertions(+), 29 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index a6e4c54..22015d2 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -436,44 +436,55 @@ Aml *aml_store(Aml *val, Aml *target)
>      return var;
>  }
>  
> -/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> -Aml *aml_and(Aml *arg1, Aml *arg2)
> +/**
> + * build_opcode_2arg_dst:
> + * @op: 1-byte opcode
> + * @arg1: 1st operand
> + * @arg2: 2nd operand
> + * @dst: optional target to store to, set to NULL if it's not required
> + *
> + * An internal helper to compose AML terms that have
> + *   "Op Operand Operand Target"
> + * pattern.
> + *
> + * Returns: The newly allocated and composed according to patter Aml object.
> + */
> +static Aml *
> +build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
>  {
> -    Aml *var = aml_opcode(0x7B /* AndOp */);
> +    Aml *var = aml_opcode(op);
>      aml_append(var, arg1);
>      aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    if (dst) {
> +        aml_append(var, dst);
> +    } else {
> +        build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    }
>      return var;
>  }
> 
This looks good. Maybe you could add a helper like build_opcode_2arg(),
then aml_lor() and aml_lgreater() could use this.

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() to accept target argument
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() " Igor Mammedov
@ 2015-12-10  2:07   ` Shannon Zhao
  2015-12-10 11:16     ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Shannon Zhao @ 2015-12-10  2:07 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel



On 2015/12/10 7:41, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/acpi/aml-build.c         | 4 ++--
>  hw/arm/virt-acpi-build.c    | 2 +-
>  hw/i386/acpi-build.c        | 8 +++++---
>  include/hw/acpi/aml-build.h | 2 +-
>  4 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 4f62512..2ca9207 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -499,9 +499,9 @@ build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
>  }
>  
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> -Aml *aml_and(Aml *arg1, Aml *arg2)
> +Aml *aml_and(Aml *arg1, Aml *arg2, Aml *dst)
>  {
> -    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, NULL);
> +    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, dst);
>  }
>  
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 1cc98f5..698b5f2 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -272,7 +272,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>          aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));
>      aml_append(ifctx, aml_store(aml_name("CDW2"), aml_name("SUPP")));
>      aml_append(ifctx, aml_store(aml_name("CDW3"), aml_name("CTRL")));
> -    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1D)),
> +    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"), aml_int(0x1D), NULL),

I'm not sure why you must extend this kind functions now. When I post
the patch to add aml_and(), you said
"
>>>> +Aml *aml_and(Aml *arg1, Aml *arg2, Aml *arg3)
>> I know that it's possible to Store inside of And(a, b, save_here)
>> ASL op, but could you instead rewrite it to
>>
>>  Store(And(a, b), save_here)
>>
>> so it wouldn't clatter trivial  And(a,b) uses and drop this hunk.
>>
> Yes, we can use Store(And(a, b), save_here) but according to the SPEC
> the And op can have 3 args. We don't support it?
I don't think that we should do it if it could be implemented
using 2 already existing API calls to keep it simple and not to
pollute code with extra ", NULL" argument in most cases.
"

Thanks,
-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
  2015-12-10  1:59   ` Shannon Zhao
@ 2015-12-10 11:08     ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 11:08 UTC (permalink / raw)
  To: Shannon Zhao; +Cc: qemu-devel

On Thu, 10 Dec 2015 09:59:16 +0800
Shannon Zhao <zhaoshenglong@huawei.com> wrote:

> 
> 
> On 2015/12/10 7:41, Igor Mammedov wrote:
> > Currently AML API doesn't compose terms in form of
> > following pattern:
> > 
> >    Opcode Arg2 Arg2 [Dst]
> > 
> > but ASL used in piix4/q35 DSDT ACPI tables uses that
> > form, so for clean conversion of it, AML API should
> > be able to handle an optional 'Dst' argumet used there.
> > 
> > Since above pattern is used by arithmetic/bit ops,
> > introduce helper that they could reuse.
> > It reduces code duplication in existing 5 aml_foo()
> > functions and also will prevent more duplication
> > when exiting functions are extended to support
> > optional 'Dst' argument.
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/acpi/aml-build.c | 61
> > ++++++++++++++++++++++++++++------------------------- 1 file
> > changed, 32 insertions(+), 29 deletions(-)
> > 
> > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > index a6e4c54..22015d2 100644
> > --- a/hw/acpi/aml-build.c
> > +++ b/hw/acpi/aml-build.c
> > @@ -436,44 +436,55 @@ Aml *aml_store(Aml *val, Aml *target)
> >      return var;
> >  }
> >  
> > -/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> > -Aml *aml_and(Aml *arg1, Aml *arg2)
> > +/**
> > + * build_opcode_2arg_dst:
> > + * @op: 1-byte opcode
> > + * @arg1: 1st operand
> > + * @arg2: 2nd operand
> > + * @dst: optional target to store to, set to NULL if it's not
> > required
> > + *
> > + * An internal helper to compose AML terms that have
> > + *   "Op Operand Operand Target"
> > + * pattern.
> > + *
> > + * Returns: The newly allocated and composed according to patter
> > Aml object.
> > + */
> > +static Aml *
> > +build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
> >  {
> > -    Aml *var = aml_opcode(0x7B /* AndOp */);
> > +    Aml *var = aml_opcode(op);
> >      aml_append(var, arg1);
> >      aml_append(var, arg2);
> > -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> > +    if (dst) {
> > +        aml_append(var, dst);
> > +    } else {
> > +        build_append_byte(var->buf, 0x00 /* NullNameOp */);
> > +    }
> >      return var;
> >  }
> > 
> This looks good. Maybe you could add a helper like
> build_opcode_2arg(), then aml_lor() and aml_lgreater() could use this.

If it reduces number code size, it could be made on top of this
series.

If AML API patches ('acpi:' prefixed) would have 'Reviewed-by:' we
could merge them first, before the PC:DSTD conversion patches are
reviewed so that AML API could be improved/extendend further without
conflicts.

That would also make series smaller on respin.

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

* Re: [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() to accept target argument
  2015-12-10  2:07   ` Shannon Zhao
@ 2015-12-10 11:16     ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 11:16 UTC (permalink / raw)
  To: Shannon Zhao; +Cc: qemu-devel

On Thu, 10 Dec 2015 10:07:43 +0800
Shannon Zhao <zhaoshenglong@huawei.com> wrote:

> 
> 
> On 2015/12/10 7:41, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/acpi/aml-build.c         | 4 ++--
> >  hw/arm/virt-acpi-build.c    | 2 +-
> >  hw/i386/acpi-build.c        | 8 +++++---
> >  include/hw/acpi/aml-build.h | 2 +-
> >  4 files changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > index 4f62512..2ca9207 100644
> > --- a/hw/acpi/aml-build.c
> > +++ b/hw/acpi/aml-build.c
> > @@ -499,9 +499,9 @@ build_opcode_2arg_dst(uint8_t op, Aml *arg1,
> > Aml *arg2, Aml *dst) }
> >  
> >  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> > -Aml *aml_and(Aml *arg1, Aml *arg2)
> > +Aml *aml_and(Aml *arg1, Aml *arg2, Aml *dst)
> >  {
> > -    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2,
> > NULL);
> > +    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2,
> > dst); }
> >  
> >  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > index 1cc98f5..698b5f2 100644
> > --- a/hw/arm/virt-acpi-build.c
> > +++ b/hw/arm/virt-acpi-build.c
> > @@ -272,7 +272,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const
> > MemMapEntry *memmap, int irq, aml_create_dword_field(aml_arg(3),
> > aml_int(8), "CDW3")); aml_append(ifctx, aml_store(aml_name("CDW2"),
> > aml_name("SUPP"))); aml_append(ifctx, aml_store(aml_name("CDW3"),
> > aml_name("CTRL")));
> > -    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"),
> > aml_int(0x1D)),
> > +    aml_append(ifctx, aml_store(aml_and(aml_name("CTRL"),
> > aml_int(0x1D), NULL),
> 
> I'm not sure why you must extend this kind functions now. When I post
> the patch to add aml_and(), you said
> "
> >>>> +Aml *aml_and(Aml *arg1, Aml *arg2, Aml *arg3)
> >> I know that it's possible to Store inside of And(a, b, save_here)
> >> ASL op, but could you instead rewrite it to
> >>
> >>  Store(And(a, b), save_here)
> >>
> >> so it wouldn't clatter trivial  And(a,b) uses and drop this hunk.
> >>
> > Yes, we can use Store(And(a, b), save_here) but according to the
> > SPEC the And op can have 3 args. We don't support it?
> I don't think that we should do it if it could be implemented
> using 2 already existing API calls to keep it simple and not to
> pollute code with extra ", NULL" argument in most cases.
> "


I'd prefer 'Store(And(a, b), save_here)' but piix4/q35 DSDT currently
utilizes And(arg1,arg2, dst) form and if I do that during conversion
that will break exact match with IASL compiled DSDT and hence
break 'make check' tests, since it produces different series of AML
opcodes.
Hence making hard to prove that conversion doesn't introduce any
regression.

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

* [Qemu-devel] [PATCH v2 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-10  1:50   ` Shannon Zhao
@ 2015-12-10 11:34     ` Igor Mammedov
  2015-12-11  1:51       ` Shannon Zhao
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst, zhaoshenglong

ASL Interrupt() macro translates to Extended Interrupt Descriptor
which supports variable number of IRQs. It will be used for
conversion of ASL code for pc/q35 machines that use it for
returning several IRQs in _PSR object.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
 - fix incorrect irq number calculation in ARM:acpi_dsdt_add_virtio()
     Reported-by: Shannon Zhao <zhaoshenglong@huawei.com>
---
 hw/acpi/aml-build.c         | 22 +++++++++++++---------
 hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
 include/hw/acpi/aml-build.h |  2 +-
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 2ca9207..ee64d12 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
 Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
                    AmlLevelAndEdge level_and_edge,
                    AmlActiveHighAndLow high_and_low, AmlShared shared,
-                   uint32_t irq)
+                   uint32_t *irq_list, uint8_t irq_count)
 {
+    int i;
     Aml *var = aml_alloc();
     uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
                         | (high_and_low << 2) | (shared << 3);
+    const int header_bytes_in_len = 2;
+    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
+
+    assert(irq_count > 0);
 
     build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
-    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
-    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
+    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
+    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
     build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
-    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
+    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
 
-    /* Interrupt Number */
-    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
-    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
-    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
-    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
+    /* Interrupt Number List */
+    for (i = 0; i < irq_count; i++) {
+        build_append_int_noprefix(var->buf, irq_list[i], 4);
+    }
     return var;
 }
 
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 698b5f2..b0c1c4e 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
 }
 
 static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
-                                           int uart_irq)
+                                           uint32_t uart_irq)
 {
     Aml *dev = aml_device("COM0");
     aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
@@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
                                        uart_memmap->size, AML_READ_WRITE));
     aml_append(crs,
                aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                             AML_EXCLUSIVE, uart_irq));
+                             AML_EXCLUSIVE, &uart_irq, 1));
     aml_append(dev, aml_name_decl("_CRS", crs));
 
     /* The _ADR entry is used to link this device to the UART described
@@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
 }
 
 static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
-                                          int rtc_irq)
+                                          uint32_t rtc_irq)
 {
     Aml *dev = aml_device("RTC0");
     aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
@@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
                                        rtc_memmap->size, AML_READ_WRITE));
     aml_append(crs,
                aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                             AML_EXCLUSIVE, rtc_irq));
+                             AML_EXCLUSIVE, &rtc_irq, 1));
     aml_append(dev, aml_name_decl("_CRS", crs));
     aml_append(scope, dev);
 }
@@ -136,14 +136,14 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
 
 static void acpi_dsdt_add_virtio(Aml *scope,
                                  const MemMapEntry *virtio_mmio_memmap,
-                                 int mmio_irq, int num)
+                                 uint32_t mmio_irq, int num)
 {
     hwaddr base = virtio_mmio_memmap->base;
     hwaddr size = virtio_mmio_memmap->size;
-    int irq = mmio_irq;
     int i;
 
     for (i = 0; i < num; i++) {
+        uint32_t irq = mmio_irq + i;
         Aml *dev = aml_device("VR%02u", i);
         aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005")));
         aml_append(dev, aml_name_decl("_UID", aml_int(i)));
@@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
         aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
         aml_append(crs,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                                 AML_EXCLUSIVE, irq + i));
+                                 AML_EXCLUSIVE, &irq, 1));
         aml_append(dev, aml_name_decl("_CRS", crs));
         aml_append(scope, dev);
         base += size;
     }
 }
 
-static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
-                              bool use_highmem)
+static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
+                              uint32_t irq, bool use_highmem)
 {
     Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
     int i, bus_no;
@@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
 
     /* Create GSI link device */
     for (i = 0; i < PCI_NUM_PINS; i++) {
+        uint32_t irqs =  irq + i;
         Aml *dev_gsi = aml_device("GSI%d", i);
         aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
         aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
         crs = aml_resource_template();
         aml_append(crs,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                                 AML_EXCLUSIVE, irq + i));
+                                 AML_EXCLUSIVE, &irqs, 1));
         aml_append(dev_gsi, aml_name_decl("_PRS", crs));
         crs = aml_resource_template();
         aml_append(crs,
                    aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
-                                 AML_EXCLUSIVE, irq + i));
+                                 AML_EXCLUSIVE, &irqs, 1));
         aml_append(dev_gsi, aml_name_decl("_CRS", crs));
         method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
         aml_append(dev_gsi, method);
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index ca365c9..a3a058f 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
 Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
                    AmlLevelAndEdge level_and_edge,
                    AmlActiveHighAndLow high_and_low, AmlShared shared,
-                   uint32_t irq);
+                   uint32_t *irq_list, uint8_t irq_count);
 Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
             uint8_t aln, uint8_t len);
 Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() " Igor Mammedov
@ 2015-12-10 12:32   ` Marcel Apfelbaum
  2015-12-10 13:50     ` Igor Mammedov
  2015-12-10 16:17     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  0 siblings, 2 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 12:32 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/i386/acpi-build.c  | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   hw/i386/acpi-dsdt.dsl | 60 -------------------------------------
>   2 files changed, 83 insertions(+), 60 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index cf98037..f0966b8 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1339,6 +1339,17 @@ static Aml *build_link_dev(const char *name, uint8_t uid, Aml *reg)
>       return dev;
>    }
>
> +static Aml *build_prt_entry(const char *dev)
> +{
> +    Aml *a_zero = aml_int(0);
> +    Aml *pkg = aml_package(4);
> +    aml_append(pkg, a_zero);
> +    aml_append(pkg, a_zero);
> +    aml_append(pkg, aml_name("%s", dev));
> +    aml_append(pkg, a_zero);
> +    return pkg;
> +}
> +
>   static void build_piix4_pci0_int(Aml *table)
>   {
>       Aml *dev;
> @@ -1348,6 +1359,78 @@ static void build_piix4_pci0_int(Aml *table)
>       Aml *method;
>       uint32_t irqs;
>       Aml *sb_scope = aml_scope("_SB");
> +    Aml *pci0_scope = aml_scope("PCI0");
> +
> +    method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> +    {

Hi,

Actually there is a PRT implementation already, please see:
     static Aml *build_prt(void)

It is used for PXB host-bridges and it is *almost* the same.
The only difference is the power-management device.

I think is better to unify those (instead of duplicating the code).

Thanks,
Marcel


> +        Aml *w_ctx;
> +        Aml *if_ctx2;
> +        Aml *else_ctx2;
> +        Aml *a_zero = aml_int(0);
> +        Aml *a_prt = aml_local(0);
> +        Aml *a_pin = aml_local(1);
> +        Aml *a_lnk = aml_local(3);
> +        Aml *a_slot = aml_local(2);
> +        Aml *a_prt_ent = aml_local(4);
> +
> +        aml_append(method, aml_store(aml_package(128), a_prt));
> +        aml_append(method, aml_store(a_zero, a_pin));
> +        w_ctx = aml_while(aml_lless(a_pin, aml_int(128)));
> +
> +        /* slot = pin >> 2 */
> +        aml_append(w_ctx,
> +            aml_store(aml_shiftright(a_pin, aml_int(2), NULL), a_slot));
> +
> +        /* lnk = (slot + pin) & 3 */
> +        aml_append(w_ctx,
> +            aml_store(aml_and(aml_add(a_pin, a_slot, NULL), aml_int(3), NULL),
> +                      a_lnk));
> +
> +        if_ctx = aml_if(aml_equal(a_lnk, a_zero));
> +        aml_append(if_ctx, aml_store(build_prt_entry("LNKD"), a_prt_ent));
> +        aml_append(w_ctx, if_ctx);
> +
> +        if_ctx = aml_if(aml_equal(a_lnk, aml_int(1)));
> +        /* device 1 is the power-management device, needs SCI */
> +        if_ctx2 = aml_if(aml_equal(a_pin, aml_int(4)));
> +        aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), a_prt_ent));
> +        aml_append(if_ctx, if_ctx2);
> +        else_ctx2 = aml_else();
> +        aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), a_prt_ent));
> +        aml_append(if_ctx, else_ctx2);
> +        aml_append(w_ctx, if_ctx);
> +
> +        if_ctx = aml_if(aml_equal(a_lnk, aml_int(2)));
> +        aml_append(if_ctx, aml_store(build_prt_entry("LNKB"), a_prt_ent));
> +        aml_append(w_ctx, if_ctx);
> +
> +        if_ctx = aml_if(aml_equal(a_lnk, aml_int(3)));
> +        aml_append(if_ctx, aml_store(build_prt_entry("LNKC"), a_prt_ent));
> +        aml_append(w_ctx, if_ctx);
> +
> +        /*
> +         * Complete the interrupt routing entry:
> +         *    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> +         */
> +        aml_append(w_ctx,
> +            aml_store(
> +                aml_or(aml_shiftleft(a_slot, aml_int(16)),
> +                       aml_int(0xFFFF), NULL),
> +                aml_index(a_prt_ent, a_zero)
> +            )
> +        );
> +        aml_append(w_ctx,
> +            aml_store(aml_and(a_pin, aml_int(3), NULL),
> +                      aml_index(a_prt_ent, aml_int(1))));
> +        aml_append(w_ctx, aml_store(a_prt_ent, aml_index(a_prt, a_pin)));
> +
> +        aml_append(w_ctx, aml_increment(a_pin));
> +        aml_append(method, w_ctx);
> +
> +        aml_append(method, aml_return(aml_local(0)));
> +    }
> +    aml_append(pci0_scope, method);
> +    aml_append(sb_scope, pci0_scope);
>
>       field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
>       aml_append(field, aml_named_field("PRQ0", 8));
> diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> index bc6bd45..5d741dd 100644
> --- a/hw/i386/acpi-dsdt.dsl
> +++ b/hw/i386/acpi-dsdt.dsl
> @@ -78,64 +78,4 @@ DefinitionBlock (
>           /* Hotplug notification method supplied by SSDT */
>           External(\_SB.PCI0.PCNT, MethodObj)
>       }
> -
> -
> -/****************************************************************
> - * PCI IRQs
> - ****************************************************************/
> -
> -    Scope(\_SB) {
> -        Scope(PCI0) {
> -            Method (_PRT, 0) {
> -                Store(Package(128) {}, Local0)
> -                Store(Zero, Local1)
> -                While(LLess(Local1, 128)) {
> -                    // slot = pin >> 2
> -                    Store(ShiftRight(Local1, 2), Local2)
> -
> -                    // lnk = (slot + pin) & 3
> -                    Store(And(Add(Local1, Local2), 3), Local3)
> -                    If (LEqual(Local3, 0)) {
> -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> -                    }
> -                    If (LEqual(Local3, 1)) {
> -                        // device 1 is the power-management device, needs SCI
> -                        If (LEqual(Local1, 4)) {
> -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> -                        } Else {
> -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> -                        }
> -                    }
> -                    If (LEqual(Local3, 2)) {
> -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> -                    }
> -                    If (LEqual(Local3, 3)) {
> -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> -                    }
> -
> -                    // Complete the interrupt routing entry:
> -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> -
> -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> -                    Store(And(Local1, 3),                    Index(Local4, 1))
> -                    Store(Local4,                            Index(Local0, Local1))
> -
> -                    Increment(Local1)
> -                }
> -
> -                Return(Local0)
> -            }
> -        }
> -
> -
> -        External(PRQ0, FieldUnitObj)
> -        External(PRQ1, FieldUnitObj)
> -        External(PRQ2, FieldUnitObj)
> -        External(PRQ3, FieldUnitObj)
> -        External(LNKA, DeviceObj)
> -        External(LNKB, DeviceObj)
> -        External(LNKC, DeviceObj)
> -        External(LNKD, DeviceObj)
> -        External(LNKS, DeviceObj)
> -    }
>   }
>

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Igor Mammedov
@ 2015-12-10 12:45   ` Marcel Apfelbaum
  2015-12-10 13:43     ` Igor Mammedov
  2015-12-16 13:25   ` Marcel Apfelbaum
  1 sibling, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 12:45 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/Makefile.objs               |  2 +-
>   hw/acpi/memory_hotplug_acpi_table.c | 40 +++++++++++++++++++++++++++++++++++++
>   hw/i386/acpi-build.c                |  3 +++
>   include/hw/acpi/memory_hotplug.h    |  4 ++++
>   4 files changed, 48 insertions(+), 1 deletion(-)
>   create mode 100644 hw/acpi/memory_hotplug_acpi_table.c
>
> diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
> index 7d3230c..c04064e 100644
> --- a/hw/acpi/Makefile.objs
> +++ b/hw/acpi/Makefile.objs
> @@ -1,7 +1,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
> +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
>   common-obj-$(CONFIG_ACPI) += acpi_interface.o
>   common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
>   common-obj-$(CONFIG_ACPI) += aml-build.o
> diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
> new file mode 100644
> index 0000000..25bbf5e
> --- /dev/null
> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> @@ -0,0 +1,40 @@
> +/*
> + * Memory hotplug AML code of DSDT ACPI table
> + *
> + * Copyright (C) 2013 Red Hat Inc

You mean 2015, right :) ?


> + *
> + * Author: Igor Mammedov <imammedo@redhat.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> +
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> +
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <stdbool.h>
> +#include "hw/acpi/memory_hotplug.h"
> +#include "include/hw/acpi/pc-hotplug.h"
> +#include "hw/boards.h"
> +
> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> +                              uint16_t io_base, uint16_t io_len)
> +{
> +    Aml *pci_scope;
> +    Aml *ctrl_dev;
> +
> +    /* scope for memory hotplug controller device node */
> +    pci_scope = aml_scope("_SB.PCI0");
> +    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> +    {
> +    }
> +    aml_append(pci_scope, ctrl_dev);
> +    aml_append(ctx, pci_scope);
> +}
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index bbd37e9..1b609e6 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
>       /* Reserve space for header */
>       acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
>
> +    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> +                             pm->mem_hp_io_len);
> +
>       /* Extra PCI root buses are implemented  only for i440fx */
>       bus = find_i440fx();
>       if (bus) {
> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
> index 1342adb..b6e9f50 100644
> --- a/include/hw/acpi/memory_hotplug.h
> +++ b/include/hw/acpi/memory_hotplug.h
> @@ -4,6 +4,7 @@
>   #include "hw/qdev-core.h"
>   #include "hw/acpi/acpi.h"
>   #include "migration/vmstate.h"
> +#include "hw/acpi/aml-build.h"
>
>   /**
>    * MemStatus:
> @@ -45,4 +46,7 @@ extern const VMStateDescription vmstate_memory_hotplug;
>                      vmstate_memory_hotplug, MemHotplugState)
>
>   void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
> +
> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> +                              uint16_t io_base, uint16_t io_len);
>   #endif
>

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
@ 2015-12-10 12:50   ` Marcel Apfelbaum
  2015-12-22 15:28   ` Michael S. Tsirkin
  1 sibling, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 12:50 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:40 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   tests/bios-tables-test.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index 6d37332..50678b5 100644
> --- a/tests/bios-tables-test.c
> +++ b/tests/bios-tables-test.c
> @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
>                           (gchar *)&signature,
>                           sdt->asl_file, sdt->aml_file,
>                           exp_sdt->asl_file, exp_sdt->aml_file);
> +                if (getenv("V")) {
> +                    int ret G_GNUC_UNUSED;
> +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> +                        exp_sdt->asl_file, sdt->asl_file);
> +                    ret = system(diff) ;
> +                    g_free(diff);
> +                }
>             }
>           }
>           g_string_free(asl, true);
>


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

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

* Re: [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal()
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal() Igor Mammedov
@ 2015-12-10 12:52   ` Marcel Apfelbaum
  2015-12-11  2:39   ` Shannon Zhao
  1 sibling, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 12:52 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:40 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 11 +++++++++++
>   include/hw/acpi/aml-build.h |  1 +
>   2 files changed, 12 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index dc59c08..c1a30a3 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -672,6 +672,17 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
>       return var;
>   }
>
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreaterEqual */
> +Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2)
> +{
> +    /* LGreaterEqualOp := LNotOp LLessOp */
> +    Aml *var = aml_opcode(0x92 /* LNotOp */);
> +    build_append_byte(var->buf, 0x95 /* LLessOp */);
> +    aml_append(var, arg1);
> +    aml_append(var, arg2);
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
>   Aml *aml_if(Aml *predicate)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 7296efb..2a4f815 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -229,6 +229,7 @@ Aml *aml_local(int num);
>   Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
>   Aml *aml_lnot(Aml *arg);
>   Aml *aml_equal(Aml *arg1, Aml *arg2);
> +Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
>   Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
>                      const char *name_format, ...) GCC_FMT_ATTR(4, 5);
>   Aml *aml_eisaid(const char *str);
>


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

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

* Re: [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field() Igor Mammedov
@ 2015-12-10 12:53   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 12:53 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 21 +++++++++++++++++----
>   include/hw/acpi/aml-build.h |  1 +
>   2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index bb2c9f7..a6e4c54 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -805,17 +805,30 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule)
>       return var;
>   }
>
> -/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefCreateDWordField */
> -Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name)
> +static
> +Aml *create_field_common(int opcode, Aml *srcbuf, Aml *index, const char *name)
>   {
> -    Aml *var = aml_alloc();
> -    build_append_byte(var->buf, 0x8A); /* CreateDWordFieldOp */
> +    Aml *var = aml_opcode(opcode);
>       aml_append(var, srcbuf);
>       aml_append(var, index);
>       build_append_namestring(var->buf, "%s", name);
>       return var;
>   }
>
> +/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefCreateDWordField */
> +Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name)
> +{
> +    return create_field_common(0x8A /* CreateDWordFieldOp */,
> +                               srcbuf, index, name);
> +}
> +
> +/* ACPI 2.0a: 17.2.4.2 Named Objects Encoding: DefCreateQWordField */
> +Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name)
> +{
> +    return create_field_common(0x8F /* CreateQWordFieldOp */,
> +                               srcbuf, index, name);
> +}
> +
>   /* ACPI 1.0b: 16.2.3 Data Objects Encoding: String */
>   Aml *aml_string(const char *name_format, ...)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index b220b12..c113b17 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -275,6 +275,7 @@ Aml *aml_mutex(const char *name, uint8_t sync_level);
>   Aml *aml_acquire(Aml *mutex, uint16_t timeout);
>   Aml *aml_release(Aml *mutex);
>   Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
> +Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name);
>   Aml *aml_varpackage(uint32_t num_elements);
>   Aml *aml_touuid(const char *uuid);
>   Aml *aml_unicode(const char *str);
>

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

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

* Re: [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument Igor Mammedov
@ 2015-12-10 12:59   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 12:59 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> it allows to express following ASL expression:
>   Add(arg1, arg2, result)
>
> usecases that do not need to store result
> should pass NULL as 3rd arg that would express
>   Add(arg1, arg2,)
> construct.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 4 ++--
>   hw/i386/acpi-build.c        | 2 +-
>   include/hw/acpi/aml-build.h | 2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 22015d2..3bb19bf 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -497,9 +497,9 @@ Aml *aml_lless(Aml *arg1, Aml *arg2)
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */
> -Aml *aml_add(Aml *arg1, Aml *arg2)
> +Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst)
>   {
> -    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, NULL);
> +    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, dst);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 95e0c65..bce0252 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -669,7 +669,7 @@ static Aml *build_prt(void)
>                      aml_store(aml_shiftright(pin, aml_int(2)), slot));
>           /* lnk_idx = (slot + pin) & 3 */
>           aml_append(while_ctx,
> -                   aml_store(aml_and(aml_add(pin, slot), aml_int(3)), lnk_idx));
> +            aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3)), lnk_idx));
>
>           /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
>           aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index c113b17..da38c92 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -204,7 +204,7 @@ Aml *aml_or(Aml *arg1, Aml *arg2);
>   Aml *aml_shiftleft(Aml *arg1, Aml *count);
>   Aml *aml_shiftright(Aml *arg1, Aml *count);
>   Aml *aml_lless(Aml *arg1, Aml *arg2);
> -Aml *aml_add(Aml *arg1, Aml *arg2);
> +Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
>   Aml *aml_increment(Aml *arg);
>   Aml *aml_index(Aml *arg1, Aml *idx);
>   Aml *aml_notify(Aml *arg1, Aml *arg2);
>


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

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

* Re: [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract() Igor Mammedov
@ 2015-12-10 13:01   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:01 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 14 ++++++++++++++
>   include/hw/acpi/aml-build.h |  2 ++
>   2 files changed, 16 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 3bb19bf..ee34771 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -502,6 +502,12 @@ Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst)
>       return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, dst);
>   }
>
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefSubtract */
> +Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst)
> +{
> +    return build_opcode_2arg_dst(0x74 /* SubtractOp */, arg1, arg2, dst);
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
>   Aml *aml_increment(Aml *arg)
>   {
> @@ -510,6 +516,14 @@ Aml *aml_increment(Aml *arg)
>       return var;
>   }
>
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefDecrement */
> +Aml *aml_decrement(Aml *arg)
> +{
> +    Aml *var = aml_opcode(0x76 /* DecrementOp */);
> +    aml_append(var, arg);
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */
>   Aml *aml_index(Aml *arg1, Aml *idx)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index da38c92..9761438 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -205,7 +205,9 @@ Aml *aml_shiftleft(Aml *arg1, Aml *count);
>   Aml *aml_shiftright(Aml *arg1, Aml *count);
>   Aml *aml_lless(Aml *arg1, Aml *arg2);
>   Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
> +Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst);
>   Aml *aml_increment(Aml *arg);
> +Aml *aml_decrement(Aml *arg);
>   Aml *aml_index(Aml *arg1, Aml *idx);
>   Aml *aml_notify(Aml *arg1, Aml *arg2);
>   Aml *aml_call1(const char *method, Aml *arg1);
>


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

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

* Re: [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper Igor Mammedov
@ 2015-12-10 13:04   ` Marcel Apfelbaum
  2015-12-10 13:41     ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:04 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> it will help to call a method with 0 arguments
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 8 ++++++++
>   include/hw/acpi/aml-build.h | 1 +
>   2 files changed, 9 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index ee34771..50587de 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -540,6 +540,14 @@ Aml *aml_notify(Aml *arg1, Aml *arg2)
>   }
>
>   /* helper to call method with 1 argument */
> +Aml *aml_call0(const char *method)
> +{
> +    Aml *var = aml_alloc();
> +    build_append_namestring(var->buf, "%s", method);
> +    return var;
> +}
> +
> +/* helper to call method with 1 argument */
>   Aml *aml_call1(const char *method, Aml *arg1)
>   {
>       Aml *var = aml_alloc();
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 9761438..117ef46 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -210,6 +210,7 @@ Aml *aml_increment(Aml *arg);
>   Aml *aml_decrement(Aml *arg);
>   Aml *aml_index(Aml *arg1, Aml *idx);
>   Aml *aml_notify(Aml *arg1, Aml *arg2);
> +Aml *aml_call0(const char *method);
>   Aml *aml_call1(const char *method, Aml *arg1);
>   Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
>   Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml *arg3);
>

Maybe aml_call instead of aml_call0 that implies some 'zero' initialization?
It doesn't really matter.

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

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

* Re: [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer() Igor Mammedov
@ 2015-12-10 13:05   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:05 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 9 +++++++++
>   include/hw/acpi/aml-build.h | 1 +
>   2 files changed, 10 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 50587de..1f599e3 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -427,6 +427,15 @@ Aml *aml_arg(int pos)
>       return var;
>   }
>
> +/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToInteger */
> +Aml *aml_to_integer(Aml *arg)
> +{
> +    Aml *var = aml_opcode(0x99 /* ToIntegerOp */);
> +    aml_append(var, arg);
> +    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
>   Aml *aml_store(Aml *val, Aml *target)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 117ef46..d28bfe6 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -198,6 +198,7 @@ Aml *aml_name_decl(const char *name, Aml *val);
>   Aml *aml_return(Aml *val);
>   Aml *aml_int(const uint64_t val);
>   Aml *aml_arg(int pos);
> +Aml *aml_to_integer(Aml *arg);
>   Aml *aml_store(Aml *val, Aml *target);
>   Aml *aml_and(Aml *arg1, Aml *arg2);
>   Aml *aml_or(Aml *arg1, Aml *arg2);
>

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

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

* Re: [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument Igor Mammedov
@ 2015-12-10 13:08   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:08 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> it allows to express ShiftRight(A,B,C) syntax
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 4 ++--
>   hw/i386/acpi-build.c        | 2 +-
>   include/hw/acpi/aml-build.h | 2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 1f599e3..dcaa7e9 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -491,9 +491,9 @@ Aml *aml_shiftleft(Aml *arg1, Aml *count)
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftRight */
> -Aml *aml_shiftright(Aml *arg1, Aml *count)
> +Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst)
>   {
> -    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, NULL);
> +    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, dst);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index bce0252..8f7b95a 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -666,7 +666,7 @@ static Aml *build_prt(void)
>
>           /* slot = pin >> 2 */
>           aml_append(while_ctx,
> -                   aml_store(aml_shiftright(pin, aml_int(2)), slot));
> +                   aml_store(aml_shiftright(pin, aml_int(2), NULL), slot));
>           /* lnk_idx = (slot + pin) & 3 */
>           aml_append(while_ctx,
>               aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3)), lnk_idx));
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index d28bfe6..a694a67 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -203,7 +203,7 @@ Aml *aml_store(Aml *val, Aml *target);
>   Aml *aml_and(Aml *arg1, Aml *arg2);
>   Aml *aml_or(Aml *arg1, Aml *arg2);
>   Aml *aml_shiftleft(Aml *arg1, Aml *count);
> -Aml *aml_shiftright(Aml *arg1, Aml *count);
> +Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
>   Aml *aml_lless(Aml *arg1, Aml *arg2);
>   Aml *aml_add(Aml *arg1, Aml *arg2, Aml *dst);
>   Aml *aml_subtract(Aml *arg1, Aml *arg2, Aml *dst);
>

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

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

* Re: [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
  2015-12-10  1:59   ` Shannon Zhao
@ 2015-12-10 13:12   ` Marcel Apfelbaum
  2015-12-11  2:36   ` Shannon Zhao
  2 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:12 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Currently AML API doesn't compose terms in form of
> following pattern:
>
>     Opcode Arg2 Arg2 [Dst]
>
> but ASL used in piix4/q35 DSDT ACPI tables uses that
> form, so for clean conversion of it, AML API should
> be able to handle an optional 'Dst' argumet used there.
>
> Since above pattern is used by arithmetic/bit ops,
> introduce helper that they could reuse.
> It reduces code duplication in existing 5 aml_foo()
> functions and also will prevent more duplication
> when exiting functions are extended to support
> optional 'Dst' argument.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c | 61 ++++++++++++++++++++++++++++-------------------------
>   1 file changed, 32 insertions(+), 29 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index a6e4c54..22015d2 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -436,44 +436,55 @@ Aml *aml_store(Aml *val, Aml *target)
>       return var;
>   }
>
> -/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> -Aml *aml_and(Aml *arg1, Aml *arg2)
> +/**
> + * build_opcode_2arg_dst:
> + * @op: 1-byte opcode
> + * @arg1: 1st operand
> + * @arg2: 2nd operand
> + * @dst: optional target to store to, set to NULL if it's not required
> + *
> + * An internal helper to compose AML terms that have
> + *   "Op Operand Operand Target"
> + * pattern.
> + *
> + * Returns: The newly allocated and composed according to patter Aml object.
> + */
> +static Aml *
> +build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
>   {
> -    Aml *var = aml_opcode(0x7B /* AndOp */);
> +    Aml *var = aml_opcode(op);
>       aml_append(var, arg1);
>       aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    if (dst) {
> +        aml_append(var, dst);
> +    } else {
> +        build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    }
>       return var;
>   }
>
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> +Aml *aml_and(Aml *arg1, Aml *arg2)
> +{
> +    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, NULL);
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
>   Aml *aml_or(Aml *arg1, Aml *arg2)
>   {
> -    Aml *var = aml_opcode(0x7D /* OrOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> -    return var;
> +    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftLeft */
>   Aml *aml_shiftleft(Aml *arg1, Aml *count)
>   {
> -    Aml *var = aml_opcode(0x79 /* ShiftLeftOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, count);
> -    build_append_byte(var->buf, 0x00); /* NullNameOp */
> -    return var;
> +    return build_opcode_2arg_dst(0x79 /* ShiftLeftOp */, arg1, count, NULL);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftRight */
>   Aml *aml_shiftright(Aml *arg1, Aml *count)
>   {
> -    Aml *var = aml_opcode(0x7A /* ShiftRightOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, count);
> -    build_append_byte(var->buf, 0x00); /* NullNameOp */
> -    return var;
> +    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, NULL);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */
> @@ -488,11 +499,7 @@ Aml *aml_lless(Aml *arg1, Aml *arg2)
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */
>   Aml *aml_add(Aml *arg1, Aml *arg2)
>   {
> -    Aml *var = aml_opcode(0x72 /* AddOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> -    return var;
> +    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, NULL);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
> @@ -506,11 +513,7 @@ Aml *aml_increment(Aml *arg)
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */
>   Aml *aml_index(Aml *arg1, Aml *idx)
>   {
> -    Aml *var = aml_opcode(0x88 /* IndexOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, idx);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> -    return var;
> +    return build_opcode_2arg_dst(0x88 /* IndexOp */, arg1, idx, NULL);
>   }
>
>   /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */
>


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

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

* Re: [Qemu-devel] [PATCH 13/74] acpi: add aml_alias()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 13/74] acpi: add aml_alias() Igor Mammedov
@ 2015-12-10 13:13   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:13 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 9 +++++++++
>   include/hw/acpi/aml-build.h | 1 +
>   2 files changed, 10 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index dcaa7e9..6a63477 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1242,6 +1242,15 @@ Aml *aml_release(Aml *mutex)
>       return var;
>   }
>
> +/* ACPI 1.0b: 16.2.5.1 Name Space Modifier Objects Encoding: DefAlias */
> +Aml *aml_alias(const char *source_object, const char *alias_object)
> +{
> +    Aml *var = aml_opcode(0x06 /* AliasOp */);
> +    aml_append(var, aml_name("%s", source_object));
> +    aml_append(var, aml_name("%s", alias_object));
> +    return var;
> +}
> +
>   void
>   build_header(GArray *linker, GArray *table_data,
>                AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index a694a67..cd3f3b7 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -278,6 +278,7 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
>   Aml *aml_mutex(const char *name, uint8_t sync_level);
>   Aml *aml_acquire(Aml *mutex, uint16_t timeout);
>   Aml *aml_release(Aml *mutex);
> +Aml *aml_alias(const char *source_object, const char *alias_object);
>   Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
>   Aml *aml_create_qword_field(Aml *srcbuf, Aml *index, const char *name);
>   Aml *aml_varpackage(uint32_t num_elements);
>

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

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

* Re: [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep() Igor Mammedov
@ 2015-12-10 13:14   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:14 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 10 ++++++++++
>   include/hw/acpi/aml-build.h |  1 +
>   2 files changed, 11 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 6a63477..e36b546 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1123,6 +1123,16 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
>                                addr_trans, len, flags);
>   }
>
> +/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefSleep */
> +Aml *aml_sleep(uint64_t msec)
> +{
> +    Aml *var = aml_alloc();
> +    build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */
> +    build_append_byte(var->buf, 0x22); /* SleepOp */
> +    aml_append(var, aml_int(msec));
> +    return var;
> +}
> +
>   static uint8_t Hex2Byte(const char *src)
>   {
>       int hi, lo;
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index cd3f3b7..944b001 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -263,6 +263,7 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
>                         uint64_t addr_gran, uint64_t addr_min,
>                         uint64_t addr_max, uint64_t addr_trans,
>                         uint64_t len);
> +Aml *aml_sleep(uint64_t msec);
>
>   /* Block AML object primitives */
>   Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
>


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

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

* Re: [Qemu-devel] [PATCH 16/74] acpi: add aml_lor()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 16/74] acpi: add aml_lor() Igor Mammedov
@ 2015-12-10 13:25   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:25 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 9 +++++++++
>   include/hw/acpi/aml-build.h | 1 +
>   2 files changed, 10 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 5094826..8cfa65c 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -484,6 +484,15 @@ Aml *aml_or(Aml *arg1, Aml *arg2)
>       return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
>   }
>
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLOr */
> +Aml *aml_lor(Aml *arg1, Aml *arg2)
> +{
> +    Aml *var = aml_opcode(0x91 /* LOrOp */);
> +    aml_append(var, arg1);
> +    aml_append(var, arg2);
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftLeft */
>   Aml *aml_shiftleft(Aml *arg1, Aml *count)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index cd82065..897e093 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -208,6 +208,7 @@ Aml *aml_to_integer(Aml *arg);
>   Aml *aml_store(Aml *val, Aml *target);
>   Aml *aml_and(Aml *arg1, Aml *arg2);
>   Aml *aml_or(Aml *arg1, Aml *arg2);
> +Aml *aml_lor(Aml *arg1, Aml *arg2);
>   Aml *aml_shiftleft(Aml *arg1, Aml *count);
>   Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
>   Aml *aml_lless(Aml *arg1, Aml *arg2);
>

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

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

* Re: [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater() Igor Mammedov
@ 2015-12-10 13:26   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:26 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 9 +++++++++
>   include/hw/acpi/aml-build.h | 1 +
>   2 files changed, 10 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 8cfa65c..b22e7da 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -715,6 +715,15 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
>       return var;
>   }
>
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreater */
> +Aml *aml_lgreater(Aml *arg1, Aml *arg2)
> +{
> +    Aml *var = aml_opcode(0x94 /* LGreaterOp */);
> +    aml_append(var, arg1);
> +    aml_append(var, arg2);
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreaterEqual */
>   Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 897e093..238a9dc 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -240,6 +240,7 @@ Aml *aml_local(int num);
>   Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
>   Aml *aml_lnot(Aml *arg);
>   Aml *aml_equal(Aml *arg1, Aml *arg2);
> +Aml *aml_lgreater(Aml *arg1, Aml *arg2);
>   Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
>   Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
>                      const char *name_format, ...) GCC_FMT_ATTR(4, 5);
>

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

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

* Re: [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring() Igor Mammedov
@ 2015-12-10 13:41   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:41 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 13 +++++++++++++
>   include/hw/acpi/aml-build.h |  1 +
>   2 files changed, 14 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 7500474..c025801 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -436,6 +436,19 @@ Aml *aml_to_integer(Aml *arg)
>       return var;
>   }
>
> +/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToHexString */
> +Aml *aml_to_hexstring(Aml *src, Aml *dst)
> +{
> +    Aml *var = aml_opcode(0x98 /* ToHexStringOp */);
> +    aml_append(var, src);
> +    if (dst) {
> +        aml_append(var, dst);
> +    } else {
> +        build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    }
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
>   Aml *aml_store(Aml *val, Aml *target)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 679812b..77bfe0c 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -210,6 +210,7 @@ Aml *aml_return(Aml *val);
>   Aml *aml_int(const uint64_t val);
>   Aml *aml_arg(int pos);
>   Aml *aml_to_integer(Aml *arg);
> +Aml *aml_to_hexstring(Aml *src, Aml *dst);
>   Aml *aml_store(Aml *val, Aml *target);
>   Aml *aml_and(Aml *arg1, Aml *arg2);
>   Aml *aml_or(Aml *arg1, Aml *arg2);
>


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

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

* Re: [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper
  2015-12-10 13:04   ` Marcel Apfelbaum
@ 2015-12-10 13:41     ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 13:41 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel

On Thu, 10 Dec 2015 15:04:43 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> > it will help to call a method with 0 arguments
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/acpi/aml-build.c         | 8 ++++++++
> >   include/hw/acpi/aml-build.h | 1 +
> >   2 files changed, 9 insertions(+)
> >
> > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > index ee34771..50587de 100644
> > --- a/hw/acpi/aml-build.c
> > +++ b/hw/acpi/aml-build.c
> > @@ -540,6 +540,14 @@ Aml *aml_notify(Aml *arg1, Aml *arg2)
> >   }
> >
> >   /* helper to call method with 1 argument */
> > +Aml *aml_call0(const char *method)
> > +{
> > +    Aml *var = aml_alloc();
> > +    build_append_namestring(var->buf, "%s", method);
> > +    return var;
> > +}
> > +
> > +/* helper to call method with 1 argument */
> >   Aml *aml_call1(const char *method, Aml *arg1)
> >   {
> >       Aml *var = aml_alloc();
> > diff --git a/include/hw/acpi/aml-build.h
> > b/include/hw/acpi/aml-build.h index 9761438..117ef46 100644
> > --- a/include/hw/acpi/aml-build.h
> > +++ b/include/hw/acpi/aml-build.h
> > @@ -210,6 +210,7 @@ Aml *aml_increment(Aml *arg);
> >   Aml *aml_decrement(Aml *arg);
> >   Aml *aml_index(Aml *arg1, Aml *idx);
> >   Aml *aml_notify(Aml *arg1, Aml *arg2);
> > +Aml *aml_call0(const char *method);
> >   Aml *aml_call1(const char *method, Aml *arg1);
> >   Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2);
> >   Aml *aml_call3(const char *method, Aml *arg1, Aml *arg2, Aml
> > *arg3);
> >
> 
> Maybe aml_call instead of aml_call0 that implies some 'zero'
> initialization? It doesn't really matter.
it's named so for consistency with other aml_callX() helpers.

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

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

* Re: [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer()
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer() Igor Mammedov
@ 2015-12-10 13:42   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:42 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 13 +++++++++++++
>   include/hw/acpi/aml-build.h |  1 +
>   2 files changed, 14 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index c025801..4b1b496 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -449,6 +449,19 @@ Aml *aml_to_hexstring(Aml *src, Aml *dst)
>       return var;
>   }
>
> +/* ACPI 2.0a: 17.2.4.4 Type 2 Opcodes Encoding: DefToBuffer */
> +Aml *aml_to_buffer(Aml *src, Aml *dst)
> +{
> +    Aml *var = aml_opcode(0x96 /* ToBufferOp */);
> +    aml_append(var, src);
> +    if (dst) {
> +        aml_append(var, dst);
> +    } else {
> +        build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    }
> +    return var;
> +}
> +
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefStore */
>   Aml *aml_store(Aml *val, Aml *target)
>   {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 77bfe0c..04ef25e 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -211,6 +211,7 @@ Aml *aml_int(const uint64_t val);
>   Aml *aml_arg(int pos);
>   Aml *aml_to_integer(Aml *arg);
>   Aml *aml_to_hexstring(Aml *src, Aml *dst);
> +Aml *aml_to_buffer(Aml *src, Aml *dst);
>   Aml *aml_store(Aml *val, Aml *target);
>   Aml *aml_and(Aml *arg1, Aml *arg2);
>   Aml *aml_or(Aml *arg1, Aml *arg2);
>

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

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

* Re: [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument Igor Mammedov
@ 2015-12-10 13:43   ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 13:43 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/aml-build.c         | 4 ++--
>   hw/arm/virt-acpi-build.c    | 6 +++---
>   hw/i386/acpi-build.c        | 3 ++-
>   include/hw/acpi/aml-build.h | 2 +-
>   4 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 8347299..4f62512 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -505,9 +505,9 @@ Aml *aml_and(Aml *arg1, Aml *arg2)
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
> -Aml *aml_or(Aml *arg1, Aml *arg2)
> +Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst)
>   {
> -    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
> +    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, dst);
>   }
>
>   /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLOr */
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 38ab844..1cc98f5 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -276,12 +276,12 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>                                   aml_name("CTRL")));
>
>       ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1))));
> -    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x08)),
> +    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x08), NULL),
>                                    aml_name("CDW1")));
>       aml_append(ifctx, ifctx1);
>
>       ifctx1 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), aml_name("CTRL"))));
> -    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x10)),
> +    aml_append(ifctx1, aml_store(aml_or(aml_name("CDW1"), aml_int(0x10), NULL),
>                                    aml_name("CDW1")));
>       aml_append(ifctx, ifctx1);
>
> @@ -290,7 +290,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>       aml_append(method, ifctx);
>
>       elsectx = aml_else();
> -    aml_append(elsectx, aml_store(aml_or(aml_name("CDW1"), aml_int(4)),
> +    aml_append(elsectx, aml_store(aml_or(aml_name("CDW1"), aml_int(4), NULL),
>                                     aml_name("CDW1")));
>       aml_append(elsectx, aml_return(aml_arg(3)));
>       aml_append(method, elsectx);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index a705e96..fd8ccfc 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -679,7 +679,8 @@ static Aml *build_prt(void)
>
>           /* route[0] = 0x[slot]FFFF */
>           aml_append(while_ctx,
> -            aml_store(aml_or(aml_shiftleft(slot, aml_int(16)), aml_int(0xFFFF)),
> +            aml_store(aml_or(aml_shiftleft(slot, aml_int(16)), aml_int(0xFFFF),
> +                             NULL),
>                         aml_index(route, aml_int(0))));
>           /* route[1] = pin & 3 */
>           aml_append(while_ctx,
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 9dd8370..3be727e 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -232,7 +232,7 @@ Aml *aml_to_hexstring(Aml *src, Aml *dst);
>   Aml *aml_to_buffer(Aml *src, Aml *dst);
>   Aml *aml_store(Aml *val, Aml *target);
>   Aml *aml_and(Aml *arg1, Aml *arg2);
> -Aml *aml_or(Aml *arg1, Aml *arg2);
> +Aml *aml_or(Aml *arg1, Aml *arg2, Aml *dst);
>   Aml *aml_lor(Aml *arg1, Aml *arg2);
>   Aml *aml_shiftleft(Aml *arg1, Aml *count);
>   Aml *aml_shiftright(Aml *arg1, Aml *count, Aml *dst);
>

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

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-10 12:45   ` Marcel Apfelbaum
@ 2015-12-10 13:43     ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 13:43 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel

On Thu, 10 Dec 2015 14:45:32 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/acpi/Makefile.objs               |  2 +-
> >   hw/acpi/memory_hotplug_acpi_table.c | 40
> > +++++++++++++++++++++++++++++++++++++
> > hw/i386/acpi-build.c                |  3 +++
> > include/hw/acpi/memory_hotplug.h    |  4 ++++ 4 files changed, 48
> > insertions(+), 1 deletion(-) create mode 100644
> > hw/acpi/memory_hotplug_acpi_table.c
> >
> > diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
> > index 7d3230c..c04064e 100644
> > --- a/hw/acpi/Makefile.objs
> > +++ b/hw/acpi/Makefile.objs
> > @@ -1,7 +1,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
> > +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
> > memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI) +=
> > acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
> >   common-obj-$(CONFIG_ACPI) += aml-build.o
> > diff --git a/hw/acpi/memory_hotplug_acpi_table.c
> > b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644
> > index 0000000..25bbf5e
> > --- /dev/null
> > +++ b/hw/acpi/memory_hotplug_acpi_table.c
> > @@ -0,0 +1,40 @@
> > +/*
> > + * Memory hotplug AML code of DSDT ACPI table
> > + *
> > + * Copyright (C) 2013 Red Hat Inc
> 
> You mean 2015, right :) ?
yep, I'll fix it.

> 
> 
> > + *
> > + * Author: Igor Mammedov <imammedo@redhat.com>
> > + *
> > + * This program is free software; you can redistribute it and/or
> > modify
> > + * it under the terms of the GNU General Public License as
> > published by
> > + * the Free Software Foundation; either version 2 of the License,
> > or
> > + * (at your option) any later version.
> > +
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > +
> > + * You should have received a copy of the GNU General Public
> > License along
> > + * with this program; if not, see <http://www.gnu.org/licenses/>.
> > + */
> > +
> > +#include <stdbool.h>
> > +#include "hw/acpi/memory_hotplug.h"
> > +#include "include/hw/acpi/pc-hotplug.h"
> > +#include "hw/boards.h"
> > +
> > +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> > +                              uint16_t io_base, uint16_t io_len)
> > +{
> > +    Aml *pci_scope;
> > +    Aml *ctrl_dev;
> > +
> > +    /* scope for memory hotplug controller device node */
> > +    pci_scope = aml_scope("_SB.PCI0");
> > +    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> > +    {
> > +    }
> > +    aml_append(pci_scope, ctrl_dev);
> > +    aml_append(ctx, pci_scope);
> > +}
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index bbd37e9..1b609e6 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
> >       /* Reserve space for header */
> >       acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
> >
> > +    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> > +                             pm->mem_hp_io_len);
> > +
> >       /* Extra PCI root buses are implemented  only for i440fx */
> >       bus = find_i440fx();
> >       if (bus) {
> > diff --git a/include/hw/acpi/memory_hotplug.h
> > b/include/hw/acpi/memory_hotplug.h index 1342adb..b6e9f50 100644
> > --- a/include/hw/acpi/memory_hotplug.h
> > +++ b/include/hw/acpi/memory_hotplug.h
> > @@ -4,6 +4,7 @@
> >   #include "hw/qdev-core.h"
> >   #include "hw/acpi/acpi.h"
> >   #include "migration/vmstate.h"
> > +#include "hw/acpi/aml-build.h"
> >
> >   /**
> >    * MemStatus:
> > @@ -45,4 +46,7 @@ extern const VMStateDescription
> > vmstate_memory_hotplug; vmstate_memory_hotplug, MemHotplugState)
> >
> >   void acpi_memory_ospm_status(MemHotplugState *mem_st,
> > ACPIOSTInfoList ***list); +
> > +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> > +                              uint16_t io_base, uint16_t io_len);
> >   #endif
> >
> 

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

* Re: [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-10 12:32   ` Marcel Apfelbaum
@ 2015-12-10 13:50     ` Igor Mammedov
  2015-12-10 16:17     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  1 sibling, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 13:50 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel

On Thu, 10 Dec 2015 14:32:11 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/i386/acpi-build.c  | 83
> > +++++++++++++++++++++++++++++++++++++++++++++++++++
> > hw/i386/acpi-dsdt.dsl | 60 ------------------------------------- 2
> > files changed, 83 insertions(+), 60 deletions(-)
> >
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index cf98037..f0966b8 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -1339,6 +1339,17 @@ static Aml *build_link_dev(const char *name,
> > uint8_t uid, Aml *reg) return dev;
> >    }
> >
> > +static Aml *build_prt_entry(const char *dev)
> > +{
> > +    Aml *a_zero = aml_int(0);
> > +    Aml *pkg = aml_package(4);
> > +    aml_append(pkg, a_zero);
> > +    aml_append(pkg, a_zero);
> > +    aml_append(pkg, aml_name("%s", dev));
> > +    aml_append(pkg, a_zero);
> > +    return pkg;
> > +}
> > +
> >   static void build_piix4_pci0_int(Aml *table)
> >   {
> >       Aml *dev;
> > @@ -1348,6 +1359,78 @@ static void build_piix4_pci0_int(Aml *table)
> >       Aml *method;
> >       uint32_t irqs;
> >       Aml *sb_scope = aml_scope("_SB");
> > +    Aml *pci0_scope = aml_scope("PCI0");
> > +
> > +    method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> > +    {
> 
> Hi,
> 
> Actually there is a PRT implementation already, please see:
>      static Aml *build_prt(void)
> 
> It is used for PXB host-bridges and it is *almost* the same.
> The only difference is the power-management device.
> 
> I think is better to unify those (instead of duplicating the code).
Ok, I'll check if it possible to unify while keeping byte compatible
with IASL generated DSDT. If it's not we can do some code duplication
here and in follow up optimizations drop/replace it in favor of
build_prt() to remove code duplication and optimize resulting AML.

> 
> Thanks,
> Marcel
> 
> 
> > +        Aml *w_ctx;
> > +        Aml *if_ctx2;
> > +        Aml *else_ctx2;
> > +        Aml *a_zero = aml_int(0);
> > +        Aml *a_prt = aml_local(0);
> > +        Aml *a_pin = aml_local(1);
> > +        Aml *a_lnk = aml_local(3);
> > +        Aml *a_slot = aml_local(2);
> > +        Aml *a_prt_ent = aml_local(4);
> > +
> > +        aml_append(method, aml_store(aml_package(128), a_prt));
> > +        aml_append(method, aml_store(a_zero, a_pin));
> > +        w_ctx = aml_while(aml_lless(a_pin, aml_int(128)));
> > +
> > +        /* slot = pin >> 2 */
> > +        aml_append(w_ctx,
> > +            aml_store(aml_shiftright(a_pin, aml_int(2), NULL),
> > a_slot)); +
> > +        /* lnk = (slot + pin) & 3 */
> > +        aml_append(w_ctx,
> > +            aml_store(aml_and(aml_add(a_pin, a_slot, NULL),
> > aml_int(3), NULL),
> > +                      a_lnk));
> > +
> > +        if_ctx = aml_if(aml_equal(a_lnk, a_zero));
> > +        aml_append(if_ctx, aml_store(build_prt_entry("LNKD"),
> > a_prt_ent));
> > +        aml_append(w_ctx, if_ctx);
> > +
> > +        if_ctx = aml_if(aml_equal(a_lnk, aml_int(1)));
> > +        /* device 1 is the power-management device, needs SCI */
> > +        if_ctx2 = aml_if(aml_equal(a_pin, aml_int(4)));
> > +        aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"),
> > a_prt_ent));
> > +        aml_append(if_ctx, if_ctx2);
> > +        else_ctx2 = aml_else();
> > +        aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"),
> > a_prt_ent));
> > +        aml_append(if_ctx, else_ctx2);
> > +        aml_append(w_ctx, if_ctx);
> > +
> > +        if_ctx = aml_if(aml_equal(a_lnk, aml_int(2)));
> > +        aml_append(if_ctx, aml_store(build_prt_entry("LNKB"),
> > a_prt_ent));
> > +        aml_append(w_ctx, if_ctx);
> > +
> > +        if_ctx = aml_if(aml_equal(a_lnk, aml_int(3)));
> > +        aml_append(if_ctx, aml_store(build_prt_entry("LNKC"),
> > a_prt_ent));
> > +        aml_append(w_ctx, if_ctx);
> > +
> > +        /*
> > +         * Complete the interrupt routing entry:
> > +         *    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> > +         */
> > +        aml_append(w_ctx,
> > +            aml_store(
> > +                aml_or(aml_shiftleft(a_slot, aml_int(16)),
> > +                       aml_int(0xFFFF), NULL),
> > +                aml_index(a_prt_ent, a_zero)
> > +            )
> > +        );
> > +        aml_append(w_ctx,
> > +            aml_store(aml_and(a_pin, aml_int(3), NULL),
> > +                      aml_index(a_prt_ent, aml_int(1))));
> > +        aml_append(w_ctx, aml_store(a_prt_ent, aml_index(a_prt,
> > a_pin))); +
> > +        aml_append(w_ctx, aml_increment(a_pin));
> > +        aml_append(method, w_ctx);
> > +
> > +        aml_append(method, aml_return(aml_local(0)));
> > +    }
> > +    aml_append(pci0_scope, method);
> > +    aml_append(sb_scope, pci0_scope);
> >
> >       field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK,
> > AML_PRESERVE); aml_append(field, aml_named_field("PRQ0", 8));
> > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > index bc6bd45..5d741dd 100644
> > --- a/hw/i386/acpi-dsdt.dsl
> > +++ b/hw/i386/acpi-dsdt.dsl
> > @@ -78,64 +78,4 @@ DefinitionBlock (
> >           /* Hotplug notification method supplied by SSDT */
> >           External(\_SB.PCI0.PCNT, MethodObj)
> >       }
> > -
> > -
> > -/****************************************************************
> > - * PCI IRQs
> > - ****************************************************************/
> > -
> > -    Scope(\_SB) {
> > -        Scope(PCI0) {
> > -            Method (_PRT, 0) {
> > -                Store(Package(128) {}, Local0)
> > -                Store(Zero, Local1)
> > -                While(LLess(Local1, 128)) {
> > -                    // slot = pin >> 2
> > -                    Store(ShiftRight(Local1, 2), Local2)
> > -
> > -                    // lnk = (slot + pin) & 3
> > -                    Store(And(Add(Local1, Local2), 3), Local3)
> > -                    If (LEqual(Local3, 0)) {
> > -                        Store(Package(4) { Zero, Zero, LNKD,
> > Zero }, Local4)
> > -                    }
> > -                    If (LEqual(Local3, 1)) {
> > -                        // device 1 is the power-management
> > device, needs SCI
> > -                        If (LEqual(Local1, 4)) {
> > -                            Store(Package(4) { Zero, Zero, LNKS,
> > Zero }, Local4)
> > -                        } Else {
> > -                            Store(Package(4) { Zero, Zero, LNKA,
> > Zero }, Local4)
> > -                        }
> > -                    }
> > -                    If (LEqual(Local3, 2)) {
> > -                        Store(Package(4) { Zero, Zero, LNKB,
> > Zero }, Local4)
> > -                    }
> > -                    If (LEqual(Local3, 3)) {
> > -                        Store(Package(4) { Zero, Zero, LNKC,
> > Zero }, Local4)
> > -                    }
> > -
> > -                    // Complete the interrupt routing entry:
> > -                    //    Package(4) { 0x[slot]FFFF, [pin],
> > [link], 0) } -
> > -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF),
> > Index(Local4, 0))
> > -                    Store(And(Local1, 3),
> > Index(Local4, 1))
> > -                    Store(Local4,
> > Index(Local0, Local1)) -
> > -                    Increment(Local1)
> > -                }
> > -
> > -                Return(Local0)
> > -            }
> > -        }
> > -
> > -
> > -        External(PRQ0, FieldUnitObj)
> > -        External(PRQ1, FieldUnitObj)
> > -        External(PRQ2, FieldUnitObj)
> > -        External(PRQ3, FieldUnitObj)
> > -        External(LNKA, DeviceObj)
> > -        External(LNKB, DeviceObj)
> > -        External(LNKC, DeviceObj)
> > -        External(LNKD, DeviceObj)
> > -        External(LNKS, DeviceObj)
> > -    }
> >   }
> >
> 
> 

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (73 preceding siblings ...)
  2015-12-09 23:42 ` [Qemu-devel] [PATCH 74/74] pc: acpi: remove unused ASL templates and related blobs/utils Igor Mammedov
@ 2015-12-10 15:53 ` Marcel Apfelbaum
  2015-12-10 16:31   ` Igor Mammedov
  2015-12-10 16:44 ` Igor Mammedov
  2015-12-19 20:38 ` Michael S. Tsirkin
  76 siblings, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-10 15:53 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel
  Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

On 12/10/2015 01:40 AM, Igor Mammedov wrote:
> Due to huge size, CCing only cover letter instead of individual patches.
>
> Series consist of 2 parts the 1st part prefixed 'acpi:' adds necessary
> AML API functions and the second part converts DSDT using existing and
> new AML API.
>
> Series does exact byte by byte conversion and passes ACPI tables
> 'make check' tests.
> The conversion first moves common for PIIX4/Q35 parts, getting rid of *.dsl
> includes and then converts PIIX4 and Q35 parts of DSDT.
>
> Diff-stat looks nice but actual code base is reduced by ~2000LOC
> while the rest of 10000 removals is dropping precompiled AML
> templates from tree.
>
> There are some AML parts that could be optimized/simplified and shared
> between PIIX4/Q35/ARM but doing it will break exact match with original
> tests, hence it's left out of the scope of this series.


Hi Igor,
Please consider splinting this series...

Maybe ACPI new constructs first, then memhp/cpu, piix/q35. (only a suggestion)
In this you will have some "sane" 20 something patches series that
can be more easily "swallowed".

Thanks,
Marcel

>
> CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
> CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
> CC: Peter Maydell <peter.maydell@linaro.org> (maintainer:ARM)
> CC: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
> CC: Richard Henderson <rth@twiddle.net> (maintainer:X86)
> CC: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
> CC: qemu-arm@nongnu.org (open list:ARM ACPI Subsystem)
>
> Igor Mammedov (70):
>    tests: acpi: print ASL diff in verbose mode
>    acpi: add aml_lgreater_equal()
>    acpi: add aml_create_qword_field()
>    acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
>    acpi: extend aml_add() to accept target argument
>    acpi: add aml_decrement() and aml_subtract()
>    acpi: add aml_call0() helper
>    acpi: add aml_to_integer()
>    acpi: extend aml_shiftright() to accept target argument
>    acpi: add aml_alias()
>    acpi: add aml_sleep()
>    acpi: add aml_lor()
>    acpi: add aml_lgreater()
>    acpi: extend aml_field() to support LockRule
>    acpi: add aml_to_hexstring()
>    acpi: add aml_to_buffer()
>    acpi add aml_dma()
>    acpi: extend aml_or() to accept target argument
>    acpi: extend aml_and() to accept target argument
>    acpi: extend aml_interrupt() to support multiple irqs
>    pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
>    pc: acpi: memhp: move MHPD._STA method into SSDT
>    pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
>    pc: acpi: memhp: move MHPD.MSCN method into SSDT
>    pc: acpi: memhp: move MHPD.MRST method into SSDT
>    pc: acpi: memhp: move MHPD.MPXM method into SSDT
>    pc: acpi: memhp: move MHPD.MOST method into SSDT
>    pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
>    pc: acpi: memhp: move MHPD.MCRS method into SSDT
>    pc: acpi: memhp: move MHPD Device into SSDT
>    pc: acpi: factor out memhp code from build_ssdt() into separate
>      function
>    pc: acpi: memhp: move \_GPE._E03 into SSDT
>    pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
>    pc: acpi: drop unused CPU_STATUS_LEN from DSDT
>    pc: acpi: cpuhp: move CPEJ() method to SSDT
>    pc: acpi: cpuhp: move CPMA() method into SSDT
>    pc: acpi: cpuhp: move CPST() method into SSDT
>    pc: acpi: cpuhp: move PRSC() method into SSDT
>    pc: acpi: cpuhp: move \_GPE._E02() into SSDT
>    pc: acpi: factor out cpu hotplug code from build_ssdt() into separate
>      function
>    pc: acpi: move HPET from DSDT to SSDT
>    pc: acpi: move DBUG() from DSDT to SSDT
>    pc: acpi: move RTC device from DSDT to SSDT
>    pc: acpi: move KBD device from DSDT to SSDT
>    pc: acpi: move MOU device from DSDT to SSDT
>    pc: acpi: move FDC0 device from DSDT to SSDT
>    pc: acpi: move LPT device from DSDT to SSDT
>    pc: acpi: move COM devices from DSDT to SSDT
>    pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
>    pc: acpi: move remaining GPE handlers into SSDT
>    pc: acpi: pci: move link devices into SSDT
>    pc: acpi: piix4: move IQCR() into SSDT
>    pc: acpi: piix4: move IQST() into SSDT
>    pc: acpi: piix4: move PCI0._PRT() into SSDT
>    pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
>    pc: acpi: piix4: acpi move PCI0 device to SSDT
>    pc: acpi: q35: move GSI links to SSDT
>    pc: acpi: q35: move link devices to SSDT
>    pc: acpi: q35: move IQCR() into SSDT
>    pc: acpi: q35: move IQST() into SSDT
>    pc: acpi: q35: move ISA bridge into SSDT
>    pc: acpi: q35: move _PRT() into SSDT
>    pc: acpi: q35: move PRTA routing table into SSDT
>    pc: acpi: q35: move PRTP routing table into SSDT
>    pc: acpi: q35: move _PIC() method into SSDT
>    pc: acpi: q35: move PCI0._OSC() method into SSDT
>    pc: acpi: q35: move PCI0 device definition into SSDT
>    pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
>    pc: acpi: switch to AML API composed DSDT
>    pc: acpi: remove unused ASL templates and related blobs/utils
>
> Xiao Guangrong (4):
>    acpi: add aml_derefof
>    acpi: add aml_sizeof
>    acpi: add aml_mutex(), aml_acquire(), aml_release()
>    acpi: support serialized method
>
>   hw/acpi/Makefile.objs               |    4 +-
>   hw/acpi/aml-build.c                 |  294 +-
>   hw/acpi/cpu_hotplug_acpi_table.c    |  124 +
>   hw/acpi/memory_hotplug_acpi_table.c |  249 ++
>   hw/arm/virt-acpi-build.c            |   41 +-
>   hw/i386/Makefile.objs               |   31 +-
>   hw/i386/acpi-build.c                | 1329 ++++--
>   hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   90 -
>   hw/i386/acpi-dsdt-dbug.dsl          |   41 -
>   hw/i386/acpi-dsdt-hpet.dsl          |   48 -
>   hw/i386/acpi-dsdt-isa.dsl           |  117 -
>   hw/i386/acpi-dsdt-mem-hotplug.dsl   |  171 -
>   hw/i386/acpi-dsdt.dsl               |  303 --
>   hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
>   hw/i386/q35-acpi-dsdt.dsl           |  436 --
>   hw/i386/q35-acpi-dsdt.hex.generated | 7610 -----------------------------------
>   hw/timer/hpet.c                     |    2 +-
>   include/hw/acpi/aml-build.h         |   66 +-
>   include/hw/acpi/cpu_hotplug.h       |   10 +
>   include/hw/acpi/memory_hotplug.h    |    9 +
>   include/hw/acpi/pc-hotplug.h        |   44 +-
>   include/hw/timer/hpet.h             |    1 +
>   scripts/acpi_extract.py             |  367 --
>   scripts/acpi_extract_preprocess.py  |   51 -
>   scripts/update-acpi.sh              |    4 -
>   tests/bios-tables-test.c            |    7 +
>   26 files changed, 1848 insertions(+), 12573 deletions(-)
>   create mode 100644 hw/acpi/cpu_hotplug_acpi_table.c
>   create mode 100644 hw/acpi/memory_hotplug_acpi_table.c
>   delete mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl
>   delete mode 100644 hw/i386/acpi-dsdt-dbug.dsl
>   delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl
>   delete mode 100644 hw/i386/acpi-dsdt-isa.dsl
>   delete mode 100644 hw/i386/acpi-dsdt-mem-hotplug.dsl
>   delete mode 100644 hw/i386/acpi-dsdt.dsl
>   delete mode 100644 hw/i386/acpi-dsdt.hex.generated
>   delete mode 100644 hw/i386/q35-acpi-dsdt.dsl
>   delete mode 100644 hw/i386/q35-acpi-dsdt.hex.generated
>   delete mode 100755 scripts/acpi_extract.py
>   delete mode 100755 scripts/acpi_extract_preprocess.py
>   delete mode 100644 scripts/update-acpi.sh
>

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

* [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-10 12:32   ` Marcel Apfelbaum
  2015-12-10 13:50     ` Igor Mammedov
@ 2015-12-10 16:17     ` Igor Mammedov
  2015-12-13 15:19       ` Marcel Apfelbaum
  2015-12-19 19:23       ` Michael S. Tsirkin
  1 sibling, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcel.apfelbaum, mst

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
 - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
   Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
 hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
 2 files changed, 32 insertions(+), 69 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index cf98037..1b065df 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
     qobject_decref(bsel);
 }
 
+static Aml *build_prt_entry(const char *link_name)
+{
+    Aml *a_zero = aml_int(0);
+    Aml *pkg = aml_package(4);
+    aml_append(pkg, a_zero);
+    aml_append(pkg, a_zero);
+    aml_append(pkg, aml_name("%s", link_name));
+    aml_append(pkg, a_zero);
+    return pkg;
+}
+
 /*
  * initialize_route - Initialize the interrupt routing rule
  * through a specific LINK:
@@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
                              Aml *lnk_idx, int idx)
 {
     Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
-    Aml *pkg = aml_package(4);
+    Aml *pkg = build_prt_entry(link_name);
 
-    aml_append(pkg, aml_int(0));
-    aml_append(pkg, aml_int(0));
-    aml_append(pkg, aml_name("%s", link_name));
-    aml_append(pkg, aml_int(0));
     aml_append(if_ctx, aml_store(pkg, route));
 
     return if_ctx;
@@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
  * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
  *
  */
-static Aml *build_prt(void)
+static Aml *build_prt(bool is_pci0_prt)
 {
-    Aml *method, *while_ctx, *pin, *res;
+    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;
 
     method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
     res = aml_local(0);
@@ -678,7 +685,19 @@ static Aml *build_prt(void)
 
         /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
         aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
-        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
+        if (is_pci0_prt) {
+            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
+            /* device 1 is the power-management device, needs SCI */
+            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
+            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
+            aml_append(if_ctx, if_ctx2);
+            else_ctx2 = aml_else();
+            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
+            aml_append(if_ctx, else_ctx2);
+            aml_append(while_ctx, if_ctx);
+        } else {
+            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
+        }
         aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
         aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
 
@@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
     Aml *method;
     uint32_t irqs;
     Aml *sb_scope = aml_scope("_SB");
+    Aml *pci0_scope = aml_scope("PCI0");
+
+    aml_append(pci0_scope, build_prt(true));
+    aml_append(sb_scope, pci0_scope);
 
     field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
     aml_append(field, aml_named_field("PRQ0", 8));
@@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
                 aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
             }
 
-            aml_append(dev, build_prt());
+            aml_append(dev, build_prt(false));
             crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
                             io_ranges, mem_ranges);
             aml_append(dev, aml_name_decl("_CRS", crs));
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index bc6bd45..5d741dd 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -78,64 +78,4 @@ DefinitionBlock (
         /* Hotplug notification method supplied by SSDT */
         External(\_SB.PCI0.PCNT, MethodObj)
     }
-
-
-/****************************************************************
- * PCI IRQs
- ****************************************************************/
-
-    Scope(\_SB) {
-        Scope(PCI0) {
-            Method (_PRT, 0) {
-                Store(Package(128) {}, Local0)
-                Store(Zero, Local1)
-                While(LLess(Local1, 128)) {
-                    // slot = pin >> 2
-                    Store(ShiftRight(Local1, 2), Local2)
-
-                    // lnk = (slot + pin) & 3
-                    Store(And(Add(Local1, Local2), 3), Local3)
-                    If (LEqual(Local3, 0)) {
-                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
-                    }
-                    If (LEqual(Local3, 1)) {
-                        // device 1 is the power-management device, needs SCI
-                        If (LEqual(Local1, 4)) {
-                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
-                        } Else {
-                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
-                        }
-                    }
-                    If (LEqual(Local3, 2)) {
-                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
-                    }
-                    If (LEqual(Local3, 3)) {
-                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
-                    }
-
-                    // Complete the interrupt routing entry:
-                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
-
-                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
-                    Store(And(Local1, 3),                    Index(Local4, 1))
-                    Store(Local4,                            Index(Local0, Local1))
-
-                    Increment(Local1)
-                }
-
-                Return(Local0)
-            }
-        }
-
-
-        External(PRQ0, FieldUnitObj)
-        External(PRQ1, FieldUnitObj)
-        External(PRQ2, FieldUnitObj)
-        External(PRQ3, FieldUnitObj)
-        External(LNKA, DeviceObj)
-        External(LNKB, DeviceObj)
-        External(LNKC, DeviceObj)
-        External(LNKD, DeviceObj)
-        External(LNKS, DeviceObj)
-    }
 }
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-10 15:53 ` [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Marcel Apfelbaum
@ 2015-12-10 16:31   ` Igor Mammedov
  2015-12-13 15:24     ` Marcel Apfelbaum
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 16:31 UTC (permalink / raw)
  To: Marcel Apfelbaum
  Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

On Thu, 10 Dec 2015 17:53:31 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

[...]
> Hi Igor,
> Please consider splinting this series...
> 
> Maybe ACPI new constructs first, then memhp/cpu, piix/q35. (only a
> suggestion) In this you will have some "sane" 20 something patches
> series that can be more easily "swallowed".
I'd also prefer to do it incrementally but
I've tried something like this before, but Michael suggested to
avoid optimizations/refactoring and make it so that conversion would
pass 'make check' so it would be easy to prove that it hasn't regressed
anything and to do it the only way is to convert whole DSDT at once.

Nevertheless, the series more or less organized with split in mind,
so it's possible first commit AML API patches ('acpi:' prefixed)
and then just go in order the blocks as they are in series:

memhp/cpuhp/misc devices/piix4/q35/final cleanup


> 
> Thanks,
> Marcel
> 
> >
> > CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
> > CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI
> > Subsystem) CC: Peter Maydell <peter.maydell@linaro.org>
> > (maintainer:ARM) CC: Paolo Bonzini <pbonzini@redhat.com>
> > (maintainer:X86) CC: Richard Henderson <rth@twiddle.net>
> > (maintainer:X86) CC: Eduardo Habkost <ehabkost@redhat.com>
> > (maintainer:X86) CC: qemu-arm@nongnu.org (open list:ARM ACPI
> > Subsystem)
> >
> > Igor Mammedov (70):
> >    tests: acpi: print ASL diff in verbose mode
> >    acpi: add aml_lgreater_equal()
> >    acpi: add aml_create_qword_field()
> >    acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
> >    acpi: extend aml_add() to accept target argument
> >    acpi: add aml_decrement() and aml_subtract()
> >    acpi: add aml_call0() helper
> >    acpi: add aml_to_integer()
> >    acpi: extend aml_shiftright() to accept target argument
> >    acpi: add aml_alias()
> >    acpi: add aml_sleep()
> >    acpi: add aml_lor()
> >    acpi: add aml_lgreater()
> >    acpi: extend aml_field() to support LockRule
> >    acpi: add aml_to_hexstring()
> >    acpi: add aml_to_buffer()
> >    acpi add aml_dma()
> >    acpi: extend aml_or() to accept target argument
> >    acpi: extend aml_and() to accept target argument
> >    acpi: extend aml_interrupt() to support multiple irqs
> >    pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT
> > code pc: acpi: memhp: move MHPD._STA method into SSDT
> >    pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
> >    pc: acpi: memhp: move MHPD.MSCN method into SSDT
> >    pc: acpi: memhp: move MHPD.MRST method into SSDT
> >    pc: acpi: memhp: move MHPD.MPXM method into SSDT
> >    pc: acpi: memhp: move MHPD.MOST method into SSDT
> >    pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
> >    pc: acpi: memhp: move MHPD.MCRS method into SSDT
> >    pc: acpi: memhp: move MHPD Device into SSDT
> >    pc: acpi: factor out memhp code from build_ssdt() into separate
> >      function
> >    pc: acpi: memhp: move \_GPE._E03 into SSDT
> >    pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
> >    pc: acpi: drop unused CPU_STATUS_LEN from DSDT
> >    pc: acpi: cpuhp: move CPEJ() method to SSDT
> >    pc: acpi: cpuhp: move CPMA() method into SSDT
> >    pc: acpi: cpuhp: move CPST() method into SSDT
> >    pc: acpi: cpuhp: move PRSC() method into SSDT
> >    pc: acpi: cpuhp: move \_GPE._E02() into SSDT
> >    pc: acpi: factor out cpu hotplug code from build_ssdt() into
> > separate function
> >    pc: acpi: move HPET from DSDT to SSDT
> >    pc: acpi: move DBUG() from DSDT to SSDT
> >    pc: acpi: move RTC device from DSDT to SSDT
> >    pc: acpi: move KBD device from DSDT to SSDT
> >    pc: acpi: move MOU device from DSDT to SSDT
> >    pc: acpi: move FDC0 device from DSDT to SSDT
> >    pc: acpi: move LPT device from DSDT to SSDT
> >    pc: acpi: move COM devices from DSDT to SSDT
> >    pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
> >    pc: acpi: move remaining GPE handlers into SSDT
> >    pc: acpi: pci: move link devices into SSDT
> >    pc: acpi: piix4: move IQCR() into SSDT
> >    pc: acpi: piix4: move IQST() into SSDT
> >    pc: acpi: piix4: move PCI0._PRT() into SSDT
> >    pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
> >    pc: acpi: piix4: acpi move PCI0 device to SSDT
> >    pc: acpi: q35: move GSI links to SSDT
> >    pc: acpi: q35: move link devices to SSDT
> >    pc: acpi: q35: move IQCR() into SSDT
> >    pc: acpi: q35: move IQST() into SSDT
> >    pc: acpi: q35: move ISA bridge into SSDT
> >    pc: acpi: q35: move _PRT() into SSDT
> >    pc: acpi: q35: move PRTA routing table into SSDT
> >    pc: acpi: q35: move PRTP routing table into SSDT
> >    pc: acpi: q35: move _PIC() method into SSDT
> >    pc: acpi: q35: move PCI0._OSC() method into SSDT
> >    pc: acpi: q35: move PCI0 device definition into SSDT
> >    pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
> >    pc: acpi: switch to AML API composed DSDT
> >    pc: acpi: remove unused ASL templates and related blobs/utils
> >
> > Xiao Guangrong (4):
> >    acpi: add aml_derefof
> >    acpi: add aml_sizeof
> >    acpi: add aml_mutex(), aml_acquire(), aml_release()
> >    acpi: support serialized method
> >
> >   hw/acpi/Makefile.objs               |    4 +-
> >   hw/acpi/aml-build.c                 |  294 +-
> >   hw/acpi/cpu_hotplug_acpi_table.c    |  124 +
> >   hw/acpi/memory_hotplug_acpi_table.c |  249 ++
> >   hw/arm/virt-acpi-build.c            |   41 +-
> >   hw/i386/Makefile.objs               |   31 +-
> >   hw/i386/acpi-build.c                | 1329 ++++--
> >   hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   90 -
> >   hw/i386/acpi-dsdt-dbug.dsl          |   41 -
> >   hw/i386/acpi-dsdt-hpet.dsl          |   48 -
> >   hw/i386/acpi-dsdt-isa.dsl           |  117 -
> >   hw/i386/acpi-dsdt-mem-hotplug.dsl   |  171 -
> >   hw/i386/acpi-dsdt.dsl               |  303 --
> >   hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
> >   hw/i386/q35-acpi-dsdt.dsl           |  436 --
> >   hw/i386/q35-acpi-dsdt.hex.generated | 7610
> > -----------------------------------
> > hw/timer/hpet.c                     |    2 +-
> > include/hw/acpi/aml-build.h         |   66 +-
> > include/hw/acpi/cpu_hotplug.h       |   10 +
> > include/hw/acpi/memory_hotplug.h    |    9 +
> > include/hw/acpi/pc-hotplug.h        |   44 +-
> > include/hw/timer/hpet.h             |    1 +
> > scripts/acpi_extract.py             |  367 --
> > scripts/acpi_extract_preprocess.py  |   51 -
> > scripts/update-acpi.sh              |    4 -
> > tests/bios-tables-test.c            |    7 + 26 files changed, 1848
> > insertions(+), 12573 deletions(-) create mode 100644
> > hw/acpi/cpu_hotplug_acpi_table.c create mode 100644
> > hw/acpi/memory_hotplug_acpi_table.c delete mode 100644
> > hw/i386/acpi-dsdt-cpu-hotplug.dsl delete mode 100644
> > hw/i386/acpi-dsdt-dbug.dsl delete mode 100644
> > hw/i386/acpi-dsdt-hpet.dsl delete mode 100644
> > hw/i386/acpi-dsdt-isa.dsl delete mode 100644
> > hw/i386/acpi-dsdt-mem-hotplug.dsl delete mode 100644
> > hw/i386/acpi-dsdt.dsl delete mode 100644
> > hw/i386/acpi-dsdt.hex.generated delete mode 100644
> > hw/i386/q35-acpi-dsdt.dsl delete mode 100644
> > hw/i386/q35-acpi-dsdt.hex.generated delete mode 100755
> > scripts/acpi_extract.py delete mode 100755
> > scripts/acpi_extract_preprocess.py delete mode 100644
> > scripts/update-acpi.sh
> >
> 

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (74 preceding siblings ...)
  2015-12-10 15:53 ` [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Marcel Apfelbaum
@ 2015-12-10 16:44 ` Igor Mammedov
  2015-12-19 20:38 ` Michael S. Tsirkin
  76 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-10 16:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

forgot to mention
git tree for testing is available at:

git@github.com:imammedo/qemu.git drop_ASL_support_v1
or
https://github.com/imammedo/qemu/commits/drop_ASL_support_v1

and fixed-up series with fixed comments is at:

git@github.com:imammedo/qemu.git drop_ASL_support_wip
or
https://github.com/imammedo/qemu/commits/drop_ASL_support_wip

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

* Re: [Qemu-devel] [PATCH v2 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-10 11:34     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
@ 2015-12-11  1:51       ` Shannon Zhao
  0 siblings, 0 replies; 165+ messages in thread
From: Shannon Zhao @ 2015-12-11  1:51 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: mst



On 2015/12/10 19:34, Igor Mammedov wrote:
> ASL Interrupt() macro translates to Extended Interrupt Descriptor
> which supports variable number of IRQs. It will be used for
> conversion of ASL code for pc/q35 machines that use it for
> returning several IRQs in _PSR object.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

Also, I'll include this patch in my patch set[1] as you suggested.

[1] Add system_powerdown support on ARM for ACPI and DT
> ---
> v2:
>  - fix incorrect irq number calculation in ARM:acpi_dsdt_add_virtio()
>      Reported-by: Shannon Zhao <zhaoshenglong@huawei.com>
> ---
>  hw/acpi/aml-build.c         | 22 +++++++++++++---------
>  hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
>  include/hw/acpi/aml-build.h |  2 +-
>  3 files changed, 26 insertions(+), 21 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 2ca9207..ee64d12 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
>  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
>                     AmlLevelAndEdge level_and_edge,
>                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> -                   uint32_t irq)
> +                   uint32_t *irq_list, uint8_t irq_count)
>  {
> +    int i;
>      Aml *var = aml_alloc();
>      uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
>                          | (high_and_low << 2) | (shared << 3);
> +    const int header_bytes_in_len = 2;
> +    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
> +
> +    assert(irq_count > 0);
>  
>      build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
> -    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
> -    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
> +    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
> +    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
>      build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
> -    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
> +    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
>  
> -    /* Interrupt Number */
> -    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
> -    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
> -    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
> -    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
> +    /* Interrupt Number List */
> +    for (i = 0; i < irq_count; i++) {
> +        build_append_int_noprefix(var->buf, irq_list[i], 4);
> +    }
>      return var;
>  }
>  
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 698b5f2..b0c1c4e 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
>  }
>  
>  static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> -                                           int uart_irq)
> +                                           uint32_t uart_irq)
>  {
>      Aml *dev = aml_device("COM0");
>      aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
> @@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
>                                         uart_memmap->size, AML_READ_WRITE));
>      aml_append(crs,
>                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                             AML_EXCLUSIVE, uart_irq));
> +                             AML_EXCLUSIVE, &uart_irq, 1));
>      aml_append(dev, aml_name_decl("_CRS", crs));
>  
>      /* The _ADR entry is used to link this device to the UART described
> @@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
>  }
>  
>  static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> -                                          int rtc_irq)
> +                                          uint32_t rtc_irq)
>  {
>      Aml *dev = aml_device("RTC0");
>      aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
> @@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
>                                         rtc_memmap->size, AML_READ_WRITE));
>      aml_append(crs,
>                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                             AML_EXCLUSIVE, rtc_irq));
> +                             AML_EXCLUSIVE, &rtc_irq, 1));
>      aml_append(dev, aml_name_decl("_CRS", crs));
>      aml_append(scope, dev);
>  }
> @@ -136,14 +136,14 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
>  
>  static void acpi_dsdt_add_virtio(Aml *scope,
>                                   const MemMapEntry *virtio_mmio_memmap,
> -                                 int mmio_irq, int num)
> +                                 uint32_t mmio_irq, int num)
>  {
>      hwaddr base = virtio_mmio_memmap->base;
>      hwaddr size = virtio_mmio_memmap->size;
> -    int irq = mmio_irq;
>      int i;
>  
>      for (i = 0; i < num; i++) {
> +        uint32_t irq = mmio_irq + i;
>          Aml *dev = aml_device("VR%02u", i);
>          aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005")));
>          aml_append(dev, aml_name_decl("_UID", aml_int(i)));
> @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
>          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irq, 1));
>          aml_append(dev, aml_name_decl("_CRS", crs));
>          aml_append(scope, dev);
>          base += size;
>      }
>  }
>  
> -static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> -                              bool use_highmem)
> +static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
> +                              uint32_t irq, bool use_highmem)
>  {
>      Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
>      int i, bus_no;
> @@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>  
>      /* Create GSI link device */
>      for (i = 0; i < PCI_NUM_PINS; i++) {
> +        uint32_t irqs =  irq + i;
>          Aml *dev_gsi = aml_device("GSI%d", i);
>          aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
>          aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
>          crs = aml_resource_template();
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irqs, 1));
>          aml_append(dev_gsi, aml_name_decl("_PRS", crs));
>          crs = aml_resource_template();
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irqs, 1));
>          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
>          method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
>          aml_append(dev_gsi, method);
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index ca365c9..a3a058f 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
>  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
>                     AmlLevelAndEdge level_and_edge,
>                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> -                   uint32_t irq);
> +                   uint32_t *irq_list, uint8_t irq_count);
>  Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
>              uint8_t aln, uint8_t len);
>  Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
> 

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
  2015-12-10  1:59   ` Shannon Zhao
  2015-12-10 13:12   ` Marcel Apfelbaum
@ 2015-12-11  2:36   ` Shannon Zhao
  2 siblings, 0 replies; 165+ messages in thread
From: Shannon Zhao @ 2015-12-11  2:36 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel



On 2015/12/10 7:41, Igor Mammedov wrote:
> Currently AML API doesn't compose terms in form of
> following pattern:
> 
>    Opcode Arg2 Arg2 [Dst]
> 
> but ASL used in piix4/q35 DSDT ACPI tables uses that
> form, so for clean conversion of it, AML API should
> be able to handle an optional 'Dst' argumet used there.
> 
> Since above pattern is used by arithmetic/bit ops,
> introduce helper that they could reuse.
> It reduces code duplication in existing 5 aml_foo()
> functions and also will prevent more duplication
> when exiting functions are extended to support
> optional 'Dst' argument.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

> ---
>  hw/acpi/aml-build.c | 61 ++++++++++++++++++++++++++++-------------------------
>  1 file changed, 32 insertions(+), 29 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index a6e4c54..22015d2 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -436,44 +436,55 @@ Aml *aml_store(Aml *val, Aml *target)
>      return var;
>  }
>  
> -/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> -Aml *aml_and(Aml *arg1, Aml *arg2)
> +/**
> + * build_opcode_2arg_dst:
> + * @op: 1-byte opcode
> + * @arg1: 1st operand
> + * @arg2: 2nd operand
> + * @dst: optional target to store to, set to NULL if it's not required
> + *
> + * An internal helper to compose AML terms that have
> + *   "Op Operand Operand Target"
> + * pattern.
> + *
> + * Returns: The newly allocated and composed according to patter Aml object.
> + */
> +static Aml *
> +build_opcode_2arg_dst(uint8_t op, Aml *arg1, Aml *arg2, Aml *dst)
>  {
> -    Aml *var = aml_opcode(0x7B /* AndOp */);
> +    Aml *var = aml_opcode(op);
>      aml_append(var, arg1);
>      aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    if (dst) {
> +        aml_append(var, dst);
> +    } else {
> +        build_append_byte(var->buf, 0x00 /* NullNameOp */);
> +    }
>      return var;
>  }
>  
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */
> +Aml *aml_and(Aml *arg1, Aml *arg2)
> +{
> +    return build_opcode_2arg_dst(0x7B /* AndOp */, arg1, arg2, NULL);
> +}
> +
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */
>  Aml *aml_or(Aml *arg1, Aml *arg2)
>  {
> -    Aml *var = aml_opcode(0x7D /* OrOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> -    return var;
> +    return build_opcode_2arg_dst(0x7D /* OrOp */, arg1, arg2, NULL);
>  }
>  
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftLeft */
>  Aml *aml_shiftleft(Aml *arg1, Aml *count)
>  {
> -    Aml *var = aml_opcode(0x79 /* ShiftLeftOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, count);
> -    build_append_byte(var->buf, 0x00); /* NullNameOp */
> -    return var;
> +    return build_opcode_2arg_dst(0x79 /* ShiftLeftOp */, arg1, count, NULL);
>  }
>  
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefShiftRight */
>  Aml *aml_shiftright(Aml *arg1, Aml *count)
>  {
> -    Aml *var = aml_opcode(0x7A /* ShiftRightOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, count);
> -    build_append_byte(var->buf, 0x00); /* NullNameOp */
> -    return var;
> +    return build_opcode_2arg_dst(0x7A /* ShiftRightOp */, arg1, count, NULL);
>  }
>  
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLLess */
> @@ -488,11 +499,7 @@ Aml *aml_lless(Aml *arg1, Aml *arg2)
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAdd */
>  Aml *aml_add(Aml *arg1, Aml *arg2)
>  {
> -    Aml *var = aml_opcode(0x72 /* AddOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, arg2);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> -    return var;
> +    return build_opcode_2arg_dst(0x72 /* AddOp */, arg1, arg2, NULL);
>  }
>  
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIncrement */
> @@ -506,11 +513,7 @@ Aml *aml_increment(Aml *arg)
>  /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */
>  Aml *aml_index(Aml *arg1, Aml *idx)
>  {
> -    Aml *var = aml_opcode(0x88 /* IndexOp */);
> -    aml_append(var, arg1);
> -    aml_append(var, idx);
> -    build_append_byte(var->buf, 0x00 /* NullNameOp */);
> -    return var;
> +    return build_opcode_2arg_dst(0x88 /* IndexOp */, arg1, idx, NULL);
>  }
>  
>  /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */
> 

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal()
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal() Igor Mammedov
  2015-12-10 12:52   ` Marcel Apfelbaum
@ 2015-12-11  2:39   ` Shannon Zhao
  1 sibling, 0 replies; 165+ messages in thread
From: Shannon Zhao @ 2015-12-11  2:39 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel



On 2015/12/10 7:40, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>  hw/acpi/aml-build.c         | 11 +++++++++++
>  include/hw/acpi/aml-build.h |  1 +
>  2 files changed, 12 insertions(+)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index dc59c08..c1a30a3 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -672,6 +672,17 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
>      return var;
>  }
>  
> +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreaterEqual */
> +Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2)
> +{
> +    /* LGreaterEqualOp := LNotOp LLessOp */
> +    Aml *var = aml_opcode(0x92 /* LNotOp */);
> +    build_append_byte(var->buf, 0x95 /* LLessOp */);
> +    aml_append(var, arg1);
> +    aml_append(var, arg2);
> +    return var;
> +}
> +
>  /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */
>  Aml *aml_if(Aml *predicate)
>  {
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 7296efb..2a4f815 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -229,6 +229,7 @@ Aml *aml_local(int num);
>  Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
>  Aml *aml_lnot(Aml *arg);
>  Aml *aml_equal(Aml *arg1, Aml *arg2);
> +Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2);
>  Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len,
>                     const char *name_format, ...) GCC_FMT_ATTR(4, 5);
>  Aml *aml_eisaid(const char *str);
> 

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 15/74] acpi: support serialized method
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 15/74] acpi: support serialized method Igor Mammedov
@ 2015-12-11  2:58   ` Shannon Zhao
  0 siblings, 0 replies; 165+ messages in thread
From: Shannon Zhao @ 2015-12-11  2:58 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: Xiao Guangrong



On 2015/12/10 7:41, Igor Mammedov wrote:
> From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
> 
> Add serialized method support so that explicit Mutex can be
> avoided
> 
> Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

> ---
>  hw/acpi/aml-build.c         | 17 +++++++++++++++--
>  hw/arm/virt-acpi-build.c    | 10 +++++-----
>  hw/i386/acpi-build.c        | 41 +++++++++++++++++++++--------------------
>  include/hw/acpi/aml-build.h |  8 +++++++-
>  4 files changed, 48 insertions(+), 28 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index e36b546..5094826 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -741,11 +741,24 @@ Aml *aml_while(Aml *predicate)
>  }
>  
>  /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */
> -Aml *aml_method(const char *name, int arg_count)
> +Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag)
>  {
>      Aml *var = aml_bundle(0x14 /* MethodOp */, AML_PACKAGE);
> +    int methodflags;
> +
> +    /*
> +     * MethodFlags:
> +     *   bit 0-2: ArgCount (0-7)
> +     *   bit 3: SerializeFlag
> +     *     0: NotSerialized
> +     *     1: Serialized
> +     *   bit 4-7: reserved (must be 0)
> +     */
> +    assert(arg_count < 8);
> +    methodflags = arg_count | (sflag << 3);
> +
>      build_append_namestring(var->buf, "%s", name);
> -    build_append_byte(var->buf, arg_count); /* MethodFlags: ArgCount */
> +    build_append_byte(var->buf, methodflags); /* MethodFlags: ArgCount */
>      return var;
>  }
>  
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 3c2c5d6..38ab844 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -212,16 +212,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
>                                   AML_EXCLUSIVE, irq + i));
>          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
> -        method = aml_method("_SRS", 1);
> +        method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
>          aml_append(dev_gsi, method);
>          aml_append(dev, dev_gsi);
>      }
>  
> -    method = aml_method("_CBA", 0);
> +    method = aml_method("_CBA", 0, AML_NOTSERIALIZED);
>      aml_append(method, aml_return(aml_int(base_ecam)));
>      aml_append(dev, method);
>  
> -    method = aml_method("_CRS", 0);
> +    method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
>      Aml *rbuf = aml_resource_template();
>      aml_append(rbuf,
>          aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE,
> @@ -254,7 +254,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>      /* Declare an _OSC (OS Control Handoff) method */
>      aml_append(dev, aml_name_decl("SUPP", aml_int(0)));
>      aml_append(dev, aml_name_decl("CTRL", aml_int(0)));
> -    method = aml_method("_OSC", 4);
> +    method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
>      aml_append(method,
>          aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
>  
> @@ -296,7 +296,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>      aml_append(method, elsectx);
>      aml_append(dev, method);
>  
> -    method = aml_method("_DSM", 4);
> +    method = aml_method("_DSM", 4, AML_NOTSERIALIZED);
>  
>      /* PCI Firmware Specification 3.0
>       * 4.6.1. _DSM for PCI Express Slot Information
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 8f7b95a..62afe5a 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -487,7 +487,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>          int64_t bsel_val = qint_get_int(qobject_to_qint(bsel));
>  
>          aml_append(parent_scope, aml_name_decl("BSEL", aml_int(bsel_val)));
> -        notify_method = aml_method("DVNT", 2);
> +        notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED);
>      }
>  
>      for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
> @@ -503,7 +503,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>                  dev = aml_device("S%.02X", PCI_DEVFN(slot, 0));
>                  aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
>                  aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
> -                method = aml_method("_EJ0", 1);
> +                method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
>                  aml_append(method,
>                      aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
>                  );
> @@ -546,22 +546,22 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>                  s3d = 0;
>              }
>  
> -            method = aml_method("_S1D", 0);
> +            method = aml_method("_S1D", 0, AML_NOTSERIALIZED);
>              aml_append(method, aml_return(aml_int(0)));
>              aml_append(dev, method);
>  
> -            method = aml_method("_S2D", 0);
> +            method = aml_method("_S2D", 0, AML_NOTSERIALIZED);
>              aml_append(method, aml_return(aml_int(0)));
>              aml_append(dev, method);
>  
> -            method = aml_method("_S3D", 0);
> +            method = aml_method("_S3D", 0, AML_NOTSERIALIZED);
>              aml_append(method, aml_return(aml_int(s3d)));
>              aml_append(dev, method);
>          } else if (hotplug_enabled_dev) {
>              /* add _SUN/_EJ0 to make slot hotpluggable  */
>              aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
>  
> -            method = aml_method("_EJ0", 1);
> +            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
>              aml_append(method,
>                  aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
>              );
> @@ -590,7 +590,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>      /* Append PCNT method to notify about events on local and child buses.
>       * Add unconditionally for root since DSDT expects it.
>       */
> -    method = aml_method("PCNT", 0);
> +    method = aml_method("PCNT", 0, AML_NOTSERIALIZED);
>  
>      /* If bus supports hotplug select it and notify about local events */
>      if (bsel) {
> @@ -651,7 +651,7 @@ static Aml *build_prt(void)
>  {
>      Aml *method, *while_ctx, *pin, *res;
>  
> -    method = aml_method("_PRT", 0);
> +    method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
>      res = aml_local(0);
>      pin = aml_local(1);
>      aml_append(method, aml_store(aml_package(128), res));
> @@ -1112,12 +1112,12 @@ build_ssdt(GArray *table_data, GArray *linker,
>          /* device present, functioning, decoding, shown in UI */
>          aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
>  
> -        method = aml_method("RDPT", 0);
> +        method = aml_method("RDPT", 0, AML_NOTSERIALIZED);
>          aml_append(method, aml_store(aml_name("PEPT"), aml_local(0)));
>          aml_append(method, aml_return(aml_local(0)));
>          aml_append(dev, method);
>  
> -        method = aml_method("WRPT", 1);
> +        method = aml_method("WRPT", 1, AML_NOTSERIALIZED);
>          aml_append(method, aml_store(aml_arg(0), aml_name("PEPT")));
>          aml_append(dev, method);
>  
> @@ -1153,15 +1153,15 @@ build_ssdt(GArray *table_data, GArray *linker,
>          for (i = 0; i < acpi_cpus; i++) {
>              dev = aml_processor(i, 0, 0, "CP%.02X", i);
>  
> -            method = aml_method("_MAT", 0);
> +            method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
>              aml_append(method, aml_return(aml_call1("CPMA", aml_int(i))));
>              aml_append(dev, method);
>  
> -            method = aml_method("_STA", 0);
> +            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
>              aml_append(method, aml_return(aml_call1("CPST", aml_int(i))));
>              aml_append(dev, method);
>  
> -            method = aml_method("_EJ0", 1);
> +            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
>              aml_append(method,
>                  aml_return(aml_call2("CPEJ", aml_int(i), aml_arg(0)))
>              );
> @@ -1174,7 +1174,7 @@ build_ssdt(GArray *table_data, GArray *linker,
>           *   Method(NTFY, 2) {If (LEqual(Arg0, 0x00)) {Notify(CP00, Arg1)} ...}
>           */
>          /* Arg0 = Processor ID = APIC ID */
> -        method = aml_method("NTFY", 2);
> +        method = aml_method("NTFY", 2, AML_NOTSERIALIZED);
>          for (i = 0; i < acpi_cpus; i++) {
>              ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
>              aml_append(ifctx,
> @@ -1269,29 +1269,29 @@ build_ssdt(GArray *table_data, GArray *linker,
>              aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
>              aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
>  
> -            method = aml_method("_CRS", 0);
> +            method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
>              s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
>              aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
>              aml_append(dev, method);
>  
> -            method = aml_method("_STA", 0);
> +            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
>              s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
>              aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
>              aml_append(dev, method);
>  
> -            method = aml_method("_PXM", 0);
> +            method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
>              s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
>              aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
>              aml_append(dev, method);
>  
> -            method = aml_method("_OST", 3);
> +            method = aml_method("_OST", 3, AML_NOTSERIALIZED);
>              s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
>              aml_append(method, aml_return(aml_call4(
>                  s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
>              )));
>              aml_append(dev, method);
>  
> -            method = aml_method("_EJ0", 1);
> +            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
>              s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
>              aml_append(method, aml_return(aml_call2(
>                         s, aml_name("_UID"), aml_arg(0))));
> @@ -1303,7 +1303,8 @@ build_ssdt(GArray *table_data, GArray *linker,
>          /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
>           *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
>           */
> -        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2);
> +        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
> +                            AML_NOTSERIALIZED);
>          for (i = 0; i < nr_mem; i++) {
>              ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
>              aml_append(ifctx,
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 944b001..cd82065 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -148,6 +148,12 @@ typedef enum {
>      AML_SHARED_AND_WAKE = 3,
>  } AmlShared;
>  
> +/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: MethodFlags */
> +typedef enum {
> +    AML_NOTSERIALIZED = 0,
> +    AML_SERIALIZED = 1,
> +} AmlSerializeFlag;
> +
>  typedef
>  struct AcpiBuildTables {
>      GArray *table_data;
> @@ -268,7 +274,7 @@ Aml *aml_sleep(uint64_t msec);
>  /* Block AML object primitives */
>  Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
>  Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
> -Aml *aml_method(const char *name, int arg_count);
> +Aml *aml_method(const char *name, int arg_count, AmlSerializeFlag sflag);
>  Aml *aml_if(Aml *predicate);
>  Aml *aml_else(void);
>  Aml *aml_while(Aml *predicate);
> 

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-10 16:17     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
@ 2015-12-13 15:19       ` Marcel Apfelbaum
  2015-12-14 13:20         ` Igor Mammedov
  2015-12-19 19:23       ` Michael S. Tsirkin
  1 sibling, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-13 15:19 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: mst

On 12/10/2015 06:17 PM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v2:
>   - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
>     Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>
> pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
>   hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
>   2 files changed, 32 insertions(+), 69 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index cf98037..1b065df 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>       qobject_decref(bsel);
>   }
>
> +static Aml *build_prt_entry(const char *link_name)
> +{
> +    Aml *a_zero = aml_int(0);
> +    Aml *pkg = aml_package(4);
> +    aml_append(pkg, a_zero);
> +    aml_append(pkg, a_zero);
> +    aml_append(pkg, aml_name("%s", link_name));
> +    aml_append(pkg, a_zero);
> +    return pkg;
> +}
> +
>   /*
>    * initialize_route - Initialize the interrupt routing rule
>    * through a specific LINK:
> @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
>                                Aml *lnk_idx, int idx)
>   {
>       Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> -    Aml *pkg = aml_package(4);
> +    Aml *pkg = build_prt_entry(link_name);
>
> -    aml_append(pkg, aml_int(0));
> -    aml_append(pkg, aml_int(0));
> -    aml_append(pkg, aml_name("%s", link_name));
> -    aml_append(pkg, aml_int(0));
>       aml_append(if_ctx, aml_store(pkg, route));
>
>       return if_ctx;
> @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
>    * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
>    *
>    */
> -static Aml *build_prt(void)
> +static Aml *build_prt(bool is_pci0_prt)
>   {
> -    Aml *method, *while_ctx, *pin, *res;
> +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;
>
>       method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
>       res = aml_local(0);
> @@ -678,7 +685,19 @@ static Aml *build_prt(void)
>
>           /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
>           aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> -        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> +        if (is_pci0_prt) {
> +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> +            /* device 1 is the power-management device, needs SCI */
> +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
> +            aml_append(if_ctx, if_ctx2);
> +            else_ctx2 = aml_else();
> +            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
> +            aml_append(if_ctx, else_ctx2);
> +            aml_append(while_ctx, if_ctx);
> +        } else {
> +            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> +        }
>           aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
>           aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
>
> @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
>       Aml *method;
>       uint32_t irqs;
>       Aml *sb_scope = aml_scope("_SB");
> +    Aml *pci0_scope = aml_scope("PCI0");
> +
> +    aml_append(pci0_scope, build_prt(true));
> +    aml_append(sb_scope, pci0_scope);
>
>       field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
>       aml_append(field, aml_named_field("PRQ0", 8));
> @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
>                   aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
>               }
>
> -            aml_append(dev, build_prt());
> +            aml_append(dev, build_prt(false));
>               crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
>                               io_ranges, mem_ranges);
>               aml_append(dev, aml_name_decl("_CRS", crs));
> diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> index bc6bd45..5d741dd 100644
> --- a/hw/i386/acpi-dsdt.dsl
> +++ b/hw/i386/acpi-dsdt.dsl
> @@ -78,64 +78,4 @@ DefinitionBlock (
>           /* Hotplug notification method supplied by SSDT */
>           External(\_SB.PCI0.PCNT, MethodObj)
>       }
> -
> -
> -/****************************************************************
> - * PCI IRQs
> - ****************************************************************/
> -
> -    Scope(\_SB) {
> -        Scope(PCI0) {
> -            Method (_PRT, 0) {
> -                Store(Package(128) {}, Local0)
> -                Store(Zero, Local1)
> -                While(LLess(Local1, 128)) {
> -                    // slot = pin >> 2
> -                    Store(ShiftRight(Local1, 2), Local2)
> -
> -                    // lnk = (slot + pin) & 3
> -                    Store(And(Add(Local1, Local2), 3), Local3)
> -                    If (LEqual(Local3, 0)) {
> -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> -                    }
> -                    If (LEqual(Local3, 1)) {
> -                        // device 1 is the power-management device, needs SCI
> -                        If (LEqual(Local1, 4)) {
> -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> -                        } Else {
> -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> -                        }
> -                    }
> -                    If (LEqual(Local3, 2)) {
> -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> -                    }
> -                    If (LEqual(Local3, 3)) {
> -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> -                    }
> -
> -                    // Complete the interrupt routing entry:
> -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> -
> -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> -                    Store(And(Local1, 3),                    Index(Local4, 1))
> -                    Store(Local4,                            Index(Local0, Local1))
> -
> -                    Increment(Local1)
> -                }
> -
> -                Return(Local0)
> -            }
> -        }
> -
> -
> -        External(PRQ0, FieldUnitObj)
> -        External(PRQ1, FieldUnitObj)
> -        External(PRQ2, FieldUnitObj)
> -        External(PRQ3, FieldUnitObj)
> -        External(LNKA, DeviceObj)
> -        External(LNKB, DeviceObj)
> -        External(LNKC, DeviceObj)
> -        External(LNKD, DeviceObj)
> -        External(LNKS, DeviceObj)
> -    }
>   }
>

Assuming that there are no differences in the PRT:

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

Thanks,
Marcel

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-10 16:31   ` Igor Mammedov
@ 2015-12-13 15:24     ` Marcel Apfelbaum
  0 siblings, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-13 15:24 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Peter Maydell, Eduardo Habkost, Michael S. Tsirkin, qemu-devel,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

On 12/10/2015 06:31 PM, Igor Mammedov wrote:
> On Thu, 10 Dec 2015 17:53:31 +0200
> Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:
>
> [...]
>> Hi Igor,
>> Please consider splinting this series...
>>
>> Maybe ACPI new constructs first, then memhp/cpu, piix/q35. (only a
>> suggestion) In this you will have some "sane" 20 something patches
>> series that can be more easily "swallowed".
> I'd also prefer to do it incrementally but
> I've tried something like this before, but Michael suggested to
> avoid optimizations/refactoring and make it so that conversion would
> pass 'make check' so it would be easy to prove that it hasn't regressed
> anything and to do it the only way is to convert whole DSDT at once.
>
> Nevertheless, the series more or less organized with split in mind,
> so it's possible first commit AML API patches ('acpi:' prefixed)
> and then just go in order the blocks as they are in series:
>
> memhp/cpuhp/misc devices/piix4/q35/final cleanup

Indeed, the way the series is organized, it can be split-ted/committed
into the mentioned blocks without breaking make check.

However, if Michael is willing to take it "as is" ... :)
I'll do my best to go over it this week.
Marcel


>
>
>>
>> Thanks,
>> Marcel
>>
>>>
>>> CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
>>> CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI
>>> Subsystem) CC: Peter Maydell <peter.maydell@linaro.org>
>>> (maintainer:ARM) CC: Paolo Bonzini <pbonzini@redhat.com>
>>> (maintainer:X86) CC: Richard Henderson <rth@twiddle.net>
>>> (maintainer:X86) CC: Eduardo Habkost <ehabkost@redhat.com>
>>> (maintainer:X86) CC: qemu-arm@nongnu.org (open list:ARM ACPI
>>> Subsystem)
>>>
>>> Igor Mammedov (70):
>>>     tests: acpi: print ASL diff in verbose mode
>>>     acpi: add aml_lgreater_equal()
>>>     acpi: add aml_create_qword_field()
>>>     acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
>>>     acpi: extend aml_add() to accept target argument
>>>     acpi: add aml_decrement() and aml_subtract()
>>>     acpi: add aml_call0() helper
>>>     acpi: add aml_to_integer()
>>>     acpi: extend aml_shiftright() to accept target argument
>>>     acpi: add aml_alias()
>>>     acpi: add aml_sleep()
>>>     acpi: add aml_lor()
>>>     acpi: add aml_lgreater()
>>>     acpi: extend aml_field() to support LockRule
>>>     acpi: add aml_to_hexstring()
>>>     acpi: add aml_to_buffer()
>>>     acpi add aml_dma()
>>>     acpi: extend aml_or() to accept target argument
>>>     acpi: extend aml_and() to accept target argument
>>>     acpi: extend aml_interrupt() to support multiple irqs
>>>     pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT
>>> code pc: acpi: memhp: move MHPD._STA method into SSDT
>>>     pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
>>>     pc: acpi: memhp: move MHPD.MSCN method into SSDT
>>>     pc: acpi: memhp: move MHPD.MRST method into SSDT
>>>     pc: acpi: memhp: move MHPD.MPXM method into SSDT
>>>     pc: acpi: memhp: move MHPD.MOST method into SSDT
>>>     pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
>>>     pc: acpi: memhp: move MHPD.MCRS method into SSDT
>>>     pc: acpi: memhp: move MHPD Device into SSDT
>>>     pc: acpi: factor out memhp code from build_ssdt() into separate
>>>       function
>>>     pc: acpi: memhp: move \_GPE._E03 into SSDT
>>>     pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
>>>     pc: acpi: drop unused CPU_STATUS_LEN from DSDT
>>>     pc: acpi: cpuhp: move CPEJ() method to SSDT
>>>     pc: acpi: cpuhp: move CPMA() method into SSDT
>>>     pc: acpi: cpuhp: move CPST() method into SSDT
>>>     pc: acpi: cpuhp: move PRSC() method into SSDT
>>>     pc: acpi: cpuhp: move \_GPE._E02() into SSDT
>>>     pc: acpi: factor out cpu hotplug code from build_ssdt() into
>>> separate function
>>>     pc: acpi: move HPET from DSDT to SSDT
>>>     pc: acpi: move DBUG() from DSDT to SSDT
>>>     pc: acpi: move RTC device from DSDT to SSDT
>>>     pc: acpi: move KBD device from DSDT to SSDT
>>>     pc: acpi: move MOU device from DSDT to SSDT
>>>     pc: acpi: move FDC0 device from DSDT to SSDT
>>>     pc: acpi: move LPT device from DSDT to SSDT
>>>     pc: acpi: move COM devices from DSDT to SSDT
>>>     pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
>>>     pc: acpi: move remaining GPE handlers into SSDT
>>>     pc: acpi: pci: move link devices into SSDT
>>>     pc: acpi: piix4: move IQCR() into SSDT
>>>     pc: acpi: piix4: move IQST() into SSDT
>>>     pc: acpi: piix4: move PCI0._PRT() into SSDT
>>>     pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
>>>     pc: acpi: piix4: acpi move PCI0 device to SSDT
>>>     pc: acpi: q35: move GSI links to SSDT
>>>     pc: acpi: q35: move link devices to SSDT
>>>     pc: acpi: q35: move IQCR() into SSDT
>>>     pc: acpi: q35: move IQST() into SSDT
>>>     pc: acpi: q35: move ISA bridge into SSDT
>>>     pc: acpi: q35: move _PRT() into SSDT
>>>     pc: acpi: q35: move PRTA routing table into SSDT
>>>     pc: acpi: q35: move PRTP routing table into SSDT
>>>     pc: acpi: q35: move _PIC() method into SSDT
>>>     pc: acpi: q35: move PCI0._OSC() method into SSDT
>>>     pc: acpi: q35: move PCI0 device definition into SSDT
>>>     pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
>>>     pc: acpi: switch to AML API composed DSDT
>>>     pc: acpi: remove unused ASL templates and related blobs/utils
>>>
>>> Xiao Guangrong (4):
>>>     acpi: add aml_derefof
>>>     acpi: add aml_sizeof
>>>     acpi: add aml_mutex(), aml_acquire(), aml_release()
>>>     acpi: support serialized method
>>>
>>>    hw/acpi/Makefile.objs               |    4 +-
>>>    hw/acpi/aml-build.c                 |  294 +-
>>>    hw/acpi/cpu_hotplug_acpi_table.c    |  124 +
>>>    hw/acpi/memory_hotplug_acpi_table.c |  249 ++
>>>    hw/arm/virt-acpi-build.c            |   41 +-
>>>    hw/i386/Makefile.objs               |   31 +-
>>>    hw/i386/acpi-build.c                | 1329 ++++--
>>>    hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   90 -
>>>    hw/i386/acpi-dsdt-dbug.dsl          |   41 -
>>>    hw/i386/acpi-dsdt-hpet.dsl          |   48 -
>>>    hw/i386/acpi-dsdt-isa.dsl           |  117 -
>>>    hw/i386/acpi-dsdt-mem-hotplug.dsl   |  171 -
>>>    hw/i386/acpi-dsdt.dsl               |  303 --
>>>    hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
>>>    hw/i386/q35-acpi-dsdt.dsl           |  436 --
>>>    hw/i386/q35-acpi-dsdt.hex.generated | 7610
>>> -----------------------------------
>>> hw/timer/hpet.c                     |    2 +-
>>> include/hw/acpi/aml-build.h         |   66 +-
>>> include/hw/acpi/cpu_hotplug.h       |   10 +
>>> include/hw/acpi/memory_hotplug.h    |    9 +
>>> include/hw/acpi/pc-hotplug.h        |   44 +-
>>> include/hw/timer/hpet.h             |    1 +
>>> scripts/acpi_extract.py             |  367 --
>>> scripts/acpi_extract_preprocess.py  |   51 -
>>> scripts/update-acpi.sh              |    4 -
>>> tests/bios-tables-test.c            |    7 + 26 files changed, 1848
>>> insertions(+), 12573 deletions(-) create mode 100644
>>> hw/acpi/cpu_hotplug_acpi_table.c create mode 100644
>>> hw/acpi/memory_hotplug_acpi_table.c delete mode 100644
>>> hw/i386/acpi-dsdt-cpu-hotplug.dsl delete mode 100644
>>> hw/i386/acpi-dsdt-dbug.dsl delete mode 100644
>>> hw/i386/acpi-dsdt-hpet.dsl delete mode 100644
>>> hw/i386/acpi-dsdt-isa.dsl delete mode 100644
>>> hw/i386/acpi-dsdt-mem-hotplug.dsl delete mode 100644
>>> hw/i386/acpi-dsdt.dsl delete mode 100644
>>> hw/i386/acpi-dsdt.hex.generated delete mode 100644
>>> hw/i386/q35-acpi-dsdt.dsl delete mode 100644
>>> hw/i386/q35-acpi-dsdt.hex.generated delete mode 100755
>>> scripts/acpi_extract.py delete mode 100755
>>> scripts/acpi_extract_preprocess.py delete mode 100644
>>> scripts/update-acpi.sh
>>>
>>
>

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-13 15:19       ` Marcel Apfelbaum
@ 2015-12-14 13:20         ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-14 13:20 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel, mst

On Sun, 13 Dec 2015 17:19:23 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

> On 12/10/2015 06:17 PM, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > v2:
> >   - adapt build_prt() for using for PCI0._PRT(), reduces code
> > duplication, Suggested-by: Marcel Apfelbaum
> > <marcel.apfelbaum@gmail.com>
> >
> > pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
> >   hw/i386/acpi-dsdt.dsl | 60
> > --------------------------------------------------- 2 files
> > changed, 32 insertions(+), 69 deletions(-)
> >
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index cf98037..1b065df 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml
> > *parent_scope, PCIBus *bus, qobject_decref(bsel);
> >   }
> >
> > +static Aml *build_prt_entry(const char *link_name)
> > +{
> > +    Aml *a_zero = aml_int(0);
> > +    Aml *pkg = aml_package(4);
> > +    aml_append(pkg, a_zero);
> > +    aml_append(pkg, a_zero);
> > +    aml_append(pkg, aml_name("%s", link_name));
> > +    aml_append(pkg, a_zero);
> > +    return pkg;
> > +}
> > +
> >   /*
> >    * initialize_route - Initialize the interrupt routing rule
> >    * through a specific LINK:
> > @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const
> > char *link_name, Aml *lnk_idx, int idx)
> >   {
> >       Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> > -    Aml *pkg = aml_package(4);
> > +    Aml *pkg = build_prt_entry(link_name);
> >
> > -    aml_append(pkg, aml_int(0));
> > -    aml_append(pkg, aml_int(0));
> > -    aml_append(pkg, aml_name("%s", link_name));
> > -    aml_append(pkg, aml_int(0));
> >       aml_append(if_ctx, aml_store(pkg, route));
> >
> >       return if_ctx;
> > @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const
> > char *link_name,
> >    * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
> >    *
> >    */
> > -static Aml *build_prt(void)
> > +static Aml *build_prt(bool is_pci0_prt)
> >   {
> > -    Aml *method, *while_ctx, *pin, *res;
> > +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2,
> > *else_ctx2;
> >
> >       method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> >       res = aml_local(0);
> > @@ -678,7 +685,19 @@ static Aml *build_prt(void)
> >
> >           /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3
> > */ aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx,
> > 0));
> > -        aml_append(while_ctx, initialize_route(route, "LNKA",
> > lnk_idx, 1));
> > +        if (is_pci0_prt) {
> > +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> > +            /* device 1 is the power-management device, needs SCI
> > */
> > +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> > +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"),
> > route));
> > +            aml_append(if_ctx, if_ctx2);
> > +            else_ctx2 = aml_else();
> > +            aml_append(else_ctx2,
> > aml_store(build_prt_entry("LNKA"), route));
> > +            aml_append(if_ctx, else_ctx2);
> > +            aml_append(while_ctx, if_ctx);
> > +        } else {
> > +            aml_append(while_ctx, initialize_route(route, "LNKA",
> > lnk_idx, 1));
> > +        }
> >           aml_append(while_ctx, initialize_route(route, "LNKB",
> > lnk_idx, 2)); aml_append(while_ctx, initialize_route(route, "LNKC",
> > lnk_idx, 3));
> >
> > @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
> >       Aml *method;
> >       uint32_t irqs;
> >       Aml *sb_scope = aml_scope("_SB");
> > +    Aml *pci0_scope = aml_scope("PCI0");
> > +
> > +    aml_append(pci0_scope, build_prt(true));
> > +    aml_append(sb_scope, pci0_scope);
> >
> >       field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK,
> > AML_PRESERVE); aml_append(field, aml_named_field("PRQ0", 8));
> > @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
> >                   aml_append(dev, aml_name_decl("_PXM",
> > aml_int(numa_node))); }
> >
> > -            aml_append(dev, build_prt());
> > +            aml_append(dev, build_prt(false));
> >               crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
> >                               io_ranges, mem_ranges);
> >               aml_append(dev, aml_name_decl("_CRS", crs));
> > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > index bc6bd45..5d741dd 100644
> > --- a/hw/i386/acpi-dsdt.dsl
> > +++ b/hw/i386/acpi-dsdt.dsl
> > @@ -78,64 +78,4 @@ DefinitionBlock (
> >           /* Hotplug notification method supplied by SSDT */
> >           External(\_SB.PCI0.PCNT, MethodObj)
> >       }
> > -
> > -
> > -/****************************************************************
> > - * PCI IRQs
> > - ****************************************************************/
> > -
> > -    Scope(\_SB) {
> > -        Scope(PCI0) {
> > -            Method (_PRT, 0) {
> > -                Store(Package(128) {}, Local0)
> > -                Store(Zero, Local1)
> > -                While(LLess(Local1, 128)) {
> > -                    // slot = pin >> 2
> > -                    Store(ShiftRight(Local1, 2), Local2)
> > -
> > -                    // lnk = (slot + pin) & 3
> > -                    Store(And(Add(Local1, Local2), 3), Local3)
> > -                    If (LEqual(Local3, 0)) {
> > -                        Store(Package(4) { Zero, Zero, LNKD,
> > Zero }, Local4)
> > -                    }
> > -                    If (LEqual(Local3, 1)) {
> > -                        // device 1 is the power-management
> > device, needs SCI
> > -                        If (LEqual(Local1, 4)) {
> > -                            Store(Package(4) { Zero, Zero, LNKS,
> > Zero }, Local4)
> > -                        } Else {
> > -                            Store(Package(4) { Zero, Zero, LNKA,
> > Zero }, Local4)
> > -                        }
> > -                    }
> > -                    If (LEqual(Local3, 2)) {
> > -                        Store(Package(4) { Zero, Zero, LNKB,
> > Zero }, Local4)
> > -                    }
> > -                    If (LEqual(Local3, 3)) {
> > -                        Store(Package(4) { Zero, Zero, LNKC,
> > Zero }, Local4)
> > -                    }
> > -
> > -                    // Complete the interrupt routing entry:
> > -                    //    Package(4) { 0x[slot]FFFF, [pin],
> > [link], 0) } -
> > -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF),
> > Index(Local4, 0))
> > -                    Store(And(Local1, 3),
> > Index(Local4, 1))
> > -                    Store(Local4,
> > Index(Local0, Local1)) -
> > -                    Increment(Local1)
> > -                }
> > -
> > -                Return(Local0)
> > -            }
> > -        }
> > -
> > -
> > -        External(PRQ0, FieldUnitObj)
> > -        External(PRQ1, FieldUnitObj)
> > -        External(PRQ2, FieldUnitObj)
> > -        External(PRQ3, FieldUnitObj)
> > -        External(LNKA, DeviceObj)
> > -        External(LNKB, DeviceObj)
> > -        External(LNKC, DeviceObj)
> > -        External(LNKD, DeviceObj)
> > -        External(LNKS, DeviceObj)
> > -    }
> >   }
> >
> 
> Assuming that there are no differences in the PRT:
> 
> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Yep, series still passes 'make check' so there aren't any
differences in DSDT nor SSDT

> 
> Thanks,
> Marcel

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

* Re: [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT Igor Mammedov
@ 2015-12-16 12:08   ` Marcel Apfelbaum
  2015-12-16 14:30     ` Igor Mammedov
  2015-12-16 14:47   ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  1 sibling, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-16 12:08 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/memory_hotplug_acpi_table.c | 12 ++++++++++++
>   hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
>   2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
> index 25bbf5e..de51717 100644
> --- a/hw/acpi/memory_hotplug_acpi_table.c
> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> @@ -29,11 +29,23 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
>   {
>       Aml *pci_scope;
>       Aml *ctrl_dev;
> +    Aml *method;
> +    Aml *ifctx;
> +    Aml *a_zero = aml_int(0);
> +    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
>
>       /* scope for memory hotplug controller device node */
>       pci_scope = aml_scope("_SB.PCI0");
>       ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
>       {
> +        /* MHPD._STA() method */
> +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> +            aml_append(ifctx, aml_return(a_zero));

Hi Igor,

The indentation is a little off here. I understand *why*
you are doing it, to emphasize that is an if statement.
However this is not clear I think.

What I would do is use the { } parentheses for all the method:

      method = aml_method("_STA", 0, AML_NOTSERIALIZED);
      {
           ifctx = aml_if(aml_equal(a_slots_nr, a_zero))
           {
                aml_append(ifctx, aml_return(a_zero));
           }
           aml_append(method, ifctx);
           /* present, functioning, decoding, not shown in UI */
           aml_append(method, aml_return(aml_int(0xB)));
      }
      aml_append(ctrl_dev, method);


As you can see the, the _STA method is looking good
both as C code and is also easy to see the asl (compare with the original asl).

This is of course only a suggestion, me trying to help :)
I see no problem in the conversion itself.

Thanks,
Marcel

> +        aml_append(method, ifctx);
> +        /* present, functioning, decoding, not shown in UI */
> +        aml_append(method, aml_return(aml_int(0xB)));
> +        aml_append(ctrl_dev, method);
>       }
>       aml_append(pci_scope, ctrl_dev);
>       aml_append(ctx, pci_scope);
> diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> index c2bb6a1..b4eacc9 100644
> --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> @@ -35,14 +35,6 @@
>               External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
>               External(MEMORY_SLOT_OST_STATUS, FieldU835163

nitObj) // _OST status code, write only
>
> -            Method(_STA, 0) {
> -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> -                    Return(0x0)
> -                }
> -                /* present, functioning, decoding, not shown in UI */
> -                Return(0xB)
> -            }
> -
>               Mutex (MEMORY_SLOT_LOCK, 0)
>
>               Method(MEMORY_SLOT_SCAN_METHOD, 0) {
>

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Igor Mammedov
  2015-12-10 12:45   ` Marcel Apfelbaum
@ 2015-12-16 13:25   ` Marcel Apfelbaum
  2015-12-16 14:25     ` Igor Mammedov
  1 sibling, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-16 13:25 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel

On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   hw/acpi/Makefile.objs               |  2 +-
>   hw/acpi/memory_hotplug_acpi_table.c | 40 +++++++++++++++++++++++++++++++++++++
>   hw/i386/acpi-build.c                |  3 +++
>   include/hw/acpi/memory_hotplug.h    |  4 ++++
>   4 files changed, 48 insertions(+), 1 deletion(-)
>   create mode 100644 hw/acpi/memory_hotplug_acpi_table.c
>
> diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
> index 7d3230c..c04064e 100644
> --- a/hw/acpi/Makefile.objs
> +++ b/hw/acpi/Makefile.objs
> @@ -1,7 +1,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
> +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
>   common-obj-$(CONFIG_ACPI) += acpi_interface.o
>   common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
>   common-obj-$(CONFIG_ACPI) += aml-build.o
> diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
> new file mode 100644
> index 0000000..25bbf5e
> --- /dev/null
> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> @@ -0,0 +1,40 @@
> +/*
> + * Memory hotplug AML code of DSDT ACPI table

You are advertising as part of the DSDT code, but you are putting in SSDT, right?
By the way, maybe the answer is clear, but why are you moving it to SSDT?

Last thing, from this patch forward (until maybe the last one) make check fails, right?
(Specifically the acpi tests)


> + *
> + * Copyright (C) 2013 Red Hat Inc
> + *
> + * Author: Igor Mammedov <imammedo@redhat.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> +
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> +
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */

Regarding the license, I was advised to just add a pointer to the main license
instead of copying it in each file, something like:

    This work is licensed under the terms of the GNU GPL, version 2 or later.
    See the COPYING file in the top-level directory.

Thanks,
Marcel

> +
> +#include <stdbool.h>
> +#include "hw/acpi/memory_hotplug.h"
> +#include "include/hw/acpi/pc-hotplug.h"
> +#include "hw/boards.h"
> +
> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> +                              uint16_t io_base, uint16_t io_len)
> +{
> +    Aml *pci_scope;
> +    Aml *ctrl_dev;
> +
> +    /* scope for memory hotplug controller device node */
> +    pci_scope = aml_scope("_SB.PCI0");
> +    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> +    {
> +    }
> +    aml_append(pci_scope, ctrl_dev);
> +    aml_append(ctx, pci_scope);
> +}
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index bbd37e9..1b609e6 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
>       /* Reserve space for header */
>       acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
>
> +    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> +                             pm->mem_hp_io_len);
> +
>       /* Extra PCI root buses are implemented  only for i440fx */
>       bus = find_i440fx();
>       if (bus) {
> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
> index 1342adb..b6e9f50 100644
> --- a/include/hw/acpi/memory_hotplug.h
> +++ b/include/hw/acpi/memory_hotplug.h
> @@ -4,6 +4,7 @@
>   #include "hw/qdev-core.h"
>   #include "hw/acpi/acpi.h"
>   #include "migration/vmstate.h"
> +#include "hw/acpi/aml-build.h"
>
>   /**
>    * MemStatus:
> @@ -45,4 +46,7 @@ extern const VMStateDescription vmstate_memory_hotplug;
>                      vmstate_memory_hotplug, MemHotplugState)
>
>   void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list);
> +
> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> +                              uint16_t io_base, uint16_t io_len);
>   #endif
>

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-16 13:25   ` Marcel Apfelbaum
@ 2015-12-16 14:25     ` Igor Mammedov
  2015-12-17 12:14       ` Marcel Apfelbaum
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-16 14:25 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel

On Wed, 16 Dec 2015 15:25:46 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/acpi/Makefile.objs               |  2 +-
> >   hw/acpi/memory_hotplug_acpi_table.c | 40
> > +++++++++++++++++++++++++++++++++++++
> > hw/i386/acpi-build.c                |  3 +++
> > include/hw/acpi/memory_hotplug.h    |  4 ++++ 4 files changed, 48
> > insertions(+), 1 deletion(-) create mode 100644
> > hw/acpi/memory_hotplug_acpi_table.c
> >
> > diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
> > index 7d3230c..c04064e 100644
> > --- a/hw/acpi/Makefile.objs
> > +++ b/hw/acpi/Makefile.objs
> > @@ -1,7 +1,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
> > +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
> > memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI) +=
> > acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
> >   common-obj-$(CONFIG_ACPI) += aml-build.o
> > diff --git a/hw/acpi/memory_hotplug_acpi_table.c
> > b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644
> > index 0000000..25bbf5e
> > --- /dev/null
> > +++ b/hw/acpi/memory_hotplug_acpi_table.c
> > @@ -0,0 +1,40 @@
> > +/*
> > + * Memory hotplug AML code of DSDT ACPI table
> 
> You are advertising as part of the DSDT code, but you are putting in
> SSDT, right? By the way, maybe the answer is clear, but why are you
> moving it to SSDT?
There could be only one instance of DSDT and I temporarily put
converted DSDT bits in SSDT until conversion is complete.

> 
> Last thing, from this patch forward (until maybe the last one) make
> check fails, right? (Specifically the acpi tests)
yes, starting from this patch and upto 72nd acpi test fails since
patches move DSDT bits into SSDT.
But patch 73, when precompiled DSDT is empty and provides only header,
moves converted DSDT content out of SSDT into QEMU
generated DSDT, and drops ASL template.  

> 
> 
> > + *
> > + * Copyright (C) 2013 Red Hat Inc
> > + *
> > + * Author: Igor Mammedov <imammedo@redhat.com>
> > + *
> > + * This program is free software; you can redistribute it and/or
> > modify
> > + * it under the terms of the GNU General Public License as
> > published by
> > + * the Free Software Foundation; either version 2 of the License,
> > or
> > + * (at your option) any later version.
> > +
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > +
> > + * You should have received a copy of the GNU General Public
> > License along
> > + * with this program; if not, see <http://www.gnu.org/licenses/>.
> > + */
> 
> Regarding the license, I was advised to just add a pointer to the
> main license instead of copying it in each file, something like:
> 
>     This work is licensed under the terms of the GNU GPL, version 2
> or later. See the COPYING file in the top-level directory.
> 
> Thanks,
> Marcel
> 
> > +
> > +#include <stdbool.h>
> > +#include "hw/acpi/memory_hotplug.h"
> > +#include "include/hw/acpi/pc-hotplug.h"
> > +#include "hw/boards.h"
> > +
> > +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> > +                              uint16_t io_base, uint16_t io_len)
> > +{
> > +    Aml *pci_scope;
> > +    Aml *ctrl_dev;
> > +
> > +    /* scope for memory hotplug controller device node */
> > +    pci_scope = aml_scope("_SB.PCI0");
> > +    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> > +    {
> > +    }
> > +    aml_append(pci_scope, ctrl_dev);
> > +    aml_append(ctx, pci_scope);
> > +}
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index bbd37e9..1b609e6 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
> >       /* Reserve space for header */
> >       acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
> >
> > +    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> > +                             pm->mem_hp_io_len);
> > +
> >       /* Extra PCI root buses are implemented  only for i440fx */
> >       bus = find_i440fx();
> >       if (bus) {
> > diff --git a/include/hw/acpi/memory_hotplug.h
> > b/include/hw/acpi/memory_hotplug.h index 1342adb..b6e9f50 100644
> > --- a/include/hw/acpi/memory_hotplug.h
> > +++ b/include/hw/acpi/memory_hotplug.h
> > @@ -4,6 +4,7 @@
> >   #include "hw/qdev-core.h"
> >   #include "hw/acpi/acpi.h"
> >   #include "migration/vmstate.h"
> > +#include "hw/acpi/aml-build.h"
> >
> >   /**
> >    * MemStatus:
> > @@ -45,4 +46,7 @@ extern const VMStateDescription
> > vmstate_memory_hotplug; vmstate_memory_hotplug, MemHotplugState)
> >
> >   void acpi_memory_ospm_status(MemHotplugState *mem_st,
> > ACPIOSTInfoList ***list); +
> > +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> > +                              uint16_t io_base, uint16_t io_len);
> >   #endif
> >
> 

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

* Re: [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-16 12:08   ` Marcel Apfelbaum
@ 2015-12-16 14:30     ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-16 14:30 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel

On Wed, 16 Dec 2015 14:08:17 +0200
Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:

> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >   hw/acpi/memory_hotplug_acpi_table.c | 12 ++++++++++++
> >   hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
> >   2 files changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/hw/acpi/memory_hotplug_acpi_table.c
> > b/hw/acpi/memory_hotplug_acpi_table.c index 25bbf5e..de51717 100644
> > --- a/hw/acpi/memory_hotplug_acpi_table.c
> > +++ b/hw/acpi/memory_hotplug_acpi_table.c
> > @@ -29,11 +29,23 @@ void build_memory_hotplug_aml(Aml *ctx,
> > uint32_t nr_mem, {
> >       Aml *pci_scope;
> >       Aml *ctrl_dev;
> > +    Aml *method;
> > +    Aml *ifctx;
> > +    Aml *a_zero = aml_int(0);
> > +    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
> >
> >       /* scope for memory hotplug controller device node */
> >       pci_scope = aml_scope("_SB.PCI0");
> >       ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> >       {
> > +        /* MHPD._STA() method */
> > +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> > +            aml_append(ifctx, aml_return(a_zero));
> 
> Hi Igor,
> 
> The indentation is a little off here. I understand *why*
> you are doing it, to emphasize that is an if statement.
> However this is not clear I think.
> 
> What I would do is use the { } parentheses for all the method:
> 
>       method = aml_method("_STA", 0, AML_NOTSERIALIZED);
>       {
>            ifctx = aml_if(aml_equal(a_slots_nr, a_zero))
>            {
>                 aml_append(ifctx, aml_return(a_zero));
>            }
>            aml_append(method, ifctx);
>            /* present, functioning, decoding, not shown in UI */
>            aml_append(method, aml_return(aml_int(0xB)));
>       }
>       aml_append(ctrl_dev, method);
> 
> 
> As you can see the, the _STA method is looking good
> both as C code and is also easy to see the asl (compare with the
> original asl).
sure, I'll add { } parentheses around if body as you suggest.

> 
> 
> This is of course only a suggestion, me trying to help :)
> I see no problem in the conversion itself.
> 
> Thanks,
> Marcel
> 
> > +        aml_append(method, ifctx);
> > +        /* present, functioning, decoding, not shown in UI */
> > +        aml_append(method, aml_return(aml_int(0xB)));
> > +        aml_append(ctrl_dev, method);
> >       }
> >       aml_append(pci_scope, ctrl_dev);
> >       aml_append(ctx, pci_scope);
> > diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > b/hw/i386/acpi-dsdt-mem-hotplug.dsl index c2bb6a1..b4eacc9 100644
> > --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > @@ -35,14 +35,6 @@
> >               External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST
> > event code, write only External(MEMORY_SLOT_OST_STATUS, FieldU835163
> 
> nitObj) // _OST status code, write only
> >
> > -            Method(_STA, 0) {
> > -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> > -                    Return(0x0)
> > -                }
> > -                /* present, functioning, decoding, not shown in UI
> > */
> > -                Return(0xB)
> > -            }
> > -
> >               Mutex (MEMORY_SLOT_LOCK, 0)
> >
> >               Method(MEMORY_SLOT_SCAN_METHOD, 0) {
> >
> 

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

* [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT Igor Mammedov
  2015-12-16 12:08   ` Marcel Apfelbaum
@ 2015-12-16 14:47   ` Igor Mammedov
  2015-12-20 10:32     ` Marcel Apfelbaum
  2015-12-20 13:41     ` Michael S. Tsirkin
  1 sibling, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-16 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcel.apfelbaum, mst

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
 - add parentheses around ifctx block
   Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
---
 hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++
 hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
index 9b61b1c..e1a6551 100644
--- a/hw/acpi/memory_hotplug_acpi_table.c
+++ b/hw/acpi/memory_hotplug_acpi_table.c
@@ -29,11 +29,25 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
 {
     Aml *pci_scope;
     Aml *ctrl_dev;
+    Aml *method;
+    Aml *ifctx;
+    Aml *a_zero = aml_int(0);
+    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
 
     /* scope for memory hotplug controller device node */
     pci_scope = aml_scope("_SB.PCI0");
     ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
     {
+        /* MHPD._STA() method */
+        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
+        {
+             aml_append(ifctx, aml_return(a_zero));
+        }
+        aml_append(method, ifctx);
+        /* present, functioning, decoding, not shown in UI */
+        aml_append(method, aml_return(aml_int(0xB)));
+        aml_append(ctrl_dev, method);
     }
     aml_append(pci_scope, ctrl_dev);
     aml_append(ctx, pci_scope);
diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
index c2bb6a1..b4eacc9 100644
--- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
@@ -35,14 +35,6 @@
             External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
             External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
 
-            Method(_STA, 0) {
-                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
-                    Return(0x0)
-                }
-                /* present, functioning, decoding, not shown in UI */
-                Return(0xB)
-            }
-
             Mutex (MEMORY_SLOT_LOCK, 0)
 
             Method(MEMORY_SLOT_SCAN_METHOD, 0) {
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-16 14:25     ` Igor Mammedov
@ 2015-12-17 12:14       ` Marcel Apfelbaum
  2015-12-17 13:47         ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-17 12:14 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On 12/16/2015 04:25 PM, Igor Mammedov wrote:
> On Wed, 16 Dec 2015 15:25:46 +0200
> Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:
>
>> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
>>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>>> ---
>>>    hw/acpi/Makefile.objs               |  2 +-
>>>    hw/acpi/memory_hotplug_acpi_table.c | 40
>>> +++++++++++++++++++++++++++++++++++++
>>> hw/i386/acpi-build.c                |  3 +++
>>> include/hw/acpi/memory_hotplug.h    |  4 ++++ 4 files changed, 48
>>> insertions(+), 1 deletion(-) create mode 100644
>>> hw/acpi/memory_hotplug_acpi_table.c
>>>
>>> diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
>>> index 7d3230c..c04064e 100644
>>> --- a/hw/acpi/Makefile.objs
>>> +++ b/hw/acpi/Makefile.objs
>>> @@ -1,7 +1,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
>>> +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
>>> memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI) +=
>>> acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
>>>    common-obj-$(CONFIG_ACPI) += aml-build.o
>>> diff --git a/hw/acpi/memory_hotplug_acpi_table.c
>>> b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644
>>> index 0000000..25bbf5e
>>> --- /dev/null
>>> +++ b/hw/acpi/memory_hotplug_acpi_table.c
>>> @@ -0,0 +1,40 @@
>>> +/*
>>> + * Memory hotplug AML code of DSDT ACPI table
>>
>> You are advertising as part of the DSDT code, but you are putting in
>> SSDT, right? By the way, maybe the answer is clear, but why are you
>> moving it to SSDT?
> There could be only one instance of DSDT and I temporarily put
> converted DSDT bits in SSDT until conversion is complete.

I understand there can only be one DSDT table, but can't we have a "hybrid"
DSDT made from both asl files and C code?

>
>>
>> Last thing, from this patch forward (until maybe the last one) make
>> check fails, right? (Specifically the acpi tests)
> yes, starting from this patch and upto 72nd acpi test fails since
> patches move DSDT bits into SSDT.

This can be a problem.
I am thinking of 2 solutions:
1. Disable the iasl tests on patch 1 and re-enable it on patch 73.
2. Go for a "hybrid" DSDT.

If (2) is too complicated, the implication is that all this series
must be taken atomically. Of course, (1) or some other idea is needed.

What do you think?

Thanks,
Marcel

> But patch 73, when precompiled DSDT is empty and provides only header,
> moves converted DSDT content out of SSDT into QEMU
> generated DSDT, and drops ASL template.
>
>>
>>
>>> + *
>>> + * Copyright (C) 2013 Red Hat Inc
>>> + *
>>> + * Author: Igor Mammedov <imammedo@redhat.com>
>>> + *
>>> + * This program is free software; you can redistribute it and/or
>>> modify
>>> + * it under the terms of the GNU General Public License as
>>> published by
>>> + * the Free Software Foundation; either version 2 of the License,
>>> or
>>> + * (at your option) any later version.
>>> +
>>> + * This program is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> + * GNU General Public License for more details.
>>> +
>>> + * You should have received a copy of the GNU General Public
>>> License along
>>> + * with this program; if not, see <http://www.gnu.org/licenses/>.
>>> + */
>>
>> Regarding the license, I was advised to just add a pointer to the
>> main license instead of copying it in each file, something like:
>>
>>      This work is licensed under the terms of the GNU GPL, version 2
>> or later. See the COPYING file in the top-level directory.
>>
>> Thanks,
>> Marcel
>>
>>> +
>>> +#include <stdbool.h>
>>> +#include "hw/acpi/memory_hotplug.h"
>>> +#include "include/hw/acpi/pc-hotplug.h"
>>> +#include "hw/boards.h"
>>> +
>>> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
>>> +                              uint16_t io_base, uint16_t io_len)
>>> +{
>>> +    Aml *pci_scope;
>>> +    Aml *ctrl_dev;
>>> +
>>> +    /* scope for memory hotplug controller device node */
>>> +    pci_scope = aml_scope("_SB.PCI0");
>>> +    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
>>> +    {
>>> +    }
>>> +    aml_append(pci_scope, ctrl_dev);
>>> +    aml_append(ctx, pci_scope);
>>> +}
>>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>>> index bbd37e9..1b609e6 100644
>>> --- a/hw/i386/acpi-build.c
>>> +++ b/hw/i386/acpi-build.c
>>> @@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
>>>        /* Reserve space for header */
>>>        acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
>>>
>>> +    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
>>> +                             pm->mem_hp_io_len);
>>> +
>>>        /* Extra PCI root buses are implemented  only for i440fx */
>>>        bus = find_i440fx();
>>>        if (bus) {
>>> diff --git a/include/hw/acpi/memory_hotplug.h
>>> b/include/hw/acpi/memory_hotplug.h index 1342adb..b6e9f50 100644
>>> --- a/include/hw/acpi/memory_hotplug.h
>>> +++ b/include/hw/acpi/memory_hotplug.h
>>> @@ -4,6 +4,7 @@
>>>    #include "hw/qdev-core.h"
>>>    #include "hw/acpi/acpi.h"
>>>    #include "migration/vmstate.h"
>>> +#include "hw/acpi/aml-build.h"
>>>
>>>    /**
>>>     * MemStatus:
>>> @@ -45,4 +46,7 @@ extern const VMStateDescription
>>> vmstate_memory_hotplug; vmstate_memory_hotplug, MemHotplugState)
>>>
>>>    void acpi_memory_ospm_status(MemHotplugState *mem_st,
>>> ACPIOSTInfoList ***list); +
>>> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
>>> +                              uint16_t io_base, uint16_t io_len);
>>>    #endif
>>>
>>
>

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-17 12:14       ` Marcel Apfelbaum
@ 2015-12-17 13:47         ` Igor Mammedov
  2015-12-17 14:12           ` Marcel Apfelbaum
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-17 13:47 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel

On Thu, 17 Dec 2015 14:14:28 +0200
Marcel Apfelbaum <marcel@redhat.com> wrote:

> On 12/16/2015 04:25 PM, Igor Mammedov wrote:
> > On Wed, 16 Dec 2015 15:25:46 +0200
> > Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:
> >
> >> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> >>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> >>> ---
> >>>    hw/acpi/Makefile.objs               |  2 +-
> >>>    hw/acpi/memory_hotplug_acpi_table.c | 40
> >>> +++++++++++++++++++++++++++++++++++++
> >>> hw/i386/acpi-build.c                |  3 +++
> >>> include/hw/acpi/memory_hotplug.h    |  4 ++++ 4 files changed, 48
> >>> insertions(+), 1 deletion(-) create mode 100644
> >>> hw/acpi/memory_hotplug_acpi_table.c
> >>>
> >>> diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
> >>> index 7d3230c..c04064e 100644
> >>> --- a/hw/acpi/Makefile.objs
> >>> +++ b/hw/acpi/Makefile.objs
> >>> @@ -1,7 +1,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
> >>> +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
> >>> memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI) +=
> >>> acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
> >>>    common-obj-$(CONFIG_ACPI) += aml-build.o
> >>> diff --git a/hw/acpi/memory_hotplug_acpi_table.c
> >>> b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644
> >>> index 0000000..25bbf5e
> >>> --- /dev/null
> >>> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> >>> @@ -0,0 +1,40 @@
> >>> +/*
> >>> + * Memory hotplug AML code of DSDT ACPI table
> >>
> >> You are advertising as part of the DSDT code, but you are putting in
> >> SSDT, right? By the way, maybe the answer is clear, but why are you
> >> moving it to SSDT?
> > There could be only one instance of DSDT and I temporarily put
> > converted DSDT bits in SSDT until conversion is complete.
> 
> I understand there can only be one DSDT table, but can't we have a "hybrid"
> DSDT made from both asl files and C code?
I've considered that and it's a little painful but possible
to do for some parts of DSDT if ASL moved out from beginning/end
of template. However when it comes to moving parts of ASL from
the middle of template due to dependencies it all becomes way to
too complicated or I'll have to convert almost ALL of DSDT in one patch,
but that, even though verifiable via ACPI tests, won't be human
review-able chunk.


> 
> >
> >>
> >> Last thing, from this patch forward (until maybe the last one) make
> >> check fails, right? (Specifically the acpi tests)
> > yes, starting from this patch and upto 72nd acpi test fails since
> > patches move DSDT bits into SSDT.
> 
> This can be a problem.
> I am thinking of 2 solutions:
> 1. Disable the iasl tests on patch 1 and re-enable it on patch 73.
> 2. Go for a "hybrid" DSDT.
> 
> If (2) is too complicated, the implication is that all this series
> must be taken atomically. Of course, (1) or some other idea is needed.
> 
> What do you think?
as #2 too complicated, we could go with #1 but I don't think
it will gain us much if anything.

Yep, untill whole series is applied ACPI tests will not pass,
that will affect bisection with 'make check' on each step
but developers can deal with it and just ignore failed tests.

Main goal was to make conversion and make sure that at the end
of day it hasn't regressed tests.
I don't think that putting much more efforts to keep interseries
ACPI tests check passing is worth of an effort.

> 
> Thanks,
> Marcel
> 
> > But patch 73, when precompiled DSDT is empty and provides only header,
> > moves converted DSDT content out of SSDT into QEMU
> > generated DSDT, and drops ASL template.
> >
> >>
> >>
> >>> + *
> >>> + * Copyright (C) 2013 Red Hat Inc
> >>> + *
> >>> + * Author: Igor Mammedov <imammedo@redhat.com>
> >>> + *
> >>> + * This program is free software; you can redistribute it and/or
> >>> modify
> >>> + * it under the terms of the GNU General Public License as
> >>> published by
> >>> + * the Free Software Foundation; either version 2 of the License,
> >>> or
> >>> + * (at your option) any later version.
> >>> +
> >>> + * This program is distributed in the hope that it will be useful,
> >>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >>> + * GNU General Public License for more details.
> >>> +
> >>> + * You should have received a copy of the GNU General Public
> >>> License along
> >>> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> >>> + */
> >>
> >> Regarding the license, I was advised to just add a pointer to the
> >> main license instead of copying it in each file, something like:
> >>
> >>      This work is licensed under the terms of the GNU GPL, version 2
> >> or later. See the COPYING file in the top-level directory.
> >>
> >> Thanks,
> >> Marcel
> >>
> >>> +
> >>> +#include <stdbool.h>
> >>> +#include "hw/acpi/memory_hotplug.h"
> >>> +#include "include/hw/acpi/pc-hotplug.h"
> >>> +#include "hw/boards.h"
> >>> +
> >>> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> >>> +                              uint16_t io_base, uint16_t io_len)
> >>> +{
> >>> +    Aml *pci_scope;
> >>> +    Aml *ctrl_dev;
> >>> +
> >>> +    /* scope for memory hotplug controller device node */
> >>> +    pci_scope = aml_scope("_SB.PCI0");
> >>> +    ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> >>> +    {
> >>> +    }
> >>> +    aml_append(pci_scope, ctrl_dev);
> >>> +    aml_append(ctx, pci_scope);
> >>> +}
> >>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> >>> index bbd37e9..1b609e6 100644
> >>> --- a/hw/i386/acpi-build.c
> >>> +++ b/hw/i386/acpi-build.c
> >>> @@ -928,6 +928,9 @@ build_ssdt(GArray *table_data, GArray *linker,
> >>>        /* Reserve space for header */
> >>>        acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
> >>>
> >>> +    build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> >>> +                             pm->mem_hp_io_len);
> >>> +
> >>>        /* Extra PCI root buses are implemented  only for i440fx */
> >>>        bus = find_i440fx();
> >>>        if (bus) {
> >>> diff --git a/include/hw/acpi/memory_hotplug.h
> >>> b/include/hw/acpi/memory_hotplug.h index 1342adb..b6e9f50 100644
> >>> --- a/include/hw/acpi/memory_hotplug.h
> >>> +++ b/include/hw/acpi/memory_hotplug.h
> >>> @@ -4,6 +4,7 @@
> >>>    #include "hw/qdev-core.h"
> >>>    #include "hw/acpi/acpi.h"
> >>>    #include "migration/vmstate.h"
> >>> +#include "hw/acpi/aml-build.h"
> >>>
> >>>    /**
> >>>     * MemStatus:
> >>> @@ -45,4 +46,7 @@ extern const VMStateDescription
> >>> vmstate_memory_hotplug; vmstate_memory_hotplug, MemHotplugState)
> >>>
> >>>    void acpi_memory_ospm_status(MemHotplugState *mem_st,
> >>> ACPIOSTInfoList ***list); +
> >>> +void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> >>> +                              uint16_t io_base, uint16_t io_len);
> >>>    #endif
> >>>
> >>
> >
> 

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-17 13:47         ` Igor Mammedov
@ 2015-12-17 14:12           ` Marcel Apfelbaum
  2015-12-17 16:59             ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-17 14:12 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, Michael S. Tsirkin

On 12/17/2015 03:47 PM, Igor Mammedov wrote:
> On Thu, 17 Dec 2015 14:14:28 +0200
> Marcel Apfelbaum <marcel@redhat.com> wrote:
>
>> On 12/16/2015 04:25 PM, Igor Mammedov wrote:
>>> On Wed, 16 Dec 2015 15:25:46 +0200
>>> Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:
>>>
>>>> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
>>>>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
>>>>> ---
>>>>>     hw/acpi/Makefile.objs               |  2 +-
>>>>>     hw/acpi/memory_hotplug_acpi_table.c | 40
>>>>> +++++++++++++++++++++++++++++++++++++
>>>>> hw/i386/acpi-build.c                |  3 +++
>>>>> include/hw/acpi/memory_hotplug.h    |  4 ++++ 4 files changed, 48
>>>>> insertions(+), 1 deletion(-) create mode 100644
>>>>> hw/acpi/memory_hotplug_acpi_table.c
>>>>>
>>>>> diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
>>>>> index 7d3230c..c04064e 100644
>>>>> --- a/hw/acpi/Makefile.objs
>>>>> +++ b/hw/acpi/Makefile.objs
>>>>> @@ -1,7 +1,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
>>>>> +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
>>>>> memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI) +=
>>>>> acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
>>>>>     common-obj-$(CONFIG_ACPI) += aml-build.o
>>>>> diff --git a/hw/acpi/memory_hotplug_acpi_table.c
>>>>> b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644
>>>>> index 0000000..25bbf5e
>>>>> --- /dev/null
>>>>> +++ b/hw/acpi/memory_hotplug_acpi_table.c
>>>>> @@ -0,0 +1,40 @@
>>>>> +/*
>>>>> + * Memory hotplug AML code of DSDT ACPI table
>>>>
>>>> You are advertising as part of the DSDT code, but you are putting in
>>>> SSDT, right? By the way, maybe the answer is clear, but why are you
>>>> moving it to SSDT?
>>> There could be only one instance of DSDT and I temporarily put
>>> converted DSDT bits in SSDT until conversion is complete.
>>
>> I understand there can only be one DSDT table, but can't we have a "hybrid"
>> DSDT made from both asl files and C code?
> I've considered that and it's a little painful but possible
> to do for some parts of DSDT if ASL moved out from beginning/end
> of template. However when it comes to moving parts of ASL from
> the middle of template due to dependencies it all becomes way to
> too complicated or I'll have to convert almost ALL of DSDT in one patch,
> but that, even though verifiable via ACPI tests, won't be human
> review-able chunk.

Yes, I thought it would not be easy.

>
>
>>
>>>
>>>>
>>>> Last thing, from this patch forward (until maybe the last one) make
>>>> check fails, right? (Specifically the acpi tests)
>>> yes, starting from this patch and upto 72nd acpi test fails since
>>> patches move DSDT bits into SSDT.
>>
>> This can be a problem.
>> I am thinking of 2 solutions:
>> 1. Disable the iasl tests on patch 1 and re-enable it on patch 73.
>> 2. Go for a "hybrid" DSDT.
>>
>> If (2) is too complicated, the implication is that all this series
>> must be taken atomically. Of course, (1) or some other idea is needed.
>>
>> What do you think?
> as #2 too complicated, we could go with #1 but I don't think
> it will gain us much if anything.
>
> Yep, untill whole series is applied ACPI tests will not pass,
> that will affect bisection with 'make check' on each step
> but developers can deal with it and just ignore failed tests.

Here I don't agree, think about different tests not working from
different reasons, and make check failing because all kind of series,
how the developer would know not to take it in consideration? (and what to take?)

>
> Main goal was to make conversion and make sure that at the end
> of day it hasn't regressed tests.
> I don't think that putting much more efforts to keep interseries
> ACPI tests check passing is worth of an effort.

I personally think that is a little effort to disable the acpi test
in order to keep 'make check' clean.
However, we can ask for another opinion, I CC-ed Michael as the PC maintainer.

Thanks,
Marcel

[...]

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

* Re: [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
  2015-12-17 14:12           ` Marcel Apfelbaum
@ 2015-12-17 16:59             ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-17 16:59 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: qemu-devel, Michael S. Tsirkin

On Thu, 17 Dec 2015 16:12:55 +0200
Marcel Apfelbaum <marcel@redhat.com> wrote:

> On 12/17/2015 03:47 PM, Igor Mammedov wrote:
> > On Thu, 17 Dec 2015 14:14:28 +0200
> > Marcel Apfelbaum <marcel@redhat.com> wrote:
> >
> >> On 12/16/2015 04:25 PM, Igor Mammedov wrote:
> >>> On Wed, 16 Dec 2015 15:25:46 +0200
> >>> Marcel Apfelbaum <marcel.apfelbaum@gmail.com> wrote:
> >>>
> >>>> On 12/10/2015 01:41 AM, Igor Mammedov wrote:
> >>>>> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> >>>>> ---
> >>>>>     hw/acpi/Makefile.objs               |  2 +-
> >>>>>     hw/acpi/memory_hotplug_acpi_table.c | 40
> >>>>> +++++++++++++++++++++++++++++++++++++
> >>>>> hw/i386/acpi-build.c                |  3 +++
> >>>>> include/hw/acpi/memory_hotplug.h    |  4 ++++ 4 files changed, 48
> >>>>> insertions(+), 1 deletion(-) create mode 100644
> >>>>> hw/acpi/memory_hotplug_acpi_table.c
> >>>>>
> >>>>> diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
> >>>>> index 7d3230c..c04064e 100644
> >>>>> --- a/hw/acpi/Makefile.objs
> >>>>> +++ b/hw/acpi/Makefile.objs
> >>>>> @@ -1,7 +1,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
> >>>>> +common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
> >>>>> memory_hotplug_acpi_table.o common-obj-$(CONFIG_ACPI) +=
> >>>>> acpi_interface.o common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
> >>>>>     common-obj-$(CONFIG_ACPI) += aml-build.o
> >>>>> diff --git a/hw/acpi/memory_hotplug_acpi_table.c
> >>>>> b/hw/acpi/memory_hotplug_acpi_table.c new file mode 100644
> >>>>> index 0000000..25bbf5e
> >>>>> --- /dev/null
> >>>>> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> >>>>> @@ -0,0 +1,40 @@
> >>>>> +/*
> >>>>> + * Memory hotplug AML code of DSDT ACPI table
> >>>>
> >>>> You are advertising as part of the DSDT code, but you are putting in
> >>>> SSDT, right? By the way, maybe the answer is clear, but why are you
> >>>> moving it to SSDT?
> >>> There could be only one instance of DSDT and I temporarily put
> >>> converted DSDT bits in SSDT until conversion is complete.
> >>
> >> I understand there can only be one DSDT table, but can't we have a "hybrid"
> >> DSDT made from both asl files and C code?
> > I've considered that and it's a little painful but possible
> > to do for some parts of DSDT if ASL moved out from beginning/end
> > of template. However when it comes to moving parts of ASL from
> > the middle of template due to dependencies it all becomes way to
> > too complicated or I'll have to convert almost ALL of DSDT in one patch,
> > but that, even though verifiable via ACPI tests, won't be human
> > review-able chunk.
> 
> Yes, I thought it would not be easy.
> 
> >
> >
> >>
> >>>
> >>>>
> >>>> Last thing, from this patch forward (until maybe the last one) make
> >>>> check fails, right? (Specifically the acpi tests)
> >>> yes, starting from this patch and upto 72nd acpi test fails since
> >>> patches move DSDT bits into SSDT.
> >>
> >> This can be a problem.
> >> I am thinking of 2 solutions:
> >> 1. Disable the iasl tests on patch 1 and re-enable it on patch 73.
> >> 2. Go for a "hybrid" DSDT.
> >>
> >> If (2) is too complicated, the implication is that all this series
> >> must be taken atomically. Of course, (1) or some other idea is needed.
> >>
> >> What do you think?
> > as #2 too complicated, we could go with #1 but I don't think
> > it will gain us much if anything.
> >
> > Yep, untill whole series is applied ACPI tests will not pass,
> > that will affect bisection with 'make check' on each step
> > but developers can deal with it and just ignore failed tests.
> 
> Here I don't agree, think about different tests not working from
> different reasons, and make check failing because all kind of series,
> how the developer would know not to take it in consideration? (and what to take?)
> 
> >
> > Main goal was to make conversion and make sure that at the end
> > of day it hasn't regressed tests.
> > I don't think that putting much more efforts to keep interseries
> > ACPI tests check passing is worth of an effort.
> 
> I personally think that is a little effort to disable the acpi test
> in order to keep 'make check' clean.
> However, we can ask for another opinion, I CC-ed Michael as the PC maintainer.
So far with patches/series, that are changing SSDT or DSDT and obviously
breaking ACPI test, policy was submit it without updating test and let
maintainer to update ACPI blobs in test after series has been applied,
i.e. not disabling it.

I sometimes post an additional patch, that updates ACPI blobs in test
as the last in series. But that patch however could be easily discarded
or be obsoleted because some another patch changing ACPI tables was
committed before and maintainer has to update test himself.

> 
> Thanks,
> Marcel
> 
> [...]
> 

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-10 16:17     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  2015-12-13 15:19       ` Marcel Apfelbaum
@ 2015-12-19 19:23       ` Michael S. Tsirkin
  2015-12-21 12:55         ` Igor Mammedov
  1 sibling, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 19:23 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, marcel.apfelbaum

On Thu, Dec 10, 2015 at 05:17:07PM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v2:
>  - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
>    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> 
> pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
>  hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
>  2 files changed, 32 insertions(+), 69 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index cf98037..1b065df 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>      qobject_decref(bsel);
>  }
>  
> +static Aml *build_prt_entry(const char *link_name)
> +{
> +    Aml *a_zero = aml_int(0);
> +    Aml *pkg = aml_package(4);
> +    aml_append(pkg, a_zero);
> +    aml_append(pkg, a_zero);
> +    aml_append(pkg, aml_name("%s", link_name));
> +    aml_append(pkg, a_zero);
> +    return pkg;
> +}
> +
>  /*
>   * initialize_route - Initialize the interrupt routing rule
>   * through a specific LINK:
> @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
>                               Aml *lnk_idx, int idx)
>  {
>      Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> -    Aml *pkg = aml_package(4);
> +    Aml *pkg = build_prt_entry(link_name);
>  
> -    aml_append(pkg, aml_int(0));
> -    aml_append(pkg, aml_int(0));
> -    aml_append(pkg, aml_name("%s", link_name));
> -    aml_append(pkg, aml_int(0));
>      aml_append(if_ctx, aml_store(pkg, route));
>  
>      return if_ctx;
> @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
>   * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
>   *
>   */
> -static Aml *build_prt(void)
> +static Aml *build_prt(bool is_pci0_prt)
>  {
> -    Aml *method, *while_ctx, *pin, *res;
> +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;

Move if_ctx2/if_ctx/else_ctx2 where they are used?
Also, can't we come up with better name than if_ctx2?
How about if_lnk_1 and if_pin_4?

>  
>      method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
>      res = aml_local(0);
> @@ -678,7 +685,19 @@ static Aml *build_prt(void)
>  
>          /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
>          aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> -        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> +        if (is_pci0_prt) {
> +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> +            /* device 1 is the power-management device, needs SCI */

Doesn't this context belong above the previous line?

> +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
> +            aml_append(if_ctx, if_ctx2);
> +            else_ctx2 = aml_else();
> +            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
> +            aml_append(if_ctx, else_ctx2);

This looks weird. Why isn't else_ctx2 added to if_ctx2?

> +            aml_append(while_ctx, if_ctx);
> +        } else {
> +            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> +        }
>          aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
>          aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
>  
> @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
>      Aml *method;
>      uint32_t irqs;
>      Aml *sb_scope = aml_scope("_SB");
> +    Aml *pci0_scope = aml_scope("PCI0");
> +
> +    aml_append(pci0_scope, build_prt(true));
> +    aml_append(sb_scope, pci0_scope);
>  
>      field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
>      aml_append(field, aml_named_field("PRQ0", 8));
> @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
>                  aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
>              }
>  
> -            aml_append(dev, build_prt());
> +            aml_append(dev, build_prt(false));
>              crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
>                              io_ranges, mem_ranges);
>              aml_append(dev, aml_name_decl("_CRS", crs));
> diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> index bc6bd45..5d741dd 100644
> --- a/hw/i386/acpi-dsdt.dsl
> +++ b/hw/i386/acpi-dsdt.dsl
> @@ -78,64 +78,4 @@ DefinitionBlock (
>          /* Hotplug notification method supplied by SSDT */
>          External(\_SB.PCI0.PCNT, MethodObj)
>      }
> -
> -
> -/****************************************************************
> - * PCI IRQs
> - ****************************************************************/
> -
> -    Scope(\_SB) {
> -        Scope(PCI0) {
> -            Method (_PRT, 0) {
> -                Store(Package(128) {}, Local0)
> -                Store(Zero, Local1)
> -                While(LLess(Local1, 128)) {
> -                    // slot = pin >> 2
> -                    Store(ShiftRight(Local1, 2), Local2)
> -
> -                    // lnk = (slot + pin) & 3
> -                    Store(And(Add(Local1, Local2), 3), Local3)
> -                    If (LEqual(Local3, 0)) {
> -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> -                    }
> -                    If (LEqual(Local3, 1)) {
> -                        // device 1 is the power-management device, needs SCI
> -                        If (LEqual(Local1, 4)) {
> -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> -                        } Else {
> -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> -                        }
> -                    }
> -                    If (LEqual(Local3, 2)) {
> -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> -                    }
> -                    If (LEqual(Local3, 3)) {
> -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> -                    }
> -
> -                    // Complete the interrupt routing entry:
> -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> -
> -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> -                    Store(And(Local1, 3),                    Index(Local4, 1))
> -                    Store(Local4,                            Index(Local0, Local1))
> -
> -                    Increment(Local1)
> -                }
> -
> -                Return(Local0)

Interesting. And where's this code? Probably in previous or follow-up patches ...

> -            }
> -        }
> -
> -
> -        External(PRQ0, FieldUnitObj)
> -        External(PRQ1, FieldUnitObj)
> -        External(PRQ2, FieldUnitObj)
> -        External(PRQ3, FieldUnitObj)
> -        External(LNKA, DeviceObj)
> -        External(LNKB, DeviceObj)
> -        External(LNKC, DeviceObj)
> -        External(LNKD, DeviceObj)
> -        External(LNKS, DeviceObj)
> -    }
>  }
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers " Igor Mammedov
@ 2015-12-19 19:30   ` Michael S. Tsirkin
  2015-12-19 20:34   ` Michael S. Tsirkin
  1 sibling, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 19:30 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Thu, Dec 10, 2015 at 12:41:48AM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/i386/acpi-build.c      | 26 +++++++++++++++++++++++++-
>  hw/i386/acpi-dsdt.dsl     | 40 ----------------------------------------
>  hw/i386/q35-acpi-dsdt.dsl | 36 ------------------------------------
>  3 files changed, 25 insertions(+), 77 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 581ad98..99c0294 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1400,8 +1400,25 @@ build_ssdt(GArray *table_data, GArray *linker,
>      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
>                               pm->mem_hp_io_len);
>  
> -    scope =  aml_scope("\\_GPE");
> +    scope =  aml_scope("_GPE");

Should be in one of the previous patches.

>      {
> +        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
> +
> +        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
> +        aml_append(scope, method);
> +
> +        if (misc->is_piix4) {
> +            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
> +            aml_append(method,
> +                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
> +            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
> +            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
> +            aml_append(scope, method);
> +        } else {
> +            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
> +            aml_append(scope, method);
> +        }
> +
>          method = aml_method("_E02", 0, AML_NOTSERIALIZED);
>          aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
>          aml_append(scope, method);
> @@ -1409,6 +1426,13 @@ build_ssdt(GArray *table_data, GArray *linker,
>          method = aml_method("_E03", 0, AML_NOTSERIALIZED);
>          aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
>          aml_append(scope, method);
> +
> +        for (i = 4; i <= 0xF; i++) {
> +            char *name = g_strdup_printf("_L0%X", i);
> +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> +            aml_append(scope, method);
> +            g_free(name);
> +        }
>      }
>      aml_append(ssdt, scope);
>  
> diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> index 11e2e61..c9b2725 100644
> --- a/hw/i386/acpi-dsdt.dsl
> +++ b/hw/i386/acpi-dsdt.dsl
> @@ -197,44 +197,4 @@ DefinitionBlock (
>              Method(_SRS, 1, NotSerialized) { }
>          }
>      }
> -
> -/****************************************************************
> - * General purpose events
> - ****************************************************************/
> -    Scope(\_GPE) {
> -        Name(_HID, "ACPI0006")
> -
> -        Method(_L00) {
> -        }
> -        Method(_E01) {
> -            // PCI hotplug event
> -            Acquire(\_SB.PCI0.BLCK, 0xFFFF)
> -            \_SB.PCI0.PCNT()
> -            Release(\_SB.PCI0.BLCK)
> -        }
> -        Method(_L04) {
> -        }
> -        Method(_L05) {
> -        }
> -        Method(_L06) {
> -        }
> -        Method(_L07) {
> -        }
> -        Method(_L08) {
> -        }
> -        Method(_L09) {
> -        }
> -        Method(_L0A) {
> -        }
> -        Method(_L0B) {
> -        }
> -        Method(_L0C) {
> -        }
> -        Method(_L0D) {
> -        }
> -        Method(_L0E) {
> -        }
> -        Method(_L0F) {
> -        }
> -    }
>  }
> diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
> index 4862ded..e157615 100644
> --- a/hw/i386/q35-acpi-dsdt.dsl
> +++ b/hw/i386/q35-acpi-dsdt.dsl
> @@ -375,40 +375,4 @@ DefinitionBlock (
>          define_gsi_link(GSIG, 0, 0x16)
>          define_gsi_link(GSIH, 0, 0x17)
>      }
> -
> -/****************************************************************
> - * General purpose events
> - ****************************************************************/
> -    Scope(\_GPE) {
> -        Name(_HID, "ACPI0006")
> -
> -        Method(_L00) {
> -        }
> -        Method(_L01) {
> -        }
> -        Method(_L04) {
> -        }
> -        Method(_L05) {
> -        }
> -        Method(_L06) {
> -        }
> -        Method(_L07) {
> -        }
> -        Method(_L08) {
> -        }
> -        Method(_L09) {
> -        }
> -        Method(_L0A) {
> -        }
> -        Method(_L0B) {
> -        }
> -        Method(_L0C) {
> -        }
> -        Method(_L0D) {
> -        }
> -        Method(_L0E) {
> -        }
> -        Method(_L0F) {
> -        }
> -    }
>  }
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 device from DSDT to SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 " Igor Mammedov
@ 2015-12-19 19:44   ` Michael S. Tsirkin
  2015-12-21 12:42     ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 19:44 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Thu, Dec 10, 2015 at 12:41:44AM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/i386/acpi-build.c      | 38 ++++++++++++++++++++++++++++++++------
>  hw/i386/acpi-dsdt-isa.dsl | 18 ------------------
>  2 files changed, 32 insertions(+), 24 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index e5ec6af..2f0f2e1 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1173,17 +1173,34 @@ static void build_hpet_aml(Aml *table)
>  
>  static Aml *
>  build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
> -                      bool have_sta)
> +                      bool have_sta, const char *present_field)

At this point, the number of arguments is getting ridiculous.
I think you should give it up, and write a function
per device type, even if there's a minor code duplication
as a result.

As a bonus, we will get reasonably readable function
names, e.g.  build_floppy_controller()

>  {
>      Aml *dev;
>      Aml *method;
> -    Aml *a_device_present = aml_int(0x0f);
>  
>      dev = aml_device("%s", name);
>      aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
>      if (have_sta) {
> +        Aml *if_ctx;
> +        Aml *else_ctx;
> +        Aml *a_zero = aml_int(0);
> +        Aml *a_is_present = aml_local(0);
> +        Aml *a_device_present = aml_int(0x0f);
> +        Aml *a_device_not_present = aml_int(0x00);
> +

What does a_ prefix mean here?

>          method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> -        aml_append(method, aml_return(a_device_present));
> +        if (!present_field) {
> +            aml_append(method, aml_return(a_device_present));
> +        } else {
> +            aml_append(method,
> +                aml_store(aml_name("%s", present_field), a_is_present));
> +            if_ctx = aml_if(aml_equal(a_is_present, a_zero));
> +            aml_append(if_ctx, aml_return(a_device_not_present));
> +            aml_append(method, if_ctx);
> +            else_ctx = aml_else();
> +            aml_append(else_ctx, aml_return(a_device_present));
> +            aml_append(method, else_ctx);
> +        }
>          aml_append(dev, method);
>      }
>      aml_append(dev, aml_name_decl("_CRS", crs));
> @@ -1201,19 +1218,28 @@ static void build_isa_devices_aml(Aml *table)
>      aml_append(crs, aml_irq_no_flags(8));
>      aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
>      aml_append(scope, build_eisa_device_aml(
> -        "RTC", "PNP0B00", crs, false));
> +        "RTC", "PNP0B00", crs, false, NULL));
>  
>      crs = aml_resource_template();
>      aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
>      aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
>      aml_append(crs, aml_irq_no_flags(1));
>      aml_append(scope, build_eisa_device_aml(
> -        "KBD", "PNP0303", crs, true));
> +        "KBD", "PNP0303", crs, true, NULL));
>  
>      crs = aml_resource_template();
>      aml_append(crs, aml_irq_no_flags(12));
>      aml_append(scope, build_eisa_device_aml(
> -        "MOU", "PNP0F13", crs, true));
> +        "MOU", "PNP0F13", crs, true, NULL));
> +
> +    crs = aml_resource_template();
> +    aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
> +    aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01));
> +    aml_append(crs, aml_irq_no_flags(6));
> +    aml_append(crs,
> +        aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2));
> +    aml_append(scope, build_eisa_device_aml(
> +        "FDC0", "PNP0700", crs, true, "FDEN"));
>  
>      aml_append(table, scope);
>  }
> diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
> index 8936271..64dd4ac 100644
> --- a/hw/i386/acpi-dsdt-isa.dsl
> +++ b/hw/i386/acpi-dsdt-isa.dsl
> @@ -16,24 +16,6 @@
>  /* Common legacy ISA style devices. */
>  Scope(\_SB.PCI0.ISA) {
>  
> -    Device(FDC0) {
> -        Name(_HID, EisaId("PNP0700"))
> -        Method(_STA, 0, NotSerialized) {
> -            Store(FDEN, Local0)
> -            If (LEqual(Local0, 0)) {
> -                Return (0x00)
> -            } Else {
> -                Return (0x0F)
> -            }
> -        }

All these guys have in common is the _STA method.
So write a function generating one, and be done with it.


> -        Name(_CRS, ResourceTemplate() {
> -            IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
> -            IO(Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
> -            IRQNoFlags() { 6 }
> -            DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
> -        })
> -    }
> -
>      Device(LPT) {
>          Name(_HID, EisaId("PNP0400"))
>          Method(_STA, 0, NotSerialized) {
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT Igor Mammedov
@ 2015-12-19 19:50   ` Michael S. Tsirkin
  2015-12-21 11:02     ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 19:50 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Thu, Dec 10, 2015 at 12:41:39AM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/i386/acpi-build.c       | 53 ++++++++++++++++++++++++++++++++++++++++++++++
>  hw/i386/acpi-dsdt-hpet.dsl | 48 -----------------------------------------
>  hw/i386/acpi-dsdt.dsl      |  2 --
>  hw/i386/q35-acpi-dsdt.dsl  |  3 ---
>  hw/timer/hpet.c            |  2 +-
>  include/hw/timer/hpet.h    |  1 +
>  6 files changed, 55 insertions(+), 54 deletions(-)
>  delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 72883ad..62f932e 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -50,6 +50,7 @@
>  #include "hw/pci/pci_bus.h"
>  #include "hw/pci-host/q35.h"
>  #include "hw/i386/intel_iommu.h"
> +#include "hw/timer/hpet.h"
>  
>  #include "hw/i386/q35-acpi-dsdt.hex"
>  #include "hw/i386/acpi-dsdt.hex"
> @@ -1119,6 +1120,57 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
>      aml_append(sb_scope, method);
>  }
>  
> +static void build_hpet_aml(Aml *table)
> +{
> +    Aml *crs;
> +    Aml *field;
> +    Aml *method;
> +    Aml *if_ctx;
> +    Aml *scope = aml_scope("_SB");
> +    Aml *dev = aml_device("HPET");
> +    Aml *a_zero = aml_int(0);
> +    Aml *a_id = aml_local(0);
> +    Aml *a_period = aml_local(1);

This one really jumps out, but it's all over the place.
Please drop these a_ prefixes all over, they don't help.

> +
> +    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0103")));
> +    aml_append(dev, aml_name_decl("_UID", a_zero));
> +
> +    aml_append(dev, aml_operation_region("HPTM", AML_SYSTEM_MEMORY,
> +                                         HPET_BASE, HPET_LEN));
> +    field = aml_field("HPTM", AML_DWORD_ACC, AML_LOCK, AML_PRESERVE);
> +    aml_append(field, aml_named_field("VEND", 32));
> +    aml_append(field, aml_named_field("PRD", 32));
> +    aml_append(dev, field);
> +
> +    method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> +    aml_append(method, aml_store(aml_name("VEND"), a_id));
> +    aml_append(method, aml_store(aml_name("PRD"), a_period));
> +    aml_append(method, aml_shiftright(a_id, aml_int(16), a_id));
> +    if_ctx = aml_if(aml_lor(
> +                            aml_equal(a_id, a_zero),
> +                            aml_equal(a_id, aml_int(0xffff))));
> +    aml_append(if_ctx, aml_return(a_zero));
> +    aml_append(method, if_ctx);
> +
> +    if_ctx = aml_if(aml_lor(

Don't split lines like this please.

> +                            aml_equal(a_period, a_zero),
> +                            aml_lgreater(a_period, aml_int(100000000))));
> +    aml_append(if_ctx, aml_return(a_zero));
> +    aml_append(method, if_ctx);
> +
> +    aml_append(method, aml_return(aml_int(0x0F)));
> +    aml_append(dev, method);
> +
> +    crs = aml_resource_template();
> +    aml_append(crs,
> +        aml_memory32_fixed(HPET_BASE, HPET_LEN, AML_READ_ONLY)
> +    );
> +    aml_append(dev, aml_name_decl("_CRS", crs));
> +
> +    aml_append(scope, dev);
> +    aml_append(table, scope);
> +}
> +
>  static void
>  build_ssdt(GArray *table_data, GArray *linker,
>             AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
> @@ -1139,6 +1191,7 @@ build_ssdt(GArray *table_data, GArray *linker,
>      /* Reserve space for header */
>      acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
>  
> +    build_hpet_aml(ssdt);
>      build_cpu_hotplug_aml(ssdt);
>      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
>                               pm->mem_hp_io_len);
> diff --git a/hw/i386/acpi-dsdt-hpet.dsl b/hw/i386/acpi-dsdt-hpet.dsl
> deleted file mode 100644
> index 44961b8..0000000
> --- a/hw/i386/acpi-dsdt-hpet.dsl
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -/*
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> -
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> -
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -/****************************************************************
> - * HPET
> - ****************************************************************/
> -
> -Scope(\_SB) {
> -    Device(HPET) {
> -        Name(_HID, EISAID("PNP0103"))
> -        Name(_UID, 0)
> -        OperationRegion(HPTM, SystemMemory, 0xFED00000, 0x400)
> -        Field(HPTM, DWordAcc, Lock, Preserve) {
> -            VEND, 32,
> -            PRD, 32,
> -        }
> -        Method(_STA, 0, NotSerialized) {
> -            Store(VEND, Local0)
> -            Store(PRD, Local1)
> -            ShiftRight(Local0, 16, Local0)
> -            If (LOr(LEqual(Local0, 0), LEqual(Local0, 0xffff))) {
> -                Return (0x0)
> -            }
> -            If (LOr(LEqual(Local1, 0), LGreater(Local1, 100000000))) {
> -                Return (0x0)
> -            }
> -            Return (0x0F)
> -        }
> -        Name(_CRS, ResourceTemplate() {
> -            Memory32Fixed(ReadOnly,
> -                0xFED00000,         // Address Base
> -                0x00000400,         // Address Length
> -                )
> -        })
> -    }
> -}
> diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> index 007d3c9..aa7f549 100644
> --- a/hw/i386/acpi-dsdt.dsl
> +++ b/hw/i386/acpi-dsdt.dsl
> @@ -41,8 +41,6 @@ DefinitionBlock (
>          }
>      }
>  
> -#include "acpi-dsdt-hpet.dsl"
> -
>  /****************************************************************
>   * PIIX4 PM
>   ****************************************************************/
> diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
> index 0511e26..e57adb8 100644
> --- a/hw/i386/q35-acpi-dsdt.dsl
> +++ b/hw/i386/q35-acpi-dsdt.dsl
> @@ -115,9 +115,6 @@ DefinitionBlock (
>          }
>      }
>  
> -#include "acpi-dsdt-hpet.dsl"
> -
> -
>  /****************************************************************
>   * LPC ISA bridge
>   ****************************************************************/
> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> index 7f0391c..d9d039b 100644
> --- a/hw/timer/hpet.c
> +++ b/hw/timer/hpet.c
> @@ -713,7 +713,7 @@ static void hpet_init(Object *obj)
>      HPETState *s = HPET(obj);
>  
>      /* HPET Area */
> -    memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", 0x400);
> +    memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", HPET_LEN);
>      sysbus_init_mmio(sbd, &s->iomem);
>  }
>  
> diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h
> index d872909..f38bcfe 100644
> --- a/include/hw/timer/hpet.h
> +++ b/include/hw/timer/hpet.h
> @@ -16,6 +16,7 @@
>  #include "qom/object.h"
>  
>  #define HPET_BASE               0xfed00000
> +#define HPET_LEN                0x400
>  #define HPET_CLK_PERIOD         10 /* 10 ns*/
>  
>  #define FS_PER_NS 1000000       /* 1000000 femtoseconds == 1 ns */
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function Igor Mammedov
@ 2015-12-19 20:18   ` Michael S. Tsirkin
  2015-12-21 11:01     ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 20:18 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Thu, Dec 10, 2015 at 12:41:29AM +0100, Igor Mammedov wrote:
> before consolidating memhp code in memory_hotplug_acpi_table.c
> and for simplifying review, first factor out memhp code into
> new function build_memory_devices() in i386/acpi-build.c
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ----
> PS:
>    no functional change, only code movement.
> ---
>  hw/i386/acpi-build.c | 239 +++++++++++++++++++++++++++------------------------
>  1 file changed, 126 insertions(+), 113 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 1b609e6..765fccd 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -903,6 +903,130 @@ static Aml *build_crs(PCIHostState *host,
>      return crs;
>  }
>  
> +static void build_memory_devices(Aml *sb_scope, int nr_mem,
> +                                 uint16_t io_base, uint16_t io_len)
> +{
> +    int i;
> +    Aml *scope;
> +    Aml *crs;
> +    Aml *field;
> +    Aml *dev;
> +    Aml *method;
> +    Aml *ifctx;
> +
> +    /* build memory devices */
> +    assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
> +    scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
> +    aml_append(scope,
> +        aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
> +    );
> +
> +    crs = aml_resource_template();
> +    aml_append(crs,
> +        aml_io(AML_DECODE16, io_base, io_base, 0, io_len)
> +    );
> +    aml_append(scope, aml_name_decl("_CRS", crs));
> +
> +    aml_append(scope, aml_operation_region(
> +        stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
> +        io_base, io_len)
> +    );
> +
> +    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> +                      AML_NOLOCK, AML_PRESERVE);
> +    aml_append(field, /* read only */
> +        aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
> +    aml_append(field, /* read only */
> +        aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
> +    aml_append(field, /* read only */
> +        aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
> +    aml_append(field, /* read only */
> +        aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
> +    aml_append(field, /* read only */
> +        aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
> +    aml_append(scope, field);
> +
> +    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
> +                      AML_NOLOCK, AML_WRITE_AS_ZEROS);
> +    aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
> +    aml_append(field, /* 1 if enabled, read only */
> +        aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
> +    aml_append(field,
> +        /*(read) 1 if has a insert event. (write) 1 to clear event */
> +        aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
> +    aml_append(field,
> +        /* (read) 1 if has a remove event. (write) 1 to clear event */
> +        aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
> +    aml_append(field,
> +        /* initiates device eject, write only */
> +        aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
> +    aml_append(scope, field);
> +
> +    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> +                      AML_NOLOCK, AML_PRESERVE);
> +    aml_append(field, /* DIMM selector, write only */
> +        aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
> +    aml_append(field, /* _OST event code, write only */
> +        aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
> +    aml_append(field, /* _OST status code, write only */
> +        aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
> +    aml_append(scope, field);
> +    aml_append(sb_scope, scope);
> +
> +    for (i = 0; i < nr_mem; i++) {
> +        #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."

Again we'll have to clean this up down the line.
All #defines should start at the 1st column.
And we should not pollute global namespace like this.
Would ACPI_MEMHP_BASEPATH be all that bad? I think not.
Existing code so can be a separate patch on top.

> +        const char *s;
> +
> +        dev = aml_device("MP%02X", i);
> +        aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
> +        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
> +
> +        method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
> +        s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
> +        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> +        aml_append(dev, method);
> +
> +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> +        s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
> +        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> +        aml_append(dev, method);
> +
> +        method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
> +        s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
> +        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> +        aml_append(dev, method);
> +
> +        method = aml_method("_OST", 3, AML_NOTSERIALIZED);
> +        s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
> +        aml_append(method, aml_return(aml_call4(
> +            s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
> +        )));
> +        aml_append(dev, method);
> +
> +        method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
> +        s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
> +        aml_append(method, aml_return(aml_call2(
> +                   s, aml_name("_UID"), aml_arg(0))));
> +        aml_append(dev, method);
> +
> +        aml_append(sb_scope, dev);
> +    }
> +
> +    /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
> +     *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
> +     */

BTW this needs a cleanup. It does nothing to clarify what is
the method doing, which by now I have forgotten :(
ASL is generally barely readable, if one finds documenting
C using ASL one knows one is in trouble :)

> +    method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
> +                        AML_NOTSERIALIZED);
> +    for (i = 0; i < nr_mem; i++) {
> +        ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
> +        aml_append(ifctx,
> +            aml_notify(aml_name("MP%.02X", i), aml_arg(1))
> +        );
> +        aml_append(method, ifctx);
> +    }
> +    aml_append(sb_scope, method);
> +}
> +
>  static void
>  build_ssdt(GArray *table_data, GArray *linker,
>             AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
> @@ -1206,119 +1330,8 @@ build_ssdt(GArray *table_data, GArray *linker,
>          }
>          aml_append(sb_scope, aml_name_decl("CPON", pkg));
>  
> -        /* build memory devices */
> -        assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
> -        scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
> -        aml_append(scope,
> -            aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
> -        );
> -
> -        crs = aml_resource_template();
> -        aml_append(crs,
> -            aml_io(AML_DECODE16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0,
> -                   pm->mem_hp_io_len)
> -        );
> -        aml_append(scope, aml_name_decl("_CRS", crs));
> -
> -        aml_append(scope, aml_operation_region(
> -            stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
> -            pm->mem_hp_io_base, pm->mem_hp_io_len)
> -        );
> -
> -        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> -                          AML_NOLOCK, AML_PRESERVE);
> -        aml_append(field, /* read only */
> -            aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
> -        aml_append(field, /* read only */
> -            aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
> -        aml_append(field, /* read only */
> -            aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
> -        aml_append(field, /* read only */
> -            aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
> -        aml_append(field, /* read only */
> -            aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
> -        aml_append(scope, field);
> -
> -        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
> -                          AML_NOLOCK, AML_WRITE_AS_ZEROS);
> -        aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
> -        aml_append(field, /* 1 if enabled, read only */
> -            aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
> -        aml_append(field,
> -            /*(read) 1 if has a insert event. (write) 1 to clear event */
> -            aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
> -        aml_append(field,
> -            /* (read) 1 if has a remove event. (write) 1 to clear event */
> -            aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
> -        aml_append(field,
> -            /* initiates device eject, write only */
> -            aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
> -        aml_append(scope, field);
> -
> -        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> -                          AML_NOLOCK, AML_PRESERVE);
> -        aml_append(field, /* DIMM selector, write only */
> -            aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
> -        aml_append(field, /* _OST event code, write only */
> -            aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
> -        aml_append(field, /* _OST status code, write only */
> -            aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
> -        aml_append(scope, field);
> -
> -        aml_append(sb_scope, scope);
> -
> -        for (i = 0; i < nr_mem; i++) {
> -            #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
> -            const char *s;
> -
> -            dev = aml_device("MP%02X", i);
> -            aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
> -            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
> -
> -            method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
> -            s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
> -            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> -            aml_append(dev, method);
> -
> -            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> -            s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
> -            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> -            aml_append(dev, method);
> -
> -            method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
> -            s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
> -            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> -            aml_append(dev, method);
> -
> -            method = aml_method("_OST", 3, AML_NOTSERIALIZED);
> -            s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
> -            aml_append(method, aml_return(aml_call4(
> -                s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
> -            )));
> -            aml_append(dev, method);
> -
> -            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
> -            s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
> -            aml_append(method, aml_return(aml_call2(
> -                       s, aml_name("_UID"), aml_arg(0))));
> -            aml_append(dev, method);
> -
> -            aml_append(sb_scope, dev);
> -        }
> -
> -        /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
> -         *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
> -         */
> -        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
> -                            AML_NOTSERIALIZED);
> -        for (i = 0; i < nr_mem; i++) {
> -            ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
> -            aml_append(ifctx,
> -                aml_notify(aml_name("MP%.02X", i), aml_arg(1))
> -            );
> -            aml_append(method, ifctx);
> -        }
> -        aml_append(sb_scope, method);
> +        build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
> +                             pm->mem_hp_io_len);
>  
>          {
>              Object *pci_host;
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers " Igor Mammedov
  2015-12-19 19:30   ` Michael S. Tsirkin
@ 2015-12-19 20:34   ` Michael S. Tsirkin
  2015-12-21 12:45     ` Igor Mammedov
  2015-12-21 15:35     ` Igor Mammedov
  1 sibling, 2 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 20:34 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Thu, Dec 10, 2015 at 12:41:48AM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/i386/acpi-build.c      | 26 +++++++++++++++++++++++++-
>  hw/i386/acpi-dsdt.dsl     | 40 ----------------------------------------
>  hw/i386/q35-acpi-dsdt.dsl | 36 ------------------------------------
>  3 files changed, 25 insertions(+), 77 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 581ad98..99c0294 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1400,8 +1400,25 @@ build_ssdt(GArray *table_data, GArray *linker,
>      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
>                               pm->mem_hp_io_len);
>  
> -    scope =  aml_scope("\\_GPE");
> +    scope =  aml_scope("_GPE");
>      {
> +        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
> +
> +        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
> +        aml_append(scope, method);
> +
> +        if (misc->is_piix4) {
> +            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
> +            aml_append(method,
> +                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
> +            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
> +            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
> +            aml_append(scope, method);
> +        } else {
> +            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
> +            aml_append(scope, method);
> +        }
> +
>          method = aml_method("_E02", 0, AML_NOTSERIALIZED);
>          aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
>          aml_append(scope, method);
> @@ -1409,6 +1426,13 @@ build_ssdt(GArray *table_data, GArray *linker,
>          method = aml_method("_E03", 0, AML_NOTSERIALIZED);
>          aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
>          aml_append(scope, method);
> +
> +        for (i = 4; i <= 0xF; i++) {
> +            char *name = g_strdup_printf("_L0%X", i);
> +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> +            aml_append(scope, method);
> +            g_free(name);
> +        }

How about we make aml_method accept ... format instead?


>      }
>      aml_append(ssdt, scope);
>  
> diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> index 11e2e61..c9b2725 100644
> --- a/hw/i386/acpi-dsdt.dsl
> +++ b/hw/i386/acpi-dsdt.dsl
> @@ -197,44 +197,4 @@ DefinitionBlock (
>              Method(_SRS, 1, NotSerialized) { }
>          }
>      }
> -
> -/****************************************************************
> - * General purpose events
> - ****************************************************************/
> -    Scope(\_GPE) {
> -        Name(_HID, "ACPI0006")
> -
> -        Method(_L00) {
> -        }
> -        Method(_E01) {
> -            // PCI hotplug event
> -            Acquire(\_SB.PCI0.BLCK, 0xFFFF)
> -            \_SB.PCI0.PCNT()
> -            Release(\_SB.PCI0.BLCK)
> -        }
> -        Method(_L04) {
> -        }
> -        Method(_L05) {
> -        }
> -        Method(_L06) {
> -        }
> -        Method(_L07) {
> -        }
> -        Method(_L08) {
> -        }
> -        Method(_L09) {
> -        }
> -        Method(_L0A) {
> -        }
> -        Method(_L0B) {
> -        }
> -        Method(_L0C) {
> -        }
> -        Method(_L0D) {
> -        }
> -        Method(_L0E) {
> -        }
> -        Method(_L0F) {
> -        }
> -    }
>  }
> diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
> index 4862ded..e157615 100644
> --- a/hw/i386/q35-acpi-dsdt.dsl
> +++ b/hw/i386/q35-acpi-dsdt.dsl
> @@ -375,40 +375,4 @@ DefinitionBlock (
>          define_gsi_link(GSIG, 0, 0x16)
>          define_gsi_link(GSIH, 0, 0x17)
>      }
> -
> -/****************************************************************
> - * General purpose events
> - ****************************************************************/
> -    Scope(\_GPE) {
> -        Name(_HID, "ACPI0006")
> -
> -        Method(_L00) {
> -        }
> -        Method(_L01) {
> -        }
> -        Method(_L04) {
> -        }
> -        Method(_L05) {
> -        }
> -        Method(_L06) {
> -        }
> -        Method(_L07) {
> -        }
> -        Method(_L08) {
> -        }
> -        Method(_L09) {
> -        }
> -        Method(_L0A) {
> -        }
> -        Method(_L0B) {
> -        }
> -        Method(_L0C) {
> -        }
> -        Method(_L0D) {
> -        }
> -        Method(_L0E) {
> -        }
> -        Method(_L0F) {
> -        }
> -    }
>  }
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
                   ` (75 preceding siblings ...)
  2015-12-10 16:44 ` Igor Mammedov
@ 2015-12-19 20:38 ` Michael S. Tsirkin
  2015-12-21 13:00   ` Igor Mammedov
  76 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-19 20:38 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Peter Maydell, Eduardo Habkost, qemu-devel,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

On Thu, Dec 10, 2015 at 12:40:54AM +0100, Igor Mammedov wrote:
> Due to huge size, CCing only cover letter instead of individual patches.
> 
> Series consist of 2 parts the 1st part prefixed 'acpi:' adds necessary
> AML API functions and the second part converts DSDT using existing and
> new AML API.
> 
> Series does exact byte by byte conversion and passes ACPI tables
> 'make check' tests.
> The conversion first moves common for PIIX4/Q35 parts, getting rid of *.dsl
> includes and then converts PIIX4 and Q35 parts of DSDT.
> 
> Diff-stat looks nice but actual code base is reduced by ~2000LOC
> while the rest of 10000 removals is dropping precompiled AML
> templates from tree.
> 
> There are some AML parts that could be optimized/simplified and shared
> between PIIX4/Q35/ARM but doing it will break exact match with original
> tests, hence it's left out of the scope of this series.
> 
> CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
> CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
> CC: Peter Maydell <peter.maydell@linaro.org> (maintainer:ARM)
> CC: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
> CC: Richard Henderson <rth@twiddle.net> (maintainer:X86)
> CC: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
> CC: qemu-arm@nongnu.org (open list:ARM ACPI Subsystem)

I think this is a nice series, and I think we can live with the fact
make check warns in the middle.

I sent some comments I'd like to see addressed.

Main points
	- one v2 patch seems garbled
	- please don't create functions with tons of parameters
	  which just do if (a) on each of these internally.
	  instead, move common code into a small function that
	  can be reused without so many conditionals.
	- I really dislike local variables starting with a_ for
	  no good reason.

Thanks!

> Igor Mammedov (70):
>   tests: acpi: print ASL diff in verbose mode
>   acpi: add aml_lgreater_equal()
>   acpi: add aml_create_qword_field()
>   acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
>   acpi: extend aml_add() to accept target argument
>   acpi: add aml_decrement() and aml_subtract()
>   acpi: add aml_call0() helper
>   acpi: add aml_to_integer()
>   acpi: extend aml_shiftright() to accept target argument
>   acpi: add aml_alias()
>   acpi: add aml_sleep()
>   acpi: add aml_lor()
>   acpi: add aml_lgreater()
>   acpi: extend aml_field() to support LockRule
>   acpi: add aml_to_hexstring()
>   acpi: add aml_to_buffer()
>   acpi add aml_dma()
>   acpi: extend aml_or() to accept target argument
>   acpi: extend aml_and() to accept target argument
>   acpi: extend aml_interrupt() to support multiple irqs
>   pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
>   pc: acpi: memhp: move MHPD._STA method into SSDT
>   pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
>   pc: acpi: memhp: move MHPD.MSCN method into SSDT
>   pc: acpi: memhp: move MHPD.MRST method into SSDT
>   pc: acpi: memhp: move MHPD.MPXM method into SSDT
>   pc: acpi: memhp: move MHPD.MOST method into SSDT
>   pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
>   pc: acpi: memhp: move MHPD.MCRS method into SSDT
>   pc: acpi: memhp: move MHPD Device into SSDT
>   pc: acpi: factor out memhp code from build_ssdt() into separate
>     function
>   pc: acpi: memhp: move \_GPE._E03 into SSDT
>   pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
>   pc: acpi: drop unused CPU_STATUS_LEN from DSDT
>   pc: acpi: cpuhp: move CPEJ() method to SSDT
>   pc: acpi: cpuhp: move CPMA() method into SSDT
>   pc: acpi: cpuhp: move CPST() method into SSDT
>   pc: acpi: cpuhp: move PRSC() method into SSDT
>   pc: acpi: cpuhp: move \_GPE._E02() into SSDT
>   pc: acpi: factor out cpu hotplug code from build_ssdt() into separate
>     function
>   pc: acpi: move HPET from DSDT to SSDT
>   pc: acpi: move DBUG() from DSDT to SSDT
>   pc: acpi: move RTC device from DSDT to SSDT
>   pc: acpi: move KBD device from DSDT to SSDT
>   pc: acpi: move MOU device from DSDT to SSDT
>   pc: acpi: move FDC0 device from DSDT to SSDT
>   pc: acpi: move LPT device from DSDT to SSDT
>   pc: acpi: move COM devices from DSDT to SSDT
>   pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
>   pc: acpi: move remaining GPE handlers into SSDT
>   pc: acpi: pci: move link devices into SSDT
>   pc: acpi: piix4: move IQCR() into SSDT
>   pc: acpi: piix4: move IQST() into SSDT
>   pc: acpi: piix4: move PCI0._PRT() into SSDT
>   pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
>   pc: acpi: piix4: acpi move PCI0 device to SSDT
>   pc: acpi: q35: move GSI links to SSDT
>   pc: acpi: q35: move link devices to SSDT
>   pc: acpi: q35: move IQCR() into SSDT
>   pc: acpi: q35: move IQST() into SSDT
>   pc: acpi: q35: move ISA bridge into SSDT
>   pc: acpi: q35: move _PRT() into SSDT
>   pc: acpi: q35: move PRTA routing table into SSDT
>   pc: acpi: q35: move PRTP routing table into SSDT
>   pc: acpi: q35: move _PIC() method into SSDT
>   pc: acpi: q35: move PCI0._OSC() method into SSDT
>   pc: acpi: q35: move PCI0 device definition into SSDT
>   pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
>   pc: acpi: switch to AML API composed DSDT
>   pc: acpi: remove unused ASL templates and related blobs/utils
> 
> Xiao Guangrong (4):
>   acpi: add aml_derefof
>   acpi: add aml_sizeof
>   acpi: add aml_mutex(), aml_acquire(), aml_release()
>   acpi: support serialized method
> 
>  hw/acpi/Makefile.objs               |    4 +-
>  hw/acpi/aml-build.c                 |  294 +-
>  hw/acpi/cpu_hotplug_acpi_table.c    |  124 +
>  hw/acpi/memory_hotplug_acpi_table.c |  249 ++
>  hw/arm/virt-acpi-build.c            |   41 +-
>  hw/i386/Makefile.objs               |   31 +-
>  hw/i386/acpi-build.c                | 1329 ++++--
>  hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   90 -
>  hw/i386/acpi-dsdt-dbug.dsl          |   41 -
>  hw/i386/acpi-dsdt-hpet.dsl          |   48 -
>  hw/i386/acpi-dsdt-isa.dsl           |  117 -
>  hw/i386/acpi-dsdt-mem-hotplug.dsl   |  171 -
>  hw/i386/acpi-dsdt.dsl               |  303 --
>  hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
>  hw/i386/q35-acpi-dsdt.dsl           |  436 --
>  hw/i386/q35-acpi-dsdt.hex.generated | 7610 -----------------------------------
>  hw/timer/hpet.c                     |    2 +-
>  include/hw/acpi/aml-build.h         |   66 +-
>  include/hw/acpi/cpu_hotplug.h       |   10 +
>  include/hw/acpi/memory_hotplug.h    |    9 +
>  include/hw/acpi/pc-hotplug.h        |   44 +-
>  include/hw/timer/hpet.h             |    1 +
>  scripts/acpi_extract.py             |  367 --
>  scripts/acpi_extract_preprocess.py  |   51 -
>  scripts/update-acpi.sh              |    4 -
>  tests/bios-tables-test.c            |    7 +
>  26 files changed, 1848 insertions(+), 12573 deletions(-)
>  create mode 100644 hw/acpi/cpu_hotplug_acpi_table.c
>  create mode 100644 hw/acpi/memory_hotplug_acpi_table.c
>  delete mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl
>  delete mode 100644 hw/i386/acpi-dsdt-dbug.dsl
>  delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl
>  delete mode 100644 hw/i386/acpi-dsdt-isa.dsl
>  delete mode 100644 hw/i386/acpi-dsdt-mem-hotplug.dsl
>  delete mode 100644 hw/i386/acpi-dsdt.dsl
>  delete mode 100644 hw/i386/acpi-dsdt.hex.generated
>  delete mode 100644 hw/i386/q35-acpi-dsdt.dsl
>  delete mode 100644 hw/i386/q35-acpi-dsdt.hex.generated
>  delete mode 100755 scripts/acpi_extract.py
>  delete mode 100755 scripts/acpi_extract_preprocess.py
>  delete mode 100644 scripts/update-acpi.sh
> 
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-16 14:47   ` [Qemu-devel] [PATCH v2 " Igor Mammedov
@ 2015-12-20 10:32     ` Marcel Apfelbaum
  2015-12-20 13:41     ` Michael S. Tsirkin
  1 sibling, 0 replies; 165+ messages in thread
From: Marcel Apfelbaum @ 2015-12-20 10:32 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: mst

On 12/16/2015 04:47 PM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v2:
>   - add parentheses around ifctx block
>     Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> ---
>   hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++
>   hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
>   2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
> index 9b61b1c..e1a6551 100644
> --- a/hw/acpi/memory_hotplug_acpi_table.c
> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> @@ -29,11 +29,25 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
>   {
>       Aml *pci_scope;
>       Aml *ctrl_dev;
> +    Aml *method;
> +    Aml *ifctx;
> +    Aml *a_zero = aml_int(0);
> +    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
>
>       /* scope for memory hotplug controller device node */
>       pci_scope = aml_scope("_SB.PCI0");
>       ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
>       {
> +        /* MHPD._STA() method */
> +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> +        {
> +             aml_append(ifctx, aml_return(a_zero));
> +        }
> +        aml_append(method, ifctx);
> +        /* present, functioning, decoding, not shown in UI */
> +        aml_append(method, aml_return(aml_int(0xB)));
> +        aml_append(ctrl_dev, method);
>       }
>       aml_append(pci_scope, ctrl_dev);
>       aml_append(ctx, pci_scope);
> diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> index c2bb6a1..b4eacc9 100644
> --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> @@ -35,14 +35,6 @@
>               External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
>               External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
>
> -            Method(_STA, 0) {
> -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> -                    Return(0x0)
> -                }
> -                /* present, functioning, decoding, not shown in UI */
> -                Return(0xB)
> -            }
> -
>               Mutex (MEMORY_SLOT_LOCK, 0)
>
>               Method(MEMORY_SLOT_SCAN_METHOD, 0) {
>


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

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

* Re: [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-16 14:47   ` [Qemu-devel] [PATCH v2 " Igor Mammedov
  2015-12-20 10:32     ` Marcel Apfelbaum
@ 2015-12-20 13:41     ` Michael S. Tsirkin
  2015-12-21 10:52       ` Igor Mammedov
  2015-12-21 17:31       ` Igor Mammedov
  1 sibling, 2 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-20 13:41 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, marcel.apfelbaum

On Wed, Dec 16, 2015 at 03:47:35PM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v2:
>  - add parentheses around ifctx block
>    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> ---
>  hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++
>  hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
>  2 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
> index 9b61b1c..e1a6551 100644
> --- a/hw/acpi/memory_hotplug_acpi_table.c
> +++ b/hw/acpi/memory_hotplug_acpi_table.c
> @@ -29,11 +29,25 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
>  {
>      Aml *pci_scope;
>      Aml *ctrl_dev;
> +    Aml *method;
> +    Aml *ifctx;
> +    Aml *a_zero = aml_int(0);
> +    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
>  
>      /* scope for memory hotplug controller device node */
>      pci_scope = aml_scope("_SB.PCI0");
>      ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
>      {
> +        /* MHPD._STA() method */

You know something's wrong if you are documenting C using ASL.  In this
case, rename ctrl_dev to mem_hotplug_dev, move ifctx zero and slots nr
within {} and drop a_ prefix for zero and slots_nr and code will be
clear without this comment.

> +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> +        {
> +             aml_append(ifctx, aml_return(a_zero));
> +        }
> +        aml_append(method, ifctx);
> +        /* present, functioning, decoding, not shown in UI */
> +        aml_append(method, aml_return(aml_int(0xB)));
> +        aml_append(ctrl_dev, method);


Simple unserialized methods that return value depending on input
being zero seem very common.  How about a helper for this case?

E.g.

aml_method_if_then_else(slots_nr, aml_int(0xB), aml_int(0));


>      }
>      aml_append(pci_scope, ctrl_dev);
>      aml_append(ctx, pci_scope);
> diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> index c2bb6a1..b4eacc9 100644
> --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> @@ -35,14 +35,6 @@
>              External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
>              External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
>  
> -            Method(_STA, 0) {
> -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> -                    Return(0x0)
> -                }
> -                /* present, functioning, decoding, not shown in UI */
> -                Return(0xB)
> -            }
> -
>              Mutex (MEMORY_SLOT_LOCK, 0)
>  
>              Method(MEMORY_SLOT_SCAN_METHOD, 0) {
> -- 
> 1.8.3.1

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

* Re: [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-20 13:41     ` Michael S. Tsirkin
@ 2015-12-21 10:52       ` Igor Mammedov
  2015-12-21 17:31       ` Igor Mammedov
  1 sibling, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 10:52 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, marcel.apfelbaum

On Sun, 20 Dec 2015 15:41:22 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Dec 16, 2015 at 03:47:35PM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > v2:
> >  - add parentheses around ifctx block
> >    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > ---
> >  hw/acpi/memory_hotplug_acpi_table.c | 14 ++++++++++++++
> >  hw/i386/acpi-dsdt-mem-hotplug.dsl   |  8 --------
> >  2 files changed, 14 insertions(+), 8 deletions(-)
> > 
> > diff --git a/hw/acpi/memory_hotplug_acpi_table.c b/hw/acpi/memory_hotplug_acpi_table.c
> > index 9b61b1c..e1a6551 100644
> > --- a/hw/acpi/memory_hotplug_acpi_table.c
> > +++ b/hw/acpi/memory_hotplug_acpi_table.c
> > @@ -29,11 +29,25 @@ void build_memory_hotplug_aml(Aml *ctx, uint32_t nr_mem,
> >  {
> >      Aml *pci_scope;
> >      Aml *ctrl_dev;
> > +    Aml *method;
> > +    Aml *ifctx;
> > +    Aml *a_zero = aml_int(0);
> > +    Aml *a_slots_nr = aml_name(stringify(MEMORY_SLOTS_NUMBER));
> >  
> >      /* scope for memory hotplug controller device node */
> >      pci_scope = aml_scope("_SB.PCI0");
> >      ctrl_dev = aml_scope(stringify(MEMORY_HOTPLUG_DEVICE));
> >      {
> > +        /* MHPD._STA() method */
> 
> You know something's wrong if you are documenting C using ASL.  In this
> case, rename ctrl_dev to mem_hotplug_dev, move ifctx zero and slots nr
> within {} and drop a_ prefix for zero and slots_nr and code will be
> clear without this comment.
ok, will do it on respin.
> 
> > +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> > +        {
> > +             aml_append(ifctx, aml_return(a_zero));
> > +        }
> > +        aml_append(method, ifctx);
> > +        /* present, functioning, decoding, not shown in UI */
> > +        aml_append(method, aml_return(aml_int(0xB)));
> > +        aml_append(ctrl_dev, method);
> 
> 
> Simple unserialized methods that return value depending on input
> being zero seem very common.  How about a helper for this case?
> 
> E.g.
> 
> aml_method_if_then_else(slots_nr, aml_int(0xB), aml_int(0));
sure

> 
> 
> >      }
> >      aml_append(pci_scope, ctrl_dev);
> >      aml_append(ctx, pci_scope);
> > diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > index c2bb6a1..b4eacc9 100644
> > --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > @@ -35,14 +35,6 @@
> >              External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
> >              External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
> >  
> > -            Method(_STA, 0) {
> > -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> > -                    Return(0x0)
> > -                }
> > -                /* present, functioning, decoding, not shown in UI */
> > -                Return(0xB)
> > -            }
> > -
> >              Mutex (MEMORY_SLOT_LOCK, 0)
> >  
> >              Method(MEMORY_SLOT_SCAN_METHOD, 0) {
> > -- 
> > 1.8.3.1

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

* Re: [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function
  2015-12-19 20:18   ` Michael S. Tsirkin
@ 2015-12-21 11:01     ` Igor Mammedov
  2015-12-21 11:38       ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 11:01 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sat, 19 Dec 2015 22:18:14 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:41:29AM +0100, Igor Mammedov wrote:
> > before consolidating memhp code in memory_hotplug_acpi_table.c
> > and for simplifying review, first factor out memhp code into
> > new function build_memory_devices() in i386/acpi-build.c
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ----
> > PS:
> >    no functional change, only code movement.
> > ---
> >  hw/i386/acpi-build.c | 239 +++++++++++++++++++++++++++------------------------
> >  1 file changed, 126 insertions(+), 113 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index 1b609e6..765fccd 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -903,6 +903,130 @@ static Aml *build_crs(PCIHostState *host,
> >      return crs;
> >  }
> >  
> > +static void build_memory_devices(Aml *sb_scope, int nr_mem,
> > +                                 uint16_t io_base, uint16_t io_len)
> > +{
> > +    int i;
> > +    Aml *scope;
> > +    Aml *crs;
> > +    Aml *field;
> > +    Aml *dev;
> > +    Aml *method;
> > +    Aml *ifctx;
> > +
> > +    /* build memory devices */
> > +    assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
> > +    scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
> > +    aml_append(scope,
> > +        aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
> > +    );
> > +
> > +    crs = aml_resource_template();
> > +    aml_append(crs,
> > +        aml_io(AML_DECODE16, io_base, io_base, 0, io_len)
> > +    );
> > +    aml_append(scope, aml_name_decl("_CRS", crs));
> > +
> > +    aml_append(scope, aml_operation_region(
> > +        stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
> > +        io_base, io_len)
> > +    );
> > +
> > +    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> > +                      AML_NOLOCK, AML_PRESERVE);
> > +    aml_append(field, /* read only */
> > +        aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
> > +    aml_append(field, /* read only */
> > +        aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
> > +    aml_append(field, /* read only */
> > +        aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
> > +    aml_append(field, /* read only */
> > +        aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
> > +    aml_append(field, /* read only */
> > +        aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
> > +    aml_append(scope, field);
> > +
> > +    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
> > +                      AML_NOLOCK, AML_WRITE_AS_ZEROS);
> > +    aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
> > +    aml_append(field, /* 1 if enabled, read only */
> > +        aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
> > +    aml_append(field,
> > +        /*(read) 1 if has a insert event. (write) 1 to clear event */
> > +        aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
> > +    aml_append(field,
> > +        /* (read) 1 if has a remove event. (write) 1 to clear event */
> > +        aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
> > +    aml_append(field,
> > +        /* initiates device eject, write only */
> > +        aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
> > +    aml_append(scope, field);
> > +
> > +    field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> > +                      AML_NOLOCK, AML_PRESERVE);
> > +    aml_append(field, /* DIMM selector, write only */
> > +        aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
> > +    aml_append(field, /* _OST event code, write only */
> > +        aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
> > +    aml_append(field, /* _OST status code, write only */
> > +        aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
> > +    aml_append(scope, field);
> > +    aml_append(sb_scope, scope);
> > +
> > +    for (i = 0; i < nr_mem; i++) {
> > +        #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
> 
> Again we'll have to clean this up down the line.
> All #defines should start at the 1st column.
> And we should not pollute global namespace like this.
> Would ACPI_MEMHP_BASEPATH be all that bad? I think not.
> Existing code so can be a separate patch on top.
I can do it on top of series if you don't object.

> 
> > +        const char *s;
> > +
> > +        dev = aml_device("MP%02X", i);
> > +        aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
> > +        aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
> > +
> > +        method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
> > +        s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
> > +        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> > +        aml_append(dev, method);
> > +
> > +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > +        s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
> > +        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> > +        aml_append(dev, method);
> > +
> > +        method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
> > +        s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
> > +        aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> > +        aml_append(dev, method);
> > +
> > +        method = aml_method("_OST", 3, AML_NOTSERIALIZED);
> > +        s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
> > +        aml_append(method, aml_return(aml_call4(
> > +            s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
> > +        )));
> > +        aml_append(dev, method);
> > +
> > +        method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
> > +        s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
> > +        aml_append(method, aml_return(aml_call2(
> > +                   s, aml_name("_UID"), aml_arg(0))));
> > +        aml_append(dev, method);
> > +
> > +        aml_append(sb_scope, dev);
> > +    }
> > +
> > +    /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
> > +     *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
> > +     */
> 
> BTW this needs a cleanup. It does nothing to clarify what is
> the method doing, which by now I have forgotten :(
> ASL is generally barely readable, if one finds documenting
> C using ASL one knows one is in trouble :)
Generally, I've put ASL comments there so that whoever debugs
that code could easily correlate ASL seen in a table with C
code that produces it.

> 
> > +    method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
> > +                        AML_NOTSERIALIZED);
> > +    for (i = 0; i < nr_mem; i++) {
> > +        ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
> > +        aml_append(ifctx,
> > +            aml_notify(aml_name("MP%.02X", i), aml_arg(1))
> > +        );
> > +        aml_append(method, ifctx);
> > +    }
> > +    aml_append(sb_scope, method);
> > +}
> > +
> >  static void
> >  build_ssdt(GArray *table_data, GArray *linker,
> >             AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
> > @@ -1206,119 +1330,8 @@ build_ssdt(GArray *table_data, GArray *linker,
> >          }
> >          aml_append(sb_scope, aml_name_decl("CPON", pkg));
> >  
> > -        /* build memory devices */
> > -        assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
> > -        scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
> > -        aml_append(scope,
> > -            aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
> > -        );
> > -
> > -        crs = aml_resource_template();
> > -        aml_append(crs,
> > -            aml_io(AML_DECODE16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0,
> > -                   pm->mem_hp_io_len)
> > -        );
> > -        aml_append(scope, aml_name_decl("_CRS", crs));
> > -
> > -        aml_append(scope, aml_operation_region(
> > -            stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
> > -            pm->mem_hp_io_base, pm->mem_hp_io_len)
> > -        );
> > -
> > -        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> > -                          AML_NOLOCK, AML_PRESERVE);
> > -        aml_append(field, /* read only */
> > -            aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
> > -        aml_append(field, /* read only */
> > -            aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
> > -        aml_append(field, /* read only */
> > -            aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
> > -        aml_append(field, /* read only */
> > -            aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
> > -        aml_append(field, /* read only */
> > -            aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
> > -        aml_append(scope, field);
> > -
> > -        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
> > -                          AML_NOLOCK, AML_WRITE_AS_ZEROS);
> > -        aml_append(field, aml_reserved_field(160 /* bits, Offset(20) */));
> > -        aml_append(field, /* 1 if enabled, read only */
> > -            aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
> > -        aml_append(field,
> > -            /*(read) 1 if has a insert event. (write) 1 to clear event */
> > -            aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
> > -        aml_append(field,
> > -            /* (read) 1 if has a remove event. (write) 1 to clear event */
> > -            aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
> > -        aml_append(field,
> > -            /* initiates device eject, write only */
> > -            aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
> > -        aml_append(scope, field);
> > -
> > -        field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
> > -                          AML_NOLOCK, AML_PRESERVE);
> > -        aml_append(field, /* DIMM selector, write only */
> > -            aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
> > -        aml_append(field, /* _OST event code, write only */
> > -            aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
> > -        aml_append(field, /* _OST status code, write only */
> > -            aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
> > -        aml_append(scope, field);
> > -
> > -        aml_append(sb_scope, scope);
> > -
> > -        for (i = 0; i < nr_mem; i++) {
> > -            #define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
> > -            const char *s;
> > -
> > -            dev = aml_device("MP%02X", i);
> > -            aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
> > -            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
> > -
> > -            method = aml_method("_CRS", 0, AML_NOTSERIALIZED);
> > -            s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
> > -            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> > -            aml_append(dev, method);
> > -
> > -            method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > -            s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
> > -            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> > -            aml_append(dev, method);
> > -
> > -            method = aml_method("_PXM", 0, AML_NOTSERIALIZED);
> > -            s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
> > -            aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
> > -            aml_append(dev, method);
> > -
> > -            method = aml_method("_OST", 3, AML_NOTSERIALIZED);
> > -            s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
> > -            aml_append(method, aml_return(aml_call4(
> > -                s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
> > -            )));
> > -            aml_append(dev, method);
> > -
> > -            method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
> > -            s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
> > -            aml_append(method, aml_return(aml_call2(
> > -                       s, aml_name("_UID"), aml_arg(0))));
> > -            aml_append(dev, method);
> > -
> > -            aml_append(sb_scope, dev);
> > -        }
> > -
> > -        /* build Method(MEMORY_SLOT_NOTIFY_METHOD, 2) {
> > -         *     If (LEqual(Arg0, 0x00)) {Notify(MP00, Arg1)} ... }
> > -         */
> > -        method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2,
> > -                            AML_NOTSERIALIZED);
> > -        for (i = 0; i < nr_mem; i++) {
> > -            ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
> > -            aml_append(ifctx,
> > -                aml_notify(aml_name("MP%.02X", i), aml_arg(1))
> > -            );
> > -            aml_append(method, ifctx);
> > -        }
> > -        aml_append(sb_scope, method);
> > +        build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
> > +                             pm->mem_hp_io_len);
> >  
> >          {
> >              Object *pci_host;
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT
  2015-12-19 19:50   ` Michael S. Tsirkin
@ 2015-12-21 11:02     ` Igor Mammedov
  2015-12-21 11:42       ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 11:02 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sat, 19 Dec 2015 21:50:41 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:41:39AM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/i386/acpi-build.c       | 53 ++++++++++++++++++++++++++++++++++++++++++++++
> >  hw/i386/acpi-dsdt-hpet.dsl | 48 -----------------------------------------
> >  hw/i386/acpi-dsdt.dsl      |  2 --
> >  hw/i386/q35-acpi-dsdt.dsl  |  3 ---
> >  hw/timer/hpet.c            |  2 +-
> >  include/hw/timer/hpet.h    |  1 +
> >  6 files changed, 55 insertions(+), 54 deletions(-)
> >  delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index 72883ad..62f932e 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -50,6 +50,7 @@
> >  #include "hw/pci/pci_bus.h"
> >  #include "hw/pci-host/q35.h"
> >  #include "hw/i386/intel_iommu.h"
> > +#include "hw/timer/hpet.h"
> >  
> >  #include "hw/i386/q35-acpi-dsdt.hex"
> >  #include "hw/i386/acpi-dsdt.hex"
> > @@ -1119,6 +1120,57 @@ static void build_memory_devices(Aml *sb_scope, int nr_mem,
> >      aml_append(sb_scope, method);
> >  }
> >  
> > +static void build_hpet_aml(Aml *table)
> > +{
> > +    Aml *crs;
> > +    Aml *field;
> > +    Aml *method;
> > +    Aml *if_ctx;
> > +    Aml *scope = aml_scope("_SB");
> > +    Aml *dev = aml_device("HPET");
> > +    Aml *a_zero = aml_int(0);
> > +    Aml *a_id = aml_local(0);
> > +    Aml *a_period = aml_local(1);
> 
> This one really jumps out, but it's all over the place.
> Please drop these a_ prefixes all over, they don't help.
sure

> 
> > +
> > +    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0103")));
> > +    aml_append(dev, aml_name_decl("_UID", a_zero));
> > +
> > +    aml_append(dev, aml_operation_region("HPTM", AML_SYSTEM_MEMORY,
> > +                                         HPET_BASE, HPET_LEN));
> > +    field = aml_field("HPTM", AML_DWORD_ACC, AML_LOCK, AML_PRESERVE);
> > +    aml_append(field, aml_named_field("VEND", 32));
> > +    aml_append(field, aml_named_field("PRD", 32));
> > +    aml_append(dev, field);
> > +
> > +    method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > +    aml_append(method, aml_store(aml_name("VEND"), a_id));
> > +    aml_append(method, aml_store(aml_name("PRD"), a_period));
> > +    aml_append(method, aml_shiftright(a_id, aml_int(16), a_id));
> > +    if_ctx = aml_if(aml_lor(
> > +                            aml_equal(a_id, a_zero),
> > +                            aml_equal(a_id, aml_int(0xffff))));
> > +    aml_append(if_ctx, aml_return(a_zero));
> > +    aml_append(method, if_ctx);
> > +
> > +    if_ctx = aml_if(aml_lor(
> 
> Don't split lines like this please.
What style would you prefer?

> 
> > +                            aml_equal(a_period, a_zero),
> > +                            aml_lgreater(a_period, aml_int(100000000))));
> > +    aml_append(if_ctx, aml_return(a_zero));
> > +    aml_append(method, if_ctx);
> > +
> > +    aml_append(method, aml_return(aml_int(0x0F)));
> > +    aml_append(dev, method);
> > +
> > +    crs = aml_resource_template();
> > +    aml_append(crs,
> > +        aml_memory32_fixed(HPET_BASE, HPET_LEN, AML_READ_ONLY)
> > +    );
> > +    aml_append(dev, aml_name_decl("_CRS", crs));
> > +
> > +    aml_append(scope, dev);
> > +    aml_append(table, scope);
> > +}
> > +
> >  static void
> >  build_ssdt(GArray *table_data, GArray *linker,
> >             AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
> > @@ -1139,6 +1191,7 @@ build_ssdt(GArray *table_data, GArray *linker,
> >      /* Reserve space for header */
> >      acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
> >  
> > +    build_hpet_aml(ssdt);
> >      build_cpu_hotplug_aml(ssdt);
> >      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> >                               pm->mem_hp_io_len);
> > diff --git a/hw/i386/acpi-dsdt-hpet.dsl b/hw/i386/acpi-dsdt-hpet.dsl
> > deleted file mode 100644
> > index 44961b8..0000000
> > --- a/hw/i386/acpi-dsdt-hpet.dsl
> > +++ /dev/null
> > @@ -1,48 +0,0 @@
> > -/*
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License as published by
> > - * the Free Software Foundation; either version 2 of the License, or
> > - * (at your option) any later version.
> > -
> > - * This program is distributed in the hope that it will be useful,
> > - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > - * GNU General Public License for more details.
> > -
> > - * You should have received a copy of the GNU General Public License along
> > - * with this program; if not, see <http://www.gnu.org/licenses/>.
> > - */
> > -
> > -/****************************************************************
> > - * HPET
> > - ****************************************************************/
> > -
> > -Scope(\_SB) {
> > -    Device(HPET) {
> > -        Name(_HID, EISAID("PNP0103"))
> > -        Name(_UID, 0)
> > -        OperationRegion(HPTM, SystemMemory, 0xFED00000, 0x400)
> > -        Field(HPTM, DWordAcc, Lock, Preserve) {
> > -            VEND, 32,
> > -            PRD, 32,
> > -        }
> > -        Method(_STA, 0, NotSerialized) {
> > -            Store(VEND, Local0)
> > -            Store(PRD, Local1)
> > -            ShiftRight(Local0, 16, Local0)
> > -            If (LOr(LEqual(Local0, 0), LEqual(Local0, 0xffff))) {
> > -                Return (0x0)
> > -            }
> > -            If (LOr(LEqual(Local1, 0), LGreater(Local1, 100000000))) {
> > -                Return (0x0)
> > -            }
> > -            Return (0x0F)
> > -        }
> > -        Name(_CRS, ResourceTemplate() {
> > -            Memory32Fixed(ReadOnly,
> > -                0xFED00000,         // Address Base
> > -                0x00000400,         // Address Length
> > -                )
> > -        })
> > -    }
> > -}
> > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > index 007d3c9..aa7f549 100644
> > --- a/hw/i386/acpi-dsdt.dsl
> > +++ b/hw/i386/acpi-dsdt.dsl
> > @@ -41,8 +41,6 @@ DefinitionBlock (
> >          }
> >      }
> >  
> > -#include "acpi-dsdt-hpet.dsl"
> > -
> >  /****************************************************************
> >   * PIIX4 PM
> >   ****************************************************************/
> > diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
> > index 0511e26..e57adb8 100644
> > --- a/hw/i386/q35-acpi-dsdt.dsl
> > +++ b/hw/i386/q35-acpi-dsdt.dsl
> > @@ -115,9 +115,6 @@ DefinitionBlock (
> >          }
> >      }
> >  
> > -#include "acpi-dsdt-hpet.dsl"
> > -
> > -
> >  /****************************************************************
> >   * LPC ISA bridge
> >   ****************************************************************/
> > diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> > index 7f0391c..d9d039b 100644
> > --- a/hw/timer/hpet.c
> > +++ b/hw/timer/hpet.c
> > @@ -713,7 +713,7 @@ static void hpet_init(Object *obj)
> >      HPETState *s = HPET(obj);
> >  
> >      /* HPET Area */
> > -    memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", 0x400);
> > +    memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", HPET_LEN);
> >      sysbus_init_mmio(sbd, &s->iomem);
> >  }
> >  
> > diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h
> > index d872909..f38bcfe 100644
> > --- a/include/hw/timer/hpet.h
> > +++ b/include/hw/timer/hpet.h
> > @@ -16,6 +16,7 @@
> >  #include "qom/object.h"
> >  
> >  #define HPET_BASE               0xfed00000
> > +#define HPET_LEN                0x400
> >  #define HPET_CLK_PERIOD         10 /* 10 ns*/
> >  
> >  #define FS_PER_NS 1000000       /* 1000000 femtoseconds == 1 ns */
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function
  2015-12-21 11:01     ` Igor Mammedov
@ 2015-12-21 11:38       ` Michael S. Tsirkin
  0 siblings, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-21 11:38 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Mon, Dec 21, 2015 at 12:01:07PM +0100, Igor Mammedov wrote:
> > Existing code so can be a separate patch on top.
> I can do it on top of series if you don't object.

I suggested this too so I won't object :)

-- 
MST

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

* Re: [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT
  2015-12-21 11:02     ` Igor Mammedov
@ 2015-12-21 11:42       ` Michael S. Tsirkin
  0 siblings, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-21 11:42 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Mon, Dec 21, 2015 at 12:02:52PM +0100, Igor Mammedov wrote:
> > > +
> > > +    if_ctx = aml_if(aml_lor(
> > 
> > Don't split lines like this please.
> What style would you prefer?

break after a comma:

    if_ctx = aml_if(aml_lor(aml_equal(a_period, a_zero),


> > 
> > > +                            aml_equal(a_period, a_zero),
> > > +                            aml_lgreater(a_period, aml_int(100000000))));

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

* Re: [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 device from DSDT to SSDT
  2015-12-19 19:44   ` Michael S. Tsirkin
@ 2015-12-21 12:42     ` Igor Mammedov
  2015-12-21 12:54       ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 12:42 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sat, 19 Dec 2015 21:44:55 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:41:44AM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/i386/acpi-build.c      | 38 ++++++++++++++++++++++++++++++++------
> >  hw/i386/acpi-dsdt-isa.dsl | 18 ------------------
> >  2 files changed, 32 insertions(+), 24 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index e5ec6af..2f0f2e1 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -1173,17 +1173,34 @@ static void build_hpet_aml(Aml *table)
> >  
> >  static Aml *
> >  build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
> > -                      bool have_sta)
> > +                      bool have_sta, const char *present_field)
> 
> At this point, the number of arguments is getting ridiculous.
> I think you should give it up, and write a function
> per device type, even if there's a minor code duplication
> as a result.
> 
> As a bonus, we will get reasonably readable function
> names, e.g.  build_floppy_controller()
> 
> >  {
> >      Aml *dev;
> >      Aml *method;
> > -    Aml *a_device_present = aml_int(0x0f);
> >  
> >      dev = aml_device("%s", name);
> >      aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
> >      if (have_sta) {
> > +        Aml *if_ctx;
> > +        Aml *else_ctx;
> > +        Aml *a_zero = aml_int(0);
> > +        Aml *a_is_present = aml_local(0);
> > +        Aml *a_device_present = aml_int(0x0f);
> > +        Aml *a_device_not_present = aml_int(0x00);
> > +
> 
> What does a_ prefix mean here?
it's used to distinguish aml variables.

> 
> >          method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > -        aml_append(method, aml_return(a_device_present));
> > +        if (!present_field) {
> > +            aml_append(method, aml_return(a_device_present));
> > +        } else {
> > +            aml_append(method,
> > +                aml_store(aml_name("%s", present_field), a_is_present));
> > +            if_ctx = aml_if(aml_equal(a_is_present, a_zero));
> > +            aml_append(if_ctx, aml_return(a_device_not_present));
> > +            aml_append(method, if_ctx);
> > +            else_ctx = aml_else();
> > +            aml_append(else_ctx, aml_return(a_device_present));
> > +            aml_append(method, else_ctx);
> > +        }
> >          aml_append(dev, method);
> >      }
> >      aml_append(dev, aml_name_decl("_CRS", crs));
> > @@ -1201,19 +1218,28 @@ static void build_isa_devices_aml(Aml *table)
> >      aml_append(crs, aml_irq_no_flags(8));
> >      aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
> >      aml_append(scope, build_eisa_device_aml(
> > -        "RTC", "PNP0B00", crs, false));
> > +        "RTC", "PNP0B00", crs, false, NULL));
> >  
> >      crs = aml_resource_template();
> >      aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
> >      aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
> >      aml_append(crs, aml_irq_no_flags(1));
> >      aml_append(scope, build_eisa_device_aml(
> > -        "KBD", "PNP0303", crs, true));
> > +        "KBD", "PNP0303", crs, true, NULL));
> >  
> >      crs = aml_resource_template();
> >      aml_append(crs, aml_irq_no_flags(12));
> >      aml_append(scope, build_eisa_device_aml(
> > -        "MOU", "PNP0F13", crs, true));
> > +        "MOU", "PNP0F13", crs, true, NULL));
> > +
> > +    crs = aml_resource_template();
> > +    aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
> > +    aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01));
> > +    aml_append(crs, aml_irq_no_flags(6));
> > +    aml_append(crs,
> > +        aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2));
> > +    aml_append(scope, build_eisa_device_aml(
> > +        "FDC0", "PNP0700", crs, true, "FDEN"));
> >  
> >      aml_append(table, scope);
> >  }
> > diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
> > index 8936271..64dd4ac 100644
> > --- a/hw/i386/acpi-dsdt-isa.dsl
> > +++ b/hw/i386/acpi-dsdt-isa.dsl
> > @@ -16,24 +16,6 @@
> >  /* Common legacy ISA style devices. */
> >  Scope(\_SB.PCI0.ISA) {
> >  
> > -    Device(FDC0) {
> > -        Name(_HID, EisaId("PNP0700"))
> > -        Method(_STA, 0, NotSerialized) {
> > -            Store(FDEN, Local0)
> > -            If (LEqual(Local0, 0)) {
> > -                Return (0x00)
> > -            } Else {
> > -                Return (0x0F)
> > -            }
> > -        }
> 
> All these guys have in common is the _STA method.
> So write a function generating one, and be done with it.
I'll try to do so.

> 
> 
> > -        Name(_CRS, ResourceTemplate() {
> > -            IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
> > -            IO(Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
> > -            IRQNoFlags() { 6 }
> > -            DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
> > -        })
> > -    }
> > -
> >      Device(LPT) {
> >          Name(_HID, EisaId("PNP0400"))
> >          Method(_STA, 0, NotSerialized) {
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-19 20:34   ` Michael S. Tsirkin
@ 2015-12-21 12:45     ` Igor Mammedov
  2015-12-21 15:35     ` Igor Mammedov
  1 sibling, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 12:45 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sat, 19 Dec 2015 22:34:55 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:41:48AM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/i386/acpi-build.c      | 26 +++++++++++++++++++++++++-
> >  hw/i386/acpi-dsdt.dsl     | 40 ----------------------------------------
> >  hw/i386/q35-acpi-dsdt.dsl | 36 ------------------------------------
> >  3 files changed, 25 insertions(+), 77 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index 581ad98..99c0294 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -1400,8 +1400,25 @@ build_ssdt(GArray *table_data, GArray *linker,
> >      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> >                               pm->mem_hp_io_len);
> >  
> > -    scope =  aml_scope("\\_GPE");
> > +    scope =  aml_scope("_GPE");
> >      {
> > +        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
> > +
> > +        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
> > +        aml_append(scope, method);
> > +
> > +        if (misc->is_piix4) {
> > +            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
> > +            aml_append(method,
> > +                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
> > +            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
> > +            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
> > +            aml_append(scope, method);
> > +        } else {
> > +            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
> > +            aml_append(scope, method);
> > +        }
> > +
> >          method = aml_method("_E02", 0, AML_NOTSERIALIZED);
> >          aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
> >          aml_append(scope, method);
> > @@ -1409,6 +1426,13 @@ build_ssdt(GArray *table_data, GArray *linker,
> >          method = aml_method("_E03", 0, AML_NOTSERIALIZED);
> >          aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
> >          aml_append(scope, method);
> > +
> > +        for (i = 4; i <= 0xF; i++) {
> > +            char *name = g_strdup_printf("_L0%X", i);
> > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > +            aml_append(scope, method);
> > +            g_free(name);
> > +        }
> 
> How about we make aml_method accept ... format instead?
ok, I'll do it on respin

> 
> 
> >      }
> >      aml_append(ssdt, scope);
> >  
> > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > index 11e2e61..c9b2725 100644
> > --- a/hw/i386/acpi-dsdt.dsl
> > +++ b/hw/i386/acpi-dsdt.dsl
> > @@ -197,44 +197,4 @@ DefinitionBlock (
> >              Method(_SRS, 1, NotSerialized) { }
> >          }
> >      }
> > -
> > -/****************************************************************
> > - * General purpose events
> > - ****************************************************************/
> > -    Scope(\_GPE) {
> > -        Name(_HID, "ACPI0006")
> > -
> > -        Method(_L00) {
> > -        }
> > -        Method(_E01) {
> > -            // PCI hotplug event
> > -            Acquire(\_SB.PCI0.BLCK, 0xFFFF)
> > -            \_SB.PCI0.PCNT()
> > -            Release(\_SB.PCI0.BLCK)
> > -        }
> > -        Method(_L04) {
> > -        }
> > -        Method(_L05) {
> > -        }
> > -        Method(_L06) {
> > -        }
> > -        Method(_L07) {
> > -        }
> > -        Method(_L08) {
> > -        }
> > -        Method(_L09) {
> > -        }
> > -        Method(_L0A) {
> > -        }
> > -        Method(_L0B) {
> > -        }
> > -        Method(_L0C) {
> > -        }
> > -        Method(_L0D) {
> > -        }
> > -        Method(_L0E) {
> > -        }
> > -        Method(_L0F) {
> > -        }
> > -    }
> >  }
> > diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
> > index 4862ded..e157615 100644
> > --- a/hw/i386/q35-acpi-dsdt.dsl
> > +++ b/hw/i386/q35-acpi-dsdt.dsl
> > @@ -375,40 +375,4 @@ DefinitionBlock (
> >          define_gsi_link(GSIG, 0, 0x16)
> >          define_gsi_link(GSIH, 0, 0x17)
> >      }
> > -
> > -/****************************************************************
> > - * General purpose events
> > - ****************************************************************/
> > -    Scope(\_GPE) {
> > -        Name(_HID, "ACPI0006")
> > -
> > -        Method(_L00) {
> > -        }
> > -        Method(_L01) {
> > -        }
> > -        Method(_L04) {
> > -        }
> > -        Method(_L05) {
> > -        }
> > -        Method(_L06) {
> > -        }
> > -        Method(_L07) {
> > -        }
> > -        Method(_L08) {
> > -        }
> > -        Method(_L09) {
> > -        }
> > -        Method(_L0A) {
> > -        }
> > -        Method(_L0B) {
> > -        }
> > -        Method(_L0C) {
> > -        }
> > -        Method(_L0D) {
> > -        }
> > -        Method(_L0E) {
> > -        }
> > -        Method(_L0F) {
> > -        }
> > -    }
> >  }
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 device from DSDT to SSDT
  2015-12-21 12:42     ` Igor Mammedov
@ 2015-12-21 12:54       ` Michael S. Tsirkin
  0 siblings, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-21 12:54 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Mon, Dec 21, 2015 at 01:42:39PM +0100, Igor Mammedov wrote:
> On Sat, 19 Dec 2015 21:44:55 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Dec 10, 2015 at 12:41:44AM +0100, Igor Mammedov wrote:
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > >  hw/i386/acpi-build.c      | 38 ++++++++++++++++++++++++++++++++------
> > >  hw/i386/acpi-dsdt-isa.dsl | 18 ------------------
> > >  2 files changed, 32 insertions(+), 24 deletions(-)
> > > 
> > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > index e5ec6af..2f0f2e1 100644
> > > --- a/hw/i386/acpi-build.c
> > > +++ b/hw/i386/acpi-build.c
> > > @@ -1173,17 +1173,34 @@ static void build_hpet_aml(Aml *table)
> > >  
> > >  static Aml *
> > >  build_eisa_device_aml(const char *name, const char *hid, Aml *crs,
> > > -                      bool have_sta)
> > > +                      bool have_sta, const char *present_field)
> > 
> > At this point, the number of arguments is getting ridiculous.
> > I think you should give it up, and write a function
> > per device type, even if there's a minor code duplication
> > as a result.
> > 
> > As a bonus, we will get reasonably readable function
> > names, e.g.  build_floppy_controller()
> > 
> > >  {
> > >      Aml *dev;
> > >      Aml *method;
> > > -    Aml *a_device_present = aml_int(0x0f);
> > >  
> > >      dev = aml_device("%s", name);
> > >      aml_append(dev, aml_name_decl("_HID", aml_eisaid(hid)));
> > >      if (have_sta) {
> > > +        Aml *if_ctx;
> > > +        Aml *else_ctx;
> > > +        Aml *a_zero = aml_int(0);
> > > +        Aml *a_is_present = aml_local(0);
> > > +        Aml *a_device_present = aml_int(0x0f);
> > > +        Aml *a_device_not_present = aml_int(0x00);
> > > +
> > 
> > What does a_ prefix mean here?
> it's used to distinguish aml variables.


Ow, hungarian notation. Let's not go there please.

> > 
> > >          method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > > -        aml_append(method, aml_return(a_device_present));
> > > +        if (!present_field) {
> > > +            aml_append(method, aml_return(a_device_present));
> > > +        } else {
> > > +            aml_append(method,
> > > +                aml_store(aml_name("%s", present_field), a_is_present));
> > > +            if_ctx = aml_if(aml_equal(a_is_present, a_zero));
> > > +            aml_append(if_ctx, aml_return(a_device_not_present));
> > > +            aml_append(method, if_ctx);
> > > +            else_ctx = aml_else();
> > > +            aml_append(else_ctx, aml_return(a_device_present));
> > > +            aml_append(method, else_ctx);
> > > +        }
> > >          aml_append(dev, method);
> > >      }
> > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > > @@ -1201,19 +1218,28 @@ static void build_isa_devices_aml(Aml *table)
> > >      aml_append(crs, aml_irq_no_flags(8));
> > >      aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06));
> > >      aml_append(scope, build_eisa_device_aml(
> > > -        "RTC", "PNP0B00", crs, false));
> > > +        "RTC", "PNP0B00", crs, false, NULL));
> > >  
> > >      crs = aml_resource_template();
> > >      aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
> > >      aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
> > >      aml_append(crs, aml_irq_no_flags(1));
> > >      aml_append(scope, build_eisa_device_aml(
> > > -        "KBD", "PNP0303", crs, true));
> > > +        "KBD", "PNP0303", crs, true, NULL));
> > >  
> > >      crs = aml_resource_template();
> > >      aml_append(crs, aml_irq_no_flags(12));
> > >      aml_append(scope, build_eisa_device_aml(
> > > -        "MOU", "PNP0F13", crs, true));
> > > +        "MOU", "PNP0F13", crs, true, NULL));
> > > +
> > > +    crs = aml_resource_template();
> > > +    aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04));
> > > +    aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01));
> > > +    aml_append(crs, aml_irq_no_flags(6));
> > > +    aml_append(crs,
> > > +        aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2));
> > > +    aml_append(scope, build_eisa_device_aml(
> > > +        "FDC0", "PNP0700", crs, true, "FDEN"));
> > >  
> > >      aml_append(table, scope);
> > >  }
> > > diff --git a/hw/i386/acpi-dsdt-isa.dsl b/hw/i386/acpi-dsdt-isa.dsl
> > > index 8936271..64dd4ac 100644
> > > --- a/hw/i386/acpi-dsdt-isa.dsl
> > > +++ b/hw/i386/acpi-dsdt-isa.dsl
> > > @@ -16,24 +16,6 @@
> > >  /* Common legacy ISA style devices. */
> > >  Scope(\_SB.PCI0.ISA) {
> > >  
> > > -    Device(FDC0) {
> > > -        Name(_HID, EisaId("PNP0700"))
> > > -        Method(_STA, 0, NotSerialized) {
> > > -            Store(FDEN, Local0)
> > > -            If (LEqual(Local0, 0)) {
> > > -                Return (0x00)
> > > -            } Else {
> > > -                Return (0x0F)
> > > -            }
> > > -        }
> > 
> > All these guys have in common is the _STA method.
> > So write a function generating one, and be done with it.
> I'll try to do so.
> 
> > 
> > 
> > > -        Name(_CRS, ResourceTemplate() {
> > > -            IO(Decode16, 0x03F2, 0x03F2, 0x00, 0x04)
> > > -            IO(Decode16, 0x03F7, 0x03F7, 0x00, 0x01)
> > > -            IRQNoFlags() { 6 }
> > > -            DMA(Compatibility, NotBusMaster, Transfer8) { 2 }
> > > -        })
> > > -    }
> > > -
> > >      Device(LPT) {
> > >          Name(_HID, EisaId("PNP0400"))
> > >          Method(_STA, 0, NotSerialized) {
> > > -- 
> > > 1.8.3.1
> > > 

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-19 19:23       ` Michael S. Tsirkin
@ 2015-12-21 12:55         ` Igor Mammedov
  2015-12-22  9:34           ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 12:55 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, marcel.apfelbaum

On Sat, 19 Dec 2015 21:23:22 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 05:17:07PM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > v2:
> >  - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
> >    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > 
> > pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
> >  hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
> >  2 files changed, 32 insertions(+), 69 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index cf98037..1b065df 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> >      qobject_decref(bsel);
> >  }
> >  
> > +static Aml *build_prt_entry(const char *link_name)
> > +{
> > +    Aml *a_zero = aml_int(0);
> > +    Aml *pkg = aml_package(4);
> > +    aml_append(pkg, a_zero);
> > +    aml_append(pkg, a_zero);
> > +    aml_append(pkg, aml_name("%s", link_name));
> > +    aml_append(pkg, a_zero);
> > +    return pkg;
> > +}
> > +
> >  /*
> >   * initialize_route - Initialize the interrupt routing rule
> >   * through a specific LINK:
> > @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> >                               Aml *lnk_idx, int idx)
> >  {
> >      Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> > -    Aml *pkg = aml_package(4);
> > +    Aml *pkg = build_prt_entry(link_name);
> >  
> > -    aml_append(pkg, aml_int(0));
> > -    aml_append(pkg, aml_int(0));
> > -    aml_append(pkg, aml_name("%s", link_name));
> > -    aml_append(pkg, aml_int(0));
> >      aml_append(if_ctx, aml_store(pkg, route));
> >  
> >      return if_ctx;
> > @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> >   * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
> >   *
> >   */
> > -static Aml *build_prt(void)
> > +static Aml *build_prt(bool is_pci0_prt)
> >  {
> > -    Aml *method, *while_ctx, *pin, *res;
> > +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;
> 
> Move if_ctx2/if_ctx/else_ctx2 where they are used?
> Also, can't we come up with better name than if_ctx2?
> How about if_lnk_1 and if_pin_4?
sure

> 
> >  
> >      method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> >      res = aml_local(0);
> > @@ -678,7 +685,19 @@ static Aml *build_prt(void)
> >  
> >          /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
> >          aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> > -        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > +        if (is_pci0_prt) {
> > +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> > +            /* device 1 is the power-management device, needs SCI */
> 
> Doesn't this context belong above the previous line?
that how it was in ASL, but yep it belongs to a whole if block
so I'll move it up

> 
> > +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> > +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
> > +            aml_append(if_ctx, if_ctx2);
> > +            else_ctx2 = aml_else();
> > +            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
> > +            aml_append(if_ctx, else_ctx2);
> 
> This looks weird. Why isn't else_ctx2 added to if_ctx2?
it should be if_ctx2, I'll fix it.

> 
> > +            aml_append(while_ctx, if_ctx);
> > +        } else {
> > +            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > +        }
> >          aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
> >          aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
> >  
> > @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
> >      Aml *method;
> >      uint32_t irqs;
> >      Aml *sb_scope = aml_scope("_SB");
> > +    Aml *pci0_scope = aml_scope("PCI0");
> > +
> > +    aml_append(pci0_scope, build_prt(true));
> > +    aml_append(sb_scope, pci0_scope);
> >  
> >      field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
> >      aml_append(field, aml_named_field("PRQ0", 8));
> > @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
> >                  aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
> >              }
> >  
> > -            aml_append(dev, build_prt());
> > +            aml_append(dev, build_prt(false));
> >              crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
> >                              io_ranges, mem_ranges);
> >              aml_append(dev, aml_name_decl("_CRS", crs));
> > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > index bc6bd45..5d741dd 100644
> > --- a/hw/i386/acpi-dsdt.dsl
> > +++ b/hw/i386/acpi-dsdt.dsl
> > @@ -78,64 +78,4 @@ DefinitionBlock (
> >          /* Hotplug notification method supplied by SSDT */
> >          External(\_SB.PCI0.PCNT, MethodObj)
> >      }
> > -
> > -
> > -/****************************************************************
> > - * PCI IRQs
> > - ****************************************************************/
> > -
> > -    Scope(\_SB) {
> > -        Scope(PCI0) {
> > -            Method (_PRT, 0) {
> > -                Store(Package(128) {}, Local0)
> > -                Store(Zero, Local1)
> > -                While(LLess(Local1, 128)) {
> > -                    // slot = pin >> 2
> > -                    Store(ShiftRight(Local1, 2), Local2)
> > -
> > -                    // lnk = (slot + pin) & 3
> > -                    Store(And(Add(Local1, Local2), 3), Local3)
> > -                    If (LEqual(Local3, 0)) {
> > -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> > -                    }
> > -                    If (LEqual(Local3, 1)) {
> > -                        // device 1 is the power-management device, needs SCI
> > -                        If (LEqual(Local1, 4)) {
> > -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> > -                        } Else {
> > -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> > -                        }
> > -                    }
> > -                    If (LEqual(Local3, 2)) {
> > -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> > -                    }
> > -                    If (LEqual(Local3, 3)) {
> > -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> > -                    }
> > -
> > -                    // Complete the interrupt routing entry:
> > -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> > -
> > -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> > -                    Store(And(Local1, 3),                    Index(Local4, 1))
> > -                    Store(Local4,                            Index(Local0, Local1))
> > -
> > -                    Increment(Local1)
> > -                }
> > -
> > -                Return(Local0)
> 
> Interesting. And where's this code? Probably in previous or follow-up patches ...
it was and still is in original build_prt(),
I'm just modifying it to generate missing parts of DSDT AML
equivalent which it's replacing.

> 
> > -            }
> > -        }
> > -
> > -
> > -        External(PRQ0, FieldUnitObj)
> > -        External(PRQ1, FieldUnitObj)
> > -        External(PRQ2, FieldUnitObj)
> > -        External(PRQ3, FieldUnitObj)
> > -        External(LNKA, DeviceObj)
> > -        External(LNKB, DeviceObj)
> > -        External(LNKC, DeviceObj)
> > -        External(LNKD, DeviceObj)
> > -        External(LNKS, DeviceObj)
> > -    }
> >  }
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-19 20:38 ` Michael S. Tsirkin
@ 2015-12-21 13:00   ` Igor Mammedov
  2015-12-21 13:12     ` Shannon Zhao
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 13:00 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Peter Maydell, Eduardo Habkost, qemu-devel,
	open list:ARM ACPI Subsystem, Shannon Zhao, Paolo Bonzini,
	Richard Henderson

On Sat, 19 Dec 2015 22:38:41 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:40:54AM +0100, Igor Mammedov wrote:
> > Due to huge size, CCing only cover letter instead of individual patches.
> > 
> > Series consist of 2 parts the 1st part prefixed 'acpi:' adds necessary
> > AML API functions and the second part converts DSDT using existing and
> > new AML API.
> > 
> > Series does exact byte by byte conversion and passes ACPI tables
> > 'make check' tests.
> > The conversion first moves common for PIIX4/Q35 parts, getting rid of *.dsl
> > includes and then converts PIIX4 and Q35 parts of DSDT.
> > 
> > Diff-stat looks nice but actual code base is reduced by ~2000LOC
> > while the rest of 10000 removals is dropping precompiled AML
> > templates from tree.
> > 
> > There are some AML parts that could be optimized/simplified and shared
> > between PIIX4/Q35/ARM but doing it will break exact match with original
> > tests, hence it's left out of the scope of this series.
> > 
> > CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
> > CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
> > CC: Peter Maydell <peter.maydell@linaro.org> (maintainer:ARM)
> > CC: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
> > CC: Richard Henderson <rth@twiddle.net> (maintainer:X86)
> > CC: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
> > CC: qemu-arm@nongnu.org (open list:ARM ACPI Subsystem)
> 
> I think this is a nice series, and I think we can live with the fact
> make check warns in the middle.
> 
> I sent some comments I'd like to see addressed.
> 
> Main points
> 	- one v2 patch seems garbled
> 	- please don't create functions with tons of parameters
> 	  which just do if (a) on each of these internally.
> 	  instead, move common code into a small function that
> 	  can be reused without so many conditionals.
> 	- I really dislike local variables starting with a_ for
> 	  no good reason.
Michael,

Could you apply already reviewed AML API patches 1-24
and push it to master early, pls?

That will help to reduce collisions with other AML
patches on list and provide more complete API for others to use.

> 
> Thanks!
> 
> > Igor Mammedov (70):
> >   tests: acpi: print ASL diff in verbose mode
> >   acpi: add aml_lgreater_equal()
> >   acpi: add aml_create_qword_field()
> >   acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern
> >   acpi: extend aml_add() to accept target argument
> >   acpi: add aml_decrement() and aml_subtract()
> >   acpi: add aml_call0() helper
> >   acpi: add aml_to_integer()
> >   acpi: extend aml_shiftright() to accept target argument
> >   acpi: add aml_alias()
> >   acpi: add aml_sleep()
> >   acpi: add aml_lor()
> >   acpi: add aml_lgreater()
> >   acpi: extend aml_field() to support LockRule
> >   acpi: add aml_to_hexstring()
> >   acpi: add aml_to_buffer()
> >   acpi add aml_dma()
> >   acpi: extend aml_or() to accept target argument
> >   acpi: extend aml_and() to accept target argument
> >   acpi: extend aml_interrupt() to support multiple irqs
> >   pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code
> >   pc: acpi: memhp: move MHPD._STA method into SSDT
> >   pc: acpi: memhp: move MHPD.MLCK mutex into SSDT
> >   pc: acpi: memhp: move MHPD.MSCN method into SSDT
> >   pc: acpi: memhp: move MHPD.MRST method into SSDT
> >   pc: acpi: memhp: move MHPD.MPXM method into SSDT
> >   pc: acpi: memhp: move MHPD.MOST method into SSDT
> >   pc: acpi: memhp: move MHPD.MEJ0 method into SSDT
> >   pc: acpi: memhp: move MHPD.MCRS method into SSDT
> >   pc: acpi: memhp: move MHPD Device into SSDT
> >   pc: acpi: factor out memhp code from build_ssdt() into separate
> >     function
> >   pc: acpi: memhp: move \_GPE._E03 into SSDT
> >   pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage
> >   pc: acpi: drop unused CPU_STATUS_LEN from DSDT
> >   pc: acpi: cpuhp: move CPEJ() method to SSDT
> >   pc: acpi: cpuhp: move CPMA() method into SSDT
> >   pc: acpi: cpuhp: move CPST() method into SSDT
> >   pc: acpi: cpuhp: move PRSC() method into SSDT
> >   pc: acpi: cpuhp: move \_GPE._E02() into SSDT
> >   pc: acpi: factor out cpu hotplug code from build_ssdt() into separate
> >     function
> >   pc: acpi: move HPET from DSDT to SSDT
> >   pc: acpi: move DBUG() from DSDT to SSDT
> >   pc: acpi: move RTC device from DSDT to SSDT
> >   pc: acpi: move KBD device from DSDT to SSDT
> >   pc: acpi: move MOU device from DSDT to SSDT
> >   pc: acpi: move FDC0 device from DSDT to SSDT
> >   pc: acpi: move LPT device from DSDT to SSDT
> >   pc: acpi: move COM devices from DSDT to SSDT
> >   pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
> >   pc: acpi: move remaining GPE handlers into SSDT
> >   pc: acpi: pci: move link devices into SSDT
> >   pc: acpi: piix4: move IQCR() into SSDT
> >   pc: acpi: piix4: move IQST() into SSDT
> >   pc: acpi: piix4: move PCI0._PRT() into SSDT
> >   pc: acpi: piix4: move remaining PCI hotplug bits into SSDT
> >   pc: acpi: piix4: acpi move PCI0 device to SSDT
> >   pc: acpi: q35: move GSI links to SSDT
> >   pc: acpi: q35: move link devices to SSDT
> >   pc: acpi: q35: move IQCR() into SSDT
> >   pc: acpi: q35: move IQST() into SSDT
> >   pc: acpi: q35: move ISA bridge into SSDT
> >   pc: acpi: q35: move _PRT() into SSDT
> >   pc: acpi: q35: move PRTA routing table into SSDT
> >   pc: acpi: q35: move PRTP routing table into SSDT
> >   pc: acpi: q35: move _PIC() method into SSDT
> >   pc: acpi: q35: move PCI0._OSC() method into SSDT
> >   pc: acpi: q35: move PCI0 device definition into SSDT
> >   pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT
> >   pc: acpi: switch to AML API composed DSDT
> >   pc: acpi: remove unused ASL templates and related blobs/utils
> > 
> > Xiao Guangrong (4):
> >   acpi: add aml_derefof
> >   acpi: add aml_sizeof
> >   acpi: add aml_mutex(), aml_acquire(), aml_release()
> >   acpi: support serialized method
> > 
> >  hw/acpi/Makefile.objs               |    4 +-
> >  hw/acpi/aml-build.c                 |  294 +-
> >  hw/acpi/cpu_hotplug_acpi_table.c    |  124 +
> >  hw/acpi/memory_hotplug_acpi_table.c |  249 ++
> >  hw/arm/virt-acpi-build.c            |   41 +-
> >  hw/i386/Makefile.objs               |   31 +-
> >  hw/i386/acpi-build.c                | 1329 ++++--
> >  hw/i386/acpi-dsdt-cpu-hotplug.dsl   |   90 -
> >  hw/i386/acpi-dsdt-dbug.dsl          |   41 -
> >  hw/i386/acpi-dsdt-hpet.dsl          |   48 -
> >  hw/i386/acpi-dsdt-isa.dsl           |  117 -
> >  hw/i386/acpi-dsdt-mem-hotplug.dsl   |  171 -
> >  hw/i386/acpi-dsdt.dsl               |  303 --
> >  hw/i386/acpi-dsdt.hex.generated     | 2972 --------------
> >  hw/i386/q35-acpi-dsdt.dsl           |  436 --
> >  hw/i386/q35-acpi-dsdt.hex.generated | 7610 -----------------------------------
> >  hw/timer/hpet.c                     |    2 +-
> >  include/hw/acpi/aml-build.h         |   66 +-
> >  include/hw/acpi/cpu_hotplug.h       |   10 +
> >  include/hw/acpi/memory_hotplug.h    |    9 +
> >  include/hw/acpi/pc-hotplug.h        |   44 +-
> >  include/hw/timer/hpet.h             |    1 +
> >  scripts/acpi_extract.py             |  367 --
> >  scripts/acpi_extract_preprocess.py  |   51 -
> >  scripts/update-acpi.sh              |    4 -
> >  tests/bios-tables-test.c            |    7 +
> >  26 files changed, 1848 insertions(+), 12573 deletions(-)
> >  create mode 100644 hw/acpi/cpu_hotplug_acpi_table.c
> >  create mode 100644 hw/acpi/memory_hotplug_acpi_table.c
> >  delete mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl
> >  delete mode 100644 hw/i386/acpi-dsdt-dbug.dsl
> >  delete mode 100644 hw/i386/acpi-dsdt-hpet.dsl
> >  delete mode 100644 hw/i386/acpi-dsdt-isa.dsl
> >  delete mode 100644 hw/i386/acpi-dsdt-mem-hotplug.dsl
> >  delete mode 100644 hw/i386/acpi-dsdt.dsl
> >  delete mode 100644 hw/i386/acpi-dsdt.hex.generated
> >  delete mode 100644 hw/i386/q35-acpi-dsdt.dsl
> >  delete mode 100644 hw/i386/q35-acpi-dsdt.hex.generated
> >  delete mode 100755 scripts/acpi_extract.py
> >  delete mode 100755 scripts/acpi_extract_preprocess.py
> >  delete mode 100644 scripts/update-acpi.sh
> > 
> > -- 
> > 1.8.3.1
> > 
> 

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

* Re: [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support
  2015-12-21 13:00   ` Igor Mammedov
@ 2015-12-21 13:12     ` Shannon Zhao
  0 siblings, 0 replies; 165+ messages in thread
From: Shannon Zhao @ 2015-12-21 13:12 UTC (permalink / raw)
  To: Igor Mammedov, Michael S. Tsirkin
  Cc: Peter Maydell, Eduardo Habkost, qemu-devel, ARM ACPI Subsystem,
	Paolo Bonzini, Richard Henderson



On 2015/12/21 21:00, Igor Mammedov wrote:
> On Sat, 19 Dec 2015 22:38:41 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
>> > On Thu, Dec 10, 2015 at 12:40:54AM +0100, Igor Mammedov wrote:
>>> > > Due to huge size, CCing only cover letter instead of individual patches.
>>> > > 
>>> > > Series consist of 2 parts the 1st part prefixed 'acpi:' adds necessary
>>> > > AML API functions and the second part converts DSDT using existing and
>>> > > new AML API.
>>> > > 
>>> > > Series does exact byte by byte conversion and passes ACPI tables
>>> > > 'make check' tests.
>>> > > The conversion first moves common for PIIX4/Q35 parts, getting rid of *.dsl
>>> > > includes and then converts PIIX4 and Q35 parts of DSDT.
>>> > > 
>>> > > Diff-stat looks nice but actual code base is reduced by ~2000LOC
>>> > > while the rest of 10000 removals is dropping precompiled AML
>>> > > templates from tree.
>>> > > 
>>> > > There are some AML parts that could be optimized/simplified and shared
>>> > > between PIIX4/Q35/ARM but doing it will break exact match with original
>>> > > tests, hence it's left out of the scope of this series.
>>> > > 
>>> > > CC: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
>>> > > CC: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
>>> > > CC: Peter Maydell <peter.maydell@linaro.org> (maintainer:ARM)
>>> > > CC: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
>>> > > CC: Richard Henderson <rth@twiddle.net> (maintainer:X86)
>>> > > CC: Eduardo Habkost <ehabkost@redhat.com> (maintainer:X86)
>>> > > CC: qemu-arm@nongnu.org (open list:ARM ACPI Subsystem)
>> > 
>> > I think this is a nice series, and I think we can live with the fact
>> > make check warns in the middle.
>> > 
>> > I sent some comments I'd like to see addressed.
>> > 
>> > Main points
>> > 	- one v2 patch seems garbled
>> > 	- please don't create functions with tons of parameters
>> > 	  which just do if (a) on each of these internally.
>> > 	  instead, move common code into a small function that
>> > 	  can be reused without so many conditionals.
>> > 	- I really dislike local variables starting with a_ for
>> > 	  no good reason.
> Michael,
> 
> Could you apply already reviewed AML API patches 1-24
> and push it to master early, pls?
> 
+1

BTW, Below patches are already in master.

[PATCH 15/74] acpi: support serialized method
[PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs

> That will help to reduce collisions with other AML
> patches on list and provide more complete API for others to use.
> 

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-19 20:34   ` Michael S. Tsirkin
  2015-12-21 12:45     ` Igor Mammedov
@ 2015-12-21 15:35     ` Igor Mammedov
  2015-12-22  9:37       ` Michael S. Tsirkin
  1 sibling, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 15:35 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sat, 19 Dec 2015 22:34:55 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:41:48AM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  hw/i386/acpi-build.c      | 26 +++++++++++++++++++++++++-
> >  hw/i386/acpi-dsdt.dsl     | 40 ----------------------------------------
> >  hw/i386/q35-acpi-dsdt.dsl | 36 ------------------------------------
> >  3 files changed, 25 insertions(+), 77 deletions(-)
> > 
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index 581ad98..99c0294 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -1400,8 +1400,25 @@ build_ssdt(GArray *table_data, GArray *linker,
> >      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> >                               pm->mem_hp_io_len);
> >  
> > -    scope =  aml_scope("\\_GPE");
> > +    scope =  aml_scope("_GPE");
> >      {
> > +        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
> > +
> > +        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
> > +        aml_append(scope, method);
> > +
> > +        if (misc->is_piix4) {
> > +            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
> > +            aml_append(method,
> > +                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
> > +            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
> > +            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
> > +            aml_append(scope, method);
> > +        } else {
> > +            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
> > +            aml_append(scope, method);
> > +        }
> > +
> >          method = aml_method("_E02", 0, AML_NOTSERIALIZED);
> >          aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
> >          aml_append(scope, method);
> > @@ -1409,6 +1426,13 @@ build_ssdt(GArray *table_data, GArray *linker,
> >          method = aml_method("_E03", 0, AML_NOTSERIALIZED);
> >          aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
> >          aml_append(scope, method);
> > +
> > +        for (i = 4; i <= 0xF; i++) {
> > +            char *name = g_strdup_printf("_L0%X", i);
> > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > +            aml_append(scope, method);
> > +            g_free(name);
> > +        }
> 
> How about we make aml_method accept ... format instead?
actually instead of making aml_method(format,...) it would be
easier to make it accept Aml* so we could reuse aml_name(format,...)
in the end it would look like:

 Aml gpe_name = aml_name("_L0%X", i);
 aml_method(gpe_name, AML_NOTSERIALIZED);

in addition name object could be reused in other places
that reference that method.

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

* Re: [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-20 13:41     ` Michael S. Tsirkin
  2015-12-21 10:52       ` Igor Mammedov
@ 2015-12-21 17:31       ` Igor Mammedov
  2015-12-22 15:11         ` Michael S. Tsirkin
  1 sibling, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-21 17:31 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, marcel.apfelbaum

On Sun, 20 Dec 2015 15:41:22 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Dec 16, 2015 at 03:47:35PM +0100, Igor Mammedov wrote:
[...]
> > +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> > +        {
> > +             aml_append(ifctx, aml_return(a_zero));
> > +        }
> > +        aml_append(method, ifctx);
> > +        /* present, functioning, decoding, not shown in UI */
> > +        aml_append(method, aml_return(aml_int(0xB)));
> > +        aml_append(ctrl_dev, method);
> 
> 
> Simple unserialized methods that return value depending on input
> being zero seem very common.  How about a helper for this case?
> 
> E.g.
> 
> aml_method_if_then_else(slots_nr, aml_int(0xB), aml_int(0));
I've looked through all _STA methods that exist in DSDT
and though this method for mem hotplug doesn't belong to common pattern,
I could use you suggestion for 4 ISA devices.

Or perhaps I can save 2-3 LOC by making common
  build_if_else(cond, truectx, false_ctx);
I'll try both but it looks like build_if_else() will be more useful.

And after this series is applied there is a plenty to optimize,
for example most of these _STA methods will be gone or replaced
by simple _STA = FOO expression.


> 
> >      }
> >      aml_append(pci_scope, ctrl_dev);
> >      aml_append(ctx, pci_scope);
> > diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > index c2bb6a1..b4eacc9 100644
> > --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > @@ -35,14 +35,6 @@
> >              External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
> >              External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
> >  
> > -            Method(_STA, 0) {
> > -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> > -                    Return(0x0)
> > -                }
> > -                /* present, functioning, decoding, not shown in UI */
> > -                Return(0xB)
> > -            }
> > -
> >              Mutex (MEMORY_SLOT_LOCK, 0)
> >  
> >              Method(MEMORY_SLOT_SCAN_METHOD, 0) {
> > -- 
> > 1.8.3.1

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-21 12:55         ` Igor Mammedov
@ 2015-12-22  9:34           ` Michael S. Tsirkin
  2015-12-22 14:12             ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22  9:34 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, marcel.apfelbaum

On Mon, Dec 21, 2015 at 01:55:16PM +0100, Igor Mammedov wrote:
> On Sat, 19 Dec 2015 21:23:22 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Dec 10, 2015 at 05:17:07PM +0100, Igor Mammedov wrote:
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > > v2:
> > >  - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
> > >    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > > 
> > > pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > >  hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
> > >  hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
> > >  2 files changed, 32 insertions(+), 69 deletions(-)
> > > 
> > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > index cf98037..1b065df 100644
> > > --- a/hw/i386/acpi-build.c
> > > +++ b/hw/i386/acpi-build.c
> > > @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> > >      qobject_decref(bsel);
> > >  }
> > >  
> > > +static Aml *build_prt_entry(const char *link_name)

Pls document what this does.

> > > +{
> > > +    Aml *a_zero = aml_int(0);
> > > +    Aml *pkg = aml_package(4);
> > > +    aml_append(pkg, a_zero);
> > > +    aml_append(pkg, a_zero);
> > > +    aml_append(pkg, aml_name("%s", link_name));
> > > +    aml_append(pkg, a_zero);
> > > +    return pkg;
> > > +}
> > > +
> > >  /*
> > >   * initialize_route - Initialize the interrupt routing rule
> > >   * through a specific LINK:
> > > @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> > >                               Aml *lnk_idx, int idx)
> > >  {
> > >      Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> > > -    Aml *pkg = aml_package(4);
> > > +    Aml *pkg = build_prt_entry(link_name);
> > >  
> > > -    aml_append(pkg, aml_int(0));
> > > -    aml_append(pkg, aml_int(0));
> > > -    aml_append(pkg, aml_name("%s", link_name));
> > > -    aml_append(pkg, aml_int(0));
> > >      aml_append(if_ctx, aml_store(pkg, route));
> > >  
> > >      return if_ctx;
> > > @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> > >   * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
> > >   *
> > >   */
> > > -static Aml *build_prt(void)
> > > +static Aml *build_prt(bool is_pci0_prt)
> > >  {
> > > -    Aml *method, *while_ctx, *pin, *res;
> > > +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;
> > 
> > Move if_ctx2/if_ctx/else_ctx2 where they are used?
> > Also, can't we come up with better name than if_ctx2?
> > How about if_lnk_1 and if_pin_4?
> sure
> 
> > 
> > >  
> > >      method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> > >      res = aml_local(0);
> > > @@ -678,7 +685,19 @@ static Aml *build_prt(void)
> > >  
> > >          /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
> > >          aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> > > -        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > > +        if (is_pci0_prt) {
> > > +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> > > +            /* device 1 is the power-management device, needs SCI */
> > 
> > Doesn't this context belong above the previous line?
> that how it was in ASL, but yep it belongs to a whole if block
> so I'll move it up
> 
> > 
> > > +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> > > +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
> > > +            aml_append(if_ctx, if_ctx2);
> > > +            else_ctx2 = aml_else();
> > > +            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
> > > +            aml_append(if_ctx, else_ctx2);
> > 
> > This looks weird. Why isn't else_ctx2 added to if_ctx2?
> it should be if_ctx2, I'll fix it.

Hmm I'm not sure actually.
The API for if/else is confusing, but I'm not sure what's
a better one.

> > 
> > > +            aml_append(while_ctx, if_ctx);
> > > +        } else {
> > > +            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > > +        }
> > >          aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
> > >          aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
> > >  
> > > @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
> > >      Aml *method;
> > >      uint32_t irqs;
> > >      Aml *sb_scope = aml_scope("_SB");
> > > +    Aml *pci0_scope = aml_scope("PCI0");
> > > +
> > > +    aml_append(pci0_scope, build_prt(true));
> > > +    aml_append(sb_scope, pci0_scope);
> > >  
> > >      field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
> > >      aml_append(field, aml_named_field("PRQ0", 8));
> > > @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
> > >                  aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
> > >              }
> > >  
> > > -            aml_append(dev, build_prt());
> > > +            aml_append(dev, build_prt(false));
> > >              crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
> > >                              io_ranges, mem_ranges);
> > >              aml_append(dev, aml_name_decl("_CRS", crs));
> > > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > > index bc6bd45..5d741dd 100644
> > > --- a/hw/i386/acpi-dsdt.dsl
> > > +++ b/hw/i386/acpi-dsdt.dsl
> > > @@ -78,64 +78,4 @@ DefinitionBlock (
> > >          /* Hotplug notification method supplied by SSDT */
> > >          External(\_SB.PCI0.PCNT, MethodObj)
> > >      }
> > > -
> > > -
> > > -/****************************************************************
> > > - * PCI IRQs
> > > - ****************************************************************/
> > > -
> > > -    Scope(\_SB) {
> > > -        Scope(PCI0) {
> > > -            Method (_PRT, 0) {
> > > -                Store(Package(128) {}, Local0)
> > > -                Store(Zero, Local1)
> > > -                While(LLess(Local1, 128)) {
> > > -                    // slot = pin >> 2
> > > -                    Store(ShiftRight(Local1, 2), Local2)
> > > -
> > > -                    // lnk = (slot + pin) & 3
> > > -                    Store(And(Add(Local1, Local2), 3), Local3)
> > > -                    If (LEqual(Local3, 0)) {
> > > -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> > > -                    }
> > > -                    If (LEqual(Local3, 1)) {
> > > -                        // device 1 is the power-management device, needs SCI
> > > -                        If (LEqual(Local1, 4)) {
> > > -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> > > -                        } Else {
> > > -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> > > -                        }
> > > -                    }
> > > -                    If (LEqual(Local3, 2)) {
> > > -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> > > -                    }
> > > -                    If (LEqual(Local3, 3)) {
> > > -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> > > -                    }
> > > -
> > > -                    // Complete the interrupt routing entry:
> > > -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> > > -
> > > -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> > > -                    Store(And(Local1, 3),                    Index(Local4, 1))
> > > -                    Store(Local4,                            Index(Local0, Local1))
> > > -
> > > -                    Increment(Local1)
> > > -                }
> > > -
> > > -                Return(Local0)
> > 
> > Interesting. And where's this code? Probably in previous or follow-up patches ...
> it was and still is in original build_prt(),
> I'm just modifying it to generate missing parts of DSDT AML
> equivalent which it's replacing.

OK so commit log should explain that PRT for expander
buses was already generated in C, the only difference for
root bus is LINKA.

And add comment explaining that for pci0,
device 1 is connected to SCI (LNKS)
(maybe rename flag to device_1_is_pm?).


> > 
> > > -            }
> > > -        }
> > > -
> > > -
> > > -        External(PRQ0, FieldUnitObj)
> > > -        External(PRQ1, FieldUnitObj)
> > > -        External(PRQ2, FieldUnitObj)
> > > -        External(PRQ3, FieldUnitObj)
> > > -        External(LNKA, DeviceObj)
> > > -        External(LNKB, DeviceObj)
> > > -        External(LNKC, DeviceObj)
> > > -        External(LNKD, DeviceObj)
> > > -        External(LNKS, DeviceObj)
> > > -    }
> > >  }
> > > -- 
> > > 1.8.3.1
> > > 

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-21 15:35     ` Igor Mammedov
@ 2015-12-22  9:37       ` Michael S. Tsirkin
  2015-12-22 14:38         ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22  9:37 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Mon, Dec 21, 2015 at 04:35:23PM +0100, Igor Mammedov wrote:
> On Sat, 19 Dec 2015 22:34:55 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Dec 10, 2015 at 12:41:48AM +0100, Igor Mammedov wrote:
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > >  hw/i386/acpi-build.c      | 26 +++++++++++++++++++++++++-
> > >  hw/i386/acpi-dsdt.dsl     | 40 ----------------------------------------
> > >  hw/i386/q35-acpi-dsdt.dsl | 36 ------------------------------------
> > >  3 files changed, 25 insertions(+), 77 deletions(-)
> > > 
> > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > index 581ad98..99c0294 100644
> > > --- a/hw/i386/acpi-build.c
> > > +++ b/hw/i386/acpi-build.c
> > > @@ -1400,8 +1400,25 @@ build_ssdt(GArray *table_data, GArray *linker,
> > >      build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
> > >                               pm->mem_hp_io_len);
> > >  
> > > -    scope =  aml_scope("\\_GPE");
> > > +    scope =  aml_scope("_GPE");
> > >      {
> > > +        aml_append(scope, aml_name_decl("_HID", aml_string("ACPI0006")));
> > > +
> > > +        method = aml_method("_L00", 0, AML_NOTSERIALIZED);
> > > +        aml_append(scope, method);
> > > +
> > > +        if (misc->is_piix4) {
> > > +            method = aml_method("_E01", 0, AML_NOTSERIALIZED);
> > > +            aml_append(method,
> > > +                aml_acquire(aml_name("\\_SB.PCI0.BLCK"), 0xFFFF));
> > > +            aml_append(method, aml_call0("\\_SB.PCI0.PCNT"));
> > > +            aml_append(method, aml_release(aml_name("\\_SB.PCI0.BLCK")));
> > > +            aml_append(scope, method);
> > > +        } else {
> > > +            method = aml_method("_L01", 0, AML_NOTSERIALIZED);
> > > +            aml_append(scope, method);
> > > +        }
> > > +
> > >          method = aml_method("_E02", 0, AML_NOTSERIALIZED);
> > >          aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
> > >          aml_append(scope, method);
> > > @@ -1409,6 +1426,13 @@ build_ssdt(GArray *table_data, GArray *linker,
> > >          method = aml_method("_E03", 0, AML_NOTSERIALIZED);
> > >          aml_append(method, aml_call0(MEMORY_HOTPLUG_HANDLER_PATH));
> > >          aml_append(scope, method);
> > > +
> > > +        for (i = 4; i <= 0xF; i++) {
> > > +            char *name = g_strdup_printf("_L0%X", i);
> > > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > > +            aml_append(scope, method);
> > > +            g_free(name);
> > > +        }
> > 
> > How about we make aml_method accept ... format instead?
> actually instead of making aml_method(format,...) it would be
> easier to make it accept Aml* so we could reuse aml_name(format,...)
> in the end it would look like:
> 
>  Aml gpe_name = aml_name("_L0%X", i);
>  aml_method(gpe_name, AML_NOTSERIALIZED);
> 
> in addition name object could be reused in other places
> that reference that method.

Except most methods are simple, so maybe do both APIs.
Avoiding string duplication is a good idea,
but using string constants works just as well.

-- 
MST

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-22  9:34           ` Michael S. Tsirkin
@ 2015-12-22 14:12             ` Igor Mammedov
  2015-12-22 14:52               ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 14:12 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, marcel.apfelbaum

On Tue, 22 Dec 2015 11:34:46 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Mon, Dec 21, 2015 at 01:55:16PM +0100, Igor Mammedov wrote:
> > On Sat, 19 Dec 2015 21:23:22 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > > On Thu, Dec 10, 2015 at 05:17:07PM +0100, Igor Mammedov wrote:
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > ---
> > > > v2:
> > > >  - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
> > > >    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > > > 
> > > > pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
> > > > 
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > ---
> > > >  hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
> > > >  hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
> > > >  2 files changed, 32 insertions(+), 69 deletions(-)
> > > > 
> > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > > index cf98037..1b065df 100644
> > > > --- a/hw/i386/acpi-build.c
> > > > +++ b/hw/i386/acpi-build.c
> > > > @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> > > >      qobject_decref(bsel);
> > > >  }
> > > >  
> > > > +static Aml *build_prt_entry(const char *link_name)
> 
> Pls document what this does.
> 
> > > > +{
> > > > +    Aml *a_zero = aml_int(0);
> > > > +    Aml *pkg = aml_package(4);
> > > > +    aml_append(pkg, a_zero);
> > > > +    aml_append(pkg, a_zero);
> > > > +    aml_append(pkg, aml_name("%s", link_name));
> > > > +    aml_append(pkg, a_zero);
> > > > +    return pkg;
> > > > +}
> > > > +
> > > >  /*
> > > >   * initialize_route - Initialize the interrupt routing rule
> > > >   * through a specific LINK:
> > > > @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> > > >                               Aml *lnk_idx, int idx)
> > > >  {
> > > >      Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> > > > -    Aml *pkg = aml_package(4);
> > > > +    Aml *pkg = build_prt_entry(link_name);
> > > >  
> > > > -    aml_append(pkg, aml_int(0));
> > > > -    aml_append(pkg, aml_int(0));
> > > > -    aml_append(pkg, aml_name("%s", link_name));
> > > > -    aml_append(pkg, aml_int(0));
> > > >      aml_append(if_ctx, aml_store(pkg, route));
> > > >  
> > > >      return if_ctx;
> > > > @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> > > >   * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
> > > >   *
> > > >   */
> > > > -static Aml *build_prt(void)
> > > > +static Aml *build_prt(bool is_pci0_prt)
> > > >  {
> > > > -    Aml *method, *while_ctx, *pin, *res;
> > > > +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;
> > > 
> > > Move if_ctx2/if_ctx/else_ctx2 where they are used?
> > > Also, can't we come up with better name than if_ctx2?
> > > How about if_lnk_1 and if_pin_4?
> > sure
> > 
> > > 
> > > >  
> > > >      method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> > > >      res = aml_local(0);
> > > > @@ -678,7 +685,19 @@ static Aml *build_prt(void)
> > > >  
> > > >          /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
> > > >          aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> > > > -        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > > > +        if (is_pci0_prt) {
> > > > +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> > > > +            /* device 1 is the power-management device, needs SCI */
> > > 
> > > Doesn't this context belong above the previous line?
> > that how it was in ASL, but yep it belongs to a whole if block
> > so I'll move it up
> > 
> > > 
> > > > +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> > > > +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
> > > > +            aml_append(if_ctx, if_ctx2);
> > > > +            else_ctx2 = aml_else();
> > > > +            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
> > > > +            aml_append(if_ctx, else_ctx2);
> > > 
> > > This looks weird. Why isn't else_ctx2 added to if_ctx2?
> > it should be if_ctx2, I'll fix it.
> 
> Hmm I'm not sure actually.
> The API for if/else is confusing, but I'm not sure what's
> a better one.
the weird thing is that this creates exactly the same AML
as in original DSDT, anyway I'll try to make it more clear 
on respin

> 
> > > 
> > > > +            aml_append(while_ctx, if_ctx);
> > > > +        } else {
> > > > +            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > > > +        }
> > > >          aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
> > > >          aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
> > > >  
> > > > @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
> > > >      Aml *method;
> > > >      uint32_t irqs;
> > > >      Aml *sb_scope = aml_scope("_SB");
> > > > +    Aml *pci0_scope = aml_scope("PCI0");
> > > > +
> > > > +    aml_append(pci0_scope, build_prt(true));
> > > > +    aml_append(sb_scope, pci0_scope);
> > > >  
> > > >      field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
> > > >      aml_append(field, aml_named_field("PRQ0", 8));
> > > > @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
> > > >                  aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
> > > >              }
> > > >  
> > > > -            aml_append(dev, build_prt());
> > > > +            aml_append(dev, build_prt(false));
> > > >              crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
> > > >                              io_ranges, mem_ranges);
> > > >              aml_append(dev, aml_name_decl("_CRS", crs));
> > > > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > > > index bc6bd45..5d741dd 100644
> > > > --- a/hw/i386/acpi-dsdt.dsl
> > > > +++ b/hw/i386/acpi-dsdt.dsl
> > > > @@ -78,64 +78,4 @@ DefinitionBlock (
> > > >          /* Hotplug notification method supplied by SSDT */
> > > >          External(\_SB.PCI0.PCNT, MethodObj)
> > > >      }
> > > > -
> > > > -
> > > > -/****************************************************************
> > > > - * PCI IRQs
> > > > - ****************************************************************/
> > > > -
> > > > -    Scope(\_SB) {
> > > > -        Scope(PCI0) {
> > > > -            Method (_PRT, 0) {
> > > > -                Store(Package(128) {}, Local0)
> > > > -                Store(Zero, Local1)
> > > > -                While(LLess(Local1, 128)) {
> > > > -                    // slot = pin >> 2
> > > > -                    Store(ShiftRight(Local1, 2), Local2)
> > > > -
> > > > -                    // lnk = (slot + pin) & 3
> > > > -                    Store(And(Add(Local1, Local2), 3), Local3)
> > > > -                    If (LEqual(Local3, 0)) {
> > > > -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> > > > -                    }
> > > > -                    If (LEqual(Local3, 1)) {
> > > > -                        // device 1 is the power-management device, needs SCI
> > > > -                        If (LEqual(Local1, 4)) {
> > > > -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> > > > -                        } Else {
> > > > -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> > > > -                        }
> > > > -                    }
> > > > -                    If (LEqual(Local3, 2)) {
> > > > -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> > > > -                    }
> > > > -                    If (LEqual(Local3, 3)) {
> > > > -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> > > > -                    }
> > > > -
> > > > -                    // Complete the interrupt routing entry:
> > > > -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> > > > -
> > > > -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> > > > -                    Store(And(Local1, 3),                    Index(Local4, 1))
> > > > -                    Store(Local4,                            Index(Local0, Local1))
> > > > -
> > > > -                    Increment(Local1)
> > > > -                }
> > > > -
> > > > -                Return(Local0)
> > > 
> > > Interesting. And where's this code? Probably in previous or follow-up patches ...
> > it was and still is in original build_prt(),
> > I'm just modifying it to generate missing parts of DSDT AML
> > equivalent which it's replacing.
> 
> OK so commit log should explain that PRT for expander
> buses was already generated in C, the only difference for
> root bus is LINKA.
> 
> And add comment explaining that for pci0,
> device 1 is connected to SCI (LNKS)
> (maybe rename flag to device_1_is_pm?).
sure

> 
> 
> > > 
> > > > -            }
> > > > -        }
> > > > -
> > > > -
> > > > -        External(PRQ0, FieldUnitObj)
> > > > -        External(PRQ1, FieldUnitObj)
> > > > -        External(PRQ2, FieldUnitObj)
> > > > -        External(PRQ3, FieldUnitObj)
> > > > -        External(LNKA, DeviceObj)
> > > > -        External(LNKB, DeviceObj)
> > > > -        External(LNKC, DeviceObj)
> > > > -        External(LNKD, DeviceObj)
> > > > -        External(LNKS, DeviceObj)
> > > > -    }
> > > >  }
> > > > -- 
> > > > 1.8.3.1
> > > > 

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-22  9:37       ` Michael S. Tsirkin
@ 2015-12-22 14:38         ` Igor Mammedov
  2015-12-22 14:47           ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 14:38 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Tue, 22 Dec 2015 11:37:40 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

[...]
> > > > +        for (i = 4; i <= 0xF; i++) {
> > > > +            char *name = g_strdup_printf("_L0%X", i);
> > > > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > > > +            aml_append(scope, method);
> > > > +            g_free(name);
> > > > +        }
> > > 
> > > How about we make aml_method accept ... format instead?
> > actually instead of making aml_method(format,...) it would be
> > easier to make it accept Aml* so we could reuse aml_name(format,...)
> > in the end it would look like:
> > 
> >  Aml gpe_name = aml_name("_L0%X", i);
> >  aml_method(gpe_name, AML_NOTSERIALIZED);
> > 
> > in addition name object could be reused in other places
> > that reference that method.
> 
> Except most methods are simple, so maybe do both APIs.
> Avoiding string duplication is a good idea,
> but using string constants works just as well.
I don't like having 2 APIs, one with 'Aml* name' and other
with 'const char *name' in C. I'd prefer to have just one
that suits the majority use cases and

I'm not so comfortable with using format string here directly
as it would look weird (at least to me):
   aml_method("_L0%X", i, argcount, AML_NOTSERIALIZED);
     - static format string check at compile time won't work here
   or
   aml_method(argcount, AML_NOTSERIALIZED, "_L0%X", i);
     - that should be fine except of that argument order doesn't
       match the way it's in spec, which I'd prefer to keep

so it leaves for me 2 options:
  1: use aml_method(aml_name("_L0%X", i), argcount, AML_NOTSERIALIZED)
      It's a bit of code churn and not sure if we really need it
      but I can do if asked for it.

  2: just leave it as is for now, because the most of method names
     are just string constants. These "_L0%X" will be gone after
     cleanup, leaving us with only handlers that use string const and
     do some work.

     I can replace g_strdup_printf() with static buffer here if you
     dislike alloc/free in this patch.

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-22 14:38         ` Igor Mammedov
@ 2015-12-22 14:47           ` Michael S. Tsirkin
  2015-12-22 15:00             ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 14:47 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Tue, Dec 22, 2015 at 03:38:24PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 11:37:40 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> [...]
> > > > > +        for (i = 4; i <= 0xF; i++) {
> > > > > +            char *name = g_strdup_printf("_L0%X", i);
> > > > > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > > > > +            aml_append(scope, method);
> > > > > +            g_free(name);
> > > > > +        }
> > > > 
> > > > How about we make aml_method accept ... format instead?
> > > actually instead of making aml_method(format,...) it would be
> > > easier to make it accept Aml* so we could reuse aml_name(format,...)
> > > in the end it would look like:
> > > 
> > >  Aml gpe_name = aml_name("_L0%X", i);
> > >  aml_method(gpe_name, AML_NOTSERIALIZED);
> > > 
> > > in addition name object could be reused in other places
> > > that reference that method.
> > 
> > Except most methods are simple, so maybe do both APIs.
> > Avoiding string duplication is a good idea,
> > but using string constants works just as well.
> I don't like having 2 APIs, one with 'Aml* name' and other
> with 'const char *name' in C. I'd prefer to have just one
> that suits the majority use cases and
> 
> I'm not so comfortable with using format string here directly
> as it would look weird (at least to me):
>    aml_method("_L0%X", i, argcount, AML_NOTSERIALIZED);
>      - static format string check at compile time won't work here
>    or
>    aml_method(argcount, AML_NOTSERIALIZED, "_L0%X", i);
>      - that should be fine except of that argument order doesn't
>        match the way it's in spec, which I'd prefer to keep

Just add ... at the end:

aml_method("_L0%X", argcount, AML_NOTSERIALIZED, i);

looks a bit weird if you have to use it, but
it's uncommon, and the common case looks simple.

> so it leaves for me 2 options:
>   1: use aml_method(aml_name("_L0%X", i), argcount, AML_NOTSERIALIZED)
>       It's a bit of code churn and not sure if we really need it
>       but I can do if asked for it.
> 
>   2: just leave it as is for now, because the most of method names
>      are just string constants. These "_L0%X" will be gone after
>      cleanup, leaving us with only handlers that use string const and
>      do some work.
> 
>      I can replace g_strdup_printf() with static buffer here if you
>      dislike alloc/free in this patch.

So how about just open-coding this loop for now?
That's just about 10 lines of code,
not a big deal.

As you say, will be gone after refactoring.

-- 
MST

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

* Re: [Qemu-devel] [PATCH v2 58/74] pc: acpi: piix4: move PCI0._PRT() into SSDT
  2015-12-22 14:12             ` Igor Mammedov
@ 2015-12-22 14:52               ` Michael S. Tsirkin
  0 siblings, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 14:52 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, marcel.apfelbaum

On Tue, Dec 22, 2015 at 03:12:01PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 11:34:46 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Mon, Dec 21, 2015 at 01:55:16PM +0100, Igor Mammedov wrote:
> > > On Sat, 19 Dec 2015 21:23:22 +0200
> > > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > 
> > > > On Thu, Dec 10, 2015 at 05:17:07PM +0100, Igor Mammedov wrote:
> > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > ---
> > > > > v2:
> > > > >  - adapt build_prt() for using for PCI0._PRT(), reduces code duplication,
> > > > >    Suggested-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> > > > > 
> > > > > pc: acpi: piix4: adapt build_prt() for using for PCI0._PRT()
> > > > > 
> > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > ---
> > > > >  hw/i386/acpi-build.c  | 41 +++++++++++++++++++++++++++--------
> > > > >  hw/i386/acpi-dsdt.dsl | 60 ---------------------------------------------------
> > > > >  2 files changed, 32 insertions(+), 69 deletions(-)
> > > > > 
> > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > > > index cf98037..1b065df 100644
> > > > > --- a/hw/i386/acpi-build.c
> > > > > +++ b/hw/i386/acpi-build.c
> > > > > @@ -620,6 +620,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> > > > >      qobject_decref(bsel);
> > > > >  }
> > > > >  
> > > > > +static Aml *build_prt_entry(const char *link_name)
> > 
> > Pls document what this does.
> > 
> > > > > +{
> > > > > +    Aml *a_zero = aml_int(0);
> > > > > +    Aml *pkg = aml_package(4);
> > > > > +    aml_append(pkg, a_zero);
> > > > > +    aml_append(pkg, a_zero);
> > > > > +    aml_append(pkg, aml_name("%s", link_name));
> > > > > +    aml_append(pkg, a_zero);
> > > > > +    return pkg;
> > > > > +}
> > > > > +
> > > > >  /*
> > > > >   * initialize_route - Initialize the interrupt routing rule
> > > > >   * through a specific LINK:
> > > > > @@ -630,12 +641,8 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> > > > >                               Aml *lnk_idx, int idx)
> > > > >  {
> > > > >      Aml *if_ctx = aml_if(aml_equal(lnk_idx, aml_int(idx)));
> > > > > -    Aml *pkg = aml_package(4);
> > > > > +    Aml *pkg = build_prt_entry(link_name);
> > > > >  
> > > > > -    aml_append(pkg, aml_int(0));
> > > > > -    aml_append(pkg, aml_int(0));
> > > > > -    aml_append(pkg, aml_name("%s", link_name));
> > > > > -    aml_append(pkg, aml_int(0));
> > > > >      aml_append(if_ctx, aml_store(pkg, route));
> > > > >  
> > > > >      return if_ctx;
> > > > > @@ -651,9 +658,9 @@ static Aml *initialize_route(Aml *route, const char *link_name,
> > > > >   * The hash function is  (slot + pin) & 3 -> "LNK[D|A|B|C]".
> > > > >   *
> > > > >   */
> > > > > -static Aml *build_prt(void)
> > > > > +static Aml *build_prt(bool is_pci0_prt)
> > > > >  {
> > > > > -    Aml *method, *while_ctx, *pin, *res;
> > > > > +    Aml *method, *while_ctx, *pin, *res, *if_ctx, *if_ctx2, *else_ctx2;
> > > > 
> > > > Move if_ctx2/if_ctx/else_ctx2 where they are used?
> > > > Also, can't we come up with better name than if_ctx2?
> > > > How about if_lnk_1 and if_pin_4?
> > > sure
> > > 
> > > > 
> > > > >  
> > > > >      method = aml_method("_PRT", 0, AML_NOTSERIALIZED);
> > > > >      res = aml_local(0);
> > > > > @@ -678,7 +685,19 @@ static Aml *build_prt(void)
> > > > >  
> > > > >          /* route[2] = "LNK[D|A|B|C]", selection based on pin % 3  */
> > > > >          aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0));
> > > > > -        aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > > > > +        if (is_pci0_prt) {
> > > > > +            if_ctx = aml_if(aml_equal(lnk_idx, aml_int(1)));
> > > > > +            /* device 1 is the power-management device, needs SCI */
> > > > 
> > > > Doesn't this context belong above the previous line?
> > > that how it was in ASL, but yep it belongs to a whole if block
> > > so I'll move it up
> > > 
> > > > 
> > > > > +            if_ctx2 = aml_if(aml_equal(pin, aml_int(4)));
> > > > > +            aml_append(if_ctx2, aml_store(build_prt_entry("LNKS"), route));
> > > > > +            aml_append(if_ctx, if_ctx2);
> > > > > +            else_ctx2 = aml_else();
> > > > > +            aml_append(else_ctx2, aml_store(build_prt_entry("LNKA"), route));
> > > > > +            aml_append(if_ctx, else_ctx2);
> > > > 
> > > > This looks weird. Why isn't else_ctx2 added to if_ctx2?
> > > it should be if_ctx2, I'll fix it.
> > 
> > Hmm I'm not sure actually.
> > The API for if/else is confusing, but I'm not sure what's
> > a better one.
> the weird thing is that this creates exactly the same AML
> as in original DSDT,
> anyway I'll try to make it more clear 
> on respin

Maybe by using {} scopes and declaring variables there.
Also name them more explicitly: if_device_1 if_pin_4.

> > 
> > > > 
> > > > > +            aml_append(while_ctx, if_ctx);
> > > > > +        } else {
> > > > > +            aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx, 1));
> > > > > +        }
> > > > >          aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2));
> > > > >          aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3));
> > > > >  
> > > > > @@ -1348,6 +1367,10 @@ static void build_piix4_pci0_int(Aml *table)
> > > > >      Aml *method;
> > > > >      uint32_t irqs;
> > > > >      Aml *sb_scope = aml_scope("_SB");
> > > > > +    Aml *pci0_scope = aml_scope("PCI0");
> > > > > +
> > > > > +    aml_append(pci0_scope, build_prt(true));
> > > > > +    aml_append(sb_scope, pci0_scope);
> > > > >  
> > > > >      field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
> > > > >      aml_append(field, aml_named_field("PRQ0", 8));
> > > > > @@ -1569,7 +1592,7 @@ build_ssdt(GArray *table_data, GArray *linker,
> > > > >                  aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
> > > > >              }
> > > > >  
> > > > > -            aml_append(dev, build_prt());
> > > > > +            aml_append(dev, build_prt(false));
> > > > >              crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
> > > > >                              io_ranges, mem_ranges);
> > > > >              aml_append(dev, aml_name_decl("_CRS", crs));
> > > > > diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
> > > > > index bc6bd45..5d741dd 100644
> > > > > --- a/hw/i386/acpi-dsdt.dsl
> > > > > +++ b/hw/i386/acpi-dsdt.dsl
> > > > > @@ -78,64 +78,4 @@ DefinitionBlock (
> > > > >          /* Hotplug notification method supplied by SSDT */
> > > > >          External(\_SB.PCI0.PCNT, MethodObj)
> > > > >      }
> > > > > -
> > > > > -
> > > > > -/****************************************************************
> > > > > - * PCI IRQs
> > > > > - ****************************************************************/
> > > > > -
> > > > > -    Scope(\_SB) {
> > > > > -        Scope(PCI0) {
> > > > > -            Method (_PRT, 0) {
> > > > > -                Store(Package(128) {}, Local0)
> > > > > -                Store(Zero, Local1)
> > > > > -                While(LLess(Local1, 128)) {
> > > > > -                    // slot = pin >> 2
> > > > > -                    Store(ShiftRight(Local1, 2), Local2)
> > > > > -
> > > > > -                    // lnk = (slot + pin) & 3
> > > > > -                    Store(And(Add(Local1, Local2), 3), Local3)
> > > > > -                    If (LEqual(Local3, 0)) {
> > > > > -                        Store(Package(4) { Zero, Zero, LNKD, Zero }, Local4)
> > > > > -                    }
> > > > > -                    If (LEqual(Local3, 1)) {
> > > > > -                        // device 1 is the power-management device, needs SCI
> > > > > -                        If (LEqual(Local1, 4)) {
> > > > > -                            Store(Package(4) { Zero, Zero, LNKS, Zero }, Local4)
> > > > > -                        } Else {
> > > > > -                            Store(Package(4) { Zero, Zero, LNKA, Zero }, Local4)
> > > > > -                        }
> > > > > -                    }
> > > > > -                    If (LEqual(Local3, 2)) {
> > > > > -                        Store(Package(4) { Zero, Zero, LNKB, Zero }, Local4)
> > > > > -                    }
> > > > > -                    If (LEqual(Local3, 3)) {
> > > > > -                        Store(Package(4) { Zero, Zero, LNKC, Zero }, Local4)
> > > > > -                    }
> > > > > -
> > > > > -                    // Complete the interrupt routing entry:
> > > > > -                    //    Package(4) { 0x[slot]FFFF, [pin], [link], 0) }
> > > > > -
> > > > > -                    Store(Or(ShiftLeft(Local2, 16), 0xFFFF), Index(Local4, 0))
> > > > > -                    Store(And(Local1, 3),                    Index(Local4, 1))
> > > > > -                    Store(Local4,                            Index(Local0, Local1))
> > > > > -
> > > > > -                    Increment(Local1)
> > > > > -                }
> > > > > -
> > > > > -                Return(Local0)
> > > > 
> > > > Interesting. And where's this code? Probably in previous or follow-up patches ...
> > > it was and still is in original build_prt(),
> > > I'm just modifying it to generate missing parts of DSDT AML
> > > equivalent which it's replacing.
> > 
> > OK so commit log should explain that PRT for expander
> > buses was already generated in C, the only difference for
> > root bus is LINKA.
> > 
> > And add comment explaining that for pci0,
> > device 1 is connected to SCI (LNKS)
> > (maybe rename flag to device_1_is_pm?).
> sure
> 
> > 
> > 
> > > > 
> > > > > -            }
> > > > > -        }
> > > > > -
> > > > > -
> > > > > -        External(PRQ0, FieldUnitObj)
> > > > > -        External(PRQ1, FieldUnitObj)
> > > > > -        External(PRQ2, FieldUnitObj)
> > > > > -        External(PRQ3, FieldUnitObj)
> > > > > -        External(LNKA, DeviceObj)
> > > > > -        External(LNKB, DeviceObj)
> > > > > -        External(LNKC, DeviceObj)
> > > > > -        External(LNKD, DeviceObj)
> > > > > -        External(LNKS, DeviceObj)
> > > > > -    }
> > > > >  }
> > > > > -- 
> > > > > 1.8.3.1
> > > > > 

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

* Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
  2015-12-22 14:47           ` Michael S. Tsirkin
@ 2015-12-22 15:00             ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 15:00 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Tue, 22 Dec 2015 16:47:18 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Dec 22, 2015 at 03:38:24PM +0100, Igor Mammedov wrote:
> > On Tue, 22 Dec 2015 11:37:40 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > [...]
> > > > > > +        for (i = 4; i <= 0xF; i++) {
> > > > > > +            char *name = g_strdup_printf("_L0%X", i);
> > > > > > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > > > > > +            aml_append(scope, method);
> > > > > > +            g_free(name);
> > > > > > +        }
> > > > > 
> > > > > How about we make aml_method accept ... format instead?
> > > > actually instead of making aml_method(format,...) it would be
> > > > easier to make it accept Aml* so we could reuse aml_name(format,...)
> > > > in the end it would look like:
> > > > 
> > > >  Aml gpe_name = aml_name("_L0%X", i);
> > > >  aml_method(gpe_name, AML_NOTSERIALIZED);
> > > > 
> > > > in addition name object could be reused in other places
> > > > that reference that method.
> > > 
> > > Except most methods are simple, so maybe do both APIs.
> > > Avoiding string duplication is a good idea,
> > > but using string constants works just as well.
> > I don't like having 2 APIs, one with 'Aml* name' and other
> > with 'const char *name' in C. I'd prefer to have just one
> > that suits the majority use cases and
> > 
> > I'm not so comfortable with using format string here directly
> > as it would look weird (at least to me):
> >    aml_method("_L0%X", i, argcount, AML_NOTSERIALIZED);
> >      - static format string check at compile time won't work here
> >    or
> >    aml_method(argcount, AML_NOTSERIALIZED, "_L0%X", i);
> >      - that should be fine except of that argument order doesn't
> >        match the way it's in spec, which I'd prefer to keep
> 
> Just add ... at the end:
> 
> aml_method("_L0%X", argcount, AML_NOTSERIALIZED, i);
ok, I'll try to do it.

> 
> looks a bit weird if you have to use it, but
> it's uncommon, and the common case looks simple.
> 
> > so it leaves for me 2 options:
> >   1: use aml_method(aml_name("_L0%X", i), argcount, AML_NOTSERIALIZED)
> >       It's a bit of code churn and not sure if we really need it
> >       but I can do if asked for it.
> > 
> >   2: just leave it as is for now, because the most of method names
> >      are just string constants. These "_L0%X" will be gone after
> >      cleanup, leaving us with only handlers that use string const and
> >      do some work.
> > 
> >      I can replace g_strdup_printf() with static buffer here if you
> >      dislike alloc/free in this patch.
> 
> So how about just open-coding this loop for now?
> That's just about 10 lines of code,
> not a big deal.
sure

> 
> As you say, will be gone after refactoring.
> 

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

* Re: [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-21 17:31       ` Igor Mammedov
@ 2015-12-22 15:11         ` Michael S. Tsirkin
  2015-12-22 15:45           ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 15:11 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, marcel.apfelbaum

On Mon, Dec 21, 2015 at 06:31:40PM +0100, Igor Mammedov wrote:
> On Sun, 20 Dec 2015 15:41:22 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Wed, Dec 16, 2015 at 03:47:35PM +0100, Igor Mammedov wrote:
> [...]
> > > +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > > +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> > > +        {
> > > +             aml_append(ifctx, aml_return(a_zero));
> > > +        }
> > > +        aml_append(method, ifctx);
> > > +        /* present, functioning, decoding, not shown in UI */
> > > +        aml_append(method, aml_return(aml_int(0xB)));
> > > +        aml_append(ctrl_dev, method);
> > 
> > 
> > Simple unserialized methods that return value depending on input
> > being zero seem very common.  How about a helper for this case?
> > 
> > E.g.
> > 
> > aml_method_if_then_else(slots_nr, aml_int(0xB), aml_int(0));
> I've looked through all _STA methods that exist in DSDT
> and though this method for mem hotplug doesn't belong to common pattern,
> I could use you suggestion for 4 ISA devices.
> 
> Or perhaps I can save 2-3 LOC by making common
>   build_if_else(cond, truectx, false_ctx);
> I'll try both but it looks like build_if_else() will be more useful.

Yes but the issue is it makes code look weird since
you need to prepare the context ahead of the time.

> And after this series is applied there is a plenty to optimize,
> for example most of these _STA methods will be gone or replaced
> by simple _STA = FOO expression.

OK.

> 
> > 
> > >      }
> > >      aml_append(pci_scope, ctrl_dev);
> > >      aml_append(ctx, pci_scope);
> > > diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > > index c2bb6a1..b4eacc9 100644
> > > --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > > +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > > @@ -35,14 +35,6 @@
> > >              External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
> > >              External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
> > >  
> > > -            Method(_STA, 0) {
> > > -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> > > -                    Return(0x0)
> > > -                }
> > > -                /* present, functioning, decoding, not shown in UI */
> > > -                Return(0xB)
> > > -            }
> > > -
> > >              Mutex (MEMORY_SLOT_LOCK, 0)
> > >  
> > >              Method(MEMORY_SLOT_SCAN_METHOD, 0) {
> > > -- 
> > > 1.8.3.1

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

* Re: [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-09 23:41 ` [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs Igor Mammedov
  2015-12-10  1:50   ` Shannon Zhao
@ 2015-12-22 15:17   ` Michael S. Tsirkin
  2015-12-22 15:37     ` Igor Mammedov
  1 sibling, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 15:17 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-arm, qemu-devel, zhaoshenglong

On Thu, Dec 10, 2015 at 12:41:18AM +0100, Igor Mammedov wrote:
> ASL Interrupt() macro translates to Extended Interrupt Descriptor
> which supports variable number of IRQs. It will be used for
> conversion of ASL code for pc/q35 machines that use it for
> returning several IRQs in _PSR object.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> CC: zhaoshenglong@huawei.com
> CC: qemu-arm@nongnu.org
> ---
>  hw/acpi/aml-build.c         | 22 +++++++++++++---------
>  hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
>  include/hw/acpi/aml-build.h |  2 +-
>  3 files changed, 26 insertions(+), 21 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 2ca9207..ee64d12 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
>  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
>                     AmlLevelAndEdge level_and_edge,
>                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> -                   uint32_t irq)
> +                   uint32_t *irq_list, uint8_t irq_count)

const uint32_t *irq_list?

>  {
> +    int i;
>      Aml *var = aml_alloc();
>      uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
>                          | (high_and_low << 2) | (shared << 3);
> +    const int header_bytes_in_len = 2;
> +    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
> +
> +    assert(irq_count > 0);
>  
>      build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
> -    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
> -    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
> +    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
> +    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */

build_append_int_noprefix ?

Which really needs a better name btw.



>      build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
> -    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
> +    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
>  
> -    /* Interrupt Number */
> -    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
> -    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
> -    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
> -    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
> +    /* Interrupt Number List */
> +    for (i = 0; i < irq_count; i++) {
> +        build_append_int_noprefix(var->buf, irq_list[i], 4);
> +    }
>      return var;
>  }
>  
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 698b5f2..02ba822 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
>  }
>  
>  static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> -                                           int uart_irq)
> +                                           uint32_t uart_irq)
>  {
>      Aml *dev = aml_device("COM0");
>      aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
> @@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
>                                         uart_memmap->size, AML_READ_WRITE));
>      aml_append(crs,
>                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                             AML_EXCLUSIVE, uart_irq));
> +                             AML_EXCLUSIVE, &uart_irq, 1));
>      aml_append(dev, aml_name_decl("_CRS", crs));
>  
>      /* The _ADR entry is used to link this device to the UART described
> @@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
>  }
>  
>  static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> -                                          int rtc_irq)
> +                                          uint32_t rtc_irq)
>  {
>      Aml *dev = aml_device("RTC0");
>      aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
> @@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
>                                         rtc_memmap->size, AML_READ_WRITE));
>      aml_append(crs,
>                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                             AML_EXCLUSIVE, rtc_irq));
> +                             AML_EXCLUSIVE, &rtc_irq, 1));
>      aml_append(dev, aml_name_decl("_CRS", crs));
>      aml_append(scope, dev);
>  }
> @@ -136,11 +136,11 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
>  
>  static void acpi_dsdt_add_virtio(Aml *scope,
>                                   const MemMapEntry *virtio_mmio_memmap,
> -                                 int mmio_irq, int num)
> +                                 uint32_t mmio_irq, int num)
>  {
>      hwaddr base = virtio_mmio_memmap->base;
>      hwaddr size = virtio_mmio_memmap->size;
> -    int irq = mmio_irq;
> +    uint32_t irq = mmio_irq;
>      int i;
>  
>      for (i = 0; i < num; i++) {
> @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
>          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irq, 1));
>          aml_append(dev, aml_name_decl("_CRS", crs));
>          aml_append(scope, dev);
>          base += size;
>      }
>  }
>  
> -static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> -                              bool use_highmem)
> +static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
> +                              uint32_t irq, bool use_highmem)
>  {
>      Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
>      int i, bus_no;
> @@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
>  
>      /* Create GSI link device */
>      for (i = 0; i < PCI_NUM_PINS; i++) {
> +        uint32_t irqs =  irq + i;
>          Aml *dev_gsi = aml_device("GSI%d", i);
>          aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
>          aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
>          crs = aml_resource_template();
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irqs, 1));
>          aml_append(dev_gsi, aml_name_decl("_PRS", crs));
>          crs = aml_resource_template();
>          aml_append(crs,
>                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> -                                 AML_EXCLUSIVE, irq + i));
> +                                 AML_EXCLUSIVE, &irqs, 1));
>          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
>          method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
>          aml_append(dev_gsi, method);
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index ca365c9..a3a058f 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
>  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
>                     AmlLevelAndEdge level_and_edge,
>                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> -                   uint32_t irq);
> +                   uint32_t *irq_list, uint8_t irq_count);
>  Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
>              uint8_t aln, uint8_t len);
>  Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
  2015-12-10 12:50   ` Marcel Apfelbaum
@ 2015-12-22 15:28   ` Michael S. Tsirkin
  2015-12-22 15:54     ` Igor Mammedov
  1 sibling, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 15:28 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  tests/bios-tables-test.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index 6d37332..50678b5 100644
> --- a/tests/bios-tables-test.c
> +++ b/tests/bios-tables-test.c
> @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
>                          (gchar *)&signature,
>                          sdt->asl_file, sdt->aml_file,
>                          exp_sdt->asl_file, exp_sdt->aml_file);
> +                if (getenv("V")) {

How do you test? make check V=1?

> +                    int ret G_GNUC_UNUSED;
> +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> +                        exp_sdt->asl_file, sdt->asl_file);

This assumes running under git which is generally wrong e.g.
people build from tarballs.
git is also not a build dependency.


> +                    ret = system(diff) ;
> +                    g_free(diff);
> +                }
>            }
>          }
>          g_string_free(asl, true);
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-22 15:17   ` [Qemu-devel] [PATCH " Michael S. Tsirkin
@ 2015-12-22 15:37     ` Igor Mammedov
  2015-12-22 15:58       ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 15:37 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-arm, qemu-devel, zhaoshenglong

On Tue, 22 Dec 2015 17:17:33 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:41:18AM +0100, Igor Mammedov wrote:
> > ASL Interrupt() macro translates to Extended Interrupt Descriptor
> > which supports variable number of IRQs. It will be used for
> > conversion of ASL code for pc/q35 machines that use it for
> > returning several IRQs in _PSR object.
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > CC: zhaoshenglong@huawei.com
> > CC: qemu-arm@nongnu.org
> > ---
> >  hw/acpi/aml-build.c         | 22 +++++++++++++---------
> >  hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
> >  include/hw/acpi/aml-build.h |  2 +-
> >  3 files changed, 26 insertions(+), 21 deletions(-)
> > 
> > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > index 2ca9207..ee64d12 100644
> > --- a/hw/acpi/aml-build.c
> > +++ b/hw/acpi/aml-build.c
> > @@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> >                     AmlLevelAndEdge level_and_edge,
> >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > -                   uint32_t irq)
> > +                   uint32_t *irq_list, uint8_t irq_count)
> 
> const uint32_t *irq_list?
will do it on top as it's in master by now.

> 
> >  {
> > +    int i;
> >      Aml *var = aml_alloc();
> >      uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
> >                          | (high_and_low << 2) | (shared << 3);
> > +    const int header_bytes_in_len = 2;
> > +    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
> > +
> > +    assert(irq_count > 0);
> >  
> >      build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
> > -    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
> > -    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
> > +    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
> > +    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
> 
> build_append_int_noprefix ?
it will do job to, though I'd prefer it by byte as it exactly matches
table description in spec.

> 
> Which really needs a better name btw.
I'd like to get rid of long build_append_ prefix but would like to
keep aml_ one only for ASL constructs.
How about 'acpi_int(Aml*, val, sz)' replacing both 'build_append_int[_noprefix]()'
where if sz == 0 do what build_append_int() does.

same name suggestion goes for byte:
  s/build_append_byte/acpi_byte/

> 
> 
> 
> >      build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
> > -    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
> > +    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
> >  
> > -    /* Interrupt Number */
> > -    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
> > -    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
> > -    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
> > -    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
> > +    /* Interrupt Number List */
> > +    for (i = 0; i < irq_count; i++) {
> > +        build_append_int_noprefix(var->buf, irq_list[i], 4);
> > +    }
> >      return var;
> >  }
> >  
> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > index 698b5f2..02ba822 100644
> > --- a/hw/arm/virt-acpi-build.c
> > +++ b/hw/arm/virt-acpi-build.c
> > @@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
> >  }
> >  
> >  static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > -                                           int uart_irq)
> > +                                           uint32_t uart_irq)
> >  {
> >      Aml *dev = aml_device("COM0");
> >      aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
> > @@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> >                                         uart_memmap->size, AML_READ_WRITE));
> >      aml_append(crs,
> >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > -                             AML_EXCLUSIVE, uart_irq));
> > +                             AML_EXCLUSIVE, &uart_irq, 1));
> >      aml_append(dev, aml_name_decl("_CRS", crs));
> >  
> >      /* The _ADR entry is used to link this device to the UART described
> > @@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> >  }
> >  
> >  static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > -                                          int rtc_irq)
> > +                                          uint32_t rtc_irq)
> >  {
> >      Aml *dev = aml_device("RTC0");
> >      aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
> > @@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> >                                         rtc_memmap->size, AML_READ_WRITE));
> >      aml_append(crs,
> >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > -                             AML_EXCLUSIVE, rtc_irq));
> > +                             AML_EXCLUSIVE, &rtc_irq, 1));
> >      aml_append(dev, aml_name_decl("_CRS", crs));
> >      aml_append(scope, dev);
> >  }
> > @@ -136,11 +136,11 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
> >  
> >  static void acpi_dsdt_add_virtio(Aml *scope,
> >                                   const MemMapEntry *virtio_mmio_memmap,
> > -                                 int mmio_irq, int num)
> > +                                 uint32_t mmio_irq, int num)
> >  {
> >      hwaddr base = virtio_mmio_memmap->base;
> >      hwaddr size = virtio_mmio_memmap->size;
> > -    int irq = mmio_irq;
> > +    uint32_t irq = mmio_irq;
> >      int i;
> >  
> >      for (i = 0; i < num; i++) {
> > @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
> >          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
> >          aml_append(crs,
> >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > -                                 AML_EXCLUSIVE, irq + i));
> > +                                 AML_EXCLUSIVE, &irq, 1));
> >          aml_append(dev, aml_name_decl("_CRS", crs));
> >          aml_append(scope, dev);
> >          base += size;
> >      }
> >  }
> >  
> > -static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > -                              bool use_highmem)
> > +static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
> > +                              uint32_t irq, bool use_highmem)
> >  {
> >      Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
> >      int i, bus_no;
> > @@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> >  
> >      /* Create GSI link device */
> >      for (i = 0; i < PCI_NUM_PINS; i++) {
> > +        uint32_t irqs =  irq + i;
> >          Aml *dev_gsi = aml_device("GSI%d", i);
> >          aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
> >          aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
> >          crs = aml_resource_template();
> >          aml_append(crs,
> >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > -                                 AML_EXCLUSIVE, irq + i));
> > +                                 AML_EXCLUSIVE, &irqs, 1));
> >          aml_append(dev_gsi, aml_name_decl("_PRS", crs));
> >          crs = aml_resource_template();
> >          aml_append(crs,
> >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > -                                 AML_EXCLUSIVE, irq + i));
> > +                                 AML_EXCLUSIVE, &irqs, 1));
> >          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
> >          method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
> >          aml_append(dev_gsi, method);
> > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> > index ca365c9..a3a058f 100644
> > --- a/include/hw/acpi/aml-build.h
> > +++ b/include/hw/acpi/aml-build.h
> > @@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> >                     AmlLevelAndEdge level_and_edge,
> >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > -                   uint32_t irq);
> > +                   uint32_t *irq_list, uint8_t irq_count);
> >  Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
> >              uint8_t aln, uint8_t len);
> >  Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH v2 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT
  2015-12-22 15:11         ` Michael S. Tsirkin
@ 2015-12-22 15:45           ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 15:45 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel, marcel.apfelbaum

On Tue, 22 Dec 2015 17:11:46 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Mon, Dec 21, 2015 at 06:31:40PM +0100, Igor Mammedov wrote:
> > On Sun, 20 Dec 2015 15:41:22 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > > On Wed, Dec 16, 2015 at 03:47:35PM +0100, Igor Mammedov wrote:
> > [...]
> > > > +        method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > > > +        ifctx = aml_if(aml_equal(a_slots_nr, a_zero));
> > > > +        {
> > > > +             aml_append(ifctx, aml_return(a_zero));
> > > > +        }
> > > > +        aml_append(method, ifctx);
> > > > +        /* present, functioning, decoding, not shown in UI */
> > > > +        aml_append(method, aml_return(aml_int(0xB)));
> > > > +        aml_append(ctrl_dev, method);
> > > 
> > > 
> > > Simple unserialized methods that return value depending on input
> > > being zero seem very common.  How about a helper for this case?
> > > 
> > > E.g.
> > > 
> > > aml_method_if_then_else(slots_nr, aml_int(0xB), aml_int(0));
> > I've looked through all _STA methods that exist in DSDT
> > and though this method for mem hotplug doesn't belong to common pattern,
> > I could use you suggestion for 4 ISA devices.
> > 
> > Or perhaps I can save 2-3 LOC by making common
> >   build_if_else(cond, truectx, false_ctx);
> > I'll try both but it looks like build_if_else() will be more useful.
> 
> Yes but the issue is it makes code look weird since
> you need to prepare the context ahead of the time.
I was thinking using it only for simple true/falsectx where it
could be inlined as argument, like:
   aml_append(method,
       build_if_else(aml_equal(slots_nr, zero),
                     aml_return(zero), aml_return(aml_int(0xB))));

maybe save this idea for after this series to see what is left after
cleanups and if it's worth a trouble.
                 
> 
> > And after this series is applied there is a plenty to optimize,
> > for example most of these _STA methods will be gone or replaced
> > by simple _STA = FOO expression.
> 
> OK.
> 
> > 
> > > 
> > > >      }
> > > >      aml_append(pci_scope, ctrl_dev);
> > > >      aml_append(ctx, pci_scope);
> > > > diff --git a/hw/i386/acpi-dsdt-mem-hotplug.dsl b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > > > index c2bb6a1..b4eacc9 100644
> > > > --- a/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > > > +++ b/hw/i386/acpi-dsdt-mem-hotplug.dsl
> > > > @@ -35,14 +35,6 @@
> > > >              External(MEMORY_SLOT_OST_EVENT, FieldUnitObj) // _OST event code, write only
> > > >              External(MEMORY_SLOT_OST_STATUS, FieldUnitObj) // _OST status code, write only
> > > >  
> > > > -            Method(_STA, 0) {
> > > > -                If (LEqual(MEMORY_SLOTS_NUMBER, Zero)) {
> > > > -                    Return(0x0)
> > > > -                }
> > > > -                /* present, functioning, decoding, not shown in UI */
> > > > -                Return(0xB)
> > > > -            }
> > > > -
> > > >              Mutex (MEMORY_SLOT_LOCK, 0)
> > > >  
> > > >              Method(MEMORY_SLOT_SCAN_METHOD, 0) {
> > > > -- 
> > > > 1.8.3.1

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-22 15:28   ` Michael S. Tsirkin
@ 2015-12-22 15:54     ` Igor Mammedov
  2015-12-22 16:18       ` Michael S. Tsirkin
  2015-12-22 16:59       ` Michael S. Tsirkin
  0 siblings, 2 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 15:54 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Tue, 22 Dec 2015 17:28:42 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  tests/bios-tables-test.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > index 6d37332..50678b5 100644
> > --- a/tests/bios-tables-test.c
> > +++ b/tests/bios-tables-test.c
> > @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
> >                          (gchar *)&signature,
> >                          sdt->asl_file, sdt->aml_file,
> >                          exp_sdt->asl_file, exp_sdt->aml_file);
> > +                if (getenv("V")) {
> 
> How do you test? make check V=1?
yep
 make V=1 check

> 
> > +                    int ret G_GNUC_UNUSED;
> > +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> > +                        exp_sdt->asl_file, sdt->asl_file);
> 
> This assumes running under git which is generally wrong e.g.
> people build from tarballs.
> git is also not a build dependency.
usually only developers use V=1 as they care about verbose output
and they probably use/have git so it doesn't have to builddep,
if they don't they won't get any useful output here.

my choice of 'git diff' was dictated by the fact that
it produces nice colored diff of ASL while usual diff doesn't.
And that helps a lot (to me) as that diff is intended
for human consumption.

> 
> 
> > +                    ret = system(diff) ;
> > +                    g_free(diff);
> > +                }
> >            }
> >          }
> >          g_string_free(asl, true);
> > -- 
> > 1.8.3.1
> > 

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

* Re: [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-22 15:37     ` Igor Mammedov
@ 2015-12-22 15:58       ` Michael S. Tsirkin
  2015-12-22 16:19         ` Igor Mammedov
  0 siblings, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 15:58 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-arm, qemu-devel, zhaoshenglong

On Tue, Dec 22, 2015 at 04:37:11PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 17:17:33 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Dec 10, 2015 at 12:41:18AM +0100, Igor Mammedov wrote:
> > > ASL Interrupt() macro translates to Extended Interrupt Descriptor
> > > which supports variable number of IRQs. It will be used for
> > > conversion of ASL code for pc/q35 machines that use it for
> > > returning several IRQs in _PSR object.
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > > CC: zhaoshenglong@huawei.com
> > > CC: qemu-arm@nongnu.org
> > > ---
> > >  hw/acpi/aml-build.c         | 22 +++++++++++++---------
> > >  hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
> > >  include/hw/acpi/aml-build.h |  2 +-
> > >  3 files changed, 26 insertions(+), 21 deletions(-)
> > > 
> > > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > > index 2ca9207..ee64d12 100644
> > > --- a/hw/acpi/aml-build.c
> > > +++ b/hw/acpi/aml-build.c
> > > @@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> > >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> > >                     AmlLevelAndEdge level_and_edge,
> > >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > > -                   uint32_t irq)
> > > +                   uint32_t *irq_list, uint8_t irq_count)
> > 
> > const uint32_t *irq_list?
> will do it on top as it's in master by now.
> 
> > 
> > >  {
> > > +    int i;
> > >      Aml *var = aml_alloc();
> > >      uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
> > >                          | (high_and_low << 2) | (shared << 3);
> > > +    const int header_bytes_in_len = 2;
> > > +    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
> > > +
> > > +    assert(irq_count > 0);
> > >  
> > >      build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
> > > -    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
> > > -    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
> > > +    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
> > > +    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
> > 
> > build_append_int_noprefix ?
> it will do job to, though I'd prefer it by byte as it exactly matches
> table description in spec.

ok then, it's not a big deal.

> > 
> > Which really needs a better name btw.
> I'd like to get rid of long build_append_ prefix but would like to
> keep aml_ one only for ASL constructs.
> How about 'acpi_int(Aml*, val, sz)' replacing both 'build_append_int[_noprefix]()'
> where if sz == 0 do what build_append_int() does.

We can't drop GArray things yet - I want acpi tables to be
built like this and get rid of structs.

> same name suggestion goes for byte:
>   s/build_append_byte/acpi_byte/

I prefer append in there. byte implies it returns byte.

build_append_bytes?

> > 
> > 
> > 
> > >      build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
> > > -    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
> > > +    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
> > >  
> > > -    /* Interrupt Number */
> > > -    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
> > > -    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
> > > -    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
> > > -    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
> > > +    /* Interrupt Number List */
> > > +    for (i = 0; i < irq_count; i++) {
> > > +        build_append_int_noprefix(var->buf, irq_list[i], 4);
> > > +    }
> > >      return var;
> > >  }
> > >  
> > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > > index 698b5f2..02ba822 100644
> > > --- a/hw/arm/virt-acpi-build.c
> > > +++ b/hw/arm/virt-acpi-build.c
> > > @@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
> > >  }
> > >  
> > >  static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > -                                           int uart_irq)
> > > +                                           uint32_t uart_irq)
> > >  {
> > >      Aml *dev = aml_device("COM0");
> > >      aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
> > > @@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > >                                         uart_memmap->size, AML_READ_WRITE));
> > >      aml_append(crs,
> > >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > -                             AML_EXCLUSIVE, uart_irq));
> > > +                             AML_EXCLUSIVE, &uart_irq, 1));
> > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > >  
> > >      /* The _ADR entry is used to link this device to the UART described
> > > @@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > >  }
> > >  
> > >  static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > > -                                          int rtc_irq)
> > > +                                          uint32_t rtc_irq)
> > >  {
> > >      Aml *dev = aml_device("RTC0");
> > >      aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
> > > @@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > >                                         rtc_memmap->size, AML_READ_WRITE));
> > >      aml_append(crs,
> > >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > -                             AML_EXCLUSIVE, rtc_irq));
> > > +                             AML_EXCLUSIVE, &rtc_irq, 1));
> > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > >      aml_append(scope, dev);
> > >  }
> > > @@ -136,11 +136,11 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
> > >  
> > >  static void acpi_dsdt_add_virtio(Aml *scope,
> > >                                   const MemMapEntry *virtio_mmio_memmap,
> > > -                                 int mmio_irq, int num)
> > > +                                 uint32_t mmio_irq, int num)
> > >  {
> > >      hwaddr base = virtio_mmio_memmap->base;
> > >      hwaddr size = virtio_mmio_memmap->size;
> > > -    int irq = mmio_irq;
> > > +    uint32_t irq = mmio_irq;
> > >      int i;
> > >  
> > >      for (i = 0; i < num; i++) {
> > > @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
> > >          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
> > >          aml_append(crs,
> > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > -                                 AML_EXCLUSIVE, irq + i));
> > > +                                 AML_EXCLUSIVE, &irq, 1));
> > >          aml_append(dev, aml_name_decl("_CRS", crs));
> > >          aml_append(scope, dev);
> > >          base += size;
> > >      }
> > >  }
> > >  
> > > -static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > > -                              bool use_highmem)
> > > +static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
> > > +                              uint32_t irq, bool use_highmem)
> > >  {
> > >      Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
> > >      int i, bus_no;
> > > @@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > >  
> > >      /* Create GSI link device */
> > >      for (i = 0; i < PCI_NUM_PINS; i++) {
> > > +        uint32_t irqs =  irq + i;
> > >          Aml *dev_gsi = aml_device("GSI%d", i);
> > >          aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
> > >          aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
> > >          crs = aml_resource_template();
> > >          aml_append(crs,
> > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > -                                 AML_EXCLUSIVE, irq + i));
> > > +                                 AML_EXCLUSIVE, &irqs, 1));
> > >          aml_append(dev_gsi, aml_name_decl("_PRS", crs));
> > >          crs = aml_resource_template();
> > >          aml_append(crs,
> > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > -                                 AML_EXCLUSIVE, irq + i));
> > > +                                 AML_EXCLUSIVE, &irqs, 1));
> > >          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
> > >          method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
> > >          aml_append(dev_gsi, method);
> > > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> > > index ca365c9..a3a058f 100644
> > > --- a/include/hw/acpi/aml-build.h
> > > +++ b/include/hw/acpi/aml-build.h
> > > @@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> > >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> > >                     AmlLevelAndEdge level_and_edge,
> > >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > > -                   uint32_t irq);
> > > +                   uint32_t *irq_list, uint8_t irq_count);
> > >  Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
> > >              uint8_t aln, uint8_t len);
> > >  Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
> > > -- 
> > > 1.8.3.1
> > > 

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-22 15:54     ` Igor Mammedov
@ 2015-12-22 16:18       ` Michael S. Tsirkin
  2015-12-22 16:36         ` Igor Mammedov
  2015-12-22 16:59       ` Michael S. Tsirkin
  1 sibling, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 16:18 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Tue, Dec 22, 2015 at 04:54:06PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 17:28:42 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > >  tests/bios-tables-test.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > index 6d37332..50678b5 100644
> > > --- a/tests/bios-tables-test.c
> > > +++ b/tests/bios-tables-test.c
> > > @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
> > >                          (gchar *)&signature,
> > >                          sdt->asl_file, sdt->aml_file,
> > >                          exp_sdt->asl_file, exp_sdt->aml_file);
> > > +                if (getenv("V")) {
> > 
> > How do you test? make check V=1?
> yep
>  make V=1 check
> 
> > 
> > > +                    int ret G_GNUC_UNUSED;
> > > +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> > > +                        exp_sdt->asl_file, sdt->asl_file);
> > 
> > This assumes running under git which is generally wrong e.g.
> > people build from tarballs.
> > git is also not a build dependency.
> usually only developers use V=1 as they care about verbose output
> and they probably use/have git so it doesn't have to builddep,
> if they don't they won't get any useful output here.
> 
> my choice of 'git diff' was dictated by the fact that
> it produces nice colored diff of ASL while usual diff doesn't.
> And that helps a lot (to me) as that diff is intended
> for human consumption.

Well for one, I want make check to pass before
I commit a new expected, not afterwards.
Add another variable to specify which diff to use,
install colordiff and use that.

> > 
> > 
> > > +                    ret = system(diff) ;
> > > +                    g_free(diff);
> > > +                }
> > >            }
> > >          }
> > >          g_string_free(asl, true);
> > > -- 
> > > 1.8.3.1
> > > 

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

* Re: [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-22 15:58       ` Michael S. Tsirkin
@ 2015-12-22 16:19         ` Igor Mammedov
  2015-12-22 16:43           ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 16:19 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-arm, qemu-devel, zhaoshenglong

On Tue, 22 Dec 2015 17:58:41 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Dec 22, 2015 at 04:37:11PM +0100, Igor Mammedov wrote:
> > On Tue, 22 Dec 2015 17:17:33 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > > On Thu, Dec 10, 2015 at 12:41:18AM +0100, Igor Mammedov wrote:
> > > > ASL Interrupt() macro translates to Extended Interrupt Descriptor
> > > > which supports variable number of IRQs. It will be used for
> > > > conversion of ASL code for pc/q35 machines that use it for
> > > > returning several IRQs in _PSR object.
> > > > 
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > ---
> > > > CC: zhaoshenglong@huawei.com
> > > > CC: qemu-arm@nongnu.org
> > > > ---
> > > >  hw/acpi/aml-build.c         | 22 +++++++++++++---------
> > > >  hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
> > > >  include/hw/acpi/aml-build.h |  2 +-
> > > >  3 files changed, 26 insertions(+), 21 deletions(-)
> > > > 
> > > > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > > > index 2ca9207..ee64d12 100644
> > > > --- a/hw/acpi/aml-build.c
> > > > +++ b/hw/acpi/aml-build.c
> > > > @@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> > > >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> > > >                     AmlLevelAndEdge level_and_edge,
> > > >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > > > -                   uint32_t irq)
> > > > +                   uint32_t *irq_list, uint8_t irq_count)
> > > 
> > > const uint32_t *irq_list?
> > will do it on top as it's in master by now.
> > 
> > > 
> > > >  {
> > > > +    int i;
> > > >      Aml *var = aml_alloc();
> > > >      uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
> > > >                          | (high_and_low << 2) | (shared << 3);
> > > > +    const int header_bytes_in_len = 2;
> > > > +    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
> > > > +
> > > > +    assert(irq_count > 0);
> > > >  
> > > >      build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
> > > > -    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
> > > > -    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
> > > > +    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
> > > > +    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
> > > 
> > > build_append_int_noprefix ?
> > it will do job to, though I'd prefer it by byte as it exactly matches
> > table description in spec.
> 
> ok then, it's not a big deal.
> 
> > > 
> > > Which really needs a better name btw.
> > I'd like to get rid of long build_append_ prefix but would like to
> > keep aml_ one only for ASL constructs.
> > How about 'acpi_int(Aml*, val, sz)' replacing both 'build_append_int[_noprefix]()'
> > where if sz == 0 do what build_append_int() does.
> 
> We can't drop GArray things yet - I want acpi tables to be
> built like this and get rid of structs.
it doesn't have to be Aml* it could be Garray*
the point were to have single build_append_int() which does prefix/noprefix job
but that might be confusing and easy to misuse, so scratch that off.

> 
> > same name suggestion goes for byte:
> >   s/build_append_byte/acpi_byte/
> 
> I prefer append in there. byte implies it returns byte.
> 
> build_append_bytes?
'bytes' doesn't imply any encoding rules, while build_append_int_noprefix
implies ACPI integer encoding and that was whole point of adding it
so user whon't have to care about endianness.

> 
> > > 
> > > 
> > > 
> > > >      build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
> > > > -    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
> > > > +    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
> > > >  
> > > > -    /* Interrupt Number */
> > > > -    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
> > > > -    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
> > > > -    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
> > > > -    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
> > > > +    /* Interrupt Number List */
> > > > +    for (i = 0; i < irq_count; i++) {
> > > > +        build_append_int_noprefix(var->buf, irq_list[i], 4);
> > > > +    }
> > > >      return var;
> > > >  }
> > > >  
> > > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > > > index 698b5f2..02ba822 100644
> > > > --- a/hw/arm/virt-acpi-build.c
> > > > +++ b/hw/arm/virt-acpi-build.c
> > > > @@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
> > > >  }
> > > >  
> > > >  static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > > -                                           int uart_irq)
> > > > +                                           uint32_t uart_irq)
> > > >  {
> > > >      Aml *dev = aml_device("COM0");
> > > >      aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
> > > > @@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > >                                         uart_memmap->size, AML_READ_WRITE));
> > > >      aml_append(crs,
> > > >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > -                             AML_EXCLUSIVE, uart_irq));
> > > > +                             AML_EXCLUSIVE, &uart_irq, 1));
> > > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > > >  
> > > >      /* The _ADR entry is used to link this device to the UART described
> > > > @@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > >  }
> > > >  
> > > >  static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > > > -                                          int rtc_irq)
> > > > +                                          uint32_t rtc_irq)
> > > >  {
> > > >      Aml *dev = aml_device("RTC0");
> > > >      aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
> > > > @@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > > >                                         rtc_memmap->size, AML_READ_WRITE));
> > > >      aml_append(crs,
> > > >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > -                             AML_EXCLUSIVE, rtc_irq));
> > > > +                             AML_EXCLUSIVE, &rtc_irq, 1));
> > > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > > >      aml_append(scope, dev);
> > > >  }
> > > > @@ -136,11 +136,11 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
> > > >  
> > > >  static void acpi_dsdt_add_virtio(Aml *scope,
> > > >                                   const MemMapEntry *virtio_mmio_memmap,
> > > > -                                 int mmio_irq, int num)
> > > > +                                 uint32_t mmio_irq, int num)
> > > >  {
> > > >      hwaddr base = virtio_mmio_memmap->base;
> > > >      hwaddr size = virtio_mmio_memmap->size;
> > > > -    int irq = mmio_irq;
> > > > +    uint32_t irq = mmio_irq;
> > > >      int i;
> > > >  
> > > >      for (i = 0; i < num; i++) {
> > > > @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
> > > >          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
> > > >          aml_append(crs,
> > > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > -                                 AML_EXCLUSIVE, irq + i));
> > > > +                                 AML_EXCLUSIVE, &irq, 1));
> > > >          aml_append(dev, aml_name_decl("_CRS", crs));
> > > >          aml_append(scope, dev);
> > > >          base += size;
> > > >      }
> > > >  }
> > > >  
> > > > -static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > > > -                              bool use_highmem)
> > > > +static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
> > > > +                              uint32_t irq, bool use_highmem)
> > > >  {
> > > >      Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
> > > >      int i, bus_no;
> > > > @@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > > >  
> > > >      /* Create GSI link device */
> > > >      for (i = 0; i < PCI_NUM_PINS; i++) {
> > > > +        uint32_t irqs =  irq + i;
> > > >          Aml *dev_gsi = aml_device("GSI%d", i);
> > > >          aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
> > > >          aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
> > > >          crs = aml_resource_template();
> > > >          aml_append(crs,
> > > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > -                                 AML_EXCLUSIVE, irq + i));
> > > > +                                 AML_EXCLUSIVE, &irqs, 1));
> > > >          aml_append(dev_gsi, aml_name_decl("_PRS", crs));
> > > >          crs = aml_resource_template();
> > > >          aml_append(crs,
> > > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > -                                 AML_EXCLUSIVE, irq + i));
> > > > +                                 AML_EXCLUSIVE, &irqs, 1));
> > > >          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
> > > >          method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
> > > >          aml_append(dev_gsi, method);
> > > > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> > > > index ca365c9..a3a058f 100644
> > > > --- a/include/hw/acpi/aml-build.h
> > > > +++ b/include/hw/acpi/aml-build.h
> > > > @@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> > > >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> > > >                     AmlLevelAndEdge level_and_edge,
> > > >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > > > -                   uint32_t irq);
> > > > +                   uint32_t *irq_list, uint8_t irq_count);
> > > >  Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
> > > >              uint8_t aln, uint8_t len);
> > > >  Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
> > > > -- 
> > > > 1.8.3.1
> > > > 

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-22 16:18       ` Michael S. Tsirkin
@ 2015-12-22 16:36         ` Igor Mammedov
  0 siblings, 0 replies; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 16:36 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Tue, 22 Dec 2015 18:18:53 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Dec 22, 2015 at 04:54:06PM +0100, Igor Mammedov wrote:
> > On Tue, 22 Dec 2015 17:28:42 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > > On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > ---
> > > >  tests/bios-tables-test.c | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > > 
> > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > > index 6d37332..50678b5 100644
> > > > --- a/tests/bios-tables-test.c
> > > > +++ b/tests/bios-tables-test.c
> > > > @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
> > > >                          (gchar *)&signature,
> > > >                          sdt->asl_file, sdt->aml_file,
> > > >                          exp_sdt->asl_file, exp_sdt->aml_file);
> > > > +                if (getenv("V")) {
> > > 
> > > How do you test? make check V=1?
> > yep
> >  make V=1 check
> > 
> > > 
> > > > +                    int ret G_GNUC_UNUSED;
> > > > +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> > > > +                        exp_sdt->asl_file, sdt->asl_file);
> > > 
> > > This assumes running under git which is generally wrong e.g.
> > > people build from tarballs.
> > > git is also not a build dependency.
> > usually only developers use V=1 as they care about verbose output
> > and they probably use/have git so it doesn't have to builddep,
> > if they don't they won't get any useful output here.
> > 
> > my choice of 'git diff' was dictated by the fact that
> > it produces nice colored diff of ASL while usual diff doesn't.
> > And that helps a lot (to me) as that diff is intended
> > for human consumption.
> 
> Well for one, I want make check to pass before
> I commit a new expected, not afterwards.
'make check' and even 'make V=1 check' passes fine
the point of this patch is to show user difference
if there is any and one doesn't need to commit
new expected if there aren't any changes
(i.e. make check passes without diff/warning)

> Add another variable to specify which diff to use,
> install colordiff and use that.
adding variable could work however it reduces usability
as user will have to be aware of it and has to set it,
I'll probably forget it and will have to dig it out every
time it's needed.

maybe if V=1 try
  1. 'git diff' first if not
  2. fallback to 'diff' if not
  3. print warning to install git or diff

> 
> > > 
> > > 
> > > > +                    ret = system(diff) ;
> > > > +                    g_free(diff);
> > > > +                }
> > > >            }
> > > >          }
> > > >          g_string_free(asl, true);
> > > > -- 
> > > > 1.8.3.1
> > > > 

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

* Re: [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs
  2015-12-22 16:19         ` Igor Mammedov
@ 2015-12-22 16:43           ` Michael S. Tsirkin
  0 siblings, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 16:43 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-arm, qemu-devel, zhaoshenglong

On Tue, Dec 22, 2015 at 05:19:02PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 17:58:41 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Tue, Dec 22, 2015 at 04:37:11PM +0100, Igor Mammedov wrote:
> > > On Tue, 22 Dec 2015 17:17:33 +0200
> > > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > 
> > > > On Thu, Dec 10, 2015 at 12:41:18AM +0100, Igor Mammedov wrote:
> > > > > ASL Interrupt() macro translates to Extended Interrupt Descriptor
> > > > > which supports variable number of IRQs. It will be used for
> > > > > conversion of ASL code for pc/q35 machines that use it for
> > > > > returning several IRQs in _PSR object.
> > > > > 
> > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > ---
> > > > > CC: zhaoshenglong@huawei.com
> > > > > CC: qemu-arm@nongnu.org
> > > > > ---
> > > > >  hw/acpi/aml-build.c         | 22 +++++++++++++---------
> > > > >  hw/arm/virt-acpi-build.c    | 23 ++++++++++++-----------
> > > > >  include/hw/acpi/aml-build.h |  2 +-
> > > > >  3 files changed, 26 insertions(+), 21 deletions(-)
> > > > > 
> > > > > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > > > > index 2ca9207..ee64d12 100644
> > > > > --- a/hw/acpi/aml-build.c
> > > > > +++ b/hw/acpi/aml-build.c
> > > > > @@ -667,23 +667,27 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> > > > >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> > > > >                     AmlLevelAndEdge level_and_edge,
> > > > >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > > > > -                   uint32_t irq)
> > > > > +                   uint32_t *irq_list, uint8_t irq_count)
> > > > 
> > > > const uint32_t *irq_list?
> > > will do it on top as it's in master by now.
> > > 
> > > > 
> > > > >  {
> > > > > +    int i;
> > > > >      Aml *var = aml_alloc();
> > > > >      uint8_t irq_flags = con_and_pro | (level_and_edge << 1)
> > > > >                          | (high_and_low << 2) | (shared << 3);
> > > > > +    const int header_bytes_in_len = 2;
> > > > > +    uint16_t len = header_bytes_in_len + irq_count * sizeof(uint32_t);
> > > > > +
> > > > > +    assert(irq_count > 0);
> > > > >  
> > > > >      build_append_byte(var->buf, 0x89); /* Extended irq descriptor */
> > > > > -    build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */
> > > > > -    build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */
> > > > > +    build_append_byte(var->buf, len & 0xFF); /* Length, bits[7:0] */
> > > > > +    build_append_byte(var->buf, len >> 8); /* Length, bits[15:8] */
> > > > 
> > > > build_append_int_noprefix ?
> > > it will do job to, though I'd prefer it by byte as it exactly matches
> > > table description in spec.
> > 
> > ok then, it's not a big deal.
> > 
> > > > 
> > > > Which really needs a better name btw.
> > > I'd like to get rid of long build_append_ prefix but would like to
> > > keep aml_ one only for ASL constructs.
> > > How about 'acpi_int(Aml*, val, sz)' replacing both 'build_append_int[_noprefix]()'
> > > where if sz == 0 do what build_append_int() does.
> > 
> > We can't drop GArray things yet - I want acpi tables to be
> > built like this and get rid of structs.
> it doesn't have to be Aml* it could be Garray*
> the point were to have single build_append_int() which does prefix/noprefix job
> but that might be confusing and easy to misuse, so scratch that off.
> 
> > 
> > > same name suggestion goes for byte:
> > >   s/build_append_byte/acpi_byte/
> > 
> > I prefer append in there. byte implies it returns byte.
> > 
> > build_append_bytes?
> 'bytes' doesn't imply any encoding rules, while build_append_int_noprefix
> implies ACPI integer encoding and that was whole point of adding it
> so user whon't have to care about endianness.

No - it's not integer encoding. It's merely LE (as most of ACPI).
We are adding integer byte by byte, not encoding it.

> > 
> > > > 
> > > > 
> > > > 
> > > > >      build_append_byte(var->buf, irq_flags); /* Interrupt Vector Information. */
> > > > > -    build_append_byte(var->buf, 0x01);      /* Interrupt table length = 1 */
> > > > > +    build_append_byte(var->buf, irq_count);   /* Interrupt table length */
> > > > >  
> > > > > -    /* Interrupt Number */
> > > > > -    build_append_byte(var->buf, extract32(irq, 0, 8));  /* bits[7:0] */
> > > > > -    build_append_byte(var->buf, extract32(irq, 8, 8));  /* bits[15:8] */
> > > > > -    build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */
> > > > > -    build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */
> > > > > +    /* Interrupt Number List */
> > > > > +    for (i = 0; i < irq_count; i++) {
> > > > > +        build_append_int_noprefix(var->buf, irq_list[i], 4);
> > > > > +    }
> > > > >      return var;
> > > > >  }
> > > > >  
> > > > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > > > > index 698b5f2..02ba822 100644
> > > > > --- a/hw/arm/virt-acpi-build.c
> > > > > +++ b/hw/arm/virt-acpi-build.c
> > > > > @@ -71,7 +71,7 @@ static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
> > > > >  }
> > > > >  
> > > > >  static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > > > -                                           int uart_irq)
> > > > > +                                           uint32_t uart_irq)
> > > > >  {
> > > > >      Aml *dev = aml_device("COM0");
> > > > >      aml_append(dev, aml_name_decl("_HID", aml_string("ARMH0011")));
> > > > > @@ -82,7 +82,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > > >                                         uart_memmap->size, AML_READ_WRITE));
> > > > >      aml_append(crs,
> > > > >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > > -                             AML_EXCLUSIVE, uart_irq));
> > > > > +                             AML_EXCLUSIVE, &uart_irq, 1));
> > > > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > > > >  
> > > > >      /* The _ADR entry is used to link this device to the UART described
> > > > > @@ -94,7 +94,7 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
> > > > >  }
> > > > >  
> > > > >  static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > > > > -                                          int rtc_irq)
> > > > > +                                          uint32_t rtc_irq)
> > > > >  {
> > > > >      Aml *dev = aml_device("RTC0");
> > > > >      aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013")));
> > > > > @@ -105,7 +105,7 @@ static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap,
> > > > >                                         rtc_memmap->size, AML_READ_WRITE));
> > > > >      aml_append(crs,
> > > > >                 aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > > -                             AML_EXCLUSIVE, rtc_irq));
> > > > > +                             AML_EXCLUSIVE, &rtc_irq, 1));
> > > > >      aml_append(dev, aml_name_decl("_CRS", crs));
> > > > >      aml_append(scope, dev);
> > > > >  }
> > > > > @@ -136,11 +136,11 @@ static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap)
> > > > >  
> > > > >  static void acpi_dsdt_add_virtio(Aml *scope,
> > > > >                                   const MemMapEntry *virtio_mmio_memmap,
> > > > > -                                 int mmio_irq, int num)
> > > > > +                                 uint32_t mmio_irq, int num)
> > > > >  {
> > > > >      hwaddr base = virtio_mmio_memmap->base;
> > > > >      hwaddr size = virtio_mmio_memmap->size;
> > > > > -    int irq = mmio_irq;
> > > > > +    uint32_t irq = mmio_irq;
> > > > >      int i;
> > > > >  
> > > > >      for (i = 0; i < num; i++) {
> > > > > @@ -152,15 +152,15 @@ static void acpi_dsdt_add_virtio(Aml *scope,
> > > > >          aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE));
> > > > >          aml_append(crs,
> > > > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > > -                                 AML_EXCLUSIVE, irq + i));
> > > > > +                                 AML_EXCLUSIVE, &irq, 1));
> > > > >          aml_append(dev, aml_name_decl("_CRS", crs));
> > > > >          aml_append(scope, dev);
> > > > >          base += size;
> > > > >      }
> > > > >  }
> > > > >  
> > > > > -static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > > > > -                              bool use_highmem)
> > > > > +static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
> > > > > +                              uint32_t irq, bool use_highmem)
> > > > >  {
> > > > >      Aml *method, *crs, *ifctx, *UUID, *ifctx1, *elsectx, *buf;
> > > > >      int i, bus_no;
> > > > > @@ -199,18 +199,19 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq,
> > > > >  
> > > > >      /* Create GSI link device */
> > > > >      for (i = 0; i < PCI_NUM_PINS; i++) {
> > > > > +        uint32_t irqs =  irq + i;
> > > > >          Aml *dev_gsi = aml_device("GSI%d", i);
> > > > >          aml_append(dev_gsi, aml_name_decl("_HID", aml_string("PNP0C0F")));
> > > > >          aml_append(dev_gsi, aml_name_decl("_UID", aml_int(0)));
> > > > >          crs = aml_resource_template();
> > > > >          aml_append(crs,
> > > > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > > -                                 AML_EXCLUSIVE, irq + i));
> > > > > +                                 AML_EXCLUSIVE, &irqs, 1));
> > > > >          aml_append(dev_gsi, aml_name_decl("_PRS", crs));
> > > > >          crs = aml_resource_template();
> > > > >          aml_append(crs,
> > > > >                     aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
> > > > > -                                 AML_EXCLUSIVE, irq + i));
> > > > > +                                 AML_EXCLUSIVE, &irqs, 1));
> > > > >          aml_append(dev_gsi, aml_name_decl("_CRS", crs));
> > > > >          method = aml_method("_SRS", 1, AML_NOTSERIALIZED);
> > > > >          aml_append(dev_gsi, method);
> > > > > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> > > > > index ca365c9..a3a058f 100644
> > > > > --- a/include/hw/acpi/aml-build.h
> > > > > +++ b/include/hw/acpi/aml-build.h
> > > > > @@ -253,7 +253,7 @@ Aml *aml_memory32_fixed(uint32_t addr, uint32_t size,
> > > > >  Aml *aml_interrupt(AmlConsumerAndProducer con_and_pro,
> > > > >                     AmlLevelAndEdge level_and_edge,
> > > > >                     AmlActiveHighAndLow high_and_low, AmlShared shared,
> > > > > -                   uint32_t irq);
> > > > > +                   uint32_t *irq_list, uint8_t irq_count);
> > > > >  Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
> > > > >              uint8_t aln, uint8_t len);
> > > > >  Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
> > > > > -- 
> > > > > 1.8.3.1
> > > > > 

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-22 15:54     ` Igor Mammedov
  2015-12-22 16:18       ` Michael S. Tsirkin
@ 2015-12-22 16:59       ` Michael S. Tsirkin
  2015-12-22 17:22         ` Igor Mammedov
  1 sibling, 1 reply; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 16:59 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Tue, Dec 22, 2015 at 04:54:06PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 17:28:42 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > >  tests/bios-tables-test.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > index 6d37332..50678b5 100644
> > > --- a/tests/bios-tables-test.c
> > > +++ b/tests/bios-tables-test.c
> > > @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
> > >                          (gchar *)&signature,
> > >                          sdt->asl_file, sdt->aml_file,
> > >                          exp_sdt->asl_file, exp_sdt->aml_file);
> > > +                if (getenv("V")) {
> > 
> > How do you test? make check V=1?
> yep
>  make V=1 check
> 
> > 
> > > +                    int ret G_GNUC_UNUSED;
> > > +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> > > +                        exp_sdt->asl_file, sdt->asl_file);
> > 
> > This assumes running under git which is generally wrong e.g.
> > people build from tarballs.
> > git is also not a build dependency.
> usually only developers use V=1 as they care about verbose output
> and they probably use/have git so it doesn't have to builddep,
> if they don't they won't get any useful output here.
> 
> my choice of 'git diff' was dictated by the fact that
> it produces nice colored diff of ASL while usual diff doesn't.
> And that helps a lot (to me) as that diff is intended
> for human consumption.

I just do vimdiff on the two files it prints.
Not sure all this is worth it.

> > 
> > 
> > > +                    ret = system(diff) ;
> > > +                    g_free(diff);
> > > +                }
> > >            }
> > >          }
> > >          g_string_free(asl, true);
> > > -- 
> > > 1.8.3.1
> > > 

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-22 16:59       ` Michael S. Tsirkin
@ 2015-12-22 17:22         ` Igor Mammedov
  2015-12-22 19:05           ` Michael S. Tsirkin
  0 siblings, 1 reply; 165+ messages in thread
From: Igor Mammedov @ 2015-12-22 17:22 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Tue, 22 Dec 2015 18:59:30 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Dec 22, 2015 at 04:54:06PM +0100, Igor Mammedov wrote:
> > On Tue, 22 Dec 2015 17:28:42 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > > On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > ---
> > > >  tests/bios-tables-test.c | 7 +++++++
> > > >  1 file changed, 7 insertions(+)
> > > > 
> > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > > index 6d37332..50678b5 100644
> > > > --- a/tests/bios-tables-test.c
> > > > +++ b/tests/bios-tables-test.c
> > > > @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
> > > >                          (gchar *)&signature,
> > > >                          sdt->asl_file, sdt->aml_file,
> > > >                          exp_sdt->asl_file, exp_sdt->aml_file);
> > > > +                if (getenv("V")) {
> > > 
> > > How do you test? make check V=1?
> > yep
> >  make V=1 check
> > 
> > > 
> > > > +                    int ret G_GNUC_UNUSED;
> > > > +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> > > > +                        exp_sdt->asl_file, sdt->asl_file);
> > > 
> > > This assumes running under git which is generally wrong e.g.
> > > people build from tarballs.
> > > git is also not a build dependency.
> > usually only developers use V=1 as they care about verbose output
> > and they probably use/have git so it doesn't have to builddep,
> > if they don't they won't get any useful output here.
> > 
> > my choice of 'git diff' was dictated by the fact that
> > it produces nice colored diff of ASL while usual diff doesn't.
> > And that helps a lot (to me) as that diff is intended
> > for human consumption.
> 
> I just do vimdiff on the two files it prints.
> Not sure all this is worth it.
yep, it's something that I was doing manually as well,
but after 50th or so times it was taking too much time,
hence a patch that saves my and hopefully others time.

Alternative solution if V=1:
 1. use variable to specify diff command
 2. if variable is not defined, print warning to set it

that way user will be informed about diff option when
'make V=1 check' is run and diff is not specified.

> 
> > > 
> > > 
> > > > +                    ret = system(diff) ;
> > > > +                    g_free(diff);
> > > > +                }
> > > >            }
> > > >          }
> > > >          g_string_free(asl, true);
> > > > -- 
> > > > 1.8.3.1
> > > > 

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

* Re: [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode
  2015-12-22 17:22         ` Igor Mammedov
@ 2015-12-22 19:05           ` Michael S. Tsirkin
  0 siblings, 0 replies; 165+ messages in thread
From: Michael S. Tsirkin @ 2015-12-22 19:05 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Tue, Dec 22, 2015 at 06:22:08PM +0100, Igor Mammedov wrote:
> On Tue, 22 Dec 2015 18:59:30 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Tue, Dec 22, 2015 at 04:54:06PM +0100, Igor Mammedov wrote:
> > > On Tue, 22 Dec 2015 17:28:42 +0200
> > > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > 
> > > > On Thu, Dec 10, 2015 at 12:40:55AM +0100, Igor Mammedov wrote:
> > > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > > > ---
> > > > >  tests/bios-tables-test.c | 7 +++++++
> > > > >  1 file changed, 7 insertions(+)
> > > > > 
> > > > > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > > > > index 6d37332..50678b5 100644
> > > > > --- a/tests/bios-tables-test.c
> > > > > +++ b/tests/bios-tables-test.c
> > > > > @@ -580,6 +580,13 @@ static void test_acpi_asl(test_data *data)
> > > > >                          (gchar *)&signature,
> > > > >                          sdt->asl_file, sdt->aml_file,
> > > > >                          exp_sdt->asl_file, exp_sdt->aml_file);
> > > > > +                if (getenv("V")) {
> > > > 
> > > > How do you test? make check V=1?
> > > yep
> > >  make V=1 check
> > > 
> > > > 
> > > > > +                    int ret G_GNUC_UNUSED;
> > > > > +                    char *diff = g_strdup_printf("git diff --exit-code %s %s",
> > > > > +                        exp_sdt->asl_file, sdt->asl_file);
> > > > 
> > > > This assumes running under git which is generally wrong e.g.
> > > > people build from tarballs.
> > > > git is also not a build dependency.
> > > usually only developers use V=1 as they care about verbose output
> > > and they probably use/have git so it doesn't have to builddep,
> > > if they don't they won't get any useful output here.
> > > 
> > > my choice of 'git diff' was dictated by the fact that
> > > it produces nice colored diff of ASL while usual diff doesn't.
> > > And that helps a lot (to me) as that diff is intended
> > > for human consumption.
> > 
> > I just do vimdiff on the two files it prints.
> > Not sure all this is worth it.
> yep, it's something that I was doing manually as well,
> but after 50th or so times it was taking too much time,
> hence a patch that saves my and hopefully others time.
> Alternative solution if V=1:
>  1. use variable to specify diff command
>  2. if variable is not defined, print warning to set it
> 
> that way user will be informed about diff option when
> 'make V=1 check' is run and diff is not specified.

OK.

> > 
> > > > 
> > > > 
> > > > > +                    ret = system(diff) ;
> > > > > +                    g_free(diff);
> > > > > +                }
> > > > >            }
> > > > >          }
> > > > >          g_string_free(asl, true);
> > > > > -- 
> > > > > 1.8.3.1
> > > > > 

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

end of thread, other threads:[~2015-12-22 19:06 UTC | newest]

Thread overview: 165+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
2015-12-10 12:50   ` Marcel Apfelbaum
2015-12-22 15:28   ` Michael S. Tsirkin
2015-12-22 15:54     ` Igor Mammedov
2015-12-22 16:18       ` Michael S. Tsirkin
2015-12-22 16:36         ` Igor Mammedov
2015-12-22 16:59       ` Michael S. Tsirkin
2015-12-22 17:22         ` Igor Mammedov
2015-12-22 19:05           ` Michael S. Tsirkin
2015-12-09 23:40 ` [Qemu-devel] [PATCH 02/74] acpi: add aml_derefof Igor Mammedov
2015-12-09 23:40 ` [Qemu-devel] [PATCH 03/74] acpi: add aml_sizeof Igor Mammedov
2015-12-09 23:40 ` [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal() Igor Mammedov
2015-12-10 12:52   ` Marcel Apfelbaum
2015-12-11  2:39   ` Shannon Zhao
2015-12-09 23:40 ` [Qemu-devel] [PATCH 05/74] acpi: add aml_mutex(), aml_acquire(), aml_release() Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field() Igor Mammedov
2015-12-10 12:53   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
2015-12-10  1:59   ` Shannon Zhao
2015-12-10 11:08     ` Igor Mammedov
2015-12-10 13:12   ` Marcel Apfelbaum
2015-12-11  2:36   ` Shannon Zhao
2015-12-09 23:41 ` [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument Igor Mammedov
2015-12-10 12:59   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract() Igor Mammedov
2015-12-10 13:01   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper Igor Mammedov
2015-12-10 13:04   ` Marcel Apfelbaum
2015-12-10 13:41     ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer() Igor Mammedov
2015-12-10 13:05   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument Igor Mammedov
2015-12-10 13:08   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 13/74] acpi: add aml_alias() Igor Mammedov
2015-12-10 13:13   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep() Igor Mammedov
2015-12-10 13:14   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 15/74] acpi: support serialized method Igor Mammedov
2015-12-11  2:58   ` Shannon Zhao
2015-12-09 23:41 ` [Qemu-devel] [PATCH 16/74] acpi: add aml_lor() Igor Mammedov
2015-12-10 13:25   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater() Igor Mammedov
2015-12-10 13:26   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 18/74] acpi: extend aml_field() to support LockRule Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring() Igor Mammedov
2015-12-10 13:41   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer() Igor Mammedov
2015-12-10 13:42   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 21/74] acpi add aml_dma() Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument Igor Mammedov
2015-12-10 13:43   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() " Igor Mammedov
2015-12-10  2:07   ` Shannon Zhao
2015-12-10 11:16     ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs Igor Mammedov
2015-12-10  1:50   ` Shannon Zhao
2015-12-10 11:34     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2015-12-11  1:51       ` Shannon Zhao
2015-12-22 15:17   ` [Qemu-devel] [PATCH " Michael S. Tsirkin
2015-12-22 15:37     ` Igor Mammedov
2015-12-22 15:58       ` Michael S. Tsirkin
2015-12-22 16:19         ` Igor Mammedov
2015-12-22 16:43           ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Igor Mammedov
2015-12-10 12:45   ` Marcel Apfelbaum
2015-12-10 13:43     ` Igor Mammedov
2015-12-16 13:25   ` Marcel Apfelbaum
2015-12-16 14:25     ` Igor Mammedov
2015-12-17 12:14       ` Marcel Apfelbaum
2015-12-17 13:47         ` Igor Mammedov
2015-12-17 14:12           ` Marcel Apfelbaum
2015-12-17 16:59             ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT Igor Mammedov
2015-12-16 12:08   ` Marcel Apfelbaum
2015-12-16 14:30     ` Igor Mammedov
2015-12-16 14:47   ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2015-12-20 10:32     ` Marcel Apfelbaum
2015-12-20 13:41     ` Michael S. Tsirkin
2015-12-21 10:52       ` Igor Mammedov
2015-12-21 17:31       ` Igor Mammedov
2015-12-22 15:11         ` Michael S. Tsirkin
2015-12-22 15:45           ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 27/74] pc: acpi: memhp: move MHPD.MLCK mutex " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 28/74] pc: acpi: memhp: move MHPD.MSCN method " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 29/74] pc: acpi: memhp: move MHPD.MRST " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 30/74] pc: acpi: memhp: move MHPD.MPXM " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 31/74] pc: acpi: memhp: move MHPD.MOST " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 32/74] pc: acpi: memhp: move MHPD.MEJ0 " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 33/74] pc: acpi: memhp: move MHPD.MCRS " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 34/74] pc: acpi: memhp: move MHPD Device " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function Igor Mammedov
2015-12-19 20:18   ` Michael S. Tsirkin
2015-12-21 11:01     ` Igor Mammedov
2015-12-21 11:38       ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 36/74] pc: acpi: memhp: move \_GPE._E03 into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 37/74] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 38/74] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 39/74] pc: acpi: cpuhp: move CPEJ() method to SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 40/74] pc: acpi: cpuhp: move CPMA() method into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 41/74] pc: acpi: cpuhp: move CPST() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 42/74] pc: acpi: cpuhp: move PRSC() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 43/74] pc: acpi: cpuhp: move \_GPE._E02() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 44/74] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT Igor Mammedov
2015-12-19 19:50   ` Michael S. Tsirkin
2015-12-21 11:02     ` Igor Mammedov
2015-12-21 11:42       ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 46/74] pc: acpi: move DBUG() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 47/74] pc: acpi: move RTC device " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 48/74] pc: acpi: move KBD " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 49/74] pc: acpi: move MOU " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 " Igor Mammedov
2015-12-19 19:44   ` Michael S. Tsirkin
2015-12-21 12:42     ` Igor Mammedov
2015-12-21 12:54       ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 51/74] pc: acpi: move LPT " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 52/74] pc: acpi: move COM devices " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 53/74] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers " Igor Mammedov
2015-12-19 19:30   ` Michael S. Tsirkin
2015-12-19 20:34   ` Michael S. Tsirkin
2015-12-21 12:45     ` Igor Mammedov
2015-12-21 15:35     ` Igor Mammedov
2015-12-22  9:37       ` Michael S. Tsirkin
2015-12-22 14:38         ` Igor Mammedov
2015-12-22 14:47           ` Michael S. Tsirkin
2015-12-22 15:00             ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 55/74] pc: acpi: pci: move link devices " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 56/74] pc: acpi: piix4: move IQCR() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 57/74] pc: acpi: piix4: move IQST() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() " Igor Mammedov
2015-12-10 12:32   ` Marcel Apfelbaum
2015-12-10 13:50     ` Igor Mammedov
2015-12-10 16:17     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2015-12-13 15:19       ` Marcel Apfelbaum
2015-12-14 13:20         ` Igor Mammedov
2015-12-19 19:23       ` Michael S. Tsirkin
2015-12-21 12:55         ` Igor Mammedov
2015-12-22  9:34           ` Michael S. Tsirkin
2015-12-22 14:12             ` Igor Mammedov
2015-12-22 14:52               ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 59/74] pc: acpi: piix4: move remaining PCI hotplug bits " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 60/74] pc: acpi: piix4: acpi move PCI0 device to SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 61/74] pc: acpi: q35: move GSI links " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 62/74] pc: acpi: q35: move link devices " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 63/74] pc: acpi: q35: move IQCR() into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 64/74] pc: acpi: q35: move IQST() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 65/74] pc: acpi: q35: move ISA bridge " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 66/74] pc: acpi: q35: move _PRT() " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 67/74] pc: acpi: q35: move PRTA routing table " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 68/74] pc: acpi: q35: move PRTP " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 69/74] pc: acpi: q35: move _PIC() method " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 70/74] pc: acpi: q35: move PCI0._OSC() " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 71/74] pc: acpi: q35: move PCI0 device definition " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 72/74] pc: acpi: q35: PCST, PCSB opregions and PCIB field " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 73/74] pc: acpi: switch to AML API composed DSDT Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 74/74] pc: acpi: remove unused ASL templates and related blobs/utils Igor Mammedov
2015-12-10 15:53 ` [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Marcel Apfelbaum
2015-12-10 16:31   ` Igor Mammedov
2015-12-13 15:24     ` Marcel Apfelbaum
2015-12-10 16:44 ` Igor Mammedov
2015-12-19 20:38 ` Michael S. Tsirkin
2015-12-21 13:00   ` Igor Mammedov
2015-12-21 13:12     ` Shannon Zhao

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.