Skip to contentSkip to conversation

virtio,acpi,pci: fixes, cleanups, tools.

GIT PULL Applied Michael S. Tsirkin 3 participants 23 messages Jun 24, 2020 – Jun 25, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit d4b78317b7cf8c0c635b70086503813f79ff21ec:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200623' into staging (2020-06-23 18:57:05 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to f6f746db6bae1ba74967fd7bea2bb5e169502948:

tests: disassemble-asm.sh: generate AML in readable format (2020-06-24 19:03:57 -0400)

----------------------------------------------------------------
virtio,acpi,pci: fixes, cleanups, tools.

Fixes, cleanups in ACPI, PCI, virtio.
A handy script for testing ACPI.

----------------------------------------------------------------
Ani Sinha (1):
Rename use_acpi_pci_hotplug to more appropriate use_acpi_hotplug_bridge

Eric Auger (3):
acpi: Some build_tpm2() code reshape arm/acpi: Add the TPM2.0 device under the DSDT docs/specs/tpm: ACPI boot now supported for TPM/ARM

Gerd Hoffmann (12):
qtest: allow DSDT acpi table changes
acpi: bios-tables-test: show more context on asl diffs
acpi: move aml builder code for floppy device
floppy: make isa_fdc_get_drive_max_chs static
floppy: move cmos_get_fd_drive_type() from pc
acpi: move aml builder code for i8042 (kbd+mouse) device
acpi: factor out fw_cfg_add_acpi_dsdt()
acpi: simplify build_isa_devices_aml()
acpi: drop serial/parallel enable bits from dsdt
acpi: drop build_piix4_pm()
acpi: q35: drop _SB.PCI0.ISA.LPCD opregion. tests/acpi: update expected data files

Michael S. Tsirkin (1):
tests: disassemble-asm.sh: generate AML in readable format

Raphael Norwitz (1):
Stop vhost-user sending uninitialized mmap_offsets

Thomas Huth (1):
tests/qtest/bios-tables: Only run the TPM test with CONFIG_TPM enabled

 hw/i386/fw_cfg.h                            |   1 +
 include/hw/acpi/acpi-defs.h                 |  18 ---
 include/hw/block/fdc.h                      |   3 +-
 include/hw/i386/pc.h                        |   1 -
 tests/qtest/bios-tables-test-allowed-diff.h |  18 +++
 hw/acpi/aml-build.c                         |  51 ++++---
 hw/acpi/piix4.c                             |  21 +--
 hw/arm/virt-acpi-build.c                    |  34 +++++
 hw/block/fdc.c                              | 111 ++++++++++++++-
 hw/i386/acpi-build.c                        | 210 +---------------------------
 hw/i386/fw_cfg.c                            |  28 ++++
 hw/i386/pc.c                                |  25 ----
 hw/input/pckbd.c                            |  31 ++++
 hw/virtio/vhost-user.c                      |  12 +-
 stubs/cmos.c                                |   7 +
 tests/qtest/bios-tables-test.c              |   8 +-
 docs/specs/tpm.rst                          |   2 -
 stubs/Makefile.objs                         |   1 +
 tests/data/acpi/disassemle-aml.sh           |  52 +++++++
 tests/data/acpi/pc/DSDT                     | Bin 5014 -> 4934 bytes
 tests/data/acpi/pc/DSDT.acpihmat            | Bin 6338 -> 6258 bytes
 tests/data/acpi/pc/DSDT.bridge              | Bin 6873 -> 6793 bytes
 tests/data/acpi/pc/DSDT.cphp                | Bin 5477 -> 5397 bytes
 tests/data/acpi/pc/DSDT.dimmpxm             | Bin 6667 -> 6587 bytes
 tests/data/acpi/pc/DSDT.ipmikcs             | Bin 5086 -> 5006 bytes
 tests/data/acpi/pc/DSDT.memhp               | Bin 6373 -> 6293 bytes
 tests/data/acpi/pc/DSDT.numamem             | Bin 5020 -> 4940 bytes
 tests/data/acpi/q35/DSDT                    | Bin 7752 -> 7678 bytes
 tests/data/acpi/q35/DSDT.acpihmat           | Bin 9076 -> 9002 bytes
 tests/data/acpi/q35/DSDT.bridge             | Bin 7769 -> 7695 bytes
 tests/data/acpi/q35/DSDT.cphp               | Bin 8215 -> 8141 bytes
 tests/data/acpi/q35/DSDT.dimmpxm            | Bin 9405 -> 9331 bytes
 tests/data/acpi/q35/DSDT.ipmibt             | Bin 7827 -> 7753 bytes
 tests/data/acpi/q35/DSDT.memhp              | Bin 9111 -> 9037 bytes
 tests/data/acpi/q35/DSDT.mmio64             | Bin 8882 -> 8808 bytes
 tests/data/acpi/q35/DSDT.numamem            | Bin 7758 -> 7684 bytes
 tests/data/acpi/q35/DSDT.tis                | Bin 8357 -> 8283 bytes
 37 files changed, 344 insertions(+), 290 deletions(-)
 create mode 100644 stubs/cmos.c
 create mode 100755 tests/data/acpi/disassemle-aml.sh
#1 lore raw

[PULL 02/19] acpi: bios-tables-test: show more context on asl diffs

From: Gerd Hoffmann <[email protected]>

