Skip to contentSkip to conversation

acpi: i386 tweaks

PATCH Superseded Gerd Hoffmann 3 participants 15 messages Jun 10, 2020 – Jun 11, 2020

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v7 cover acpi: i386 tweaks

First batch of microvm patches, some generic acpi stuff. Split the acpi-build.c monster, specifically split the pc and q35 and pci bits into a separate file which we can skip building at some point in the future.

v2 changes: leave acpi-build.c largely as-is, move useful bits to other places to allow them being reused, specifically:

* move isa device generator functions to individual isa devices.
* move fw_cfg generator function to fw_cfg.c

v3 changes: fix rtc, support multiple lpt devices.

v4 changes:
* drop merged patches.
* split rtc crs change to separata patch.
* added two cleanup patches.
* picked up ack & review tags.

v5 changes:
* add comment for rtc crs update.
* add even more cleanup patches.
* picked up ack & review tags.

v6 changes:
* floppy: move cmos_get_fd_drive_type.
* picked up ack & review tags.

v7 changes:
* rebased to mst/pci branch, resolved stubs conflict.
* dropped patches already queued up in mst/pci.
* added missing sign-off.
* picked up ack & review tags.

take care,
Gerd

Gerd Hoffmann (9):
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.

 hw/i386/fw_cfg.h       |   1 +
 include/hw/block/fdc.h |   3 +-
 include/hw/i386/pc.h   |   1 -
 hw/block/fdc.c         | 111 +++++++++++++++++++++-
 hw/i386/acpi-build.c   | 211 ++---------------------------------------
 hw/i386/fw_cfg.c       |  28 ++++++
 hw/i386/pc.c           |  25 -----
 hw/input/pckbd.c       |  31 ++++++
 stubs/cmos.c           |   7 ++
 stubs/Makefile.objs    |   1 +
 10 files changed, 184 insertions(+), 235 deletions(-)
 create mode 100644 stubs/cmos.c
Signature · 1 line
2.18.4
#1 lore raw

PATCH v7 1/9 acpi: move aml builder code for floppy device

---
 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 c5fb9d6ece77..b4d2eaf66dcd 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"
@@ -2765,6 +2767,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,
@@ -2798,11 +2879,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 000000000000..416cbe4055ff
@@ -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 c1e43ac68f87..df2cbfe68ca0 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
2.18.4
#2 lore raw

PATCH v7 2/9 floppy: make isa_fdc_get_drive_max_chs static

In reply to Gerd Hoffmann

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

---
 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 c15ff4c62315..5d71cf972268 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 b4d2eaf66dcd..8024c822cea3 100644
@@ -2744,8 +2744,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
2.18.4
#3 lore raw

PATCH v7 3/9 floppy: move cmos_get_fd_drive_type() from pc

In reply to Gerd Hoffmann
---
 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 5d71cf972268..479cebc0a330 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 8d764f965cd3..5e3b19ab78fc 100644
@@ -176,7 +176,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 8024c822cea3..ea0fb8ee15b9 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"
@@ -2809,6 +2808,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 2128f3d6fe8b..c5db7be6d8b1 100644
@@ -385,31 +385,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
2.18.4
#4 lore raw

PATCH v7 4/9 acpi: move aml builder code for i8042 (kbd+mouse) device

In reply to Gerd Hoffmann
---
 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 7726d5c0f7cb..9fed13a27333 100644
@@ -937,42 +937,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 void build_isa_devices_aml(Aml *table)
 {
     bool ambiguous;
@@ -980,9 +944,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 60a41303203a..29d633ca9478 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
2.18.4
#5 lore raw

PATCH v7 5/9 acpi: factor out fw_cfg_add_acpi_dsdt()

In reply to Gerd Hoffmann

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

---
 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 9e742787792b..275f15c1c5e8 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 9fed13a27333..86be45eea17c 100644
@@ -1759,30 +1759,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 da60ada59462..c55abfb01abb 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
2.18.4
#6 lore raw

PATCH v7 6/9 acpi: simplify build_isa_devices_aml()

In reply to Gerd Hoffmann

x86 machines can have a single ISA bus only.

---
 hw/i386/acpi-build.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
hw/i386/acpi-build.c +5 -10
index 86be45eea17c..c8e47700fc53 100644
@@ -940,19 +940,14 @@ static void build_hpet_aml(Aml *table)
 static void build_isa_devices_aml(Aml *table)
 {
     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);
     aml_append(table, scope);
 }
 
Signature · 1 line
2.18.4
#7 lore raw

PATCH v7 7/9 acpi: drop serial/parallel enable bits from dsdt

