Skip to contentSkip to conversation

pci, pc, virtio fixes and cleanups

GIT PULL Michael S. Tsirkin 1 participant 29 messages Mar 2, 2015

lore
Share & tools
lore
#0 lore raw

Hello, Peter!

This should be the last big pull as we are entering hard freeze.

This is an update of my previous pull request from
http://mid.gmane.org/[email protected]
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream_rebased
as the tree was not rebased since, you can either do both pulls or only this latest pull, result will be exactly the same.

Note: I only included here the extra 26 patches, on top of what was previously posted
http://mid.gmane.org/[email protected]
if you merge PULL v2 first, you will see just these 26 patches.

I hope all this helps reduce the amount of noise rather than increase it.

Note: these patches remove some generated files that we previously compiled. Our build system doesn't handle this well for incremental builds, resulting in build errors. This is not new, incremental builds aren't 100% reliable. You can find and remove the stale .d files from the removed sources, this will fix it - for example, if you get an error about a missing ssdt-misc.dsl, find and remove ssdt-misc.d in output directory.

The following changes since commit 11d39a131020cc5c54ff9bc86d3259f7d32bf849:

Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20150218' into staging (2015-02-26 09:08:54 +0000)

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 e32dccddb0b1fa335bf251c155e907f9d47accfd:

acpi-test-data: update after pci rewrite (2015-03-01 19:41:50 +0100)

----------------------------------------------------------------
pci, pc, virtio fixes and cleanups

Last pull for hard freeze.

A bunch of fixes all over the place.
All of ACPI refactoring has been merged.
Legacy pci commands have been dropped.

Additionally, this includes patches from soft-freeze (which apparently haven't been merged yet):

a bunch of fixes all over the place
virtio header cleanup
initial patches from virtio-1.0 branch

----------------------------------------------------------------
Cornelia Huck (3):
virtio: cull virtio_bus_set_vdev_features
virtio: feature bit manipulation helpers
virtio: add feature checking helpers

Denis V. Lunev (1):
balloon: call qdev_alias_all_properties for proxy dev in balloon class init

Igor Mammedov (59):
acpi: move generic aml building helpers into dedictated file
acpi: add build_append_namestring() helper
acpi: drop min-bytes in build_package()
pc: acpi-build: update linker on guest access
pc: acpi-build: migrate RSDP table
pc: acpi: use local var for accessing ACPI tables blob in acpi_build()
acpi: introduce AML composer aml_append()
acpi: add aml_scope() term
pc: acpi-build: use aml_scope() for \_SB scope
acpi: add aml_device() term
acpi: add aml_method() term
acpi: add aml_if() term
acpi: add aml_name() & aml_name_decl() term
acpi: add aml_int() term
acpi: add aml_return() term
acpi: add aml_arg() term
acpi: add aml_store() term
acpi: add aml_and() term
acpi: add aml_notify() term
acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers
acpi: add aml_package() term
pc: acpi-build: generate _S[345] packages dynamically
acpi: add aml_buffer() term
acpi: add aml_resource_template() helper
acpi: add aml_io() helper
acpi: include PkgLength size only when requested
acpi: add aml_operation_region() term
acpi: add aml_field() & aml_named_field() terms
acpi: add aml_local() term
acpi: add aml_string() term
pc: acpi-build: generate pvpanic device description dynamically
acpi: add aml_varpackage() term
acpi: add aml_equal() term
acpi: add aml_processor() term
acpi: add aml_eisaid() term
pc: acpi-build: drop template patching and CPU hotplug objects dynamically
pc: acpi-build: create CPU hotplug IO region dynamically
acpi: add aml_reserved_field() term
pc: acpi-build: drop template patching and memory hotplug objects dynamically
pc: acpi-build: create memory hotplug IO region dynamically
acpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), aml_qword_memory() terms
pc: pcihp: expose MMIO base and len as properties
pc: acpi-build: reserve PCIHP MMIO resources
pc: acpi-build: create PCI0._CRS dynamically
pc: acpi: drop manual hole punching for PCI hotplug resources
pc: acpi: drop manual hole punching for CPU hotplug resources
pc: acpi: drop manual hole punching for GPE0 resources
pc: acpi-build: drop remaining ssdt_misc template
acpi: add acpi_irq_no_flags() term
pc: export applesmc IO port/len
pc: acpi-build: drop template patching and create Device(SMC) dynamically
tests: ACPI test blobs update due to PCI0._CRS changes
tests: bios-tables-test: add support for testing bridges
tests: add ACPI blobs for qemu with bridge cases
pc: acpi-build: simplify PCI bus tree generation
tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation
pc: acpi-build: drop template patching and create PCI bus tree dynamically
pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs
acpi: make build_*() routines static to aml-build.c

Markus Armbruster (13):
pci: Convert core to realize
pci: Permit incremental conversion of device models to realize
pci: Trivial device model conversions to realize
pcnet: pcnet_common_init() always returns 0, change to void
pcnet: Convert to realize
serial-pci: Convert to realize
ide/ich: Convert to realize
cirrus-vga: Convert to realize
qxl: Convert to realize
pci-assign: Convert to realize
qdev: Don't exit when running into bad -global
pci: Give a few helpers internal linkage
pci-hotplug-old: Has been dead for five major releases, bury

Michael S. Tsirkin (33):
acpi-build: fix memory leak with bridge hp off bios linker: validate pointer within table
acpi: update RSDP on guest access
exec: round up size on MR resize
acpi-build: fix ACPI RAM management
acpi: has_immutable_rsdp->!rsdp_in_ram
acpi-build: simplify rsdp management for legacy scripts/update-linux-headers.sh: pull virtio hdrs
include: import virtio headers from linux 4.0
virtio: use standard virtio_ring.h
virtio: use standard-headers
virtio-balloon: use standard headers
virtio-9p: use standard headers
virtio-blk: switch to standard-headers virtio-net,tap: use standard-headers
virtio-rng: use standard-headers
virtio-scsi: use standard-headers
virtio-serial: switch to standard-headers
update-linux-headers: use standard-headers
linux-headers: use standard-headers
virtio-pci: use standard headers
scripts: add arch specific standard-headers
standard-headers: add s390 virtio headers
s390: use standard headers
acpi-build: skip hotplugged bridges update-linux-headers.sh: s/__inline__/inline/ virtio-serial-bus.c: drop virtio_ids.h
standard-headers: include stdint.h virtio_ring.h: s/__inline__/inline/
acpi: update generated hex files
acpi: drop unused generated files
acpi-test: update expected files
acpi-test-data: update after pci rewrite

Peter Krempa (2):
vl.c: Fix error messages when parsing maxmem parameters
pc: memory: Validate alignment of maxram_size to page size

Stefan Berger (5):
tpm: Extend sts register to 32 bit
tpm: Allow 32 & 16 bit accesses to the registers
tpm: Support for XFIFO register
tpm: Support for TIS selftest done flag
tpm: Support for capability flags of TIS 1.3

Tang Chen (6):
acpi, pc: Add hotunplug request cb for pc machine. acpi, ich9: Add hotunplug request cb for ich9.
acpi, pc: Add unplug cb for pc machine.
acpi, ich9: Add unplug cb for ich9.
acpi, piix4: Add unplug cb for piix4.
acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().

 hw/9pfs/virtio-9p.h                                |   18 +-
 hw/net/pcnet.h                                     |    2 +-
 hw/s390x/s390-virtio-bus.h                         |   36 +-
 hw/s390x/s390-virtio.h                             |    7 +-
 hw/tpm/tpm_int.h                                   |    1 +
 hw/tpm/tpm_tis.h                                   |    2 +-
 include/hw/acpi/aml-build.h                        |  191 ++++
 include/hw/acpi/ich9.h                             |    4 +
 include/hw/acpi/pc-hotplug.h                       |    1 +
 include/hw/acpi/pcihp.h                            |    7 +-
 include/hw/i386/pc.h                               |    1 +
 include/hw/isa/isa.h                               |   11 +-
 include/hw/pci/pci.h                               |   10 +-
 include/hw/qdev-properties.h                       |    4 +-
 include/hw/virtio/dataplane/vring-accessors.h      |    2 +-
 include/hw/virtio/dataplane/vring.h                |    2 +-
 include/hw/virtio/virtio-balloon.h                 |   35 +-
 include/hw/virtio/virtio-blk.h                     |   77 +-
 include/hw/virtio/virtio-bus.h                     |    3 -
 include/hw/virtio/virtio-net.h                     |  151 +--
 include/hw/virtio/virtio-rng.h                     |    4 +-
 include/hw/virtio/virtio-scsi.h                    |  120 +-
 include/hw/virtio/virtio-serial.h                  |   40 +-
 include/hw/virtio/virtio.h                         |   71 +-
 include/net/tap.h                                  |   24 +-
 include/standard-headers/asm-s390/kvm_virtio.h     |   64 ++
 include/standard-headers/asm-s390/virtio-ccw.h     |   21 +
 include/standard-headers/linux/if_ether.h          |    1 +
 include/standard-headers/linux/types.h             |    2 +
 include/standard-headers/linux/virtio_9p.h         |   44 +
 include/standard-headers/linux/virtio_balloon.h    |   59 +
 include/standard-headers/linux/virtio_blk.h        |  143 +++
 include/standard-headers/linux/virtio_config.h     |   64 ++
 include/standard-headers/linux/virtio_console.h    |   78 ++
 include/standard-headers/linux/virtio_ids.h        |   43 +
 include/standard-headers/linux/virtio_net.h        |  233 ++++
 include/standard-headers/linux/virtio_pci.h        |  193 ++++
 .../linux}/virtio_ring.h                           |  132 +--
 include/standard-headers/linux/virtio_rng.h        |    8 +
 include/standard-headers/linux/virtio_scsi.h       |  164 +++
 include/standard-headers/linux/virtio_types.h      |   46 +
 include/sysemu/blockdev.h                          |    2 -
 include/sysemu/sysemu.h                            |    5 -
 include/sysemu/tpm_backend.h                       |    2 +-
 linux-headers/linux/virtio_config.h                |   58 +-
 linux-headers/linux/virtio_ring.h                  |  164 +--
 device-hotplug.c                                   |    7 +-
 exec.c                                             |    2 +
 hw/9pfs/virtio-9p-device.c                         |    2 +-
 hw/acpi/aml-build.c                                |  888 +++++++++++++++
 hw/acpi/bios-linker-loader.c                       |    4 +-
 hw/acpi/ich9.c                                     |   14 +
 hw/acpi/memory_hotplug.c                           |    3 +-
 hw/acpi/pcihp.c                                    |   18 +-
 hw/acpi/piix4.c                                    |   15 +-
 hw/audio/ac97.c                                    |    5 +-
 hw/audio/es1370.c                                  |    5 +-
 hw/audio/intel-hda.c                               |    6 +-
 hw/block/virtio-blk.c                              |   31 +-
 hw/char/serial-pci.c                               |   22 +-
 hw/char/virtio-serial-bus.c                        |    4 +-
 hw/core/qdev-properties.c                          |   21 +-
 hw/core/qdev.c                                     |    8 +-
 hw/display/cirrus_vga.c                            |   11 +-
 hw/display/qxl.c                                   |   36 +-
 hw/display/vga-pci.c                               |   11 +-
 hw/display/vmware_vga.c                            |    6 +-
 hw/i2c/smbus_ich9.c                                |    5 +-
 hw/i386/acpi-build.c                               | 1179 +++++++++-----------
 hw/i386/kvm/pci-assign.c                           |   10 +-
 hw/i386/pc.c                                       |   23 +
 hw/i386/pc_piix.c                                  |    3 +
 hw/i386/pc_q35.c                                   |    3 +
 hw/ide/cmd646.c                                    |    5 +-
 hw/ide/ich.c                                       |   13 +-
 hw/ide/piix.c                                      |   10 +-
 hw/ide/via.c                                       |    6 +-
 hw/ipack/tpci200.c                                 |    6 +-
 hw/isa/i82378.c                                    |    6 +-
 hw/isa/lpc_ich9.c                                  |   14 +-
 hw/isa/piix4.c                                     |    5 +-
 hw/isa/vt82c686.c                                  |   24 +-
 hw/misc/applesmc.c                                 |    5 +-
 hw/misc/pci-testdev.c                              |    6 +-
 hw/net/e1000.c                                     |    6 +-
 hw/net/eepro100.c                                  |    6 +-
 hw/net/lance.c                                     |    3 +-
 hw/net/ne2000.c                                    |    6 +-
 hw/net/pcnet-pci.c                                 |    6 +-
 hw/net/pcnet.c                                     |    4 +-
 hw/net/rtl8139.c                                   |    6 +-
 hw/net/vhost_net.c                                 |    2 +-
 hw/net/virtio-net.c                                |   57 +-
 hw/net/vmxnet3.c                                   |    6 +-
 hw/pci-bridge/dec.c                                |    5 +-
 hw/pci-host/apb.c                                  |    5 +-
 hw/pci-host/bonito.c                               |    6 +-
 hw/pci-host/grackle.c                              |    5 +-
 hw/pci-host/piix.c                                 |   12 +-
 hw/pci-host/ppce500.c                              |    6 +-
 hw/pci-host/prep.c                                 |    6 +-
 hw/pci-host/q35.c                                  |    5 +-
 hw/pci-host/uninorth.c                             |   20 +-
 hw/pci-host/versatile.c                            |    5 +-
 hw/pci/pci-hotplug-old.c                           |  342 ------
 hw/pci/pci.c                                       |  127 ++-
 hw/s390x/virtio-ccw.c                              |   12 +-
 hw/scsi/virtio-scsi.c                              |    9 +-
 hw/sd/sdhci.c                                      |    5 +-
 hw/tpm/tpm_passthrough.c                           |   37 +-
 hw/tpm/tpm_tis.c                                   |  131 ++-
 hw/usb/hcd-ehci-pci.c                              |    6 +-
 hw/usb/hcd-xhci.c                                  |    6 +-
 hw/virtio/dataplane/vring.c                        |   10 +-
 hw/virtio/virtio-balloon.c                         |    2 +-
 hw/virtio/virtio-bus.c                             |   14 -
 hw/virtio/virtio-mmio.c                            |    2 +-
 hw/virtio/virtio-pci.c                             |   63 +-
 hw/virtio/virtio.c                                 |   33 +-
 hw/watchdog/wdt_i6300esb.c                         |    6 +-
 stubs/pci-drive-hot-add.c                          |   10 -
 tests/bios-tables-test.c                           |   45 +-
 vl.c                                               |   34 +-
 default-configs/i386-softmmu.mak                   |    1 -
 default-configs/x86_64-softmmu.mak                 |    1 -
 hmp-commands.hx                                    |   32 -
 hw/acpi/Makefile.objs                              |    1 +
 hw/i386/Makefile.objs                              |    4 +-
 hw/i386/acpi-dsdt-cpu-hotplug.dsl                  |   17 +-
 hw/i386/acpi-dsdt-isa.dsl                          |   11 -
 hw/i386/acpi-dsdt-mem-hotplug.dsl                  |   36 +-
 hw/i386/acpi-dsdt-pci-crs.dsl                      |   92 --
 hw/i386/acpi-dsdt.dsl                              |   46 -
 hw/i386/acpi-dsdt.hex.generated                    |  224 +---
 hw/i386/q35-acpi-dsdt.dsl                          |   19 -
 hw/i386/q35-acpi-dsdt.hex.generated                |  224 +---
 hw/i386/ssdt-mem.dsl                               |   77 --
 hw/i386/ssdt-mem.hex.generated                     |  213 ----
 hw/i386/ssdt-misc.dsl                              |  122 --
 hw/i386/ssdt-misc.hex.generated                    |  399 -------
 hw/i386/ssdt-pcihp.dsl                             |  100 --
 hw/i386/ssdt-pcihp.hex.generated                   |  251 -----
 hw/i386/ssdt-proc.dsl                              |   63 --
 hw/i386/ssdt-proc.hex.generated                    |  134 ---
 hw/pci/Makefile.objs                               |    2 -
 scripts/update-linux-headers.sh                    |   52 +-
 stubs/Makefile.objs                                |    1 -
 tests/acpi-test-data/pc/DSDT                       |  Bin 3621 -> 2970 bytes
 tests/acpi-test-data/pc/SSDT                       |  Bin 2279 -> 2476 bytes
 tests/acpi-test-data/pc/SSDT.bridge                |  Bin 0 -> 4335 bytes
 tests/acpi-test-data/q35/DSDT                      |  Bin 8211 -> 7608 bytes
 tests/acpi-test-data/q35/SSDT                      |  Bin 560 -> 681 bytes
 tests/acpi-test-data/q35/SSDT.bridge               |  Bin 0 -> 698 bytes
 153 files changed, 3576 insertions(+), 4409 deletions(-)
 create mode 100644 include/hw/acpi/aml-build.h
 create mode 100644 include/standard-headers/asm-s390/kvm_virtio.h
 create mode 100644 include/standard-headers/asm-s390/virtio-ccw.h
 create mode 100644 include/standard-headers/linux/if_ether.h
 create mode 100644 include/standard-headers/linux/types.h
 create mode 100644 include/standard-headers/linux/virtio_9p.h
 create mode 100644 include/standard-headers/linux/virtio_balloon.h
 create mode 100644 include/standard-headers/linux/virtio_blk.h
 create mode 100644 include/standard-headers/linux/virtio_config.h
 create mode 100644 include/standard-headers/linux/virtio_console.h
 create mode 100644 include/standard-headers/linux/virtio_ids.h
 create mode 100644 include/standard-headers/linux/virtio_net.h
 create mode 100644 include/standard-headers/linux/virtio_pci.h
 rename include/{hw/virtio => standard-headers/linux}/virtio_ring.h (61%)
 create mode 100644 include/standard-headers/linux/virtio_rng.h
 create mode 100644 include/standard-headers/linux/virtio_scsi.h
 create mode 100644 include/standard-headers/linux/virtio_types.h
 create mode 100644 hw/acpi/aml-build.c
 delete mode 100644 hw/pci/pci-hotplug-old.c
 delete mode 100644 stubs/pci-drive-hot-add.c
 delete mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl
 delete mode 100644 hw/i386/ssdt-mem.dsl
 delete mode 100644 hw/i386/ssdt-mem.hex.generated
 delete mode 100644 hw/i386/ssdt-misc.dsl
 delete mode 100644 hw/i386/ssdt-misc.hex.generated
 delete mode 100644 hw/i386/ssdt-pcihp.dsl
 delete mode 100644 hw/i386/ssdt-pcihp.hex.generated
 delete mode 100644 hw/i386/ssdt-proc.dsl
 delete mode 100644 hw/i386/ssdt-proc.hex.generated
 create mode 100644 tests/acpi-test-data/pc/SSDT.bridge
 create mode 100644 tests/acpi-test-data/q35/SSDT.bridge
#1 lore raw

[Qemu-devel] [PULL v3 01/26] balloon: call qdev_alias_all_properties for proxy dev in balloon class init

From: "Denis V. Lunev" <[email protected]>

The idea is that all other virtio devices are calling this helper to merge properties of the proxy device. This is the only difference in between this helper and code in inside virtio_instance_init_common. The patch should not cause any harm as property list in generic balloon code is empty.

This also allows to avoid some dummy errors like fixed by this
commit 91ba21208839643603e7f7fa5864723c3f371ebe
Author: Gonglei <[email protected]>
Date: Tue Sep 30 14:10:35 2014 +0800
virtio-balloon: fix virtio-balloon child refcount in transports

