All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table
@ 2021-10-19  8:00 Eric Auger
  2021-10-19  8:00 ` [PATCH v5 1/3] tests/acpi: Add void table for virt/DBG2 bios-tables-test Eric Auger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Auger @ 2021-10-19  8:00 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, mst, imammedo, richard.henderson,
	philmd, peter.maydell, shannon.zhaosl, qemu-arm, qemu-devel,
	ardb, drjones
  Cc: gshan

This series generates the ACPI DBG2 table along with machvirt.

The DBG2 specification can be found at
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table.

DBG2 is mandated by ARM SBBR since its v1.0 release (the rationale
behind is Windows requires it on all systems).

The DBG2 is used to describe a debug port, used by the kernel debugger.

The series can be found at:
https://github.com/eauger/qemu.git
branch: dbg2_v5

History:

v4 -> v5:
- added Drew and Igor's R-b on patch 2.

v3 -> v4:
- fix revision in header (0)
- added Michael's R-b
- address 2 minor style issues (Drew, Igor)

v2 -> v3:
- addressed all comments from Igor on v2:
  patches 2/3 swapped
  style adjustments in "hw/arm/virt_acpi_build: Generate DBG2 table"
  + more precision on spec references

v1 -> v2:
- rebase on top of Igor's series and use acpi_init_table/acpi_table_composed
  and build_append_int_noprefix()


Eric Auger (3):
  tests/acpi: Add void table for virt/DBG2 bios-tables-test
  hw/arm/virt_acpi_build: Generate DBG2 table
  bios-tables-test: Generate reference table for virt/DBG2

 hw/arm/virt-acpi-build.c  |  63 +++++++++++++++++++++++++++++++++++++-
 tests/data/acpi/virt/DBG2 | Bin 0 -> 87 bytes
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 tests/data/acpi/virt/DBG2

-- 
2.26.3



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

* [PATCH v5 1/3] tests/acpi: Add void table for virt/DBG2 bios-tables-test
  2021-10-19  8:00 [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
@ 2021-10-19  8:00 ` Eric Auger
  2021-10-19  8:00 ` [PATCH v5 2/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Auger @ 2021-10-19  8:00 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, mst, imammedo, richard.henderson,
	philmd, peter.maydell, shannon.zhaosl, qemu-arm, qemu-devel,
	ardb, drjones
  Cc: gshan

Add placeholders for DBG2 reference table for
virt tests and ignore till reference blob is added.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/data/acpi/virt/DBG2                   | 0
 tests/qtest/bios-tables-test-allowed-diff.h | 1 +
 2 files changed, 1 insertion(+)
 create mode 100644 tests/data/acpi/virt/DBG2

diff --git a/tests/data/acpi/virt/DBG2 b/tests/data/acpi/virt/DBG2
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..1910d154c2 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,2 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/DBG2",
-- 
2.26.3



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

* [PATCH v5 2/3] hw/arm/virt_acpi_build: Generate DBG2 table
  2021-10-19  8:00 [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
  2021-10-19  8:00 ` [PATCH v5 1/3] tests/acpi: Add void table for virt/DBG2 bios-tables-test Eric Auger