Makes it easier to create good commit messages from the logs.

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/bios-tables-test.c +1 -1
index b482f76c03..c315156858 100644
@@ -469,7 +469,7 @@ static void test_acpi_asl(test_data *data)
                 fflush(stderr);
                 if (getenv("V")) {
                     const char *diff_env = getenv("DIFF");
-                    const char *diff_cmd = diff_env ? diff_env : "diff -u";
+                    const char *diff_cmd = diff_env ? diff_env : "diff -U 16";
                     char *diff = g_strdup_printf("%s %s %s", diff_cmd,
                                                  exp_sdt->asl_file, sdt->asl_file);
                     int out = dup(STDOUT_FILENO);
Signature · 1 line
MST
#2 lore raw

[PULL 03/19] acpi: move aml builder code for floppy device

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

DSDT change: isa device order changes in case MI1 (ipmi) is present.

Message-Id: <[email protected]>

---
 hw/block/fdc.c       | 83 ++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-build.c | 83 --------------------------------------------
 stubs/cmos.c         |  7 ++++
 stubs/Makefile.objs  |  1 +
 4 files changed, 91 insertions(+), 83 deletions(-)
 create mode 100644 stubs/cmos.c
hw/block/fdc.c +83 -0
index be0674e4aa..5244df6f91 100644
@@ -32,6 +32,8 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
+#include "hw/i386/pc.h"
+#include "hw/acpi/aml-build.h"
 #include "hw/irq.h"
 #include "hw/isa/isa.h"
 #include "hw/qdev-properties.h"
@@ -2768,6 +2770,85 @@ void isa_fdc_get_drive_max_chs(FloppyDriveType type,
     (*maxc)--;
 }
 
+static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
+{
+    Aml *dev, *fdi;
+    uint8_t maxc, maxh, maxs;
+
+    isa_fdc_get_drive_max_chs(type, &maxc, &maxh, &maxs);
+
+    dev = aml_device("FLP%c", 'A' + idx);
+
+    aml_append(dev, aml_name_decl("_ADR", aml_int(idx)));
+
+    fdi = aml_package(16);
+    aml_append(fdi, aml_int(idx));  /* Drive Number */
+    aml_append(fdi,
+        aml_int(cmos_get_fd_drive_type(type)));  /* Device Type */
+    /*
+     * the values below are the limits of the drive, and are thus independent
+     * of the inserted media
+     */
+    aml_append(fdi, aml_int(maxc));  /* Maximum Cylinder Number */
+    aml_append(fdi, aml_int(maxs));  /* Maximum Sector Number */
+    aml_append(fdi, aml_int(maxh));  /* Maximum Head Number */
+    /*
+     * SeaBIOS returns the below values for int 0x13 func 0x08 regardless of
+     * the drive type, so shall we
+     */
+    aml_append(fdi, aml_int(0xAF));  /* disk_specify_1 */
+    aml_append(fdi, aml_int(0x02));  /* disk_specify_2 */
+    aml_append(fdi, aml_int(0x25));  /* disk_motor_wait */
+    aml_append(fdi, aml_int(0x02));  /* disk_sector_siz */
+    aml_append(fdi, aml_int(0x12));  /* disk_eot */
+    aml_append(fdi, aml_int(0x1B));  /* disk_rw_gap */
+    aml_append(fdi, aml_int(0xFF));  /* disk_dtl */
+    aml_append(fdi, aml_int(0x6C));  /* disk_formt_gap */
+    aml_append(fdi, aml_int(0xF6));  /* disk_fill */
+    aml_append(fdi, aml_int(0x0F));  /* disk_head_sttl */
+    aml_append(fdi, aml_int(0x08));  /* disk_motor_strt */
+
+    aml_append(dev, aml_name_decl("_FDI", fdi));
+    return dev;
+}
+
+static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope)
+{
+    Aml *dev;
+    Aml *crs;
+    int i;
+
+#define ACPI_FDE_MAX_FD 4
+    uint32_t fde_buf[5] = {
+        0, 0, 0, 0,     /* presence of floppy drives #0 - #3 */
+        cpu_to_le32(2)  /* tape presence (2 == never present) */
+    };
+
+    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));
+
+    dev = aml_device("FDC0");
+    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0700")));
+    aml_append(dev, aml_name_decl("_CRS", crs));
+
+    for (i = 0; i < MIN(MAX_FD, ACPI_FDE_MAX_FD); i++) {
+        FloppyDriveType type = isa_fdc_get_drive_type(isadev, i);
+
+        if (type < FLOPPY_DRIVE_TYPE_NONE) {
+            fde_buf[i] = cpu_to_le32(1);  /* drive present */
+            aml_append(dev, build_fdinfo_aml(i, type));
+        }
+    }
+    aml_append(dev, aml_name_decl("_FDE",
+               aml_buffer(sizeof(fde_buf), (uint8_t *)fde_buf)));
+
+    aml_append(scope, dev);
+}
+
 static const VMStateDescription vmstate_isa_fdc ={
     .name = "fdc",
     .version_id = 2,
@@ -2801,11 +2882,13 @@ static Property isa_fdc_properties[] = {
 static void isabus_fdc_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ISADeviceClass *isa = ISA_DEVICE_CLASS(klass);
 
     dc->realize = isabus_fdc_realize;
     dc->fw_name = "fdc";
     dc->reset = fdctrl_external_reset_isa;
     dc->vmsd = &vmstate_isa_fdc;
+    isa->build_aml = fdc_isa_build_aml;
     device_class_set_props(dc, isa_fdc_properties);
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
 }
hw/i386/acpi-build.c +0 -83

101 lines not on this page · raw message

stubs/cmos.c new file +7 -0
new file mode 100644
index 0000000000..416cbe4055
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/i386/pc.h"
+
+int cmos_get_fd_drive_type(FloppyDriveType fd0)
+{
+    return 0;
+}
stubs/Makefile.objs +1 -0
index 28e48171d1..f32b9e47a3 100644
@@ -1,4 +1,5 @@
 stub-obj-y += blk-commit-all.o
+stub-obj-y += cmos.o
 stub-obj-y += cpu-get-clock.o
 stub-obj-y += cpu-get-icount.o
 stub-obj-y += dump.o
Signature · 1 line
MST
#3 lore raw

[PULL 01/19] qtest: allow DSDT acpi table changes

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test-allowed-diff.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +18 -0
index dfb8523c8b..8992f1f12b 100644
@@ -1 +1,19 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/pc/DSDT",
+"tests/data/acpi/pc/DSDT.acpihmat",
+"tests/data/acpi/pc/DSDT.bridge",
+"tests/data/acpi/pc/DSDT.cphp",
+"tests/data/acpi/pc/DSDT.dimmpxm",
+"tests/data/acpi/pc/DSDT.ipmikcs",
+"tests/data/acpi/pc/DSDT.memhp",
+"tests/data/acpi/pc/DSDT.numamem",
+"tests/data/acpi/q35/DSDT",
+"tests/data/acpi/q35/DSDT.acpihmat",
+"tests/data/acpi/q35/DSDT.bridge",
+"tests/data/acpi/q35/DSDT.cphp",
+"tests/data/acpi/q35/DSDT.dimmpxm",
+"tests/data/acpi/q35/DSDT.ipmibt",
+"tests/data/acpi/q35/DSDT.memhp",
+"tests/data/acpi/q35/DSDT.mmio64",
+"tests/data/acpi/q35/DSDT.numamem",
+"tests/data/acpi/q35/DSDT.tis",
Signature · 1 line
MST
#4 lore raw

[PULL 07/19] acpi: factor out fw_cfg_add_acpi_dsdt()

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

Add helper function to add fw_cfg device,
also move code to hw/i386/fw_cfg.c.

Message-Id: <[email protected]>

---
 hw/i386/fw_cfg.h     |  1 +
 hw/i386/acpi-build.c | 24 +-----------------------
 hw/i386/fw_cfg.c     | 28 ++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 23 deletions(-)
hw/i386/fw_cfg.h +1 -0
index 9e74278779..275f15c1c5 100644
@@ -25,5 +25,6 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,
                                uint16_t apic_id_limit);
 void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg);
 void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg);
+void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg);
 
 #endif
hw/i386/acpi-build.c +1 -23
index 13113e83df..19e9c298dc 100644
@@ -1802,30 +1802,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
 
     /* create fw_cfg node, unconditionally */
     {
-        /* when using port i/o, the 8-bit data register *always* overlaps
-         * with half of the 16-bit control register. Hence, the total size
-         * of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the
-         * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */
-        uint8_t io_size = object_property_get_bool(OBJECT(x86ms->fw_cfg),
-                                                   "dma_enabled", NULL) ?
-                          ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) :
-                          FW_CFG_CTL_SIZE;
-
         scope = aml_scope("\\_SB.PCI0");