---
 hw/s390x/virtio-ccw.c  | 5 ++---
 hw/virtio/virtio-pci.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
hw/s390x/virtio-ccw.c +2 -3
index 3fee4aa..ffbb9c2 100644
@@ -898,9 +898,8 @@ static void balloon_ccw_stats_set_poll_interval(Object *obj, struct Visitor *v,
 static void virtio_ccw_balloon_instance_init(Object *obj)
 {
     VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(obj);
-    object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BALLOON);
-    object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
-    object_unref(OBJECT(&dev->vdev));
+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+                                TYPE_VIRTIO_BALLOON);
     object_property_add(obj, "guest-stats", "guest statistics",
                         balloon_ccw_stats_get_all, NULL, NULL, dev, NULL);
 
hw/virtio/virtio-pci.c +2 -3
index 6dd41b9..e7baf7b 100644
@@ -1274,9 +1274,8 @@ static void virtio_balloon_pci_class_init(ObjectClass *klass, void *data)
 static void virtio_balloon_pci_instance_init(Object *obj)
 {
     VirtIOBalloonPCI *dev = VIRTIO_BALLOON_PCI(obj);
-    object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BALLOON);
-    object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
-    object_unref(OBJECT(&dev->vdev));
+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+                                TYPE_VIRTIO_BALLOON);
     object_property_add(obj, "guest-stats", "guest statistics",
                         balloon_pci_stats_get_all, NULL, NULL, dev,
                         NULL);
Signature · 1 line
MST
#2 lore raw

[Qemu-devel] [PULL v3 02/26] tpm: Extend sts register to 32 bit

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

More recent TIS specs extend the STS register to 32 bit. While we don't store the TIS interface state, yet, we can extend it without sideeffects.

---
 hw/tpm/tpm_tis.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_tis.h +1 -1