In reply to Gerd Hoffmann

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

---
 hw/i386/acpi-build.c | 23 -----------------------
 1 file changed, 23 deletions(-)
hw/i386/acpi-build.c +0 -23
index c8e47700fc53..750fcf9baa37 100644
@@ -1316,15 +1316,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);
 }
@@ -1348,7 +1339,6 @@ static void build_piix4_isa_bridge(Aml *table)
 {
     Aml *dev;
     Aml *scope;
-    Aml *field;
 
     scope =  aml_scope("_SB.PCI0");
     dev = aml_device("ISA");
@@ -1357,19 +1347,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
2.18.4
#8 lore raw

PATCH v7 8/9 acpi: drop build_piix4_pm()

In reply to Gerd Hoffmann

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

---
 hw/i386/acpi-build.c | 16 ----------------
 1 file changed, 16 deletions(-)
hw/i386/acpi-build.c +0 -16
index 750fcf9baa37..02cf4199c2e9 100644
@@ -1320,21 +1320,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;
@@ -1486,7 +1471,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
2.18.4
#9 lore raw

PATCH v7 9/9 acpi: q35: drop _SB.PCI0.ISA.LPCD opregion.

In reply to Gerd Hoffmann

Seems to be unused.

---
 hw/i386/acpi-build.c | 11 -----------
 1 file changed, 11 deletions(-)
hw/i386/acpi-build.c +0 -11
index 02cf4199c2e9..d93ea40c58b9 100644
@@ -1296,7 +1296,6 @@ static void build_q35_isa_bridge(Aml *table)
 {
     Aml *dev;
     Aml *scope;
-    Aml *field;
 
     scope =  aml_scope("_SB.PCI0");
     dev = aml_device("ISA");
@@ -1306,16 +1305,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
2.18.4
#10 lore raw
In reply to Gerd Hoffmann
Quoted 5 lines · On Wed, 10 Jun 2020 11:41:22 +0200 Gerd Hoffmann <[email protected]> wrote:

First batch of microvm patches, some generic acpi stuff. Split the acpi-build.c monster, specifically split the pc and q35 and pci bits into a separate file which we can skip building at some point in the future.

It looks like series is missing patch to whitelist changed ACPI tables in bios-table-test.

Do we already have test case for microvm in bios-table-test, if not it's probably time to add it.

Quoted 56 lines

v2 changes: leave acpi-build.c largely as-is, move useful bits to other places to allow them being reused, specifically:

* move isa device generator functions to individual isa devices.
* move fw_cfg generator function to fw_cfg.c

v3 changes: fix rtc, support multiple lpt devices.

v4 changes:
* drop merged patches.
* split rtc crs change to separata patch.
* added two cleanup patches.
* picked up ack & review tags.

v5 changes:
* add comment for rtc crs update.
* add even more cleanup patches.
* picked up ack & review tags.

v6 changes:
* floppy: move cmos_get_fd_drive_type.
* picked up ack & review tags.

v7 changes:
* rebased to mst/pci branch, resolved stubs conflict.
* dropped patches already queued up in mst/pci.
* added missing sign-off.
* picked up ack & review tags.

take care,
Gerd

Gerd Hoffmann (9):
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.

 hw/i386/fw_cfg.h       |   1 +
 include/hw/block/fdc.h |   3 +-
 include/hw/i386/pc.h   |   1 -
 hw/block/fdc.c         | 111 +++++++++++++++++++++-
 hw/i386/acpi-build.c   | 211 ++---------------------------------------
 hw/i386/fw_cfg.c       |  28 ++++++
 hw/i386/pc.c           |  25 -----
 hw/input/pckbd.c       |  31 ++++++
 stubs/cmos.c           |   7 ++
 stubs/Makefile.objs    |   1 +
 10 files changed, 184 insertions(+), 235 deletions(-)
 create mode 100644 stubs/cmos.c
#11 lore raw
Quoted 10 lines · Igor Mammedov
Quoted 5 lines · On Wed, 10 Jun 2020 11:41:22 +0200 Gerd Hoffmann <[email protected]> wrote:

First batch of microvm patches, some generic acpi stuff. Split the acpi-build.c monster, specifically split the pc and q35 and pci bits into a separate file which we can skip building at some point in the future.

It looks like series is missing patch to whitelist changed ACPI tables in bios-table-test.

Right. Does it pass make check?

Quoted 2 lines

Do we already have test case for microvm in bios-table-test, if not it's probably time to add it.

Separately :)

Quoted 56 lines
Quoted 56 lines

v2 changes: leave acpi-build.c largely as-is, move useful bits to other places to allow them being reused, specifically:

* move isa device generator functions to individual isa devices.
* move fw_cfg generator function to fw_cfg.c

v3 changes: fix rtc, support multiple lpt devices.

v4 changes:
* drop merged patches.
* split rtc crs change to separata patch.
* added two cleanup patches.
* picked up ack & review tags.

v5 changes:
* add comment for rtc crs update.
* add even more cleanup patches.
* picked up ack & review tags.

v6 changes:
* floppy: move cmos_get_fd_drive_type.
* picked up ack & review tags.

v7 changes:
* rebased to mst/pci branch, resolved stubs conflict.
* dropped patches already queued up in mst/pci.
* added missing sign-off.
* picked up ack & review tags.

take care,
Gerd

Gerd Hoffmann (9):
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.

 hw/i386/fw_cfg.h       |   1 +
 include/hw/block/fdc.h |   3 +-
 include/hw/i386/pc.h   |   1 -
 hw/block/fdc.c         | 111 +++++++++++++++++++++-
 hw/i386/acpi-build.c   | 211 ++---------------------------------------
 hw/i386/fw_cfg.c       |  28 ++++++
 hw/i386/pc.c           |  25 -----
 hw/input/pckbd.c       |  31 ++++++
 stubs/cmos.c           |   7 ++
 stubs/Makefile.objs    |   1 +
 10 files changed, 184 insertions(+), 235 deletions(-)
 create mode 100644 stubs/cmos.c
#12 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Igor Mammedov
Quoted 5 lines · On Wed, 10 Jun 2020 11:41:22 +0200 Gerd Hoffmann <[email protected]> wrote:

First batch of microvm patches, some generic acpi stuff. Split the acpi-build.c monster, specifically split the pc and q35 and pci bits into a separate file which we can skip building at some point in the future.

Quoted 4 lines
Quoted 2 lines

It looks like series is missing patch to whitelist changed ACPI tables in bios-table-test.

Right. Does it pass make check?

No, but after 'git cherry-pick 9b20a3365d73dad4ad144eab9c5827dbbb2e9f21' it does.

Quoted 4 lines
Quoted 2 lines

Do we already have test case for microvm in bios-table-test, if not it's probably time to add it.

Separately :)