-        dev = aml_device("FWCF");
-
-        aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002")));
-
-        /* 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, FW_CFG_IO_BASE, FW_CFG_IO_BASE, 0x01, io_size)
-        );
-        aml_append(dev, aml_name_decl("_CRS", crs));
-
-        aml_append(scope, dev);
+        fw_cfg_add_acpi_dsdt(scope, x86ms->fw_cfg);
         aml_append(dsdt, scope);
     }
 
hw/i386/fw_cfg.c +28 -0
index da60ada594..c55abfb01a 100644
@@ -15,6 +15,7 @@
 #include "qemu/osdep.h"
 #include "sysemu/numa.h"
 #include "hw/acpi/acpi.h"
+#include "hw/acpi/aml-build.h"
 #include "hw/firmware/smbios.h"
 #include "hw/i386/fw_cfg.h"
 #include "hw/timer/hpet.h"
@@ -179,3 +180,30 @@ void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg)
     *val = cpu_to_le64(feature_control_bits | FEATURE_CONTROL_LOCKED);
     fw_cfg_add_file(fw_cfg, "etc/msr_feature_control", val, sizeof(*val));
 }
+
+void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg)
+{
+    /*
+     * when using port i/o, the 8-bit data register *always* overlaps
+     * with half of the 16-bit control register. Hence, the total size
+     * of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the
+     * DMA control register is located at FW_CFG_DMA_IO_BASE + 4
+     */
+    Object *obj = OBJECT(fw_cfg);
+    uint8_t io_size = object_property_get_bool(obj, "dma_enabled", NULL) ?
+        ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) :
+        FW_CFG_CTL_SIZE;
+    Aml *dev = aml_device("FWCF");
+    Aml *crs = aml_resource_template();
+
+    aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002")));
+
+    /* device present, functioning, decoding, not shown in UI */
+    aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
+
+    aml_append(crs,
+        aml_io(AML_DECODE16, FW_CFG_IO_BASE, FW_CFG_IO_BASE, 0x01, io_size));
+
+    aml_append(dev, aml_name_decl("_CRS", crs));
+    aml_append(scope, dev);
+}
Signature · 1 line
MST
#5 lore raw

[PULL 04/19] floppy: make isa_fdc_get_drive_max_chs static

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

acpi aml generator needs this, but it is in floppy code now so we can make the function static.

Message-Id: <[email protected]>

---
 include/hw/block/fdc.h | 2 --
 hw/block/fdc.c         | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
include/hw/block/fdc.h +0 -2
index c15ff4c623..5d71cf9722 100644
@@ -16,7 +16,5 @@ void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
                        DriveInfo **fds, qemu_irq *fdc_tc);
 
 FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i);
-void isa_fdc_get_drive_max_chs(FloppyDriveType type,
-                               uint8_t *maxc, uint8_t *maxh, uint8_t *maxs);
 
 #endif
hw/block/fdc.c +2 -2
index 5244df6f91..f1da83f08e 100644
@@ -2747,8 +2747,8 @@ FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i)
     return isa->state.drives[i].drive;
 }
 
-void isa_fdc_get_drive_max_chs(FloppyDriveType type,
-                               uint8_t *maxc, uint8_t *maxh, uint8_t *maxs)
+static void isa_fdc_get_drive_max_chs(FloppyDriveType type, uint8_t *maxc,
+                                      uint8_t *maxh, uint8_t *maxs)
 {
     const FDFormat *fdf;
 
Signature · 1 line
MST
#6 lore raw

[PULL 05/19] floppy: move cmos_get_fd_drive_type() from pc

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

Message-Id: <[email protected]>

---
 include/hw/block/fdc.h |  1 +
 include/hw/i386/pc.h   |  1 -
 hw/block/fdc.c         | 26 +++++++++++++++++++++++++-
 hw/i386/pc.c           | 25 -------------------------
 4 files changed, 26 insertions(+), 27 deletions(-)
include/hw/block/fdc.h +1 -0
index 5d71cf9722..479cebc0a3 100644
@@ -16,5 +16,6 @@ void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
                        DriveInfo **fds, qemu_irq *fdc_tc);
 
 FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i);
+int cmos_get_fd_drive_type(FloppyDriveType fd0);
 
 #endif
include/hw/i386/pc.h +0 -1
index e6135c34d6..dce1273c7d 100644
@@ -178,7 +178,6 @@ typedef void (*cpu_set_smm_t)(int smm, void *arg);
 void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs);
 
 ISADevice *pc_find_fdc0(void);
-int cmos_get_fd_drive_type(FloppyDriveType fd0);
 
 /* port92.c */
 #define PORT92_A20_LINE "a20"
hw/block/fdc.c +25 -1
index f1da83f08e..4f0921298b 100644
@@ -32,7 +32,6 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
-#include "hw/i386/pc.h"
 #include "hw/acpi/aml-build.h"
 #include "hw/irq.h"
 #include "hw/isa/isa.h"
@@ -2812,6 +2811,31 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
     return dev;
 }
 
+int cmos_get_fd_drive_type(FloppyDriveType fd0)
+{
+    int val;
+
+    switch (fd0) {
+    case FLOPPY_DRIVE_TYPE_144:
+        /* 1.44 Mb 3"5 drive */
+        val = 4;
+        break;
+    case FLOPPY_DRIVE_TYPE_288:
+        /* 2.88 Mb 3"5 drive */
+        val = 5;
+        break;
+    case FLOPPY_DRIVE_TYPE_120:
+        /* 1.2 Mb 5"5 drive */
+        val = 2;
+        break;
+    case FLOPPY_DRIVE_TYPE_NONE:
+    default:
+        val = 0;
+        break;
+    }
+    return val;
+}
+
 static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope)
 {
     Aml *dev;
hw/i386/pc.c +0 -25
index d103b8c0ab..e78e32b41b 100644
@@ -386,31 +386,6 @@ static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
 
 #define REG_EQUIPMENT_BYTE          0x14
 
-int cmos_get_fd_drive_type(FloppyDriveType fd0)
-{
-    int val;
-
-    switch (fd0) {
-    case FLOPPY_DRIVE_TYPE_144:
-        /* 1.44 Mb 3"5 drive */
-        val = 4;
-        break;
-    case FLOPPY_DRIVE_TYPE_288:
-        /* 2.88 Mb 3"5 drive */
-        val = 5;
-        break;
-    case FLOPPY_DRIVE_TYPE_120:
-        /* 1.2 Mb 5"5 drive */
-        val = 2;
-        break;
-    case FLOPPY_DRIVE_TYPE_NONE:
-    default:
-        val = 0;
-        break;
-    }
-    return val;
-}
-
 static void cmos_init_hd(ISADevice *s, int type_ofs, int info_ofs,
                          int16_t cylinders, int8_t heads, int8_t sectors)
 {
Signature · 1 line
MST
#7 lore raw

[PULL 10/19] acpi: drop build_piix4_pm()

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

The _SB.PCI0.PX13.P13C opregion (holds isa device enable bits) is not used any more, remove it from DSDT.

piix4 DSDT changes:

     Scope (_SB.PCI0)
     {

- Device (PX13)
- {
- Name (_ADR, 0x00010003) // _ADR: Address
- OperationRegion (P13C, PCI_Config, Zero, 0xFF)
- }
- }
-
- Scope (_SB.PCI0)

-    {
         Device (ISA)
         {
             Name (_ADR, 0x00010000)  // _ADR: Address
             OperationRegion (P40C, PCI_Config, 0x60, 0x04)
         }
     }

Message-Id: <[email protected]>

---
 hw/i386/acpi-build.c | 16 ----------------
 1 file changed, 16 deletions(-)
hw/i386/acpi-build.c +0 -16
index ffbdbee51a..59f1b4d890 100644
@@ -1364,21 +1364,6 @@ static void build_q35_isa_bridge(Aml *table)
     aml_append(table, 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,
-                                         aml_int(0x00), 0xff));
-    aml_append(scope, dev);
-    aml_append(table, scope);
-}
-
 static void build_piix4_isa_bridge(Aml *table)
 {
     Aml *dev;
@@ -1530,7 +1515,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
         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);