@ 2021-10-19  8:00 ` Eric Auger
  2021-10-19  8:00 ` [PATCH v5 3/3] bios-tables-test: Generate reference table for virt/DBG2 Eric Auger
  2021-10-19 16:09 ` [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Auger @ 2021-10-19  8:00 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, mst, imammedo, richard.henderson,
	philmd, peter.maydell, shannon.zhaosl, qemu-arm, qemu-devel,
	ardb, drjones
  Cc: gshan

ARM SBBR specification mandates DBG2 table (Debug Port Table 2)
since v1.0 (ARM DEN0044F 8.3.1.7 DBG2).

The DBG2 table allows to describe one or more debug ports.

Generate an DBG2 table featuring a single debug port, the PL011.

The DBG2 specification can be found at
"Microsoft Debug Port Table 2 (DBG2)"
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table?redirectedfrom=MSDN

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/arm/virt-acpi-build.c | 63 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 6cec97352b..dd17a48c00 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -616,6 +616,64 @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     acpi_table_end(linker, &table);
 }
 
+/* Debug Port Table 2 (DBG2) */
+static void
+build_dbg2(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
+{
+    AcpiTable table = { .sig = "DBG2", .rev = 0, .oem_id = vms->oem_id,
+                        .oem_table_id = vms->oem_table_id };
+    int dbg2devicelength;
+    const char name[] = "COM0";
+    const int namespace_length = sizeof(name);
+
+    acpi_table_begin(&table, table_data);
+
+    dbg2devicelength = 22 + /* BaseAddressRegister[] offset */
+                       12 + /* BaseAddressRegister[] */
+                       4 + /* AddressSize[] */
+                       namespace_length /* NamespaceString[] */;
+
+    /* OffsetDbgDeviceInfo */
+    build_append_int_noprefix(table_data, 44, 4);
+    /* NumberDbgDeviceInfo */
+    build_append_int_noprefix(table_data, 1, 4);
+
+    /* Table 2. Debug Device Information structure format */
+    build_append_int_noprefix(table_data, 0, 1); /* Revision */
+    build_append_int_noprefix(table_data, dbg2devicelength, 2); /* Length */
+    /* NumberofGenericAddressRegisters */
+    build_append_int_noprefix(table_data, 1, 1);
+    /* NameSpaceStringLength */
+    build_append_int_noprefix(table_data, namespace_length, 2);
+    build_append_int_noprefix(table_data, 38, 2); /* NameSpaceStringOffset */
+    build_append_int_noprefix(table_data, 0, 2); /* OemDataLength */
+    /* OemDataOffset (0 means no OEM data) */
+    build_append_int_noprefix(table_data, 0, 2);
+
+    /* Port Type */
+    build_append_int_noprefix(table_data, 0x8000 /* Serial */, 2);
+    /* Port Subtype */
+    build_append_int_noprefix(table_data, 0x3 /* ARM PL011 UART */, 2);
+    build_append_int_noprefix(table_data, 0, 2); /* Reserved */
+    /* BaseAddressRegisterOffset */
+    build_append_int_noprefix(table_data, 22, 2);
+    /* AddressSizeOffset */
+    build_append_int_noprefix(table_data, 34, 2);
+
+    /* BaseAddressRegister[] */
+    build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 8, 0, 1,
+                     vms->memmap[VIRT_UART].base);
+
+    /* AddressSize[] */
+    build_append_int_noprefix(table_data,
+                              vms->memmap[VIRT_UART].size, 4);
+
+    /* NamespaceString[] */
+    g_array_append_vals(table_data, name, namespace_length);
+
+    acpi_table_end(linker, &table);
+};
+
 /*
  * ACPI spec, Revision 5.1 Errata A
  * 5.2.12 Multiple APIC Description Table (MADT)
@@ -875,7 +933,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
     dsdt = tables_blob->len;
     build_dsdt(tables_blob, tables->linker, vms);
 
-    /* FADT MADT GTDT MCFG SPCR pointed to by RSDT */
+    /* FADT MADT GTDT MCFG SPCR DBG2 pointed to by RSDT */
     acpi_add_table(table_offsets, tables_blob);
     build_fadt_rev5(tables_blob, tables->linker, vms, dsdt);
 
@@ -898,6 +956,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
     acpi_add_table(table_offsets, tables_blob);
     build_spcr(tables_blob, tables->linker, vms);
 
+    acpi_add_table(table_offsets, tables_blob);
+    build_dbg2(tables_blob, tables->linker, vms);
+
     if (vms->ras) {
         build_ghes_error_table(tables->hardware_errors, tables->linker);
         acpi_add_table(table_offsets, tables_blob);
-- 
2.26.3



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

* [PATCH v5 3/3] bios-tables-test: Generate reference table for virt/DBG2
  2021-10-19  8:00 [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
  2021-10-19  8:00 ` [PATCH v5 1/3] tests/acpi: Add void table for virt/DBG2 bios-tables-test Eric Auger
  2021-10-19  8:00 ` [PATCH v5 2/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
@ 2021-10-19  8:00 ` Eric Auger
  2021-10-19 16:09 ` [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Auger @ 2021-10-19  8:00 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, mst, imammedo, richard.henderson,
	philmd, peter.maydell, shannon.zhaosl, qemu-arm, qemu-devel,
	ardb, drjones
  Cc: gshan

Add the DBG2 table generated with
tests/data/acpi/rebuild-expected-aml.sh

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/data/acpi/virt/DBG2                   | Bin 0 -> 87 bytes
 tests/qtest/bios-tables-test-allowed-diff.h |   1 -
 2 files changed, 1 deletion(-)

diff --git a/tests/data/acpi/virt/DBG2 b/tests/data/acpi/virt/DBG2
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..86e6314f7b0235ef8ed3e0221e09f996c41f5e98 100644
GIT binary patch
literal 87
zcmZ>9ayJTR0D|*Q{>~o33QiFL&I&-l2owUbL9`AKgJ=eA21Zr}H4uw|p@A7lh%qQJ
TFmQk+Il-a=3=Gcxz6J~c3~mVl