index 1a0db23..db78d51 100644
@@ -41,7 +41,7 @@ typedef enum {
 typedef struct TPMLocality {
     TPMTISState state;
     uint8_t access;
-    uint8_t sts;
+    uint32_t sts;
     uint32_t inte;
     uint32_t ints;
 
Signature · 1 line
MST
#3 lore raw

[Qemu-devel] [PULL v3 04/26] tpm: Support for XFIFO register

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

Support for the XFIFO register (range) of the TIS 1.3 specification. We support a range of 64 bytes.

---
 hw/tpm/tpm_tis.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/tpm/tpm_tis.c +4 -0
index 6170693..a37c7ce 100644
@@ -51,6 +51,8 @@
 #define TPM_TIS_REG_INTF_CAPABILITY       0x14
 #define TPM_TIS_REG_STS                   0x18
 #define TPM_TIS_REG_DATA_FIFO             0x24
+#define TPM_TIS_REG_DATA_XFIFO            0x80
+#define TPM_TIS_REG_DATA_XFIFO_END        0xbc
 #define TPM_TIS_REG_DID_VID               0xf00
 #define TPM_TIS_REG_RID                   0xf04
 
@@ -476,6 +478,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
         }
         break;
     case TPM_TIS_REG_DATA_FIFO:
+    case TPM_TIS_REG_DATA_XFIFO ... TPM_TIS_REG_DATA_XFIFO_END:
         if (tis->active_locty == locty) {
             if (size > 4 - (addr & 0x3)) {
                 /* prevent access beyond FIFO */
@@ -762,6 +765,7 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
         }
         break;
     case TPM_TIS_REG_DATA_FIFO:
+    case TPM_TIS_REG_DATA_XFIFO ... TPM_TIS_REG_DATA_XFIFO_END:
         /* data fifo */
         if (tis->active_locty != locty) {
             break;
Signature · 1 line
MST
#4 lore raw

[Qemu-devel] [PULL v3 03/26] tpm: Allow 32 & 16 bit accesses to the registers

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

Improve the access to the registers with 32 and 16 bit reads and writes. Also enable access to a non-base register address, such as reads of the 2nd byte of a register. Map the FIFO byte access to any byte within its 4 byte register (following specs).

---
 hw/tpm/tpm_tis.c | 60 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 47 insertions(+), 13 deletions(-)
hw/tpm/tpm_tis.c +47 -13
index c0e7cd7..6170693 100644
@@ -427,6 +427,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
     uint32_t val = 0xffffffff;
     uint8_t locty = tpm_tis_locality_from_addr(addr);
     uint32_t avail;
+    uint8_t v;
 
     if (tpm_backend_had_startup_error(s->be_driver)) {
         return val;
@@ -476,14 +477,26 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
         break;
     case TPM_TIS_REG_DATA_FIFO:
         if (tis->active_locty == locty) {
-            switch (tis->loc[locty].state) {
-            case TPM_TIS_STATE_COMPLETION:
-                val = tpm_tis_data_read(s, locty);
-                break;
-            default:
-                val = TPM_TIS_NO_DATA_BYTE;
-                break;
+            if (size > 4 - (addr & 0x3)) {
+                /* prevent access beyond FIFO */
+                size = 4 - (addr & 0x3);
+            }
+            val = 0;
+            shift = 0;
+            while (size > 0) {
+                switch (tis->loc[locty].state) {
+                case TPM_TIS_STATE_COMPLETION:
+                    v = tpm_tis_data_read(s, locty);
+                    break;
+                default:
+                    v = TPM_TIS_NO_DATA_BYTE;
+                    break;
+                }
+                val |= (v << shift);
+                shift += 8;
+                size--;
             }
+            shift = 0; /* no more adjustments */
         }
         break;
     case TPM_TIS_REG_DID_VID:
@@ -518,11 +531,13 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
 {
     TPMState *s = opaque;
     TPMTISEmuState *tis = &s->s.tis;
-    uint16_t off = addr & 0xfff;
+    uint16_t off = addr & 0xffc;
+    uint8_t shift = (addr & 0x3) * 8;
     uint8_t locty = tpm_tis_locality_from_addr(addr);
     uint8_t active_locty, l;
     int c, set_new_locty = 1;
     uint16_t len;
+    uint32_t mask = (size == 1) ? 0xff : ((size == 2) ? 0xffff : ~0);
 
     DPRINTF("tpm_tis: write.%u(%08x) = %08x\n", size, (int)addr, (uint32_t)val);
 
@@ -535,6 +550,15 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
         return;
     }
 
+    val &= mask;
+
+    if (shift) {
+        val <<= shift;
+        mask <<= shift;
+    }
+
+    mask ^= 0xffffffff;
+
     switch (off) {
     case TPM_TIS_REG_ACCESS:
 
@@ -646,9 +670,10 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
             break;
         }
 
-        tis->loc[locty].inte = (val & (TPM_TIS_INT_ENABLED |
-                                       TPM_TIS_INT_POLARITY_MASK |
-                                       TPM_TIS_INTERRUPTS_SUPPORTED));
+        tis->loc[locty].inte &= mask;
+        tis->loc[locty].inte |= (val & (TPM_TIS_INT_ENABLED |
+                                        TPM_TIS_INT_POLARITY_MASK |
+                                        TPM_TIS_INTERRUPTS_SUPPORTED));
         break;
     case TPM_TIS_REG_INT_VECTOR:
         /* hard wired -- ignore */
@@ -747,16 +772,25 @@ static void tpm_tis_mmio_write_intern(void *opaque, hwaddr addr,
             tis->loc[locty].state == TPM_TIS_STATE_COMPLETION) {
             /* drop the byte */
         } else {
-            DPRINTF("tpm_tis: Byte to send to TPM: %02x\n", (uint8_t)val);
+            DPRINTF("tpm_tis: Data to send to TPM: %08x (size=%d)\n",
+                    val, size);
             if (tis->loc[locty].state == TPM_TIS_STATE_READY) {
                 tis->loc[locty].state = TPM_TIS_STATE_RECEPTION;
                 tis->loc[locty].sts = TPM_TIS_STS_EXPECT | TPM_TIS_STS_VALID;
             }
 
-            if ((tis->loc[locty].sts & TPM_TIS_STS_EXPECT)) {
+            val >>= shift;
+            if (size > 4 - (addr & 0x3)) {
+                /* prevent access beyond FIFO */
+                size = 4 - (addr & 0x3);
+            }
+
+            while ((tis->loc[locty].sts & TPM_TIS_STS_EXPECT) && size > 0) {
                 if (tis->loc[locty].w_offset < tis->loc[locty].w_buffer.size) {
                     tis->loc[locty].w_buffer.
                         buffer[tis->loc[locty].w_offset++] = (uint8_t)val;
+                    val >>= 8;
+                    size--;
                 } else {
                     tis->loc[locty].sts = TPM_TIS_STS_VALID;
                 }
Signature · 1 line
MST
#5 lore raw

[Qemu-devel] [PULL v3 05/26] tpm: Support for TIS selftest done flag

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

Extend the backend to check whether the TPM_ContinueSelfTest finished successfully and provide a flag to the TIS front-end if it successfully finished. The TIS then sets a flag in all localities in the STS register and keeps it until the next reset.

---
 hw/tpm/tpm_int.h             |  1 +
 include/sysemu/tpm_backend.h |  2 +-
 hw/tpm/tpm_passthrough.c     | 37 ++++++++++++++++++++++++----
 hw/tpm/tpm_tis.c             | 58 ++++++++++++++++++++++++++++++++++----------
 4 files changed, 79 insertions(+), 19 deletions(-)
hw/tpm/tpm_int.h +1 -0
index 2f582ca..2b35fe2 100644
@@ -62,6 +62,7 @@ struct tpm_resp_hdr {
 
 #define TPM_FAIL                  9
 
+#define TPM_ORD_ContinueSelfTest  0x53
 #define TPM_ORD_GetTicks          0xf1
 
 #endif /* TPM_TPM_INT_H */
include/sysemu/tpm_backend.h +1 -1
index 825f33b..540ee25 100644
@@ -56,7 +56,7 @@ struct TPMBackend {
     QLIST_ENTRY(TPMBackend) list;
 };
 
-typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty);
+typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done);
 
 typedef struct TPMSizedBuffer {
     uint32_t size;
hw/tpm/tpm_passthrough.c +32 -5
index 2bf3c6f..a94c7c5 100644
@@ -112,14 +112,31 @@ static void tpm_write_fatal_error_response(uint8_t *out, uint32_t out_len)
     }
 }
 
+static bool tpm_passthrough_is_selftest(const uint8_t *in, uint32_t in_len)
+{
+    struct tpm_req_hdr *hdr = (struct tpm_req_hdr *)in;
+
+    if (in_len >= sizeof(*hdr)) {
+        return (be32_to_cpu(hdr->ordinal) == TPM_ORD_ContinueSelfTest);
+    }
+
+    return false;
+}
+
 static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt,
                                         const uint8_t *in, uint32_t in_len,
-                                        uint8_t *out, uint32_t out_len)
+                                        uint8_t *out, uint32_t out_len,
+                                        bool *selftest_done)
 {
     int ret;
+    bool is_selftest;
+    const struct tpm_resp_hdr *hdr;
 
     tpm_pt->tpm_op_canceled = false;
     tpm_pt->tpm_executing = true;
+    *selftest_done = false;
+
+    is_selftest = tpm_passthrough_is_selftest(in, in_len);
 
     ret = tpm_passthrough_unix_write(tpm_pt->tpm_fd, in, in_len);
     if (ret != in_len) {
@@ -149,6 +166,11 @@ static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt,
                      "packet from TPM\n");
     }
 
+    if (is_selftest && (ret >= sizeof(struct tpm_resp_hdr))) {
+        hdr = (struct tpm_resp_hdr *)out;
+        *selftest_done = (be32_to_cpu(hdr->errcode) == 0);
+    }
+
 err_exit:
     if (ret < 0) {
         tpm_write_fatal_error_response(out, out_len);
@@ -160,13 +182,15 @@ err_exit:
 }
 
 static int tpm_passthrough_unix_transfer(TPMPassthruState *tpm_pt,
-                                         const TPMLocality *locty_data)
+                                         const TPMLocality *locty_data,
+                                         bool *selftest_done)
 {
     return tpm_passthrough_unix_tx_bufs(tpm_pt,
                                         locty_data->w_buffer.buffer,
                                         locty_data->w_offset,
                                         locty_data->r_buffer.buffer,
-                                        locty_data->r_buffer.size);
+                                        locty_data->r_buffer.size,
+                                        selftest_done);
 }
 
 static void tpm_passthrough_worker_thread(gpointer data,
@@ -175,16 +199,19 @@ static void tpm_passthrough_worker_thread(gpointer data,
     TPMPassthruThreadParams *thr_parms = user_data;
     TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(thr_parms->tb);
     TPMBackendCmd cmd = (TPMBackendCmd)data;
+    bool selftest_done = false;
 
     DPRINTF("tpm_passthrough: processing command type %d\n", cmd);
 
     switch (cmd) {
     case TPM_BACKEND_CMD_PROCESS_CMD:
         tpm_passthrough_unix_transfer(tpm_pt,
-                                      thr_parms->tpm_state->locty_data);
+                                      thr_parms->tpm_state->locty_data,
+                                      &selftest_done);
 
         thr_parms->recv_data_callback(thr_parms->tpm_state,
-                                      thr_parms->tpm_state->locty_number);
+                                      thr_parms->tpm_state->locty_number,
+                                      selftest_done);
         break;
     case TPM_BACKEND_CMD_INIT:
     case TPM_BACKEND_CMD_END:
hw/tpm/tpm_tis.c +45 -13

137 lines not on this page · raw message

Signature · 1 line
MST
#6 lore raw

[Qemu-devel] [PULL v3 06/26] tpm: Support for capability flags of TIS 1.3

In reply to Michael S. Tsirkin

From: Stefan Berger <[email protected]>

Provide the TIS 1.3 capability flags.
The interface now looks like a TIS 1.3 interface. It's fully compatible with previous TIS 1.2 and drivers written for TIS 1.2 continue to work.

---
 hw/tpm/tpm_tis.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
hw/tpm/tpm_tis.c +8 -1
index 61186c5..d0bb97f 100644
@@ -14,7 +14,7 @@
  *
  * Implementation of the TIS interface according to specs found at
  * http://www.trustedcomputinggroup.org. This implementation currently
- * supports version 1.21, revision 1.0.
+ * supports version 1.3, 21 March 2013
  * In the developers menu choose the PC Client section then find the TIS
  * specification.
  */
@@ -103,8 +103,15 @@
 
 #endif
 
+#define TPM_TIS_CAP_INTERFACE_VERSION1_3 (2 << 28)
+#define TPM_TIS_CAP_DATA_TRANSFER_64B    (3 << 9)
+#define TPM_TIS_CAP_DATA_TRANSFER_LEGACY (0 << 9)
+#define TPM_TIS_CAP_BURST_COUNT_DYNAMIC  (0 << 8)
 #define TPM_TIS_CAP_INTERRUPT_LOW_LEVEL  (1 << 4) /* support is mandatory */
 #define TPM_TIS_CAPABILITIES_SUPPORTED   (TPM_TIS_CAP_INTERRUPT_LOW_LEVEL | \
+                                          TPM_TIS_CAP_BURST_COUNT_DYNAMIC | \
+                                          TPM_TIS_CAP_DATA_TRANSFER_64B | \
+                                          TPM_TIS_CAP_INTERFACE_VERSION1_3 | \
                                           TPM_TIS_INTERRUPTS_SUPPORTED)
 
 #define TPM_TIS_TPM_DID       0x0001
Signature · 1 line
MST
#7 lore raw

[Qemu-devel] [PULL v3 09/26] pc: acpi: drop manual hole punching for CPU hotplug resources

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Drops manual hole punching in PCI0._CRS on PIIX4 machine type for CPU hotplug resources.
Resources will be consumed by Device(PRES) that is attached to PCI bus. The same way how it currently works for mem hotlpug.

---
 hw/i386/acpi-build.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
hw/i386/acpi-build.c +1 -5
index 02e2597..0de261a 100644
@@ -885,11 +885,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_append(crs,
             aml_word_io(aml_min_fixed, aml_max_fixed,
                         aml_pos_decode, aml_entire_range,
-                        0x0000, 0x0D00, 0xAEFF, 0x0000, 0xA200));
-        aml_append(crs,
-            aml_word_io(aml_min_fixed, aml_max_fixed,
-                        aml_pos_decode, aml_entire_range,
-                        0x0000, 0xAF20, 0xAFDF, 0x0000, 0x00C0));
+                        0x0000, 0x0D00, 0xAFDF, 0x0000, 0xA2E0));
         aml_append(crs,
             aml_word_io(aml_min_fixed, aml_max_fixed,
                         aml_pos_decode, aml_entire_range,
Signature · 1 line
MST
#8 lore raw

[Qemu-devel] [PULL v3 07/26] pc: acpi-build: create PCI0._CRS dynamically

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Replace template patching and runtime calculation in _CRS() method with static _CRS defined in SSDT. No functional change except of as mentined above and _CRS being moved from DSDT to SSDT.

---
 hw/i386/acpi-build.c          | 88 ++++++++++++++++++++++++-----------------
 hw/i386/acpi-dsdt-pci-crs.dsl | 92 -------------------------------------------
 hw/i386/acpi-dsdt.dsl         | 45 ---------------------
 hw/i386/q35-acpi-dsdt.dsl     | 18 ---------
 hw/i386/ssdt-misc.dsl         | 19 ---------
 5 files changed, 52 insertions(+), 210 deletions(-)
 delete mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl
hw/i386/acpi-build.c +52 -36
index 4d5d7e3..355f9b7 100644
@@ -346,24 +346,6 @@ static void acpi_align_size(GArray *blob, unsigned align)
     g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
 }
 
-/* Set a value within table in a safe manner */
-#define ACPI_BUILD_SET_LE(table, size, off, bits, val) \
-    do { \
-        uint64_t ACPI_BUILD_SET_LE_val = cpu_to_le64(val); \
-        memcpy(acpi_data_get_ptr(table, size, off, \
-                                 (bits) / BITS_PER_BYTE), \
-               &ACPI_BUILD_SET_LE_val, \
-               (bits) / BITS_PER_BYTE); \
-    } while (0)
-
-static inline void *acpi_data_get_ptr(uint8_t *table_data, unsigned table_size,
-                                      unsigned off, unsigned size)
-{
-    assert(off + size > off);
-    assert(off + size <= table_size);
-    return table_data + off;
-}
-
 static inline void acpi_add_table(GArray *table_offsets, GArray *table_data)
 {
     uint32_t offset = cpu_to_le32(table_data->len);
@@ -860,22 +842,6 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
     g_free(child);
 }
 
-static void patch_pci_windows(PcPciInfo *pci, uint8_t *start, unsigned size)
-{
-    ACPI_BUILD_SET_LE(start, size, acpi_pci32_start[0], 32, pci->w32.begin);
-
-    ACPI_BUILD_SET_LE(start, size, acpi_pci32_end[0], 32, pci->w32.end - 1);
-
-    if (pci->w64.end || pci->w64.begin) {
-        ACPI_BUILD_SET_LE(start, size, acpi_pci64_valid[0], 8, 1);
-        ACPI_BUILD_SET_LE(start, size, acpi_pci64_start[0], 64, pci->w64.begin);
-        ACPI_BUILD_SET_LE(start, size, acpi_pci64_end[0], 64, pci->w64.end - 1);
-        ACPI_BUILD_SET_LE(start, size, acpi_pci64_length[0], 64, pci->w64.end - pci->w64.begin);
-    } else {
-        ACPI_BUILD_SET_LE(start, size, acpi_pci64_valid[0], 8, 0);
-    }
-}
-
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -898,9 +864,59 @@ build_ssdt(GArray *table_data, GArray *linker,
     ssdt_ptr = acpi_data_push(ssdt->buf, sizeof(ssdp_misc_aml));
     memcpy(ssdt_ptr, ssdp_misc_aml, sizeof(ssdp_misc_aml));
 
-    patch_pci_windows(pci, ssdt_ptr, sizeof(ssdp_misc_aml));
-
     scope = aml_scope("\\_SB.PCI0");
+    /* build PCI0._CRS */
+    crs = aml_resource_template();
+    aml_append(crs,
+        aml_word_bus_number(aml_min_fixed, aml_max_fixed, aml_pos_decode,
+                            0x0000, 0x0000, 0x00FF, 0x0000, 0x0100));
+    aml_append(crs, aml_io(aml_decode16, 0x0CF8, 0x0CF8, 0x01, 0x08));
+
+    aml_append(crs,
+        aml_word_io(aml_min_fixed, aml_max_fixed,
+                    aml_pos_decode, aml_entire_range,
+                    0x0000, 0x0000, 0x0CF7, 0x0000, 0x0CF8));
+    if (ich9_lpc_find()) { /* Q35 */
+        aml_append(crs,
+            aml_word_io(aml_min_fixed, aml_max_fixed,
+                        aml_pos_decode, aml_entire_range,
+                        0x0000, 0x0D00, 0xFFFF, 0x0000, 0xF300));
+    } else { /* piix4 */
+        aml_append(crs,
+            aml_word_io(aml_min_fixed, aml_max_fixed,
+                        aml_pos_decode, aml_entire_range,
+                        0x0000, 0x0D00, 0xADFF, 0x0000, 0xA100));
+        aml_append(crs,
+            aml_word_io(aml_min_fixed, aml_max_fixed,
+                        aml_pos_decode, aml_entire_range,
+                        0x0000, 0xAE0F, 0xAEFF, 0x0000, 0x00F1));
+        aml_append(crs,
+            aml_word_io(aml_min_fixed, aml_max_fixed,
+                        aml_pos_decode, aml_entire_range,
+                        0x0000, 0xAF20, 0xAFDF, 0x0000, 0x00C0));
+        aml_append(crs,
+            aml_word_io(aml_min_fixed, aml_max_fixed,
+                        aml_pos_decode, aml_entire_range,
+                        0x0000, 0xAFE4, 0xFFFF, 0x0000, 0x501C));
+    }
+    aml_append(crs,
+        aml_dword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed,
+                         aml_cacheable, aml_ReadWrite,
+                         0, 0x000A0000, 0x000BFFFF, 0, 0x00020000));
+    aml_append(crs,
+        aml_dword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed,
+                         aml_non_cacheable, aml_ReadWrite,
+                         0, pci->w32.begin, pci->w32.end - 1, 0,
+                         pci->w32.end - pci->w32.begin));
+    if (pci->w64.begin) {
+        aml_append(crs,
+            aml_qword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed,
+                             aml_cacheable, aml_ReadWrite,
+                             0, pci->w64.begin, pci->w64.end - 1, 0,
+                             pci->w64.end - pci->w64.begin));
+    }
+    aml_append(scope, aml_name_decl("_CRS", crs));
+
     /* reserve PCIHP resources */
     if (pm->pcihp_io_len) {
         dev = aml_device("PHPR");
hw/i386/acpi-dsdt-pci-crs.dsl deleted +0 -92

92 lines not on this page · raw message

hw/i386/acpi-dsdt.dsl +0 -45

57 lines not on this page · raw message

hw/i386/q35-acpi-dsdt.dsl +0 -18
index e1cee5d..3fb4b2f 100644
@@ -48,23 +48,6 @@ DefinitionBlock (
 /****************************************************************
  * PCI Bus definition
  ****************************************************************/
-#define BOARD_SPECIFIC_PCI_RESOURSES \
-     WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \
-         0x0000, \
-         0x0000, \
-         0x0CD7, \
-         0x0000, \
-         0x0CD8, \
-         ,, , TypeStatic) \
-     /* 0xcd8-0xcf7 hole for CPU hotplug, hw/acpi/ich9.c:ICH9_PROC_BASE */ \
-     WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \
-         0x0000, \
-         0x0D00, \
-         0xFFFF, \
-         0x0000, \
-         0xF300, \
-         ,, , TypeStatic)
-
     Scope(\_SB) {
         Device(PCI0) {
             Name(_HID, EisaId("PNP0A08"))
@@ -131,7 +114,6 @@ DefinitionBlock (
         }
     }
 
-#include "acpi-dsdt-pci-crs.dsl"
 #include "acpi-dsdt-hpet.dsl"
 
 
hw/i386/ssdt-misc.dsl +0 -19
index 2588e30..8d61f21 100644
@@ -18,23 +18,4 @@ ACPI_EXTRACT_ALL_CODE ssdp_misc_aml
 
 DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1)
 {
-
-/****************************************************************
- * PCI memory ranges
- ****************************************************************/
-
-    Scope(\) {
-       ACPI_EXTRACT_NAME_DWORD_CONST acpi_pci32_start
-       Name(P0S, 0x12345678)
-       ACPI_EXTRACT_NAME_DWORD_CONST acpi_pci32_end
-       Name(P0E, 0x12345678)
-       ACPI_EXTRACT_NAME_BYTE_CONST acpi_pci64_valid
-       Name(P1V, 0x12)
-       ACPI_EXTRACT_NAME_BUFFER8 acpi_pci64_start
-       Name(P1S, Buffer() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
-       ACPI_EXTRACT_NAME_BUFFER8 acpi_pci64_end
-       Name(P1E, Buffer() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
-       ACPI_EXTRACT_NAME_BUFFER8 acpi_pci64_length
-       Name(P1L, Buffer() { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })
-    }
 }
Signature · 1 line
MST
#9 lore raw

[Qemu-devel] [PULL v3 08/26] pc: acpi: drop manual hole punching for PCI hotplug resources

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Drops manual hole punching in PCI0._CRS for PIIX4 machine type. Resources will be consumed by Device(PHPR) that cwis attached to PCI bus. The same way how it currently works for mem hotlpug.

Manual hole in PIIX4 _CRS wasn't correct anyway since it was legacy size 0xF while current PCIHP MMIO region is of size 0x14.

---
 hw/i386/acpi-build.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
hw/i386/acpi-build.c +1 -5
index 355f9b7..02e2597 100644
@@ -885,11 +885,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_append(crs,
             aml_word_io(aml_min_fixed, aml_max_fixed,
                         aml_pos_decode, aml_entire_range,
-                        0x0000, 0x0D00, 0xADFF, 0x0000, 0xA100));
-        aml_append(crs,
-            aml_word_io(aml_min_fixed, aml_max_fixed,
-                        aml_pos_decode, aml_entire_range,
-                        0x0000, 0xAE0F, 0xAEFF, 0x0000, 0x00F1));
+                        0x0000, 0x0D00, 0xAEFF, 0x0000, 0xA200));
         aml_append(crs,
             aml_word_io(aml_min_fixed, aml_max_fixed,
                         aml_pos_decode, aml_entire_range,
Signature · 1 line
MST
#10 lore raw

[Qemu-devel] [PULL v3 10/26] pc: acpi: drop manual hole punching for GPE0 resources

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Drops manual hole punching in PCI0._CRS on PIIX4 machine type for GPE0 resources. Resources will be consumed by Device(GPE0) that is attached to PCI namespace.
There is GPE device with HID ACPI0006 since ACPI2.0 that should be used for this purpose but none of Windows versions support it and show it as "unknown device", so reserve resource in old fashioned way with PNP0A06 device to make windows happy and actually reserve resources.

Along with last hole _CRS layout of PIIX4 machine becomes the same as Q35 one, so merge them together and use the same _CRS for both machine types.

---
 hw/i386/acpi-build.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
hw/i386/acpi-build.c +17 -15
index 0de261a..2700154 100644
@@ -876,21 +876,10 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_word_io(aml_min_fixed, aml_max_fixed,
                     aml_pos_decode, aml_entire_range,
                     0x0000, 0x0000, 0x0CF7, 0x0000, 0x0CF8));
-    if (ich9_lpc_find()) { /* Q35 */
-        aml_append(crs,
-            aml_word_io(aml_min_fixed, aml_max_fixed,
-                        aml_pos_decode, aml_entire_range,
-                        0x0000, 0x0D00, 0xFFFF, 0x0000, 0xF300));
-    } else { /* piix4 */
-        aml_append(crs,
-            aml_word_io(aml_min_fixed, aml_max_fixed,
-                        aml_pos_decode, aml_entire_range,
-                        0x0000, 0x0D00, 0xAFDF, 0x0000, 0xA2E0));
-        aml_append(crs,
-            aml_word_io(aml_min_fixed, aml_max_fixed,
-                        aml_pos_decode, aml_entire_range,
-                        0x0000, 0xAFE4, 0xFFFF, 0x0000, 0x501C));
-    }
+    aml_append(crs,
+        aml_word_io(aml_min_fixed, aml_max_fixed,
+                    aml_pos_decode, aml_entire_range,
+                    0x0000, 0x0D00, 0xFFFF, 0x0000, 0xF300));
     aml_append(crs,
         aml_dword_memory(aml_pos_decode, aml_min_fixed, aml_max_fixed,
                          aml_cacheable, aml_ReadWrite,
@@ -909,6 +898,19 @@ build_ssdt(GArray *table_data, GArray *linker,
     }
     aml_append(scope, aml_name_decl("_CRS", crs));
 
+    /* reserve GPE0 block resources */
+    dev = aml_device("GPE0");
+    aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06")));
+    aml_append(dev, aml_name_decl("_UID", aml_string("GPE0 resources")));
+    /* device present, functioning, decoding, not shown in UI */
+    aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
+    crs = aml_resource_template();
+    aml_append(crs,
+        aml_io(aml_decode16, pm->gpe0_blk, pm->gpe0_blk, 1, pm->gpe0_blk_len)
+    );
+    aml_append(dev, aml_name_decl("_CRS", crs));
+    aml_append(scope, dev);
+
     /* reserve PCIHP resources */
     if (pm->pcihp_io_len) {
         dev = aml_device("PHPR");
Signature · 1 line
MST
#11 lore raw

[Qemu-devel] [PULL v3 12/26] acpi: add acpi_irq_no_flags() term

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

---
 include/hw/acpi/aml-build.h |  1 +
 hw/acpi/aml-build.c         | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
include/hw/acpi/aml-build.h +1 -0
index d2b2c35..1187197 100644
@@ -146,6 +146,7 @@ Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
             uint8_t aln, uint8_t len);
 Aml *aml_operation_region(const char *name, AmlRegionSpace rs,
                           uint32_t offset, uint32_t len);
+Aml *aml_irq_no_flags(uint8_t irq);
 Aml *aml_named_field(const char *name, unsigned length);
 Aml *aml_reserved_field(unsigned length);
 Aml *aml_local(int num);
hw/acpi/aml-build.c +21 -0
index d793775..60245e7 100644
@@ -514,6 +514,27 @@ Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base,
     return var;
 }
 
+/*
+ * ACPI 1.0b: 6.4.2.1.1 ASL Macro for IRQ Descriptor
+ *
+ * More verbose description at:
+ * ACPI 5.0: 19.5.64 IRQNoFlags (Interrupt Resource Descriptor Macro)
+ *           6.4.2.1 IRQ Descriptor
+ */
+Aml *aml_irq_no_flags(uint8_t irq)
+{
+    uint16_t irq_mask;
+    Aml *var = aml_alloc();
+
+    assert(irq < 16);
+    build_append_byte(var->buf, 0x22); /* IRQ descriptor 2 byte form */
+
+    irq_mask = 1U << irq;
+    build_append_byte(var->buf, irq_mask & 0xFF); /* IRQ mask bits[7:0] */
+    build_append_byte(var->buf, irq_mask >> 8); /* IRQ mask bits[15:8] */
+    return var;
+}
+
 /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLEqual */
 Aml *aml_equal(Aml *arg1, Aml *arg2)
 {
Signature · 1 line
MST
#12 lore raw

[Qemu-devel] [PULL v3 11/26] pc: acpi-build: drop remaining ssdt_misc template

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

It drops empty ssdt_misc templete. It also hides from user almost all pointer arithmetic when building SSDT which makes resulting code a bit cleaner and concentrating only on composing ASL construct /i.e. a task build_ssdt() should be doing/.

Also it makes one binary blob less stored in QEMU source tree by removing need to keep and update hw/i386/ssdt-misc.hex.generated file here in total saving us ~430LOC.

---
 hw/i386/acpi-build.c  |  7 ++-----
 hw/i386/Makefile.objs |  1 -
 hw/i386/ssdt-misc.dsl | 21 ---------------------
 3 files changed, 2 insertions(+), 27 deletions(-)
 delete mode 100644 hw/i386/ssdt-misc.dsl
hw/i386/acpi-build.c +2 -5
index 2700154..01d988c 100644
@@ -526,7 +526,6 @@ static inline char acpi_get_hex(uint32_t val)
 #define ACPI_SSDT_SIGNATURE 0x54445353 /* SSDT */
 #define ACPI_SSDT_HEADER_LENGTH 36
 
-#include "hw/i386/ssdt-misc.hex"
 #include "hw/i386/ssdt-pcihp.hex"
 #include "hw/i386/ssdt-tpm.hex"
 
@@ -850,7 +849,6 @@ build_ssdt(GArray *table_data, GArray *linker,
     MachineState *machine = MACHINE(qdev_get_machine());
     uint32_t nr_mem = machine->ram_slots;
     unsigned acpi_cpus = guest_info->apic_id_limit;
-    uint8_t *ssdt_ptr;
     Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx;
     int i;
 
@@ -860,9 +858,8 @@ build_ssdt(GArray *table_data, GArray *linker,
     QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
     g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
 
-    /* Copy header and patch values in the S3_ / S4_ / S5_ packages */
-    ssdt_ptr = acpi_data_push(ssdt->buf, sizeof(ssdp_misc_aml));
-    memcpy(ssdt_ptr, ssdp_misc_aml, sizeof(ssdp_misc_aml));
+    /* Reserve space for header */
+    acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
     scope = aml_scope("\\_SB.PCI0");
     /* build PCI0._CRS */
hw/i386/Makefile.objs +0 -1
index 45b90a8..9b00568 100644
@@ -10,7 +10,6 @@ obj-y += acpi-build.o
 hw/i386/acpi-build.o: hw/i386/acpi-build.c \
 	hw/i386/acpi-dsdt.hex hw/i386/q35-acpi-dsdt.hex \
 	hw/i386/ssdt-pcihp.hex \
-	hw/i386/ssdt-misc.hex \
 	hw/i386/ssdt-tpm.hex
 
 iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
hw/i386/ssdt-misc.dsl deleted +0 -21
deleted file mode 100644
index 8d61f21..0000000
@@ -1,21 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-#include "hw/acpi/pc-hotplug.h"
-
-ACPI_EXTRACT_ALL_CODE ssdp_misc_aml
-
-DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1)
-{
-}
Signature · 1 line
MST
#13 lore raw

[Qemu-devel] [PULL v3 13/26] pc: export applesmc IO port/len

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

IO port and length will be used in following patch to correctly generate SMC ACPI device in SSDT.

---
 include/hw/isa/isa.h | 11 +++++++++--
 hw/i386/acpi-build.c |  2 +-
 hw/misc/applesmc.c   |  5 ++---
 3 files changed, 12 insertions(+), 6 deletions(-)
include/hw/isa/isa.h +9 -2
index cf7bd34..f21ceaa 100644
@@ -21,10 +21,17 @@
 #define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS)
 
 #define TYPE_APPLE_SMC "isa-applesmc"
+#define APPLESMC_MAX_DATA_LENGTH       32
+#define APPLESMC_PROP_IO_BASE "iobase"
 
-static inline bool applesmc_find(void)
+static inline uint16_t applesmc_port(void)
 {
-    return object_resolve_path_type("", TYPE_APPLE_SMC, NULL);
+    Object *obj = object_resolve_path_type("", TYPE_APPLE_SMC, NULL);
+
+    if (obj) {
+        return object_property_get_int(obj, APPLESMC_PROP_IO_BASE, NULL);
+    }
+    return 0;
 }
 
 typedef struct ISADeviceClass {
hw/i386/acpi-build.c +1 -1
index 01d988c..badfa73 100644
@@ -145,7 +145,7 @@ static void acpi_get_dsdt(AcpiMiscInfo *info)
 
     /* Patch in appropriate value for AppleSMC _STA */
     *(uint8_t *)(info->dsdt_code + *applesmc_sta) =
-        applesmc_find() ? 0x0b : 0x00;
+        applesmc_port() ? 0x0b : 0x00;
 }
 
 static
hw/misc/applesmc.c +2 -3
index 6a56b07..6bd61e7 100644
@@ -43,7 +43,6 @@
 /* command/status port used by Apple SMC */
 #define APPLESMC_CMD_PORT              0x4
 #define APPLESMC_NR_PORTS              32
-#define APPLESMC_MAX_DATA_LENGTH       32
 
 #define APPLESMC_READ_CMD              0x10
 #define APPLESMC_WRITE_CMD             0x11
@@ -249,8 +248,8 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp)
 }
 
 static Property applesmc_isa_properties[] = {
-    DEFINE_PROP_UINT32("iobase", AppleSMCState, iobase,
-                      APPLESMC_DEFAULT_IOBASE),
+    DEFINE_PROP_UINT32(APPLESMC_PROP_IO_BASE, AppleSMCState, iobase,
+                       APPLESMC_DEFAULT_IOBASE),
     DEFINE_PROP_STRING("osk", AppleSMCState, osk),
     DEFINE_PROP_END_OF_LIST(),
 };
Signature · 1 line
MST
#14 lore raw

[Qemu-devel] [PULL v3 14/26] pc: acpi-build: drop template patching and create Device(SMC) dynamically

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

patch moves SMC device into SSDT and creates it only when device is present, which makes ACPI tables smaller in default case when device is not present.

Also it fixes wrong IO range in CRS if "iobase" property is set to a non default value.

PS:
Testing with XP shows that current default "iobase" used SMC device conflicts with floppy controller IO, but it's topic for another patch and I'd leave it to SMC device author for resolving conflict.

---
 hw/i386/acpi-build.c      | 29 ++++++++++++++++++++++-------
 hw/i386/acpi-dsdt-isa.dsl | 11 -----------
 hw/i386/acpi-dsdt.dsl     |  1 -
 hw/i386/q35-acpi-dsdt.dsl |  1 -
 4 files changed, 22 insertions(+), 20 deletions(-)
hw/i386/acpi-build.c +22 -7
index badfa73..05eb80a 100644
@@ -116,6 +116,7 @@ typedef struct AcpiMiscInfo {
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
     uint16_t pvpanic_port;
+    uint16_t applesmc_io_base;
 } AcpiMiscInfo;
 
 typedef struct AcpiBuildPciBusHotplugState {
@@ -127,7 +128,6 @@ typedef struct AcpiBuildPciBusHotplugState {
 
 static void acpi_get_dsdt(AcpiMiscInfo *info)
 {
-    uint16_t *applesmc_sta;
     Object *piix = piix4_pm_find();
     Object *lpc = ich9_lpc_find();
     assert(!!piix != !!lpc);
@@ -135,17 +135,11 @@ static void acpi_get_dsdt(AcpiMiscInfo *info)
     if (piix) {
         info->dsdt_code = AcpiDsdtAmlCode;
         info->dsdt_size = sizeof AcpiDsdtAmlCode;
-        applesmc_sta = piix_dsdt_applesmc_sta;
     }
     if (lpc) {
         info->dsdt_code = Q35AcpiDsdtAmlCode;
         info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
-        applesmc_sta = q35_dsdt_applesmc_sta;
     }
-
-    /* Patch in appropriate value for AppleSMC _STA */
-    *(uint8_t *)(info->dsdt_code + *applesmc_sta) =
-        applesmc_port() ? 0x0b : 0x00;
 }
 
 static
@@ -248,6 +242,7 @@ static void acpi_get_misc_info(AcpiMiscInfo *info)
     info->has_hpet = hpet_find();
     info->has_tpm = tpm_find();
     info->pvpanic_port = pvpanic_port();
+    info->applesmc_io_base = applesmc_port();
 }
 
 static void acpi_get_pci_info(PcPciInfo *info)
@@ -955,6 +950,26 @@ build_ssdt(GArray *table_data, GArray *linker,
     aml_append(scope, aml_name_decl("_S5", pkg));
     aml_append(ssdt, scope);
 
+    if (misc->applesmc_io_base) {
+        scope = aml_scope("\\_SB.PCI0.ISA");
+        dev = aml_device("SMC");
+
+        aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0001")));
+        /* 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, misc->applesmc_io_base, misc->applesmc_io_base,
+                   0x01, APPLESMC_MAX_DATA_LENGTH)
+        );
+        aml_append(crs, aml_irq_no_flags(6));
+        aml_append(dev, aml_name_decl("_CRS", crs));
+
+        aml_append(scope, dev);
+        aml_append(ssdt, scope);
+    }
+
     if (misc->pvpanic_port) {
         scope = aml_scope("\\_SB.PCI0.ISA");
 
hw/i386/acpi-dsdt-isa.dsl +0 -11
index deb37de..89caa16 100644
@@ -16,17 +16,6 @@
 /* Common legacy ISA style devices. */
 Scope(\_SB.PCI0.ISA) {
 
-    Device (SMC) {
-        Name(_HID, EisaId("APP0001"))
-        /* _STA will be patched to 0x0B if AppleSMC is present */
-        ACPI_EXTRACT_NAME_BYTE_CONST DSDT_APPLESMC_STA
-        Name(_STA, 0xF0)
-        Name(_CRS, ResourceTemplate () {
-            IO (Decode16, 0x0300, 0x0300, 0x01, 0x20)
-            IRQNoFlags() { 6 }
-        })
-    }
-
     Device(RTC) {
         Name(_HID, EisaId("PNP0B00"))
         Name(_CRS, ResourceTemplate() {
hw/i386/acpi-dsdt.dsl +0 -1
index 09b68f0..a2d84ec 100644
@@ -85,7 +85,6 @@ DefinitionBlock (
         }
     }
 
-#define DSDT_APPLESMC_STA piix_dsdt_applesmc_sta
 #include "acpi-dsdt-isa.dsl"
 
 
hw/i386/q35-acpi-dsdt.dsl +0 -1
index 3fb4b2f..16eaca3 100644
@@ -150,7 +150,6 @@ DefinitionBlock (
         }
     }
 
-#define DSDT_APPLESMC_STA q35_dsdt_applesmc_sta
 #include "acpi-dsdt-isa.dsl"
 
 
Signature · 1 line
MST
#15 lore raw

[Qemu-devel] [PULL v3 15/26] tests: ACPI test blobs update due to PCI0._CRS changes

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

PCI0._CRS was moved into SSDT and became the same for PIIX4/Q35 machines.

---
 tests/acpi-test-data/pc/DSDT  | Bin 3415 -> 2970 bytes
 tests/acpi-test-data/pc/SSDT  | Bin 2374 -> 2480 bytes
 tests/acpi-test-data/q35/DSDT | Bin 8005 -> 7608 bytes
 tests/acpi-test-data/q35/SSDT | Bin 578 -> 685 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/DSDT binary +0 -0
index ad12cb35d9dafc4d50002873f5c4ca04552b36df..1693c3783b34cfb5473e7ef65ba6f8deee390898 100644
GIT binary patch
tests/acpi-test-data/pc/SSDT binary +0 -0
index d0103368a0b9e3d5410372f1f589df4eeeebaf03..dc5be2497b6c2015d7cbabb1ff0cd13e02b3e0e4 100644
GIT binary patch
tests/acpi-test-data/q35/DSDT binary +0 -0
index de430e2a68e203518384b1db75baaefc02f2aa33..e9ac11c38ff98c36ba0c06abfd6b01fcb94b4452 100644
GIT binary patch
tests/acpi-test-data/q35/SSDT binary +0 -0
index f86643da45ad89a97a652233cb090516afde7b31..749f368e3034bfb491dcd8ced37936e0dcbba02a 100644
GIT binary patch
Signature · 1 line
MST
#16 lore raw

[Qemu-devel] [PULL v3 16/26] tests: bios-tables-test: add support for testing bridges

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Adds alternative ACPI table blob selection for testing non default QEMU configurations. If blob file for test variant is not present, fallback to default blob.

With this change implement testing with a coldplugged bridge.

---
 tests/bios-tables-test.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)
tests/bios-tables-test.c +40 -5
index 4d0fa84..735ac61 100644
@@ -40,6 +40,7 @@ typedef struct {
 
 typedef struct {
     const char *machine;
+    const char *variant;
     uint32_t rsdp_addr;
     AcpiRsdpDescriptor rsdp_table;
     AcpiRsdtDescriptorRev1 rsdt_table;
@@ -396,13 +397,14 @@ static void dump_aml_files(test_data *data, bool rebuild)
     int i;
 
     for (i = 0; i < data->tables->len; ++i) {
+        const char *ext = data->variant ? data->variant : "";
         sdt = &g_array_index(data->tables, AcpiSdtTable, i);
         g_assert(sdt->aml);
 
         if (rebuild) {
             uint32_t signature = cpu_to_le32(sdt->header.signature);
-            aml_file = g_strdup_printf("%s/%s/%.4s", data_dir, data->machine,
-                                       (gchar *)&signature);
+            aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
+                                       (gchar *)&signature, ext);
             fd = g_open(aml_file, O_WRONLY|O_TRUNC|O_CREAT,
                         S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
         } else {
@@ -509,7 +511,7 @@ static GArray *load_expected_aml(test_data *data)
 {
     int i;
     AcpiSdtTable *sdt;
-    gchar *aml_file;
+    gchar *aml_file = NULL;
     GError *error = NULL;
     gboolean ret;
 
@@ -517,6 +519,7 @@ static GArray *load_expected_aml(test_data *data)
     for (i = 0; i < data->tables->len; ++i) {
         AcpiSdtTable exp_sdt;
         uint32_t signature;
+        const char *ext = data->variant ? data->variant : "";
 
         sdt = &g_array_index(data->tables, AcpiSdtTable, i);
 
@@ -524,8 +527,15 @@ static GArray *load_expected_aml(test_data *data)
         exp_sdt.header.signature = sdt->header.signature;
 
         signature = cpu_to_le32(sdt->header.signature);
-        aml_file = g_strdup_printf("%s/%s/%.4s", data_dir, data->machine,
-                                   (gchar *)&signature);
+
+try_again:
+        aml_file = g_strdup_printf("%s/%s/%.4s%s", data_dir, data->machine,
+                                   (gchar *)&signature, ext);
+        if (data->variant && !g_file_test(aml_file, G_FILE_TEST_EXISTS)) {
+            g_free(aml_file);
+            ext = "";
+            goto try_again;
+        }
         exp_sdt.aml_file = aml_file;
         g_assert(g_file_test(aml_file, G_FILE_TEST_EXISTS));
         ret = g_file_get_contents(aml_file, &exp_sdt.aml,
@@ -778,6 +788,17 @@ static void test_acpi_piix4_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_piix4_tcg_bridge(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_PC;
+    data.variant = ".bridge";
+    test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg(void)
 {
     test_data data;
@@ -788,6 +809,18 @@ static void test_acpi_q35_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_bridge(void)
+{
+    test_data data;
+
+    memset(&data, 0, sizeof(data));
+    data.machine = MACHINE_Q35;
+    data.variant = ".bridge";
+    test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
+                  &data);
+    free_test_data(&data);
+}
+
 int main(int argc, char *argv[])
 {
     const char *arch = qtest_get_arch();
@@ -805,7 +838,9 @@ int main(int argc, char *argv[])
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         qtest_add_func("acpi/piix4/tcg", test_acpi_piix4_tcg);
+        qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
         qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
+        qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
     }
     ret = g_test_run();
     unlink(disk);
Signature · 1 line
MST
#17 lore raw

[Qemu-devel] [PULL v3 17/26] tests: add ACPI blobs for qemu with bridge cases

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

---
 tests/acpi-test-data/pc/SSDT.bridge  | Bin 0 -> 4352 bytes
 tests/acpi-test-data/q35/SSDT.bridge | Bin 0 -> 702 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tests/acpi-test-data/pc/SSDT.bridge
 create mode 100644 tests/acpi-test-data/q35/SSDT.bridge
tests/acpi-test-data/pc/SSDT.bridge new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..b807ac92dde72719fe3861c710b555fe3dd62583
GIT binary patch
tests/acpi-test-data/q35/SSDT.bridge new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..c552782f5bcc57094a7d1375b67979b2efa48f1c
GIT binary patch
Signature · 1 line
MST
#18 lore raw

[Qemu-devel] [PULL v3 18/26] pc: acpi-build: simplify PCI bus tree generation

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

it basicaly does the same as original approach,
* just without bus/notify tables tracking (less obscure) which is easier to follow.
* drops unnecessary loops and bitmaps,
creating devices and notification method in the same loop.
* saves us ~100LOC

---
 hw/i386/acpi-build.c | 274 ++++++++++++++++-----------------------------------
 1 file changed, 85 insertions(+), 189 deletions(-)
hw/i386/acpi-build.c +85 -189
index 05eb80a..ba056f0 100644
@@ -112,7 +112,6 @@ typedef struct AcpiPmInfo {
 typedef struct AcpiMiscInfo {
     bool has_hpet;
     bool has_tpm;
-    DECLARE_BITMAP(slot_hotplug_enable, PCI_SLOT_MAX);
     const unsigned char *dsdt_code;
     unsigned dsdt_size;
     uint16_t pvpanic_port;
@@ -591,74 +590,37 @@ static void acpi_set_pci_info(void)
     }
 }
 
-static void build_pci_bus_state_init(AcpiBuildPciBusHotplugState *state,
-                                     AcpiBuildPciBusHotplugState *parent,
-                                     bool pcihp_bridge_en)
+static void build_append_pcihp_notify_entry(GArray *method, int slot)
 {
-    state->parent = parent;
-    state->device_table = build_alloc_array();
-    state->notify_table = build_alloc_array();
-    state->pcihp_bridge_en = pcihp_bridge_en;
+    GArray *ifctx;
+
+    ifctx = build_alloc_array();
+    build_append_byte(ifctx, 0x7B); /* AndOp */
+    build_append_byte(ifctx, 0x68); /* Arg0Op */
+    build_append_int(ifctx, 0x1U << slot);
+    build_append_byte(ifctx, 0x00); /* NullName */
+    build_append_byte(ifctx, 0x86); /* NotifyOp */
+    build_append_namestring(ifctx, "S%.02X", PCI_DEVFN(slot, 0));
+    build_append_byte(ifctx, 0x69); /* Arg1Op */
+
+    /* Pack it up */
+    build_package(ifctx, 0xA0 /* IfOp */);
+    build_append_array(method, ifctx);
+    build_free_array(ifctx);
 }
 
-static void build_pci_bus_state_cleanup(AcpiBuildPciBusHotplugState *state)
+static void build_append_pci_bus_devices(GArray *parent_scope, PCIBus *bus,
+                                         bool pcihp_bridge_en)
 {
-    build_free_array(state->device_table);
-    build_free_array(state->notify_table);
-}
-
-static void *build_pci_bus_begin(PCIBus *bus, void *parent_state)
-{
-    AcpiBuildPciBusHotplugState *parent = parent_state;
-    AcpiBuildPciBusHotplugState *child = g_malloc(sizeof *child);
-
-    build_pci_bus_state_init(child, parent, parent->pcihp_bridge_en);
-
-    return child;
-}
-
-static void build_pci_bus_end(PCIBus *bus, void *bus_state)
-{
-    AcpiBuildPciBusHotplugState *child = bus_state;
-    AcpiBuildPciBusHotplugState *parent = child->parent;
     GArray *bus_table = build_alloc_array();
-    DECLARE_BITMAP(slot_hotplug_enable, PCI_SLOT_MAX);
-    DECLARE_BITMAP(slot_device_present, PCI_SLOT_MAX);
-    DECLARE_BITMAP(slot_device_system, PCI_SLOT_MAX);
-    DECLARE_BITMAP(slot_device_vga, PCI_SLOT_MAX);
-    DECLARE_BITMAP(slot_device_qxl, PCI_SLOT_MAX);
-    uint8_t op;
-    int i;
+    GArray *method = NULL;
     QObject *bsel;
-    GArray *method;
-    bool bus_hotplug_support = false;
-
-    /*
-     * Skip bridge subtree creation if bridge hotplug is disabled
-     * to make acpi tables compatible with legacy machine types.
-     * Skip creation for hotplugged bridges as well.
-     */
-    if (bus->parent_dev && (!child->pcihp_bridge_en ||
-                            DEVICE(bus->parent_dev)->hotplugged)) {
-        build_free_array(bus_table);
-        build_pci_bus_state_cleanup(child);
-        g_free(child);
-        return;
-    }
+    PCIBus *sec;
+    int i;
 
     if (bus->parent_dev) {
-        op = 0x82; /* DeviceOp */
-        build_append_namestring(bus_table, "S%.02X",
-                             bus->parent_dev->devfn);
-        build_append_byte(bus_table, 0x08); /* NameOp */
-        build_append_namestring(bus_table, "_SUN");
-        build_append_int(bus_table, PCI_SLOT(bus->parent_dev->devfn));
-        build_append_byte(bus_table, 0x08); /* NameOp */
-        build_append_namestring(bus_table, "_ADR");
-        build_append_int(bus_table, (PCI_SLOT(bus->parent_dev->devfn) << 16) |
-                           PCI_FUNC(bus->parent_dev->devfn));
+        build_append_namestring(bus_table, "S%.02X_", bus->parent_dev->devfn);
     } else {
-        op = 0x10; /* ScopeOp */;
         build_append_namestring(bus_table, "PCI0");
     }
 
@@ -667,29 +629,28 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
         build_append_byte(bus_table, 0x08); /* NameOp */
         build_append_namestring(bus_table, "BSEL");
         build_append_int(bus_table, qint_get_int(qobject_to_qint(bsel)));
-        memset(slot_hotplug_enable, 0xff, sizeof slot_hotplug_enable);
-    } else {
-        /* No bsel - no slots are hot-pluggable */
-        memset(slot_hotplug_enable, 0x00, sizeof slot_hotplug_enable);
+        method = build_alloc_method("DVNT", 2);
     }
 
-    memset(slot_device_present, 0x00, sizeof slot_device_present);
-    memset(slot_device_system, 0x00, sizeof slot_device_present);
-    memset(slot_device_vga, 0x00, sizeof slot_device_vga);
-    memset(slot_device_qxl, 0x00, sizeof slot_device_qxl);
-
     for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
         DeviceClass *dc;
         PCIDeviceClass *pc;
         PCIDevice *pdev = bus->devices[i];
         int slot = PCI_SLOT(i);
+        bool hotplug_enabled_dev;
         bool bridge_in_acpi;
 
         if (!pdev) {
+            if (bsel) { /* add hotplug slots for non present devices */
+                void *pcihp = acpi_data_push(bus_table, ACPI_PCIHP_SIZEOF);
+                memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF);
+                patch_pcihp(slot, pcihp);
+
+                build_append_pcihp_notify_entry(method, slot);
+            }
             continue;
         }
 
-        set_bit(slot, slot_device_present);
         pc = PCI_DEVICE_GET_CLASS(pdev);
         dc = DEVICE_GET_CLASS(pdev);
 
@@ -698,142 +659,83 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
          * In this case they aren't themselves hot-pluggable.
          * Hotplugged bridges *are* hot-pluggable.
          */
-        bridge_in_acpi = pc->is_bridge && child->pcihp_bridge_en &&
-         !DEVICE(pdev)->hotplugged;
+        bridge_in_acpi = pc->is_bridge && pcihp_bridge_en &&
+            !DEVICE(pdev)->hotplugged;
 
-        if (pc->class_id == PCI_CLASS_BRIDGE_ISA || bridge_in_acpi) {
-            set_bit(slot, slot_device_system);
+        hotplug_enabled_dev = bsel && dc->hotpluggable && !bridge_in_acpi;
+
+        if (pc->class_id == PCI_CLASS_BRIDGE_ISA) {
+            continue;
         }
 
         if (pc->class_id == PCI_CLASS_DISPLAY_VGA) {
-            set_bit(slot, slot_device_vga);
-
             if (object_dynamic_cast(OBJECT(pdev), "qxl-vga")) {
-                set_bit(slot, slot_device_qxl);
+                void *pcihp = acpi_data_push(bus_table,
+                                             ACPI_PCIQXL_SIZEOF);
+                      memcpy(pcihp, ACPI_PCIQXL_AML, ACPI_PCIQXL_SIZEOF);
+                      patch_pciqxl(slot, pcihp);
+            } else {
+                void *pcihp = acpi_data_push(bus_table,
+                                             ACPI_PCIVGA_SIZEOF);
+                memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF);
+                patch_pcivga(slot, pcihp);
             }
-        }
-
-        if (!dc->hotpluggable || bridge_in_acpi) {
-            clear_bit(slot, slot_hotplug_enable);
-        }
-    }
+        } else if (hotplug_enabled_dev) {
+            void *pcihp = acpi_data_push(bus_table, ACPI_PCIHP_SIZEOF);
 
-    /* Append Device object for each slot */
-    for (i = 0; i < PCI_SLOT_MAX; i++) {
-        bool can_eject = test_bit(i, slot_hotplug_enable);
-        bool present = test_bit(i, slot_device_present);
-        bool vga = test_bit(i, slot_device_vga);
-        bool qxl = test_bit(i, slot_device_qxl);
-        bool system = test_bit(i, slot_device_system);
-        if (can_eject) {
-            void *pcihp = acpi_data_push(bus_table,
-                                         ACPI_PCIHP_SIZEOF);
             memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF);
-            patch_pcihp(i, pcihp);
-            bus_hotplug_support = true;
-        } else if (qxl) {
-            void *pcihp = acpi_data_push(bus_table,
-                                         ACPI_PCIQXL_SIZEOF);
-            memcpy(pcihp, ACPI_PCIQXL_AML, ACPI_PCIQXL_SIZEOF);
-            patch_pciqxl(i, pcihp);
-        } else if (vga) {
-            void *pcihp = acpi_data_push(bus_table,
-                                         ACPI_PCIVGA_SIZEOF);
-            memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF);
-            patch_pcivga(i, pcihp);
-        } else if (system) {
-            /* Nothing to do: system devices are in DSDT or in SSDT above. */
-        } else if (present) {
-            void *pcihp = acpi_data_push(bus_table,
-                                         ACPI_PCINOHP_SIZEOF);
+            patch_pcihp(slot, pcihp);
+            build_append_pcihp_notify_entry(method, slot);
+        } else if (bridge_in_acpi) {
+            PCIBus *sec_bus = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev));
+            void *pcihp = acpi_data_push(bus_table, ACPI_PCINOHP_SIZEOF);
+
+            memcpy(pcihp, ACPI_PCINOHP_AML, ACPI_PCINOHP_SIZEOF);
+            patch_pcinohp(slot, pcihp);
+            build_append_pci_bus_devices(bus_table, sec_bus, pcihp_bridge_en);
+        } else { /* non hotpluggable present devices */
+            void *pcihp = acpi_data_push(bus_table, ACPI_PCINOHP_SIZEOF);
+
             memcpy(pcihp, ACPI_PCINOHP_AML, ACPI_PCINOHP_SIZEOF);
-            patch_pcinohp(i, pcihp);
+            patch_pcinohp(slot, pcihp);
         }
     }
 
     if (bsel) {
-        method = build_alloc_method("DVNT", 2);
-
-        for (i = 0; i < PCI_SLOT_MAX; i++) {
-            GArray *notify;
-            uint8_t op;
-
-            if (!test_bit(i, slot_hotplug_enable)) {
-                continue;
-            }
-
-            notify = build_alloc_array();
-            op = 0xA0; /* IfOp */
-
-            build_append_byte(notify, 0x7B); /* AndOp */
-            build_append_byte(notify, 0x68); /* Arg0Op */
-            build_append_int(notify, 0x1U << i);
-            build_append_byte(notify, 0x00); /* NullName */
-            build_append_byte(notify, 0x86); /* NotifyOp */
-            build_append_namestring(notify, "S%.02X", PCI_DEVFN(i, 0));
-            build_append_byte(notify, 0x69); /* Arg1Op */
-
-            /* Pack it up */
-            build_package(notify, op);
-
-            build_append_array(method, notify);
-
-            build_free_array(notify);
-        }
-
         build_append_and_cleanup_method(bus_table, method);
     }
 
     /* Append PCNT method to notify about events on local and child buses.
      * Add unconditionally for root since DSDT expects it.
      */
-    if (bus_hotplug_support || child->notify_table->len || !bus->parent_dev) {
-        method = build_alloc_method("PCNT", 0);
-
-        /* If bus supports hotplug select it and notify about local events */
-        if (bsel) {
-            build_append_byte(method, 0x70); /* StoreOp */
-            build_append_int(method, qint_get_int(qobject_to_qint(bsel)));
-            build_append_namestring(method, "BNUM");
-            build_append_namestring(method, "DVNT");
-            build_append_namestring(method, "PCIU");
-            build_append_int(method, 1); /* Device Check */
-            build_append_namestring(method, "DVNT");
-            build_append_namestring(method, "PCID");
-            build_append_int(method, 3); /* Eject Request */
-        }
-
-        /* Notify about child bus events in any case */
-        build_append_array(method, child->notify_table);
-
-        build_append_and_cleanup_method(bus_table, method);
-
-        /* Append description of child buses */
-        build_append_array(bus_table, child->device_table);
-
-        /* Pack it up */
-        if (bus->parent_dev) {
-            build_extop_package(bus_table, op);
-        } else {
-            build_package(bus_table, op);
-        }
+    method = build_alloc_method("PCNT", 0);
 
-        /* Append our bus description to parent table */
-        build_append_array(parent->device_table, bus_table);
+    /* If bus supports hotplug select it and notify about local events */
+    if (bsel) {
+        build_append_byte(method, 0x70); /* StoreOp */
+        build_append_int(method, qint_get_int(qobject_to_qint(bsel)));
+        build_append_namestring(method, "BNUM");
+        build_append_namestring(method, "DVNT");
+        build_append_namestring(method, "PCIU");
+        build_append_int(method, 1); /* Device Check */
+        build_append_namestring(method, "DVNT");
+        build_append_namestring(method, "PCID");
+        build_append_int(method, 3); /* Eject Request */
+    }
 
-        /* Also tell parent how to notify us, invoking PCNT method.
-         * At the moment this is not needed for root as we have a single root.
-         */
-        if (bus->parent_dev) {
-            build_append_namestring(parent->notify_table, "^PCNT.S%.02X",
-                                    bus->parent_dev->devfn);
+    /* Notify about child bus events in any case */
+    if (pcihp_bridge_en) {
+        QLIST_FOREACH(sec, &bus->child, sibling) {
+            build_append_namestring(method, "^S%.02X.PCNT",
+                                    sec->parent_dev->devfn);
         }
     }
 
-    qobject_decref(bsel);
+    build_append_and_cleanup_method(bus_table, method);
+
+    build_package(bus_table, 0x10); /* ScopeOp */
+    build_append_array(parent_scope, bus_table);
     build_free_array(bus_table);
-    build_pci_bus_state_cleanup(child);
-    g_free(child);
 }
 
 static void
@@ -1175,7 +1077,6 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_append(sb_scope, method);
 
         {
-            AcpiBuildPciBusHotplugState hotplug_state;
             Object *pci_host;
             PCIBus *bus = NULL;
             bool ambiguous;
@@ -1185,16 +1086,11 @@ build_ssdt(GArray *table_data, GArray *linker,
                 bus = PCI_HOST_BRIDGE(pci_host)->bus;
             }
 
-            build_pci_bus_state_init(&hotplug_state, NULL, pm->pcihp_bridge_en);
-
             if (bus) {
                 /* Scan all PCI buses. Generate tables to support hotplug. */
-                pci_for_each_bus_depth_first(bus, build_pci_bus_begin,
-                                             build_pci_bus_end, &hotplug_state);
+                build_append_pci_bus_devices(sb_scope->buf, bus,
+                                             pm->pcihp_bridge_en);
             }
-
-            build_append_array(sb_scope->buf, hotplug_state.device_table);
-            build_pci_bus_state_cleanup(&hotplug_state);
         }
         aml_append(ssdt, sb_scope);
     }
Signature · 1 line
MST
#19 lore raw

[Qemu-devel] [PULL v3 19/26] tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

---
 tests/acpi-test-data/pc/SSDT.bridge | Bin 4352 -> 4351 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/SSDT.bridge binary +0 -0
index b807ac92dde72719fe3861c710b555fe3dd62583..ca7f63cb4e48bd95418f68daf1b7e254d5bcf8c2 100644
GIT binary patch
Signature · 1 line
MST
#20 lore raw

[Qemu-devel] [PULL v3 20/26] pc: acpi-build: drop template patching and create PCI bus tree dynamically

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Replace AML template patching with direct composing of PCI device entries in C. It allows to simplify PCI tree generation further and saves us about 400LOC scattered through different files, confining tree generation to one C function which is much easier to deal with.

---
 hw/i386/acpi-build.c   | 235 +++++++++++++++++--------------------------------
 hw/i386/Makefile.objs  |   1 -
 hw/i386/ssdt-pcihp.dsl | 100 ---------------------
 3 files changed, 80 insertions(+), 256 deletions(-)
 delete mode 100644 hw/i386/ssdt-pcihp.dsl
hw/i386/acpi-build.c +80 -155
index ba056f0..b94e47e 100644
@@ -294,26 +294,6 @@ build_header(GArray *linker, GArray *table_data,
                                     table_data->data, h, len, &h->checksum);
 }
 
-static GArray *build_alloc_method(const char *name, uint8_t arg_count)
-{
-    GArray *method = build_alloc_array();
-
-    build_append_namestring(method, "%s", name);
-    build_append_byte(method, arg_count); /* MethodFlags: ArgCount */
-
-    return method;
-}
-
-static void build_append_and_cleanup_method(GArray *device, GArray *method)
-{
-    uint8_t op = 0x14; /* MethodOp */
-
-    build_package(method, op);
-
-    build_append_array(device, method);
-    build_free_array(method);
-}
-
 /* End here */
 #define ACPI_PORT_SMI_CMD           0x00b2 /* TODO: this is APM_CNT_IOPORT */
 
@@ -494,71 +474,12 @@ static inline char acpi_get_hex(uint32_t val)
     return (val <= 9) ? ('0' + val) : ('A' + val - 10);
 }
 
-/* 0x5B 0x82 DeviceOp PkgLength NameString */
-#define ACPI_PCIHP_OFFSET_HEX (*ssdt_pcihp_name - *ssdt_pcihp_start + 1)
-#define ACPI_PCIHP_OFFSET_ID (*ssdt_pcihp_id - *ssdt_pcihp_start)
-#define ACPI_PCIHP_OFFSET_ADR (*ssdt_pcihp_adr - *ssdt_pcihp_start)
-#define ACPI_PCIHP_OFFSET_EJ0 (*ssdt_pcihp_ej0 - *ssdt_pcihp_start)
-#define ACPI_PCIHP_SIZEOF (*ssdt_pcihp_end - *ssdt_pcihp_start)
-#define ACPI_PCIHP_AML (ssdp_pcihp_aml + *ssdt_pcihp_start)
-
-#define ACPI_PCINOHP_OFFSET_HEX (*ssdt_pcinohp_name - *ssdt_pcinohp_start + 1)
-#define ACPI_PCINOHP_OFFSET_ADR (*ssdt_pcinohp_adr - *ssdt_pcinohp_start)
-#define ACPI_PCINOHP_SIZEOF (*ssdt_pcinohp_end - *ssdt_pcinohp_start)
-#define ACPI_PCINOHP_AML (ssdp_pcihp_aml + *ssdt_pcinohp_start)
-
-#define ACPI_PCIVGA_OFFSET_HEX (*ssdt_pcivga_name - *ssdt_pcivga_start + 1)
-#define ACPI_PCIVGA_OFFSET_ADR (*ssdt_pcivga_adr - *ssdt_pcivga_start)
-#define ACPI_PCIVGA_SIZEOF (*ssdt_pcivga_end - *ssdt_pcivga_start)
-#define ACPI_PCIVGA_AML (ssdp_pcihp_aml + *ssdt_pcivga_start)
-
-#define ACPI_PCIQXL_OFFSET_HEX (*ssdt_pciqxl_name - *ssdt_pciqxl_start + 1)
-#define ACPI_PCIQXL_OFFSET_ADR (*ssdt_pciqxl_adr - *ssdt_pciqxl_start)
-#define ACPI_PCIQXL_SIZEOF (*ssdt_pciqxl_end - *ssdt_pciqxl_start)
-#define ACPI_PCIQXL_AML (ssdp_pcihp_aml + *ssdt_pciqxl_start)
 
 #define ACPI_SSDT_SIGNATURE 0x54445353 /* SSDT */
 #define ACPI_SSDT_HEADER_LENGTH 36
 
-#include "hw/i386/ssdt-pcihp.hex"
 #include "hw/i386/ssdt-tpm.hex"
 
-static void patch_pcihp(int slot, uint8_t *ssdt_ptr)
-{
-    unsigned devfn = PCI_DEVFN(slot, 0);
-
-    ssdt_ptr[ACPI_PCIHP_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
-    ssdt_ptr[ACPI_PCIHP_OFFSET_HEX + 1] = acpi_get_hex(devfn);
-    ssdt_ptr[ACPI_PCIHP_OFFSET_ID] = slot;
-    ssdt_ptr[ACPI_PCIHP_OFFSET_ADR + 2] = slot;
-}
-
-static void patch_pcinohp(int slot, uint8_t *ssdt_ptr)
-{
-    unsigned devfn = PCI_DEVFN(slot, 0);
-
-    ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
-    ssdt_ptr[ACPI_PCINOHP_OFFSET_HEX + 1] = acpi_get_hex(devfn);
-    ssdt_ptr[ACPI_PCINOHP_OFFSET_ADR + 2] = slot;
-}
-
-static void patch_pcivga(int slot, uint8_t *ssdt_ptr)
-{
-    unsigned devfn = PCI_DEVFN(slot, 0);
-
-    ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
-    ssdt_ptr[ACPI_PCIVGA_OFFSET_HEX + 1] = acpi_get_hex(devfn);
-    ssdt_ptr[ACPI_PCIVGA_OFFSET_ADR + 2] = slot;
-}
-
-static void patch_pciqxl(int slot, uint8_t *ssdt_ptr)
-{
-    unsigned devfn = PCI_DEVFN(slot, 0);
-
-    ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX] = acpi_get_hex(devfn >> 4);
-    ssdt_ptr[ACPI_PCIQXL_OFFSET_HEX + 1] = acpi_get_hex(devfn);
-    ssdt_ptr[ACPI_PCIQXL_OFFSET_ADR + 2] = slot;
-}
 
 /* Assign BSEL property to all buses.  In the future, this can be changed
  * to only assign to buses that support hotplug.
@@ -590,46 +511,30 @@ static void acpi_set_pci_info(void)
     }
 }
 
-static void build_append_pcihp_notify_entry(GArray *method, int slot)
+static void build_append_pcihp_notify_entry(Aml *method, int slot)
 {
-    GArray *ifctx;
-
-    ifctx = build_alloc_array();
-    build_append_byte(ifctx, 0x7B); /* AndOp */
-    build_append_byte(ifctx, 0x68); /* Arg0Op */
-    build_append_int(ifctx, 0x1U << slot);
-    build_append_byte(ifctx, 0x00); /* NullName */
-    build_append_byte(ifctx, 0x86); /* NotifyOp */
-    build_append_namestring(ifctx, "S%.02X", PCI_DEVFN(slot, 0));
-    build_append_byte(ifctx, 0x69); /* Arg1Op */
-
-    /* Pack it up */
-    build_package(ifctx, 0xA0 /* IfOp */);
-    build_append_array(method, ifctx);
-    build_free_array(ifctx);
+    Aml *if_ctx;
+    int32_t devfn = PCI_DEVFN(slot, 0);
+
+    if_ctx = aml_if(aml_and(aml_arg(0), aml_int(0x1U << slot)));
+    aml_append(if_ctx, aml_notify(aml_name("S%.02X", devfn), aml_arg(1)));
+    aml_append(method, if_ctx);
 }
 
-static void build_append_pci_bus_devices(GArray *parent_scope, PCIBus *bus,
+static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
                                          bool pcihp_bridge_en)
 {
-    GArray *bus_table = build_alloc_array();
-    GArray *method = NULL;
+    Aml *dev, *notify_method, *method;
     QObject *bsel;
     PCIBus *sec;
     int i;
 
-    if (bus->parent_dev) {
-        build_append_namestring(bus_table, "S%.02X_", bus->parent_dev->devfn);
-    } else {
-        build_append_namestring(bus_table, "PCI0");
-    }
-
     bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL);
     if (bsel) {
-        build_append_byte(bus_table, 0x08); /* NameOp */
-        build_append_namestring(bus_table, "BSEL");
-        build_append_int(bus_table, qint_get_int(qobject_to_qint(bsel)));
-        method = build_alloc_method("DVNT", 2);
+        int64_t bsel_val = qint_get_int(qobject_to_qint(bsel));
+
+        aml_append(parent_scope, aml_name_decl("BSEL", aml_int(bsel_val)));
+        notify_method = aml_method("DVNT", 2);
     }
 
     for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
@@ -642,11 +547,17 @@ static void build_append_pci_bus_devices(GArray *parent_scope, PCIBus *bus,
 
         if (!pdev) {
             if (bsel) { /* add hotplug slots for non present devices */
-                void *pcihp = acpi_data_push(bus_table, ACPI_PCIHP_SIZEOF);
-                memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF);
-                patch_pcihp(slot, pcihp);
-
-                build_append_pcihp_notify_entry(method, slot);
+                dev = aml_device("S%.02X", PCI_DEVFN(slot, 0));
+                aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
+                aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
+                method = aml_method("_EJ0", 1);
+                aml_append(method,
+                    aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
+                );
+                aml_append(dev, method);
+                aml_append(parent_scope, dev);
+
+                build_append_pcihp_notify_entry(notify_method, slot);
             }
             continue;
         }
@@ -668,74 +579,87 @@ static void build_append_pci_bus_devices(GArray *parent_scope, PCIBus *bus,
             continue;
         }
 
+        /* start to compose PCI slot descriptor */
+        dev = aml_device("S%.02X", PCI_DEVFN(slot, 0));
+        aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
+
         if (pc->class_id == PCI_CLASS_DISPLAY_VGA) {
+            /* add VGA specific AML methods */
+            int s3d;
+
             if (object_dynamic_cast(OBJECT(pdev), "qxl-vga")) {
-                void *pcihp = acpi_data_push(bus_table,
-                                             ACPI_PCIQXL_SIZEOF);
-                      memcpy(pcihp, ACPI_PCIQXL_AML, ACPI_PCIQXL_SIZEOF);
-                      patch_pciqxl(slot, pcihp);
+                s3d = 3;
             } else {
-                void *pcihp = acpi_data_push(bus_table,
-                                             ACPI_PCIVGA_SIZEOF);
-                memcpy(pcihp, ACPI_PCIVGA_AML, ACPI_PCIVGA_SIZEOF);
-                patch_pcivga(slot, pcihp);
+                s3d = 0;
             }
+
+            method = aml_method("_S1D", 0);
+            aml_append(method, aml_return(aml_int(0)));
+            aml_append(dev, method);
+
+            method = aml_method("_S2D", 0);
+            aml_append(method, aml_return(aml_int(0)));
+            aml_append(dev, method);
+
+            method = aml_method("_S3D", 0);
+            aml_append(method, aml_return(aml_int(s3d)));
+            aml_append(dev, method);
         } else if (hotplug_enabled_dev) {
-            void *pcihp = acpi_data_push(bus_table, ACPI_PCIHP_SIZEOF);
+            /* add _SUN/_EJ0 to make slot hotpluggable  */
+            aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
 
-            memcpy(pcihp, ACPI_PCIHP_AML, ACPI_PCIHP_SIZEOF);
-            patch_pcihp(slot, pcihp);
-            build_append_pcihp_notify_entry(method, slot);
+            method = aml_method("_EJ0", 1);
+            aml_append(method,
+                aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN"))
+            );
+            aml_append(dev, method);
+
+            if (bsel) {
+                build_append_pcihp_notify_entry(notify_method, slot);
+            }
         } else if (bridge_in_acpi) {
+            /*
+             * device is coldplugged bridge,
+             * add child device descriptions into its scope
+             */
             PCIBus *sec_bus = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev));
-            void *pcihp = acpi_data_push(bus_table, ACPI_PCINOHP_SIZEOF);
 
-            memcpy(pcihp, ACPI_PCINOHP_AML, ACPI_PCINOHP_SIZEOF);
-            patch_pcinohp(slot, pcihp);
-            build_append_pci_bus_devices(bus_table, sec_bus, pcihp_bridge_en);
-        } else { /* non hotpluggable present devices */
-            void *pcihp = acpi_data_push(bus_table, ACPI_PCINOHP_SIZEOF);
-
-            memcpy(pcihp, ACPI_PCINOHP_AML, ACPI_PCINOHP_SIZEOF);
-            patch_pcinohp(slot, pcihp);
+            build_append_pci_bus_devices(dev, sec_bus, pcihp_bridge_en);
         }
+        /* slot descriptor has been composed, add it into parent context */
+        aml_append(parent_scope, dev);
     }
 
     if (bsel) {
-        build_append_and_cleanup_method(bus_table, method);
+        aml_append(parent_scope, notify_method);
     }
 
     /* Append PCNT method to notify about events on local and child buses.
      * Add unconditionally for root since DSDT expects it.
      */
-    method = build_alloc_method("PCNT", 0);
+    method = aml_method("PCNT", 0);
 
     /* If bus supports hotplug select it and notify about local events */
     if (bsel) {
-        build_append_byte(method, 0x70); /* StoreOp */
-        build_append_int(method, qint_get_int(qobject_to_qint(bsel)));
-        build_append_namestring(method, "BNUM");
-        build_append_namestring(method, "DVNT");
-        build_append_namestring(method, "PCIU");
-        build_append_int(method, 1); /* Device Check */
-        build_append_namestring(method, "DVNT");
-        build_append_namestring(method, "PCID");
-        build_append_int(method, 3); /* Eject Request */
+        int64_t bsel_val = qint_get_int(qobject_to_qint(bsel));
+        aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM")));
+        aml_append(method,
+            aml_call2("DVNT", aml_name("PCIU"), aml_int(1) /* Device Check */)
+        );
+        aml_append(method,
+            aml_call2("DVNT", aml_name("PCID"), aml_int(3)/* Eject Request */)
+        );
     }
 
     /* Notify about child bus events in any case */
     if (pcihp_bridge_en) {
         QLIST_FOREACH(sec, &bus->child, sibling) {
-            build_append_namestring(method, "^S%.02X.PCNT",
-                                    sec->parent_dev->devfn);
+            int32_t devfn = sec->parent_dev->devfn;
+
+            aml_append(method, aml_name("^S%.02X.PCNT", devfn));
         }
     }
-
-    build_append_and_cleanup_method(bus_table, method);
-
-    build_package(bus_table, 0x10); /* ScopeOp */
-    build_append_array(parent_scope, bus_table);
-    build_free_array(bus_table);
+    aml_append(parent_scope, method);
 }
 
 static void
@@ -1087,9 +1011,10 @@ build_ssdt(GArray *table_data, GArray *linker,
             }
 
             if (bus) {
+                Aml *scope = aml_scope("PCI0");
                 /* Scan all PCI buses. Generate tables to support hotplug. */
-                build_append_pci_bus_devices(sb_scope->buf, bus,
-                                             pm->pcihp_bridge_en);
+                build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
+                aml_append(sb_scope, scope);
             }
         }
         aml_append(ssdt, sb_scope);