Signature · 1 line
MST
#8 lore raw

[PULL 13/19] acpi: Some build_tpm2() code reshape

In reply to Michael S. Tsirkin

From: Eric Auger <[email protected]>

Remove any reference to Acpi20TPM2 and adopt an implementation similar to build_ghes_v2().

Message-Id: <[email protected]>

---
 include/hw/acpi/acpi-defs.h | 18 -------------
 hw/acpi/aml-build.c         | 51 +++++++++++++++++++++++--------------
 2 files changed, 32 insertions(+), 37 deletions(-)
include/hw/acpi/acpi-defs.h +0 -18
index 3be9ab5049..38a42f409a 100644
@@ -465,24 +465,6 @@ struct Acpi20Tcpa {
 } QEMU_PACKED;
 typedef struct Acpi20Tcpa Acpi20Tcpa;
 
-/*
- * TPM2
- *
- * Following Version 1.2, Revision 8 of specs:
- * https://trustedcomputinggroup.org/tcg-acpi-specification/
- */
-struct Acpi20TPM2 {
-    ACPI_TABLE_HEADER_DEF
-    uint16_t platform_class;
-    uint16_t reserved;
-    uint64_t control_area_address;
-    uint32_t start_method;
-    uint8_t start_method_params[12];
-    uint32_t log_area_minimum_length;
-    uint64_t log_area_start_address;
-} QEMU_PACKED;
-typedef struct Acpi20TPM2 Acpi20TPM2;
-
 /* DMAR - DMA Remapping table r2.2 */
 struct AcpiTableDmar {
     ACPI_TABLE_HEADER_DEF
hw/acpi/aml-build.c +32 -19

80 lines not on this page · raw message

Signature · 1 line
MST
#9 lore raw

[PULL 08/19] acpi: simplify build_isa_devices_aml()

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

x86 machines can have a single ISA bus only.

Message-Id: <[email protected]>

---
 hw/i386/acpi-build.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
hw/i386/acpi-build.c +6 -10
index 19e9c298dc..d27cecc877 100644
@@ -979,18 +979,14 @@ static void build_isa_devices_aml(Aml *table)
 {
     VMBusBridge *vmbus_bridge = vmbus_bridge_find();
     bool ambiguous;
-
-    Aml *scope = aml_scope("_SB.PCI0.ISA");
     Object *obj = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous);
+    Aml *scope;
 
-    if (ambiguous) {
-        error_report("Multiple ISA busses, unable to define IPMI ACPI data");
-    } else if (!obj) {
-        error_report("No ISA bus, unable to define IPMI ACPI data");
-    } else {
-        build_acpi_ipmi_devices(scope, BUS(obj), "\\_SB.PCI0.ISA");
-        isa_build_aml(ISA_BUS(obj), scope);
-    }
+    assert(obj && !ambiguous);
+
+    scope = aml_scope("_SB.PCI0.ISA");
+    build_acpi_ipmi_devices(scope, BUS(obj), "\\_SB.PCI0.ISA");
+    isa_build_aml(ISA_BUS(obj), scope);
 
     if (vmbus_bridge) {
         aml_append(scope, build_vmbus_device_aml(vmbus_bridge));
Signature · 1 line
MST
#10 lore raw

[PULL 06/19] acpi: move aml builder code for i8042 (kbd+mouse) device

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

DSDT change: isa device order changes in case MI1 (ipmi) is present.

Message-Id: <[email protected]>

---
 hw/i386/acpi-build.c | 39 ---------------------------------------
 hw/input/pckbd.c     | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 39 deletions(-)
hw/i386/acpi-build.c +0 -39
index 45297d9a90..13113e83df 100644
@@ -938,42 +938,6 @@ static void build_hpet_aml(Aml *table)
     aml_append(table, scope);
 }
 
-static Aml *build_kbd_device_aml(void)
-{
-    Aml *dev;
-    Aml *crs;
-
-    dev = aml_device("KBD");
-    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0303")));
-
-    aml_append(dev, aml_name_decl("_STA", aml_int(0xf)));
-
-    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(dev, aml_name_decl("_CRS", crs));
-
-    return dev;
-}
-
-static Aml *build_mouse_device_aml(void)
-{
-    Aml *dev;
-    Aml *crs;
-
-    dev = aml_device("MOU");
-    aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0F13")));
-
-    aml_append(dev, aml_name_decl("_STA", aml_int(0xf)));
-
-    crs = aml_resource_template();
-    aml_append(crs, aml_irq_no_flags(12));
-    aml_append(dev, aml_name_decl("_CRS", crs));
-
-    return dev;
-}
-
 static Aml *build_vmbus_device_aml(VMBusBridge *vmbus_bridge)
 {
     Aml *dev;
@@ -1019,9 +983,6 @@ static void build_isa_devices_aml(Aml *table)
     Aml *scope = aml_scope("_SB.PCI0.ISA");
     Object *obj = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous);
 
-    aml_append(scope, build_kbd_device_aml());
-    aml_append(scope, build_mouse_device_aml());
-
     if (ambiguous) {
         error_report("Multiple ISA busses, unable to define IPMI ACPI data");
     } else if (!obj) {
hw/input/pckbd.c +31 -0
index 60a4130320..29d633ca94 100644
@@ -26,6 +26,7 @@
 #include "qemu/log.h"
 #include "hw/isa/isa.h"
 #include "migration/vmstate.h"
+#include "hw/acpi/aml-build.h"
 #include "hw/input/ps2.h"
 #include "hw/irq.h"
 #include "hw/input/i8042.h"
@@ -561,12 +562,42 @@ static void i8042_realizefn(DeviceState *dev, Error **errp)
     qemu_register_reset(kbd_reset, s);
 }
 
+static void i8042_build_aml(ISADevice *isadev, Aml *scope)
+{
+    Aml *kbd;
+    Aml *mou;
+    Aml *crs;
+
+    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));
+
+    kbd = aml_device("KBD");
+    aml_append(kbd, aml_name_decl("_HID", aml_eisaid("PNP0303")));
+    aml_append(kbd, aml_name_decl("_STA", aml_int(0xf)));
+    aml_append(kbd, aml_name_decl("_CRS", crs));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_irq_no_flags(12));
+
+    mou = aml_device("MOU");
+    aml_append(mou, aml_name_decl("_HID", aml_eisaid("PNP0F13")));
+    aml_append(mou, aml_name_decl("_STA", aml_int(0xf)));
+    aml_append(mou, aml_name_decl("_CRS", crs));
+
+    aml_append(scope, kbd);
+    aml_append(scope, mou);
+}
+
 static void i8042_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ISADeviceClass *isa = ISA_DEVICE_CLASS(klass);
 
     dc->realize = i8042_realizefn;
     dc->vmsd = &vmstate_kbd_isa;
+    isa->build_aml = i8042_build_aml;
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 }
 
Signature · 1 line
MST
#11 lore raw

[PULL 11/19] acpi: q35: drop _SB.PCI0.ISA.LPCD opregion.

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

Seems to be unused.