literal 0
HcmV?d00001

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 1910d154c2..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,2 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/DBG2",
-- 
2.26.3



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

* Re: [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table
  2021-10-19  8:00 [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
                   ` (2 preceding siblings ...)
  2021-10-19  8:00 ` [PATCH v5 3/3] bios-tables-test: Generate reference table for virt/DBG2 Eric Auger
@ 2021-10-19 16:09 ` Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2021-10-19 16:09 UTC (permalink / raw)
  To: Eric Auger, eric.auger.pro, mst, imammedo, philmd, peter.maydell,
	shannon.zhaosl, qemu-arm, qemu-devel, ardb, drjones
  Cc: gshan

On 10/19/21 1:00 AM, Eric Auger wrote:
> This series generates the ACPI DBG2 table along with machvirt.
> 
> The DBG2 specification can be found at
> https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table.
> 
> DBG2 is mandated by ARM SBBR since its v1.0 release (the rationale
> behind is Windows requires it on all systems).
> 
> The DBG2 is used to describe a debug port, used by the kernel debugger.
> 
> The series can be found at:
> https://github.com/eauger/qemu.git
> branch: dbg2_v5
> 
> History:
> 
> v4 -> v5:
> - added Drew and Igor's R-b on patch 2.
> 
> v3 -> v4:
> - fix revision in header (0)
> - added Michael's R-b
> - address 2 minor style issues (Drew, Igor)
> 
> v2 -> v3:
> - addressed all comments from Igor on v2:
>    patches 2/3 swapped
>    style adjustments in "hw/arm/virt_acpi_build: Generate DBG2 table"
>    + more precision on spec references
> 
> v1 -> v2:
> - rebase on top of Igor's series and use acpi_init_table/acpi_table_composed
>    and build_append_int_noprefix()
> 
> 
> Eric Auger (3):
>    tests/acpi: Add void table for virt/DBG2 bios-tables-test
>    hw/arm/virt_acpi_build: Generate DBG2 table
>    bios-tables-test: Generate reference table for virt/DBG2
> 
>   hw/arm/virt-acpi-build.c  |  63 +++++++++++++++++++++++++++++++++++++-
>   tests/data/acpi/virt/DBG2 | Bin 0 -> 87 bytes
>   2 files changed, 62 insertions(+), 1 deletion(-)
>   create mode 100644 tests/data/acpi/virt/DBG2

Thanks, applied to target-arm.next.

r~



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

end of thread, other threads:[~2021-10-19 16:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  8:00 [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
2021-10-19  8:00 ` [PATCH v5 1/3] tests/acpi: Add void table for virt/DBG2 bios-tables-test Eric Auger
2021-10-19  8:00 ` [PATCH v5 2/3] hw/arm/virt_acpi_build: Generate DBG2 table Eric Auger
2021-10-19  8:00 ` [PATCH v5 3/3] bios-tables-test: Generate reference table for virt/DBG2 Eric Auger
2021-10-19 16:09 ` [PATCH v5 0/3] hw/arm/virt_acpi_build: Generate DBG2 table Richard Henderson

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.