hw/i386/Makefile.objs +0 -1
index 9b00568..e058a39 100644
@@ -9,7 +9,6 @@ obj-y += kvmvapic.o
 obj-y += acpi-build.o
 hw/i386/acpi-build.o: hw/i386/acpi-build.c \
 	hw/i386/acpi-dsdt.hex hw/i386/q35-acpi-dsdt.hex \
-	hw/i386/ssdt-pcihp.hex \
 	hw/i386/ssdt-tpm.hex
 
 iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
hw/i386/ssdt-pcihp.dsl deleted +0 -100

100 lines not on this page · raw message

Signature · 1 line
MST
#21 lore raw

[Qemu-devel] [PULL v3 21/26] pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

---
 hw/i386/ssdt-misc.hex.generated  | 139 ----------------------
 hw/i386/ssdt-pcihp.hex.generated | 251 ---------------------------------------
 2 files changed, 390 deletions(-)
 delete mode 100644 hw/i386/ssdt-misc.hex.generated
 delete mode 100644 hw/i386/ssdt-pcihp.hex.generated
hw/i386/ssdt-misc.hex.generated deleted +0 -139
deleted file mode 100644
index 0b77ed4..0000000
@@ -1,139 +0,0 @@
-static unsigned char acpi_pci64_length[] = {
-0x6f
-};
-static unsigned char acpi_pci32_start[] = {
-0x2f
-};
-static unsigned char acpi_pci64_valid[] = {
-0x43
-};
-static unsigned char ssdp_misc_aml[] = {
-0x53,
-0x53,
-0x44,
-0x54,
-0x77,
-0x0,
-0x0,
-0x0,
-0x1,
-0x40,
-0x42,
-0x58,
-0x50,
-0x43,
-0x0,
-0x0,
-0x42,
-0x58,
-0x53,
-0x53,
-0x44,
-0x54,
-0x53,
-0x55,
-0x1,
-0x0,
-0x0,
-0x0,
-0x49,
-0x4e,
-0x54,
-0x4c,
-0x7,
-0x11,
-0x14,
-0x20,
-0x10,
-0x42,
-0x5,
-0x5c,
-0x0,
-0x8,
-0x50,
-0x30,
-0x53,
-0x5f,
-0xc,
-0x78,
-0x56,
-0x34,
-0x12,
-0x8,
-0x50,
-0x30,
-0x45,
-0x5f,
-0xc,
-0x78,
-0x56,
-0x34,
-0x12,
-0x8,
-0x50,
-0x31,
-0x56,
-0x5f,
-0xa,
-0x12,
-0x8,
-0x50,
-0x31,
-0x53,
-0x5f,
-0x11,
-0xb,
-0xa,
-0x8,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x8,
-0x50,
-0x31,
-0x45,
-0x5f,
-0x11,
-0xb,
-0xa,
-0x8,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x8,
-0x50,
-0x31,
-0x4c,
-0x5f,
-0x11,
-0xb,
-0xa,
-0x8,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0,
-0x0
-};
-static unsigned char acpi_pci64_start[] = {
-0x4d
-};
-static unsigned char acpi_pci64_end[] = {
-0x5e
-};
-static unsigned char acpi_pci32_end[] = {
-0x39
-};
hw/i386/ssdt-pcihp.hex.generated deleted +0 -251