ich9 DSDT changes:

     Scope (_SB.PCI0)
     {
         Device (ISA)
         {
             Name (_ADR, 0x001F0000)  // _ADR: Address
             OperationRegion (PIRQ, PCI_Config, 0x60, 0x0C)
-            OperationRegion (LPCD, PCI_Config, 0x80, 0x02)
-            Field (LPCD, AnyAcc, NoLock, Preserve)
-            {
-                COMA,   3,
-                    ,   1,
-                COMB,   3,
-                Offset (0x01),
-                LPTD,   2
-            }
         }
     }

Message-Id: <[email protected]>

---
 hw/i386/acpi-build.c | 11 -----------
 1 file changed, 11 deletions(-)
hw/i386/acpi-build.c +0 -11
index 59f1b4d890..378515df66 100644
@@ -1340,7 +1340,6 @@ static void build_q35_isa_bridge(Aml *table)
 {
     Aml *dev;
     Aml *scope;
-    Aml *field;
 
     scope =  aml_scope("_SB.PCI0");
     dev = aml_device("ISA");
@@ -1350,16 +1349,6 @@ static void build_q35_isa_bridge(Aml *table)
     aml_append(dev, aml_operation_region("PIRQ", AML_PCI_CONFIG,
                                          aml_int(0x60), 0x0C));
 
-    aml_append(dev, aml_operation_region("LPCD", AML_PCI_CONFIG,
-                                         aml_int(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(dev, field);
-
     aml_append(scope, dev);
     aml_append(table, scope);
 }
Signature · 1 line
MST
#12 lore raw

[PULL 14/19] arm/acpi: Add the TPM2.0 device under the DSDT

In reply to Michael S. Tsirkin

From: Eric Auger <[email protected]>

In case it is dynamically instantiated, add the TPM 2.0 device object under the DSDT table in the ACPI namespace. Its HID is MSFT0101 while its current resource settings (CRS) property is initialized with the guest physical address and MMIO size of the device.

Message-Id: <[email protected]>

---
 hw/arm/virt-acpi-build.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
hw/arm/virt-acpi-build.c +34 -0
index ca31f70f7f..1384a2cf2a 100644
@@ -46,6 +46,7 @@
 #include "hw/pci/pci.h"
 #include "hw/arm/virt.h"
 #include "hw/mem/nvdimm.h"
+#include "hw/platform-bus.h"
 #include "sysemu/numa.h"
 #include "sysemu/reset.h"
 #include "sysemu/tpm.h"
@@ -364,6 +365,38 @@ static void acpi_dsdt_add_power_button(Aml *scope)
     aml_append(scope, dev);
 }
 
+static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
+{
+    PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
+    hwaddr pbus_base = vms->memmap[VIRT_PLATFORM_BUS].base;
+    SysBusDevice *sbdev = SYS_BUS_DEVICE(tpm_find());
+    MemoryRegion *sbdev_mr;
+    hwaddr tpm_base;
+
+    if (!sbdev) {
+        return;
+    }
+
+    tpm_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
+    assert(tpm_base != -1);
+
+    tpm_base += pbus_base;
+
+    sbdev_mr = sysbus_mmio_get_region(sbdev, 0);
+
+    Aml *dev = aml_device("TPM0");
+    aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
+    aml_append(dev, aml_name_decl("_UID", aml_int(0)));
+
+    Aml *crs = aml_resource_template();
+    aml_append(crs,
+               aml_memory32_fixed(tpm_base,
+                                  (uint32_t)memory_region_size(sbdev_mr),
+                                  AML_READ_WRITE));
+    aml_append(dev, aml_name_decl("_CRS", crs));
+    aml_append(scope, dev);
+}
+
 static void
 build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 {
@@ -762,6 +795,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     }
 
     acpi_dsdt_add_power_button(scope);
+    acpi_dsdt_add_tpm(scope, vms);
 
     aml_append(dsdt, scope);
 
Signature · 1 line
MST
#13 lore raw

[PULL 19/19] tests: disassemble-asm.sh: generate AML in readable format

In reply to Michael S. Tsirkin

On systems where the IASL tool exists, we can convert extected ACPI tables to ASL format, which is useful
for debugging and documentation purposes.
This script does this for all ACPI tables under tests/data/acpi/.

---
 tests/data/acpi/disassemle-aml.sh | 52 +++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100755 tests/data/acpi/disassemle-aml.sh
tests/data/acpi/disassemle-aml.sh new file +52 -0
new file mode 100755
index 0000000000..1d8a4d0301
@@ -0,0 +1,52 @@
+#!/usr/bin/bash
+
+outdir=
+while getopts "o:" arg; do
+  case ${arg} in
+    o )
+        outdir=$OPTARG
+        ;;
+    \? )
+        echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]"
+        exit 1
+        ;;
+
+  esac
+done
+
+for machine in tests/data/acpi/*
+do
+    if [[ ! -d "$machine" ]];
+    then
+        continue
+    fi
+
+    if [[ "${outdir}" ]];
+    then
+        mkdir -p "${outdir}"/${machine} || exit $?
+    fi
+    for aml in $machine/*
+    do
+        if [[ "$aml" == $machine/*.dsl ]];
+        then
+            continue
+        fi
+        if [[ "$aml" == $machine/SSDT*.* ]];
+        then
+            dsdt=${aml/SSDT*./DSDT.}
+            extra="-e ${dsdt}"
+        elif [[ "$aml" == $machine/SSDT* ]];
+        then
+            dsdt=${aml/SSDT*/DSDT};
+            extra="-e ${dsdt}"
+        else
+            extra=""
+        fi
+        asl=${aml}.dsl
+        if [[ "${outdir}" ]];
+        then
+            asl="${outdir}"/${machine}/${asl}
+        fi
+        iasl -d -p ${asl} ${extra} ${aml}
+    done
+done
Signature · 1 line
MST
#14 lore raw

[PULL 09/19] acpi: drop serial/parallel enable bits from dsdt

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

The _STA methods for COM+LPT used to reference them, but that isn't the case any more.

piix4 DSDT changes:

     Scope (_SB.PCI0)
     {
         Device (ISA)
         {
             Name (_ADR, 0x00010000)  // _ADR: Address
             OperationRegion (P40C, PCI_Config, 0x60, 0x04)

- Field (^PX13.P13C, AnyAcc, NoLock, Preserve)
- {
- Offset (0x5F),
- , 7,
- LPEN, 1,
- Offset (0x67),

-                    ,   3,
-                CAEN,   1,
-                    ,   3,
-                CBEN,   1
-            }
         }
     }

ich9 DSDT changes:

     Scope (_SB.PCI0)
     {
         Device (ISA)
         {
             Name (_ADR, 0x001F0000)  // _ADR: Address
             OperationRegion (PIRQ, PCI_Config, 0x60, 0x0C)
             OperationRegion (LPCD, PCI_Config, 0x80, 0x02)
             Field (LPCD, AnyAcc, NoLock, Preserve)
             {
                 COMA,   3,
                     ,   1,
                 COMB,   3,
                 Offset (0x01),
                 LPTD,   2
             }
-
-            OperationRegion (LPCE, PCI_Config, 0x82, 0x02)
-            Field (LPCE, AnyAcc, NoLock, Preserve)
-            {
-                CAEN,   1,
-                CBEN,   1,
-                LPEN,   1
-            }
         }
     }

Message-Id: <[email protected]>

---
 hw/i386/acpi-build.c | 23 -----------------------
 1 file changed, 23 deletions(-)
hw/i386/acpi-build.c +0 -23
index d27cecc877..ffbdbee51a 100644
@@ -1360,15 +1360,6 @@ static void build_q35_isa_bridge(Aml *table)
     aml_append(field, aml_named_field("LPTD", 2));
     aml_append(dev, field);
 