Especially as this series is just preparing cleanups and doesn't actually add acpi support to microvm yet.

But, yes, adding a testcase sounds useful.

take care,
Gerd

#13 lore raw
Quoted 10 lines · Gerd Hoffmann
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Igor Mammedov
Quoted 5 lines · On Wed, 10 Jun 2020 11:41:22 +0200 Gerd Hoffmann <[email protected]> wrote:

First batch of microvm patches, some generic acpi stuff. Split the acpi-build.c monster, specifically split the pc and q35 and pci bits into a separate file which we can skip building at some point in the future.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It looks like series is missing patch to whitelist changed ACPI tables in bios-table-test.

Right. Does it pass make check?

No, but after 'git cherry-pick 9b20a3365d73dad4ad144eab9c5827dbbb2e9f21' it does.

OK pls post a complete series, ok?

Quoted 12 lines
Quoted 4 lines
Quoted 2 lines

Do we already have test case for microvm in bios-table-test, if not it's probably time to add it.

Separately :)

Especially as this series is just preparing cleanups and doesn't actually add acpi support to microvm yet.

But, yes, adding a testcase sounds useful.

take care,
Gerd

#14 lore raw
In reply to Gerd Hoffmann
Quoted 20 lines · On Wed, 10 Jun 2020 17:53:46 +0200 Gerd Hoffmann <[email protected]> wrote:
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Igor Mammedov
Quoted 5 lines · On Wed, 10 Jun 2020 11:41:22 +0200 Gerd Hoffmann <[email protected]> wrote:

First batch of microvm patches, some generic acpi stuff. Split the acpi-build.c monster, specifically split the pc and q35 and pci bits into a separate file which we can skip building at some point in the future.

Quoted 4 lines
Quoted 2 lines

It looks like series is missing patch to whitelist changed ACPI tables in bios-table-test.

Right. Does it pass make check?

No, but after 'git cherry-pick 9b20a3365d73dad4ad144eab9c5827dbbb2e9f21' it does.

Quoted 3 lines
Quoted 2 lines

Do we already have test case for microvm in bios-table-test, if not it's probably time to add it.

Quoted 6 lines
Quoted 1 line

Separately :)

Especially as this series is just preparing cleanups and doesn't actually add acpi support to microvm yet.

But, yes, adding a testcase sounds useful.

Sorry for confusion, I didn't mean to do it within this series

Quoted 4 lines

take care,
Gerd