251 lines not on this page · raw message

Signature · 1 line
MST
#22 lore raw

[Qemu-devel] [PULL v3 23/26] pci: Give a few helpers internal linkage

In reply to Michael S. Tsirkin

From: Markus Armbruster <[email protected]>

None of them should be used in new code.

---
 include/hw/pci/pci.h |  7 -------
 hw/pci/pci.c         | 14 +++++++-------
 2 files changed, 7 insertions(+), 14 deletions(-)
include/hw/pci/pci.h +0 -7
index 3164fc3..be2d9b8 100644
@@ -371,9 +371,6 @@ void pci_device_set_intx_routing_notifier(PCIDevice *dev,
                                           PCIINTxRoutingNotifier notifier);
 void pci_device_reset(PCIDevice *dev);
 
-PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
-                        const char *default_model,
-                        const char *default_devaddr);
 PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
                                const char *default_model,
                                const char *default_devaddr);
@@ -403,12 +400,8 @@ PCIBus *pci_device_root_bus(const PCIDevice *d);
 const char *pci_root_bus_path(PCIDevice *dev);
 PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn);
 int pci_qdev_find_device(const char *id, PCIDevice **pdev);
-PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr);
 void pci_bus_get_w64_range(PCIBus *bus, Range *range);
 
-int pci_parse_devaddr(const char *addr, int *domp, int *busp,
-                      unsigned int *slotp, unsigned int *funcp);
-
 void pci_device_deassert_intx(PCIDevice *dev);
 
 typedef AddressSpace *(*PCIIOMMUFunc)(PCIBus *, void *, int);
hw/pci/pci.c +7 -7
index b1f3cea..cc5d946 100644
@@ -539,8 +539,8 @@ static void pci_set_default_subsystem_id(PCIDevice *pci_dev)
  * Parse [[<domain>:]<bus>:]<slot>, return -1 on error if funcp == NULL
  *       [[<domain>:]<bus>:]<slot>.<func>, return -1 on error
  */
-int pci_parse_devaddr(const char *addr, int *domp, int *busp,
-                      unsigned int *slotp, unsigned int *funcp)
+static int pci_parse_devaddr(const char *addr, int *domp, int *busp,
+                             unsigned int *slotp, unsigned int *funcp)
 {
     const char *p;
     char *e;
@@ -598,7 +598,8 @@ int pci_parse_devaddr(const char *addr, int *domp, int *busp,
     return 0;
 }
 
-PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)
+static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root,
+                                 const char *devaddr)
 {
     int dom, bus;
     unsigned slot;
@@ -1610,10 +1611,9 @@ static const char * const pci_nic_names[] = {
 };
 
 /* Initialize a PCI NIC.  */
-/* FIXME callers should check for failure, but don't */
-PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
-                        const char *default_model,
-                        const char *default_devaddr)
+static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
+                               const char *default_model,
+                               const char *default_devaddr)
 {
     const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
     PCIBus *bus;
Signature · 1 line
MST
#23 lore raw

[Qemu-devel] [PULL v3 22/26] acpi: make build_*() routines static to aml-build.c

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

build_*() routines were used for composing AML structures manually in acpi-build.c but after conversion to AML API they are not used outside of aml-build.c anymore, so hide them from external users.

---
 include/hw/acpi/aml-build.h | 16 ----------------
 hw/acpi/aml-build.c         | 20 ++++++++++----------
 2 files changed, 10 insertions(+), 26 deletions(-)
include/hw/acpi/aml-build.h +0 -16
index 1187197..f6735ea 100644
@@ -188,20 +188,4 @@ Aml *aml_resource_template(void);
 Aml *aml_field(const char *name, AmlFieldFlags flags);
 Aml *aml_varpackage(uint32_t num_elements);
 
-/* other helpers */
-GArray *build_alloc_array(void);
-void build_free_array(GArray *array);
-void build_prepend_byte(GArray *array, uint8_t val);
-void build_append_byte(GArray *array, uint8_t val);
-void build_append_array(GArray *array, GArray *val);
-
-void GCC_FMT_ATTR(2, 3)
-build_append_namestring(GArray *array, const char *format, ...);
-
-void
-build_prepend_package_length(GArray *package, unsigned length, bool incl_self);
-void build_package(GArray *package, uint8_t op);
-void build_append_int(GArray *table, uint64_t value);
-void build_extop_package(GArray *package, uint8_t op);
-
 #endif
hw/acpi/aml-build.c +10 -10
index 60245e7..3e5949b 100644
@@ -27,27 +27,27 @@
 #include "hw/acpi/aml-build.h"
 #include "qemu/bswap.h"
 
-GArray *build_alloc_array(void)
+static GArray *build_alloc_array(void)
 {
     return g_array_new(false, true /* clear */, 1);
 }
 
-void build_free_array(GArray *array)
+static void build_free_array(GArray *array)
 {
     g_array_free(array, true);
 }
 
-void build_prepend_byte(GArray *array, uint8_t val)
+static void build_prepend_byte(GArray *array, uint8_t val)
 {
     g_array_prepend_val(array, val);
 }
 
-void build_append_byte(GArray *array, uint8_t val)
+static void build_append_byte(GArray *array, uint8_t val)
 {
     g_array_append_val(array, val);
 }
 
-void build_append_array(GArray *array, GArray *val)
+static void build_append_array(GArray *array, GArray *val)
 {
     g_array_append_vals(array, val->data, val->len);
 }
@@ -141,7 +141,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
     g_strfreev(segs);
 }
 
-void build_append_namestring(GArray *array, const char *format, ...)
+static void build_append_namestring(GArray *array, const char *format, ...)
 {
     va_list ap;
 
@@ -158,7 +158,7 @@ enum {
     PACKAGE_LENGTH_4BYTE_SHIFT = 20,
 };
 
-void
+static void
 build_prepend_package_length(GArray *package, unsigned length, bool incl_self)
 {
     uint8_t byte;
@@ -226,13 +226,13 @@ build_append_pkg_length(GArray *array, unsigned length, bool incl_self)
     build_free_array(tmp);
 }
 
-void build_package(GArray *package, uint8_t op)
+static void build_package(GArray *package, uint8_t op)
 {
     build_prepend_package_length(package, package->len, true);
     build_prepend_byte(package, op);
 }
 
-void build_extop_package(GArray *package, uint8_t op)
+static void build_extop_package(GArray *package, uint8_t op)
 {
     build_package(package, op);
     build_prepend_byte(package, 0x5B); /* ExtOpPrefix */
@@ -248,7 +248,7 @@ static void build_append_int_noprefix(GArray *table, uint64_t value, int size)
     }
 }
 
-void build_append_int(GArray *table, uint64_t value)
+static void build_append_int(GArray *table, uint64_t value)
 {
     if (value == 0x00) {
         build_append_byte(table, 0x00); /* ZeroOp */
Signature · 1 line
MST
#24 lore raw

[Qemu-devel] [PULL v3 25/26] acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().

In reply to Michael S. Tsirkin

From: Tang Chen <[email protected]>

Replace string "slot" in acpi_memory_plug_cb() with macro PC_DIMM_SLOT_PROP.

---
 hw/acpi/memory_hotplug.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/acpi/memory_hotplug.c +2 -1
index ed39241..c6580da 100644
@@ -168,7 +168,8 @@ void acpi_memory_plug_cb(ACPIREGS *ar, qemu_irq irq, MemHotplugState *mem_st,
 {
     MemStatus *mdev;
     Error *local_err = NULL;
-    int slot = object_property_get_int(OBJECT(dev), "slot", &local_err);
+    int slot = object_property_get_int(OBJECT(dev), PC_DIMM_SLOT_PROP,
+                                       &local_err);
 
     if (local_err) {
         error_propagate(errp, local_err);
Signature · 1 line
MST
#25 lore raw

[Qemu-devel] [PULL v3 24/26] pci-hotplug-old: Has been dead for five major releases, bury

In reply to Michael S. Tsirkin

From: Markus Armbruster <[email protected]>

Commit 79ca616 (v1.6.0) accidentally disabled legacy x86-only HMP commands pci_add, pci_del: it defined CONFIG_PCI_HOTPLUG only as make variable, not as preprocessor macro, killing the code conditional on defined(CONFIG_PCI_HOTPLUG_OLD).

In all this time, nobody reported the loss. I only noticed it when I tried to test some error reporting change that forced me to touch this old crap again.

Fun: git-log hw/pci/pci-hotplug-old.c shows our faith in the backward compatibility god has been strong enough to sacrifice at its altar about a dozen times, but not strong enough to even once verify the legacy feature's still there, let alone works.

Remove the commands along with the code backing them.

---
 include/sysemu/blockdev.h          |   2 -
 include/sysemu/sysemu.h            |   5 -
 device-hotplug.c                   |   7 +-
 hw/pci/pci-hotplug-old.c           | 342 -------------------------------------
 stubs/pci-drive-hot-add.c          |  10 --
 default-configs/i386-softmmu.mak   |   1 -
 default-configs/x86_64-softmmu.mak |   1 -
 hmp-commands.hx                    |  32 ----
 hw/pci/Makefile.objs               |   2 -
 stubs/Makefile.objs                |   1 -
 10 files changed, 3 insertions(+), 400 deletions(-)
 delete mode 100644 hw/pci/pci-hotplug-old.c
 delete mode 100644 stubs/pci-drive-hot-add.c
include/sysemu/blockdev.h +0 -2
index 0c62643..7ca59b5 100644
@@ -63,8 +63,6 @@ DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
 
 /* device-hotplug */
 
-DriveInfo *add_init_drive(const char *opts);
-
 void qmp_change_blockdev(const char *device, const char *filename,
                          const char *format, Error **errp);
 void hmp_commit(Monitor *mon, const QDict *qdict);
include/sysemu/sysemu.h +0 -5
index 1ab7063..e7135e1 100644
@@ -174,11 +174,6 @@ extern int nb_option_roms;
 extern const char *prom_envs[MAX_PROM_ENVS];
 extern unsigned int nb_prom_envs;
 
-/* pci-hotplug */
-void hmp_pci_add(Monitor *mon, const QDict *qdict);
-int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo);
-void hmp_pci_del(Monitor *mon, const QDict *qdict);
-
 /* generic hotplug */
 void hmp_drive_add(Monitor *mon, const QDict *qdict);
 
device-hotplug.c +3 -4
index 833d874..68b9496 100644
@@ -30,7 +30,7 @@
 #include "sysemu/sysemu.h"
 #include "monitor/monitor.h"
 
-DriveInfo *add_init_drive(const char *optstr)
+static DriveInfo *add_init_drive(const char *optstr)
 {
     DriveInfo *dinfo;
     QemuOpts *opts;
@@ -69,9 +69,8 @@ void hmp_drive_add(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "OK\n");
         break;
     default:
-        if (pci_drive_hot_add(mon, qdict, dinfo)) {
-            goto err;
-        }
+        monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
+        goto err;
     }
     return;
 
hw/pci/pci-hotplug-old.c deleted +0 -342

342 lines not on this page · raw message

stubs/pci-drive-hot-add.c deleted +0 -10
deleted file mode 100644
index 1d98145..0000000
@@ -1,10 +0,0 @@
-#include <monitor/monitor.h>
-#include <sysemu/sysemu.h>
-#include <sysemu/blockdev.h>
-
-int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo)
-{
-    /* On non-x86 we don't do PCI hotplug */
-    monitor_printf(mon, "Can't hot-add drive to type %d\n", dinfo->type);
-    return -1;
-}
default-configs/i386-softmmu.mak +0 -1
index bd99af9..f5634bf 100644
@@ -26,7 +26,6 @@ CONFIG_APPLESMC=y
 CONFIG_I8259=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_TPM_TIS=$(CONFIG_TPM)
-CONFIG_PCI_HOTPLUG_OLD=y
 CONFIG_MC146818RTC=y
 CONFIG_PAM=y
 CONFIG_PCI_PIIX=y
default-configs/x86_64-softmmu.mak +0 -1
index e7c2734..41990f7 100644
@@ -26,7 +26,6 @@ CONFIG_APPLESMC=y
 CONFIG_I8259=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_TPM_TIS=$(CONFIG_TPM)
-CONFIG_PCI_HOTPLUG_OLD=y
 CONFIG_MC146818RTC=y
 CONFIG_PAM=y
 CONFIG_PCI_PIIX=y
hmp-commands.hx +0 -32
index 81f276b..d5022d8 100644
@@ -1149,38 +1149,6 @@ STEXI
 Add drive to PCI storage controller.
 ETEXI
 
-#if defined(CONFIG_PCI_HOTPLUG_OLD)
-    {
-        .name       = "pci_add",
-        .args_type  = "pci_addr:s,type:s,opts:s?",
-        .params     = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...",
-        .help       = "hot-add PCI device",
-        .mhandler.cmd = hmp_pci_add,
-    },
-#endif
-
-STEXI
-@item pci_add
-@findex pci_add
-Hot-add PCI device.
-ETEXI
-
-#if defined(CONFIG_PCI_HOTPLUG_OLD)
-    {
-        .name       = "pci_del",
-        .args_type  = "pci_addr:s",
-        .params     = "[[<domain>:]<bus>:]<slot>",
-        .help       = "hot remove PCI device",
-        .mhandler.cmd = hmp_pci_del,
-    },
-#endif
-
-STEXI
-@item pci_del
-@findex pci_del
-Hot remove PCI device.
-ETEXI
-
     {
         .name       = "pcie_aer_inject_error",
         .args_type  = "advisory_non_fatal:-a,correctable:-c,"
hw/pci/Makefile.objs +0 -2
index 80f8aa6..9f905e6 100644
@@ -7,5 +7,3 @@ common-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o
 
 common-obj-$(call lnot,$(CONFIG_PCI)) += pci-stub.o
 common-obj-$(CONFIG_ALL) += pci-stub.o
-
-common-obj-$(CONFIG_PCI_HOTPLUG_OLD) += pci-hotplug-old.o
stubs/Makefile.objs +0 -1
index 5e347d0..8beff4c 100644
@@ -24,7 +24,6 @@ stub-obj-y += mon-printf.o
 stub-obj-y += mon-set-error.o
 stub-obj-y += monitor-init.o
 stub-obj-y += notify-event.o
-stub-obj-y += pci-drive-hot-add.o
 stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o
 stub-obj-y += qtest.o
 stub-obj-y += reset.o
Signature · 1 line
MST
#26 lore raw

[Qemu-devel] [PULL v3 26/26] acpi-test-data: update after pci rewrite

In reply to Michael S. Tsirkin

more trivial changes as more code has been rewritten in C. we also got rid of extra Scope operators.

---
 tests/acpi-test-data/pc/SSDT         | Bin 2480 -> 2476 bytes
 tests/acpi-test-data/pc/SSDT.bridge  | Bin 4351 -> 4335 bytes
 tests/acpi-test-data/q35/SSDT        | Bin 685 -> 681 bytes
 tests/acpi-test-data/q35/SSDT.bridge | Bin 702 -> 698 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/SSDT binary +0 -0
index dc5be2497b6c2015d7cbabb1ff0cd13e02b3e0e4..87c3e9fc0271f2b5826877a9f931c2428838f8a7 100644
GIT binary patch
tests/acpi-test-data/pc/SSDT.bridge binary +0 -0
index ca7f63cb4e48bd95418f68daf1b7e254d5bcf8c2..325899a757221b732ec94101301d782b577b28a3 100644
GIT binary patch
tests/acpi-test-data/q35/SSDT binary +0 -0
index 749f368e3034bfb491dcd8ced37936e0dcbba02a..6a5c0423b93dd9eda038dc4fd4af283f6bba9745 100644
GIT binary patch
tests/acpi-test-data/q35/SSDT.bridge binary +0 -0
index c552782f5bcc57094a7d1375b67979b2efa48f1c..5fc83a034002df64500970fa64f07b58bc15f3ea 100644
GIT binary patch
Signature · 1 line
MST
#27 lore raw
In reply to Michael S. Tsirkin

Igor noticed a problem on hosts without iasl.
I will redo this later.

Quoted 380 lines · Michael S. Tsirkin

Hello, Peter!

This should be the last big pull as we are entering hard freeze.

This is an update of my previous pull request from
http://mid.gmane.org/[email protected]
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream_rebased
as the tree was not rebased since, you can either do both pulls or only this latest pull, result will be exactly the same.

Note: I only included here the extra 26 patches, on top of what was previously posted
http://mid.gmane.org/[email protected]
if you merge PULL v2 first, you will see just these 26 patches.

I hope all this helps reduce the amount of noise rather than increase it.

Note: these patches remove some generated files that we previously compiled. Our build system doesn't handle this well for incremental builds, resulting in build errors. This is not new, incremental builds aren't 100% reliable. You can find and remove the stale .d files from the removed sources, this will fix it - for example, if you get an error about a missing ssdt-misc.dsl, find and remove ssdt-misc.d in output directory.

The following changes since commit 11d39a131020cc5c54ff9bc86d3259f7d32bf849:

Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20150218' into staging (2015-02-26 09:08:54 +0000)

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 e32dccddb0b1fa335bf251c155e907f9d47accfd:

acpi-test-data: update after pci rewrite (2015-03-01 19:41:50 +0100)

----------------------------------------------------------------
pci, pc, virtio fixes and cleanups

Last pull for hard freeze.

A bunch of fixes all over the place.
All of ACPI refactoring has been merged.
Legacy pci commands have been dropped.

Additionally, this includes patches from soft-freeze (which apparently haven't been merged yet):

a bunch of fixes all over the place
virtio header cleanup
initial patches from virtio-1.0 branch

----------------------------------------------------------------
Cornelia Huck (3):
virtio: cull virtio_bus_set_vdev_features
virtio: feature bit manipulation helpers
virtio: add feature checking helpers

Denis V. Lunev (1):
balloon: call qdev_alias_all_properties for proxy dev in balloon class init

Igor Mammedov (59):
acpi: move generic aml building helpers into dedictated file
acpi: add build_append_namestring() helper
acpi: drop min-bytes in build_package()
pc: acpi-build: update linker on guest access
pc: acpi-build: migrate RSDP table
pc: acpi: use local var for accessing ACPI tables blob in acpi_build()
acpi: introduce AML composer aml_append()
acpi: add aml_scope() term
pc: acpi-build: use aml_scope() for \_SB scope
acpi: add aml_device() term
acpi: add aml_method() term
acpi: add aml_if() term
acpi: add aml_name() & aml_name_decl() term
acpi: add aml_int() term
acpi: add aml_return() term
acpi: add aml_arg() term
acpi: add aml_store() term
acpi: add aml_and() term
acpi: add aml_notify() term
acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers
acpi: add aml_package() term
pc: acpi-build: generate _S[345] packages dynamically
acpi: add aml_buffer() term
acpi: add aml_resource_template() helper
acpi: add aml_io() helper
acpi: include PkgLength size only when requested
acpi: add aml_operation_region() term
acpi: add aml_field() & aml_named_field() terms
acpi: add aml_local() term
acpi: add aml_string() term
pc: acpi-build: generate pvpanic device description dynamically
acpi: add aml_varpackage() term
acpi: add aml_equal() term
acpi: add aml_processor() term
acpi: add aml_eisaid() term
pc: acpi-build: drop template patching and CPU hotplug objects dynamically
pc: acpi-build: create CPU hotplug IO region dynamically
acpi: add aml_reserved_field() term
pc: acpi-build: drop template patching and memory hotplug objects dynamically
pc: acpi-build: create memory hotplug IO region dynamically
acpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), aml_qword_memory() terms
pc: pcihp: expose MMIO base and len as properties
pc: acpi-build: reserve PCIHP MMIO resources
pc: acpi-build: create PCI0._CRS dynamically
pc: acpi: drop manual hole punching for PCI hotplug resources
pc: acpi: drop manual hole punching for CPU hotplug resources
pc: acpi: drop manual hole punching for GPE0 resources
pc: acpi-build: drop remaining ssdt_misc template
acpi: add acpi_irq_no_flags() term
pc: export applesmc IO port/len
pc: acpi-build: drop template patching and create Device(SMC) dynamically
tests: ACPI test blobs update due to PCI0._CRS changes
tests: bios-tables-test: add support for testing bridges
tests: add ACPI blobs for qemu with bridge cases
pc: acpi-build: simplify PCI bus tree generation
tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation
pc: acpi-build: drop template patching and create PCI bus tree dynamically
pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs
acpi: make build_*() routines static to aml-build.c

Markus Armbruster (13):
pci: Convert core to realize
pci: Permit incremental conversion of device models to realize
pci: Trivial device model conversions to realize
pcnet: pcnet_common_init() always returns 0, change to void
pcnet: Convert to realize
serial-pci: Convert to realize
ide/ich: Convert to realize
cirrus-vga: Convert to realize
qxl: Convert to realize
pci-assign: Convert to realize
qdev: Don't exit when running into bad -global
pci: Give a few helpers internal linkage
pci-hotplug-old: Has been dead for five major releases, bury

Michael S. Tsirkin (33):
acpi-build: fix memory leak with bridge hp off bios linker: validate pointer within table
acpi: update RSDP on guest access
exec: round up size on MR resize
acpi-build: fix ACPI RAM management
acpi: has_immutable_rsdp->!rsdp_in_ram
acpi-build: simplify rsdp management for legacy scripts/update-linux-headers.sh: pull virtio hdrs
include: import virtio headers from linux 4.0
virtio: use standard virtio_ring.h
virtio: use standard-headers
virtio-balloon: use standard headers
virtio-9p: use standard headers
virtio-blk: switch to standard-headers virtio-net,tap: use standard-headers
virtio-rng: use standard-headers
virtio-scsi: use standard-headers
virtio-serial: switch to standard-headers
update-linux-headers: use standard-headers
linux-headers: use standard-headers
virtio-pci: use standard headers
scripts: add arch specific standard-headers
standard-headers: add s390 virtio headers
s390: use standard headers
acpi-build: skip hotplugged bridges update-linux-headers.sh: s/__inline__/inline/ virtio-serial-bus.c: drop virtio_ids.h
standard-headers: include stdint.h virtio_ring.h: s/__inline__/inline/
acpi: update generated hex files
acpi: drop unused generated files
acpi-test: update expected files
acpi-test-data: update after pci rewrite

Peter Krempa (2):
vl.c: Fix error messages when parsing maxmem parameters
pc: memory: Validate alignment of maxram_size to page size

Stefan Berger (5):
tpm: Extend sts register to 32 bit
tpm: Allow 32 & 16 bit accesses to the registers
tpm: Support for XFIFO register
tpm: Support for TIS selftest done flag
tpm: Support for capability flags of TIS 1.3

Tang Chen (6):
acpi, pc: Add hotunplug request cb for pc machine. acpi, ich9: Add hotunplug request cb for ich9.
acpi, pc: Add unplug cb for pc machine.
acpi, ich9: Add unplug cb for ich9.
acpi, piix4: Add unplug cb for piix4.
acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().

 hw/9pfs/virtio-9p.h                                |   18 +-
 hw/net/pcnet.h                                     |    2 +-
 hw/s390x/s390-virtio-bus.h                         |   36 +-
 hw/s390x/s390-virtio.h                             |    7 +-
 hw/tpm/tpm_int.h                                   |    1 +
 hw/tpm/tpm_tis.h                                   |    2 +-
 include/hw/acpi/aml-build.h                        |  191 ++++
 include/hw/acpi/ich9.h                             |    4 +
 include/hw/acpi/pc-hotplug.h                       |    1 +
 include/hw/acpi/pcihp.h                            |    7 +-
 include/hw/i386/pc.h                               |    1 +
 include/hw/isa/isa.h                               |   11 +-
 include/hw/pci/pci.h                               |   10 +-
 include/hw/qdev-properties.h                       |    4 +-
 include/hw/virtio/dataplane/vring-accessors.h      |    2 +-
 include/hw/virtio/dataplane/vring.h                |    2 +-
 include/hw/virtio/virtio-balloon.h                 |   35 +-
 include/hw/virtio/virtio-blk.h                     |   77 +-
 include/hw/virtio/virtio-bus.h                     |    3 -
 include/hw/virtio/virtio-net.h                     |  151 +--
 include/hw/virtio/virtio-rng.h                     |    4 +-
 include/hw/virtio/virtio-scsi.h                    |  120 +-
 include/hw/virtio/virtio-serial.h                  |   40 +-
 include/hw/virtio/virtio.h                         |   71 +-
 include/net/tap.h                                  |   24 +-
 include/standard-headers/asm-s390/kvm_virtio.h     |   64 ++
 include/standard-headers/asm-s390/virtio-ccw.h     |   21 +
 include/standard-headers/linux/if_ether.h          |    1 +
 include/standard-headers/linux/types.h             |    2 +
 include/standard-headers/linux/virtio_9p.h         |   44 +
 include/standard-headers/linux/virtio_balloon.h    |   59 +
 include/standard-headers/linux/virtio_blk.h        |  143 +++
 include/standard-headers/linux/virtio_config.h     |   64 ++
 include/standard-headers/linux/virtio_console.h    |   78 ++
 include/standard-headers/linux/virtio_ids.h        |   43 +
 include/standard-headers/linux/virtio_net.h        |  233 ++++
 include/standard-headers/linux/virtio_pci.h        |  193 ++++
 .../linux}/virtio_ring.h                           |  132 +--
 include/standard-headers/linux/virtio_rng.h        |    8 +
 include/standard-headers/linux/virtio_scsi.h       |  164 +++
 include/standard-headers/linux/virtio_types.h      |   46 +
 include/sysemu/blockdev.h                          |    2 -
 include/sysemu/sysemu.h                            |    5 -
 include/sysemu/tpm_backend.h                       |    2 +-
 linux-headers/linux/virtio_config.h                |   58 +-
 linux-headers/linux/virtio_ring.h                  |  164 +--
 device-hotplug.c                                   |    7 +-
 exec.c                                             |    2 +
 hw/9pfs/virtio-9p-device.c                         |    2 +-
 hw/acpi/aml-build.c                                |  888 +++++++++++++++
 hw/acpi/bios-linker-loader.c                       |    4 +-
 hw/acpi/ich9.c                                     |   14 +
 hw/acpi/memory_hotplug.c                           |    3 +-
 hw/acpi/pcihp.c                                    |   18 +-
 hw/acpi/piix4.c                                    |   15 +-
 hw/audio/ac97.c                                    |    5 +-
 hw/audio/es1370.c                                  |    5 +-
 hw/audio/intel-hda.c                               |    6 +-
 hw/block/virtio-blk.c                              |   31 +-
 hw/char/serial-pci.c                               |   22 +-
 hw/char/virtio-serial-bus.c                        |    4 +-
 hw/core/qdev-properties.c                          |   21 +-
 hw/core/qdev.c                                     |    8 +-
 hw/display/cirrus_vga.c                            |   11 +-
 hw/display/qxl.c                                   |   36 +-
 hw/display/vga-pci.c                               |   11 +-
 hw/display/vmware_vga.c                            |    6 +-
 hw/i2c/smbus_ich9.c                                |    5 +-
 hw/i386/acpi-build.c                               | 1179 +++++++++-----------
 hw/i386/kvm/pci-assign.c                           |   10 +-
 hw/i386/pc.c                                       |   23 +
 hw/i386/pc_piix.c                                  |    3 +
 hw/i386/pc_q35.c                                   |    3 +
 hw/ide/cmd646.c                                    |    5 +-
 hw/ide/ich.c                                       |   13 +-
 hw/ide/piix.c                                      |   10 +-
 hw/ide/via.c                                       |    6 +-
 hw/ipack/tpci200.c                                 |    6 +-
 hw/isa/i82378.c                                    |    6 +-
 hw/isa/lpc_ich9.c                                  |   14 +-
 hw/isa/piix4.c                                     |    5 +-
 hw/isa/vt82c686.c                                  |   24 +-
 hw/misc/applesmc.c                                 |    5 +-
 hw/misc/pci-testdev.c                              |    6 +-
 hw/net/e1000.c                                     |    6 +-
 hw/net/eepro100.c                                  |    6 +-
 hw/net/lance.c                                     |    3 +-
 hw/net/ne2000.c                                    |    6 +-
 hw/net/pcnet-pci.c                                 |    6 +-
 hw/net/pcnet.c                                     |    4 +-
 hw/net/rtl8139.c                                   |    6 +-
 hw/net/vhost_net.c                                 |    2 +-
 hw/net/virtio-net.c                                |   57 +-
 hw/net/vmxnet3.c                                   |    6 +-
 hw/pci-bridge/dec.c                                |    5 +-
 hw/pci-host/apb.c                                  |    5 +-
 hw/pci-host/bonito.c                               |    6 +-
 hw/pci-host/grackle.c                              |    5 +-
 hw/pci-host/piix.c                                 |   12 +-
 hw/pci-host/ppce500.c                              |    6 +-
 hw/pci-host/prep.c                                 |    6 +-
 hw/pci-host/q35.c                                  |    5 +-
 hw/pci-host/uninorth.c                             |   20 +-
 hw/pci-host/versatile.c                            |    5 +-
 hw/pci/pci-hotplug-old.c                           |  342 ------
 hw/pci/pci.c                                       |  127 ++-
 hw/s390x/virtio-ccw.c                              |   12 +-
 hw/scsi/virtio-scsi.c                              |    9 +-
 hw/sd/sdhci.c                                      |    5 +-
 hw/tpm/tpm_passthrough.c                           |   37 +-
 hw/tpm/tpm_tis.c                                   |  131 ++-
 hw/usb/hcd-ehci-pci.c                              |    6 +-
 hw/usb/hcd-xhci.c                                  |    6 +-
 hw/virtio/dataplane/vring.c                        |   10 +-
 hw/virtio/virtio-balloon.c                         |    2 +-
 hw/virtio/virtio-bus.c                             |   14 -
 hw/virtio/virtio-mmio.c                            |    2 +-
 hw/virtio/virtio-pci.c                             |   63 +-
 hw/virtio/virtio.c                                 |   33 +-
 hw/watchdog/wdt_i6300esb.c                         |    6 +-
 stubs/pci-drive-hot-add.c                          |   10 -
 tests/bios-tables-test.c                           |   45 +-
 vl.c                                               |   34 +-
 default-configs/i386-softmmu.mak                   |    1 -
 default-configs/x86_64-softmmu.mak                 |    1 -
 hmp-commands.hx                                    |   32 -
 hw/acpi/Makefile.objs                              |    1 +
 hw/i386/Makefile.objs                              |    4 +-
 hw/i386/acpi-dsdt-cpu-hotplug.dsl                  |   17 +-
 hw/i386/acpi-dsdt-isa.dsl                          |   11 -
 hw/i386/acpi-dsdt-mem-hotplug.dsl                  |   36 +-
 hw/i386/acpi-dsdt-pci-crs.dsl                      |   92 --
 hw/i386/acpi-dsdt.dsl                              |   46 -
 hw/i386/acpi-dsdt.hex.generated                    |  224 +---
 hw/i386/q35-acpi-dsdt.dsl                          |   19 -
 hw/i386/q35-acpi-dsdt.hex.generated                |  224 +---
 hw/i386/ssdt-mem.dsl                               |   77 --
 hw/i386/ssdt-mem.hex.generated                     |  213 ----
 hw/i386/ssdt-misc.dsl                              |  122 --
 hw/i386/ssdt-misc.hex.generated                    |  399 -------
 hw/i386/ssdt-pcihp.dsl                             |  100 --
 hw/i386/ssdt-pcihp.hex.generated                   |  251 -----
 hw/i386/ssdt-proc.dsl                              |   63 --
 hw/i386/ssdt-proc.hex.generated                    |  134 ---
 hw/pci/Makefile.objs                               |    2 -
 scripts/update-linux-headers.sh                    |   52 +-
 stubs/Makefile.objs                                |    1 -
 tests/acpi-test-data/pc/DSDT                       |  Bin 3621 -> 2970 bytes
 tests/acpi-test-data/pc/SSDT                       |  Bin 2279 -> 2476 bytes
 tests/acpi-test-data/pc/SSDT.bridge                |  Bin 0 -> 4335 bytes
 tests/acpi-test-data/q35/DSDT                      |  Bin 8211 -> 7608 bytes
 tests/acpi-test-data/q35/SSDT                      |  Bin 560 -> 681 bytes
 tests/acpi-test-data/q35/SSDT.bridge               |  Bin 0 -> 698 bytes
 153 files changed, 3576 insertions(+), 4409 deletions(-)
 create mode 100644 include/hw/acpi/aml-build.h
 create mode 100644 include/standard-headers/asm-s390/kvm_virtio.h
 create mode 100644 include/standard-headers/asm-s390/virtio-ccw.h
 create mode 100644 include/standard-headers/linux/if_ether.h
 create mode 100644 include/standard-headers/linux/types.h
 create mode 100644 include/standard-headers/linux/virtio_9p.h
 create mode 100644 include/standard-headers/linux/virtio_balloon.h
 create mode 100644 include/standard-headers/linux/virtio_blk.h
 create mode 100644 include/standard-headers/linux/virtio_config.h
 create mode 100644 include/standard-headers/linux/virtio_console.h
 create mode 100644 include/standard-headers/linux/virtio_ids.h
 create mode 100644 include/standard-headers/linux/virtio_net.h
 create mode 100644 include/standard-headers/linux/virtio_pci.h
 rename include/{hw/virtio => standard-headers/linux}/virtio_ring.h (61%)
 create mode 100644 include/standard-headers/linux/virtio_rng.h
 create mode 100644 include/standard-headers/linux/virtio_scsi.h
 create mode 100644 include/standard-headers/linux/virtio_types.h
 create mode 100644 hw/acpi/aml-build.c
 delete mode 100644 hw/pci/pci-hotplug-old.c
 delete mode 100644 stubs/pci-drive-hot-add.c
 delete mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl
 delete mode 100644 hw/i386/ssdt-mem.dsl
 delete mode 100644 hw/i386/ssdt-mem.hex.generated
 delete mode 100644 hw/i386/ssdt-misc.dsl
 delete mode 100644 hw/i386/ssdt-misc.hex.generated
 delete mode 100644 hw/i386/ssdt-pcihp.dsl
 delete mode 100644 hw/i386/ssdt-pcihp.hex.generated
 delete mode 100644 hw/i386/ssdt-proc.dsl
 delete mode 100644 hw/i386/ssdt-proc.hex.generated
 create mode 100644 tests/acpi-test-data/pc/SSDT.bridge
 create mode 100644 tests/acpi-test-data/q35/SSDT.bridge
#28 lore raw
Quoted 2 lines · Michael S. Tsirkin

Igor noticed a problem on hosts without iasl.
I will redo this later.

It's ok now - generated hex files were missing. I updated the same for_upstream tag.

The following changes since commit 11d39a131020cc5c54ff9bc86d3259f7d32bf849:

Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20150218' into staging (2015-02-26 09:08:54 +0000)

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 48ce35b7645154eff6b685b3178aacf33f2ff871:

acpi: update generated files (2015-03-02 16:14:33 +0100)

----------------------------------------------------------------
pci, pc, virtio fixes and cleanups

Last pull for hard freeze.

A bunch of fixes all over the place.
All of ACPI refactoring has been merged. Legacy pci commands have been dropped.

Additionally, this includes patches from soft-freeze (which apparently haven't been merged yet):

a bunch of fixes all over the place virtio header cleanup
initial patches from virtio-1.0 branch

----------------------------------------------------------------
Cornelia Huck (3):
virtio: cull virtio_bus_set_vdev_features
virtio: feature bit manipulation helpers
virtio: add feature checking helpers

Denis V. Lunev (1):
balloon: call qdev_alias_all_properties for proxy dev in balloon class init

Igor Mammedov (59):
acpi: move generic aml building helpers into dedictated file
acpi: add build_append_namestring() helper
acpi: drop min-bytes in build_package()
pc: acpi-build: update linker on guest access
pc: acpi-build: migrate RSDP table
pc: acpi: use local var for accessing ACPI tables blob in acpi_build()
acpi: introduce AML composer aml_append()
acpi: add aml_scope() term
pc: acpi-build: use aml_scope() for \_SB scope
acpi: add aml_device() term
acpi: add aml_method() term
acpi: add aml_if() term
acpi: add aml_name() & aml_name_decl() term
acpi: add aml_int() term
acpi: add aml_return() term
acpi: add aml_arg() term
acpi: add aml_store() term
acpi: add aml_and() term
acpi: add aml_notify() term
acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpers
acpi: add aml_package() term
pc: acpi-build: generate _S[345] packages dynamically
acpi: add aml_buffer() term
acpi: add aml_resource_template() helper
acpi: add aml_io() helper
acpi: include PkgLength size only when requested
acpi: add aml_operation_region() term
acpi: add aml_field() & aml_named_field() terms
acpi: add aml_local() term
acpi: add aml_string() term
pc: acpi-build: generate pvpanic device description dynamically
acpi: add aml_varpackage() term
acpi: add aml_equal() term
acpi: add aml_processor() term
acpi: add aml_eisaid() term
pc: acpi-build: drop template patching and CPU hotplug objects dynamically
pc: acpi-build: create CPU hotplug IO region dynamically
acpi: add aml_reserved_field() term
pc: acpi-build: drop template patching and memory hotplug objects dynamically
pc: acpi-build: create memory hotplug IO region dynamically
acpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), aml_qword_memory() terms
pc: pcihp: expose MMIO base and len as properties
pc: acpi-build: reserve PCIHP MMIO resources
pc: acpi-build: create PCI0._CRS dynamically
pc: acpi: drop manual hole punching for PCI hotplug resources
pc: acpi: drop manual hole punching for CPU hotplug resources
pc: acpi: drop manual hole punching for GPE0 resources
pc: acpi-build: drop remaining ssdt_misc template
acpi: add acpi_irq_no_flags() term
pc: export applesmc IO port/len
pc: acpi-build: drop template patching and create Device(SMC) dynamically
tests: ACPI test blobs update due to PCI0._CRS changes
tests: bios-tables-test: add support for testing bridges
tests: add ACPI blobs for qemu with bridge cases
pc: acpi-build: simplify PCI bus tree generation
tests: ACPI: update pc/SSDT.bridge due to new alg of PCI tree creation
pc: acpi-build: drop template patching and create PCI bus tree dynamically
pc: acpi: remove not used anymore ssdt-[misc|pcihp].hex.generated blobs
acpi: make build_*() routines static to aml-build.c

Markus Armbruster (13):
pci: Convert core to realize
pci: Permit incremental conversion of device models to realize
pci: Trivial device model conversions to realize
pcnet: pcnet_common_init() always returns 0, change to void
pcnet: Convert to realize
serial-pci: Convert to realize
ide/ich: Convert to realize
cirrus-vga: Convert to realize
qxl: Convert to realize
pci-assign: Convert to realize
qdev: Don't exit when running into bad -global
pci: Give a few helpers internal linkage
pci-hotplug-old: Has been dead for five major releases, bury

Michael S. Tsirkin (35):
acpi-build: fix memory leak with bridge hp off bios linker: validate pointer within table
acpi: update RSDP on guest access
exec: round up size on MR resize
acpi-build: fix ACPI RAM management
acpi: has_immutable_rsdp->!rsdp_in_ram
acpi-build: simplify rsdp management for legacy scripts/update-linux-headers.sh: pull virtio hdrs
include: import virtio headers from linux 4.0
virtio: use standard virtio_ring.h
virtio: use standard-headers
virtio-balloon: use standard headers
virtio-9p: use standard headers
virtio-blk: switch to standard-headers virtio-net,tap: use standard-headers
virtio-rng: use standard-headers
virtio-scsi: use standard-headers
virtio-serial: switch to standard-headers
update-linux-headers: use standard-headers
linux-headers: use standard-headers
virtio-pci: use standard headers
scripts: add arch specific standard-headers
standard-headers: add s390 virtio headers
s390: use standard headers
acpi-build: skip hotplugged bridges update-linux-headers.sh: s/__inline__/inline/ virtio-serial-bus.c: drop virtio_ids.h
standard-headers: include stdint.h virtio_ring.h: s/__inline__/inline/
acpi: update generated hex files
acpi: drop unused generated files
acpi-test: update expected files
acpi-test-data: update after pci rewrite Makefile.target: binary depends on config-devices
acpi: update generated files

Peter Krempa (2):
vl.c: Fix error messages when parsing maxmem parameters
pc: memory: Validate alignment of maxram_size to page size

Stefan Berger (5):
tpm: Extend sts register to 32 bit
tpm: Allow 32 & 16 bit accesses to the registers
tpm: Support for XFIFO register
tpm: Support for TIS selftest done flag
tpm: Support for capability flags of TIS 1.3

Tang Chen (6):
acpi, pc: Add hotunplug request cb for pc machine. acpi, ich9: Add hotunplug request cb for ich9.
acpi, pc: Add unplug cb for pc machine.
acpi, ich9: Add unplug cb for ich9.
acpi, piix4: Add unplug cb for piix4.
acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().

 Makefile.target                                    |    4 +-
 hw/9pfs/virtio-9p.h                                |   18 +-
 hw/net/pcnet.h                                     |    2 +-
 hw/s390x/s390-virtio-bus.h                         |   36 +-
 hw/s390x/s390-virtio.h                             |    7 +-
 hw/tpm/tpm_int.h                                   |    1 +
 hw/tpm/tpm_tis.h                                   |    2 +-
 include/hw/acpi/aml-build.h                        |  191 ++++
 include/hw/acpi/ich9.h                             |    4 +
 include/hw/acpi/pc-hotplug.h                       |    1 +
 include/hw/acpi/pcihp.h                            |    7 +-
 include/hw/i386/pc.h                               |    1 +
 include/hw/isa/isa.h                               |   11 +-
 include/hw/pci/pci.h                               |   10 +-
 include/hw/qdev-properties.h                       |    4 +-
 include/hw/virtio/dataplane/vring-accessors.h      |    2 +-
 include/hw/virtio/dataplane/vring.h                |    2 +-
 include/hw/virtio/virtio-balloon.h                 |   35 +-
 include/hw/virtio/virtio-blk.h                     |   77 +-
 include/hw/virtio/virtio-bus.h                     |    3 -
 include/hw/virtio/virtio-net.h                     |  151 +--
 include/hw/virtio/virtio-rng.h                     |    4 +-
 include/hw/virtio/virtio-scsi.h                    |  120 +-
 include/hw/virtio/virtio-serial.h                  |   40 +-
 include/hw/virtio/virtio.h                         |   71 +-
 include/net/tap.h                                  |   24 +-
 include/standard-headers/asm-s390/kvm_virtio.h     |   64 ++
 include/standard-headers/asm-s390/virtio-ccw.h     |   21 +
 include/standard-headers/linux/if_ether.h          |    1 +
 include/standard-headers/linux/types.h             |    2 +
 include/standard-headers/linux/virtio_9p.h         |   44 +
 include/standard-headers/linux/virtio_balloon.h    |   59 +
 include/standard-headers/linux/virtio_blk.h        |  143 +++
 include/standard-headers/linux/virtio_config.h     |   64 ++
 include/standard-headers/linux/virtio_console.h    |   78 ++
 include/standard-headers/linux/virtio_ids.h        |   43 +
 include/standard-headers/linux/virtio_net.h        |  233 ++++
 include/standard-headers/linux/virtio_pci.h        |  193 ++++
 .../linux}/virtio_ring.h                           |  132 +--
 include/standard-headers/linux/virtio_rng.h        |    8 +
 include/standard-headers/linux/virtio_scsi.h       |  164 +++
 include/standard-headers/linux/virtio_types.h      |   46 +
 include/sysemu/blockdev.h                          |    2 -
 include/sysemu/sysemu.h                            |    5 -
 include/sysemu/tpm_backend.h                       |    2 +-
 linux-headers/linux/virtio_config.h                |   58 +-
 linux-headers/linux/virtio_ring.h                  |  164 +--
 device-hotplug.c                                   |    7 +-
 exec.c                                             |    2 +
 hw/9pfs/virtio-9p-device.c                         |    2 +-
 hw/acpi/aml-build.c                                |  888 +++++++++++++++
 hw/acpi/bios-linker-loader.c                       |    4 +-
 hw/acpi/ich9.c                                     |   14 +
 hw/acpi/memory_hotplug.c                           |    3 +-
 hw/acpi/pcihp.c                                    |   18 +-
 hw/acpi/piix4.c                                    |   15 +-
 hw/audio/ac97.c                                    |    5 +-
 hw/audio/es1370.c                                  |    5 +-
 hw/audio/intel-hda.c                               |    6 +-
 hw/block/virtio-blk.c                              |   31 +-
 hw/char/serial-pci.c                               |   22 +-
 hw/char/virtio-serial-bus.c                        |    4 +-
 hw/core/qdev-properties.c                          |   21 +-
 hw/core/qdev.c                                     |    8 +-
 hw/display/cirrus_vga.c                            |   11 +-
 hw/display/qxl.c                                   |   36 +-
 hw/display/vga-pci.c                               |   11 +-
 hw/display/vmware_vga.c                            |    6 +-
 hw/i2c/smbus_ich9.c                                |    5 +-
 hw/i386/acpi-build.c                               | 1179 +++++++++-----------
 hw/i386/kvm/pci-assign.c                           |   10 +-
 hw/i386/pc.c                                       |   23 +
 hw/i386/pc_piix.c                                  |    3 +
 hw/i386/pc_q35.c                                   |    3 +
 hw/ide/cmd646.c                                    |    5 +-
 hw/ide/ich.c                                       |   13 +-
 hw/ide/piix.c                                      |   10 +-
 hw/ide/via.c                                       |    6 +-
 hw/ipack/tpci200.c                                 |    6 +-
 hw/isa/i82378.c                                    |    6 +-
 hw/isa/lpc_ich9.c                                  |   14 +-
 hw/isa/piix4.c                                     |    5 +-
 hw/isa/vt82c686.c                                  |   24 +-
 hw/misc/applesmc.c                                 |    5 +-
 hw/misc/pci-testdev.c                              |    6 +-
 hw/net/e1000.c                                     |    6 +-
 hw/net/eepro100.c                                  |    6 +-
 hw/net/lance.c                                     |    3 +-
 hw/net/ne2000.c                                    |    6 +-
 hw/net/pcnet-pci.c                                 |    6 +-
 hw/net/pcnet.c                                     |    4 +-
 hw/net/rtl8139.c                                   |    6 +-
 hw/net/vhost_net.c                                 |    2 +-
 hw/net/virtio-net.c                                |   57 +-
 hw/net/vmxnet3.c                                   |    6 +-
 hw/pci-bridge/dec.c                                |    5 +-
 hw/pci-host/apb.c                                  |    5 +-
 hw/pci-host/bonito.c                               |    6 +-
 hw/pci-host/grackle.c                              |    5 +-
 hw/pci-host/piix.c                                 |   12 +-
 hw/pci-host/ppce500.c                              |    6 +-
 hw/pci-host/prep.c                                 |    6 +-
 hw/pci-host/q35.c                                  |    5 +-
 hw/pci-host/uninorth.c                             |   20 +-
 hw/pci-host/versatile.c                            |    5 +-
 hw/pci/pci-hotplug-old.c                           |  342 ------
 hw/pci/pci.c                                       |  127 ++-
 hw/s390x/virtio-ccw.c                              |   12 +-
 hw/scsi/virtio-scsi.c                              |    9 +-
 hw/sd/sdhci.c                                      |    5 +-
 hw/tpm/tpm_passthrough.c                           |   37 +-
 hw/tpm/tpm_tis.c                                   |  131 ++-
 hw/usb/hcd-ehci-pci.c                              |    6 +-
 hw/usb/hcd-xhci.c                                  |    6 +-
 hw/virtio/dataplane/vring.c                        |   10 +-
 hw/virtio/virtio-balloon.c                         |    2 +-
 hw/virtio/virtio-bus.c                             |   14 -
 hw/virtio/virtio-mmio.c                            |    2 +-
 hw/virtio/virtio-pci.c                             |   63 +-
 hw/virtio/virtio.c                                 |   33 +-
 hw/watchdog/wdt_i6300esb.c                         |    6 +-
 stubs/pci-drive-hot-add.c                          |   10 -
 tests/bios-tables-test.c                           |   45 +-
 vl.c                                               |   34 +-
 default-configs/i386-softmmu.mak                   |    1 -
 default-configs/x86_64-softmmu.mak                 |    1 -
 hmp-commands.hx                                    |   32 -
 hw/acpi/Makefile.objs                              |    1 +
 hw/i386/Makefile.objs                              |    4 +-
 hw/i386/acpi-dsdt-cpu-hotplug.dsl                  |   17 +-
 hw/i386/acpi-dsdt-isa.dsl                          |   11 -
 hw/i386/acpi-dsdt-mem-hotplug.dsl                  |   36 +-
 hw/i386/acpi-dsdt-pci-crs.dsl                      |   92 --
 hw/i386/acpi-dsdt.dsl                              |   46 -
 hw/i386/acpi-dsdt.hex.generated                    |   39 +-
 hw/i386/q35-acpi-dsdt.dsl                          |   19 -
 hw/i386/q35-acpi-dsdt.hex.generated                |   41 +-
 hw/i386/ssdt-mem.dsl                               |   77 --
 hw/i386/ssdt-mem.hex.generated                     |  213 ----
 hw/i386/ssdt-misc.dsl                              |  122 --
 hw/i386/ssdt-misc.hex.generated                    |  399 -------
 hw/i386/ssdt-pcihp.dsl                             |  100 --
 hw/i386/ssdt-pcihp.hex.generated                   |  251 -----
 hw/i386/ssdt-proc.dsl                              |   63 --
 hw/i386/ssdt-proc.hex.generated                    |  134 ---
 hw/i386/ssdt-tpm.hex.generated                     |    6 +-
 hw/pci/Makefile.objs                               |    2 -
 scripts/update-linux-headers.sh                    |   52 +-
 stubs/Makefile.objs                                |    1 -
 tests/acpi-test-data/pc/DSDT                       |  Bin 3621 -> 2970 bytes
 tests/acpi-test-data/pc/SSDT                       |  Bin 2279 -> 2476 bytes
 tests/acpi-test-data/pc/SSDT.bridge                |  Bin 0 -> 4335 bytes
 tests/acpi-test-data/q35/DSDT                      |  Bin 8211 -> 7608 bytes
 tests/acpi-test-data/q35/SSDT                      |  Bin 560 -> 681 bytes
 tests/acpi-test-data/q35/SSDT.bridge               |  Bin 0 -> 698 bytes
 155 files changed, 3575 insertions(+), 4052 deletions(-)
 create mode 100644 include/hw/acpi/aml-build.h
 create mode 100644 include/standard-headers/asm-s390/kvm_virtio.h
 create mode 100644 include/standard-headers/asm-s390/virtio-ccw.h
 create mode 100644 include/standard-headers/linux/if_ether.h
 create mode 100644 include/standard-headers/linux/types.h
 create mode 100644 include/standard-headers/linux/virtio_9p.h
 create mode 100644 include/standard-headers/linux/virtio_balloon.h
 create mode 100644 include/standard-headers/linux/virtio_blk.h
 create mode 100644 include/standard-headers/linux/virtio_config.h
 create mode 100644 include/standard-headers/linux/virtio_console.h
 create mode 100644 include/standard-headers/linux/virtio_ids.h
 create mode 100644 include/standard-headers/linux/virtio_net.h
 create mode 100644 include/standard-headers/linux/virtio_pci.h
 rename include/{hw/virtio => standard-headers/linux}/virtio_ring.h (61%)
 create mode 100644 include/standard-headers/linux/virtio_rng.h
 create mode 100644 include/standard-headers/linux/virtio_scsi.h
 create mode 100644 include/standard-headers/linux/virtio_types.h
 create mode 100644 hw/acpi/aml-build.c
 delete mode 100644 hw/pci/pci-hotplug-old.c
 delete mode 100644 stubs/pci-drive-hot-add.c
 delete mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl
 delete mode 100644 hw/i386/ssdt-mem.dsl
 delete mode 100644 hw/i386/ssdt-mem.hex.generated
 delete mode 100644 hw/i386/ssdt-misc.dsl
 delete mode 100644 hw/i386/ssdt-misc.hex.generated
 delete mode 100644 hw/i386/ssdt-pcihp.dsl
 delete mode 100644 hw/i386/ssdt-pcihp.hex.generated
 delete mode 100644 hw/i386/ssdt-proc.dsl
 delete mode 100644 hw/i386/ssdt-proc.hex.generated
 create mode 100644 tests/acpi-test-data/pc/SSDT.bridge
 create mode 100644 tests/acpi-test-data/q35/SSDT.bridge