-    aml_append(dev, aml_operation_region("LPCE", AML_PCI_CONFIG,
-                                         aml_int(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(dev, field);
-
     aml_append(scope, dev);
     aml_append(table, scope);
 }
@@ -1392,7 +1383,6 @@ static void build_piix4_isa_bridge(Aml *table)
 {
     Aml *dev;
     Aml *scope;
-    Aml *field;
 
     scope =  aml_scope("_SB.PCI0");
     dev = aml_device("ISA");
@@ -1401,19 +1391,6 @@ static void build_piix4_isa_bridge(Aml *table)
     /* PIIX PCI to ISA irq remapping */
     aml_append(dev, aml_operation_region("P40C", AML_PCI_CONFIG,
                                          aml_int(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(scope, dev);
     aml_append(table, scope);
Signature · 1 line
MST
#15 lore raw

[PULL 15/19] docs/specs/tpm: ACPI boot now supported for TPM/ARM

In reply to Michael S. Tsirkin

From: Eric Auger <[email protected]>

ACPI boot now is supported. Let's remove the comment saying it is not.

Message-Id: <[email protected]>

---
 docs/specs/tpm.rst | 2 --
 1 file changed, 2 deletions(-)
docs/specs/tpm.rst +0 -2
index 5e61238bc5..eeeb93730a 100644
@@ -346,8 +346,6 @@ In case an Arm virt machine is emulated, use the following command line:
     -drive if=pflash,format=raw,file=flash0.img,readonly \
     -drive if=pflash,format=raw,file=flash1.img
 
-  On Arm, ACPI boot with TPM is not yet supported.
-
 In case SeaBIOS is used as firmware, it should show the TPM menu item
 after entering the menu with 'ESC'.
 
Signature · 1 line
MST
#16 lore raw

[PULL 12/19] tests/acpi: update expected data files

In reply to Michael S. Tsirkin

From: Gerd Hoffmann <[email protected]>

Message-Id: <[email protected]>

---
 tests/data/acpi/pc/DSDT           | Bin 5014 -> 4934 bytes
 tests/data/acpi/pc/DSDT.acpihmat  | Bin 6338 -> 6258 bytes
 tests/data/acpi/pc/DSDT.bridge    | Bin 6873 -> 6793 bytes
 tests/data/acpi/pc/DSDT.cphp      | Bin 5477 -> 5397 bytes
 tests/data/acpi/pc/DSDT.dimmpxm   | Bin 6667 -> 6587 bytes
 tests/data/acpi/pc/DSDT.ipmikcs   | Bin 5086 -> 5006 bytes
 tests/data/acpi/pc/DSDT.memhp     | Bin 6373 -> 6293 bytes
 tests/data/acpi/pc/DSDT.numamem   | Bin 5020 -> 4940 bytes
 tests/data/acpi/q35/DSDT          | Bin 7752 -> 7678 bytes
 tests/data/acpi/q35/DSDT.acpihmat | Bin 9076 -> 9002 bytes
 tests/data/acpi/q35/DSDT.bridge   | Bin 7769 -> 7695 bytes
 tests/data/acpi/q35/DSDT.cphp     | Bin 8215 -> 8141 bytes
 tests/data/acpi/q35/DSDT.dimmpxm  | Bin 9405 -> 9331 bytes
 tests/data/acpi/q35/DSDT.ipmibt   | Bin 7827 -> 7753 bytes
 tests/data/acpi/q35/DSDT.memhp    | Bin 9111 -> 9037 bytes
 tests/data/acpi/q35/DSDT.mmio64   | Bin 8882 -> 8808 bytes
 tests/data/acpi/q35/DSDT.numamem  | Bin 7758 -> 7684 bytes
 tests/data/acpi/q35/DSDT.tis      | Bin 8357 -> 8283 bytes
 18 files changed, 0 insertions(+), 0 deletions(-)
tests/data/acpi/pc/DSDT binary +0 -0
index 384a82dbb3cb0e9f47db6f4d08945631c2b72b56..6d0aaf729ac7d64cf966621adf276534de5cc555 100644
GIT binary patch
tests/data/acpi/pc/DSDT.acpihmat binary +0 -0
index 47ddfdb027b06dc2daa46be711c3f4640ce68320..2e5e02400b1bd2842989d395c573fc593f45503b 100644
GIT binary patch
tests/data/acpi/pc/DSDT.bridge binary +0 -0
index d1e2fa9fb8c75160fc1fa46deed6a6a9cb515559..623c4c03585c47d4d28adc611823b7cce8f4a5c7 100644
GIT binary patch
tests/data/acpi/pc/DSDT.cphp binary +0 -0
index 54f481faf1e336c0bbf5e774cd67220fe06e951b..e0a43ccdadae150c0f39599c85e4e21ed8fff2a4 100644
GIT binary patch
tests/data/acpi/pc/DSDT.dimmpxm binary +0 -0
index 5d98016ae571cde04ff96d58212e0faf9aaf50e6..21eb065a0ee3bd96f1a2e7601aa83fefa833349a 100644
GIT binary patch
tests/data/acpi/pc/DSDT.ipmikcs binary +0 -0
index 57b78358744a5bb13639ccddb887be2721240807..b8f08f266b5735fe6967d4e105ee6b3662dad7e6 100644
GIT binary patch
tests/data/acpi/pc/DSDT.memhp binary +0 -0
index 8cb90ef14e13be85995c6fe3d3f6d12f4d939504..9a9418f4bde5fb18883c244ea956122e371ff01a 100644
GIT binary patch
tests/data/acpi/pc/DSDT.numamem binary +0 -0
index f194bc639482eb839a875d493857526f85f1a9e0..6eec385c2ec00544c6eaa7e19d32b2ccd5a51915 100644
GIT binary patch
tests/data/acpi/q35/DSDT binary +0 -0
index 6a5e4dd85a7d9a95f7ad0fb95e6a4fa7a8d91adb..e63676d7a63afec714debeb465ee478ea4714337 100644
GIT binary patch
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
index c1dd7773f3386a946fcb4a9a3bf9ad3a33ddbbe9..cd97b819824e4140d087e465d179b71775d6a494 100644
GIT binary patch
tests/data/acpi/q35/DSDT.bridge binary +0 -0
index 2ef1e894a35b9e85fe07e2678bd2456f5ec40dc6..8b0fb497dbbaeba18e9d0e1503de4396f1c230b0 100644
GIT binary patch
tests/data/acpi/q35/DSDT.cphp binary +0 -0
index 74e86176e5fec46e660c567acf8fbcf08a14bdfb..d9bb414e9bf15d9b9149f38c9bb5d8b993f88650 100644
GIT binary patch
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
index 4bf8e9d64b04f9f805047d6850c2dd0086970445..29f19b22a38f9d8e7dc9870f0c1aa3d4470643ff 100644
GIT binary patch
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
index 38723daef80421ea528b2ad2d411e7357df43956..e8dea1ea42af765babcb747af998b0d912abdcbd 100644
GIT binary patch
tests/data/acpi/q35/DSDT.memhp binary +0 -0
index 98328d1c4197ab19a71de7f3f18e2985f4910f45..dca76db15b943122efd5c200cb54ce3dbc97a55f 100644
GIT binary patch
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
index 5916c0e9ce0a9607c6230f9dfebe2c1be70b2495..6d8facd9e179140682ad5d4302f3dad14dbec342 100644
GIT binary patch
tests/data/acpi/q35/DSDT.numamem binary +0 -0
index cf3fde3449bc8e9bbe683b936cf9866590b0ef82..737325dc3082fdf06283857811f6f5174e0ff2a9 100644
GIT binary patch
tests/data/acpi/q35/DSDT.tis binary +0 -0
index 56b6fb0c3298517d080e38fea05a748b9f1dba54..27ee927fc5ac05b89724c154197304c39e653269 100644
GIT binary patch
Signature · 1 line
MST
#17 lore raw

[PULL 16/19] Stop vhost-user sending uninitialized mmap_offsets

In reply to Michael S. Tsirkin

From: Raphael Norwitz <[email protected]>

Prior to this change, the vhost_user_fill_msg_region function filled out all elements of the VhostUserMemoryRegion struct except the mmap_offset.

This function is often called on uninitialized structs, which are then copied into VHOST_USER_SET_MEM_TABLE and VHOST_USER_ADD/REM_MEM_REG messages. In some cases, where the mmap_offset was not needed, it was left uninitialized, causing QEMU to send the backend uninitialized data, which Coverity flagged as a series of issues.

This change augments the vhost_user_fill_msg_region API, adding a mmap_offset paramenter, forcing the caller to initialize mmap_offset.

Fixes ece99091c2d0aeb23734289a50ef2ff4e0a08929
Fixes f1aeb14b0809e313c74244d838645ed25e85ea63
Reported-by Coverity (CIDs 1429802, 1429803 and 1429804)

Message-Id: <[email protected]>

---
 hw/virtio/vhost-user.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/virtio/vhost-user.c +6 -6
index 4d6cd4e58a..31231218dc 100644
@@ -460,12 +460,14 @@ static MemoryRegion *vhost_user_get_mr_data(uint64_t addr, ram_addr_t *offset,
 }
 
 static void vhost_user_fill_msg_region(VhostUserMemoryRegion *dst,
-                                       struct vhost_memory_region *src)
+                                       struct vhost_memory_region *src,
+                                       uint64_t mmap_offset)
 {
     assert(src != NULL && dst != NULL);
     dst->userspace_addr = src->userspace_addr;
     dst->memory_size = src->memory_size;
     dst->guest_phys_addr = src->guest_phys_addr;
+    dst->mmap_offset = mmap_offset;
 }
 
 static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u,
@@ -500,9 +502,8 @@ static int vhost_user_fill_set_mem_table_msg(struct vhost_user *u,
                 error_report("Failed preparing vhost-user memory table msg");
                 return -1;
             }
-            vhost_user_fill_msg_region(&region_buffer, reg);
+            vhost_user_fill_msg_region(&region_buffer, reg, offset);
             msg->payload.memory.regions[*fd_num] = region_buffer;
-            msg->payload.memory.regions[*fd_num].mmap_offset = offset;
             fds[(*fd_num)++] = fd;
         } else if (track_ramblocks) {
             u->region_rb_offset[i] = 0;
@@ -649,7 +650,7 @@ static int send_remove_regions(struct vhost_dev *dev,
 
         if (fd > 0) {
             msg->hdr.request = VHOST_USER_REM_MEM_REG;
-            vhost_user_fill_msg_region(&region_buffer, shadow_reg);
+            vhost_user_fill_msg_region(&region_buffer, shadow_reg, 0);
             msg->payload.mem_reg.region = region_buffer;
 
             if (vhost_user_write(dev, msg, &fd, 1) < 0) {
@@ -709,9 +710,8 @@ static int send_add_regions(struct vhost_dev *dev,
                 u->region_rb[reg_idx] = mr->ram_block;
             }
             msg->hdr.request = VHOST_USER_ADD_MEM_REG;
-            vhost_user_fill_msg_region(&region_buffer, reg);
+            vhost_user_fill_msg_region(&region_buffer, reg, offset);
             msg->payload.mem_reg.region = region_buffer;
-            msg->payload.mem_reg.region.mmap_offset = offset;
 
             if (vhost_user_write(dev, msg, &fd, 1) < 0) {
                 return -1;
Signature · 1 line
MST
#18 lore raw

[PULL 17/19] Rename use_acpi_pci_hotplug to more appropriate use_acpi_hotplug_bridge

In reply to Michael S. Tsirkin

From: Ani Sinha <[email protected]>

Currently, the option use_acpi_pci_hotplug is being used to control device hotplug capability using ACPI for slots of cold plugged bridges. Hence, we are renaming this option to better reflect what it actually does.

Message-Id: <[email protected]>

---
 hw/acpi/piix4.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
hw/acpi/piix4.c +11 -10
index 1262abc77a..630ca6ec87 100644
@@ -77,7 +77,7 @@ typedef struct PIIX4PMState {
     Notifier powerdown_notifier;
 
     AcpiPciHpState acpi_pci_hotplug;
-    bool use_acpi_pci_hotplug;
+    bool use_acpi_hotplug_bridge;
 
     uint8_t disable_s3;
     uint8_t disable_s4;
@@ -204,16 +204,17 @@ static const VMStateDescription vmstate_pci_status = {
     }
 };
 
-static bool vmstate_test_use_acpi_pci_hotplug(void *opaque, int version_id)
+static bool vmstate_test_use_acpi_hotplug_bridge(void *opaque, int version_id)
 {
     PIIX4PMState *s = opaque;
-    return s->use_acpi_pci_hotplug;
+    return s->use_acpi_hotplug_bridge;
 }
 
-static bool vmstate_test_no_use_acpi_pci_hotplug(void *opaque, int version_id)
+static bool vmstate_test_no_use_acpi_hotplug_bridge(void *opaque,
+                                                    int version_id)
 {
     PIIX4PMState *s = opaque;
-    return !s->use_acpi_pci_hotplug;
+    return !s->use_acpi_hotplug_bridge;
 }
 
 static bool vmstate_test_use_memhp(void *opaque)
@@ -290,11 +291,11 @@ static const VMStateDescription vmstate_acpi = {
         VMSTATE_STRUCT_TEST(
             acpi_pci_hotplug.acpi_pcihp_pci_status[ACPI_PCIHP_BSEL_DEFAULT],
             PIIX4PMState,
-            vmstate_test_no_use_acpi_pci_hotplug,
+            vmstate_test_no_use_acpi_hotplug_bridge,
             2, vmstate_pci_status,
             struct AcpiPciHpPciStatus),
         VMSTATE_PCI_HOTPLUG(acpi_pci_hotplug, PIIX4PMState,
-                            vmstate_test_use_acpi_pci_hotplug),
+                            vmstate_test_use_acpi_hotplug_bridge),
         VMSTATE_END_OF_LIST()
     },
     .subsections = (const VMStateDescription*[]) {
@@ -530,7 +531,7 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
     s->smi_irq = smi_irq;
     s->smm_enabled = smm_enabled;
     if (xen_enabled()) {
-        s->use_acpi_pci_hotplug = false;
+        s->use_acpi_hotplug_bridge = false;
     }
 
     pci_realize_and_unref(pci_dev, bus, &error_fatal);
@@ -595,7 +596,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
     memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe);
 
     acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent,
-                    s->use_acpi_pci_hotplug);
+                    s->use_acpi_hotplug_bridge);
 
     s->cpu_hotplug_legacy = true;
     object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",
@@ -633,7 +634,7 @@ static Property piix4_pm_properties[] = {
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0),
     DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2),
     DEFINE_PROP_BOOL("acpi-pci-hotplug-with-bridge-support", PIIX4PMState,
-                     use_acpi_pci_hotplug, true),
+                     use_acpi_hotplug_bridge, true),
     DEFINE_PROP_BOOL("memory-hotplug-support", PIIX4PMState,
                      acpi_memory_hotplug.is_enabled, true),
     DEFINE_PROP_END_OF_LIST(),
Signature · 1 line
MST
#19 lore raw

[PULL 18/19] tests/qtest/bios-tables: Only run the TPM test with CONFIG_TPM enabled

In reply to Michael S. Tsirkin

From: Thomas Huth <[email protected]>

"make check-qtest" currently fails if configure has been run with "--disable-tpm" - the TPM-related tests can only work if the TPM is enabled in the build. So let's use the CONFIG_TPM switch to disable the test if TPM is not available.

Message-Id: <[email protected]>

---
 tests/qtest/bios-tables-test.c | 6 ++++++
 1 file changed, 6 insertions(+)
tests/qtest/bios-tables-test.c +6 -0
index c315156858..3bd57b830d 100644
@@ -877,6 +877,8 @@ static void test_acpi_piix4_tcg_numamem(void)
     free_test_data(&data);
 }
 
+#ifdef CONFIG_TPM
+
 uint64_t tpm_tis_base_addr;
 
 static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
@@ -935,6 +937,8 @@ static void test_acpi_q35_tcg_tpm_tis(void)
     test_acpi_tcg_tpm("q35", "tis", 0xFED40000);
 }
 
+#endif /* CONFIG_TPM */
+
 static void test_acpi_tcg_dimm_pxm(const char *machine)
 {
     test_data data;
@@ -1098,7 +1102,9 @@ int main(int argc, char *argv[])
             return ret;
         }
 
+#ifdef CONFIG_TPM
         qtest_add_func("acpi/q35/tpm-tis", test_acpi_q35_tcg_tpm_tis);
+#endif
         qtest_add_func("acpi/piix4", test_acpi_piix4_tcg);
         qtest_add_func("acpi/piix4/bridge", test_acpi_piix4_tcg_bridge);
         qtest_add_func("acpi/q35", test_acpi_q35_tcg);
Signature · 1 line
MST
#20 lore raw
In reply to Michael S. Tsirkin
Quoted 43 lines · Michael S. Tsirkin

The following changes since commit d4b78317b7cf8c0c635b70086503813f79ff21ec:

   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200623' into staging (2020-06-23 18:57:05 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to f6f746db6bae1ba74967fd7bea2bb5e169502948:

tests: disassemble-asm.sh: generate AML in readable format (2020-06-24 19:03:57 -0400)

----------------------------------------------------------------
virtio,acpi,pci: fixes, cleanups, tools.

Fixes, cleanups in ACPI, PCI, virtio.
A handy script for testing ACPI.

----------------------------------------------------------------
Ani Sinha (1):
Rename use_acpi_pci_hotplug to more appropriate use_acpi_hotplug_bridge

Eric Auger (3):
acpi: Some build_tpm2() code reshape arm/acpi: Add the TPM2.0 device under the DSDT docs/specs/tpm: ACPI boot now supported for TPM/ARM

Gerd Hoffmann (12):
qtest: allow DSDT acpi table changes
acpi: bios-tables-test: show more context on asl diffs
acpi: move aml builder code for floppy device
floppy: make isa_fdc_get_drive_max_chs static
floppy: move cmos_get_fd_drive_type() from pc
acpi: move aml builder code for i8042 (kbd+mouse) device
acpi: factor out fw_cfg_add_acpi_dsdt()
acpi: simplify build_isa_devices_aml()
acpi: drop serial/parallel enable bits from dsdt
acpi: drop build_piix4_pm()
acpi: q35: drop _SB.PCI0.ISA.LPCD opregion. tests/acpi: update expected data files

Quoted 8 lines

Michael S. Tsirkin (1):
tests: disassemble-asm.sh: generate AML in readable format

Raphael Norwitz (1):
Stop vhost-user sending uninitialized mmap_offsets

Thomas Huth (1):
tests/qtest/bios-tables: Only run the TPM test with CONFIG_TPM enabled

Hi Michael!

Please drop my patch from your pull request - the issue has already been solved by Eric's patch that already got merged:

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=55b9757c7e58092

Thanks,
Thomas

#21 lore raw
Quoted 55 lines · Thomas Huth
Quoted 43 lines · Michael S. Tsirkin

The following changes since commit d4b78317b7cf8c0c635b70086503813f79ff21ec:

   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200623' into staging (2020-06-23 18:57:05 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to f6f746db6bae1ba74967fd7bea2bb5e169502948:

tests: disassemble-asm.sh: generate AML in readable format (2020-06-24 19:03:57 -0400)

----------------------------------------------------------------
virtio,acpi,pci: fixes, cleanups, tools.

Fixes, cleanups in ACPI, PCI, virtio.
A handy script for testing ACPI.

----------------------------------------------------------------
Ani Sinha (1):
Rename use_acpi_pci_hotplug to more appropriate use_acpi_hotplug_bridge

Eric Auger (3):
acpi: Some build_tpm2() code reshape arm/acpi: Add the TPM2.0 device under the DSDT docs/specs/tpm: ACPI boot now supported for TPM/ARM

Gerd Hoffmann (12):
qtest: allow DSDT acpi table changes
acpi: bios-tables-test: show more context on asl diffs
acpi: move aml builder code for floppy device
floppy: make isa_fdc_get_drive_max_chs static
floppy: move cmos_get_fd_drive_type() from pc
acpi: move aml builder code for i8042 (kbd+mouse) device
acpi: factor out fw_cfg_add_acpi_dsdt()
acpi: simplify build_isa_devices_aml()
acpi: drop serial/parallel enable bits from dsdt
acpi: drop build_piix4_pm()
acpi: q35: drop _SB.PCI0.ISA.LPCD opregion. tests/acpi: update expected data files

Quoted 8 lines

Michael S. Tsirkin (1):
tests: disassemble-asm.sh: generate AML in readable format

Raphael Norwitz (1):
Stop vhost-user sending uninitialized mmap_offsets

Thomas Huth (1):
tests/qtest/bios-tables: Only run the TPM test with CONFIG_TPM enabled

Hi Michael!

Quoted 7 lines

Please drop my patch from your pull request - the issue has already been solved by Eric's patch that already got merged:

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=55b9757c7e58092

Thanks,
Thomas

OK done. Peter I pushed a new tag dropping a couple of patches accordingly. Same name.

#22 lore raw
In reply to Michael S. Tsirkin
Quoted 13 lines · Michael S. Tsirkin

The following changes since commit d4b78317b7cf8c0c635b70086503813f79ff21ec:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200623' into staging (2020-06-23 18:57:05 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to f6f746db6bae1ba74967fd7bea2bb5e169502948:

tests: disassemble-asm.sh: generate AML in readable format (2020-06-24 19:03:57 -0400)

Quoted 8 lines

----------------------------------------------------------------
virtio,acpi,pci: fixes, cleanups, tools.

Fixes, cleanups in ACPI, PCI, virtio.
A handy script for testing ACPI.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM