All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
@ 2023-01-05  9:14 Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 01/51] virtio_net: Modify virtio_net_get_config to early return Michael S. Tsirkin
                   ` (52 more replies)
  0 siblings, 53 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:

  .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)

are available in the Git repository at:

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

for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:

  vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)

----------------------------------------------------------------
virtio,pc,pci: features, cleanups, fixes

mostly vhost-vdpa:
    guest announce feature emulation when using shadow virtqueue
    support for configure interrupt
    startup speed ups

an acpi change to only generate cluster node in PPTT when specified for arm

misc fixes, cleanups

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------

Note: linux-user build is failing for me on master, I just
disabled it for now as nothing I'm doing should affect linux-user.
Didn't debug yet.


Bernhard Beschow (7):
      hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9
      hw/acpi/Kconfig: Add missing dependencies to ACPI_ICH9
      hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines
      hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4
      hw/isa/Kconfig: Add missing dependency to VT82C686
      i386, mips: Resolve redundant ACPI and APM dependencies
      hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2

Cindy Lu (10):
      virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
      virtio-pci: decouple notifier from interrupt process
      virtio-pci: decouple the single vector from the interrupt process
      vhost: introduce new VhostOps vhost_set_config_call
      vhost-vdpa: add support for config interrupt
      virtio: add support for configure interrupt
      vhost: add support for configure interrupt
      virtio-net: add support for configure interrupt
      virtio-mmio: add support for configure interrupt
      virtio-pci: add support for configure interrupt

Dongli Zhang (1):
      vhost-scsi: fix memleak of vsc->inflight

Eugenio Pérez (4):
      virtio_net: Modify virtio_net_get_config to early return
      virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it
      vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail
      vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa

Hyman Huang (3):
      vhost-user: Refactor vhost acked features saving
      vhost-user: Refactor the chr_closed_bh
      vhost-user: Fix the virtio features negotiation flaw

Laszlo Ersek (1):
      acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block

Longpeng (Mike) (5):
      vdpa-dev: get iova range explicitly
      vdpa: harden the error path if get_iova_range failed
      vhost: simplify vhost_dev_enable_notifiers
      vhost: configure all host notifiers in a single MR transaction
      vdpa: commit all host notifier MRs in a single MR transaction

Markus Armbruster (11):
      include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h
      include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use
      include/hw/cxl: Include hw/cxl/*.h where needed
      include/hw/pci: Clean up a few things checkpatch.pl would flag
      include/hw/pci: Split pci_device.h off pci.h
      include/hw/pci: Include hw/pci/pci.h where needed
      include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h
      include/hw/virtio: Break inclusion loop
      include: Include headers where needed
      include: Don't include qemu/osdep.h
      docs/devel: Rules on #include in headers

Philippe Mathieu-Daudé (2):
      hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device()
      hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c

Yicong Yang (6):
      tests: virt: Allow changes to PPTT test table
      hw/acpi/aml-build: Only generate cluster node in PPTT when specified
      tests: virt: Update expected ACPI tables for virt test
      tests: acpi: Add and whitelist *.topology blobs
      tests: acpi: aarch64: Add topology test for aarch64
      tests: acpi: aarch64: Add *.topology tables

leixiang (1):
      virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers

 configs/devices/mips-softmmu/common.mak     |   3 -
 bsd-user/qemu.h                             |   1 -
 crypto/block-luks-priv.h                    |   1 -
 hw/alpha/alpha_sys.h                        |   1 -
 hw/display/ati_int.h                        |   2 +-
 hw/display/qxl.h                            |   3 +-
 hw/ide/ahci_internal.h                      |   2 +-
 hw/net/vmxnet3_defs.h                       |   2 +-
 hw/nvme/nvme.h                              |   2 +-
 hw/rdma/rdma_utils.h                        |   1 -
 hw/rdma/vmw/pvrdma.h                        |   2 +-
 hw/scsi/mptsas.h                            |   2 +-
 hw/usb/hcd-ehci.h                           |   3 +-
 hw/usb/hcd-uhci.h                           |   2 +-
 hw/usb/hcd-xhci-pci.h                       |   1 +
 hw/vfio/pci.h                               |   2 +-
 hw/virtio/virtio-qmp.h                      |  10 +
 hw/xen/xen_pt.h                             |   1 -
 include/exec/plugin-gen.h                   |   1 +
 include/hw/acpi/erst.h                      |   3 +
 include/hw/acpi/piix4.h                     |   2 +-
 include/hw/arm/allwinner-a10.h              |   1 +
 include/hw/boards.h                         |   3 +
 include/hw/char/cmsdk-apb-uart.h            |   1 +
 include/hw/char/goldfish_tty.h              |   1 +
 include/hw/char/xilinx_uartlite.h           |   1 +
 include/hw/cris/etraxfs.h                   |   1 +
 include/hw/cxl/cxl.h                        |   5 +-
 include/hw/cxl/cxl_cdat.h                   |   1 +
 include/hw/cxl/cxl_component.h              |   1 +
 include/hw/cxl/cxl_device.h                 |   2 +
 include/hw/cxl/cxl_host.h                   |   1 -
 include/hw/cxl/cxl_pci.h                    |   3 -
 include/hw/display/macfb.h                  |   3 +-
 include/hw/dma/sifive_pdma.h                |   2 +
 include/hw/i386/ich9.h                      |   4 -
 include/hw/i386/ioapic_internal.h           |   1 +
 include/hw/i386/sgx-epc.h                   |   1 +
 include/hw/i386/x86-iommu.h                 |   1 -
 include/hw/ide/pci.h                        |   2 +-
 include/hw/input/pl050.h                    |   1 -
 include/hw/intc/goldfish_pic.h              |   2 +
 include/hw/intc/loongarch_pch_msi.h         |   2 +
 include/hw/intc/loongarch_pch_pic.h         |   2 +
 include/hw/intc/nios2_vic.h                 |   2 +
 include/hw/isa/vt82c686.h                   |   1 -
 include/hw/misc/macio/macio.h               |   2 +-
 include/hw/misc/mchp_pfsoc_dmc.h            |   2 +
 include/hw/misc/mchp_pfsoc_ioscb.h          |   2 +
 include/hw/misc/mchp_pfsoc_sysreg.h         |   2 +
 include/hw/misc/pvpanic.h                   |   1 +
 include/hw/misc/sifive_e_prci.h             |   3 +-
 include/hw/misc/sifive_u_otp.h              |   3 +-
 include/hw/misc/sifive_u_prci.h             |   3 +-
 include/hw/misc/virt_ctrl.h                 |   2 +
 include/hw/misc/xlnx-versal-pmc-iou-slcr.h  |   1 +
 include/hw/net/lasi_82596.h                 |   2 +-
 include/hw/net/xlnx-zynqmp-can.h            |   1 +
 include/hw/pci-host/designware.h            |   3 -
 include/hw/pci-host/gpex.h                  |   2 +-
 include/hw/pci-host/i440fx.h                |   2 +-
 include/hw/pci-host/ls7a.h                  |   2 -
 include/hw/pci-host/pnv_phb3.h              |   2 -
 include/hw/pci-host/pnv_phb4.h              |   3 +-
 include/hw/pci-host/q35.h                   |   2 +-
 include/hw/pci-host/sabre.h                 |   2 +-
 include/hw/pci-host/xilinx-pcie.h           |   1 -
 include/hw/pci/msi.h                        |   2 +-
 include/hw/pci/pci.h                        | 341 ---------------------------
 include/hw/pci/pci_bridge.h                 |   3 +-
 include/hw/pci/pci_device.h                 | 350 ++++++++++++++++++++++++++++
 include/hw/pci/pcie.h                       |   1 -
 include/hw/pci/pcie_port.h                  |   1 +
 include/hw/pci/pcie_sriov.h                 |   2 +
 include/hw/pci/shpc.h                       |   2 +-
 include/hw/ppc/pnv_psi.h                    |   2 +-
 include/hw/remote/iohub.h                   |   2 +-
 include/hw/remote/proxy.h                   |   2 +-
 include/hw/riscv/boot_opensbi.h             |   2 +
 include/hw/riscv/microchip_pfsoc.h          |   3 +
 include/hw/riscv/numa.h                     |   1 +
 include/hw/riscv/sifive_u.h                 |   2 +
 include/hw/riscv/spike.h                    |   2 +-
 include/hw/riscv/virt.h                     |   2 +-
 include/hw/sd/sdhci.h                       |   2 +-
 include/hw/southbridge/piix.h               |   3 +-
 include/hw/ssi/sifive_spi.h                 |   3 +
 include/hw/timer/sse-timer.h                |   1 +
 include/hw/tricore/triboard.h               |   1 -
 include/hw/usb/hcd-dwc3.h                   |   1 +
 include/hw/usb/hcd-musb.h                   |   2 +
 include/hw/usb/xlnx-usb-subsystem.h         |   2 +
 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h |   3 +
 include/hw/virtio/vhost-backend.h           |   3 +
 include/hw/virtio/vhost-vdpa.h              |   2 +
 include/hw/virtio/vhost.h                   |   4 +
 include/hw/virtio/virtio-mmio.h             |   2 +-
 include/hw/virtio/virtio-pci.h              |   4 +-
 include/hw/virtio/virtio-scsi.h             |   1 -
 include/hw/virtio/virtio.h                  |   8 +-
 include/hw/xen/xen_common.h                 |   2 +-
 include/net/vhost-user.h                    |   1 +
 include/net/vhost_net.h                     |   4 +
 include/qemu/plugin-memory.h                |   3 +
 include/qemu/userfaultfd.h                  |   1 -
 include/sysemu/dirtyrate.h                  |   2 +
 include/sysemu/dump.h                       |   1 +
 include/user/syscall-trace.h                |   1 +
 net/vmnet_int.h                             |   1 -
 qga/cutils.h                                |   1 -
 target/hexagon/hex_arch_types.h             |   1 -
 target/hexagon/mmvec/macros.h               |   1 -
 target/riscv/pmu.h                          |   1 -
 hw/acpi/aml-build.c                         |   2 +-
 hw/acpi/cpu_hotplug.c                       |   3 +
 hw/acpi/erst.c                              |   2 +-
 hw/alpha/pci.c                              |   1 +
 hw/alpha/typhoon.c                          |   2 +-
 hw/audio/ac97.c                             |   2 +-
 hw/audio/es1370.c                           |   2 +-
 hw/audio/via-ac97.c                         |   2 +-
 hw/char/serial-pci-multi.c                  |   2 +-
 hw/char/serial-pci.c                        |   2 +-
 hw/core/machine-smp.c                       |   2 +
 hw/core/qdev-properties-system.c            |   1 +
 hw/display/bochs-display.c                  |   2 +-
 hw/display/cirrus_vga.c                     |   2 +-
 hw/display/sm501.c                          |   2 +-
 hw/display/vga-pci.c                        |   2 +-
 hw/display/vhost-user-gpu.c                 |  18 ++
 hw/display/vmware_vga.c                     |   2 +-
 hw/i386/acpi-build.c                        |   2 +-
 hw/i386/xen/xen_pvdevice.c                  |   2 +-
 hw/ipack/tpci200.c                          |   2 +-
 hw/ipmi/pci_ipmi_bt.c                       |   2 +-
 hw/ipmi/pci_ipmi_kcs.c                      |   2 +-
 hw/isa/i82378.c                             |   2 +-
 hw/mips/gt64xxx_pci.c                       |   2 +-
 hw/misc/pci-testdev.c                       |   2 +-
 hw/misc/pvpanic-pci.c                       |   2 +-
 hw/net/can/can_kvaser_pci.c                 |   2 +-
 hw/net/can/can_mioe3680_pci.c               |   2 +-
 hw/net/can/can_pcm3680_pci.c                |   2 +-
 hw/net/can/ctucan_pci.c                     |   2 +-
 hw/net/e1000.c                              |   2 +-
 hw/net/e1000x_common.c                      |   2 +-
 hw/net/eepro100.c                           |   2 +-
 hw/net/ne2000-pci.c                         |   2 +-
 hw/net/net_tx_pkt.c                         |   2 +-
 hw/net/pcnet-pci.c                          |   2 +-
 hw/net/rocker/rocker.c                      |   2 +-
 hw/net/rocker/rocker_desc.c                 |   2 +-
 hw/net/rtl8139.c                            |   2 +-
 hw/net/sungem.c                             |   2 +-
 hw/net/sunhme.c                             |   2 +-
 hw/net/tulip.c                              |   2 +-
 hw/net/vhost_net-stub.c                     |  14 ++
 hw/net/vhost_net.c                          |  18 ++
 hw/net/virtio-net.c                         |  60 +++--
 hw/pci-bridge/i82801b11.c                   |   2 +-
 hw/pci-bridge/pci_expander_bridge.c         |   1 -
 hw/pci-host/bonito.c                        |   2 +-
 hw/pci-host/dino.c                          |   2 +-
 hw/pci-host/grackle.c                       |   2 +-
 hw/pci-host/mv64361.c                       |   2 +-
 hw/pci-host/ppce500.c                       |   2 +-
 hw/pci-host/raven.c                         |   2 +-
 hw/pci-host/sh_pci.c                        |   2 +-
 hw/pci-host/uninorth.c                      |   2 +-
 hw/pci-host/versatile.c                     |   2 +-
 hw/pci/pci-hmp-cmds.c                       |   1 +
 hw/pci/pcie_host.c                          |   2 +-
 hw/pci/pcie_sriov.c                         |   2 +-
 hw/pci/slotid_cap.c                         |   2 +-
 hw/ppc/ppc440_pcix.c                        |   2 +-
 hw/ppc/ppc4xx_pci.c                         |   2 +-
 hw/ppc/spapr_pci_vfio.c                     |   1 +
 hw/rdma/rdma_utils.c                        |   1 +
 hw/s390x/s390-pci-inst.c                    |   1 +
 hw/scsi/esp-pci.c                           |   2 +-
 hw/scsi/lsi53c895a.c                        |   2 +-
 hw/scsi/vhost-scsi-common.c                 |   1 +
 hw/scsi/virtio-scsi.c                       |   1 +
 hw/smbios/smbios.c                          |   1 +
 hw/usb/hcd-ohci-pci.c                       |   2 +-
 hw/virtio/vdpa-dev.c                        |   9 +
 hw/virtio/vhost-user-fs.c                   |  18 ++
 hw/virtio/vhost-user-gpio.c                 |  10 +
 hw/virtio/vhost-vdpa.c                      |  40 +++-
 hw/virtio/vhost-vsock-common.c              |  18 ++
 hw/virtio/vhost.c                           | 122 ++++++++--
 hw/virtio/virtio-crypto.c                   |  18 ++
 hw/virtio/virtio-mmio.c                     |  27 +++
 hw/virtio/virtio-pci.c                      | 305 ++++++++++++++++--------
 hw/virtio/virtio-qmp.c                      | 192 ++++++++++++++-
 hw/virtio/virtio.c                          | 225 +++---------------
 hw/watchdog/wdt_i6300esb.c                  |   2 +-
 net/vhost-user.c                            |  27 ++-
 net/vhost-vdpa.c                            |  32 +--
 qga/cutils.c                                |   3 +-
 tests/qtest/bios-tables-test.c              |  19 ++
 tests/qtest/fuzz/generic_fuzz.c             |   1 +
 ui/util.c                                   |   2 +-
 docs/devel/style.rst                        |   7 +
 hw/acpi/Kconfig                             |   9 +-
 hw/acpi/meson.build                         |   2 +-
 hw/i2c/meson.build                          |   2 +-
 hw/i386/Kconfig                             |   3 +-
 hw/isa/Kconfig                              |   4 +-
 hw/ppc/Kconfig                              |   2 -
 hw/virtio/trace-events                      |   1 +
 qemu-options.hx                             |   3 +
 tests/data/acpi/virt/APIC.topology          | Bin 0 -> 732 bytes
 tests/data/acpi/virt/DSDT.topology          | Bin 0 -> 5398 bytes
 tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
 tests/data/acpi/virt/PPTT.acpihmatvirt      | Bin 196 -> 156 bytes
 tests/data/acpi/virt/PPTT.topology          | Bin 0 -> 336 bytes
 217 files changed, 1418 insertions(+), 839 deletions(-)
 create mode 100644 include/hw/pci/pci_device.h
 create mode 100644 tests/data/acpi/virt/APIC.topology
 create mode 100644 tests/data/acpi/virt/DSDT.topology
 create mode 100644 tests/data/acpi/virt/PPTT.topology



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

* [PULL 01/51] virtio_net: Modify virtio_net_get_config to early return
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Michael S. Tsirkin
                   ` (51 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Eugenio Pérez, Philippe Mathieu-Daudé,
	Jason Wang

From: Eugenio Pérez <eperezma@redhat.com>

Next patches introduce more code on vhost-vdpa branch, with already have
too much indentation.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20221221115015.1400889-2-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/net/virtio-net.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9cbdfa5547..b30038d130 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -168,20 +168,22 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
     if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
         ret = vhost_net_get_config(get_vhost_net(nc->peer), (uint8_t *)&netcfg,
                                    n->config_size);
-        if (ret != -1) {
-            /*
-             * Some NIC/kernel combinations present 0 as the mac address.  As
-             * that is not a legal address, try to proceed with the
-             * address from the QEMU command line in the hope that the
-             * address has been configured correctly elsewhere - just not
-             * reported by the device.
-             */
-            if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
-                info_report("Zero hardware mac address detected. Ignoring.");
-                memcpy(netcfg.mac, n->mac, ETH_ALEN);
-            }
-            memcpy(config, &netcfg, n->config_size);
+        if (ret == -1) {
+            return;
         }
+
+        /*
+         * Some NIC/kernel combinations present 0 as the mac address.  As that
+         * is not a legal address, try to proceed with the address from the
+         * QEMU command line in the hope that the address has been configured
+         * correctly elsewhere - just not reported by the device.
+         */
+        if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
+            info_report("Zero hardware mac address detected. Ignoring.");
+            memcpy(netcfg.mac, n->mac, ETH_ALEN);
+        }
+
+        memcpy(config, &netcfg, n->config_size);
     }
 }
 
-- 
MST



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

* [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 01/51] virtio_net: Modify virtio_net_get_config to early return Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 03/51] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Michael S. Tsirkin
                   ` (50 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Eugenio Pérez, Jason Wang

From: Eugenio Pérez <eperezma@redhat.com>

Status part of the emulated feature. It will follow device model, so we
must copy it as long as NIC device model has it set.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20221221115015.1400889-3-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/virtio-net.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index b30038d130..122eac25ee 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -183,6 +183,8 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
             memcpy(netcfg.mac, n->mac, ETH_ALEN);
         }
 
+        netcfg.status |= virtio_tswap16(vdev,
+                                        n->status & VIRTIO_NET_S_ANNOUNCE);
         memcpy(config, &netcfg, n->config_size);
     }
 }
-- 
MST



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

* [PULL 03/51] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 01/51] virtio_net: Modify virtio_net_get_config to early return Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 04/51] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa Michael S. Tsirkin
                   ` (49 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Eugenio Pérez, Jason Wang

From: Eugenio Pérez <eperezma@redhat.com>

Since this capability is emulated by qemu shadowed CVQ cannot forward it
to the device. Process all that command within qemu.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20221221115015.1400889-4-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
 net/vhost-vdpa.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index d36664f33a..41de76376f 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -616,9 +616,18 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq,
     out.iov_len = iov_to_buf(elem->out_sg, elem->out_num, 0,
                              s->cvq_cmd_out_buffer,
                              vhost_vdpa_net_cvq_cmd_len());
-    dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
-    if (unlikely(dev_written < 0)) {
-        goto out;
+    if (*(uint8_t *)s->cvq_cmd_out_buffer == VIRTIO_NET_CTRL_ANNOUNCE) {
+        /*
+         * Guest announce capability is emulated by qemu, so don't forward to
+         * the device.
+         */
+        dev_written = sizeof(status);
+        *s->status = VIRTIO_NET_OK;
+    } else {
+        dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
+        if (unlikely(dev_written < 0)) {
+            goto out;
+        }
     }
 
     if (unlikely(dev_written < sizeof(status))) {
-- 
MST



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

* [PULL 04/51] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 03/51] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 05/51] hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9 Michael S. Tsirkin
                   ` (48 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Eugenio Pérez, Jason Wang

From: Eugenio Pérez <eperezma@redhat.com>

So qemu emulates it even in case the device does not support it.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20221221115015.1400889-5-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 net/vhost-vdpa.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 41de76376f..b0c6109230 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -74,7 +74,6 @@ const int vdpa_feature_bits[] = {
     VIRTIO_F_RING_RESET,
     VIRTIO_NET_F_RSS,
     VIRTIO_NET_F_HASH_REPORT,
-    VIRTIO_NET_F_GUEST_ANNOUNCE,
     VIRTIO_NET_F_STATUS,
     VHOST_INVALID_FEATURE_BIT
 };
-- 
MST



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

* [PULL 05/51] hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 04/51] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 06/51] hw/acpi/Kconfig: Add missing dependencies " Michael S. Tsirkin
                   ` (47 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, Philippe Mathieu-Daudé,
	Igor Mammedov, Ani Sinha

From: Bernhard Beschow <shentey@gmail.com>

Although the ICH9 ACPI controller may currently be tied to x86 it
doesn't have to. Furthermore, the source files this configuration switch
manages contain a '9', so this name fits more.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221216130355.41667-2-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/acpi/Kconfig     | 2 +-
 hw/acpi/meson.build | 2 +-
 hw/i2c/meson.build  | 2 +-
 hw/isa/Kconfig      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
index 3703aca212..14694c75b4 100644
--- a/hw/acpi/Kconfig
+++ b/hw/acpi/Kconfig
@@ -13,7 +13,7 @@ config ACPI_X86
     select ACPI_PCIHP
     select ACPI_ERST
 
-config ACPI_X86_ICH
+config ACPI_ICH9
     bool
     select ACPI_X86
 
diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build
index 2ed29ae94c..30054a8cdc 100644
--- a/hw/acpi/meson.build
+++ b/hw/acpi/meson.build
@@ -22,7 +22,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'ich9_tco.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c'))
 acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c'))
 acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c'))
 acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
diff --git a/hw/i2c/meson.build b/hw/i2c/meson.build
index d3df273251..6e7340aaac 100644
--- a/hw/i2c/meson.build
+++ b/hw/i2c/meson.build
@@ -2,7 +2,7 @@ i2c_ss = ss.source_set()
 i2c_ss.add(when: 'CONFIG_I2C', if_true: files('core.c'))
 i2c_ss.add(when: 'CONFIG_SMBUS', if_true: files('smbus_slave.c', 'smbus_master.c'))
 i2c_ss.add(when: 'CONFIG_ACPI_SMBUS', if_true: files('pm_smbus.c'))
-i2c_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('smbus_ich9.c'))
+i2c_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('smbus_ich9.c'))
 i2c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i2c.c'))
 i2c_ss.add(when: 'CONFIG_BITBANG_I2C', if_true: files('bitbang_i2c.c'))
 i2c_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_i2c.c'))
diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig
index 18b5c6bf3f..01f330d941 100644
--- a/hw/isa/Kconfig
+++ b/hw/isa/Kconfig
@@ -78,4 +78,4 @@ config LPC_ICH9
     select I8257
     select ISA_BUS
     select ACPI_SMBUS
-    select ACPI_X86_ICH
+    select ACPI_ICH9
-- 
MST



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

* [PULL 06/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_ICH9
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (4 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 05/51] hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9 Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 07/51] hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines Michael S. Tsirkin
                   ` (46 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, Philippe Mathieu-Daudé,
	Igor Mammedov, Ani Sinha

From: Bernhard Beschow <shentey@gmail.com>

ich9_lpc_realize() uses apm_init() and ich9_smbus_realize() uses
pm_smbus_init(), so both APM and ACPI_SMBUS are provided by the device
models managed by ACPI_ICH9.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221216130355.41667-3-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/acpi/Kconfig | 2 ++
 hw/isa/Kconfig  | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
index 14694c75b4..704cbc6236 100644
--- a/hw/acpi/Kconfig
+++ b/hw/acpi/Kconfig
@@ -15,7 +15,9 @@ config ACPI_X86
 
 config ACPI_ICH9
     bool
+    select ACPI_SMBUS
     select ACPI_X86
+    select APM
 
 config ACPI_CPU_HOTPLUG
     bool
diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig
index 01f330d941..0a6a04947c 100644
--- a/hw/isa/Kconfig
+++ b/hw/isa/Kconfig
@@ -77,5 +77,4 @@ config LPC_ICH9
     # for ICH9.
     select I8257
     select ISA_BUS
-    select ACPI_SMBUS
     select ACPI_ICH9
-- 
MST



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

* [PULL 07/51] hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (5 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 06/51] hw/acpi/Kconfig: Add missing dependencies " Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 08/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4 Michael S. Tsirkin
                   ` (45 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, BALATON Zoltan, Igor Mammedov,
	Ani Sinha, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Marcel Apfelbaum

From: Bernhard Beschow <shentey@gmail.com>

TYPE_PIIX4_PM is only used in machines where PIIX chipsets are used
which is currently PC and Malta. There is no point building it for the
other ACPI_X86 machines.

Note that this also removes unneeded ACPI_PIIX4 from PEGASOS2.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20221216130355.41667-4-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/acpi/Kconfig | 1 -
 hw/i386/Kconfig | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
index 704cbc6236..b7006e18c8 100644
--- a/hw/acpi/Kconfig
+++ b/hw/acpi/Kconfig
@@ -9,7 +9,6 @@ config ACPI_X86
     select ACPI_CPU_HOTPLUG
     select ACPI_MEMORY_HOTPLUG
     select ACPI_HMAT
-    select ACPI_PIIX4
     select ACPI_PCIHP
     select ACPI_ERST
 
diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index d22ac4a4b9..3a92566701 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -69,6 +69,7 @@ config I440FX
     imply E1000_PCI
     imply VMPORT
     imply VMMOUSE
+    select ACPI_PIIX4
     select PC_PCI
     select PC_ACPI
     select ACPI_SMBUS
-- 
MST



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

* [PULL 08/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (6 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 07/51] hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 09/51] hw/isa/Kconfig: Add missing dependency to VT82C686 Michael S. Tsirkin
                   ` (44 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, Philippe Mathieu-Daudé,
	Igor Mammedov, Ani Sinha

From: Bernhard Beschow <shentey@gmail.com>

piix4_pm_realize() uses apm_init() and pm_smbus_init(), so both APM and
ACPI_SMBUS are provided by the device model managed by ACPI_PIIX4.

The ACPIREGS are also provided by ACPI_PIIX4, so needs to select ACPI.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20221216130355.41667-5-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/acpi/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
index b7006e18c8..1f7803fdab 100644
--- a/hw/acpi/Kconfig
+++ b/hw/acpi/Kconfig
@@ -31,7 +31,9 @@ config ACPI_NVDIMM
 
 config ACPI_PIIX4
     bool
-    depends on ACPI
+    select ACPI
+    select ACPI_SMBUS
+    select APM
 
 config ACPI_PCIHP
     bool
-- 
MST



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

* [PULL 09/51] hw/isa/Kconfig: Add missing dependency to VT82C686
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (7 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 08/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4 Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 10/51] i386, mips: Resolve redundant ACPI and APM dependencies Michael S. Tsirkin
                   ` (43 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, BALATON Zoltan,
	Philippe Mathieu-Daudé,
	Daniel Henrique Barboza

From: Bernhard Beschow <shentey@gmail.com>

The ACPIREGS are provided by TYPE_VIA_PM, so needs to select ACPI.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20221216130355.41667-6-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/isa/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig
index 0a6a04947c..0156a66889 100644
--- a/hw/isa/Kconfig
+++ b/hw/isa/Kconfig
@@ -52,6 +52,7 @@ config PIIX4
 config VT82C686
     bool
     select ISA_SUPERIO
+    select ACPI
     select ACPI_SMBUS
     select SERIAL_ISA
     select FDC_ISA
-- 
MST



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

* [PULL 10/51] i386, mips: Resolve redundant ACPI and APM dependencies
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (8 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 09/51] hw/isa/Kconfig: Add missing dependency to VT82C686 Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 11/51] hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2 Michael S. Tsirkin
                   ` (42 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, Philippe Mathieu-Daudé,
	Marcel Apfelbaum, Paolo Bonzini, Richard Henderson,
	Eduardo Habkost, Jiaxun Yang

From: Bernhard Beschow <shentey@gmail.com>

Now that all ACPI controllers select the ACPI and APM dependencies
themselves, these explicit dependencies became redundant. Remove them.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20221216130355.41667-7-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 configs/devices/mips-softmmu/common.mak | 3 ---
 hw/i386/Kconfig                         | 2 --
 2 files changed, 5 deletions(-)

diff --git a/configs/devices/mips-softmmu/common.mak b/configs/devices/mips-softmmu/common.mak
index 416161f833..88aff94625 100644
--- a/configs/devices/mips-softmmu/common.mak
+++ b/configs/devices/mips-softmmu/common.mak
@@ -17,9 +17,7 @@ CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
-CONFIG_ACPI=y
 CONFIG_ACPI_PIIX4=y
-CONFIG_APM=y
 CONFIG_I8257=y
 CONFIG_PIIX4=y
 CONFIG_IDE_ISA=y
@@ -32,6 +30,5 @@ CONFIG_MIPS_ITU=y
 CONFIG_MALTA=y
 CONFIG_PCNET_PCI=y
 CONFIG_MIPSSIM=y
-CONFIG_ACPI_SMBUS=y
 CONFIG_SMBUS_EEPROM=y
 CONFIG_TEST_DEVICES=y
diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index 3a92566701..c4fb5b49bd 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -51,7 +51,6 @@ config PC_PCI
     bool
     select APIC
     select IOAPIC
-    select APM
     select PC
 
 config PC_ACPI
@@ -72,7 +71,6 @@ config I440FX
     select ACPI_PIIX4
     select PC_PCI
     select PC_ACPI
-    select ACPI_SMBUS
     select PCI_I440FX
     select PIIX3
     select IDE_PIIX
-- 
MST



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

* [PULL 11/51] hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (9 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 10/51] i386, mips: Resolve redundant ACPI and APM dependencies Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 12/51] vhost-user: Refactor vhost acked features saving Michael S. Tsirkin
                   ` (41 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Bernhard Beschow, BALATON Zoltan,
	Philippe Mathieu-Daudé,
	Daniel Henrique Barboza, Bin Meng

From: Bernhard Beschow <shentey@gmail.com>

Removes the following dependencies from ppc-softmmu:
- CONFIG_ACPI_CPU_HOTPLUG
- CONFIG_ACPI_CXL
- CONFIG_ACPI_HMAT
- CONFIG_ACPI_MEMORY_HOTPLUG
- CONFIG_ACPI_NVDIMM
- CONFIG_ACPI_PCIHP
- CONFIG_ACPI_X86
- CONFIG_MEM_DEVICE

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20221216130355.41667-8-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/Kconfig | 2 --
 1 file changed, 2 deletions(-)

diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index 72a311edcb..c898021b5f 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -76,8 +76,6 @@ config PEGASOS2
     select VT82C686
     select SMBUS_EEPROM
     select VOF
-# This should come with VT82C686
-    select ACPI_X86
 
 config PREP
     bool
-- 
MST



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

* [PULL 12/51] vhost-user: Refactor vhost acked features saving
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (10 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 11/51] hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2 Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 13/51] vhost-user: Refactor the chr_closed_bh Michael S. Tsirkin
                   ` (40 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Hyman Huang(黄勇), Guoyi Tu, Jason Wang

From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>

Abstract vhost acked features saving into
vhost_user_save_acked_features, export it as util function.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Message-Id: <50dc9b09b0635e3052551efcc1046c2a85332fcb.1671627406.git.huangy81@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/net/vhost-user.h |  1 +
 net/vhost-user.c         | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/net/vhost-user.h b/include/net/vhost-user.h
index 5bcd8a6285..35bf619709 100644
--- a/include/net/vhost-user.h
+++ b/include/net/vhost-user.h
@@ -14,5 +14,6 @@
 struct vhost_net;
 struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
 uint64_t vhost_user_get_acked_features(NetClientState *nc);
+void vhost_user_save_acked_features(NetClientState *nc);
 
 #endif /* VHOST_USER_H */
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 3a6b90da86..f5cb095d5c 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -45,10 +45,23 @@ uint64_t vhost_user_get_acked_features(NetClientState *nc)
     return s->acked_features;
 }
 
-static void vhost_user_stop(int queues, NetClientState *ncs[])
+void vhost_user_save_acked_features(NetClientState *nc)
 {
     NetVhostUserState *s;
+
+    s = DO_UPCAST(NetVhostUserState, nc, nc);
+    if (s->vhost_net) {
+        uint64_t features = vhost_net_get_acked_features(s->vhost_net);
+        if (features) {
+            s->acked_features = features;
+        }
+    }
+}
+
+static void vhost_user_stop(int queues, NetClientState *ncs[])
+{
     int i;
+    NetVhostUserState *s;
 
     for (i = 0; i < queues; i++) {
         assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
@@ -56,11 +69,7 @@ static void vhost_user_stop(int queues, NetClientState *ncs[])
         s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
 
         if (s->vhost_net) {
-            /* save acked features */
-            uint64_t features = vhost_net_get_acked_features(s->vhost_net);
-            if (features) {
-                s->acked_features = features;
-            }
+            vhost_user_save_acked_features(ncs[i]);
             vhost_net_cleanup(s->vhost_net);
         }
     }
-- 
MST



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

* [PULL 13/51] vhost-user: Refactor the chr_closed_bh
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (11 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 12/51] vhost-user: Refactor vhost acked features saving Michael S. Tsirkin
@ 2023-01-05  9:14 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 14/51] vhost-user: Fix the virtio features negotiation flaw Michael S. Tsirkin
                   ` (39 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:14 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Hyman Huang(黄勇), Guoyi Tu, Jason Wang

From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>

Use vhost_user_save_acked_features to implemente acked features
saving.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Message-Id: <6699ee88687b62fb8152fe021e576cd2f468d7ca.1671627406.git.huangy81@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 net/vhost-user.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/vhost-user.c b/net/vhost-user.c
index f5cb095d5c..5993e4afca 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -260,11 +260,7 @@ static void chr_closed_bh(void *opaque)
     s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
 
     for (i = queues -1; i >= 0; i--) {
-        s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
-
-        if (s->vhost_net) {
-            s->acked_features = vhost_net_get_acked_features(s->vhost_net);
-        }
+        vhost_user_save_acked_features(ncs[i]);
     }
 
     qmp_set_link(name, false, &err);
-- 
MST



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

* [PULL 14/51] vhost-user: Fix the virtio features negotiation flaw
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (12 preceding siblings ...)
  2023-01-05  9:14 ` [PULL 13/51] vhost-user: Refactor the chr_closed_bh Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15   ` [Virtio-fs] " Michael S. Tsirkin
                   ` (38 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Hyman Huang(黄勇),
	Guoyi Tu, Liuxiangdong, Jason Wang

From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>

This patch aims to fix unexpected negotiation features for
vhost-user netdev interface.

When openvswitch reconnect Qemu after an unexpected disconnection
and Qemu therefore start the vhost_dev, acked_features field in
vhost_dev is initialized with value fetched from acked_features
field in NetVhostUserState, which should be up-to-date at that
moment but Qemu could not make it actually during the time window
of virtio features negotiation.

So we save the acked_features right after being configured by
guest virtio driver so it can be used to restore acked_features
field in vhost_dev correctly.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Signed-off-by: Liuxiangdong <liuxiangdong5@huawei.com>
Message-Id: <b9f8cf5561a79ea65ea38960e5a5e6d3707eef0a.1671627406.git.huangy81@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/net/vhost_net.h | 2 ++
 hw/net/vhost_net-stub.c | 5 +++++
 hw/net/vhost_net.c      | 9 +++++++++
 hw/net/virtio-net.c     | 6 ++++++
 4 files changed, 22 insertions(+)

diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index 40b9a40074..dfb13756cd 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -52,4 +52,6 @@ void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc,
                                int vq_index);
 int vhost_net_virtqueue_restart(VirtIODevice *vdev, NetClientState *nc,
                                 int vq_index);
+
+void vhost_net_save_acked_features(NetClientState *nc);
 #endif
diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c
index 9f7daae99c..66ed5f0b98 100644
--- a/hw/net/vhost_net-stub.c
+++ b/hw/net/vhost_net-stub.c
@@ -113,3 +113,8 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev, NetClientState *nc,
 {
     return 0;
 }
+
+void vhost_net_save_acked_features(NetClientState *nc)
+{
+
+}
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 043058ff43..984b130e8f 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -144,6 +144,15 @@ uint64_t vhost_net_get_acked_features(VHostNetState *net)
     return net->dev.acked_features;
 }
 
+void vhost_net_save_acked_features(NetClientState *nc)
+{
+#ifdef CONFIG_VHOST_NET_USER
+    if (nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
+        vhost_user_save_acked_features(nc);
+    }
+#endif
+}
+
 static int vhost_net_get_fd(NetClientState *backend)
 {
     switch (backend->info->type) {
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 122eac25ee..b342d66160 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -984,6 +984,12 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)
             continue;
         }
         vhost_net_ack_features(get_vhost_net(nc->peer), features);
+
+        /*
+         * keep acked_features in NetVhostUserState up-to-date so it
+         * can't miss any features configured by guest virtio driver.
+         */
+        vhost_net_save_acked_features(nc->peer);
     }
 
     if (virtio_has_feature(features, VIRTIO_NET_F_CTRL_VLAN)) {
-- 
MST



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

* [PULL 15/51] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
@ 2023-01-05  9:15   ` Michael S. Tsirkin
  2023-01-05  9:14 ` [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Michael S. Tsirkin
                     ` (51 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Cindy Lu, Jason Wang, Marc-André Lureau,
	Gerd Hoffmann, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Alex Bennée, Viresh Kumar, Gonglei (Arei),
	virtio-fs

From: Cindy Lu <lulu@redhat.com>

To support configure interrupt for vhost-vdpa
Introduce VIRTIO_CONFIG_IRQ_IDX -1 as configure interrupt's queue index,
Then we can reuse the functions guest_notifier_mask and guest_notifier_pending.
Add the check of queue index in these drivers, if the driver does not support
configure interrupt, the function will just return

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-2-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h     |  3 +++
 hw/display/vhost-user-gpu.c    | 18 ++++++++++++++++++
 hw/net/virtio-net.c            | 22 ++++++++++++++++++++--
 hw/virtio/vhost-user-fs.c      | 18 ++++++++++++++++++
 hw/virtio/vhost-user-gpio.c    | 10 ++++++++++
 hw/virtio/vhost-vsock-common.c | 18 ++++++++++++++++++
 hw/virtio/virtio-crypto.c      | 18 ++++++++++++++++++
 7 files changed, 105 insertions(+), 2 deletions(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 24561e933a..8266d240cc 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -79,6 +79,9 @@ typedef struct VirtQueueElement
 
 #define VIRTIO_NO_VECTOR 0xffff
 
+/* special index value used internally for config irqs */
+#define VIRTIO_CONFIG_IRQ_IDX -1
+
 #define TYPE_VIRTIO_DEVICE "virtio-device"
 OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
 
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index 19c0e20103..4380a5e672 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -486,6 +486,15 @@ vhost_user_gpu_guest_notifier_pending(VirtIODevice *vdev, int idx)
 {
     VhostUserGPU *g = VHOST_USER_GPU(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&g->vhost->dev, idx);
 }
 
@@ -494,6 +503,15 @@ vhost_user_gpu_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
 {
     VhostUserGPU *g = VHOST_USER_GPU(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask);
 }
 
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index b342d66160..0bfe454c23 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3325,6 +3325,15 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
     } else {
         nc = qemu_get_subqueue(n->nic, vq2q(idx));
     }
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return false
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
 }
 
@@ -3348,8 +3357,17 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
     } else {
         nc = qemu_get_subqueue(n->nic, vq2q(idx));
     }
-    vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
-                             vdev, idx, mask);
+    /*
+     *Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
+
+    vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
 }
 
 static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index d97b179e6f..f5049735ac 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -159,6 +159,15 @@ static void vuf_guest_notifier_mask(VirtIODevice *vdev, int idx,
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&fs->vhost_dev, vdev, idx, mask);
 }
 
@@ -166,6 +175,15 @@ static bool vuf_guest_notifier_pending(VirtIODevice *vdev, int idx)
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&fs->vhost_dev, idx);
 }
 
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index b7b82a1099..fe3da32c74 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -191,6 +191,16 @@ static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
 {
     VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
+
     vhost_virtqueue_mask(&gpio->vhost_dev, vdev, idx, mask);
 }
 
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index d21c72b401..d2b5519d5a 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -127,6 +127,15 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
 }
 
@@ -135,6 +144,15 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
 }
 
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 97da74e719..516425e26a 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1182,6 +1182,15 @@ static void virtio_crypto_guest_notifier_mask(VirtIODevice *vdev, int idx,
 
     assert(vcrypto->vhost_started);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     cryptodev_vhost_virtqueue_mask(vdev, queue, idx, mask);
 }
 
@@ -1192,6 +1201,15 @@ static bool virtio_crypto_guest_notifier_pending(VirtIODevice *vdev, int idx)
 
     assert(vcrypto->vhost_started);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return cryptodev_vhost_virtqueue_pending(vdev, queue, idx);
 }
 
-- 
MST



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

* [Virtio-fs] [PULL 15/51] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
@ 2023-01-05  9:15   ` Michael S. Tsirkin
  0 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Cindy Lu, Jason Wang, Marc-André Lureau,
	Gerd Hoffmann, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Alex Bennée, Viresh Kumar, Gonglei (Arei),
	virtio-fs

From: Cindy Lu <lulu@redhat.com>

To support configure interrupt for vhost-vdpa
Introduce VIRTIO_CONFIG_IRQ_IDX -1 as configure interrupt's queue index,
Then we can reuse the functions guest_notifier_mask and guest_notifier_pending.
Add the check of queue index in these drivers, if the driver does not support
configure interrupt, the function will just return

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-2-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h     |  3 +++
 hw/display/vhost-user-gpu.c    | 18 ++++++++++++++++++
 hw/net/virtio-net.c            | 22 ++++++++++++++++++++--
 hw/virtio/vhost-user-fs.c      | 18 ++++++++++++++++++
 hw/virtio/vhost-user-gpio.c    | 10 ++++++++++
 hw/virtio/vhost-vsock-common.c | 18 ++++++++++++++++++
 hw/virtio/virtio-crypto.c      | 18 ++++++++++++++++++
 7 files changed, 105 insertions(+), 2 deletions(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 24561e933a..8266d240cc 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -79,6 +79,9 @@ typedef struct VirtQueueElement
 
 #define VIRTIO_NO_VECTOR 0xffff
 
+/* special index value used internally for config irqs */
+#define VIRTIO_CONFIG_IRQ_IDX -1
+
 #define TYPE_VIRTIO_DEVICE "virtio-device"
 OBJECT_DECLARE_TYPE(VirtIODevice, VirtioDeviceClass, VIRTIO_DEVICE)
 
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index 19c0e20103..4380a5e672 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -486,6 +486,15 @@ vhost_user_gpu_guest_notifier_pending(VirtIODevice *vdev, int idx)
 {
     VhostUserGPU *g = VHOST_USER_GPU(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&g->vhost->dev, idx);
 }
 
@@ -494,6 +503,15 @@ vhost_user_gpu_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
 {
     VhostUserGPU *g = VHOST_USER_GPU(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&g->vhost->dev, vdev, idx, mask);
 }
 
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index b342d66160..0bfe454c23 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3325,6 +3325,15 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
     } else {
         nc = qemu_get_subqueue(n->nic, vq2q(idx));
     }
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return false
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
 }
 
@@ -3348,8 +3357,17 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
     } else {
         nc = qemu_get_subqueue(n->nic, vq2q(idx));
     }
-    vhost_net_virtqueue_mask(get_vhost_net(nc->peer),
-                             vdev, idx, mask);
+    /*
+     *Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
+
+    vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
 }
 
 static void virtio_net_set_config_size(VirtIONet *n, uint64_t host_features)
diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index d97b179e6f..f5049735ac 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -159,6 +159,15 @@ static void vuf_guest_notifier_mask(VirtIODevice *vdev, int idx,
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&fs->vhost_dev, vdev, idx, mask);
 }
 
@@ -166,6 +175,15 @@ static bool vuf_guest_notifier_pending(VirtIODevice *vdev, int idx)
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&fs->vhost_dev, idx);
 }
 
diff --git a/hw/virtio/vhost-user-gpio.c b/hw/virtio/vhost-user-gpio.c
index b7b82a1099..fe3da32c74 100644
--- a/hw/virtio/vhost-user-gpio.c
+++ b/hw/virtio/vhost-user-gpio.c
@@ -191,6 +191,16 @@ static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)
 {
     VHostUserGPIO *gpio = VHOST_USER_GPIO(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
+
     vhost_virtqueue_mask(&gpio->vhost_dev, vdev, idx, mask);
 }
 
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index d21c72b401..d2b5519d5a 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -127,6 +127,15 @@ static void vhost_vsock_common_guest_notifier_mask(VirtIODevice *vdev, int idx,
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     vhost_virtqueue_mask(&vvc->vhost_dev, vdev, idx, mask);
 }
 
@@ -135,6 +144,15 @@ static bool vhost_vsock_common_guest_notifier_pending(VirtIODevice *vdev,
 {
     VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return vhost_virtqueue_pending(&vvc->vhost_dev, idx);
 }
 
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 97da74e719..516425e26a 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1182,6 +1182,15 @@ static void virtio_crypto_guest_notifier_mask(VirtIODevice *vdev, int idx,
 
     assert(vcrypto->vhost_started);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return;
+    }
     cryptodev_vhost_virtqueue_mask(vdev, queue, idx, mask);
 }
 
@@ -1192,6 +1201,15 @@ static bool virtio_crypto_guest_notifier_pending(VirtIODevice *vdev, int idx)
 
     assert(vcrypto->vhost_started);
 
+    /*
+     * Add the check for configure interrupt, Use VIRTIO_CONFIG_IRQ_IDX -1
+     * as the Marco of configure interrupt's IDX, If this driver does not
+     * support, the function will return
+     */
+
+    if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        return false;
+    }
     return cryptodev_vhost_virtqueue_pending(vdev, queue, idx);
 }
 
-- 
MST


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

* [PULL 16/51] virtio-pci: decouple notifier from interrupt process
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (14 preceding siblings ...)
  2023-01-05  9:15   ` [Virtio-fs] " Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 17/51] virtio-pci: decouple the single vector from the " Michael S. Tsirkin
                   ` (36 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

To reuse the notifier process. We add the virtio_pci_get_notifier
to get the notifier and vector. The INPUT for this function is IDX,
The OUTPUT is the notifier and the vector

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-3-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio-pci.c | 88 +++++++++++++++++++++++++++---------------
 1 file changed, 57 insertions(+), 31 deletions(-)

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 70639300aa..68d04928db 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -813,29 +813,41 @@ static void kvm_virtio_pci_vq_vector_release(VirtIOPCIProxy *proxy,
 }
 
 static int kvm_virtio_pci_irqfd_use(VirtIOPCIProxy *proxy,
-                                 unsigned int queue_no,
+                                 EventNotifier *n,
                                  unsigned int vector)
 {
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
-    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
-    VirtQueue *vq = virtio_get_queue(vdev, queue_no);
-    EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     return kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, n, NULL, irqfd->virq);
 }
 
 static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy,
-                                      unsigned int queue_no,
+                                      EventNotifier *n ,
                                       unsigned int vector)
 {
-    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
-    VirtQueue *vq = virtio_get_queue(vdev, queue_no);
-    EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
     int ret;
 
     ret = kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, n, irqfd->virq);
     assert(ret == 0);
 }
+static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
+                                      EventNotifier **n, unsigned int *vector)
+{
+    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+    VirtQueue *vq;
+
+    if (queue_no == VIRTIO_CONFIG_IRQ_IDX) {
+        return -1;
+    } else {
+        if (!virtio_queue_get_num(vdev, queue_no)) {
+            return -1;
+        }
+        *vector = virtio_queue_vector(vdev, queue_no);
+        vq = virtio_get_queue(vdev, queue_no);
+        *n = virtio_queue_get_guest_notifier(vq);
+    }
+    return 0;
+}
 
 static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
 {
@@ -844,12 +856,15 @@ static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
     unsigned int vector;
     int ret, queue_no;
-
+    EventNotifier *n;
     for (queue_no = 0; queue_no < nvqs; queue_no++) {
         if (!virtio_queue_get_num(vdev, queue_no)) {
             break;
         }
-        vector = virtio_queue_vector(vdev, queue_no);
+        ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+        if (ret < 0) {
+            break;
+        }
         if (vector >= msix_nr_vectors_allocated(dev)) {
             continue;
         }
@@ -861,7 +876,7 @@ static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
          * Otherwise, delay until unmasked in the frontend.
          */
         if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
-            ret = kvm_virtio_pci_irqfd_use(proxy, queue_no, vector);
+            ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
             if (ret < 0) {
                 kvm_virtio_pci_vq_vector_release(proxy, vector);
                 goto undo;
@@ -877,7 +892,11 @@ undo:
             continue;
         }
         if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
-            kvm_virtio_pci_irqfd_release(proxy, queue_no, vector);
+            ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+            if (ret < 0) {
+                break;
+            }
+            kvm_virtio_pci_irqfd_release(proxy, n, vector);
         }
         kvm_virtio_pci_vq_vector_release(proxy, vector);
     }
@@ -891,12 +910,16 @@ static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
     unsigned int vector;
     int queue_no;
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
-
+    EventNotifier *n;
+    int ret ;
     for (queue_no = 0; queue_no < nvqs; queue_no++) {
         if (!virtio_queue_get_num(vdev, queue_no)) {
             break;
         }
-        vector = virtio_queue_vector(vdev, queue_no);
+        ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+        if (ret < 0) {
+            break;
+        }
         if (vector >= msix_nr_vectors_allocated(dev)) {
             continue;
         }
@@ -904,21 +927,20 @@ static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
          * Otherwise, it was cleaned when masked in the frontend.
          */
         if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
-            kvm_virtio_pci_irqfd_release(proxy, queue_no, vector);
+            kvm_virtio_pci_irqfd_release(proxy, n, vector);
         }
         kvm_virtio_pci_vq_vector_release(proxy, vector);
     }
 }
 
-static int virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
+static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
                                        unsigned int queue_no,
                                        unsigned int vector,
-                                       MSIMessage msg)
+                                       MSIMessage msg,
+                                       EventNotifier *n)
 {
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
-    VirtQueue *vq = virtio_get_queue(vdev, queue_no);
-    EventNotifier *n = virtio_queue_get_guest_notifier(vq);
     VirtIOIRQFD *irqfd;
     int ret = 0;
 
@@ -945,14 +967,15 @@ static int virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy,
             event_notifier_set(n);
         }
     } else {
-        ret = kvm_virtio_pci_irqfd_use(proxy, queue_no, vector);
+        ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
     }
     return ret;
 }
 
-static void virtio_pci_vq_vector_mask(VirtIOPCIProxy *proxy,
+static void virtio_pci_one_vector_mask(VirtIOPCIProxy *proxy,
                                              unsigned int queue_no,
-                                             unsigned int vector)
+                                             unsigned int vector,
+                                             EventNotifier *n)
 {
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
@@ -963,7 +986,7 @@ static void virtio_pci_vq_vector_mask(VirtIOPCIProxy *proxy,
     if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
         k->guest_notifier_mask(vdev, queue_no, true);
     } else {
-        kvm_virtio_pci_irqfd_release(proxy, queue_no, vector);
+        kvm_virtio_pci_irqfd_release(proxy, n, vector);
     }
 }
 
@@ -973,6 +996,7 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
     VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev);
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     VirtQueue *vq = virtio_vector_first_queue(vdev, vector);
+    EventNotifier *n;
     int ret, index, unmasked = 0;
 
     while (vq) {
@@ -981,7 +1005,8 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
             break;
         }
         if (index < proxy->nvqs_with_notifiers) {
-            ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg);
+            n = virtio_queue_get_guest_notifier(vq);
+            ret = virtio_pci_one_vector_unmask(proxy, index, vector, msg, n);
             if (ret < 0) {
                 goto undo;
             }
@@ -997,7 +1022,8 @@ undo:
     while (vq && unmasked >= 0) {
         index = virtio_get_queue_index(vq);
         if (index < proxy->nvqs_with_notifiers) {
-            virtio_pci_vq_vector_mask(proxy, index, vector);
+            n = virtio_queue_get_guest_notifier(vq);
+            virtio_pci_one_vector_mask(proxy, index, vector, n);
             --unmasked;
         }
         vq = virtio_vector_next_queue(vq);
@@ -1010,15 +1036,17 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector)
     VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev);
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     VirtQueue *vq = virtio_vector_first_queue(vdev, vector);
+    EventNotifier *n;
     int index;
 
     while (vq) {
         index = virtio_get_queue_index(vq);
+        n = virtio_queue_get_guest_notifier(vq);
         if (!virtio_queue_get_num(vdev, index)) {
             break;
         }
         if (index < proxy->nvqs_with_notifiers) {
-            virtio_pci_vq_vector_mask(proxy, index, vector);
+            virtio_pci_one_vector_mask(proxy, index, vector, n);
         }
         vq = virtio_vector_next_queue(vq);
     }
@@ -1034,19 +1062,17 @@ static void virtio_pci_vector_poll(PCIDevice *dev,
     int queue_no;
     unsigned int vector;
     EventNotifier *notifier;
-    VirtQueue *vq;
+    int ret;
 
     for (queue_no = 0; queue_no < proxy->nvqs_with_notifiers; queue_no++) {
-        if (!virtio_queue_get_num(vdev, queue_no)) {
+        ret = virtio_pci_get_notifier(proxy, queue_no, &notifier, &vector);
+        if (ret < 0) {
             break;
         }
-        vector = virtio_queue_vector(vdev, queue_no);
         if (vector < vector_start || vector >= vector_end ||
             !msix_is_masked(dev, vector)) {
             continue;
         }
-        vq = virtio_get_queue(vdev, queue_no);
-        notifier = virtio_queue_get_guest_notifier(vq);
         if (k->guest_notifier_pending) {
             if (k->guest_notifier_pending(vdev, queue_no)) {
                 msix_set_pending(dev, vector);
-- 
MST



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

* [PULL 17/51] virtio-pci: decouple the single vector from the interrupt process
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (15 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 16/51] virtio-pci: decouple notifier from interrupt process Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 18/51] vhost: introduce new VhostOps vhost_set_config_call Michael S. Tsirkin
                   ` (35 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

To reuse the interrupt process in configure interrupt
Need to decouple the single vector from the interrupt process.
We add new function kvm_virtio_pci_vector_use_one and _release_one.
These functions are used for the single vector, the whole process will
finish in the loop with vq number.

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-4-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio-pci.c | 131 +++++++++++++++++++++++------------------
 1 file changed, 73 insertions(+), 58 deletions(-)

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 68d04928db..d7e29b1cdc 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -784,7 +784,6 @@ static uint32_t virtio_read_config(PCIDevice *pci_dev,
 }
 
 static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
-                                        unsigned int queue_no,
                                         unsigned int vector)
 {
     VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector];
@@ -849,87 +848,103 @@ static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
     return 0;
 }
 
-static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
+static int kvm_virtio_pci_vector_use_one(VirtIOPCIProxy *proxy, int queue_no)
 {
+    unsigned int vector;
+    int ret;
+    EventNotifier *n;
     PCIDevice *dev = &proxy->pci_dev;
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
-    unsigned int vector;
-    int ret, queue_no;
-    EventNotifier *n;
-    for (queue_no = 0; queue_no < nvqs; queue_no++) {
-        if (!virtio_queue_get_num(vdev, queue_no)) {
-            break;
-        }
-        ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
-        if (ret < 0) {
-            break;
-        }
-        if (vector >= msix_nr_vectors_allocated(dev)) {
-            continue;
-        }
-        ret = kvm_virtio_pci_vq_vector_use(proxy, queue_no, vector);
+
+    ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+    if (ret < 0) {
+        return ret;
+    }
+    if (vector >= msix_nr_vectors_allocated(dev)) {
+        return 0;
+    }
+    ret = kvm_virtio_pci_vq_vector_use(proxy, vector);
+    if (ret < 0) {
+        goto undo;
+    }
+    /*
+     * If guest supports masking, set up irqfd now.
+     * Otherwise, delay until unmasked in the frontend.
+     */
+    if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
+        ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
         if (ret < 0) {
+            kvm_virtio_pci_vq_vector_release(proxy, vector);
             goto undo;
         }
-        /* If guest supports masking, set up irqfd now.
-         * Otherwise, delay until unmasked in the frontend.
-         */
-        if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
-            ret = kvm_virtio_pci_irqfd_use(proxy, n, vector);
-            if (ret < 0) {
-                kvm_virtio_pci_vq_vector_release(proxy, vector);
-                goto undo;
-            }
-        }
     }
-    return 0;
 
+    return 0;
 undo:
-    while (--queue_no >= 0) {
-        vector = virtio_queue_vector(vdev, queue_no);
-        if (vector >= msix_nr_vectors_allocated(dev)) {
-            continue;
+
+    vector = virtio_queue_vector(vdev, queue_no);
+    if (vector >= msix_nr_vectors_allocated(dev)) {
+        return ret;
+    }
+    if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
+        ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+        if (ret < 0) {
+            return ret;
         }
-        if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
-            ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
-            if (ret < 0) {
-                break;
-            }
-            kvm_virtio_pci_irqfd_release(proxy, n, vector);
+        kvm_virtio_pci_irqfd_release(proxy, n, vector);
+    }
+    return ret;
+}
+static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
+{
+    int queue_no;
+    int ret = 0;
+    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+
+    for (queue_no = 0; queue_no < nvqs; queue_no++) {
+        if (!virtio_queue_get_num(vdev, queue_no)) {
+            return -1;
         }
-        kvm_virtio_pci_vq_vector_release(proxy, vector);
+        ret = kvm_virtio_pci_vector_use_one(proxy, queue_no);
     }
     return ret;
 }
 
-static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
+
+static void kvm_virtio_pci_vector_release_one(VirtIOPCIProxy *proxy,
+                                              int queue_no)
 {
-    PCIDevice *dev = &proxy->pci_dev;
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     unsigned int vector;
-    int queue_no;
-    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
     EventNotifier *n;
-    int ret ;
+    int ret;
+    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
+    PCIDevice *dev = &proxy->pci_dev;
+
+    ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
+    if (ret < 0) {
+        return;
+    }
+    if (vector >= msix_nr_vectors_allocated(dev)) {
+        return;
+    }
+    if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
+        kvm_virtio_pci_irqfd_release(proxy, n, vector);
+    }
+    kvm_virtio_pci_vq_vector_release(proxy, vector);
+}
+
+static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
+{
+    int queue_no;
+    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+
     for (queue_no = 0; queue_no < nvqs; queue_no++) {
         if (!virtio_queue_get_num(vdev, queue_no)) {
             break;
         }
-        ret = virtio_pci_get_notifier(proxy, queue_no, &n, &vector);
-        if (ret < 0) {
-            break;
-        }
-        if (vector >= msix_nr_vectors_allocated(dev)) {
-            continue;
-        }
-        /* If guest supports masking, clean up irqfd now.
-         * Otherwise, it was cleaned when masked in the frontend.
-         */
-        if (vdev->use_guest_notifier_mask && k->guest_notifier_mask) {
-            kvm_virtio_pci_irqfd_release(proxy, n, vector);
-        }
-        kvm_virtio_pci_vq_vector_release(proxy, vector);
+        kvm_virtio_pci_vector_release_one(proxy, queue_no);
     }
 }
 
-- 
MST



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

* [PULL 18/51] vhost: introduce new VhostOps vhost_set_config_call
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (16 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 17/51] virtio-pci: decouple the single vector from the " Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 19/51] vhost-vdpa: add support for config interrupt Michael S. Tsirkin
                   ` (34 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

This patch introduces new VhostOps vhost_set_config_call.
This function allows the qemu to set the config
event fd to kernel driver.

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-5-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/vhost-backend.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index eab46d7f0b..c5ab49051e 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -128,6 +128,8 @@ typedef int (*vhost_get_device_id_op)(struct vhost_dev *dev, uint32_t *dev_id);
 
 typedef bool (*vhost_force_iommu_op)(struct vhost_dev *dev);
 
+typedef int (*vhost_set_config_call_op)(struct vhost_dev *dev,
+                                       int fd);
 typedef struct VhostOps {
     VhostBackendType backend_type;
     vhost_backend_init vhost_backend_init;
@@ -174,6 +176,7 @@ typedef struct VhostOps {
     vhost_vq_get_addr_op  vhost_vq_get_addr;
     vhost_get_device_id_op vhost_get_device_id;
     vhost_force_iommu_op vhost_force_iommu;
+    vhost_set_config_call_op vhost_set_config_call;
 } VhostOps;
 
 int vhost_backend_update_device_iotlb(struct vhost_dev *dev,
-- 
MST



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

* [PULL 19/51] vhost-vdpa: add support for config interrupt
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (17 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 18/51] vhost: introduce new VhostOps vhost_set_config_call Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 20/51] virtio: add support for configure interrupt Michael S. Tsirkin
                   ` (33 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add new call back function in vhost-vdpa, The function
vhost_set_config_call can set the event fd to kernel.
This function will be called in the vhost_dev_start
and vhost_dev_stop

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-6-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 8 ++++++++
 hw/virtio/trace-events | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index fd0c33b0e1..fcb1e96316 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -716,6 +716,13 @@ static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev)
     return 0;
 }
 
+static int vhost_vdpa_set_config_call(struct vhost_dev *dev,
+                                       int fd)
+{
+    trace_vhost_vdpa_set_config_call(dev, fd);
+    return vhost_vdpa_call(dev, VHOST_VDPA_SET_CONFIG_CALL, &fd);
+}
+
 static void vhost_vdpa_dump_config(struct vhost_dev *dev, const uint8_t *config,
                                    uint32_t config_len)
 {
@@ -1298,4 +1305,5 @@ const VhostOps vdpa_ops = {
         .vhost_get_device_id = vhost_vdpa_get_device_id,
         .vhost_vq_get_addr = vhost_vdpa_vq_get_addr,
         .vhost_force_iommu = vhost_vdpa_force_iommu,
+        .vhost_set_config_call = vhost_vdpa_set_config_call,
 };
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 96da58a41f..a87c5f39a2 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -62,6 +62,7 @@ vhost_vdpa_get_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRI
 vhost_vdpa_set_owner(void *dev) "dev: %p"
 vhost_vdpa_vq_get_addr(void *dev, void *vq, uint64_t desc_user_addr, uint64_t avail_user_addr, uint64_t used_user_addr) "dev: %p vq: %p desc_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64
 vhost_vdpa_get_iova_range(void *dev, uint64_t first, uint64_t last) "dev: %p first: 0x%"PRIx64" last: 0x%"PRIx64
+vhost_vdpa_set_config_call(void *dev, int fd)"dev: %p fd: %d"
 
 # virtio.c
 virtqueue_alloc_element(void *elem, size_t sz, unsigned in_num, unsigned out_num) "elem %p size %zd in_num %u out_num %u"
-- 
MST



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

* [PULL 20/51] virtio: add support for configure interrupt
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (18 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 19/51] vhost-vdpa: add support for config interrupt Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:21   ` Michael S. Tsirkin
                   ` (32 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add the functions to support the configure interrupt in virtio
The function virtio_config_guest_notifier_read will notify the
guest if there is an configure interrupt.
The function virtio_config_set_guest_notifier_fd_handler is
to set the fd hander for the notifier

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-7-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio.h |  4 ++++
 hw/virtio/virtio.c         | 29 +++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 8266d240cc..4219968fd8 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -155,6 +155,7 @@ struct VirtIODevice
     AddressSpace *dma_as;
     QLIST_HEAD(, VirtQueue) *vector_queues;
     QTAILQ_ENTRY(VirtIODevice) next;
+    EventNotifier config_notifier;
 };
 
 struct VirtioDeviceClass {
@@ -377,6 +378,9 @@ void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioContext *ct
 void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx);
 VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector);
 VirtQueue *virtio_vector_next_queue(VirtQueue *vq);
+EventNotifier *virtio_config_get_guest_notifier(VirtIODevice *vdev);
+void virtio_config_set_guest_notifier_fd_handler(VirtIODevice *vdev,
+                                                 bool assign, bool with_irqfd);
 
 static inline void virtio_add_feature(uint64_t *features, unsigned int fbit)
 {
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 289eb71045..6ff797e1cf 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3417,7 +3417,14 @@ static void virtio_queue_guest_notifier_read(EventNotifier *n)
         virtio_irq(vq);
     }
 }
+static void virtio_config_guest_notifier_read(EventNotifier *n)
+{
+    VirtIODevice *vdev = container_of(n, VirtIODevice, config_notifier);
 
+    if (event_notifier_test_and_clear(n)) {
+        virtio_notify_config(vdev);
+    }
+}
 void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
                                                 bool with_irqfd)
 {
@@ -3434,6 +3441,23 @@ void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
     }
 }
 
+void virtio_config_set_guest_notifier_fd_handler(VirtIODevice *vdev,
+                                                 bool assign, bool with_irqfd)
+{
+    EventNotifier *n;
+    n = &vdev->config_notifier;
+    if (assign && !with_irqfd) {
+        event_notifier_set_handler(n, virtio_config_guest_notifier_read);
+    } else {
+        event_notifier_set_handler(n, NULL);
+    }
+    if (!assign) {
+        /* Test and clear notifier before closing it,*/
+        /* in case poll callback didn't have time to run. */
+        virtio_config_guest_notifier_read(n);
+    }
+}
+
 EventNotifier *virtio_queue_get_guest_notifier(VirtQueue *vq)
 {
     return &vq->guest_notifier;
@@ -3514,6 +3538,11 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq)
     return &vq->host_notifier;
 }
 
+EventNotifier *virtio_config_get_guest_notifier(VirtIODevice *vdev)
+{
+    return &vdev->config_notifier;
+}
+
 void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled)
 {
     vq->host_notifier_enabled = enabled;
-- 
MST



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

* [PULL 21/51] vhost: add support for configure interrupt
@ 2023-01-05  9:21   ` Michael S. Tsirkin
  0 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add functions to support configure interrupt.
The configure interrupt process will start in vhost_dev_start
and stop in vhost_dev_stop.

Also add the functions to support vhost_config_pending and
vhost_config_mask.

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-8-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/vhost.h |  4 ++
 hw/virtio/vhost.c         | 78 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 1cafa0d776..a52f273347 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -33,6 +33,7 @@ struct vhost_virtqueue {
     unsigned used_size;
     EventNotifier masked_notifier;
     EventNotifier error_notifier;
+    EventNotifier masked_config_notifier;
     struct vhost_dev *dev;
 };
 
@@ -41,6 +42,7 @@ typedef unsigned long vhost_log_chunk_t;
 #define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
 #define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
 #define VHOST_INVALID_FEATURE_BIT   (0xff)
+#define VHOST_QUEUE_NUM_CONFIG_INR 0
 
 struct vhost_log {
     unsigned long long size;
@@ -187,6 +189,8 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
  * Disable direct notifications to vhost device.
  */
 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
+bool vhost_config_pending(struct vhost_dev *hdev);
+void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask);
 
 /**
  * vhost_dev_is_started() - report status of vhost device
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index fdcd1a8fdf..2c566dc539 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1640,7 +1640,68 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
     file.index = hdev->vhost_ops->vhost_get_vq_index(hdev, n);
     r = hdev->vhost_ops->vhost_set_vring_call(hdev, &file);
     if (r < 0) {
-        VHOST_OPS_DEBUG(r, "vhost_set_vring_call failed");
+        error_report("vhost_set_vring_call failed %d", -r);
+    }
+}
+
+bool vhost_config_pending(struct vhost_dev *hdev)
+{
+    assert(hdev->vhost_ops);
+    if ((hdev->started == false) ||
+        (hdev->vhost_ops->vhost_set_config_call == NULL)) {
+        return false;
+    }
+
+    EventNotifier *notifier =
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
+    return event_notifier_test_and_clear(notifier);
+}
+
+void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask)
+{
+    int fd;
+    int r;
+    EventNotifier *notifier =
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
+    EventNotifier *config_notifier = &vdev->config_notifier;
+    assert(hdev->vhost_ops);
+
+    if ((hdev->started == false) ||
+        (hdev->vhost_ops->vhost_set_config_call == NULL)) {
+        return;
+    }
+    if (mask) {
+        assert(vdev->use_guest_notifier_mask);
+        fd = event_notifier_get_fd(notifier);
+    } else {
+        fd = event_notifier_get_fd(config_notifier);
+    }
+    r = hdev->vhost_ops->vhost_set_config_call(hdev, fd);
+    if (r < 0) {
+        error_report("vhost_set_config_call failed %d", -r);
+    }
+}
+
+static void vhost_stop_config_intr(struct vhost_dev *dev)
+{
+    int fd = -1;
+    assert(dev->vhost_ops);
+    if (dev->vhost_ops->vhost_set_config_call) {
+        dev->vhost_ops->vhost_set_config_call(dev, fd);
+    }
+}
+
+static void vhost_start_config_intr(struct vhost_dev *dev)
+{
+    int r;
+
+    assert(dev->vhost_ops);
+    int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
+    if (dev->vhost_ops->vhost_set_config_call) {
+        r = dev->vhost_ops->vhost_set_config_call(dev, fd);
+        if (!r) {
+            event_notifier_set(&dev->vdev->config_notifier);
+        }
     }
 }
 
@@ -1880,6 +1941,16 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
         }
     }
 
+    r = event_notifier_init(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier, 0);
+    if (r < 0) {
+        return r;
+    }
+    event_notifier_test_and_clear(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
+    if (!vdev->use_guest_notifier_mask) {
+        vhost_config_mask(hdev, vdev, true);
+    }
     if (hdev->log_enabled) {
         uint64_t log_base;
 
@@ -1918,6 +1989,7 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
             vhost_device_iotlb_miss(hdev, vq->used_phys, true);
         }
     }
+    vhost_start_config_intr(hdev);
     return 0;
 fail_start:
     if (vrings) {
@@ -1947,6 +2019,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
 
     /* should only be called after backend is connected */
     assert(hdev->vhost_ops);
+    event_notifier_test_and_clear(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
+    event_notifier_test_and_clear(&vdev->config_notifier);
 
     trace_vhost_dev_stop(hdev, vdev->name, vrings);
 
@@ -1969,6 +2044,7 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
         }
         memory_listener_unregister(&hdev->iommu_listener);
     }
+    vhost_stop_config_intr(hdev);
     vhost_log_put(hdev, true);
     hdev->started = false;
     vdev->vhost_started = false;
-- 
MST



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

* [PULL 22/51] virtio-net: add support for configure interrupt
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (20 preceding siblings ...)
  2023-01-05  9:21   ` Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 23/51] virtio-mmio: " Michael S. Tsirkin
                   ` (30 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add functions to support configure interrupt in virtio_net
Add the functions to support vhost_net_config_pending
and vhost_net_config_mask.

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-9-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/net/vhost_net.h | 2 ++
 hw/net/vhost_net-stub.c | 9 +++++++++
 hw/net/vhost_net.c      | 9 +++++++++
 hw/net/virtio-net.c     | 4 ++--
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index dfb13756cd..c37aba35e6 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -39,6 +39,8 @@ int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
 bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
 void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
                               int idx, bool mask);
+bool vhost_net_config_pending(VHostNetState *net);
+void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask);
 int vhost_net_notify_migration_done(VHostNetState *net, char* mac_addr);
 VHostNetState *get_vhost_net(NetClientState *nc);
 
diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c
index 66ed5f0b98..72df6d757e 100644
--- a/hw/net/vhost_net-stub.c
+++ b/hw/net/vhost_net-stub.c
@@ -82,6 +82,15 @@ void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
 {
 }
 
+bool vhost_net_config_pending(VHostNetState *net)
+{
+    return false;
+}
+
+void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
+{
+}
+
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
     return -1;
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 984b130e8f..c4eecc6f36 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -487,6 +487,15 @@ void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
     vhost_virtqueue_mask(&net->dev, dev, idx, mask);
 }
 
+bool vhost_net_config_pending(VHostNetState *net)
+{
+    return vhost_config_pending(&net->dev);
+}
+
+void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
+{
+    vhost_config_mask(&net->dev, dev, mask);
+}
 VHostNetState *get_vhost_net(NetClientState *nc)
 {
     VHostNetState *vhost_net = 0;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 0bfe454c23..f191e3037f 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3332,7 +3332,7 @@ static bool virtio_net_guest_notifier_pending(VirtIODevice *vdev, int idx)
      */
 
     if (idx == VIRTIO_CONFIG_IRQ_IDX) {
-        return false;
+        return vhost_net_config_pending(get_vhost_net(nc->peer));
     }
     return vhost_net_virtqueue_pending(get_vhost_net(nc->peer), idx);
 }
@@ -3364,9 +3364,9 @@ static void virtio_net_guest_notifier_mask(VirtIODevice *vdev, int idx,
      */
 
     if (idx == VIRTIO_CONFIG_IRQ_IDX) {
+        vhost_net_config_mask(get_vhost_net(nc->peer), vdev, mask);
         return;
     }
-
     vhost_net_virtqueue_mask(get_vhost_net(nc->peer), vdev, idx, mask);
 }
 
-- 
MST



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

* [PULL 23/51] virtio-mmio: add support for configure interrupt
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (21 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 22/51] virtio-net: " Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 24/51] virtio-pci: " Michael S. Tsirkin
                   ` (29 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add configure interrupt support in virtio-mmio bus.
add function to set configure guest notifier.

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-10-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio-mmio.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index d240efef97..103260ec15 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -670,7 +670,30 @@ static int virtio_mmio_set_guest_notifier(DeviceState *d, int n, bool assign,
 
     return 0;
 }
+static int virtio_mmio_set_config_guest_notifier(DeviceState *d, bool assign,
+                                                 bool with_irqfd)
+{
+    VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
+    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+    EventNotifier *notifier = virtio_config_get_guest_notifier(vdev);
+    int r = 0;
 
+    if (assign) {
+        r = event_notifier_init(notifier, 0);
+        if (r < 0) {
+            return r;
+        }
+        virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
+    } else {
+        virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
+        event_notifier_cleanup(notifier);
+    }
+    if (vdc->guest_notifier_mask && vdev->use_guest_notifier_mask) {
+        vdc->guest_notifier_mask(vdev, VIRTIO_CONFIG_IRQ_IDX, !assign);
+    }
+    return r;
+}
 static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
                                            bool assign)
 {
@@ -692,6 +715,10 @@ static int virtio_mmio_set_guest_notifiers(DeviceState *d, int nvqs,
             goto assign_error;
         }
     }
+    r = virtio_mmio_set_config_guest_notifier(d, assign, with_irqfd);
+    if (r < 0) {
+        goto assign_error;
+    }
 
     return 0;
 
-- 
MST



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

* [PULL 24/51] virtio-pci: add support for configure interrupt
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (22 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 23/51] virtio-mmio: " Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 25/51] hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device() Michael S. Tsirkin
                   ` (28 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add process to handle the configure interrupt, The function's
logic is the same with vq interrupt.Add extra process to check
the configure interrupt

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-11-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/virtio-pci.h |   4 +-
 hw/virtio/virtio-pci.c         | 118 +++++++++++++++++++++++++++------
 2 files changed, 102 insertions(+), 20 deletions(-)

diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
index 24fba1604b..ab2051b64b 100644
--- a/include/hw/virtio/virtio-pci.h
+++ b/include/hw/virtio/virtio-pci.h
@@ -261,5 +261,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t);
  * @fixed_queues.
  */
 unsigned virtio_pci_optimal_num_queues(unsigned fixed_queues);
-
+void virtio_pci_set_guest_notifier_fd_handler(VirtIODevice *vdev, VirtQueue *vq,
+                                              int n, bool assign,
+                                              bool with_irqfd);
 #endif
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index d7e29b1cdc..7bc60fcf94 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -836,7 +836,8 @@ static int virtio_pci_get_notifier(VirtIOPCIProxy *proxy, int queue_no,
     VirtQueue *vq;
 
     if (queue_no == VIRTIO_CONFIG_IRQ_IDX) {
-        return -1;
+        *n = virtio_config_get_guest_notifier(vdev);
+        *vector = vdev->config_vector;
     } else {
         if (!virtio_queue_get_num(vdev, queue_no)) {
             return -1;
@@ -896,7 +897,7 @@ undo:
     }
     return ret;
 }
-static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
+static int kvm_virtio_pci_vector_vq_use(VirtIOPCIProxy *proxy, int nvqs)
 {
     int queue_no;
     int ret = 0;
@@ -911,6 +912,10 @@ static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs)
     return ret;
 }
 
+static int kvm_virtio_pci_vector_config_use(VirtIOPCIProxy *proxy)
+{
+    return kvm_virtio_pci_vector_use_one(proxy, VIRTIO_CONFIG_IRQ_IDX);
+}
 
 static void kvm_virtio_pci_vector_release_one(VirtIOPCIProxy *proxy,
                                               int queue_no)
@@ -935,7 +940,7 @@ static void kvm_virtio_pci_vector_release_one(VirtIOPCIProxy *proxy,
     kvm_virtio_pci_vq_vector_release(proxy, vector);
 }
 
-static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
+static void kvm_virtio_pci_vector_vq_release(VirtIOPCIProxy *proxy, int nvqs)
 {
     int queue_no;
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
@@ -948,6 +953,11 @@ static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs)
     }
 }
 
+static void kvm_virtio_pci_vector_config_release(VirtIOPCIProxy *proxy)
+{
+    kvm_virtio_pci_vector_release_one(proxy, VIRTIO_CONFIG_IRQ_IDX);
+}
+
 static int virtio_pci_one_vector_unmask(VirtIOPCIProxy *proxy,
                                        unsigned int queue_no,
                                        unsigned int vector,
@@ -1029,9 +1039,19 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,
         }
         vq = virtio_vector_next_queue(vq);
     }
-
+    /* unmask config intr */
+    if (vector == vdev->config_vector) {
+        n = virtio_config_get_guest_notifier(vdev);
+        ret = virtio_pci_one_vector_unmask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector,
+                                           msg, n);
+        if (ret < 0) {
+            goto undo_config;
+        }
+    }
     return 0;
-
+undo_config:
+    n = virtio_config_get_guest_notifier(vdev);
+    virtio_pci_one_vector_mask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector, n);
 undo:
     vq = virtio_vector_first_queue(vdev, vector);
     while (vq && unmasked >= 0) {
@@ -1065,6 +1085,11 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector)
         }
         vq = virtio_vector_next_queue(vq);
     }
+
+    if (vector == vdev->config_vector) {
+        n = virtio_config_get_guest_notifier(vdev);
+        virtio_pci_one_vector_mask(proxy, VIRTIO_CONFIG_IRQ_IDX, vector, n);
+    }
 }
 
 static void virtio_pci_vector_poll(PCIDevice *dev,
@@ -1096,6 +1121,34 @@ static void virtio_pci_vector_poll(PCIDevice *dev,
             msix_set_pending(dev, vector);
         }
     }
+    /* poll the config intr */
+    ret = virtio_pci_get_notifier(proxy, VIRTIO_CONFIG_IRQ_IDX, &notifier,
+                                  &vector);
+    if (ret < 0) {
+        return;
+    }
+    if (vector < vector_start || vector >= vector_end ||
+        !msix_is_masked(dev, vector)) {
+        return;
+    }
+    if (k->guest_notifier_pending) {
+        if (k->guest_notifier_pending(vdev, VIRTIO_CONFIG_IRQ_IDX)) {
+            msix_set_pending(dev, vector);
+        }
+    } else if (event_notifier_test_and_clear(notifier)) {
+        msix_set_pending(dev, vector);
+    }
+}
+
+void virtio_pci_set_guest_notifier_fd_handler(VirtIODevice *vdev, VirtQueue *vq,
+                                              int n, bool assign,
+                                              bool with_irqfd)
+{
+    if (n == VIRTIO_CONFIG_IRQ_IDX) {
+        virtio_config_set_guest_notifier_fd_handler(vdev, assign, with_irqfd);
+    } else {
+        virtio_queue_set_guest_notifier_fd_handler(vq, assign, with_irqfd);
+    }
 }
 
 static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
@@ -1104,17 +1157,25 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
-    VirtQueue *vq = virtio_get_queue(vdev, n);
-    EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
+    VirtQueue *vq = NULL;
+    EventNotifier *notifier = NULL;
+
+    if (n == VIRTIO_CONFIG_IRQ_IDX) {
+        notifier = virtio_config_get_guest_notifier(vdev);
+    } else {
+        vq = virtio_get_queue(vdev, n);
+        notifier = virtio_queue_get_guest_notifier(vq);
+    }
 
     if (assign) {
         int r = event_notifier_init(notifier, 0);
         if (r < 0) {
             return r;
         }
-        virtio_queue_set_guest_notifier_fd_handler(vq, true, with_irqfd);
+        virtio_pci_set_guest_notifier_fd_handler(vdev, vq, n, true, with_irqfd);
     } else {
-        virtio_queue_set_guest_notifier_fd_handler(vq, false, with_irqfd);
+        virtio_pci_set_guest_notifier_fd_handler(vdev, vq, n, false,
+                                                 with_irqfd);
         event_notifier_cleanup(notifier);
     }
 
@@ -1157,10 +1218,13 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
     proxy->nvqs_with_notifiers = nvqs;
 
     /* Must unset vector notifier while guest notifier is still assigned */
-    if ((proxy->vector_irqfd || k->guest_notifier_mask) && !assign) {
+    if ((proxy->vector_irqfd ||
+         (vdev->use_guest_notifier_mask && k->guest_notifier_mask)) &&
+        !assign) {
         msix_unset_vector_notifiers(&proxy->pci_dev);
         if (proxy->vector_irqfd) {
-            kvm_virtio_pci_vector_release(proxy, nvqs);
+            kvm_virtio_pci_vector_vq_release(proxy, nvqs);
+            kvm_virtio_pci_vector_config_release(proxy);
             g_free(proxy->vector_irqfd);
             proxy->vector_irqfd = NULL;
         }
@@ -1176,20 +1240,30 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
             goto assign_error;
         }
     }
-
+    r = virtio_pci_set_guest_notifier(d, VIRTIO_CONFIG_IRQ_IDX, assign,
+                                      with_irqfd);
+    if (r < 0) {
+        goto config_assign_error;
+    }
     /* Must set vector notifier after guest notifier has been assigned */
-    if ((with_irqfd || k->guest_notifier_mask) && assign) {
+    if ((with_irqfd ||
+         (vdev->use_guest_notifier_mask && k->guest_notifier_mask)) &&
+        assign) {
         if (with_irqfd) {
             proxy->vector_irqfd =
                 g_malloc0(sizeof(*proxy->vector_irqfd) *
                           msix_nr_vectors_allocated(&proxy->pci_dev));
-            r = kvm_virtio_pci_vector_use(proxy, nvqs);
+            r = kvm_virtio_pci_vector_vq_use(proxy, nvqs);
             if (r < 0) {
-                goto assign_error;
+                goto config_assign_error;
+            }
+            r = kvm_virtio_pci_vector_config_use(proxy);
+            if (r < 0) {
+                goto config_error;
             }
         }
-        r = msix_set_vector_notifiers(&proxy->pci_dev,
-                                      virtio_pci_vector_unmask,
+
+        r = msix_set_vector_notifiers(&proxy->pci_dev, virtio_pci_vector_unmask,
                                       virtio_pci_vector_mask,
                                       virtio_pci_vector_poll);
         if (r < 0) {
@@ -1202,9 +1276,15 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)
 notifiers_error:
     if (with_irqfd) {
         assert(assign);
-        kvm_virtio_pci_vector_release(proxy, nvqs);
+        kvm_virtio_pci_vector_vq_release(proxy, nvqs);
     }
-
+config_error:
+    if (with_irqfd) {
+        kvm_virtio_pci_vector_config_release(proxy);
+    }
+config_assign_error:
+    virtio_pci_set_guest_notifier(d, VIRTIO_CONFIG_IRQ_IDX, !assign,
+                                  with_irqfd);
 assign_error:
     /* We get here on assignment failure. Recover by undoing for VQs 0 .. n. */
     assert(assign);
-- 
MST



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

* [PULL 25/51] hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device()
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (23 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 24/51] virtio-pci: " Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 26/51] hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c Michael S. Tsirkin
                   ` (27 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@linaro.org>

To emphasize this function is QMP related, rename it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221222080005.27616-2-philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6ff797e1cf..e08443e3bf 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3855,7 +3855,7 @@ VirtioInfoList *qmp_x_query_virtio(Error **errp)
     return list;
 }
 
-static VirtIODevice *virtio_device_find(const char *path)
+static VirtIODevice *qmp_find_virtio_device(const char *path)
 {
     VirtIODevice *vdev;
 
@@ -3896,7 +3896,7 @@ VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
     VirtIODevice *vdev;
     VirtioStatus *status;
 
-    vdev = virtio_device_find(path);
+    vdev = qmp_find_virtio_device(path);
     if (vdev == NULL) {
         error_setg(errp, "Path %s is not a VirtIODevice", path);
         return NULL;
@@ -3972,7 +3972,7 @@ VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *path,
     VirtIODevice *vdev;
     VirtVhostQueueStatus *status;
 
-    vdev = virtio_device_find(path);
+    vdev = qmp_find_virtio_device(path);
     if (vdev == NULL) {
         error_setg(errp, "Path %s is not a VirtIODevice", path);
         return NULL;
@@ -4016,7 +4016,7 @@ VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path,
     VirtIODevice *vdev;
     VirtQueueStatus *status;
 
-    vdev = virtio_device_find(path);
+    vdev = qmp_find_virtio_device(path);
     if (vdev == NULL) {
         error_setg(errp, "Path %s is not a VirtIODevice", path);
         return NULL;
@@ -4109,7 +4109,7 @@ VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path,
     VirtQueue *vq;
     VirtioQueueElement *element = NULL;
 
-    vdev = virtio_device_find(path);
+    vdev = qmp_find_virtio_device(path);
     if (vdev == NULL) {
         error_setg(errp, "Path %s is not a VirtIO device", path);
         return NULL;
-- 
MST



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

* [PULL 26/51] hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (24 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 25/51] hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device() Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:21   ` Michael S. Tsirkin
                   ` (26 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Philippe Mathieu-Daudé, Jonah Palmer

From: Philippe Mathieu-Daudé <philmd@linaro.org>

virtio.c is big enough, extract more QMP related code to virtio-qmp.c.
To do so, expose qmp_find_virtio_device() and declar virtio_list in
the internal virtio-qmp.h header.

Note we have to leave qmp_x_query_virtio_queue_status() and
qmp_x_query_virtio_queue_element(), because they access VirtQueue
internal fields, and VirtQueue is only declared within virtio.c.

Suggested-by: Jonah Palmer <jonah.palmer@oracle.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221222080005.27616-3-philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio-qmp.h |   9 ++
 hw/virtio/virtio-qmp.c | 192 ++++++++++++++++++++++++++++++++++++++++-
 hw/virtio/virtio.c     | 191 +---------------------------------------
 3 files changed, 201 insertions(+), 191 deletions(-)

diff --git a/hw/virtio/virtio-qmp.h b/hw/virtio/virtio-qmp.h
index 075fc27030..59681082e5 100644
--- a/hw/virtio/virtio-qmp.h
+++ b/hw/virtio/virtio-qmp.h
@@ -12,7 +12,16 @@
 #define HW_VIRTIO_QMP_H
 
 #include "qapi/qapi-types-virtio.h"
+#include "hw/virtio/virtio.h"
 
+#include "qemu/queue.h"
+
+typedef QTAILQ_HEAD(QmpVirtIODeviceList, VirtIODevice) QmpVirtIODeviceList;
+
+/* QAPI list of realized VirtIODevices */
+extern QmpVirtIODeviceList virtio_list;
+
+VirtIODevice *qmp_find_virtio_device(const char *path);
 VirtioDeviceStatus *qmp_decode_status(uint8_t bitmap);
 VhostDeviceProtocols *qmp_decode_protocols(uint64_t bitmap);
 VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap);
diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c
index 8e7282658f..e4d4bece2d 100644
--- a/hw/virtio/virtio-qmp.c
+++ b/hw/virtio/virtio-qmp.c
@@ -10,9 +10,14 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/virtio/virtio.h"
 #include "virtio-qmp.h"
 
+#include "qapi/error.h"
+#include "qapi/qapi-commands-virtio.h"
+#include "qapi/qapi-commands-qom.h"
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp/qjson.h"
+
 #include "standard-headers/linux/virtio_ids.h"
 #include "standard-headers/linux/vhost_types.h"
 #include "standard-headers/linux/virtio_blk.h"
@@ -657,3 +662,188 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap)
 
     return features;
 }
+
+VirtioInfoList *qmp_x_query_virtio(Error **errp)
+{
+    VirtioInfoList *list = NULL;
+    VirtioInfoList *node;
+    VirtIODevice *vdev;
+
+    QTAILQ_FOREACH(vdev, &virtio_list, next) {
+        DeviceState *dev = DEVICE(vdev);
+        Error *err = NULL;
+        QObject *obj = qmp_qom_get(dev->canonical_path, "realized", &err);
+
+        if (err == NULL) {
+            GString *is_realized = qobject_to_json_pretty(obj, true);
+            /* virtio device is NOT realized, remove it from list */
+            if (!strncmp(is_realized->str, "false", 4)) {
+                QTAILQ_REMOVE(&virtio_list, vdev, next);
+            } else {
+                node = g_new0(VirtioInfoList, 1);
+                node->value = g_new(VirtioInfo, 1);
+                node->value->path = g_strdup(dev->canonical_path);
+                node->value->name = g_strdup(vdev->name);
+                QAPI_LIST_PREPEND(list, node->value);
+            }
+           g_string_free(is_realized, true);
+        }
+        qobject_unref(obj);
+    }
+
+    return list;
+}
+
+VirtIODevice *qmp_find_virtio_device(const char *path)
+{
+    VirtIODevice *vdev;
+
+    QTAILQ_FOREACH(vdev, &virtio_list, next) {
+        DeviceState *dev = DEVICE(vdev);
+
+        if (strcmp(dev->canonical_path, path) != 0) {
+            continue;
+        }
+
+        Error *err = NULL;
+        QObject *obj = qmp_qom_get(dev->canonical_path, "realized", &err);
+        if (err == NULL) {
+            GString *is_realized = qobject_to_json_pretty(obj, true);
+            /* virtio device is NOT realized, remove it from list */
+            if (!strncmp(is_realized->str, "false", 4)) {
+                g_string_free(is_realized, true);
+                qobject_unref(obj);
+                QTAILQ_REMOVE(&virtio_list, vdev, next);
+                return NULL;
+            }
+            g_string_free(is_realized, true);
+        } else {
+            /* virtio device doesn't exist in QOM tree */
+            QTAILQ_REMOVE(&virtio_list, vdev, next);
+            qobject_unref(obj);
+            return NULL;
+        }
+        /* device exists in QOM tree & is realized */
+        qobject_unref(obj);
+        return vdev;
+    }
+    return NULL;
+}
+
+VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
+{
+    VirtIODevice *vdev;
+    VirtioStatus *status;
+
+    vdev = qmp_find_virtio_device(path);
+    if (vdev == NULL) {
+        error_setg(errp, "Path %s is not a VirtIODevice", path);
+        return NULL;
+    }
+
+    status = g_new0(VirtioStatus, 1);
+    status->name = g_strdup(vdev->name);
+    status->device_id = vdev->device_id;
+    status->vhost_started = vdev->vhost_started;
+    status->guest_features = qmp_decode_features(vdev->device_id,
+                                                 vdev->guest_features);
+    status->host_features = qmp_decode_features(vdev->device_id,
+                                                vdev->host_features);
+    status->backend_features = qmp_decode_features(vdev->device_id,
+                                                   vdev->backend_features);
+
+    switch (vdev->device_endian) {
+    case VIRTIO_DEVICE_ENDIAN_LITTLE:
+        status->device_endian = g_strdup("little");
+        break;
+    case VIRTIO_DEVICE_ENDIAN_BIG:
+        status->device_endian = g_strdup("big");
+        break;
+    default:
+        status->device_endian = g_strdup("unknown");
+        break;
+    }
+
+    status->num_vqs = virtio_get_num_queues(vdev);
+    status->status = qmp_decode_status(vdev->status);
+    status->isr = vdev->isr;
+    status->queue_sel = vdev->queue_sel;
+    status->vm_running = vdev->vm_running;
+    status->broken = vdev->broken;
+    status->disabled = vdev->disabled;
+    status->use_started = vdev->use_started;
+    status->started = vdev->started;
+    status->start_on_kick = vdev->start_on_kick;
+    status->disable_legacy_check = vdev->disable_legacy_check;
+    status->bus_name = g_strdup(vdev->bus_name);
+    status->use_guest_notifier_mask = vdev->use_guest_notifier_mask;
+
+    if (vdev->vhost_started) {
+        VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+        struct vhost_dev *hdev = vdc->get_vhost(vdev);
+
+        status->vhost_dev = g_new0(VhostStatus, 1);
+        status->vhost_dev->n_mem_sections = hdev->n_mem_sections;
+        status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections;
+        status->vhost_dev->nvqs = hdev->nvqs;
+        status->vhost_dev->vq_index = hdev->vq_index;
+        status->vhost_dev->features =
+            qmp_decode_features(vdev->device_id, hdev->features);
+        status->vhost_dev->acked_features =
+            qmp_decode_features(vdev->device_id, hdev->acked_features);
+        status->vhost_dev->backend_features =
+            qmp_decode_features(vdev->device_id, hdev->backend_features);
+        status->vhost_dev->protocol_features =
+            qmp_decode_protocols(hdev->protocol_features);
+        status->vhost_dev->max_queues = hdev->max_queues;
+        status->vhost_dev->backend_cap = hdev->backend_cap;
+        status->vhost_dev->log_enabled = hdev->log_enabled;
+        status->vhost_dev->log_size = hdev->log_size;
+    }
+
+    return status;
+}
+
+VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *path,
+                                                            uint16_t queue,
+                                                            Error **errp)
+{
+    VirtIODevice *vdev;
+    VirtVhostQueueStatus *status;
+
+    vdev = qmp_find_virtio_device(path);
+    if (vdev == NULL) {
+        error_setg(errp, "Path %s is not a VirtIODevice", path);
+        return NULL;
+    }
+
+    if (!vdev->vhost_started) {
+        error_setg(errp, "Error: vhost device has not started yet");
+        return NULL;
+    }
+
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
+    struct vhost_dev *hdev = vdc->get_vhost(vdev);
+
+    if (queue < hdev->vq_index || queue >= hdev->vq_index + hdev->nvqs) {
+        error_setg(errp, "Invalid vhost virtqueue number %d", queue);
+        return NULL;
+    }
+
+    status = g_new0(VirtVhostQueueStatus, 1);
+    status->name = g_strdup(vdev->name);
+    status->kick = hdev->vqs[queue].kick;
+    status->call = hdev->vqs[queue].call;
+    status->desc = (uintptr_t)hdev->vqs[queue].desc;
+    status->avail = (uintptr_t)hdev->vqs[queue].avail;
+    status->used = (uintptr_t)hdev->vqs[queue].used;
+    status->num = hdev->vqs[queue].num;
+    status->desc_phys = hdev->vqs[queue].desc_phys;
+    status->desc_size = hdev->vqs[queue].desc_size;
+    status->avail_phys = hdev->vqs[queue].avail_phys;
+    status->avail_size = hdev->vqs[queue].avail_size;
+    status->used_phys = hdev->vqs[queue].used_phys;
+    status->used_size = hdev->vqs[queue].used_size;
+
+    return status;
+}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index e08443e3bf..02a49d9fa1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -13,10 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qapi/qmp/qdict.h"
 #include "qapi/qapi-commands-virtio.h"
-#include "qapi/qapi-commands-qom.h"
-#include "qapi/qmp/qjson.h"
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "qemu/log.h"
@@ -47,8 +44,7 @@
 #include "standard-headers/linux/virtio_mem.h"
 #include "standard-headers/linux/virtio_vsock.h"
 
-/* QAPI list of realized VirtIODevices */
-static QTAILQ_HEAD(, VirtIODevice) virtio_list;
+QmpVirtIODeviceList virtio_list;
 
 /*
  * Maximum size of virtio device config space
@@ -3824,191 +3820,6 @@ bool virtio_device_ioeventfd_enabled(VirtIODevice *vdev)
     return virtio_bus_ioeventfd_enabled(vbus);
 }
 
-VirtioInfoList *qmp_x_query_virtio(Error **errp)
-{
-    VirtioInfoList *list = NULL;
-    VirtioInfoList *node;
-    VirtIODevice *vdev;
-
-    QTAILQ_FOREACH(vdev, &virtio_list, next) {
-        DeviceState *dev = DEVICE(vdev);
-        Error *err = NULL;
-        QObject *obj = qmp_qom_get(dev->canonical_path, "realized", &err);
-
-        if (err == NULL) {
-            GString *is_realized = qobject_to_json_pretty(obj, true);
-            /* virtio device is NOT realized, remove it from list */
-            if (!strncmp(is_realized->str, "false", 4)) {
-                QTAILQ_REMOVE(&virtio_list, vdev, next);
-            } else {
-                node = g_new0(VirtioInfoList, 1);
-                node->value = g_new(VirtioInfo, 1);
-                node->value->path = g_strdup(dev->canonical_path);
-                node->value->name = g_strdup(vdev->name);
-                QAPI_LIST_PREPEND(list, node->value);
-            }
-           g_string_free(is_realized, true);
-        }
-        qobject_unref(obj);
-    }
-
-    return list;
-}
-
-static VirtIODevice *qmp_find_virtio_device(const char *path)
-{
-    VirtIODevice *vdev;
-
-    QTAILQ_FOREACH(vdev, &virtio_list, next) {
-        DeviceState *dev = DEVICE(vdev);
-
-        if (strcmp(dev->canonical_path, path) != 0) {
-            continue;
-        }
-
-        Error *err = NULL;
-        QObject *obj = qmp_qom_get(dev->canonical_path, "realized", &err);
-        if (err == NULL) {
-            GString *is_realized = qobject_to_json_pretty(obj, true);
-            /* virtio device is NOT realized, remove it from list */
-            if (!strncmp(is_realized->str, "false", 4)) {
-                g_string_free(is_realized, true);
-                qobject_unref(obj);
-                QTAILQ_REMOVE(&virtio_list, vdev, next);
-                return NULL;
-            }
-            g_string_free(is_realized, true);
-        } else {
-            /* virtio device doesn't exist in QOM tree */
-            QTAILQ_REMOVE(&virtio_list, vdev, next);
-            qobject_unref(obj);
-            return NULL;
-        }
-        /* device exists in QOM tree & is realized */
-        qobject_unref(obj);
-        return vdev;
-    }
-    return NULL;
-}
-
-VirtioStatus *qmp_x_query_virtio_status(const char *path, Error **errp)
-{
-    VirtIODevice *vdev;
-    VirtioStatus *status;
-
-    vdev = qmp_find_virtio_device(path);
-    if (vdev == NULL) {
-        error_setg(errp, "Path %s is not a VirtIODevice", path);
-        return NULL;
-    }
-
-    status = g_new0(VirtioStatus, 1);
-    status->name = g_strdup(vdev->name);
-    status->device_id = vdev->device_id;
-    status->vhost_started = vdev->vhost_started;
-    status->guest_features = qmp_decode_features(vdev->device_id,
-                                                 vdev->guest_features);
-    status->host_features = qmp_decode_features(vdev->device_id,
-                                                vdev->host_features);
-    status->backend_features = qmp_decode_features(vdev->device_id,
-                                                   vdev->backend_features);
-
-    switch (vdev->device_endian) {
-    case VIRTIO_DEVICE_ENDIAN_LITTLE:
-        status->device_endian = g_strdup("little");
-        break;
-    case VIRTIO_DEVICE_ENDIAN_BIG:
-        status->device_endian = g_strdup("big");
-        break;
-    default:
-        status->device_endian = g_strdup("unknown");
-        break;
-    }
-
-    status->num_vqs = virtio_get_num_queues(vdev);
-    status->status = qmp_decode_status(vdev->status);
-    status->isr = vdev->isr;
-    status->queue_sel = vdev->queue_sel;
-    status->vm_running = vdev->vm_running;
-    status->broken = vdev->broken;
-    status->disabled = vdev->disabled;
-    status->use_started = vdev->use_started;
-    status->started = vdev->started;
-    status->start_on_kick = vdev->start_on_kick;
-    status->disable_legacy_check = vdev->disable_legacy_check;
-    status->bus_name = g_strdup(vdev->bus_name);
-    status->use_guest_notifier_mask = vdev->use_guest_notifier_mask;
-
-    if (vdev->vhost_started) {
-        VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
-        struct vhost_dev *hdev = vdc->get_vhost(vdev);
-
-        status->vhost_dev = g_new0(VhostStatus, 1);
-        status->vhost_dev->n_mem_sections = hdev->n_mem_sections;
-        status->vhost_dev->n_tmp_sections = hdev->n_tmp_sections;
-        status->vhost_dev->nvqs = hdev->nvqs;
-        status->vhost_dev->vq_index = hdev->vq_index;
-        status->vhost_dev->features =
-            qmp_decode_features(vdev->device_id, hdev->features);
-        status->vhost_dev->acked_features =
-            qmp_decode_features(vdev->device_id, hdev->acked_features);
-        status->vhost_dev->backend_features =
-            qmp_decode_features(vdev->device_id, hdev->backend_features);
-        status->vhost_dev->protocol_features =
-            qmp_decode_protocols(hdev->protocol_features);
-        status->vhost_dev->max_queues = hdev->max_queues;
-        status->vhost_dev->backend_cap = hdev->backend_cap;
-        status->vhost_dev->log_enabled = hdev->log_enabled;
-        status->vhost_dev->log_size = hdev->log_size;
-    }
-
-    return status;
-}
-
-VirtVhostQueueStatus *qmp_x_query_virtio_vhost_queue_status(const char *path,
-                                                            uint16_t queue,
-                                                            Error **errp)
-{
-    VirtIODevice *vdev;
-    VirtVhostQueueStatus *status;
-
-    vdev = qmp_find_virtio_device(path);
-    if (vdev == NULL) {
-        error_setg(errp, "Path %s is not a VirtIODevice", path);
-        return NULL;
-    }
-
-    if (!vdev->vhost_started) {
-        error_setg(errp, "Error: vhost device has not started yet");
-        return NULL;
-    }
-
-    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
-    struct vhost_dev *hdev = vdc->get_vhost(vdev);
-
-    if (queue < hdev->vq_index || queue >= hdev->vq_index + hdev->nvqs) {
-        error_setg(errp, "Invalid vhost virtqueue number %d", queue);
-        return NULL;
-    }
-
-    status = g_new0(VirtVhostQueueStatus, 1);
-    status->name = g_strdup(vdev->name);
-    status->kick = hdev->vqs[queue].kick;
-    status->call = hdev->vqs[queue].call;
-    status->desc = (uintptr_t)hdev->vqs[queue].desc;
-    status->avail = (uintptr_t)hdev->vqs[queue].avail;
-    status->used = (uintptr_t)hdev->vqs[queue].used;
-    status->num = hdev->vqs[queue].num;
-    status->desc_phys = hdev->vqs[queue].desc_phys;
-    status->desc_size = hdev->vqs[queue].desc_size;
-    status->avail_phys = hdev->vqs[queue].avail_phys;
-    status->avail_size = hdev->vqs[queue].avail_size;
-    status->used_phys = hdev->vqs[queue].used_phys;
-    status->used_size = hdev->vqs[queue].used_size;
-
-    return status;
-}
-
 VirtQueueStatus *qmp_x_query_virtio_queue_status(const char *path,
                                                  uint16_t queue,
                                                  Error **errp)
-- 
MST



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

* [PULL 27/51] include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h
@ 2023-01-05  9:21   ` Michael S. Tsirkin
  0 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Richard Henderson,
	Igor Mammedov, Ani Sinha, Paolo Bonzini, Eduardo Habkost,
	Marcel Apfelbaum, Yuval Shaia, Fam Zheng, Gerd Hoffmann,
	Stefano Stabellini, Anthony Perard, Paul Durrant, Ben Widawsky,
	Jonathan Cameron, Huacai Chen, Philippe Mathieu-Daudé,
	Jiaxun Yang, Andrey Smirnov, Xiaojuan Yang, Song Gao,
	Cédric Le Goater, Paul Burton, Aleksandar Rikalo, xen-devel,
	qemu-arm, qemu-ppc

From: Markus Armbruster <armbru@redhat.com>

hw/pci/pci_bridge.h and hw/cxl/cxl.h include each other.

Fortunately, breaking the loop is merely a matter of deleting
unnecessary includes from headers, and adding them back in places
where they are now missing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221222100330.380143-2-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/alpha/alpha_sys.h              | 1 -
 hw/rdma/rdma_utils.h              | 1 -
 hw/rdma/vmw/pvrdma.h              | 1 -
 hw/usb/hcd-ehci.h                 | 1 -
 hw/xen/xen_pt.h                   | 1 -
 include/hw/cxl/cxl.h              | 1 -
 include/hw/cxl/cxl_cdat.h         | 1 +
 include/hw/cxl/cxl_device.h       | 1 +
 include/hw/cxl/cxl_pci.h          | 2 --
 include/hw/i386/ich9.h            | 4 ----
 include/hw/i386/x86-iommu.h       | 1 -
 include/hw/isa/vt82c686.h         | 1 -
 include/hw/pci-host/designware.h  | 3 ---
 include/hw/pci-host/i440fx.h      | 2 +-
 include/hw/pci-host/ls7a.h        | 2 --
 include/hw/pci-host/pnv_phb3.h    | 2 --
 include/hw/pci-host/pnv_phb4.h    | 3 +--
 include/hw/pci-host/xilinx-pcie.h | 1 -
 include/hw/pci/pcie.h             | 1 -
 include/hw/virtio/virtio-scsi.h   | 1 -
 hw/alpha/pci.c                    | 1 +
 hw/alpha/typhoon.c                | 2 +-
 hw/i386/acpi-build.c              | 2 +-
 hw/pci-bridge/i82801b11.c         | 2 +-
 hw/rdma/rdma_utils.c              | 1 +
 hw/scsi/virtio-scsi.c             | 1 +
 26 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index 2263e821da..a303c58438 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -5,7 +5,6 @@
 
 #include "target/alpha/cpu-qom.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci_host.h"
 #include "hw/boards.h"
 #include "hw/intc/i8259.h"
 
diff --git a/hw/rdma/rdma_utils.h b/hw/rdma/rdma_utils.h
index 0c6414e7e0..54e4f56edd 100644
--- a/hw/rdma/rdma_utils.h
+++ b/hw/rdma/rdma_utils.h
@@ -18,7 +18,6 @@
 #define RDMA_UTILS_H
 
 #include "qemu/error-report.h"
-#include "hw/pci/pci.h"
 #include "sysemu/dma.h"
 
 #define rdma_error_report(fmt, ...) \
diff --git a/hw/rdma/vmw/pvrdma.h b/hw/rdma/vmw/pvrdma.h
index d08965d3e2..0caf95ede8 100644
--- a/hw/rdma/vmw/pvrdma.h
+++ b/hw/rdma/vmw/pvrdma.h
@@ -18,7 +18,6 @@
 
 #include "qemu/units.h"
 #include "qemu/notify.h"
-#include "hw/pci/pci.h"
 #include "hw/pci/msix.h"
 #include "chardev/char-fe.h"
 #include "hw/net/vmxnet3_defs.h"
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index a173707d9b..4d4b2830b7 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -23,7 +23,6 @@
 #include "sysemu/dma.h"
 #include "hw/pci/pci.h"
 #include "hw/sysbus.h"
-#include "qom/object.h"
 
 #ifndef EHCI_DEBUG
 #define EHCI_DEBUG   0
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index e7c4316a7d..cf10fc7bbf 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -2,7 +2,6 @@
 #define XEN_PT_H
 
 #include "hw/xen/xen_common.h"
-#include "hw/pci/pci.h"
 #include "xen-host-pci-device.h"
 #include "qom/object.h"
 
diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h
index 38e0e271d5..5129557bee 100644
--- a/include/hw/cxl/cxl.h
+++ b/include/hw/cxl/cxl.h
@@ -13,7 +13,6 @@
 
 #include "qapi/qapi-types-machine.h"
 #include "qapi/qapi-visit-machine.h"
-#include "hw/pci/pci_bridge.h"
 #include "hw/pci/pci_host.h"
 #include "cxl_pci.h"
 #include "cxl_component.h"
diff --git a/include/hw/cxl/cxl_cdat.h b/include/hw/cxl/cxl_cdat.h
index e9eda00142..7f67638685 100644
--- a/include/hw/cxl/cxl_cdat.h
+++ b/include/hw/cxl/cxl_cdat.h
@@ -11,6 +11,7 @@
 #define CXL_CDAT_H
 
 #include "hw/cxl/cxl_pci.h"
+#include "hw/pci/pcie_doe.h"
 
 /*
  * Reference:
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 449b0edfe9..fd475b947b 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -10,6 +10,7 @@
 #ifndef CXL_DEVICE_H
 #define CXL_DEVICE_H
 
+#include "hw/pci/pci.h"
 #include "hw/register.h"
 
 /*
diff --git a/include/hw/cxl/cxl_pci.h b/include/hw/cxl/cxl_pci.h
index 3cb79eca1e..aca14845ab 100644
--- a/include/hw/cxl/cxl_pci.h
+++ b/include/hw/cxl/cxl_pci.h
@@ -11,8 +11,6 @@
 #define CXL_PCI_H
 
 #include "qemu/compiler.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pcie.h"
 #include "hw/cxl/cxl_cdat.h"
 
 #define CXL_VENDOR_ID 0x1e98
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 23ee8e371b..222781e8b9 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -5,12 +5,8 @@
 #include "hw/sysbus.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/apm.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pcie_host.h"
-#include "hw/pci/pci_bridge.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9.h"
-#include "hw/pci/pci_bus.h"
 #include "qom/object.h"
 
 void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h
index 7637edb430..8d8d53b18b 100644
--- a/include/hw/i386/x86-iommu.h
+++ b/include/hw/i386/x86-iommu.h
@@ -21,7 +21,6 @@
 #define HW_I386_X86_IOMMU_H
 
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
 #include "qom/object.h"
 
diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h
index eaa07881c5..e273cd38dc 100644
--- a/include/hw/isa/vt82c686.h
+++ b/include/hw/isa/vt82c686.h
@@ -1,7 +1,6 @@
 #ifndef HW_VT82C686_H
 #define HW_VT82C686_H
 
-#include "hw/pci/pci.h"
 
 #define TYPE_VT82C686B_ISA "vt82c686b-isa"
 #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci"
diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h
index 6d9b51ae67..908f3d946b 100644
--- a/include/hw/pci-host/designware.h
+++ b/include/hw/pci-host/designware.h
@@ -22,9 +22,6 @@
 #define DESIGNWARE_H
 
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pci_bus.h"
-#include "hw/pci/pcie_host.h"
 #include "hw/pci/pci_bridge.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
index d02bf1ed6b..fc93e22732 100644
--- a/include/hw/pci-host/i440fx.h
+++ b/include/hw/pci-host/i440fx.h
@@ -11,7 +11,7 @@
 #ifndef HW_PCI_I440FX_H
 #define HW_PCI_I440FX_H
 
-#include "hw/pci/pci_bus.h"
+#include "hw/pci/pci.h"
 #include "hw/pci-host/pam.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/ls7a.h b/include/hw/pci-host/ls7a.h
index df7fa55a30..b27db8e2ca 100644
--- a/include/hw/pci-host/ls7a.h
+++ b/include/hw/pci-host/ls7a.h
@@ -8,8 +8,6 @@
 #ifndef HW_LS7A_H
 #define HW_LS7A_H
 
-#include "hw/pci/pci.h"
-#include "hw/pci/pcie_host.h"
 #include "hw/pci-host/pam.h"
 #include "qemu/units.h"
 #include "qemu/range.h"
diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
index 4854f6d2f6..f791ebda9b 100644
--- a/include/hw/pci-host/pnv_phb3.h
+++ b/include/hw/pci-host/pnv_phb3.h
@@ -10,8 +10,6 @@
 #ifndef PCI_HOST_PNV_PHB3_H
 #define PCI_HOST_PNV_PHB3_H
 
-#include "hw/pci/pcie_host.h"
-#include "hw/pci/pcie_port.h"
 #include "hw/ppc/xics.h"
 #include "qom/object.h"
 #include "hw/pci-host/pnv_phb.h"
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 50d4faa001..d9cea3f952 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -10,8 +10,7 @@
 #ifndef PCI_HOST_PNV_PHB4_H
 #define PCI_HOST_PNV_PHB4_H
 
-#include "hw/pci/pcie_host.h"
-#include "hw/pci/pcie_port.h"
+#include "hw/pci/pci_bus.h"
 #include "hw/ppc/xive.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/xilinx-pcie.h b/include/hw/pci-host/xilinx-pcie.h
index 89be88d87f..e1b3c1c280 100644
--- a/include/hw/pci-host/xilinx-pcie.h
+++ b/include/hw/pci-host/xilinx-pcie.h
@@ -21,7 +21,6 @@
 #define HW_XILINX_PCIE_H
 
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
 #include "hw/pci/pci_bridge.h"
 #include "hw/pci/pcie_host.h"
 #include "qom/object.h"
diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
index 698d3de851..798a262a0a 100644
--- a/include/hw/pci/pcie.h
+++ b/include/hw/pci/pcie.h
@@ -26,7 +26,6 @@
 #include "hw/pci/pcie_aer.h"
 #include "hw/pci/pcie_sriov.h"
 #include "hw/hotplug.h"
-#include "hw/pci/pcie_doe.h"
 
 typedef enum {
     /* for attention and power indicator */
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index a36aad9c86..37b75e15e3 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -20,7 +20,6 @@
 #define VIRTIO_SCSI_SENSE_SIZE 0
 #include "standard-headers/linux/virtio_scsi.h"
 #include "hw/virtio/virtio.h"
-#include "hw/pci/pci.h"
 #include "hw/scsi/scsi.h"
 #include "chardev/char-fe.h"
 #include "sysemu/iothread.h"
diff --git a/hw/alpha/pci.c b/hw/alpha/pci.c
index 72251fcdf0..7c18297177 100644
--- a/hw/alpha/pci.c
+++ b/hw/alpha/pci.c
@@ -7,6 +7,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/pci/pci_host.h"
 #include "alpha_sys.h"
 #include "qemu/log.h"
 #include "trace.h"
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index bd39c8ca86..49a80550c5 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -10,10 +10,10 @@
 #include "qemu/module.h"
 #include "qemu/units.h"
 #include "qapi/error.h"
+#include "hw/pci/pci_host.h"
 #include "cpu.h"
 #include "hw/irq.h"
 #include "alpha_sys.h"
-#include "qom/object.h"
 
 
 #define TYPE_TYPHOON_PCI_HOST_BRIDGE "typhoon-pcihost"
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index aa15b11cde..127c4e2d50 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -27,7 +27,7 @@
 #include "acpi-common.h"
 #include "qemu/bitmap.h"
 #include "qemu/error-report.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_bridge.h"
 #include "hw/cxl/cxl.h"
 #include "hw/core/cpu.h"
 #include "target/i386/cpu.h"
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index d9f224818b..f3b4a14611 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -42,7 +42,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_bridge.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "hw/i386/ich9.h"
diff --git a/hw/rdma/rdma_utils.c b/hw/rdma/rdma_utils.c
index 5a7ef63ad2..77008552f4 100644
--- a/hw/rdma/rdma_utils.c
+++ b/hw/rdma/rdma_utils.c
@@ -14,6 +14,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/pci/pci.h"
 #include "trace.h"
 #include "rdma_utils.h"
 
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6f6e2e32ba..2b649ca976 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -22,6 +22,7 @@
 #include "qemu/iov.h"
 #include "qemu/module.h"
 #include "sysemu/block-backend.h"
+#include "sysemu/dma.h"
 #include "hw/qdev-properties.h"
 #include "hw/scsi/scsi.h"
 #include "scsi/constants.h"
-- 
MST



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

* [PULL 29/51] include/hw/cxl: Include hw/cxl/*.h where needed
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (26 preceding siblings ...)
  2023-01-05  9:21   ` Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 30/51] include/hw/pci: Clean up a few things checkpatch.pl would flag Michael S. Tsirkin
                   ` (24 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Jonathan Cameron, Ben Widawsky

From: Markus Armbruster <armbru@redhat.com>

hw/cxl/cxl_component.h needs CDATObject from hw/cxl/cxl_cdat.h.

hw/cxl/cxl_device.h needs CXLComponentState from
hw/cxl/cxl_component.h.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20221222100330.380143-4-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/cxl/cxl_component.h | 1 +
 include/hw/cxl/cxl_device.h    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
index 34075cfb72..5dca21e95b 100644
--- a/include/hw/cxl/cxl_component.h
+++ b/include/hw/cxl/cxl_component.h
@@ -18,6 +18,7 @@
 #include "qemu/compiler.h"
 #include "qemu/range.h"
 #include "qemu/typedefs.h"
+#include "hw/cxl/cxl_cdat.h"
 #include "hw/register.h"
 #include "qapi/error.h"
 
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index fd475b947b..3f91969db0 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -10,6 +10,7 @@
 #ifndef CXL_DEVICE_H
 #define CXL_DEVICE_H
 
+#include "hw/cxl/cxl_component.h"
 #include "hw/pci/pci.h"
 #include "hw/register.h"
 
-- 
MST



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

* [PULL 30/51] include/hw/pci: Clean up a few things checkpatch.pl would flag
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (27 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 29/51] include/hw/cxl: Include hw/cxl/*.h where needed Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:15 ` [PULL 31/51] include/hw/pci: Split pci_device.h off pci.h Michael S. Tsirkin
                   ` (23 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Philippe Mathieu-Daudé,
	Marcel Apfelbaum

From: Markus Armbruster <armbru@redhat.com>

Fix a few style violations so that checkpatch.pl won't complain when I
move this code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221222100330.380143-5-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/pci/pci.h | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 954f260f84..5ca2a9df58 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -284,8 +284,10 @@ struct PCIDevice {
     /* PCI config space */
     uint8_t *config;
 
-    /* Used to enable config checks on load. Note that writable bits are
-     * never checked even if set in cmask. */
+    /*
+     * Used to enable config checks on load. Note that writable bits are
+     * never checked even if set in cmask.
+     */
     uint8_t *cmask;
 
     /* Used to implement R/W bytes */
@@ -299,10 +301,11 @@ struct PCIDevice {
 
     /* the following fields are read only */
     int32_t devfn;
-    /* Cached device to fetch requester ID from, to avoid the PCI
-     * tree walking every time we invoke PCI request (e.g.,
-     * MSI). For conventional PCI root complex, this field is
-     * meaningless. */
+    /*
+     * Cached device to fetch requester ID from, to avoid the PCI tree
+     * walking every time we invoke PCI request (e.g., MSI). For
+     * conventional PCI root complex, this field is meaningless.
+     */
     PCIReqIDCache requester_id_cache;
     char name[64];
     PCIIORegion io_regions[PCI_NUM_REGIONS];
@@ -943,7 +946,7 @@ extern const VMStateDescription vmstate_pci_device;
     .name       = (stringify(_field)),                               \
     .size       = sizeof(PCIDevice),                                 \
     .vmsd       = &vmstate_pci_device,                               \
-    .flags      = VMS_STRUCT|VMS_POINTER,                            \
+    .flags      = VMS_STRUCT | VMS_POINTER,                          \
     .offset     = vmstate_offset_pointer(_state, _field, PCIDevice), \
 }
 
-- 
MST



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

* [PULL 31/51] include/hw/pci: Split pci_device.h off pci.h
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (28 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 30/51] include/hw/pci: Clean up a few things checkpatch.pl would flag Michael S. Tsirkin
@ 2023-01-05  9:15 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 34/51] include/hw/virtio: Break inclusion loop Michael S. Tsirkin
                   ` (22 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Igor Mammedov, Ani Sinha,
	Gerd Hoffmann, Paolo Bonzini, Marc-André Lureau,
	Daniel P. Berrangé,
	Eduardo Habkost, BALATON Zoltan, Stefano Stabellini,
	Anthony Perard, Paul Durrant, Richard Henderson,
	Marcel Apfelbaum, John Snow, Alberto Garcia, Corey Minyard,
	Hervé Poussineau, Philippe Mathieu-Daudé,
	Aurelien Jarno, Pavel Pisa, Vikram Garhwal, Jason Wang,
	Dmitry Fleytman, Stefan Weil, Jiri Pirko, Sven Schnelle,
	Keith Busch, Klaus Jensen, Huacai Chen, Jiaxun Yang,
	Helge Deller, Mark Cave-Ayland, Yoshinori Sato, Magnus Damm,
	Daniel Henrique Barboza, Cédric Le Goater, David Gibson,
	Greg Kurz, Yuval Shaia, Matthew Rosato, Eric Farman,
	David Hildenbrand, Ilya Leoshkevich, Halil Pasic,
	Christian Borntraeger, Thomas Huth, Fam Zheng, Alex Williamson,
	Beniamino Galvani, Ben Widawsky, Jonathan Cameron,
	Elena Ufimtseva, Jagannathan Raman, John G Johnson, Bin Meng,
	Alexander Bulekov, Bandan Das, Stefan Hajnoczi, Darren Kenny,
	Qiuhao Li, Laurent Vivier, qemu-ppc, xen-devel, qemu-block,
	qemu-arm, qemu-s390x

From: Markus Armbruster <armbru@redhat.com>

PCIDeviceClass and PCIDevice are defined in pci.h.  Many users of the
header don't actually need them.  Similar structs live in their own
headers: PCIBusClass and PCIBus in pci_bus.h, PCIBridge in
pci_bridge.h, PCIHostBridgeClass and PCIHostState in pci_host.h,
PCIExpressHost in pcie_host.h, and PCIERootPortClass, PCIEPort, and
PCIESlot in pcie_port.h.

Move PCIDeviceClass and PCIDeviceClass to new pci_device.h, along with
the code that needs them.  Adjust include directives.

This also enables the next commit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221222100330.380143-6-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/display/ati_int.h             |   2 +-
 hw/display/qxl.h                 |   3 +-
 hw/ide/ahci_internal.h           |   2 +-
 hw/net/vmxnet3_defs.h            |   2 +-
 hw/nvme/nvme.h                   |   2 +-
 hw/rdma/vmw/pvrdma.h             |   1 +
 hw/scsi/mptsas.h                 |   2 +-
 hw/usb/hcd-ehci.h                |   2 +-
 hw/usb/hcd-uhci.h                |   2 +-
 hw/usb/hcd-xhci-pci.h            |   1 +
 hw/vfio/pci.h                    |   2 +-
 include/hw/acpi/piix4.h          |   2 +-
 include/hw/arm/allwinner-a10.h   |   1 +
 include/hw/cxl/cxl_device.h      |   2 +-
 include/hw/ide/pci.h             |   2 +-
 include/hw/misc/macio/macio.h    |   2 +-
 include/hw/pci-host/gpex.h       |   2 +-
 include/hw/pci-host/i440fx.h     |   2 +-
 include/hw/pci-host/q35.h        |   2 +-
 include/hw/pci-host/sabre.h      |   2 +-
 include/hw/pci/msi.h             |   2 +-
 include/hw/pci/pci.h             | 344 ------------------------------
 include/hw/pci/pci_bridge.h      |   2 +-
 include/hw/pci/pci_device.h      | 350 +++++++++++++++++++++++++++++++
 include/hw/pci/pcie_port.h       |   1 +
 include/hw/pci/shpc.h            |   2 +-
 include/hw/remote/iohub.h        |   2 +-
 include/hw/remote/proxy.h        |   2 +-
 include/hw/sd/sdhci.h            |   2 +-
 include/hw/southbridge/piix.h    |   3 +-
 include/hw/xen/xen_common.h      |   2 +-
 hw/acpi/erst.c                   |   2 +-
 hw/audio/ac97.c                  |   2 +-
 hw/audio/es1370.c                |   2 +-
 hw/audio/via-ac97.c              |   2 +-
 hw/char/serial-pci-multi.c       |   2 +-
 hw/char/serial-pci.c             |   2 +-
 hw/core/qdev-properties-system.c |   1 +
 hw/display/bochs-display.c       |   2 +-
 hw/display/cirrus_vga.c          |   2 +-
 hw/display/sm501.c               |   2 +-
 hw/display/vga-pci.c             |   2 +-
 hw/display/vmware_vga.c          |   2 +-
 hw/i386/xen/xen_pvdevice.c       |   2 +-
 hw/ipack/tpci200.c               |   2 +-
 hw/ipmi/pci_ipmi_bt.c            |   2 +-
 hw/ipmi/pci_ipmi_kcs.c           |   2 +-
 hw/isa/i82378.c                  |   2 +-
 hw/mips/gt64xxx_pci.c            |   2 +-
 hw/misc/pci-testdev.c            |   2 +-
 hw/misc/pvpanic-pci.c            |   2 +-
 hw/net/can/can_kvaser_pci.c      |   2 +-
 hw/net/can/can_mioe3680_pci.c    |   2 +-
 hw/net/can/can_pcm3680_pci.c     |   2 +-
 hw/net/can/ctucan_pci.c          |   2 +-
 hw/net/e1000.c                   |   2 +-
 hw/net/e1000x_common.c           |   2 +-
 hw/net/eepro100.c                |   2 +-
 hw/net/ne2000-pci.c              |   2 +-
 hw/net/net_tx_pkt.c              |   2 +-
 hw/net/pcnet-pci.c               |   2 +-
 hw/net/rocker/rocker.c           |   2 +-
 hw/net/rocker/rocker_desc.c      |   2 +-
 hw/net/rtl8139.c                 |   2 +-
 hw/net/sungem.c                  |   2 +-
 hw/net/sunhme.c                  |   2 +-
 hw/net/tulip.c                   |   2 +-
 hw/net/virtio-net.c              |   2 +-
 hw/pci-host/bonito.c             |   2 +-
 hw/pci-host/dino.c               |   2 +-
 hw/pci-host/grackle.c            |   2 +-
 hw/pci-host/mv64361.c            |   2 +-
 hw/pci-host/ppce500.c            |   2 +-
 hw/pci-host/raven.c              |   2 +-
 hw/pci-host/sh_pci.c             |   2 +-
 hw/pci-host/uninorth.c           |   2 +-
 hw/pci-host/versatile.c          |   2 +-
 hw/pci/pci-hmp-cmds.c            |   1 +
 hw/pci/pcie_host.c               |   2 +-
 hw/pci/pcie_sriov.c              |   2 +-
 hw/pci/slotid_cap.c              |   2 +-
 hw/ppc/ppc440_pcix.c             |   2 +-
 hw/ppc/ppc4xx_pci.c              |   2 +-
 hw/ppc/spapr_pci_vfio.c          |   1 +
 hw/rdma/rdma_utils.c             |   2 +-
 hw/s390x/s390-pci-inst.c         |   1 +
 hw/scsi/esp-pci.c                |   2 +-
 hw/scsi/lsi53c895a.c             |   2 +-
 hw/smbios/smbios.c               |   1 +
 hw/usb/hcd-ohci-pci.c            |   2 +-
 hw/watchdog/wdt_i6300esb.c       |   2 +-
 tests/qtest/fuzz/generic_fuzz.c  |   1 +
 ui/util.c                        |   2 +-
 93 files changed, 441 insertions(+), 427 deletions(-)
 create mode 100644 include/hw/pci/pci_device.h

diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h
index 8acb9c7466..e8d3c7af75 100644
--- a/hw/display/ati_int.h
+++ b/hw/display/ati_int.h
@@ -10,7 +10,7 @@
 #define ATI_INT_H
 
 #include "qemu/timer.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/i2c/bitbang_i2c.h"
 #include "vga_int.h"
 #include "qom/object.h"
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 7894bd5134..cd82c7a6fe 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -1,8 +1,7 @@
 #ifndef HW_QXL_H
 #define HW_QXL_H
 
-
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "vga_int.h"
 #include "qemu/thread.h"
 
diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
index 109de9e2d1..303fcd7235 100644
--- a/hw/ide/ahci_internal.h
+++ b/hw/ide/ahci_internal.h
@@ -26,7 +26,7 @@
 
 #include "hw/ide/ahci.h"
 #include "hw/ide/internal.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 
 #define AHCI_MEM_BAR_SIZE         0x1000
 #define AHCI_MAX_PORTS            32
diff --git a/hw/net/vmxnet3_defs.h b/hw/net/vmxnet3_defs.h
index 71440509ca..64034af6d5 100644
--- a/hw/net/vmxnet3_defs.h
+++ b/hw/net/vmxnet3_defs.h
@@ -19,7 +19,7 @@
 
 #include "net/net.h"
 #include "hw/net/vmxnet3.h"
-#include "qom/object.h"
+#include "hw/pci/pci_device.h"
 
 #define TYPE_VMXNET3 "vmxnet3"
 typedef struct VMXNET3State VMXNET3State;
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 7adf042ec3..16da27a69b 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -19,7 +19,7 @@
 #define HW_NVME_NVME_H
 
 #include "qemu/uuid.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/block/block.h"
 
 #include "block/nvme.h"
diff --git a/hw/rdma/vmw/pvrdma.h b/hw/rdma/vmw/pvrdma.h
index 0caf95ede8..4cbc10c980 100644
--- a/hw/rdma/vmw/pvrdma.h
+++ b/hw/rdma/vmw/pvrdma.h
@@ -19,6 +19,7 @@
 #include "qemu/units.h"
 #include "qemu/notify.h"
 #include "hw/pci/msix.h"
+#include "hw/pci/pci_device.h"
 #include "chardev/char-fe.h"
 #include "hw/net/vmxnet3_defs.h"
 
diff --git a/hw/scsi/mptsas.h b/hw/scsi/mptsas.h
index c046497db7..04e97ce3af 100644
--- a/hw/scsi/mptsas.h
+++ b/hw/scsi/mptsas.h
@@ -2,7 +2,7 @@
 #define MPTSAS_H
 
 #include "mpi.h"
-#include "qom/object.h"
+#include "hw/pci/pci_device.h"
 
 #define MPTSAS_NUM_PORTS 8
 #define MPTSAS_MAX_FRAMES 2048     /* Firmware limit at 65535 */
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 4d4b2830b7..2cd821f49e 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -21,7 +21,7 @@
 #include "qemu/timer.h"
 #include "hw/usb.h"
 #include "sysemu/dma.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/sysbus.h"
 
 #ifndef EHCI_DEBUG
diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h
index c85ab7868e..5843af504a 100644
--- a/hw/usb/hcd-uhci.h
+++ b/hw/usb/hcd-uhci.h
@@ -30,7 +30,7 @@
 
 #include "exec/memory.h"
 #include "qemu/timer.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/usb.h"
 
 typedef struct UHCIQueue UHCIQueue;
diff --git a/hw/usb/hcd-xhci-pci.h b/hw/usb/hcd-xhci-pci.h
index c193f79443..08f70ce97c 100644
--- a/hw/usb/hcd-xhci-pci.h
+++ b/hw/usb/hcd-xhci-pci.h
@@ -24,6 +24,7 @@
 #ifndef HW_USB_HCD_XHCI_PCI_H
 #define HW_USB_HCD_XHCI_PCI_H
 
+#include "hw/pci/pci_device.h"
 #include "hw/usb.h"
 #include "hcd-xhci.h"
 
diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
index 7c236a52f4..177abcc8fb 100644
--- a/hw/vfio/pci.h
+++ b/hw/vfio/pci.h
@@ -13,7 +13,7 @@
 #define HW_VFIO_VFIO_PCI_H
 
 #include "exec/memory.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/vfio/vfio-common.h"
 #include "qemu/event_notifier.h"
 #include "qemu/queue.h"
diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h
index 32686a75c5..be1f8ea80e 100644
--- a/include/hw/acpi/piix4.h
+++ b/include/hw/acpi/piix4.h
@@ -22,7 +22,7 @@
 #ifndef HW_ACPI_PIIX4_H
 #define HW_ACPI_PIIX4_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/cpu_hotplug.h"
 #include "hw/acpi/memory_hotplug.h"
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
index a76dc7b84d..f9240ffa64 100644
--- a/include/hw/arm/allwinner-a10.h
+++ b/include/hw/arm/allwinner-a10.h
@@ -4,6 +4,7 @@
 #include "qemu/error-report.h"
 #include "hw/char/serial.h"
 #include "hw/arm/boot.h"
+#include "hw/pci/pci_device.h"
 #include "hw/timer/allwinner-a10-pit.h"
 #include "hw/intc/allwinner-a10-pic.h"
 #include "hw/net/allwinner_emac.h"
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 3f91969db0..250adf18b2 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -11,7 +11,7 @@
 #define CXL_DEVICE_H
 
 #include "hw/cxl/cxl_component.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/register.h"
 
 /*
diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h
index d8384e1c42..2a6284acac 100644
--- a/include/hw/ide/pci.h
+++ b/include/hw/ide/pci.h
@@ -2,7 +2,7 @@
 #define HW_IDE_PCI_H
 
 #include "hw/ide/internal.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "qom/object.h"
 
 #define BM_STATUS_DMAING 0x01
diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h
index 95d30a1745..86df2c2b60 100644
--- a/include/hw/misc/macio/macio.h
+++ b/include/hw/misc/macio/macio.h
@@ -27,7 +27,7 @@
 #define MACIO_H
 
 #include "hw/char/escc.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/ide/internal.h"
 #include "hw/intc/heathrow_pic.h"
 #include "hw/misc/macio/cuda.h"
diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
index fcf8b63820..b0240bd768 100644
--- a/include/hw/pci-host/gpex.h
+++ b/include/hw/pci-host/gpex.h
@@ -22,7 +22,7 @@
 
 #include "exec/hwaddr.h"
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pcie_host.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
index fc93e22732..bf57216c78 100644
--- a/include/hw/pci-host/i440fx.h
+++ b/include/hw/pci-host/i440fx.h
@@ -11,7 +11,7 @@
 #ifndef HW_PCI_I440FX_H
 #define HW_PCI_I440FX_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci-host/pam.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h
index ab989698ef..e89329c51e 100644
--- a/include/hw/pci-host/q35.h
+++ b/include/hw/pci-host/q35.h
@@ -22,7 +22,7 @@
 #ifndef HW_Q35_H
 #define HW_Q35_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pcie_host.h"
 #include "hw/pci-host/pam.h"
 #include "qemu/units.h"
diff --git a/include/hw/pci-host/sabre.h b/include/hw/pci-host/sabre.h
index 01190241bb..d12de84ea2 100644
--- a/include/hw/pci-host/sabre.h
+++ b/include/hw/pci-host/sabre.h
@@ -1,7 +1,7 @@
 #ifndef HW_PCI_HOST_SABRE_H
 #define HW_PCI_HOST_SABRE_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "hw/sparc/sun4u_iommu.h"
 #include "qom/object.h"
diff --git a/include/hw/pci/msi.h b/include/hw/pci/msi.h
index 58aa576215..ee8ee469a6 100644
--- a/include/hw/pci/msi.h
+++ b/include/hw/pci/msi.h
@@ -21,7 +21,7 @@
 #ifndef QEMU_MSI_H
 #define QEMU_MSI_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 
 struct MSIMessage {
     uint64_t address;
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 5ca2a9df58..7048a373d1 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -166,7 +166,6 @@ enum {
 #define QEMU_PCI_VGA_IO_HI_SIZE 0x20
 
 #include "hw/pci/pci_regs.h"
-#include "hw/pci/pcie.h"
 
 /* PCI HEADER_TYPE */
 #define  PCI_HEADER_TYPE_MULTI_FUNCTION 0x80
@@ -210,23 +209,6 @@ enum {
     QEMU_PCIE_CAP_CXL = (1 << QEMU_PCIE_CXL_BITNR),
 };
 
-#define TYPE_PCI_DEVICE "pci-device"
-typedef struct PCIDeviceClass PCIDeviceClass;
-DECLARE_OBJ_CHECKERS(PCIDevice, PCIDeviceClass,
-                     PCI_DEVICE, TYPE_PCI_DEVICE)
-
-/*
- * Implemented by devices that can be plugged on CXL buses. In the spec, this is
- * actually a "CXL Component, but we name it device to match the PCI naming.
- */
-#define INTERFACE_CXL_DEVICE "cxl-device"
-
-/* Implemented by devices that can be plugged on PCI Express buses */
-#define INTERFACE_PCIE_DEVICE "pci-express-device"
-
-/* Implemented by devices that can be plugged on Conventional PCI buses */
-#define INTERFACE_CONVENTIONAL_PCI_DEVICE "conventional-pci-device"
-
 typedef struct PCIINTxRoute {
     enum {
         PCI_INTX_ENABLED,
@@ -236,24 +218,6 @@ typedef struct PCIINTxRoute {
     int irq;
 } PCIINTxRoute;
 
-struct PCIDeviceClass {
-    DeviceClass parent_class;
-
-    void (*realize)(PCIDevice *dev, Error **errp);
-    PCIUnregisterFunc *exit;
-    PCIConfigReadFunc *config_read;
-    PCIConfigWriteFunc *config_write;
-
-    uint16_t vendor_id;
-    uint16_t device_id;
-    uint8_t revision;
-    uint16_t class_id;
-    uint16_t subsystem_vendor_id;       /* only for header type = 0 */
-    uint16_t subsystem_id;              /* only for header type = 0 */
-
-    const char *romfile;                /* rom bar */
-};
-
 typedef void (*PCIINTxRoutingNotifier)(PCIDevice *dev);
 typedef int (*MSIVectorUseNotifier)(PCIDevice *dev, unsigned int vector,
                                       MSIMessage msg);
@@ -262,129 +226,6 @@ typedef void (*MSIVectorPollNotifier)(PCIDevice *dev,
                                       unsigned int vector_start,
                                       unsigned int vector_end);
 
-enum PCIReqIDType {
-    PCI_REQ_ID_INVALID = 0,
-    PCI_REQ_ID_BDF,
-    PCI_REQ_ID_SECONDARY_BUS,
-    PCI_REQ_ID_MAX,
-};
-typedef enum PCIReqIDType PCIReqIDType;
-
-struct PCIReqIDCache {
-    PCIDevice *dev;
-    PCIReqIDType type;
-};
-typedef struct PCIReqIDCache PCIReqIDCache;
-
-struct PCIDevice {
-    DeviceState qdev;
-    bool partially_hotplugged;
-    bool has_power;
-
-    /* PCI config space */
-    uint8_t *config;
-
-    /*
-     * Used to enable config checks on load. Note that writable bits are
-     * never checked even if set in cmask.
-     */
-    uint8_t *cmask;
-
-    /* Used to implement R/W bytes */
-    uint8_t *wmask;
-
-    /* Used to implement RW1C(Write 1 to Clear) bytes */
-    uint8_t *w1cmask;
-
-    /* Used to allocate config space for capabilities. */
-    uint8_t *used;
-
-    /* the following fields are read only */
-    int32_t devfn;
-    /*
-     * Cached device to fetch requester ID from, to avoid the PCI tree
-     * walking every time we invoke PCI request (e.g., MSI). For
-     * conventional PCI root complex, this field is meaningless.
-     */
-    PCIReqIDCache requester_id_cache;
-    char name[64];
-    PCIIORegion io_regions[PCI_NUM_REGIONS];
-    AddressSpace bus_master_as;
-    MemoryRegion bus_master_container_region;
-    MemoryRegion bus_master_enable_region;
-
-    /* do not access the following fields */
-    PCIConfigReadFunc *config_read;
-    PCIConfigWriteFunc *config_write;
-
-    /* Legacy PCI VGA regions */
-    MemoryRegion *vga_regions[QEMU_PCI_VGA_NUM_REGIONS];
-    bool has_vga;
-
-    /* Current IRQ levels.  Used internally by the generic PCI code.  */
-    uint8_t irq_state;
-
-    /* Capability bits */
-    uint32_t cap_present;
-
-    /* Offset of MSI-X capability in config space */
-    uint8_t msix_cap;
-
-    /* MSI-X entries */
-    int msix_entries_nr;
-
-    /* Space to store MSIX table & pending bit array */
-    uint8_t *msix_table;
-    uint8_t *msix_pba;
-
-    /* May be used by INTx or MSI during interrupt notification */
-    void *irq_opaque;
-
-    MSITriggerFunc *msi_trigger;
-    MSIPrepareMessageFunc *msi_prepare_message;
-    MSIxPrepareMessageFunc *msix_prepare_message;
-
-    /* MemoryRegion container for msix exclusive BAR setup */
-    MemoryRegion msix_exclusive_bar;
-    /* Memory Regions for MSIX table and pending bit entries. */
-    MemoryRegion msix_table_mmio;
-    MemoryRegion msix_pba_mmio;
-    /* Reference-count for entries actually in use by driver. */
-    unsigned *msix_entry_used;
-    /* MSIX function mask set or MSIX disabled */
-    bool msix_function_masked;
-    /* Version id needed for VMState */
-    int32_t version_id;
-
-    /* Offset of MSI capability in config space */
-    uint8_t msi_cap;
-
-    /* PCI Express */
-    PCIExpressDevice exp;
-
-    /* SHPC */
-    SHPCDevice *shpc;
-
-    /* Location of option rom */
-    char *romfile;
-    uint32_t romsize;
-    bool has_rom;
-    MemoryRegion rom;
-    uint32_t rom_bar;
-
-    /* INTx routing notifier */
-    PCIINTxRoutingNotifier intx_routing_notifier;
-
-    /* MSI-X notifiers */
-    MSIVectorUseNotifier msix_vector_use_notifier;
-    MSIVectorReleaseNotifier msix_vector_release_notifier;
-    MSIVectorPollNotifier msix_vector_poll_notifier;
-
-    /* ID of standby device in net_failover pair */
-    char *failover_pair_id;
-    uint32_t acpi_index;
-};
-
 void pci_register_bar(PCIDevice *pci_dev, int region_num,
                       uint8_t attr, MemoryRegion *memory);
 void pci_register_vga(PCIDevice *pci_dev, MemoryRegion *mem,
@@ -745,11 +586,6 @@ void lsi53c8xx_handle_legacy_cmdline(DeviceState *lsi_dev);
 qemu_irq pci_allocate_irq(PCIDevice *pci_dev);
 void pci_set_irq(PCIDevice *pci_dev, int level);
 
-static inline int pci_intx(PCIDevice *pci_dev)
-{
-    return pci_get_byte(pci_dev->config + PCI_INTERRUPT_PIN) - 1;
-}
-
 static inline void pci_irq_assert(PCIDevice *pci_dev)
 {
     pci_set_irq(pci_dev, 1);
@@ -770,186 +606,6 @@ static inline void pci_irq_pulse(PCIDevice *pci_dev)
     pci_irq_deassert(pci_dev);
 }
 
-static inline int pci_is_cxl(const PCIDevice *d)
-{
-    return d->cap_present & QEMU_PCIE_CAP_CXL;
-}
-
-static inline int pci_is_express(const PCIDevice *d)
-{
-    return d->cap_present & QEMU_PCI_CAP_EXPRESS;
-}
-
-static inline int pci_is_express_downstream_port(const PCIDevice *d)
-{
-    uint8_t type;
-
-    if (!pci_is_express(d) || !d->exp.exp_cap) {
-        return 0;
-    }
-
-    type = pcie_cap_get_type(d);
-
-    return type == PCI_EXP_TYPE_DOWNSTREAM || type == PCI_EXP_TYPE_ROOT_PORT;
-}
-
-static inline int pci_is_vf(const PCIDevice *d)
-{
-    return d->exp.sriov_vf.pf != NULL;
-}
-
-static inline uint32_t pci_config_size(const PCIDevice *d)
-{
-    return pci_is_express(d) ? PCIE_CONFIG_SPACE_SIZE : PCI_CONFIG_SPACE_SIZE;
-}
-
-static inline uint16_t pci_get_bdf(PCIDevice *dev)
-{
-    return PCI_BUILD_BDF(pci_bus_num(pci_get_bus(dev)), dev->devfn);
-}
-
-uint16_t pci_requester_id(PCIDevice *dev);
-
-/* DMA access functions */
-static inline AddressSpace *pci_get_address_space(PCIDevice *dev)
-{
-    return &dev->bus_master_as;
-}
-
-/**
- * pci_dma_rw: Read from or write to an address space from PCI device.
- *
- * Return a MemTxResult indicating whether the operation succeeded
- * or failed (eg unassigned memory, device rejected the transaction,
- * IOMMU fault).
- *
- * @dev: #PCIDevice doing the memory access
- * @addr: address within the #PCIDevice address space
- * @buf: buffer with the data transferred
- * @len: the number of bytes to read or write
- * @dir: indicates the transfer direction
- */
-static inline MemTxResult pci_dma_rw(PCIDevice *dev, dma_addr_t addr,
-                                     void *buf, dma_addr_t len,
-                                     DMADirection dir, MemTxAttrs attrs)
-{
-    return dma_memory_rw(pci_get_address_space(dev), addr, buf, len,
-                         dir, attrs);
-}
-
-/**
- * pci_dma_read: Read from an address space from PCI device.
- *
- * Return a MemTxResult indicating whether the operation succeeded
- * or failed (eg unassigned memory, device rejected the transaction,
- * IOMMU fault).  Called within RCU critical section.
- *
- * @dev: #PCIDevice doing the memory access
- * @addr: address within the #PCIDevice address space
- * @buf: buffer with the data transferred
- * @len: length of the data transferred
- */
-static inline MemTxResult pci_dma_read(PCIDevice *dev, dma_addr_t addr,
-                                       void *buf, dma_addr_t len)
-{
-    return pci_dma_rw(dev, addr, buf, len,
-                      DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
-}
-
-/**
- * pci_dma_write: Write to address space from PCI device.
- *
- * Return a MemTxResult indicating whether the operation succeeded
- * or failed (eg unassigned memory, device rejected the transaction,
- * IOMMU fault).
- *
- * @dev: #PCIDevice doing the memory access
- * @addr: address within the #PCIDevice address space
- * @buf: buffer with the data transferred
- * @len: the number of bytes to write
- */
-static inline MemTxResult pci_dma_write(PCIDevice *dev, dma_addr_t addr,
-                                        const void *buf, dma_addr_t len)
-{
-    return pci_dma_rw(dev, addr, (void *) buf, len,
-                      DMA_DIRECTION_FROM_DEVICE, MEMTXATTRS_UNSPECIFIED);
-}
-
-#define PCI_DMA_DEFINE_LDST(_l, _s, _bits) \
-    static inline MemTxResult ld##_l##_pci_dma(PCIDevice *dev, \
-                                               dma_addr_t addr, \
-                                               uint##_bits##_t *val, \
-                                               MemTxAttrs attrs) \
-    { \
-        return ld##_l##_dma(pci_get_address_space(dev), addr, val, attrs); \
-    } \
-    static inline MemTxResult st##_s##_pci_dma(PCIDevice *dev, \
-                                               dma_addr_t addr, \
-                                               uint##_bits##_t val, \
-                                               MemTxAttrs attrs) \
-    { \
-        return st##_s##_dma(pci_get_address_space(dev), addr, val, attrs); \
-    }
-
-PCI_DMA_DEFINE_LDST(ub, b, 8);
-PCI_DMA_DEFINE_LDST(uw_le, w_le, 16)
-PCI_DMA_DEFINE_LDST(l_le, l_le, 32);
-PCI_DMA_DEFINE_LDST(q_le, q_le, 64);
-PCI_DMA_DEFINE_LDST(uw_be, w_be, 16)
-PCI_DMA_DEFINE_LDST(l_be, l_be, 32);
-PCI_DMA_DEFINE_LDST(q_be, q_be, 64);
-
-#undef PCI_DMA_DEFINE_LDST
-
-/**
- * pci_dma_map: Map device PCI address space range into host virtual address
- * @dev: #PCIDevice to be accessed
- * @addr: address within that device's address space
- * @plen: pointer to length of buffer; updated on return to indicate
- *        if only a subset of the requested range has been mapped
- * @dir: indicates the transfer direction
- *
- * Return: A host pointer, or %NULL if the resources needed to
- *         perform the mapping are exhausted (in that case *@plen
- *         is set to zero).
- */
-static inline void *pci_dma_map(PCIDevice *dev, dma_addr_t addr,
-                                dma_addr_t *plen, DMADirection dir)
-{
-    return dma_memory_map(pci_get_address_space(dev), addr, plen, dir,
-                          MEMTXATTRS_UNSPECIFIED);
-}
-
-static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len,
-                                 DMADirection dir, dma_addr_t access_len)
-{
-    dma_memory_unmap(pci_get_address_space(dev), buffer, len, dir, access_len);
-}
-
-static inline void pci_dma_sglist_init(QEMUSGList *qsg, PCIDevice *dev,
-                                       int alloc_hint)
-{
-    qemu_sglist_init(qsg, DEVICE(dev), alloc_hint, pci_get_address_space(dev));
-}
-
-extern const VMStateDescription vmstate_pci_device;
-
-#define VMSTATE_PCI_DEVICE(_field, _state) {                         \
-    .name       = (stringify(_field)),                               \
-    .size       = sizeof(PCIDevice),                                 \
-    .vmsd       = &vmstate_pci_device,                               \
-    .flags      = VMS_STRUCT,                                        \
-    .offset     = vmstate_offset_value(_state, _field, PCIDevice),   \
-}
-
-#define VMSTATE_PCI_DEVICE_POINTER(_field, _state) {                 \
-    .name       = (stringify(_field)),                               \
-    .size       = sizeof(PCIDevice),                                 \
-    .vmsd       = &vmstate_pci_device,                               \
-    .flags      = VMS_STRUCT | VMS_POINTER,                          \
-    .offset     = vmstate_offset_pointer(_state, _field, PCIDevice), \
-}
-
 MSIMessage pci_get_msi_message(PCIDevice *dev, int vector);
 void pci_set_power(PCIDevice *pci_dev, bool state);
 
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index 58a3fb0c2c..63a7521567 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -26,7 +26,7 @@
 #ifndef QEMU_PCI_BRIDGE_H
 #define QEMU_PCI_BRIDGE_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/cxl/cxl.h"
 #include "qom/object.h"
diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h
new file mode 100644
index 0000000000..d3dd0f64b2
--- /dev/null
+++ b/include/hw/pci/pci_device.h
@@ -0,0 +1,350 @@
+#ifndef QEMU_PCI_DEVICE_H
+#define QEMU_PCI_DEVICE_H
+
+#include "hw/pci/pci.h"
+#include "hw/pci/pcie.h"
+
+#define TYPE_PCI_DEVICE "pci-device"
+typedef struct PCIDeviceClass PCIDeviceClass;
+DECLARE_OBJ_CHECKERS(PCIDevice, PCIDeviceClass,
+                     PCI_DEVICE, TYPE_PCI_DEVICE)
+
+/*
+ * Implemented by devices that can be plugged on CXL buses. In the spec, this is
+ * actually a "CXL Component, but we name it device to match the PCI naming.
+ */
+#define INTERFACE_CXL_DEVICE "cxl-device"
+
+/* Implemented by devices that can be plugged on PCI Express buses */
+#define INTERFACE_PCIE_DEVICE "pci-express-device"
+
+/* Implemented by devices that can be plugged on Conventional PCI buses */
+#define INTERFACE_CONVENTIONAL_PCI_DEVICE "conventional-pci-device"
+
+struct PCIDeviceClass {
+    DeviceClass parent_class;
+
+    void (*realize)(PCIDevice *dev, Error **errp);
+    PCIUnregisterFunc *exit;
+    PCIConfigReadFunc *config_read;
+    PCIConfigWriteFunc *config_write;
+
+    uint16_t vendor_id;
+    uint16_t device_id;
+    uint8_t revision;
+    uint16_t class_id;
+    uint16_t subsystem_vendor_id;       /* only for header type = 0 */
+    uint16_t subsystem_id;              /* only for header type = 0 */
+
+    const char *romfile;                /* rom bar */
+};
+
+enum PCIReqIDType {
+    PCI_REQ_ID_INVALID = 0,
+    PCI_REQ_ID_BDF,
+    PCI_REQ_ID_SECONDARY_BUS,
+    PCI_REQ_ID_MAX,
+};
+typedef enum PCIReqIDType PCIReqIDType;
+
+struct PCIReqIDCache {
+    PCIDevice *dev;
+    PCIReqIDType type;
+};
+typedef struct PCIReqIDCache PCIReqIDCache;
+
+struct PCIDevice {
+    DeviceState qdev;
+    bool partially_hotplugged;
+    bool has_power;
+
+    /* PCI config space */
+    uint8_t *config;
+
+    /*
+     * Used to enable config checks on load. Note that writable bits are
+     * never checked even if set in cmask.
+     */
+    uint8_t *cmask;
+
+    /* Used to implement R/W bytes */
+    uint8_t *wmask;
+
+    /* Used to implement RW1C(Write 1 to Clear) bytes */
+    uint8_t *w1cmask;
+
+    /* Used to allocate config space for capabilities. */
+    uint8_t *used;
+
+    /* the following fields are read only */
+    int32_t devfn;
+    /*
+     * Cached device to fetch requester ID from, to avoid the PCI tree
+     * walking every time we invoke PCI request (e.g., MSI). For
+     * conventional PCI root complex, this field is meaningless.
+     */
+    PCIReqIDCache requester_id_cache;
+    char name[64];
+    PCIIORegion io_regions[PCI_NUM_REGIONS];
+    AddressSpace bus_master_as;
+    MemoryRegion bus_master_container_region;
+    MemoryRegion bus_master_enable_region;
+
+    /* do not access the following fields */
+    PCIConfigReadFunc *config_read;
+    PCIConfigWriteFunc *config_write;
+
+    /* Legacy PCI VGA regions */
+    MemoryRegion *vga_regions[QEMU_PCI_VGA_NUM_REGIONS];
+    bool has_vga;
+
+    /* Current IRQ levels.  Used internally by the generic PCI code.  */
+    uint8_t irq_state;
+
+    /* Capability bits */
+    uint32_t cap_present;
+
+    /* Offset of MSI-X capability in config space */
+    uint8_t msix_cap;
+
+    /* MSI-X entries */
+    int msix_entries_nr;
+
+    /* Space to store MSIX table & pending bit array */
+    uint8_t *msix_table;
+    uint8_t *msix_pba;
+
+    /* May be used by INTx or MSI during interrupt notification */
+    void *irq_opaque;
+
+    MSITriggerFunc *msi_trigger;
+    MSIPrepareMessageFunc *msi_prepare_message;
+    MSIxPrepareMessageFunc *msix_prepare_message;
+
+    /* MemoryRegion container for msix exclusive BAR setup */
+    MemoryRegion msix_exclusive_bar;
+    /* Memory Regions for MSIX table and pending bit entries. */
+    MemoryRegion msix_table_mmio;
+    MemoryRegion msix_pba_mmio;
+    /* Reference-count for entries actually in use by driver. */
+    unsigned *msix_entry_used;
+    /* MSIX function mask set or MSIX disabled */
+    bool msix_function_masked;
+    /* Version id needed for VMState */
+    int32_t version_id;
+
+    /* Offset of MSI capability in config space */
+    uint8_t msi_cap;
+
+    /* PCI Express */
+    PCIExpressDevice exp;
+
+    /* SHPC */
+    SHPCDevice *shpc;
+
+    /* Location of option rom */
+    char *romfile;
+    uint32_t romsize;
+    bool has_rom;
+    MemoryRegion rom;
+    uint32_t rom_bar;
+
+    /* INTx routing notifier */
+    PCIINTxRoutingNotifier intx_routing_notifier;
+
+    /* MSI-X notifiers */
+    MSIVectorUseNotifier msix_vector_use_notifier;
+    MSIVectorReleaseNotifier msix_vector_release_notifier;
+    MSIVectorPollNotifier msix_vector_poll_notifier;
+
+    /* ID of standby device in net_failover pair */
+    char *failover_pair_id;
+    uint32_t acpi_index;
+};
+
+static inline int pci_intx(PCIDevice *pci_dev)
+{
+    return pci_get_byte(pci_dev->config + PCI_INTERRUPT_PIN) - 1;
+}
+
+static inline int pci_is_cxl(const PCIDevice *d)
+{
+    return d->cap_present & QEMU_PCIE_CAP_CXL;
+}
+
+static inline int pci_is_express(const PCIDevice *d)
+{
+    return d->cap_present & QEMU_PCI_CAP_EXPRESS;
+}
+
+static inline int pci_is_express_downstream_port(const PCIDevice *d)
+{
+    uint8_t type;
+
+    if (!pci_is_express(d) || !d->exp.exp_cap) {
+        return 0;
+    }
+
+    type = pcie_cap_get_type(d);
+
+    return type == PCI_EXP_TYPE_DOWNSTREAM || type == PCI_EXP_TYPE_ROOT_PORT;
+}
+
+static inline int pci_is_vf(const PCIDevice *d)
+{
+    return d->exp.sriov_vf.pf != NULL;
+}
+
+static inline uint32_t pci_config_size(const PCIDevice *d)
+{
+    return pci_is_express(d) ? PCIE_CONFIG_SPACE_SIZE : PCI_CONFIG_SPACE_SIZE;
+}
+
+static inline uint16_t pci_get_bdf(PCIDevice *dev)
+{
+    return PCI_BUILD_BDF(pci_bus_num(pci_get_bus(dev)), dev->devfn);
+}
+
+uint16_t pci_requester_id(PCIDevice *dev);
+
+/* DMA access functions */
+static inline AddressSpace *pci_get_address_space(PCIDevice *dev)
+{
+    return &dev->bus_master_as;
+}
+
+/**
+ * pci_dma_rw: Read from or write to an address space from PCI device.
+ *
+ * Return a MemTxResult indicating whether the operation succeeded
+ * or failed (eg unassigned memory, device rejected the transaction,
+ * IOMMU fault).
+ *
+ * @dev: #PCIDevice doing the memory access
+ * @addr: address within the #PCIDevice address space
+ * @buf: buffer with the data transferred
+ * @len: the number of bytes to read or write
+ * @dir: indicates the transfer direction
+ */
+static inline MemTxResult pci_dma_rw(PCIDevice *dev, dma_addr_t addr,
+                                     void *buf, dma_addr_t len,
+                                     DMADirection dir, MemTxAttrs attrs)
+{
+    return dma_memory_rw(pci_get_address_space(dev), addr, buf, len,
+                         dir, attrs);
+}
+
+/**
+ * pci_dma_read: Read from an address space from PCI device.
+ *
+ * Return a MemTxResult indicating whether the operation succeeded
+ * or failed (eg unassigned memory, device rejected the transaction,
+ * IOMMU fault).  Called within RCU critical section.
+ *
+ * @dev: #PCIDevice doing the memory access
+ * @addr: address within the #PCIDevice address space
+ * @buf: buffer with the data transferred
+ * @len: length of the data transferred
+ */
+static inline MemTxResult pci_dma_read(PCIDevice *dev, dma_addr_t addr,
+                                       void *buf, dma_addr_t len)
+{
+    return pci_dma_rw(dev, addr, buf, len,
+                      DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
+}
+
+/**
+ * pci_dma_write: Write to address space from PCI device.
+ *
+ * Return a MemTxResult indicating whether the operation succeeded
+ * or failed (eg unassigned memory, device rejected the transaction,
+ * IOMMU fault).
+ *
+ * @dev: #PCIDevice doing the memory access
+ * @addr: address within the #PCIDevice address space
+ * @buf: buffer with the data transferred
+ * @len: the number of bytes to write
+ */
+static inline MemTxResult pci_dma_write(PCIDevice *dev, dma_addr_t addr,
+                                        const void *buf, dma_addr_t len)
+{
+    return pci_dma_rw(dev, addr, (void *) buf, len,
+                      DMA_DIRECTION_FROM_DEVICE, MEMTXATTRS_UNSPECIFIED);
+}
+
+#define PCI_DMA_DEFINE_LDST(_l, _s, _bits) \
+    static inline MemTxResult ld##_l##_pci_dma(PCIDevice *dev, \
+                                               dma_addr_t addr, \
+                                               uint##_bits##_t *val, \
+                                               MemTxAttrs attrs) \
+    { \
+        return ld##_l##_dma(pci_get_address_space(dev), addr, val, attrs); \
+    } \
+    static inline MemTxResult st##_s##_pci_dma(PCIDevice *dev, \
+                                               dma_addr_t addr, \
+                                               uint##_bits##_t val, \
+                                               MemTxAttrs attrs) \
+    { \
+        return st##_s##_dma(pci_get_address_space(dev), addr, val, attrs); \
+    }
+
+PCI_DMA_DEFINE_LDST(ub, b, 8);
+PCI_DMA_DEFINE_LDST(uw_le, w_le, 16)
+PCI_DMA_DEFINE_LDST(l_le, l_le, 32);
+PCI_DMA_DEFINE_LDST(q_le, q_le, 64);
+PCI_DMA_DEFINE_LDST(uw_be, w_be, 16)
+PCI_DMA_DEFINE_LDST(l_be, l_be, 32);
+PCI_DMA_DEFINE_LDST(q_be, q_be, 64);
+
+#undef PCI_DMA_DEFINE_LDST
+
+/**
+ * pci_dma_map: Map device PCI address space range into host virtual address
+ * @dev: #PCIDevice to be accessed
+ * @addr: address within that device's address space
+ * @plen: pointer to length of buffer; updated on return to indicate
+ *        if only a subset of the requested range has been mapped
+ * @dir: indicates the transfer direction
+ *
+ * Return: A host pointer, or %NULL if the resources needed to
+ *         perform the mapping are exhausted (in that case *@plen
+ *         is set to zero).
+ */
+static inline void *pci_dma_map(PCIDevice *dev, dma_addr_t addr,
+                                dma_addr_t *plen, DMADirection dir)
+{
+    return dma_memory_map(pci_get_address_space(dev), addr, plen, dir,
+                          MEMTXATTRS_UNSPECIFIED);
+}
+
+static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len,
+                                 DMADirection dir, dma_addr_t access_len)
+{
+    dma_memory_unmap(pci_get_address_space(dev), buffer, len, dir, access_len);
+}
+
+static inline void pci_dma_sglist_init(QEMUSGList *qsg, PCIDevice *dev,
+                                       int alloc_hint)
+{
+    qemu_sglist_init(qsg, DEVICE(dev), alloc_hint, pci_get_address_space(dev));
+}
+
+extern const VMStateDescription vmstate_pci_device;
+
+#define VMSTATE_PCI_DEVICE(_field, _state) {                         \
+    .name       = (stringify(_field)),                               \
+    .size       = sizeof(PCIDevice),                                 \
+    .vmsd       = &vmstate_pci_device,                               \
+    .flags      = VMS_STRUCT,                                        \
+    .offset     = vmstate_offset_value(_state, _field, PCIDevice),   \
+}
+
+#define VMSTATE_PCI_DEVICE_POINTER(_field, _state) {                 \
+    .name       = (stringify(_field)),                               \
+    .size       = sizeof(PCIDevice),                                 \
+    .vmsd       = &vmstate_pci_device,                               \
+    .flags      = VMS_STRUCT | VMS_POINTER,                          \
+    .offset     = vmstate_offset_pointer(_state, _field, PCIDevice), \
+}
+
+#endif
diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h
index d9b5d07504..fd484afb30 100644
--- a/include/hw/pci/pcie_port.h
+++ b/include/hw/pci/pcie_port.h
@@ -23,6 +23,7 @@
 
 #include "hw/pci/pci_bridge.h"
 #include "hw/pci/pci_bus.h"
+#include "hw/pci/pci_device.h"
 #include "qom/object.h"
 
 #define TYPE_PCIE_PORT "pcie-port"
diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h
index d5683b7399..89c7a3b7fa 100644
--- a/include/hw/pci/shpc.h
+++ b/include/hw/pci/shpc.h
@@ -3,7 +3,7 @@
 
 #include "exec/memory.h"
 #include "hw/hotplug.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "migration/vmstate.h"
 
 struct SHPCDevice {
diff --git a/include/hw/remote/iohub.h b/include/hw/remote/iohub.h
index 0bf98e0d78..6a8444f9a9 100644
--- a/include/hw/remote/iohub.h
+++ b/include/hw/remote/iohub.h
@@ -11,7 +11,7 @@
 #ifndef REMOTE_IOHUB_H
 #define REMOTE_IOHUB_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "qemu/event_notifier.h"
 #include "qemu/thread-posix.h"
 #include "hw/remote/mpqemu-link.h"
diff --git a/include/hw/remote/proxy.h b/include/hw/remote/proxy.h
index 741def71f1..0cfd9665be 100644
--- a/include/hw/remote/proxy.h
+++ b/include/hw/remote/proxy.h
@@ -9,7 +9,7 @@
 #ifndef PROXY_H
 #define PROXY_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "io/channel.h"
 #include "hw/remote/proxy-memory-listener.h"
 #include "qemu/event_notifier.h"
diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index a989fca3b2..6cd2822f1d 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -25,7 +25,7 @@
 #ifndef SDHCI_H
 #define SDHCI_H
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/sysbus.h"
 #include "hw/sd/sd.h"
 #include "qom/object.h"
diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
index 2693778b23..0bf48e936d 100644
--- a/include/hw/southbridge/piix.h
+++ b/include/hw/southbridge/piix.h
@@ -12,8 +12,7 @@
 #ifndef HW_SOUTHBRIDGE_PIIX_H
 #define HW_SOUTHBRIDGE_PIIX_H
 
-#include "hw/pci/pci.h"
-#include "qom/object.h"
+#include "hw/pci/pci_device.h"
 
 /* PIRQRC[A:D]: PIRQx Route Control Registers */
 #define PIIX_PIRQCA 0x60
diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
index 77ce17d8a4..9a13a756ae 100644
--- a/include/hw/xen/xen_common.h
+++ b/include/hw/xen/xen_common.h
@@ -15,7 +15,7 @@
 #include "hw/xen/interface/io/xenbus.h"
 
 #include "hw/xen/xen.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/xen/trace.h"
 
 extern xc_interface *xen_xc;
diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c
index aefcc03ad6..35007d8017 100644
--- a/hw/acpi/erst.c
+++ b/hw/acpi/erst.c
@@ -14,7 +14,7 @@
 #include "hw/qdev-core.h"
 #include "exec/memory.h"
 #include "qom/object.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "qom/object_interfaces.h"
 #include "qemu/error-report.h"
 #include "migration/vmstate.h"
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index be2dd701a4..364cdfa733 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -20,7 +20,7 @@
 #include "qemu/osdep.h"
 #include "hw/audio/soundhw.h"
 #include "audio/audio.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 6904589814..54cc19a637 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -29,7 +29,7 @@
 #include "qemu/osdep.h"
 #include "hw/audio/soundhw.h"
 #include "audio/audio.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "sysemu/dma.h"
diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c
index 6d556f74fc..d1a856f63d 100644
--- a/hw/audio/via-ac97.c
+++ b/hw/audio/via-ac97.c
@@ -11,7 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/isa/vt82c686.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 
 static void via_ac97_realize(PCIDevice *pci_dev, Error **errp)
 {
diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c
index 3a9f96c2d1..f18b8dcce5 100644
--- a/hw/char/serial-pci-multi.c
+++ b/hw/char/serial-pci-multi.c
@@ -31,7 +31,7 @@
 #include "qapi/error.h"
 #include "hw/char/serial.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
 #include "migration/vmstate.h"
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index 93d6f99244..801b769aba 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -30,7 +30,7 @@
 #include "qemu/module.h"
 #include "hw/char/serial.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "qom/object.h"
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 97a968f477..54a09fa9ac 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -32,6 +32,7 @@
 #include "sysemu/blockdev.h"
 #include "net/net.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pcie.h"
 #include "util/block-helpers.h"
 
 static bool check_prop_still_unset(Object *obj, const char *name,
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index 8ed734b195..e7ec268184 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -8,7 +8,7 @@
 #include "qemu/osdep.h"
 #include "qemu/module.h"
 #include "qemu/units.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "hw/display/bochs-vbe.h"
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 6e8c747c46..55c32e3e40 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -39,7 +39,7 @@
 #include "sysemu/reset.h"
 #include "qapi/error.h"
 #include "trace.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "ui/pixel_ops.h"
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 663c37e7f2..52e42585af 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -32,7 +32,7 @@
 #include "ui/console.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "hw/i2c/i2c.h"
 #include "hw/display/i2c-ddc.h"
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index df23dbf3a0..b351b8f299 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -25,7 +25,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "vga_int.h"
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 53949d2539..59ae7f74b8 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -29,7 +29,7 @@
 #include "qemu/log.h"
 #include "hw/loader.h"
 #include "trace.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "qom/object.h"
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index 1ea95fa601..e62e06622b 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -32,7 +32,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "trace.h"
diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c
index 1f764fc85b..6b3edbf017 100644
--- a/hw/ipack/tpci200.c
+++ b/hw/ipack/tpci200.c
@@ -12,7 +12,7 @@
 #include "qemu/units.h"
 #include "hw/ipack/ipack.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "migration/vmstate.h"
 #include "qemu/bitops.h"
 #include "qemu/module.h"
diff --git a/hw/ipmi/pci_ipmi_bt.c b/hw/ipmi/pci_ipmi_bt.c
index b6e52730d3..633931b825 100644
--- a/hw/ipmi/pci_ipmi_bt.c
+++ b/hw/ipmi/pci_ipmi_bt.c
@@ -25,7 +25,7 @@
 #include "migration/vmstate.h"
 #include "qapi/error.h"
 #include "hw/ipmi/ipmi_bt.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "qom/object.h"
 
 #define TYPE_PCI_IPMI_BT "pci-ipmi-bt"
diff --git a/hw/ipmi/pci_ipmi_kcs.c b/hw/ipmi/pci_ipmi_kcs.c
index de13418862..1a581413c2 100644
--- a/hw/ipmi/pci_ipmi_kcs.c
+++ b/hw/ipmi/pci_ipmi_kcs.c
@@ -25,7 +25,7 @@
 #include "migration/vmstate.h"
 #include "qapi/error.h"
 #include "hw/ipmi/ipmi_kcs.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "qom/object.h"
 
 #define TYPE_PCI_IPMI_KCS "pci-ipmi-kcs"
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 2a2ff05b93..e3322e03bf 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -18,7 +18,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/irq.h"
 #include "hw/intc/i8259.h"
 #include "hw/timer/i8254.h"
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 19d0d9889f..164866cf3e 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -26,7 +26,7 @@
 #include "qapi/error.h"
 #include "qemu/units.h"
 #include "qemu/log.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "migration/vmstate.h"
 #include "hw/intc/i8259.h"
diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index 03845c8de3..49303134e4 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -19,7 +19,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "qemu/event_notifier.h"
 #include "qemu/module.h"
diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
index 99cf7e2041..fbcaa50731 100644
--- a/hw/misc/pvpanic-pci.c
+++ b/hw/misc/pvpanic-pci.c
@@ -20,7 +20,7 @@
 #include "migration/vmstate.h"
 #include "hw/misc/pvpanic.h"
 #include "qom/object.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "standard-headers/linux/pvpanic.h"
 
 OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE)
diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c
index 94b3a534f8..2cd90cef1e 100644
--- a/hw/net/can/can_kvaser_pci.c
+++ b/hw/net/can/can_kvaser_pci.c
@@ -37,7 +37,7 @@
 #include "qapi/error.h"
 #include "chardev/char.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/can_emu.h"
diff --git a/hw/net/can/can_mioe3680_pci.c b/hw/net/can/can_mioe3680_pci.c
index 29dc696f7c..b9918773b3 100644
--- a/hw/net/can/can_mioe3680_pci.c
+++ b/hw/net/can/can_mioe3680_pci.c
@@ -33,7 +33,7 @@
 #include "qapi/error.h"
 #include "chardev/char.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/can_emu.h"
diff --git a/hw/net/can/can_pcm3680_pci.c b/hw/net/can/can_pcm3680_pci.c
index e8e57f4f33..8ef3e4659c 100644
--- a/hw/net/can/can_pcm3680_pci.c
+++ b/hw/net/can/can_pcm3680_pci.c
@@ -33,7 +33,7 @@
 #include "qapi/error.h"
 #include "chardev/char.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/can_emu.h"
diff --git a/hw/net/can/ctucan_pci.c b/hw/net/can/ctucan_pci.c
index 50f4ea6cd6..ea079e2af5 100644
--- a/hw/net/can/ctucan_pci.c
+++ b/hw/net/can/ctucan_pci.c
@@ -34,7 +34,7 @@
 #include "qapi/error.h"
 #include "chardev/char.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/can_emu.h"
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index e26e0a64c1..7efb8a4c52 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -26,7 +26,7 @@
 
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/eth.h"
diff --git a/hw/net/e1000x_common.c b/hw/net/e1000x_common.c
index a8d93870b5..2f43e8cd13 100644
--- a/hw/net/e1000x_common.c
+++ b/hw/net/e1000x_common.c
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/units.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "net/net.h"
 
 #include "e1000x_common.h"
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index 679f52f80f..dc07984ae9 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -42,7 +42,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/units.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/net.h"
diff --git a/hw/net/ne2000-pci.c b/hw/net/ne2000-pci.c
index 9e5d10859a..edc6689d33 100644
--- a/hw/net/ne2000-pci.c
+++ b/hw/net/ne2000-pci.c
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "ne2000.h"
diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
index 1cb1125d9f..2533ea2700 100644
--- a/hw/net/net_tx_pkt.c
+++ b/hw/net/net_tx_pkt.c
@@ -21,7 +21,7 @@
 #include "net/checksum.h"
 #include "net/tap.h"
 #include "net/net.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 
 enum {
     NET_TX_PKT_VHDR_FRAG = 0,
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 95d27102aa..96a302c141 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -29,7 +29,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "net/net.h"
diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
index 281d43e6cf..cf54ddf49d 100644
--- a/hw/net/rocker/rocker.c
+++ b/hw/net/rocker/rocker.c
@@ -16,7 +16,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-properties-system.h"
 #include "migration/vmstate.h"
diff --git a/hw/net/rocker/rocker_desc.c b/hw/net/rocker/rocker_desc.c
index 01845f1157..f3068c9250 100644
--- a/hw/net/rocker/rocker_desc.c
+++ b/hw/net/rocker/rocker_desc.c
@@ -16,7 +16,7 @@
 
 #include "qemu/osdep.h"
 #include "net/net.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 
 #include "rocker.h"
 #include "rocker_hw.h"
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 700b1b66b6..5a5aaf868d 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -53,7 +53,7 @@
 #include "qemu/osdep.h"
 #include <zlib.h>
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "sysemu/dma.h"
diff --git a/hw/net/sungem.c b/hw/net/sungem.c
index 3684a4d733..eb01520790 100644
--- a/hw/net/sungem.c
+++ b/hw/net/sungem.c
@@ -8,7 +8,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "qemu/log.h"
diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c
index fc34905f87..1f3d8011ae 100644
--- a/hw/net/sunhme.c
+++ b/hw/net/sunhme.c
@@ -23,7 +23,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
 #include "hw/net/mii.h"
diff --git a/hw/net/tulip.c b/hw/net/tulip.c
index c2b3b1bdfa..915e5fb595 100644
--- a/hw/net/tulip.c
+++ b/hw/net/tulip.c
@@ -9,7 +9,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/qdev-properties.h"
 #include "hw/nvram/eeprom93xx.h"
 #include "migration/vmstate.h"
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index f191e3037f..3ae909041a 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -42,7 +42,7 @@
 #include "sysemu/sysemu.h"
 #include "trace.h"
 #include "monitor/qdev.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "net_rx_pkt.h"
 #include "hw/virtio/vhost.h"
 #include "sysemu/qtest.h"
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index a57e81e3a9..f04f3ad668 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -42,7 +42,7 @@
 #include "qemu/units.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/irq.h"
 #include "hw/mips/mips.h"
 #include "hw/pci/pci_host.h"
diff --git a/hw/pci-host/dino.c b/hw/pci-host/dino.c
index f257c24e64..e8eaebca54 100644
--- a/hw/pci-host/dino.c
+++ b/hw/pci-host/dino.c
@@ -15,7 +15,7 @@
 #include "qemu/units.h"
 #include "qapi/error.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/qdev-properties.h"
 #include "hw/pci-host/dino.h"
diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index 95945ac0f4..8cf318cb80 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -25,7 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/qdev-properties.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/irq.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
diff --git a/hw/pci-host/mv64361.c b/hw/pci-host/mv64361.c
index cc9c4d6d3b..015b92bd5f 100644
--- a/hw/pci-host/mv64361.c
+++ b/hw/pci-host/mv64361.c
@@ -13,7 +13,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "hw/irq.h"
 #include "hw/intc/i8259.h"
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index 89c1b53dd7..568849e930 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -19,7 +19,7 @@
 #include "hw/ppc/e500-ccsr.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "qemu/bswap.h"
 #include "qemu/module.h"
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 7a105e4a63..2c96ddf8fe 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -28,7 +28,7 @@
 #include "qemu/units.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "hw/qdev-properties.h"
diff --git a/hw/pci-host/sh_pci.c b/hw/pci-host/sh_pci.c
index 719d6ca2a6..77e7bbc65f 100644
--- a/hw/pci-host/sh_pci.c
+++ b/hw/pci-host/sh_pci.c
@@ -26,7 +26,7 @@
 #include "hw/sysbus.h"
 #include "hw/sh4/sh.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "qemu/bswap.h"
 #include "qemu/module.h"
diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 8396c91d59..e3abe3c0f9 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -26,7 +26,7 @@
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "qemu/module.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "hw/pci-host/uninorth.h"
 #include "trace.h"
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index f66384fa02..0d50ea4cc0 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -12,7 +12,7 @@
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "hw/qdev-properties.h"
diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c
index fb7591d6ab..b09fce9377 100644
--- a/hw/pci/pci-hmp-cmds.c
+++ b/hw/pci/pci-hmp-cmds.c
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "monitor/hmp.h"
 #include "monitor/monitor.h"
 #include "pci-internal.h"
diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
index 5abbe83220..3717e1a086 100644
--- a/hw/pci/pcie_host.c
+++ b/hw/pci/pcie_host.c
@@ -20,7 +20,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pcie_host.h"
 #include "qemu/module.h"
 
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index 8e3faf1f59..f0bd72e069 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pcie.h"
 #include "hw/pci/pci_bus.h"
 #include "hw/qdev-properties.h"
diff --git a/hw/pci/slotid_cap.c b/hw/pci/slotid_cap.c
index 36d021b4a6..8372d05d9e 100644
--- a/hw/pci/slotid_cap.c
+++ b/hw/pci/slotid_cap.c
@@ -1,6 +1,6 @@
 #include "qemu/osdep.h"
 #include "hw/pci/slotid_cap.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 
diff --git a/hw/ppc/ppc440_pcix.c b/hw/ppc/ppc440_pcix.c
index 788d25514a..f10f93c533 100644
--- a/hw/ppc/ppc440_pcix.c
+++ b/hw/ppc/ppc440_pcix.c
@@ -26,7 +26,7 @@
 #include "hw/irq.h"
 #include "hw/ppc/ppc.h"
 #include "hw/ppc/ppc4xx.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "trace.h"
 #include "qom/object.h"
diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
index 8642b96455..1d4a50fa7c 100644
--- a/hw/ppc/ppc4xx_pci.c
+++ b/hw/ppc/ppc4xx_pci.c
@@ -29,7 +29,7 @@
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_host.h"
 #include "trace.h"
 #include "qom/object.h"
diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c
index 2a76b4e0b5..d8aeee0b7e 100644
--- a/hw/ppc/spapr_pci_vfio.c
+++ b/hw/ppc/spapr_pci_vfio.c
@@ -22,6 +22,7 @@
 #include "hw/ppc/spapr.h"
 #include "hw/pci-host/spapr.h"
 #include "hw/pci/msix.h"
+#include "hw/pci/pci_device.h"
 #include "hw/vfio/vfio.h"
 #include "qemu/error-report.h"
 
diff --git a/hw/rdma/rdma_utils.c b/hw/rdma/rdma_utils.c
index 77008552f4..c948baf052 100644
--- a/hw/rdma/rdma_utils.c
+++ b/hw/rdma/rdma_utils.c
@@ -14,7 +14,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "trace.h"
 #include "rdma_utils.h"
 
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 9abe95130c..69137e0757 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -16,6 +16,7 @@
 #include "exec/memory-internal.h"
 #include "qemu/error-report.h"
 #include "sysemu/hw_accel.h"
+#include "hw/pci/pci_device.h"
 #include "hw/s390x/s390-pci-inst.h"
 #include "hw/s390x/s390-pci-bus.h"
 #include "hw/s390x/s390-pci-kvm.h"
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 1792f84cea..2f7f11e70b 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -24,7 +24,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/irq.h"
 #include "hw/nvram/eeprom93xx.h"
 #include "hw/scsi/esp.h"
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 50979640c3..af93557a9a 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -16,7 +16,7 @@
 #include "qemu/osdep.h"
 
 #include "hw/irq.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/scsi/scsi.h"
 #include "migration/vmstate.h"
 #include "sysemu/dma.h"
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index b4243de735..4869566cf5 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -28,6 +28,7 @@
 #include "hw/loader.h"
 #include "hw/boards.h"
 #include "hw/pci/pci_bus.h"
+#include "hw/pci/pci_device.h"
 #include "smbios_build.h"
 
 /* legacy structures and constants for <= 2.0 machines */
diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c
index 8e1146b862..6b630d35a7 100644
--- a/hw/usb/hcd-ohci-pci.c
+++ b/hw/usb/hcd-ohci-pci.c
@@ -23,7 +23,7 @@
 #include "qemu/timer.h"
 #include "hw/usb.h"
 #include "migration/vmstate.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/sysbus.h"
 #include "hw/qdev-dma.h"
 #include "hw/qdev-properties.h"
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 5693ec6a09..54c167cd35 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -24,7 +24,7 @@
 #include "qemu/module.h"
 #include "qemu/timer.h"
 #include "sysemu/watchdog.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "migration/vmstate.h"
 #include "qom/object.h"
 
diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index afc1d20355..7326f6840b 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -24,6 +24,7 @@
 #include "exec/ramblock.h"
 #include "hw/qdev-core.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/boards.h"
 #include "generic_fuzz_configs.h"
 #include "hw/mem/sparse-mem.h"
diff --git a/ui/util.c b/ui/util.c
index 907d60e032..d54bbb74fb 100644
--- a/ui/util.c
+++ b/ui/util.c
@@ -17,7 +17,7 @@
 
 #include "qemu/osdep.h"
 
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_device.h"
 #include "hw/pci/pci_bus.h"
 #include "qapi/error.h"
 #include "ui/console.h"
-- 
MST



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

* [PULL 34/51] include/hw/virtio: Break inclusion loop
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (29 preceding siblings ...)
  2023-01-05  9:15 ` [PULL 31/51] include/hw/pci: Split pci_device.h off pci.h Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 35/51] include: Include headers where needed Michael S. Tsirkin
                   ` (21 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Philippe Mathieu-Daudé,
	Alistair Francis, Stefano Garzarella, Jason Wang,
	Edgar E . Iglesias

From: Markus Armbruster <armbru@redhat.com>

hw/virtio/virtio.h and hw/virtio/vhost.h include each other.  The
former doesn't actually need the latter, so drop that inclusion to
break the loop.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20221222120813.727830-2-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
---
 hw/virtio/virtio-qmp.h     | 1 +
 include/hw/virtio/virtio.h | 1 -
 hw/virtio/virtio.c         | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-qmp.h b/hw/virtio/virtio-qmp.h
index 59681082e5..8af5f5e65a 100644
--- a/hw/virtio/virtio-qmp.h
+++ b/hw/virtio/virtio-qmp.h
@@ -13,6 +13,7 @@
 
 #include "qapi/qapi-types-virtio.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
 
 #include "qemu/queue.h"
 
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 4219968fd8..77c6c55929 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -22,7 +22,6 @@
 #include "standard-headers/linux/virtio_config.h"
 #include "standard-headers/linux/virtio_ring.h"
 #include "qom/object.h"
-#include "hw/virtio/vhost.h"
 
 /*
  * A guest should never accept this. It implies negotiation is broken
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 02a49d9fa1..f35178f5fc 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -22,6 +22,7 @@
 #include "qom/object_interfaces.h"
 #include "hw/core/cpu.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost.h"
 #include "migration/qemu-file-types.h"
 #include "qemu/atomic.h"
 #include "hw/virtio/virtio-bus.h"
-- 
MST



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

* [PULL 35/51] include: Include headers where needed
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (30 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 34/51] include/hw/virtio: Break inclusion loop Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 36/51] include: Don't include qemu/osdep.h Michael S. Tsirkin
                   ` (20 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Alistair Francis,
	Igor Mammedov, Ani Sinha, Laurent Vivier, Edgar E. Iglesias,
	Bin Meng, Palmer Dabbelt, Marcel Apfelbaum, Xiaojuan Yang,
	Song Gao, Richard Henderson, Helge Deller, Jason Wang,
	Vikram Garhwal, Francisco Iglesias, Cédric Le Goater,
	Gerd Hoffmann, Marc-André Lureau, Riku Voipio, qemu-arm,
	qemu-riscv, qemu-ppc

From: Markus Armbruster <armbru@redhat.com>

A number of headers neglect to include everything they need.  They
compile only if the headers they need are already included from
elsewhere.  Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20221222120813.727830-3-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/exec/plugin-gen.h                   | 1 +
 include/hw/acpi/erst.h                      | 3 +++
 include/hw/char/cmsdk-apb-uart.h            | 1 +
 include/hw/char/goldfish_tty.h              | 1 +
 include/hw/char/xilinx_uartlite.h           | 1 +
 include/hw/cris/etraxfs.h                   | 1 +
 include/hw/display/macfb.h                  | 3 ++-
 include/hw/dma/sifive_pdma.h                | 2 ++
 include/hw/i386/ioapic_internal.h           | 1 +
 include/hw/i386/sgx-epc.h                   | 1 +
 include/hw/intc/goldfish_pic.h              | 2 ++
 include/hw/intc/loongarch_pch_msi.h         | 2 ++
 include/hw/intc/loongarch_pch_pic.h         | 2 ++
 include/hw/intc/nios2_vic.h                 | 2 ++
 include/hw/misc/mchp_pfsoc_dmc.h            | 2 ++
 include/hw/misc/mchp_pfsoc_ioscb.h          | 2 ++
 include/hw/misc/mchp_pfsoc_sysreg.h         | 2 ++
 include/hw/misc/pvpanic.h                   | 1 +
 include/hw/misc/sifive_e_prci.h             | 3 ++-
 include/hw/misc/sifive_u_otp.h              | 3 ++-
 include/hw/misc/sifive_u_prci.h             | 3 ++-
 include/hw/misc/virt_ctrl.h                 | 2 ++
 include/hw/misc/xlnx-versal-pmc-iou-slcr.h  | 1 +
 include/hw/net/lasi_82596.h                 | 2 +-
 include/hw/net/xlnx-zynqmp-can.h            | 1 +
 include/hw/ppc/pnv_psi.h                    | 2 +-
 include/hw/riscv/boot_opensbi.h             | 2 ++
 include/hw/riscv/microchip_pfsoc.h          | 3 +++
 include/hw/riscv/numa.h                     | 1 +
 include/hw/riscv/sifive_u.h                 | 2 ++
 include/hw/riscv/spike.h                    | 2 +-
 include/hw/riscv/virt.h                     | 2 +-
 include/hw/ssi/sifive_spi.h                 | 3 +++
 include/hw/timer/sse-timer.h                | 1 +
 include/hw/usb/hcd-dwc3.h                   | 1 +
 include/hw/usb/hcd-musb.h                   | 2 ++
 include/hw/usb/xlnx-usb-subsystem.h         | 2 ++
 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h | 3 +++
 include/hw/virtio/virtio-mmio.h             | 2 +-
 include/qemu/plugin-memory.h                | 3 +++
 include/sysemu/dirtyrate.h                  | 2 ++
 include/sysemu/dump.h                       | 1 +
 include/user/syscall-trace.h                | 1 +
 43 files changed, 71 insertions(+), 9 deletions(-)

diff --git a/include/exec/plugin-gen.h b/include/exec/plugin-gen.h
index 5004728c61..5f5506f1cc 100644
--- a/include/exec/plugin-gen.h
+++ b/include/exec/plugin-gen.h
@@ -12,6 +12,7 @@
 #ifndef QEMU_PLUGIN_GEN_H
 #define QEMU_PLUGIN_GEN_H
 
+#include "exec/cpu_ldst.h"
 #include "qemu/plugin.h"
 #include "tcg/tcg.h"
 
diff --git a/include/hw/acpi/erst.h b/include/hw/acpi/erst.h
index b747fe7739..b2ff663ddc 100644
--- a/include/hw/acpi/erst.h
+++ b/include/hw/acpi/erst.h
@@ -11,6 +11,9 @@
 #ifndef HW_ACPI_ERST_H
 #define HW_ACPI_ERST_H
 
+#include "hw/acpi/bios-linker-loader.h"
+#include "qom/object.h"
+
 void build_erst(GArray *table_data, BIOSLinker *linker, Object *erst_dev,
                 const char *oem_id, const char *oem_table_id);
 
diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h
index 9daff0eeee..64b0a3d534 100644
--- a/include/hw/char/cmsdk-apb-uart.h
+++ b/include/hw/char/cmsdk-apb-uart.h
@@ -15,6 +15,7 @@
 #include "hw/qdev-properties.h"
 #include "hw/sysbus.h"
 #include "chardev/char-fe.h"
+#include "qapi/error.h"
 #include "qom/object.h"
 
 #define TYPE_CMSDK_APB_UART "cmsdk-apb-uart"
diff --git a/include/hw/char/goldfish_tty.h b/include/hw/char/goldfish_tty.h
index 7503d2fa1e..d59733e5ae 100644
--- a/include/hw/char/goldfish_tty.h
+++ b/include/hw/char/goldfish_tty.h
@@ -12,6 +12,7 @@
 
 #include "qemu/fifo8.h"
 #include "chardev/char-fe.h"
+#include "hw/sysbus.h"
 
 #define TYPE_GOLDFISH_TTY "goldfish_tty"
 OBJECT_DECLARE_SIMPLE_TYPE(GoldfishTTYState, GOLDFISH_TTY)
diff --git a/include/hw/char/xilinx_uartlite.h b/include/hw/char/xilinx_uartlite.h
index bb32d0fcb3..dd09c06801 100644
--- a/include/hw/char/xilinx_uartlite.h
+++ b/include/hw/char/xilinx_uartlite.h
@@ -17,6 +17,7 @@
 
 #include "hw/qdev-properties.h"
 #include "hw/sysbus.h"
+#include "qapi/error.h"
 
 static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
                                         qemu_irq irq,
diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h
index 8b01ed67d3..467b529dc0 100644
--- a/include/hw/cris/etraxfs.h
+++ b/include/hw/cris/etraxfs.h
@@ -29,6 +29,7 @@
 #include "hw/cris/etraxfs_dma.h"
 #include "hw/qdev-properties.h"
 #include "hw/sysbus.h"
+#include "qapi/error.h"
 
 DeviceState *etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr,
                               struct etraxfs_dma_client *dma_out,
diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h
index 55a50d3fb0..27cebefc9e 100644
--- a/include/hw/display/macfb.h
+++ b/include/hw/display/macfb.h
@@ -15,9 +15,10 @@
 
 #include "exec/memory.h"
 #include "hw/irq.h"
+#include "hw/nubus/nubus.h"
+#include "hw/sysbus.h"
 #include "ui/console.h"
 #include "qemu/timer.h"
-#include "qom/object.h"
 
 typedef enum  {
     MACFB_DISPLAY_APPLE_21_COLOR = 0,
diff --git a/include/hw/dma/sifive_pdma.h b/include/hw/dma/sifive_pdma.h
index e319bbd6c4..8c6cfa7f32 100644
--- a/include/hw/dma/sifive_pdma.h
+++ b/include/hw/dma/sifive_pdma.h
@@ -23,6 +23,8 @@
 #ifndef SIFIVE_PDMA_H
 #define SIFIVE_PDMA_H
 
+#include "hw/sysbus.h"
+
 struct sifive_pdma_chan {
     uint32_t control;
     uint32_t next_config;
diff --git a/include/hw/i386/ioapic_internal.h b/include/hw/i386/ioapic_internal.h
index 9880443cc7..e8ff338d7f 100644
--- a/include/hw/i386/ioapic_internal.h
+++ b/include/hw/i386/ioapic_internal.h
@@ -23,6 +23,7 @@
 #define QEMU_IOAPIC_INTERNAL_H
 
 #include "exec/memory.h"
+#include "hw/i386/ioapic.h"
 #include "hw/sysbus.h"
 #include "qemu/notify.h"
 #include "qom/object.h"
diff --git a/include/hw/i386/sgx-epc.h b/include/hw/i386/sgx-epc.h
index 581fac389a..3e00efd870 100644
--- a/include/hw/i386/sgx-epc.h
+++ b/include/hw/i386/sgx-epc.h
@@ -12,6 +12,7 @@
 #ifndef QEMU_SGX_EPC_H
 #define QEMU_SGX_EPC_H
 
+#include "hw/qdev-core.h"
 #include "hw/i386/hostmem-epc.h"
 
 #define TYPE_SGX_EPC "sgx-epc"
diff --git a/include/hw/intc/goldfish_pic.h b/include/hw/intc/goldfish_pic.h
index e9d552f796..3e79580367 100644
--- a/include/hw/intc/goldfish_pic.h
+++ b/include/hw/intc/goldfish_pic.h
@@ -10,6 +10,8 @@
 #ifndef HW_INTC_GOLDFISH_PIC_H
 #define HW_INTC_GOLDFISH_PIC_H
 
+#include "hw/sysbus.h"
+
 #define TYPE_GOLDFISH_PIC "goldfish_pic"
 OBJECT_DECLARE_SIMPLE_TYPE(GoldfishPICState, GOLDFISH_PIC)
 
diff --git a/include/hw/intc/loongarch_pch_msi.h b/include/hw/intc/loongarch_pch_msi.h
index 6d67560dea..2810665ef7 100644
--- a/include/hw/intc/loongarch_pch_msi.h
+++ b/include/hw/intc/loongarch_pch_msi.h
@@ -5,6 +5,8 @@
  * Copyright (C) 2021 Loongson Technology Corporation Limited
  */
 
+#include "hw/sysbus.h"
+
 #define TYPE_LOONGARCH_PCH_MSI "loongarch_pch_msi"
 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHMSI, LOONGARCH_PCH_MSI)
 
diff --git a/include/hw/intc/loongarch_pch_pic.h b/include/hw/intc/loongarch_pch_pic.h
index 2d4aa9ed6f..5d5dee9280 100644
--- a/include/hw/intc/loongarch_pch_pic.h
+++ b/include/hw/intc/loongarch_pch_pic.h
@@ -5,6 +5,8 @@
  * Copyright (c) 2021 Loongson Technology Corporation Limited
  */
 
+#include "hw/sysbus.h"
+
 #define TYPE_LOONGARCH_PCH_PIC "loongarch_pch_pic"
 #define PCH_PIC_NAME(name) TYPE_LOONGARCH_PCH_PIC#name
 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHPIC, LOONGARCH_PCH_PIC)
diff --git a/include/hw/intc/nios2_vic.h b/include/hw/intc/nios2_vic.h
index ac507b9d74..5c975a2ac4 100644
--- a/include/hw/intc/nios2_vic.h
+++ b/include/hw/intc/nios2_vic.h
@@ -35,6 +35,8 @@
 #ifndef HW_INTC_NIOS2_VIC_H
 #define HW_INTC_NIOS2_VIC_H
 
+#include "hw/sysbus.h"
+
 #define TYPE_NIOS2_VIC "nios2-vic"
 OBJECT_DECLARE_SIMPLE_TYPE(Nios2VIC, NIOS2_VIC)
 
diff --git a/include/hw/misc/mchp_pfsoc_dmc.h b/include/hw/misc/mchp_pfsoc_dmc.h
index 2baa1413b0..3bc1581e0f 100644
--- a/include/hw/misc/mchp_pfsoc_dmc.h
+++ b/include/hw/misc/mchp_pfsoc_dmc.h
@@ -23,6 +23,8 @@
 #ifndef MCHP_PFSOC_DMC_H
 #define MCHP_PFSOC_DMC_H
 
+#include "hw/sysbus.h"
+
 /* DDR SGMII PHY module */
 
 #define MCHP_PFSOC_DDR_SGMII_PHY_REG_SIZE   0x1000
diff --git a/include/hw/misc/mchp_pfsoc_ioscb.h b/include/hw/misc/mchp_pfsoc_ioscb.h
index 9235523e33..bab83a96a6 100644
--- a/include/hw/misc/mchp_pfsoc_ioscb.h
+++ b/include/hw/misc/mchp_pfsoc_ioscb.h
@@ -23,6 +23,8 @@
 #ifndef MCHP_PFSOC_IOSCB_H
 #define MCHP_PFSOC_IOSCB_H
 
+#include "hw/sysbus.h"
+
 typedef struct MchpPfSoCIoscbState {
     SysBusDevice parent;
     MemoryRegion container;
diff --git a/include/hw/misc/mchp_pfsoc_sysreg.h b/include/hw/misc/mchp_pfsoc_sysreg.h
index 546ba68f6a..a2fd1c9f07 100644
--- a/include/hw/misc/mchp_pfsoc_sysreg.h
+++ b/include/hw/misc/mchp_pfsoc_sysreg.h
@@ -23,6 +23,8 @@
 #ifndef MCHP_PFSOC_SYSREG_H
 #define MCHP_PFSOC_SYSREG_H
 
+#include "hw/sysbus.h"
+
 #define MCHP_PFSOC_SYSREG_REG_SIZE  0x2000
 
 typedef struct MchpPfSoCSysregState {
diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h
index e520566ab0..fab94165d0 100644
--- a/include/hw/misc/pvpanic.h
+++ b/include/hw/misc/pvpanic.h
@@ -15,6 +15,7 @@
 #ifndef HW_MISC_PVPANIC_H
 #define HW_MISC_PVPANIC_H
 
+#include "exec/memory.h"
 #include "qom/object.h"
 
 #define TYPE_PVPANIC_ISA_DEVICE "pvpanic"
diff --git a/include/hw/misc/sifive_e_prci.h b/include/hw/misc/sifive_e_prci.h
index 262ca16181..6aa949e910 100644
--- a/include/hw/misc/sifive_e_prci.h
+++ b/include/hw/misc/sifive_e_prci.h
@@ -18,7 +18,8 @@
 
 #ifndef HW_SIFIVE_E_PRCI_H
 #define HW_SIFIVE_E_PRCI_H
-#include "qom/object.h"
+
+#include "hw/sysbus.h"
 
 enum {
     SIFIVE_E_PRCI_HFROSCCFG = 0x0,
diff --git a/include/hw/misc/sifive_u_otp.h b/include/hw/misc/sifive_u_otp.h
index 5d0d7df455..170d2148f2 100644
--- a/include/hw/misc/sifive_u_otp.h
+++ b/include/hw/misc/sifive_u_otp.h
@@ -18,7 +18,8 @@
 
 #ifndef HW_SIFIVE_U_OTP_H
 #define HW_SIFIVE_U_OTP_H
-#include "qom/object.h"
+
+#include "hw/sysbus.h"
 
 #define SIFIVE_U_OTP_PA         0x00
 #define SIFIVE_U_OTP_PAIO       0x04
diff --git a/include/hw/misc/sifive_u_prci.h b/include/hw/misc/sifive_u_prci.h
index d9ebf40b7f..4d2491ad46 100644
--- a/include/hw/misc/sifive_u_prci.h
+++ b/include/hw/misc/sifive_u_prci.h
@@ -18,7 +18,8 @@
 
 #ifndef HW_SIFIVE_U_PRCI_H
 #define HW_SIFIVE_U_PRCI_H
-#include "qom/object.h"
+
+#include "hw/sysbus.h"
 
 #define SIFIVE_U_PRCI_HFXOSCCFG     0x00
 #define SIFIVE_U_PRCI_COREPLLCFG0   0x04
diff --git a/include/hw/misc/virt_ctrl.h b/include/hw/misc/virt_ctrl.h
index 25a237e518..81346cf017 100644
--- a/include/hw/misc/virt_ctrl.h
+++ b/include/hw/misc/virt_ctrl.h
@@ -7,6 +7,8 @@
 #ifndef VIRT_CTRL_H
 #define VIRT_CTRL_H
 
+#include "hw/sysbus.h"
+
 #define TYPE_VIRT_CTRL "virt-ctrl"
 OBJECT_DECLARE_SIMPLE_TYPE(VirtCtrlState, VIRT_CTRL)
 
diff --git a/include/hw/misc/xlnx-versal-pmc-iou-slcr.h b/include/hw/misc/xlnx-versal-pmc-iou-slcr.h
index 2170420f01..f7d24c93c4 100644
--- a/include/hw/misc/xlnx-versal-pmc-iou-slcr.h
+++ b/include/hw/misc/xlnx-versal-pmc-iou-slcr.h
@@ -54,6 +54,7 @@
 #ifndef XLNX_VERSAL_PMC_IOU_SLCR_H
 #define XLNX_VERSAL_PMC_IOU_SLCR_H
 
+#include "hw/sysbus.h"
 #include "hw/register.h"
 
 #define TYPE_XILINX_VERSAL_PMC_IOU_SLCR "xlnx.versal-pmc-iou-slcr"
diff --git a/include/hw/net/lasi_82596.h b/include/hw/net/lasi_82596.h
index 7b62b04833..3ef2f47ba2 100644
--- a/include/hw/net/lasi_82596.h
+++ b/include/hw/net/lasi_82596.h
@@ -10,7 +10,7 @@
 
 #include "net/net.h"
 #include "hw/net/i82596.h"
-#include "qom/object.h"
+#include "hw/sysbus.h"
 
 #define TYPE_LASI_82596 "lasi_82596"
 typedef struct SysBusI82596State SysBusI82596State;
diff --git a/include/hw/net/xlnx-zynqmp-can.h b/include/hw/net/xlnx-zynqmp-can.h
index eb1558708b..fd2aa77760 100644
--- a/include/hw/net/xlnx-zynqmp-can.h
+++ b/include/hw/net/xlnx-zynqmp-can.h
@@ -30,6 +30,7 @@
 #ifndef XLNX_ZYNQMP_CAN_H
 #define XLNX_ZYNQMP_CAN_H
 
+#include "hw/sysbus.h"
 #include "hw/register.h"
 #include "net/can_emu.h"
 #include "net/can_host.h"
diff --git a/include/hw/ppc/pnv_psi.h b/include/hw/ppc/pnv_psi.h
index 8253469b8f..2a6f715350 100644
--- a/include/hw/ppc/pnv_psi.h
+++ b/include/hw/ppc/pnv_psi.h
@@ -23,7 +23,7 @@
 #include "hw/sysbus.h"
 #include "hw/ppc/xics.h"
 #include "hw/ppc/xive.h"
-#include "qom/object.h"
+#include "hw/qdev-core.h"
 
 #define TYPE_PNV_PSI "pnv-psi"
 OBJECT_DECLARE_TYPE(PnvPsi, PnvPsiClass,
diff --git a/include/hw/riscv/boot_opensbi.h b/include/hw/riscv/boot_opensbi.h
index c19cad4818..1b749663dc 100644
--- a/include/hw/riscv/boot_opensbi.h
+++ b/include/hw/riscv/boot_opensbi.h
@@ -8,6 +8,8 @@
 #ifndef RISCV_BOOT_OPENSBI_H
 #define RISCV_BOOT_OPENSBI_H
 
+#include "exec/cpu-defs.h"
+
 /** Expected value of info magic ('OSBI' ascii string in hex) */
 #define FW_DYNAMIC_INFO_MAGIC_VALUE     0x4942534f
 
diff --git a/include/hw/riscv/microchip_pfsoc.h b/include/hw/riscv/microchip_pfsoc.h
index a757b240e0..9e806b09b1 100644
--- a/include/hw/riscv/microchip_pfsoc.h
+++ b/include/hw/riscv/microchip_pfsoc.h
@@ -22,13 +22,16 @@
 #ifndef HW_MICROCHIP_PFSOC_H
 #define HW_MICROCHIP_PFSOC_H
 
+#include "hw/boards.h"
 #include "hw/char/mchp_pfsoc_mmuart.h"
+#include "hw/cpu/cluster.h"
 #include "hw/dma/sifive_pdma.h"
 #include "hw/misc/mchp_pfsoc_dmc.h"
 #include "hw/misc/mchp_pfsoc_ioscb.h"
 #include "hw/misc/mchp_pfsoc_sysreg.h"
 #include "hw/net/cadence_gem.h"
 #include "hw/sd/cadence_sdhci.h"
+#include "hw/riscv/riscv_hart.h"
 
 typedef struct MicrochipPFSoCState {
     /*< private >*/
diff --git a/include/hw/riscv/numa.h b/include/hw/riscv/numa.h
index fcce942cee..1a9cce3344 100644
--- a/include/hw/riscv/numa.h
+++ b/include/hw/riscv/numa.h
@@ -19,6 +19,7 @@
 #ifndef RISCV_NUMA_H
 #define RISCV_NUMA_H
 
+#include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "sysemu/numa.h"
 
diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h
index 8f63a183c4..a43304292c 100644
--- a/include/hw/riscv/sifive_u.h
+++ b/include/hw/riscv/sifive_u.h
@@ -19,6 +19,8 @@
 #ifndef HW_SIFIVE_U_H
 #define HW_SIFIVE_U_H
 
+#include "hw/boards.h"
+#include "hw/cpu/cluster.h"
 #include "hw/dma/sifive_pdma.h"
 #include "hw/net/cadence_gem.h"
 #include "hw/riscv/riscv_hart.h"
diff --git a/include/hw/riscv/spike.h b/include/hw/riscv/spike.h
index 73d69234de..73bf2a9aad 100644
--- a/include/hw/riscv/spike.h
+++ b/include/hw/riscv/spike.h
@@ -19,9 +19,9 @@
 #ifndef HW_RISCV_SPIKE_H
 #define HW_RISCV_SPIKE_H
 
+#include "hw/boards.h"
 #include "hw/riscv/riscv_hart.h"
 #include "hw/sysbus.h"
-#include "qom/object.h"
 
 #define SPIKE_CPUS_MAX 8
 #define SPIKE_SOCKETS_MAX 8
diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
index be4ab8fe7f..3007bb3646 100644
--- a/include/hw/riscv/virt.h
+++ b/include/hw/riscv/virt.h
@@ -19,10 +19,10 @@
 #ifndef HW_RISCV_VIRT_H
 #define HW_RISCV_VIRT_H
 
+#include "hw/boards.h"
 #include "hw/riscv/riscv_hart.h"
 #include "hw/sysbus.h"
 #include "hw/block/flash.h"
-#include "qom/object.h"
 
 #define VIRT_CPUS_MAX_BITS             9
 #define VIRT_CPUS_MAX                  (1 << VIRT_CPUS_MAX_BITS)
diff --git a/include/hw/ssi/sifive_spi.h b/include/hw/ssi/sifive_spi.h
index 47d0d6a47c..d0c40cdb11 100644
--- a/include/hw/ssi/sifive_spi.h
+++ b/include/hw/ssi/sifive_spi.h
@@ -22,6 +22,9 @@
 #ifndef HW_SIFIVE_SPI_H
 #define HW_SIFIVE_SPI_H
 
+#include "qemu/fifo8.h"
+#include "hw/sysbus.h"
+
 #define SIFIVE_SPI_REG_NUM  (0x78 / 4)
 
 #define TYPE_SIFIVE_SPI "sifive.spi"
diff --git a/include/hw/timer/sse-timer.h b/include/hw/timer/sse-timer.h
index b4ee8e7f6c..265ad32400 100644
--- a/include/hw/timer/sse-timer.h
+++ b/include/hw/timer/sse-timer.h
@@ -25,6 +25,7 @@
 #define SSE_TIMER_H
 
 #include "hw/sysbus.h"
+#include "qemu/timer.h"
 #include "qom/object.h"
 #include "hw/timer/sse-counter.h"
 
diff --git a/include/hw/usb/hcd-dwc3.h b/include/hw/usb/hcd-dwc3.h
index 7c804d536d..f752a27e94 100644
--- a/include/hw/usb/hcd-dwc3.h
+++ b/include/hw/usb/hcd-dwc3.h
@@ -26,6 +26,7 @@
 #ifndef HCD_DWC3_H
 #define HCD_DWC3_H
 
+#include "hw/register.h"
 #include "hw/usb/hcd-xhci.h"
 #include "hw/usb/hcd-xhci-sysbus.h"
 
diff --git a/include/hw/usb/hcd-musb.h b/include/hw/usb/hcd-musb.h
index f30a26f7f4..4d4b1ec0fc 100644
--- a/include/hw/usb/hcd-musb.h
+++ b/include/hw/usb/hcd-musb.h
@@ -13,6 +13,8 @@
 #ifndef HW_USB_HCD_MUSB_H
 #define HW_USB_HCD_MUSB_H
 
+#include "exec/hwaddr.h"
+
 enum musb_irq_source_e {
     musb_irq_suspend = 0,
     musb_irq_resume,
diff --git a/include/hw/usb/xlnx-usb-subsystem.h b/include/hw/usb/xlnx-usb-subsystem.h
index 5b730abd84..40f9e97e09 100644
--- a/include/hw/usb/xlnx-usb-subsystem.h
+++ b/include/hw/usb/xlnx-usb-subsystem.h
@@ -25,6 +25,8 @@
 #ifndef XLNX_USB_SUBSYSTEM_H
 #define XLNX_USB_SUBSYSTEM_H
 
+#include "hw/register.h"
+#include "hw/sysbus.h"
 #include "hw/usb/xlnx-versal-usb2-ctrl-regs.h"
 #include "hw/usb/hcd-dwc3.h"
 
diff --git a/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h b/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
index 633bf3013a..6a502006b0 100644
--- a/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
+++ b/include/hw/usb/xlnx-versal-usb2-ctrl-regs.h
@@ -26,6 +26,9 @@
 #ifndef XLNX_VERSAL_USB2_CTRL_REGS_H
 #define XLNX_VERSAL_USB2_CTRL_REGS_H
 
+#include "hw/register.h"
+#include "hw/sysbus.h"
+
 #define TYPE_XILINX_VERSAL_USB2_CTRL_REGS "xlnx.versal-usb2-ctrl-regs"
 
 #define XILINX_VERSAL_USB2_CTRL_REGS(obj) \
diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
index 090f7730e7..aa49262022 100644
--- a/include/hw/virtio/virtio-mmio.h
+++ b/include/hw/virtio/virtio-mmio.h
@@ -22,8 +22,8 @@
 #ifndef HW_VIRTIO_MMIO_H
 #define HW_VIRTIO_MMIO_H
 
+#include "hw/sysbus.h"
 #include "hw/virtio/virtio-bus.h"
-#include "qom/object.h"
 
 /* QOM macros */
 /* virtio-mmio-bus */
diff --git a/include/qemu/plugin-memory.h b/include/qemu/plugin-memory.h
index 8ad13c110c..6fd539022a 100644
--- a/include/qemu/plugin-memory.h
+++ b/include/qemu/plugin-memory.h
@@ -9,6 +9,9 @@
 #ifndef PLUGIN_MEMORY_H
 #define PLUGIN_MEMORY_H
 
+#include "exec/cpu-defs.h"
+#include "exec/hwaddr.h"
+
 struct qemu_plugin_hwaddr {
     bool is_io;
     bool is_store;
diff --git a/include/sysemu/dirtyrate.h b/include/sysemu/dirtyrate.h
index 4d3b9a4902..20813f303f 100644
--- a/include/sysemu/dirtyrate.h
+++ b/include/sysemu/dirtyrate.h
@@ -13,6 +13,8 @@
 #ifndef QEMU_DIRTYRATE_H
 #define QEMU_DIRTYRATE_H
 
+#include "qapi/qapi-types-migration.h"
+
 typedef struct VcpuStat {
     int nvcpu; /* number of vcpu */
     DirtyRateVcpu *rates; /* array of dirty rate for each vcpu */
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
index 4ffed0b659..7008d43d04 100644
--- a/include/sysemu/dump.h
+++ b/include/sysemu/dump.h
@@ -15,6 +15,7 @@
 #define DUMP_H
 
 #include "qapi/qapi-types-dump.h"
+#include "qemu/thread.h"
 
 #define MAKEDUMPFILE_SIGNATURE      "makedumpfile"
 #define MAX_SIZE_MDF_HEADER         (4096) /* max size of makedumpfile_header */
diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h
index b4e53d3870..c5a220da34 100644
--- a/include/user/syscall-trace.h
+++ b/include/user/syscall-trace.h
@@ -10,6 +10,7 @@
 #ifndef SYSCALL_TRACE_H
 #define SYSCALL_TRACE_H
 
+#include "exec/user/abitypes.h"
 #include "trace/trace-root.h"
 
 /*
-- 
MST



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

* [PULL 36/51] include: Don't include qemu/osdep.h
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (31 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 35/51] include: Include headers where needed Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 37/51] docs/devel: Rules on #include in headers Michael S. Tsirkin
                   ` (19 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Philippe Mathieu-Daudé,
	Bin Meng, Taylor Simpson, Alistair Francis, Warner Losh,
	Kyle Evans, Daniel P. Berrangé,
	Ben Widawsky, Jonathan Cameron, Bastian Koppelmann, Jason Wang,
	Michael Roth, Konstantin Kostiuk, Palmer Dabbelt, Bin Meng,
	qemu-riscv

From: Markus Armbruster <armbru@redhat.com>

docs/devel/style.rst mandates:

    The "qemu/osdep.h" header contains preprocessor macros that affect
    the behavior of core system headers like <stdint.h>.  It must be
    the first include so that core system headers included by external
    libraries get the preprocessor macros that QEMU depends on.

    Do not include "qemu/osdep.h" from header files since the .c file
    will have already included it.

A few violations have crept in.  Fix them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20221222120813.727830-4-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 bsd-user/qemu.h                 | 1 -
 crypto/block-luks-priv.h        | 1 -
 include/hw/cxl/cxl_host.h       | 1 -
 include/hw/input/pl050.h        | 1 -
 include/hw/tricore/triboard.h   | 1 -
 include/qemu/userfaultfd.h      | 1 -
 net/vmnet_int.h                 | 1 -
 qga/cutils.h                    | 1 -
 target/hexagon/hex_arch_types.h | 1 -
 target/hexagon/mmvec/macros.h   | 1 -
 target/riscv/pmu.h              | 1 -
 qga/cutils.c                    | 3 ++-
 12 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index be6105385e..0ceecfb6df 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -17,7 +17,6 @@
 #ifndef QEMU_H
 #define QEMU_H
 
-#include "qemu/osdep.h"
 #include "cpu.h"
 #include "qemu/units.h"
 #include "exec/cpu_ldst.h"
diff --git a/crypto/block-luks-priv.h b/crypto/block-luks-priv.h
index 90a20d432b..1066df0307 100644
--- a/crypto/block-luks-priv.h
+++ b/crypto/block-luks-priv.h
@@ -18,7 +18,6 @@
  *
  */
 
-#include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/bswap.h"
 
diff --git a/include/hw/cxl/cxl_host.h b/include/hw/cxl/cxl_host.h
index a1b662ce40..c9bc9c7c50 100644
--- a/include/hw/cxl/cxl_host.h
+++ b/include/hw/cxl/cxl_host.h
@@ -7,7 +7,6 @@
  * COPYING file in the top-level directory.
  */
 
-#include "qemu/osdep.h"
 #include "hw/cxl/cxl.h"
 #include "hw/boards.h"
 
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index 89ec4fafc9..4cb8985f31 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -10,7 +10,6 @@
 #ifndef HW_PL050_H
 #define HW_PL050_H
 
-#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/input/ps2.h"
diff --git a/include/hw/tricore/triboard.h b/include/hw/tricore/triboard.h
index 094c8bd563..4fdd2d7d97 100644
--- a/include/hw/tricore/triboard.h
+++ b/include/hw/tricore/triboard.h
@@ -18,7 +18,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/boards.h"
 #include "sysemu/sysemu.h"
diff --git a/include/qemu/userfaultfd.h b/include/qemu/userfaultfd.h
index 6b74f92792..55c95998e8 100644
--- a/include/qemu/userfaultfd.h
+++ b/include/qemu/userfaultfd.h
@@ -13,7 +13,6 @@
 #ifndef USERFAULTFD_H
 #define USERFAULTFD_H
 
-#include "qemu/osdep.h"
 #include "exec/hwaddr.h"
 #include <linux/userfaultfd.h>
 
diff --git a/net/vmnet_int.h b/net/vmnet_int.h
index adf6e8c20d..d0b90594f2 100644
--- a/net/vmnet_int.h
+++ b/net/vmnet_int.h
@@ -10,7 +10,6 @@
 #ifndef VMNET_INT_H
 #define VMNET_INT_H
 
-#include "qemu/osdep.h"
 #include "vmnet_int.h"
 #include "clients.h"
 
diff --git a/qga/cutils.h b/qga/cutils.h
index f0f30a7d28..2bfaf554a8 100644
--- a/qga/cutils.h
+++ b/qga/cutils.h
@@ -1,7 +1,6 @@
 #ifndef CUTILS_H_
 #define CUTILS_H_
 
-#include "qemu/osdep.h"
 
 int qga_open_cloexec(const char *name, int flags, mode_t mode);
 
diff --git a/target/hexagon/hex_arch_types.h b/target/hexagon/hex_arch_types.h
index 885f68f760..52a7f2b2f3 100644
--- a/target/hexagon/hex_arch_types.h
+++ b/target/hexagon/hex_arch_types.h
@@ -18,7 +18,6 @@
 #ifndef HEXAGON_HEX_ARCH_TYPES_H
 #define HEXAGON_HEX_ARCH_TYPES_H
 
-#include "qemu/osdep.h"
 #include "mmvec/mmvec.h"
 #include "qemu/int128.h"
 
diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h
index 8c864e8c68..1201d778d0 100644
--- a/target/hexagon/mmvec/macros.h
+++ b/target/hexagon/mmvec/macros.h
@@ -18,7 +18,6 @@
 #ifndef HEXAGON_MMVEC_MACROS_H
 #define HEXAGON_MMVEC_MACROS_H
 
-#include "qemu/osdep.h"
 #include "qemu/host-utils.h"
 #include "arch.h"
 #include "mmvec/system_ext_mmvec.h"
diff --git a/target/riscv/pmu.h b/target/riscv/pmu.h
index 3004ce37b6..0c819ca983 100644
--- a/target/riscv/pmu.h
+++ b/target/riscv/pmu.h
@@ -16,7 +16,6 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "cpu.h"
 #include "qemu/main-loop.h"
diff --git a/qga/cutils.c b/qga/cutils.c
index b8e142ef64..b21bcf3683 100644
--- a/qga/cutils.c
+++ b/qga/cutils.c
@@ -2,8 +2,9 @@
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
  */
-#include "cutils.h"
 
+#include "qemu/osdep.h"
+#include "cutils.h"
 #include "qapi/error.h"
 
 /**
-- 
MST



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

* [PULL 37/51] docs/devel: Rules on #include in headers
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (32 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 36/51] include: Don't include qemu/osdep.h Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-09 12:03   ` Markus Armbruster
  2023-01-05  9:16 ` [PULL 38/51] vdpa-dev: get iova range explicitly Michael S. Tsirkin
                   ` (18 subsequent siblings)
  52 siblings, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Bernhard Beschow,
	Alex Bennée, Philippe Mathieu-Daudé,
	Daniel P. Berrangé,
	Richard Henderson

From: Markus Armbruster <armbru@redhat.com>

Rules for headers were proposed a long time ago, and generally liked:

    Message-ID: <87h9g8j57d.fsf@blackfin.pond.sub.org>
    https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html

Wortk them into docs/devel/style.rst.

Suggested-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221222120813.727830-5-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
---
 docs/devel/style.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/devel/style.rst b/docs/devel/style.rst
index 7ddd42b6c2..68aa776930 100644
--- a/docs/devel/style.rst
+++ b/docs/devel/style.rst
@@ -293,6 +293,13 @@ that QEMU depends on.
 Do not include "qemu/osdep.h" from header files since the .c file will have
 already included it.
 
+Headers should normally include everything they need beyond osdep.h.
+If exceptions are needed for some reason, they must be documented in
+the header.  If all that's needed from a header is typedefs, consider
+putting those into qemu/typedefs.h instead of including the header.
+
+Cyclic inclusion is forbidden.
+
 C types
 =======
 
-- 
MST



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

* [PULL 38/51] vdpa-dev: get iova range explicitly
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (33 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 37/51] docs/devel: Rules on #include in headers Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 39/51] vdpa: harden the error path if get_iova_range failed Michael S. Tsirkin
                   ` (17 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Longpeng, Jason Wang

From: Longpeng <longpeng2@huawei.com>

In commit a585fad26b ("vdpa: request iova_range only once") we remove
GET_IOVA_RANGE form vhost_vdpa_init, the generic vdpa device will start
without iova_range populated, so the device won't work. Let's call
GET_IOVA_RANGE ioctl explicitly.

Fixes: a585fad26b2e6ccc ("vdpa: request iova_range only once")
Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20221224114848.3062-2-longpeng2@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
 include/hw/virtio/vhost-vdpa.h | 2 ++
 hw/virtio/vdpa-dev.c           | 9 +++++++++
 hw/virtio/vhost-vdpa.c         | 7 +++++++
 net/vhost-vdpa.c               | 8 --------
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index 45b969a311..7997f09a8d 100644
--- a/include/hw/virtio/vhost-vdpa.h
+++ b/include/hw/virtio/vhost-vdpa.h
@@ -51,6 +51,8 @@ typedef struct vhost_vdpa {
     VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX];
 } VhostVDPA;
 
+int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_range);
+
 int vhost_vdpa_dma_map(struct vhost_vdpa *v, uint32_t asid, hwaddr iova,
                        hwaddr size, void *vaddr, bool readonly);
 int vhost_vdpa_dma_unmap(struct vhost_vdpa *v, uint32_t asid, hwaddr iova,
diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c
index db6ba61152..01b41eb0f1 100644
--- a/hw/virtio/vdpa-dev.c
+++ b/hw/virtio/vdpa-dev.c
@@ -53,6 +53,7 @@ static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VhostVdpaDevice *v = VHOST_VDPA_DEVICE(vdev);
+    struct vhost_vdpa_iova_range iova_range;
     uint16_t max_queue_size;
     struct vhost_virtqueue *vqs;
     int i, ret;
@@ -108,6 +109,14 @@ static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp)
     v->dev.backend_features = 0;
     v->started = false;
 
+    ret = vhost_vdpa_get_iova_range(v->vhostfd, &iova_range);
+    if (ret < 0) {
+        error_setg(errp, "vhost-vdpa-device: get iova range failed: %s",
+                   strerror(-ret));
+        goto free_vqs;
+    }
+    v->vdpa.iova_range = iova_range;
+
     ret = vhost_dev_init(&v->dev, &v->vdpa, VHOST_BACKEND_TYPE_VDPA, 0, NULL);
     if (ret < 0) {
         error_setg(errp, "vhost-vdpa-device: vhost initialization failed: %s",
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index fcb1e96316..c295a8c917 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -378,6 +378,13 @@ static int vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status)
     return 0;
 }
 
+int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_range)
+{
+    int ret = ioctl(fd, VHOST_VDPA_GET_IOVA_RANGE, iova_range);
+
+    return ret < 0 ? -errno : 0;
+}
+
 /*
  * The use of this function is for requests that only need to be
  * applied once. Typically such request occurs at the beginning
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index b0c6109230..b6e1e84ed2 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -710,14 +710,6 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
     return nc;
 }
 
-static int vhost_vdpa_get_iova_range(int fd,
-                                     struct vhost_vdpa_iova_range *iova_range)
-{
-    int ret = ioctl(fd, VHOST_VDPA_GET_IOVA_RANGE, iova_range);
-
-    return ret < 0 ? -errno : 0;
-}
-
 static int vhost_vdpa_get_features(int fd, uint64_t *features, Error **errp)
 {
     int ret = ioctl(fd, VHOST_GET_FEATURES, features);
-- 
MST



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

* [PULL 39/51] vdpa: harden the error path if get_iova_range failed
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (34 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 38/51] vdpa-dev: get iova range explicitly Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 40/51] vhost: simplify vhost_dev_enable_notifiers Michael S. Tsirkin
                   ` (16 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Longpeng, Jason Wang

From: Longpeng <longpeng2@huawei.com>

We should stop if the GET_IOVA_RANGE ioctl failed.

Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20221224114848.3062-3-longpeng2@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
 net/vhost-vdpa.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index b6e1e84ed2..1a13a34d35 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -805,7 +805,13 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
         return queue_pairs;
     }
 
-    vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
+    r = vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
+    if (unlikely(r < 0)) {
+        error_setg(errp, "vhost-vdpa: get iova range failed: %s",
+                   strerror(-r));
+        goto err;
+    }
+
     if (opts->x_svq) {
         if (!vhost_vdpa_net_valid_svq_features(features, errp)) {
             goto err_svq;
-- 
MST



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

* [PULL 40/51] vhost: simplify vhost_dev_enable_notifiers
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (35 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 39/51] vdpa: harden the error path if get_iova_range failed Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 41/51] vhost: configure all host notifiers in a single MR transaction Michael S. Tsirkin
                   ` (15 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Longpeng

From: Longpeng <longpeng2@huawei.com>

Simplify the error path in vhost_dev_enable_notifiers by using
vhost_dev_disable_notifiers directly.

Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20221227072015.3134-2-longpeng2@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/vhost.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 2c566dc539..87c49fa679 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1551,7 +1551,7 @@ void vhost_dev_cleanup(struct vhost_dev *hdev)
 int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
 {
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
-    int i, r, e;
+    int i, r;
 
     /* We will pass the notifiers to the kernel, make sure that QEMU
      * doesn't interfere.
@@ -1559,7 +1559,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
     r = virtio_device_grab_ioeventfd(vdev);
     if (r < 0) {
         error_report("binding does not support host notifiers");
-        goto fail;
+        return r;
     }
 
     for (i = 0; i < hdev->nvqs; ++i) {
@@ -1567,24 +1567,12 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
                                          true);
         if (r < 0) {
             error_report("vhost VQ %d notifier binding failed: %d", i, -r);
-            goto fail_vq;
+            vhost_dev_disable_notifiers(hdev, vdev);
+            return r;
         }
     }
 
     return 0;
-fail_vq:
-    while (--i >= 0) {
-        e = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
-                                         false);
-        if (e < 0) {
-            error_report("vhost VQ %d notifier cleanup error: %d", i, -r);
-        }
-        assert (e >= 0);
-        virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i);
-    }
-    virtio_device_release_ioeventfd(vdev);
-fail:
-    return r;
 }
 
 /* Stop processing guest IO notifications in vhost.
-- 
MST



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

* [PULL 41/51] vhost: configure all host notifiers in a single MR transaction
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (36 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 40/51] vhost: simplify vhost_dev_enable_notifiers Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 42/51] vdpa: commit all host notifier MRs " Michael S. Tsirkin
                   ` (14 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Longpeng, Philippe Mathieu-Daudé

From: Longpeng <longpeng2@huawei.com>

This allows the vhost device to batch the setup of all its host notifiers.
This significantly reduces the device starting time, e.g. the time spend
on enabling notifiers reduce from 376ms to 9.1ms for a VM with 64 vCPUs
and 3 vhost-vDPA generic devices (vdpa_sim_blk, 64vq per device)

Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20221227072015.3134-3-longpeng2@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/virtio/vhost.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 87c49fa679..eb8c4c378c 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1562,16 +1562,25 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
         return r;
     }
 
+    /*
+     * Batch all the host notifiers in a single transaction to avoid
+     * quadratic time complexity in address_space_update_ioeventfds().
+     */
+    memory_region_transaction_begin();
+
     for (i = 0; i < hdev->nvqs; ++i) {
         r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
                                          true);
         if (r < 0) {
             error_report("vhost VQ %d notifier binding failed: %d", i, -r);
+            memory_region_transaction_commit();
             vhost_dev_disable_notifiers(hdev, vdev);
             return r;
         }
     }
 
+    memory_region_transaction_commit();
+
     return 0;
 }
 
@@ -1585,6 +1594,12 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
     int i, r;
 
+    /*
+     * Batch all the host notifiers in a single transaction to avoid
+     * quadratic time complexity in address_space_update_ioeventfds().
+     */
+    memory_region_transaction_begin();
+
     for (i = 0; i < hdev->nvqs; ++i) {
         r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
                                          false);
@@ -1592,6 +1607,15 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
             error_report("vhost VQ %d notifier cleanup failed: %d", i, -r);
         }
         assert (r >= 0);
+    }
+
+    /*
+     * The transaction expects the ioeventfds to be open when it
+     * commits. Do it now, before the cleanup loop.
+     */
+    memory_region_transaction_commit();
+
+    for (i = 0; i < hdev->nvqs; ++i) {
         virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i);
     }
     virtio_device_release_ioeventfd(vdev);
-- 
MST



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

* [PULL 42/51] vdpa: commit all host notifier MRs in a single MR transaction
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (37 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 41/51] vhost: configure all host notifiers in a single MR transaction Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 43/51] virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers Michael S. Tsirkin
                   ` (13 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Longpeng, Philippe Mathieu-Daudé

From: Longpeng <longpeng2@huawei.com>

This allows the vhost-vdpa device to batch the setup of all its MRs of
host notifiers.

This significantly reduces the device starting time, e.g. the time spend
on setup the host notifier MRs reduce from 423ms to 32ms for a VM with
64 vCPUs and 3 vhost-vDPA generic devices (vdpa_sim_blk, 64vq per device).

Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20221227072015.3134-4-longpeng2@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/virtio/vhost-vdpa.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index c295a8c917..542e003101 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -519,9 +519,18 @@ static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n)
 {
     int i;
 
+    /*
+     * Pack all the changes to the memory regions in a single
+     * transaction to avoid a few updating of the address space
+     * topology.
+     */
+    memory_region_transaction_begin();
+
     for (i = dev->vq_index; i < dev->vq_index + n; i++) {
         vhost_vdpa_host_notifier_uninit(dev, i);
     }
+
+    memory_region_transaction_commit();
 }
 
 static void vhost_vdpa_host_notifiers_init(struct vhost_dev *dev)
@@ -534,17 +543,21 @@ static void vhost_vdpa_host_notifiers_init(struct vhost_dev *dev)
         return;
     }
 
+    /*
+     * Pack all the changes to the memory regions in a single
+     * transaction to avoid a few updating of the address space
+     * topology.
+     */
+    memory_region_transaction_begin();
+
     for (i = dev->vq_index; i < dev->vq_index + dev->nvqs; i++) {
         if (vhost_vdpa_host_notifier_init(dev, i)) {
-            goto err;
+            vhost_vdpa_host_notifiers_uninit(dev, i - dev->vq_index);
+            break;
         }
     }
 
-    return;
-
-err:
-    vhost_vdpa_host_notifiers_uninit(dev, i - dev->vq_index);
-    return;
+    memory_region_transaction_commit();
 }
 
 static void vhost_vdpa_svq_cleanup(struct vhost_dev *dev)
-- 
MST



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

* [PULL 43/51] virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (38 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 42/51] vdpa: commit all host notifier MRs " Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 44/51] tests: virt: Allow changes to PPTT test table Michael S. Tsirkin
                   ` (12 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, leixiang, Zeng Chi, Xie Ming

From: leixiang <leixiang@kylinos.cn>

proxy->vector_irqfd did not free when kvm_virtio_pci_vector_use or
msix_set_vector_notifiers failed in virtio_pci_set_guest_notifiers.

Fixes: 7d37d351

Signed-off-by: Lei Xiang <leixiang@kylinos.cn>
Tested-by: Zeng Chi <zengchi@kylinos.cn>
Suggested-by: Xie Ming <xieming@kylinos.cn>
Message-Id: <20221227081604.806415-1-leixiang@kylinos.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio-pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 7bc60fcf94..247325c193 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1291,6 +1291,8 @@ assign_error:
     while (--n >= 0) {
         virtio_pci_set_guest_notifier(d, n, !assign, with_irqfd);
     }
+    g_free(proxy->vector_irqfd);
+    proxy->vector_irqfd = NULL;
     return r;
 }
 
-- 
MST



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

* [PULL 44/51] tests: virt: Allow changes to PPTT test table
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (39 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 43/51] virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified Michael S. Tsirkin
                   ` (11 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Yicong Yang, Yanan Wang, Igor Mammedov, Ani Sinha

From: Yicong Yang <yangyicong@hisilicon.com>

Allow changes to test/data/acpi/virt/PPTT*, prepare to change the
building policy of the cluster topology.

Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Message-Id: <20221229065513.55652-2-yangyicong@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..fc12cd8c5c 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,3 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/PPTT",
+"tests/data/acpi/virt/PPTT.acpihmatvirt",
-- 
MST



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

* [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (40 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 44/51] tests: virt: Allow changes to PPTT test table Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-05-10 10:13   ` Philippe Mathieu-Daudé
  2023-01-05  9:16 ` [PULL 46/51] tests: virt: Update expected ACPI tables for virt test Michael S. Tsirkin
                   ` (10 subsequent siblings)
  52 siblings, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Yicong Yang, Yanan Wang, Igor Mammedov, Ani Sinha,
	Eduardo Habkost, Marcel Apfelbaum, Philippe Mathieu-Daudé

From: Yicong Yang <yangyicong@hisilicon.com>

Currently we'll always generate a cluster node no matter user has
specified '-smp clusters=X' or not. Cluster is an optional level
and will participant the building of Linux scheduling domains and
only appears on a few platforms. It's unncessary to always build
it when it cannot reflect the real topology on platforms having no
cluster implementation and to avoid affecting the linux scheduling
domains in the VM. So only generate the cluster topology in ACPI
PPTT when the user has specified it explicitly in -smp.

Tested qemu-system-aarch64 with `-smp 8` and linux 6.1-rc1, without
this patch:
estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff	# cluster_cpus
0-7	# cluster_cpus_list
56	# cluster_id

with this patch:
estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
ff	# cluster_cpus
0-7	# cluster_cpus_list
36	# cluster_id, with no cluster node kernel will make it to
	  physical package id

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Tested-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Message-Id: <20221229065513.55652-3-yangyicong@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/boards.h   | 3 +++
 hw/acpi/aml-build.c   | 2 +-
 hw/core/machine-smp.c | 2 ++
 qemu-options.hx       | 3 +++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index d18d6d0073..b0abbdd5dc 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -130,11 +130,14 @@ typedef struct {
  * @prefer_sockets - whether sockets are preferred over cores in smp parsing
  * @dies_supported - whether dies are supported by the machine
  * @clusters_supported - whether clusters are supported by the machine
+ * @has_clusters - whether clusters are explicitly specified in the user
+ *                 provided SMP configuration
  */
 typedef struct {
     bool prefer_sockets;
     bool dies_supported;
     bool clusters_supported;
+    bool has_clusters;
 } SMPCompatProps;
 
 /**
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 42feb4d4d7..ea331a20d1 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
                 0, socket_id, NULL, 0);
         }
 
-        if (mc->smp_props.clusters_supported) {
+        if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
             if (cpus->cpus[n].props.cluster_id != cluster_id) {
                 assert(cpus->cpus[n].props.cluster_id > cluster_id);
                 cluster_id = cpus->cpus[n].props.cluster_id;
diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index b39ed21e65..c3dab007da 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -158,6 +158,8 @@ void machine_parse_smp_config(MachineState *ms,
     ms->smp.threads = threads;
     ms->smp.max_cpus = maxcpus;
 
+    mc->smp_props.has_clusters = config->has_clusters;
+
     /* sanity-check of the computed topology */
     if (sockets * dies * clusters * cores * threads != maxcpus) {
         g_autofree char *topo_msg = cpu_hierarchy_to_string(ms);
diff --git a/qemu-options.hx b/qemu-options.hx
index 7f99d15b23..8662568324 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -343,6 +343,9 @@ SRST
     ::
 
         -smp 2
+
+    Note: The cluster topology will only be generated in ACPI and exposed
+    to guest if it's explicitly specified in -smp.
 ERST
 
 DEF("numa", HAS_ARG, QEMU_OPTION_numa,
-- 
MST



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

* [PULL 46/51] tests: virt: Update expected ACPI tables for virt test
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (41 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 47/51] tests: acpi: Add and whitelist *.topology blobs Michael S. Tsirkin
                   ` (9 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Yicong Yang, Yanan Wang, Igor Mammedov, Ani Sinha

From: Yicong Yang <yangyicong@hisilicon.com>

Update the ACPI tables according to the acpi aml_build change, also
empty bios-tables-test-allowed-diff.h.

The disassembled differences between actual and expected PPTT:

  /*
   * Intel ACPI Component Architecture
   * AML/ASL+ Disassembler version 20180105 (64-bit version)
   * Copyright (c) 2000 - 2018 Intel Corporation
   *
 - * Disassembly of tests/data/acpi/virt/PPTT, Tue Nov  1 09:29:12 2022
 + * Disassembly of /tmp/aml-DIIGV1, Tue Nov  1 09:29:12 2022
   *
   * ACPI Data Table [PPTT]
   *
   * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
   */

  [000h 0000   4]                    Signature : "PPTT"    [Processor Properties Topology Table]
 -[004h 0004   4]                 Table Length : 00000060
 +[004h 0004   4]                 Table Length : 0000004C
  [008h 0008   1]                     Revision : 02
 -[009h 0009   1]                     Checksum : 48
 +[009h 0009   1]                     Checksum : A8
  [00Ah 0010   6]                       Oem ID : "BOCHS "
  [010h 0016   8]                 Oem Table ID : "BXPC    "
  [018h 0024   4]                 Oem Revision : 00000001
  [01Ch 0028   4]              Asl Compiler ID : "BXPC"
  [020h 0032   4]        Asl Compiler Revision : 00000001

  [024h 0036   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [025h 0037   1]                       Length : 14
  [026h 0038   2]                     Reserved : 0000
  [028h 0040   4]        Flags (decoded below) : 00000001
                              Physical package : 1
                       ACPI Processor ID valid : 0
  [02Ch 0044   4]                       Parent : 00000000
  [030h 0048   4]            ACPI Processor ID : 00000000
  [034h 0052   4]      Private Resource Number : 00000000

  [038h 0056   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [039h 0057   1]                       Length : 14
  [03Ah 0058   2]                     Reserved : 0000
 -[03Ch 0060   4]        Flags (decoded below) : 00000000
 +[03Ch 0060   4]        Flags (decoded below) : 0000000A
                              Physical package : 0
 -                     ACPI Processor ID valid : 0
 +                     ACPI Processor ID valid : 1
  [040h 0064   4]                       Parent : 00000024
  [044h 0068   4]            ACPI Processor ID : 00000000
  [048h 0072   4]      Private Resource Number : 00000000

 -[04Ch 0076   1]                Subtable Type : 00 [Processor Hierarchy Node]
 -[04Dh 0077   1]                       Length : 14
 -[04Eh 0078   2]                     Reserved : 0000
 -[050h 0080   4]        Flags (decoded below) : 0000000A
 -                            Physical package : 0
 -                     ACPI Processor ID valid : 1
 -[054h 0084   4]                       Parent : 00000038
 -[058h 0088   4]            ACPI Processor ID : 00000000
 -[05Ch 0092   4]      Private Resource Number : 00000000
 -
 -Raw Table Data: Length 96 (0x60)
 +Raw Table Data: Length 76 (0x4C)

 -  0000: 50 50 54 54 60 00 00 00 02 48 42 4F 43 48 53 20  // PPTT`....HBOCHS
 +  0000: 50 50 54 54 4C 00 00 00 02 A8 42 4F 43 48 53 20  // PPTTL.....BOCHS
    0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
    0020: 01 00 00 00 00 14 00 00 01 00 00 00 00 00 00 00  // ................
 -  0030: 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00  // ................
 -  0040: 24 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00  // $...............
 -  0050: 0A 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00  // ....8...........
 +  0030: 00 00 00 00 00 00 00 00 00 14 00 00 0A 00 00 00  // ................
 +  0040: 24 00 00 00 00 00 00 00 00 00 00 00              // $...........

PPTT.acpihmatvirt is also updated:
  /*
   * Intel ACPI Component Architecture
   * AML/ASL+ Disassembler version 20180105 (64-bit version)
   * Copyright (c) 2000 - 2018 Intel Corporation
   *
 - * Disassembly of tests/data/acpi/virt/PPTT.acpihmatvirt, Wed Dec 28 15:36:06 2022
 + * Disassembly of /tmp/aml-IPKJX1, Wed Dec 28 15:36:06 2022
   *
   * ACPI Data Table [PPTT]
   *
   * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
   */

  [000h 0000   4]                    Signature : "PPTT"    [Processor Properties Topology Table]
 -[004h 0004   4]                 Table Length : 000000C4
 +[004h 0004   4]                 Table Length : 0000009C
  [008h 0008   1]                     Revision : 02
 -[009h 0009   1]                     Checksum : 9E
 +[009h 0009   1]                     Checksum : FE
  [00Ah 0010   6]                       Oem ID : "BOCHS "
  [010h 0016   8]                 Oem Table ID : "BXPC    "
  [018h 0024   4]                 Oem Revision : 00000001
  [01Ch 0028   4]              Asl Compiler ID : "BXPC"
  [020h 0032   4]        Asl Compiler Revision : 00000001

  [024h 0036   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [025h 0037   1]                       Length : 14
  [026h 0038   2]                     Reserved : 0000
  [028h 0040   4]        Flags (decoded below) : 00000001
                              Physical package : 1
                       ACPI Processor ID valid : 0
  [02Ch 0044   4]                       Parent : 00000000
  [030h 0048   4]            ACPI Processor ID : 00000000
  [034h 0052   4]      Private Resource Number : 00000000

  [038h 0056   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [039h 0057   1]                       Length : 14
  [03Ah 0058   2]                     Reserved : 0000
 -[03Ch 0060   4]        Flags (decoded below) : 00000000
 +[03Ch 0060   4]        Flags (decoded below) : 0000000A
                              Physical package : 0
 -                     ACPI Processor ID valid : 0
 +                     ACPI Processor ID valid : 1
  [040h 0064   4]                       Parent : 00000024
  [044h 0068   4]            ACPI Processor ID : 00000000
  [048h 0072   4]      Private Resource Number : 00000000

  [04Ch 0076   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [04Dh 0077   1]                       Length : 14
  [04Eh 0078   2]                     Reserved : 0000
  [050h 0080   4]        Flags (decoded below) : 0000000A
                              Physical package : 0
                       ACPI Processor ID valid : 1
 -[054h 0084   4]                       Parent : 00000038
 -[058h 0088   4]            ACPI Processor ID : 00000000
 +[054h 0084   4]                       Parent : 00000024
 +[058h 0088   4]            ACPI Processor ID : 00000001
  [05Ch 0092   4]      Private Resource Number : 00000000

  [060h 0096   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [061h 0097   1]                       Length : 14
  [062h 0098   2]                     Reserved : 0000
 -[064h 0100   4]        Flags (decoded below) : 0000000A
 -                            Physical package : 0
 -                     ACPI Processor ID valid : 1
 -[068h 0104   4]                       Parent : 00000038
 +[064h 0100   4]        Flags (decoded below) : 00000001
 +                            Physical package : 1
 +                     ACPI Processor ID valid : 0
 +[068h 0104   4]                       Parent : 00000000
  [06Ch 0108   4]            ACPI Processor ID : 00000001
  [070h 0112   4]      Private Resource Number : 00000000

  [074h 0116   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [075h 0117   1]                       Length : 14
  [076h 0118   2]                     Reserved : 0000
 -[078h 0120   4]        Flags (decoded below) : 00000001
 -                            Physical package : 1
 -                     ACPI Processor ID valid : 0
 -[07Ch 0124   4]                       Parent : 00000000
 -[080h 0128   4]            ACPI Processor ID : 00000001
 +[078h 0120   4]        Flags (decoded below) : 0000000A
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[07Ch 0124   4]                       Parent : 00000060
 +[080h 0128   4]            ACPI Processor ID : 00000002
  [084h 0132   4]      Private Resource Number : 00000000

  [088h 0136   1]                Subtable Type : 00 [Processor Hierarchy Node]
  [089h 0137   1]                       Length : 14
  [08Ah 0138   2]                     Reserved : 0000
 -[08Ch 0140   4]        Flags (decoded below) : 00000000
 -                            Physical package : 0
 -                     ACPI Processor ID valid : 0
 -[090h 0144   4]                       Parent : 00000074
 -[094h 0148   4]            ACPI Processor ID : 00000000
 -[098h 0152   4]      Private Resource Number : 00000000
 -
 -[09Ch 0156   1]                Subtable Type : 00 [Processor Hierarchy Node]
 -[09Dh 0157   1]                       Length : 14
 -[09Eh 0158   2]                     Reserved : 0000
 -[0A0h 0160   4]        Flags (decoded below) : 0000000A
 -                            Physical package : 0
 -                     ACPI Processor ID valid : 1
 -[0A4h 0164   4]                       Parent : 00000088
 -[0A8h 0168   4]            ACPI Processor ID : 00000002
 -[0ACh 0172   4]      Private Resource Number : 00000000
 -
 -[0B0h 0176   1]                Subtable Type : 00 [Processor Hierarchy Node]
 -[0B1h 0177   1]                       Length : 14
 -[0B2h 0178   2]                     Reserved : 0000
 -[0B4h 0180   4]        Flags (decoded below) : 0000000A
 +[08Ch 0140   4]        Flags (decoded below) : 0000000A
                              Physical package : 0
                       ACPI Processor ID valid : 1
 -[0B8h 0184   4]                       Parent : 00000088
 -[0BCh 0188   4]            ACPI Processor ID : 00000003
 -[0C0h 0192   4]      Private Resource Number : 00000000
 +[090h 0144   4]                       Parent : 00000060
 +[094h 0148   4]            ACPI Processor ID : 00000003
 +[098h 0152   4]      Private Resource Number : 00000000

 -Raw Table Data: Length 196 (0xC4)
 +Raw Table Data: Length 156 (0x9C)

 -  0000: 50 50 54 54 C4 00 00 00 02 9E 42 4F 43 48 53 20  // PPTT......BOCHS
 +  0000: 50 50 54 54 9C 00 00 00 02 FE 42 4F 43 48 53 20  // PPTT......BOCHS
    0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
    0020: 01 00 00 00 00 14 00 00 01 00 00 00 00 00 00 00  // ................
 -  0030: 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00  // ................
 +  0030: 00 00 00 00 00 00 00 00 00 14 00 00 0A 00 00 00  // ................
    0040: 24 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00  // $...............
 -  0050: 0A 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00  // ....8...........
 -  0060: 00 14 00 00 0A 00 00 00 38 00 00 00 01 00 00 00  // ........8.......
 -  0070: 00 00 00 00 00 14 00 00 01 00 00 00 00 00 00 00  // ................
 -  0080: 01 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00  // ................
 -  0090: 74 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00  // t...............
 -  00A0: 0A 00 00 00 88 00 00 00 02 00 00 00 00 00 00 00  // ................
 -  00B0: 00 14 00 00 0A 00 00 00 88 00 00 00 03 00 00 00  // ................
 -  00C0: 00 00 00 00                                      // ....
 +  0050: 0A 00 00 00 24 00 00 00 01 00 00 00 00 00 00 00  // ....$...........
 +  0060: 00 14 00 00 01 00 00 00 00 00 00 00 01 00 00 00  // ................
 +  0070: 00 00 00 00 00 14 00 00 0A 00 00 00 60 00 00 00  // ............`...
 +  0080: 02 00 00 00 00 00 00 00 00 14 00 00 0A 00 00 00  // ................
 +  0090: 60 00 00 00 03 00 00 00 00 00 00 00              // `...........

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Message-Id: <20221229065513.55652-4-yangyicong@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |   2 --
 tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
 tests/data/acpi/virt/PPTT.acpihmatvirt      | Bin 196 -> 156 bytes
 3 files changed, 2 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index fc12cd8c5c..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,3 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/PPTT",
-"tests/data/acpi/virt/PPTT.acpihmatvirt",
diff --git a/tests/data/acpi/virt/PPTT b/tests/data/acpi/virt/PPTT
index f56ea63b369a604877374ad696c396e796ab1c83..7a1258ecf123555b24462c98ccbb76b4ac1d0c2b 100644
GIT binary patch
delta 32
fcmYfB;R*-{3GrcIU|?D?k;`ae01J-_kOKn%ZFdCM

delta 53
pcmeZC;0g!`2}xjJU|{l?$YrDgWH5jU5Ca567#O&Klm(arApowi1QY-O

diff --git a/tests/data/acpi/virt/PPTT.acpihmatvirt b/tests/data/acpi/virt/PPTT.acpihmatvirt
index 710dba5e793cf36df94087666db58af5f8d03684..4eef303a5b6168c6bc3795c2e2c53f65b4c4cfd4 100644
GIT binary patch
delta 66
zcmX@YIERrdARr`U4g&)N)4z#aMiT>ACOU{Ps!YsOR^b8)CV(V>7z{)h7+_+|P$2-t
C;0Zeb

delta 75
zcmbQkc!ZHFARr{<2m=EH)4YjXMvM#-ZN(WaCOQfOiBM%$pg2Pbkf+cAQUT(DfCvKv
N7mxypF@yL(0023a3f%wz

-- 
MST



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

* [PULL 47/51] tests: acpi: Add and whitelist *.topology blobs
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (42 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 46/51] tests: virt: Update expected ACPI tables for virt test Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:16 ` [PULL 48/51] tests: acpi: aarch64: Add topology test for aarch64 Michael S. Tsirkin
                   ` (8 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Yicong Yang, Yanan Wang, Igor Mammedov, Ani Sinha

From: Yicong Yang <yangyicong@hisilicon.com>

Add and whitelist *.topology blobs, prepares for the aarch64's ACPI
topology building test.

Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Message-Id: <20221229065513.55652-5-yangyicong@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h | 3 +++
 tests/data/acpi/virt/APIC.topology          | 0
 tests/data/acpi/virt/DSDT.topology          | 0
 tests/data/acpi/virt/PPTT.topology          | 0
 4 files changed, 3 insertions(+)
 create mode 100644 tests/data/acpi/virt/APIC.topology
 create mode 100644 tests/data/acpi/virt/DSDT.topology
 create mode 100644 tests/data/acpi/virt/PPTT.topology

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index dfb8523c8b..90f53f9c1d 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1 +1,4 @@
 /* List of comma-separated changed AML files to ignore */
+"tests/data/acpi/virt/APIC.topology",
+"tests/data/acpi/virt/DSDT.topology",
+"tests/data/acpi/virt/PPTT.topology",
diff --git a/tests/data/acpi/virt/APIC.topology b/tests/data/acpi/virt/APIC.topology
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/virt/DSDT.topology b/tests/data/acpi/virt/DSDT.topology
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/data/acpi/virt/PPTT.topology b/tests/data/acpi/virt/PPTT.topology
new file mode 100644
index 0000000000..e69de29bb2
-- 
MST



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

* [PULL 48/51] tests: acpi: aarch64: Add topology test for aarch64
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (43 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 47/51] tests: acpi: Add and whitelist *.topology blobs Michael S. Tsirkin
@ 2023-01-05  9:16 ` Michael S. Tsirkin
  2023-01-05  9:17 ` [PULL 49/51] tests: acpi: aarch64: Add *.topology tables Michael S. Tsirkin
                   ` (7 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Yicong Yang, Yanan Wang, Igor Mammedov, Ani Sinha

From: Yicong Yang <yangyicong@hisilicon.com>

Add test for aarch64's ACPI topology building for all the supported
levels.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Tested-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Message-Id: <20221229065513.55652-6-yangyicong@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 395d441212..e954a9cb39 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -1720,6 +1720,24 @@ static void test_acpi_virt_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_virt_tcg_topology(void)
+{
+    test_data data = {
+        .machine = "virt",
+        .variant = ".topology",
+        .tcg_only = true,
+        .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+        .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+        .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+        .ram_start = 0x40000000ULL,
+        .scan_len = 128ULL * 1024 * 1024,
+    };
+
+    test_acpi_one("-cpu cortex-a57 "
+                  "-smp sockets=1,clusters=2,cores=2,threads=2", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_viot(void)
 {
     test_data data = {
@@ -2057,6 +2075,7 @@ int main(int argc, char *argv[])
             qtest_add_func("acpi/virt", test_acpi_virt_tcg);
             qtest_add_func("acpi/virt/acpihmatvirt",
                             test_acpi_virt_tcg_acpi_hmat);
+            qtest_add_func("acpi/virt/topology", test_acpi_virt_tcg_topology);
             qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem);
             qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp);
             qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb);
-- 
MST



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

* [PULL 49/51] tests: acpi: aarch64: Add *.topology tables
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (44 preceding siblings ...)
  2023-01-05  9:16 ` [PULL 48/51] tests: acpi: aarch64: Add topology test for aarch64 Michael S. Tsirkin
@ 2023-01-05  9:17 ` Michael S. Tsirkin
  2023-01-05  9:17 ` [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
                   ` (6 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Yicong Yang, Yanan Wang, Igor Mammedov, Ani Sinha

From: Yicong Yang <yangyicong@hisilicon.com>

Add *.topology tables for the aarch64's topology test and empty
bios-tables-test-allowed-diff.h

The disassembled differences between actual and expected
PPTT (the table which we actually care about):

 +/*
 + * Intel ACPI Component Architecture
 + * AML/ASL+ Disassembler version 20180105 (64-bit version)
 + * Copyright (c) 2000 - 2018 Intel Corporation
 + *
 + * Disassembly of /tmp/aml-WUN4U1, Tue Nov  1 09:51:52 2022
 + *
 + * ACPI Data Table [PPTT]
 + *
 + * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 + */
 +
 +[000h 0000   4]                    Signature : "PPTT"    [Processor Properties Topology Table]
 +[004h 0004   4]                 Table Length : 00000150
 +[008h 0008   1]                     Revision : 02
 +[009h 0009   1]                     Checksum : 7C
 +[00Ah 0010   6]                       Oem ID : "BOCHS "
 +[010h 0016   8]                 Oem Table ID : "BXPC    "
 +[018h 0024   4]                 Oem Revision : 00000001
 +[01Ch 0028   4]              Asl Compiler ID : "BXPC"
 +[020h 0032   4]        Asl Compiler Revision : 00000001
 +
 +
 +[024h 0036   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[025h 0037   1]                       Length : 14
 +[026h 0038   2]                     Reserved : 0000
 +[028h 0040   4]        Flags (decoded below) : 00000001
 +                            Physical package : 1
 +                     ACPI Processor ID valid : 0
 +[02Ch 0044   4]                       Parent : 00000000
 +[030h 0048   4]            ACPI Processor ID : 00000000
 +[034h 0052   4]      Private Resource Number : 00000000
 +
 +[038h 0056   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[039h 0057   1]                       Length : 14
 +[03Ah 0058   2]                     Reserved : 0000
 +[03Ch 0060   4]        Flags (decoded below) : 00000000
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 0
 +[040h 0064   4]                       Parent : 00000024
 +[044h 0068   4]            ACPI Processor ID : 00000000
 +[048h 0072   4]      Private Resource Number : 00000000
 +
 +[04Ch 0076   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[04Dh 0077   1]                       Length : 14
 +[04Eh 0078   2]                     Reserved : 0000
 +[050h 0080   4]        Flags (decoded below) : 00000000
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 0
 +[054h 0084   4]                       Parent : 00000038
 +[058h 0088   4]            ACPI Processor ID : 00000000
 +[05Ch 0092   4]      Private Resource Number : 00000000
 +
 +[060h 0096   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[061h 0097   1]                       Length : 14
 +[062h 0098   2]                     Reserved : 0000
 +[064h 0100   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[068h 0104   4]                       Parent : 0000004C
 +[06Ch 0108   4]            ACPI Processor ID : 00000000
 +[070h 0112   4]      Private Resource Number : 00000000
 +
 +[074h 0116   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[075h 0117   1]                       Length : 14
 +[076h 0118   2]                     Reserved : 0000
 +[078h 0120   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[07Ch 0124   4]                       Parent : 0000004C
 +[080h 0128   4]            ACPI Processor ID : 00000001
 +[084h 0132   4]      Private Resource Number : 00000000
 +
 +[088h 0136   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[089h 0137   1]                       Length : 14
 +[08Ah 0138   2]                     Reserved : 0000
 +[08Ch 0140   4]        Flags (decoded below) : 00000000
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 0
 +[090h 0144   4]                       Parent : 00000038
 +[094h 0148   4]            ACPI Processor ID : 00000001
 +[098h 0152   4]      Private Resource Number : 00000000
 +
 +[09Ch 0156   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[09Dh 0157   1]                       Length : 14
 +[09Eh 0158   2]                     Reserved : 0000
 +[0A0h 0160   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[0A4h 0164   4]                       Parent : 00000088
 +[0A8h 0168   4]            ACPI Processor ID : 00000002
 +[0ACh 0172   4]      Private Resource Number : 00000000
 +
 +[0B0h 0176   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[0B1h 0177   1]                       Length : 14
 +[0B2h 0178   2]                     Reserved : 0000
 +[0B4h 0180   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[0B8h 0184   4]                       Parent : 00000088
 +[0BCh 0188   4]            ACPI Processor ID : 00000003
 +[0C0h 0192   4]      Private Resource Number : 00000000
 +
 +[0C4h 0196   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[0C5h 0197   1]                       Length : 14
 +[0C6h 0198   2]                     Reserved : 0000
 +[0C8h 0200   4]        Flags (decoded below) : 00000000
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 0
 +[0CCh 0204   4]                       Parent : 00000024
 +[0D0h 0208   4]            ACPI Processor ID : 00000001
 +[0D4h 0212   4]      Private Resource Number : 00000000
 +
 +[0D8h 0216   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[0D9h 0217   1]                       Length : 14
 +[0DAh 0218   2]                     Reserved : 0000
 +[0DCh 0220   4]        Flags (decoded below) : 00000000
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 0
 +[0E0h 0224   4]                       Parent : 000000C4
 +[0E4h 0228   4]            ACPI Processor ID : 00000000
 +[0E8h 0232   4]      Private Resource Number : 00000000
 +
 +[0ECh 0236   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[0EDh 0237   1]                       Length : 14
 +[0EEh 0238   2]                     Reserved : 0000
 +[0F0h 0240   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[0F4h 0244   4]                       Parent : 000000D8
 +[0F8h 0248   4]            ACPI Processor ID : 00000004
 +[0FCh 0252   4]      Private Resource Number : 00000000
 +
 +[100h 0256   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[101h 0257   1]                       Length : 14
 +[102h 0258   2]                     Reserved : 0000
 +[104h 0260   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[108h 0264   4]                       Parent : 000000D8
 +[10Ch 0268   4]            ACPI Processor ID : 00000005
 +[110h 0272   4]      Private Resource Number : 00000000
 +
 +[114h 0276   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[115h 0277   1]                       Length : 14
 +[116h 0278   2]                     Reserved : 0000
 +[118h 0280   4]        Flags (decoded below) : 00000000
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 0
 +[11Ch 0284   4]                       Parent : 000000C4
 +[120h 0288   4]            ACPI Processor ID : 00000001
 +[124h 0292   4]      Private Resource Number : 00000000
 +
 +[128h 0296   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[129h 0297   1]                       Length : 14
 +[12Ah 0298   2]                     Reserved : 0000
 +[12Ch 0300   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[130h 0304   4]                       Parent : 00000114
 +[134h 0308   4]            ACPI Processor ID : 00000006
 +[138h 0312   4]      Private Resource Number : 00000000
 +
 +[13Ch 0316   1]                Subtable Type : 00 [Processor Hierarchy Node]
 +[13Dh 0317   1]                       Length : 14
 +[13Eh 0318   2]                     Reserved : 0000
 +[140h 0320   4]        Flags (decoded below) : 0000000E
 +                            Physical package : 0
 +                     ACPI Processor ID valid : 1
 +[144h 0324   4]                       Parent : 00000114
 +[148h 0328   4]            ACPI Processor ID : 00000007
 +[14Ch 0332   4]      Private Resource Number : 00000000
 +
 +Raw Table Data: Length 336 (0x150)
 +
 +  0000: 50 50 54 54 50 01 00 00 02 7C 42 4F 43 48 53 20  // PPTTP....|BOCHS
 +  0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
 +  0020: 01 00 00 00 00 14 00 00 01 00 00 00 00 00 00 00  // ................
 +  0030: 00 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00  // ................
 +  0040: 24 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00  // $...............
 +  0050: 00 00 00 00 38 00 00 00 00 00 00 00 00 00 00 00  // ....8...........
 +  0060: 00 14 00 00 0E 00 00 00 4C 00 00 00 00 00 00 00  // ........L.......
 +  0070: 00 00 00 00 00 14 00 00 0E 00 00 00 4C 00 00 00  // ............L...
 +  0080: 01 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00  // ................
 +  0090: 38 00 00 00 01 00 00 00 00 00 00 00 00 14 00 00  // 8...............
 +  00A0: 0E 00 00 00 88 00 00 00 02 00 00 00 00 00 00 00  // ................
 +  00B0: 00 14 00 00 0E 00 00 00 88 00 00 00 03 00 00 00  // ................
 +  00C0: 00 00 00 00 00 14 00 00 00 00 00 00 24 00 00 00  // ............$...
 +  00D0: 01 00 00 00 00 00 00 00 00 14 00 00 00 00 00 00  // ................
 +  00E0: C4 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00  // ................
 +  00F0: 0E 00 00 00 D8 00 00 00 04 00 00 00 00 00 00 00  // ................
 +  0100: 00 14 00 00 0E 00 00 00 D8 00 00 00 05 00 00 00  // ................
 +  0110: 00 00 00 00 00 14 00 00 00 00 00 00 C4 00 00 00  // ................
 +  0120: 01 00 00 00 00 00 00 00 00 14 00 00 0E 00 00 00  // ................
 +  0130: 14 01 00 00 06 00 00 00 00 00 00 00 00 14 00 00  // ................
 +  0140: 0E 00 00 00 14 01 00 00 07 00 00 00 00 00 00 00  // ................

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Message-Id: <20221229065513.55652-7-yangyicong@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test-allowed-diff.h |   3 ---
 tests/data/acpi/virt/APIC.topology          | Bin 0 -> 732 bytes
 tests/data/acpi/virt/DSDT.topology          | Bin 0 -> 5398 bytes
 tests/data/acpi/virt/PPTT.topology          | Bin 0 -> 336 bytes
 4 files changed, 3 deletions(-)

diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
index 90f53f9c1d..dfb8523c8b 100644
--- a/tests/qtest/bios-tables-test-allowed-diff.h
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
@@ -1,4 +1 @@
 /* List of comma-separated changed AML files to ignore */
-"tests/data/acpi/virt/APIC.topology",
-"tests/data/acpi/virt/DSDT.topology",
-"tests/data/acpi/virt/PPTT.topology",
diff --git a/tests/data/acpi/virt/APIC.topology b/tests/data/acpi/virt/APIC.topology
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3a6ac525e7faeaec025fa6b3fc01dc67110e1296 100644
GIT binary patch
literal 732
zcmbV~I}XAy5JV@5`A9$wWsU-I0~MBNI4nouFziE~Aj){8k#|;}Cl|hyTYmRadQJCy
zeT>ty<T2DqV&=5=Cr{dXimG<SN%H;UZxvHl@27eWbN}yJ4e;RDte5iq4!ZDoC-#0R
zkFEu8h=5ypbS-!(0&eBewcxEH;8q@83*I^cZspOn;B6w{RvumJF#pT``>$Z0RrCRg
C#|;4h

literal 0
HcmV?d00001

diff --git a/tests/data/acpi/virt/DSDT.topology b/tests/data/acpi/virt/DSDT.topology
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..501314c91be01d927fd125e0c72e919fdd85592e 100644
GIT binary patch
literal 5398
zcmZvg%WoT16o>EFlh__VVmr?J;S@^6vl`n?la>}@kDbINPK+mQkX*@?5QvgZB`Ty+
zA*ERq=#EBW9i&M78%V6!v17rS4gUZ;%(-)ClHYO9NEy$Wd(SuX%^YWrr|CEMr>B&P
zoiz5mZGWZlN!MGU#ZpS?ZT*>lwrAZR_>DpTc;0heH#yjDH?wuG+ooVmB?ougO=ZR^
z(wNmhUZA|HH0H$2U`-s1o55@1plt?M#lbN%cwHPEH-l^9V4{C~)7$Grmc7ol>sBhE
zWpd#4{KC95^E{>WrAev0Qa_9<%eq9-6S@lPn+M*e0e{@;+@&j2rCfi%?xZQ%t6K(9
zaB>C_OU;Ivb^Bf~y0|;Ly*)}@y*TW7=EcDs6$=mUA|kv89H9^U3L>U15S0+o&}R|e
zDvoes62k^Y6&c|j9bv>J#yBu)$Ov!z2*Z{bNnl(<Mpz#sj4_Gf0Am#yVHu4u#wA7u
z7}t>zR@(?8Au)2mSVP9TDXbAjQexzRv5t%zA|oX+iom!5j7s?B7&#9|Vw8Y!6B%Ne
z@-InL>eIk@9~p9;W~B3&1;#C8$aR{P81ulmjSRU?a}r|_7#|=*uG0yLu?&n4ks;S<
zUSg~OV*?p-ofag<Yrv=@L$1@J#JCKM1~TM2os<|?fZ+k7D%WXAV!R2ACNktYost-D
z1EYluxlX4g#=F4SM21|aGZNz}Ft(5(*XgXpaDlOn47pC{Bt{h&ZDh!GIxjJ<0pkub
z<T_oD7}tUE5i;aDU6dH>z}P{CT&GJC<0ddVz^KV}x-2nn0b>^#a-EhX#s|RI3mLn=
zbiH<X9^KupTX)x~`S7UGGf_=<F|93HHyXR=ZHd3%E0mqZuJTk{eWq5FOMgw;`dU3y
zpVFt&kf8DC_Vy=tzH*L=X*)d}sx80mDzk0Tc10C4dcPB+pc(~n3TmpDwKKz^rF0I>
z3nQIH6LV%P$fK!Is56Nl%%v{L%nc)*8BL`YNFR}=2ALG<%;+fbATv6HxYC)?)VRr{
zsX-=%I+M;QIEo!)MrU9LnbA~gnL^7TlS1?yW1eF{X5=|$GNY5H5Ix74CpD#XKG9Ta
zvCxx3^h_|%1oKRAPYTg9$vl(HlUg$Lq!2w*%#+$_bM=BtlH#5eqNl?=9p*_b9C}iS
zo@wTpW}a#8Ng;Y>m}iE0Qp<;)6ryLAd1jesmU~i&o;l{3W1iF^q9=vuIl(+9nCArd
zq!2yn=ZvZGpo;U%lUhpjq!2v|%(K8e3*3`J^ei&ZBJ-pc6g??K&q?Mv$vh{yCxz%)
zVxA@DNi8dSQiz`PW0|f{^dDl1c}{Up3ej_#c}_D=YH`t%LiC(ro-@pIhI>+op7i4q
z?&mD?q?Q;xDMZgX<~hea=eQ?@=sC|k=b0z9(CA4adM+@}1?IWHJt;)bMdrE4JgMbI
zPYTg<iFqzD&n50jA$l$|&t>LGEjoHqh@NHUS!SMP?n$BX>>syneJjn+H~mod+|Ba`
zahG08<eYTyD&qCvkxtLuSN4_02Y%0|_b~w~>=+n|-V-3|vVb!C&QW*tS%nQQL+SSg
z$a+IynSGoUHoBZe?+uW3MPQkIA*+-hc#XO`qyM2Qzd<W=Ikpqd<L|R7M*q%f8S0hw
z9eukp)LjHiemMM3|16_rc$G%14D|qJp{9kFA&pw<#XFD_3?Jz+y#&$4O7DN7lK$Op
zS0%mu-i|75rUrYyXTLa9Uh|-Gx}7-rqA=;?`<=gP|CSdwemZzu|Mm8tpT9VCY?@G|
z&m?`;9_c`H^hQmip6ZoT*6Y*!%ae!Jw=_}-W>-$9U!Fws%<jA%e55Dq{bz?i=gfY6
zkjmL%>AgYI@7Sl8%-Q_0_WR%d>NlMqXa4ET{pNK}Qzu`lvqIdm^om||b?jctXVs`*
zbm^L_IqoahC%6Z6b;=tTmqu^V^Txb4Yb5Sp)$bU$TFrqear1()q8m?o!I-6ikZ<Zd
zZoOqvk6JzIOX-d#Q;yw#me!%y@>@GArKLgZ-hS$l4j!E5Po6$-bien!d(dk*NB!eD
My@B5+&m2qr5A>`*Jpcdz

literal 0
HcmV?d00001

diff --git a/tests/data/acpi/virt/PPTT.topology b/tests/data/acpi/virt/PPTT.topology
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3fbcae5ff08aaf16fedf4da45e941661d79c1174 100644
GIT binary patch
literal 336
zcmWFt2nh*bWME*baq@Te2v%^42yj*a0-z8Bhz+6{L>L&rG>8oYKrs+dflv?<DrSKu
z#s}p4;1GkGi=-D>45YUMh?!vef$Csl%t&G&Cde(wdO>1GKm-gx_1*yTS+Iz)B8h>R
aAic=uf$S9l3b27BK>%tVNQ@mK!T<mOd=3Es

literal 0
HcmV?d00001

-- 
MST



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

* [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (45 preceding siblings ...)
  2023-01-05  9:17 ` [PULL 49/51] tests: acpi: aarch64: Add *.topology tables Michael S. Tsirkin
@ 2023-01-05  9:17 ` Michael S. Tsirkin
  2023-01-05  9:56   ` Michael S. Tsirkin
  2023-01-05  9:17 ` [PULL 51/51] vhost-scsi: fix memleak of vsc->inflight Michael S. Tsirkin
                   ` (5 subsequent siblings)
  52 siblings, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laszlo Ersek, Ani Sinha, Ard Biesheuvel,
	Igor Mammedov, Paolo Bonzini, qemu-stable,
	Philippe Mathieu-Daudé

From: Laszlo Ersek <lersek@redhat.com>

The modern ACPI CPU hotplug interface was introduced in the following
series (aa1dd39ca307..679dd1a957df), released in v2.7.0:

  1  abd49bc2ed2f docs: update ACPI CPU hotplug spec with new protocol
  2  16bcab97eb9f pc: piix4/ich9: add 'cpu-hotplug-legacy' property
  3  5e1b5d93887b acpi: cpuhp: add CPU devices AML with _STA method
  4  ac35f13ba8f8 pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
  5  d2238cb6781d acpi: cpuhp: implement hot-add parts of CPU hotplug
                  interface
  6  8872c25a26cc acpi: cpuhp: implement hot-remove parts of CPU hotplug
                  interface
  7  76623d00ae57 acpi: cpuhp: add cpu._OST handling
  8  679dd1a957df pc: use new CPU hotplug interface since 2.7 machine type

Before patch#1, "docs/specs/acpi_cpu_hotplug.txt" only specified 1-byte
accesses for the hotplug register block.  Patch#1 preserved the same
restriction for the legacy register block, but:

- it specified DWORD accesses for some of the modern registers,

- in particular, the switch from the legacy block to the modern block
  would require a DWORD write to the *legacy* block.

The latter functionality was then implemented in cpu_status_write()
[hw/acpi/cpu_hotplug.c], in patch#8.

Unfortunately, all DWORD accesses depended on a dormant bug: the one
introced in earlier commit a014ed07bd5a ("memory: accept mismatching sizes
in memory_region_access_valid", 2013-05-29); first released in v1.6.0.
Due to commit a014ed07bd5a, the DWORD accesses to the *legacy* CPU hotplug
register block would work in spite of the above series *not* relaxing
"valid.max_access_size = 1" in "hw/acpi/cpu_hotplug.c":

> static const MemoryRegionOps AcpiCpuHotplug_ops = {
>     .read = cpu_status_read,
>     .write = cpu_status_write,
>     .endianness = DEVICE_LITTLE_ENDIAN,
>     .valid = {
>         .min_access_size = 1,
>         .max_access_size = 1,
>     },
> };

Later, in commits e6d0c3ce6895 ("acpi: cpuhp: introduce 'Command data 2'
field", 2020-01-22) and ae340aa3d256 ("acpi: cpuhp: spec: add typical
usecases", 2020-01-22), first released in v5.0.0, the modern CPU hotplug
interface (including the documentation) was extended with another DWORD
*read* access, namely to the "Command data 2" register, which would be
important for the guest to confirm whether it managed to switch the
register block from legacy to modern.

This functionality too silently depended on the bug from commit
a014ed07bd5a.

In commit 5d971f9e6725 ('memory: Revert "memory: accept mismatching sizes
in memory_region_access_valid"', 2020-06-26), first released in v5.1.0,
the bug from commit a014ed07bd5a was fixed (the commit was reverted).
That swiftly exposed the bug in "AcpiCpuHotplug_ops", still present from
the v2.7.0 series quoted at the top -- namely the fact that
"valid.max_access_size = 1" didn't match what the guest was supposed to
do, according to the spec ("docs/specs/acpi_cpu_hotplug.txt").

The symptom is that the "modern interface negotiation protocol"
described in commit ae340aa3d256:

> +      Use following steps to detect and enable modern CPU hotplug interface:
> +        1. Store 0x0 to the 'CPU selector' register,
> +           attempting to switch to modern mode
> +        2. Store 0x0 to the 'CPU selector' register,
> +           to ensure valid selector value
> +        3. Store 0x0 to the 'Command field' register,
> +        4. Read the 'Command data 2' register.
> +           If read value is 0x0, the modern interface is enabled.
> +           Otherwise legacy or no CPU hotplug interface available

falls apart for the guest: steps 1 and 2 are lost, because they are DWORD
writes; so no switching happens.  Step 3 (a single-byte write) is not
lost, but it has no effect; see the condition in cpu_status_write() in
patch#8.  And step 4 *misleads* the guest into thinking that the switch
worked: the DWORD read is lost again -- it returns zero to the guest
without ever reaching the device model, so the guest never learns the
switch didn't work.

This means that guest behavior centered on the "Command data 2" register
worked *only* in the v5.0.0 release; it got effectively regressed in
v5.1.0.

To make things *even more* complicated, the breakage was (and remains, as
of today) visible with TCG acceleration only.  Commit 5d971f9e6725 makes
no difference with KVM acceleration -- the DWORD accesses still work,
despite "valid.max_access_size = 1".

As commit 5d971f9e6725 suggests, fix the problem by raising
"valid.max_access_size" to 4 -- the spec now clearly instructs the guest
to perform DWORD accesses to the legacy register block too, for enabling
(and verifying!) the modern block.  In order to keep compatibility for the
device model implementation though, set "impl.max_access_size = 1", so
that wide accesses be split before they reach the legacy read/write
handlers, like they always have been on KVM, and like they were on TCG
before 5d971f9e6725 (v5.1.0).

Tested with:

- OVMF IA32 + qemu-system-i386, CPU hotplug/hot-unplug with SMM,
  intermixed with ACPI S3 suspend/resume, using KVM accel
  (regression-test);

- OVMF IA32X64 + qemu-system-x86_64, CPU hotplug/hot-unplug with SMM,
  intermixed with ACPI S3 suspend/resume, using KVM accel
  (regression-test);

- OVMF IA32 + qemu-system-i386, SMM enabled, using TCG accel; verified the
  register block switch and the present/possible CPU counting through the
  modern hotplug interface, during OVMF boot (bugfix test);

- I do not have any testcase (guest payload) for regression-testing CPU
  hotplug through the *legacy* CPU hotplug register block.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Ani Sinha <ani@anisinha.ca>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Ref: "IO port write width clamping differs between TCG and KVM"
Link: http://mid.mail-archive.com/aaedee84-d3ed-a4f9-21e7-d221a28d1683@redhat.com
Link: https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg00199.html
Reported-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230104090138.214862-1-lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Fixes: b8622725cf ("acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/cpu_hotplug.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index 53654f8638..ff14c3f410 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -52,6 +52,9 @@ static const MemoryRegionOps AcpiCpuHotplug_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
     .valid = {
         .min_access_size = 1,
+        .max_access_size = 4,
+    },
+    .impl = {
         .max_access_size = 1,
     },
 };
-- 
MST



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

* [PULL 51/51] vhost-scsi: fix memleak of vsc->inflight
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (46 preceding siblings ...)
  2023-01-05  9:17 ` [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
@ 2023-01-05  9:17 ` Michael S. Tsirkin
  2023-01-05  9:21 ` [PULL 28/51] include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use Michael S. Tsirkin
                   ` (4 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Dongli Zhang, Joe Jin, Li Feng, Paolo Bonzini, Fam Zheng

From: Dongli Zhang <dongli.zhang@oracle.com>

This is below memleak detected when to quit the qemu-system-x86_64 (with
vhost-scsi-pci).

(qemu) quit

=================================================================
==15568==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f00aec57917 in __interceptor_calloc (/lib64/libasan.so.6+0xb4917)
    #1 0x7f00ada0d7b5 in g_malloc0 (/lib64/libglib-2.0.so.0+0x517b5)
    #2 0x5648ffd38bac in vhost_scsi_start ../hw/scsi/vhost-scsi.c:92
    #3 0x5648ffd38d52 in vhost_scsi_set_status ../hw/scsi/vhost-scsi.c:131
    #4 0x5648ffda340e in virtio_set_status ../hw/virtio/virtio.c:2036
    #5 0x5648ff8de281 in virtio_ioport_write ../hw/virtio/virtio-pci.c:431
    #6 0x5648ff8deb29 in virtio_pci_config_write ../hw/virtio/virtio-pci.c:576
    #7 0x5648ffe5c0c2 in memory_region_write_accessor ../softmmu/memory.c:493
    #8 0x5648ffe5c424 in access_with_adjusted_size ../softmmu/memory.c:555
    #9 0x5648ffe6428f in memory_region_dispatch_write ../softmmu/memory.c:1515
    #10 0x5648ffe8613d in flatview_write_continue ../softmmu/physmem.c:2825
    #11 0x5648ffe86490 in flatview_write ../softmmu/physmem.c:2867
    #12 0x5648ffe86d9f in address_space_write ../softmmu/physmem.c:2963
    #13 0x5648ffe86e57 in address_space_rw ../softmmu/physmem.c:2973
    #14 0x5648fffbfb3d in kvm_handle_io ../accel/kvm/kvm-all.c:2639
    #15 0x5648fffc0e0d in kvm_cpu_exec ../accel/kvm/kvm-all.c:2890
    #16 0x5648fffc90a7 in kvm_vcpu_thread_fn ../accel/kvm/kvm-accel-ops.c:51
    #17 0x56490042400a in qemu_thread_start ../util/qemu-thread-posix.c:505
    #18 0x7f00ac3b6ea4 in start_thread (/lib64/libpthread.so.0+0x7ea4)

Free the vsc->inflight at the 'stop' path.

Fixes: b82526c7ee ("vhost-scsi: support inflight io track")
Cc: Joe Jin <joe.jin@oracle.com>
Cc: Li Feng <fengli@smartx.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Message-Id: <20230104160433.21353-1-dongli.zhang@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/scsi/vhost-scsi-common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c
index 18ea5dcfa1..a06f01af26 100644
--- a/hw/scsi/vhost-scsi-common.c
+++ b/hw/scsi/vhost-scsi-common.c
@@ -113,6 +113,7 @@ void vhost_scsi_common_stop(VHostSCSICommon *vsc)
 
     if (vsc->inflight) {
         vhost_dev_free_inflight(vsc->inflight);
+        g_free(vsc->inflight);
         vsc->inflight = NULL;
     }
 
-- 
MST



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

* [PULL 21/51] vhost: add support for configure interrupt
@ 2023-01-05  9:21   ` Michael S. Tsirkin
  0 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Cindy Lu, Jason Wang

From: Cindy Lu <lulu@redhat.com>

Add functions to support configure interrupt.
The configure interrupt process will start in vhost_dev_start
and stop in vhost_dev_stop.

Also add the functions to support vhost_config_pending and
vhost_config_mask.

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20221222070451.936503-8-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/virtio/vhost.h |  4 ++
 hw/virtio/vhost.c         | 78 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 1cafa0d776..a52f273347 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -33,6 +33,7 @@ struct vhost_virtqueue {
     unsigned used_size;
     EventNotifier masked_notifier;
     EventNotifier error_notifier;
+    EventNotifier masked_config_notifier;
     struct vhost_dev *dev;
 };
 
@@ -41,6 +42,7 @@ typedef unsigned long vhost_log_chunk_t;
 #define VHOST_LOG_BITS (8 * sizeof(vhost_log_chunk_t))
 #define VHOST_LOG_CHUNK (VHOST_LOG_PAGE * VHOST_LOG_BITS)
 #define VHOST_INVALID_FEATURE_BIT   (0xff)
+#define VHOST_QUEUE_NUM_CONFIG_INR 0
 
 struct vhost_log {
     unsigned long long size;
@@ -187,6 +189,8 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
  * Disable direct notifications to vhost device.
  */
 void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev);
+bool vhost_config_pending(struct vhost_dev *hdev);
+void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask);
 
 /**
  * vhost_dev_is_started() - report status of vhost device
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index fdcd1a8fdf..2c566dc539 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1640,7 +1640,68 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
     file.index = hdev->vhost_ops->vhost_get_vq_index(hdev, n);
     r = hdev->vhost_ops->vhost_set_vring_call(hdev, &file);
     if (r < 0) {
-        VHOST_OPS_DEBUG(r, "vhost_set_vring_call failed");
+        error_report("vhost_set_vring_call failed %d", -r);
+    }
+}
+
+bool vhost_config_pending(struct vhost_dev *hdev)
+{
+    assert(hdev->vhost_ops);
+    if ((hdev->started == false) ||
+        (hdev->vhost_ops->vhost_set_config_call == NULL)) {
+        return false;
+    }
+
+    EventNotifier *notifier =
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
+    return event_notifier_test_and_clear(notifier);
+}
+
+void vhost_config_mask(struct vhost_dev *hdev, VirtIODevice *vdev, bool mask)
+{
+    int fd;
+    int r;
+    EventNotifier *notifier =
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier;
+    EventNotifier *config_notifier = &vdev->config_notifier;
+    assert(hdev->vhost_ops);
+
+    if ((hdev->started == false) ||
+        (hdev->vhost_ops->vhost_set_config_call == NULL)) {
+        return;
+    }
+    if (mask) {
+        assert(vdev->use_guest_notifier_mask);
+        fd = event_notifier_get_fd(notifier);
+    } else {
+        fd = event_notifier_get_fd(config_notifier);
+    }
+    r = hdev->vhost_ops->vhost_set_config_call(hdev, fd);
+    if (r < 0) {
+        error_report("vhost_set_config_call failed %d", -r);
+    }
+}
+
+static void vhost_stop_config_intr(struct vhost_dev *dev)
+{
+    int fd = -1;
+    assert(dev->vhost_ops);
+    if (dev->vhost_ops->vhost_set_config_call) {
+        dev->vhost_ops->vhost_set_config_call(dev, fd);
+    }
+}
+
+static void vhost_start_config_intr(struct vhost_dev *dev)
+{
+    int r;
+
+    assert(dev->vhost_ops);
+    int fd = event_notifier_get_fd(&dev->vdev->config_notifier);
+    if (dev->vhost_ops->vhost_set_config_call) {
+        r = dev->vhost_ops->vhost_set_config_call(dev, fd);
+        if (!r) {
+            event_notifier_set(&dev->vdev->config_notifier);
+        }
     }
 }
 
@@ -1880,6 +1941,16 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
         }
     }
 
+    r = event_notifier_init(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier, 0);
+    if (r < 0) {
+        return r;
+    }
+    event_notifier_test_and_clear(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
+    if (!vdev->use_guest_notifier_mask) {
+        vhost_config_mask(hdev, vdev, true);
+    }
     if (hdev->log_enabled) {
         uint64_t log_base;
 
@@ -1918,6 +1989,7 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
             vhost_device_iotlb_miss(hdev, vq->used_phys, true);
         }
     }
+    vhost_start_config_intr(hdev);
     return 0;
 fail_start:
     if (vrings) {
@@ -1947,6 +2019,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
 
     /* should only be called after backend is connected */
     assert(hdev->vhost_ops);
+    event_notifier_test_and_clear(
+        &hdev->vqs[VHOST_QUEUE_NUM_CONFIG_INR].masked_config_notifier);
+    event_notifier_test_and_clear(&vdev->config_notifier);
 
     trace_vhost_dev_stop(hdev, vdev->name, vrings);
 
@@ -1969,6 +2044,7 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
         }
         memory_listener_unregister(&hdev->iommu_listener);
     }
+    vhost_stop_config_intr(hdev);
     vhost_log_put(hdev, true);
     hdev->started = false;
     vdev->vhost_started = false;
-- 
MST



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

* [PULL 27/51] include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h
@ 2023-01-05  9:21   ` Michael S. Tsirkin
  0 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Richard Henderson,
	Igor Mammedov, Ani Sinha, Paolo Bonzini, Eduardo Habkost,
	Marcel Apfelbaum, Yuval Shaia, Fam Zheng, Gerd Hoffmann,
	Stefano Stabellini, Anthony Perard, Paul Durrant, Ben Widawsky,
	Jonathan Cameron, Huacai Chen, Philippe Mathieu-Daudé,
	Jiaxun Yang, Andrey Smirnov, Xiaojuan Yang, Song Gao,
	Cédric Le Goater, Paul Burton, Aleksandar Rikalo, xen-devel,
	qemu-arm, qemu-ppc

From: Markus Armbruster <armbru@redhat.com>

hw/pci/pci_bridge.h and hw/cxl/cxl.h include each other.

Fortunately, breaking the loop is merely a matter of deleting
unnecessary includes from headers, and adding them back in places
where they are now missing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221222100330.380143-2-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/alpha/alpha_sys.h              | 1 -
 hw/rdma/rdma_utils.h              | 1 -
 hw/rdma/vmw/pvrdma.h              | 1 -
 hw/usb/hcd-ehci.h                 | 1 -
 hw/xen/xen_pt.h                   | 1 -
 include/hw/cxl/cxl.h              | 1 -
 include/hw/cxl/cxl_cdat.h         | 1 +
 include/hw/cxl/cxl_device.h       | 1 +
 include/hw/cxl/cxl_pci.h          | 2 --
 include/hw/i386/ich9.h            | 4 ----
 include/hw/i386/x86-iommu.h       | 1 -
 include/hw/isa/vt82c686.h         | 1 -
 include/hw/pci-host/designware.h  | 3 ---
 include/hw/pci-host/i440fx.h      | 2 +-
 include/hw/pci-host/ls7a.h        | 2 --
 include/hw/pci-host/pnv_phb3.h    | 2 --
 include/hw/pci-host/pnv_phb4.h    | 3 +--
 include/hw/pci-host/xilinx-pcie.h | 1 -
 include/hw/pci/pcie.h             | 1 -
 include/hw/virtio/virtio-scsi.h   | 1 -
 hw/alpha/pci.c                    | 1 +
 hw/alpha/typhoon.c                | 2 +-
 hw/i386/acpi-build.c              | 2 +-
 hw/pci-bridge/i82801b11.c         | 2 +-
 hw/rdma/rdma_utils.c              | 1 +
 hw/scsi/virtio-scsi.c             | 1 +
 26 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index 2263e821da..a303c58438 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -5,7 +5,6 @@
 
 #include "target/alpha/cpu-qom.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci_host.h"
 #include "hw/boards.h"
 #include "hw/intc/i8259.h"
 
diff --git a/hw/rdma/rdma_utils.h b/hw/rdma/rdma_utils.h
index 0c6414e7e0..54e4f56edd 100644
--- a/hw/rdma/rdma_utils.h
+++ b/hw/rdma/rdma_utils.h
@@ -18,7 +18,6 @@
 #define RDMA_UTILS_H
 
 #include "qemu/error-report.h"
-#include "hw/pci/pci.h"
 #include "sysemu/dma.h"
 
 #define rdma_error_report(fmt, ...) \
diff --git a/hw/rdma/vmw/pvrdma.h b/hw/rdma/vmw/pvrdma.h
index d08965d3e2..0caf95ede8 100644
--- a/hw/rdma/vmw/pvrdma.h
+++ b/hw/rdma/vmw/pvrdma.h
@@ -18,7 +18,6 @@
 
 #include "qemu/units.h"
 #include "qemu/notify.h"
-#include "hw/pci/pci.h"
 #include "hw/pci/msix.h"
 #include "chardev/char-fe.h"
 #include "hw/net/vmxnet3_defs.h"
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index a173707d9b..4d4b2830b7 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -23,7 +23,6 @@
 #include "sysemu/dma.h"
 #include "hw/pci/pci.h"
 #include "hw/sysbus.h"
-#include "qom/object.h"
 
 #ifndef EHCI_DEBUG
 #define EHCI_DEBUG   0
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index e7c4316a7d..cf10fc7bbf 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -2,7 +2,6 @@
 #define XEN_PT_H
 
 #include "hw/xen/xen_common.h"
-#include "hw/pci/pci.h"
 #include "xen-host-pci-device.h"
 #include "qom/object.h"
 
diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h
index 38e0e271d5..5129557bee 100644
--- a/include/hw/cxl/cxl.h
+++ b/include/hw/cxl/cxl.h
@@ -13,7 +13,6 @@
 
 #include "qapi/qapi-types-machine.h"
 #include "qapi/qapi-visit-machine.h"
-#include "hw/pci/pci_bridge.h"
 #include "hw/pci/pci_host.h"
 #include "cxl_pci.h"
 #include "cxl_component.h"
diff --git a/include/hw/cxl/cxl_cdat.h b/include/hw/cxl/cxl_cdat.h
index e9eda00142..7f67638685 100644
--- a/include/hw/cxl/cxl_cdat.h
+++ b/include/hw/cxl/cxl_cdat.h
@@ -11,6 +11,7 @@
 #define CXL_CDAT_H
 
 #include "hw/cxl/cxl_pci.h"
+#include "hw/pci/pcie_doe.h"
 
 /*
  * Reference:
diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h
index 449b0edfe9..fd475b947b 100644
--- a/include/hw/cxl/cxl_device.h
+++ b/include/hw/cxl/cxl_device.h
@@ -10,6 +10,7 @@
 #ifndef CXL_DEVICE_H
 #define CXL_DEVICE_H
 
+#include "hw/pci/pci.h"
 #include "hw/register.h"
 
 /*
diff --git a/include/hw/cxl/cxl_pci.h b/include/hw/cxl/cxl_pci.h
index 3cb79eca1e..aca14845ab 100644
--- a/include/hw/cxl/cxl_pci.h
+++ b/include/hw/cxl/cxl_pci.h
@@ -11,8 +11,6 @@
 #define CXL_PCI_H
 
 #include "qemu/compiler.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pcie.h"
 #include "hw/cxl/cxl_cdat.h"
 
 #define CXL_VENDOR_ID 0x1e98
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 23ee8e371b..222781e8b9 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -5,12 +5,8 @@
 #include "hw/sysbus.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/apm.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pcie_host.h"
-#include "hw/pci/pci_bridge.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9.h"
-#include "hw/pci/pci_bus.h"
 #include "qom/object.h"
 
 void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h
index 7637edb430..8d8d53b18b 100644
--- a/include/hw/i386/x86-iommu.h
+++ b/include/hw/i386/x86-iommu.h
@@ -21,7 +21,6 @@
 #define HW_I386_X86_IOMMU_H
 
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
 #include "qom/object.h"
 
diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h
index eaa07881c5..e273cd38dc 100644
--- a/include/hw/isa/vt82c686.h
+++ b/include/hw/isa/vt82c686.h
@@ -1,7 +1,6 @@
 #ifndef HW_VT82C686_H
 #define HW_VT82C686_H
 
-#include "hw/pci/pci.h"
 
 #define TYPE_VT82C686B_ISA "vt82c686b-isa"
 #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci"
diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h
index 6d9b51ae67..908f3d946b 100644
--- a/include/hw/pci-host/designware.h
+++ b/include/hw/pci-host/designware.h
@@ -22,9 +22,6 @@
 #define DESIGNWARE_H
 
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pci_bus.h"
-#include "hw/pci/pcie_host.h"
 #include "hw/pci/pci_bridge.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
index d02bf1ed6b..fc93e22732 100644
--- a/include/hw/pci-host/i440fx.h
+++ b/include/hw/pci-host/i440fx.h
@@ -11,7 +11,7 @@
 #ifndef HW_PCI_I440FX_H
 #define HW_PCI_I440FX_H
 
-#include "hw/pci/pci_bus.h"
+#include "hw/pci/pci.h"
 #include "hw/pci-host/pam.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/ls7a.h b/include/hw/pci-host/ls7a.h
index df7fa55a30..b27db8e2ca 100644
--- a/include/hw/pci-host/ls7a.h
+++ b/include/hw/pci-host/ls7a.h
@@ -8,8 +8,6 @@
 #ifndef HW_LS7A_H
 #define HW_LS7A_H
 
-#include "hw/pci/pci.h"
-#include "hw/pci/pcie_host.h"
 #include "hw/pci-host/pam.h"
 #include "qemu/units.h"
 #include "qemu/range.h"
diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
index 4854f6d2f6..f791ebda9b 100644
--- a/include/hw/pci-host/pnv_phb3.h
+++ b/include/hw/pci-host/pnv_phb3.h
@@ -10,8 +10,6 @@
 #ifndef PCI_HOST_PNV_PHB3_H
 #define PCI_HOST_PNV_PHB3_H
 
-#include "hw/pci/pcie_host.h"
-#include "hw/pci/pcie_port.h"
 #include "hw/ppc/xics.h"
 #include "qom/object.h"
 #include "hw/pci-host/pnv_phb.h"
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 50d4faa001..d9cea3f952 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -10,8 +10,7 @@
 #ifndef PCI_HOST_PNV_PHB4_H
 #define PCI_HOST_PNV_PHB4_H
 
-#include "hw/pci/pcie_host.h"
-#include "hw/pci/pcie_port.h"
+#include "hw/pci/pci_bus.h"
 #include "hw/ppc/xive.h"
 #include "qom/object.h"
 
diff --git a/include/hw/pci-host/xilinx-pcie.h b/include/hw/pci-host/xilinx-pcie.h
index 89be88d87f..e1b3c1c280 100644
--- a/include/hw/pci-host/xilinx-pcie.h
+++ b/include/hw/pci-host/xilinx-pcie.h
@@ -21,7 +21,6 @@
 #define HW_XILINX_PCIE_H
 
 #include "hw/sysbus.h"
-#include "hw/pci/pci.h"
 #include "hw/pci/pci_bridge.h"
 #include "hw/pci/pcie_host.h"
 #include "qom/object.h"
diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
index 698d3de851..798a262a0a 100644
--- a/include/hw/pci/pcie.h
+++ b/include/hw/pci/pcie.h
@@ -26,7 +26,6 @@
 #include "hw/pci/pcie_aer.h"
 #include "hw/pci/pcie_sriov.h"
 #include "hw/hotplug.h"
-#include "hw/pci/pcie_doe.h"
 
 typedef enum {
     /* for attention and power indicator */
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index a36aad9c86..37b75e15e3 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -20,7 +20,6 @@
 #define VIRTIO_SCSI_SENSE_SIZE 0
 #include "standard-headers/linux/virtio_scsi.h"
 #include "hw/virtio/virtio.h"
-#include "hw/pci/pci.h"
 #include "hw/scsi/scsi.h"
 #include "chardev/char-fe.h"
 #include "sysemu/iothread.h"
diff --git a/hw/alpha/pci.c b/hw/alpha/pci.c
index 72251fcdf0..7c18297177 100644
--- a/hw/alpha/pci.c
+++ b/hw/alpha/pci.c
@@ -7,6 +7,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/pci/pci_host.h"
 #include "alpha_sys.h"
 #include "qemu/log.h"
 #include "trace.h"
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index bd39c8ca86..49a80550c5 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -10,10 +10,10 @@
 #include "qemu/module.h"
 #include "qemu/units.h"
 #include "qapi/error.h"
+#include "hw/pci/pci_host.h"
 #include "cpu.h"
 #include "hw/irq.h"
 #include "alpha_sys.h"
-#include "qom/object.h"
 
 
 #define TYPE_TYPHOON_PCI_HOST_BRIDGE "typhoon-pcihost"
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index aa15b11cde..127c4e2d50 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -27,7 +27,7 @@
 #include "acpi-common.h"
 #include "qemu/bitmap.h"
 #include "qemu/error-report.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_bridge.h"
 #include "hw/cxl/cxl.h"
 #include "hw/core/cpu.h"
 #include "target/i386/cpu.h"
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index d9f224818b..f3b4a14611 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -42,7 +42,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/pci/pci.h"
+#include "hw/pci/pci_bridge.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
 #include "hw/i386/ich9.h"
diff --git a/hw/rdma/rdma_utils.c b/hw/rdma/rdma_utils.c
index 5a7ef63ad2..77008552f4 100644
--- a/hw/rdma/rdma_utils.c
+++ b/hw/rdma/rdma_utils.c
@@ -14,6 +14,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "hw/pci/pci.h"
 #include "trace.h"
 #include "rdma_utils.h"
 
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6f6e2e32ba..2b649ca976 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -22,6 +22,7 @@
 #include "qemu/iov.h"
 #include "qemu/module.h"
 #include "sysemu/block-backend.h"
+#include "sysemu/dma.h"
 #include "hw/qdev-properties.h"
 #include "hw/scsi/scsi.h"
 #include "scsi/constants.h"
-- 
MST



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

* [PULL 28/51] include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (47 preceding siblings ...)
  2023-01-05  9:17 ` [PULL 51/51] vhost-scsi: fix memleak of vsc->inflight Michael S. Tsirkin
@ 2023-01-05  9:21 ` Michael S. Tsirkin
  2023-01-05  9:22 ` [PULL 32/51] include/hw/pci: Include hw/pci/pci.h where needed Michael S. Tsirkin
                   ` (3 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Marcel Apfelbaum, Ben Widawsky,
	Jonathan Cameron

From: Markus Armbruster <armbru@redhat.com>

hw/cxl/cxl.h uses the PXBDev structure tag instead of the typedef
name.  The typedef name is defined in hw/pci/pci_bridge.h.  Its
inclusion was dropped in the previous commit to break an inclusion
loop.

Move the typedef to hw/cxl/cxl.h, and use it there.  Delete an extra
typedef in hw/pci-bridge/pci_expander_bridge.c.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221222100330.380143-3-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/cxl/cxl.h                | 4 +++-
 include/hw/pci/pci_bridge.h         | 1 -
 hw/pci-bridge/pci_expander_bridge.c | 1 -
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h
index 5129557bee..b161be59b7 100644
--- a/include/hw/cxl/cxl.h
+++ b/include/hw/cxl/cxl.h
@@ -23,10 +23,12 @@
 
 #define CXL_WINDOW_MAX 10
 
+typedef struct PXBDev PXBDev;
+
 typedef struct CXLFixedWindow {
     uint64_t size;
     char **targets;
-    struct PXBDev *target_hbs[8];
+    PXBDev *target_hbs[8];
     uint8_t num_targets;
     uint8_t enc_int_ways;
     uint8_t enc_int_gran;
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index ca6caf487e..58a3fb0c2c 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -97,7 +97,6 @@ struct PXBDev {
     } cxl;
 };
 
-typedef struct PXBDev PXBDev;
 #define TYPE_PXB_CXL_DEVICE "pxb-cxl"
 DECLARE_INSTANCE_CHECKER(PXBDev, PXB_CXL_DEV,
                          TYPE_PXB_CXL_DEVICE)
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index c9e817aa58..870d9bab11 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -50,7 +50,6 @@ struct PXBBus {
 };
 
 #define TYPE_PXB_DEVICE "pxb"
-typedef struct PXBDev PXBDev;
 DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV,
                          TYPE_PXB_DEVICE)
 
-- 
MST



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

* [PULL 32/51] include/hw/pci: Include hw/pci/pci.h where needed
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (48 preceding siblings ...)
  2023-01-05  9:21 ` [PULL 28/51] include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use Michael S. Tsirkin
@ 2023-01-05  9:22 ` Michael S. Tsirkin
  2023-01-05  9:22 ` [PULL 33/51] include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h Michael S. Tsirkin
                   ` (2 subsequent siblings)
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Philippe Mathieu-Daudé,
	Marcel Apfelbaum

From: Markus Armbruster <armbru@redhat.com>

hw/pci/pcie_sriov.h needs PCI_NUM_REGIONS.  Without the previous
commit, this would close an inclusion loop: hw/pci/pci.h used to
include hw/pci/pcie.h for PCIExpressDevice, which includes
pcie_sriov.h for PCIESriovPF, which now includes hw/pci/pci.h for
PCI_NUM_REGIONS.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221222100330.380143-7-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/pci/pcie_sriov.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h
index 80f5c84e75..96cc743309 100644
--- a/include/hw/pci/pcie_sriov.h
+++ b/include/hw/pci/pcie_sriov.h
@@ -13,6 +13,8 @@
 #ifndef QEMU_PCIE_SRIOV_H
 #define QEMU_PCIE_SRIOV_H
 
+#include "hw/pci/pci.h"
+
 struct PCIESriovPF {
     uint16_t num_vfs;   /* Number of virtual functions created */
     uint8_t vf_bar_type[PCI_NUM_REGIONS];   /* Store type for each VF bar */
-- 
MST



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

* [PULL 33/51] include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (49 preceding siblings ...)
  2023-01-05  9:22 ` [PULL 32/51] include/hw/pci: Include hw/pci/pci.h where needed Michael S. Tsirkin
@ 2023-01-05  9:22 ` Michael S. Tsirkin
  2023-01-05  9:56 ` [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
  2023-01-05 16:30 ` [PULL v2 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Markus Armbruster, Ben Widawsky, Jonathan Cameron

From: Markus Armbruster <armbru@redhat.com>

hw/cxl/cxl_pci.h and hw/cxl/cxl_cdat.h include each other.  The former
doesn't actually need the latter, so drop that inclusion to break the
loop.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221222100330.380143-8-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/cxl/cxl_pci.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/hw/cxl/cxl_pci.h b/include/hw/cxl/cxl_pci.h
index aca14845ab..01e15ed5b4 100644
--- a/include/hw/cxl/cxl_pci.h
+++ b/include/hw/cxl/cxl_pci.h
@@ -11,7 +11,6 @@
 #define CXL_PCI_H
 
 #include "qemu/compiler.h"
-#include "hw/cxl/cxl_cdat.h"
 
 #define CXL_VENDOR_ID 0x1e98
 
-- 
MST



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

* Re: [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
  2023-01-05  9:17 ` [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
@ 2023-01-05  9:56   ` Michael S. Tsirkin
  2023-01-05 16:01     ` Laszlo Ersek
  0 siblings, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Laszlo Ersek, Ani Sinha, Ard Biesheuvel,
	Igor Mammedov, Paolo Bonzini, qemu-stable,
	Philippe Mathieu-Daudé

On Thu, Jan 05, 2023 at 04:17:06AM -0500, Michael S. Tsirkin wrote:
> From: Laszlo Ersek <lersek@redhat.com>

I noticed v2 is forthcoming. dropped now.



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (50 preceding siblings ...)
  2023-01-05  9:22 ` [PULL 33/51] include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h Michael S. Tsirkin
@ 2023-01-05  9:56 ` Michael S. Tsirkin
  2023-01-05 16:31   ` Michael S. Tsirkin
  2023-01-05 16:30 ` [PULL v2 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
  52 siblings, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> 
>   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> 
> are available in the Git repository at:
> 
>   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> 
> for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:

7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
as v2 is forthcoming.


>   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> 
> ----------------------------------------------------------------
> virtio,pc,pci: features, cleanups, fixes
> 
> mostly vhost-vdpa:
>     guest announce feature emulation when using shadow virtqueue
>     support for configure interrupt
>     startup speed ups
> 
> an acpi change to only generate cluster node in PPTT when specified for arm
> 
> misc fixes, cleanups
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> ----------------------------------------------------------------
> 
> Note: linux-user build is failing for me on master, I just
> disabled it for now as nothing I'm doing should affect linux-user.
> Didn't debug yet.
> 
> 
> Bernhard Beschow (7):
>       hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9
>       hw/acpi/Kconfig: Add missing dependencies to ACPI_ICH9
>       hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines
>       hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4
>       hw/isa/Kconfig: Add missing dependency to VT82C686
>       i386, mips: Resolve redundant ACPI and APM dependencies
>       hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2
> 
> Cindy Lu (10):
>       virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
>       virtio-pci: decouple notifier from interrupt process
>       virtio-pci: decouple the single vector from the interrupt process
>       vhost: introduce new VhostOps vhost_set_config_call
>       vhost-vdpa: add support for config interrupt
>       virtio: add support for configure interrupt
>       vhost: add support for configure interrupt
>       virtio-net: add support for configure interrupt
>       virtio-mmio: add support for configure interrupt
>       virtio-pci: add support for configure interrupt
> 
> Dongli Zhang (1):
>       vhost-scsi: fix memleak of vsc->inflight
> 
> Eugenio Pérez (4):
>       virtio_net: Modify virtio_net_get_config to early return
>       virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it
>       vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail
>       vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa
> 
> Hyman Huang (3):
>       vhost-user: Refactor vhost acked features saving
>       vhost-user: Refactor the chr_closed_bh
>       vhost-user: Fix the virtio features negotiation flaw
> 
> Laszlo Ersek (1):
>       acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
> 
> Longpeng (Mike) (5):
>       vdpa-dev: get iova range explicitly
>       vdpa: harden the error path if get_iova_range failed
>       vhost: simplify vhost_dev_enable_notifiers
>       vhost: configure all host notifiers in a single MR transaction
>       vdpa: commit all host notifier MRs in a single MR transaction
> 
> Markus Armbruster (11):
>       include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h
>       include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use
>       include/hw/cxl: Include hw/cxl/*.h where needed
>       include/hw/pci: Clean up a few things checkpatch.pl would flag
>       include/hw/pci: Split pci_device.h off pci.h
>       include/hw/pci: Include hw/pci/pci.h where needed
>       include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h
>       include/hw/virtio: Break inclusion loop
>       include: Include headers where needed
>       include: Don't include qemu/osdep.h
>       docs/devel: Rules on #include in headers
> 
> Philippe Mathieu-Daudé (2):
>       hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device()
>       hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c
> 
> Yicong Yang (6):
>       tests: virt: Allow changes to PPTT test table
>       hw/acpi/aml-build: Only generate cluster node in PPTT when specified
>       tests: virt: Update expected ACPI tables for virt test
>       tests: acpi: Add and whitelist *.topology blobs
>       tests: acpi: aarch64: Add topology test for aarch64
>       tests: acpi: aarch64: Add *.topology tables
> 
> leixiang (1):
>       virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers
> 
>  configs/devices/mips-softmmu/common.mak     |   3 -
>  bsd-user/qemu.h                             |   1 -
>  crypto/block-luks-priv.h                    |   1 -
>  hw/alpha/alpha_sys.h                        |   1 -
>  hw/display/ati_int.h                        |   2 +-
>  hw/display/qxl.h                            |   3 +-
>  hw/ide/ahci_internal.h                      |   2 +-
>  hw/net/vmxnet3_defs.h                       |   2 +-
>  hw/nvme/nvme.h                              |   2 +-
>  hw/rdma/rdma_utils.h                        |   1 -
>  hw/rdma/vmw/pvrdma.h                        |   2 +-
>  hw/scsi/mptsas.h                            |   2 +-
>  hw/usb/hcd-ehci.h                           |   3 +-
>  hw/usb/hcd-uhci.h                           |   2 +-
>  hw/usb/hcd-xhci-pci.h                       |   1 +
>  hw/vfio/pci.h                               |   2 +-
>  hw/virtio/virtio-qmp.h                      |  10 +
>  hw/xen/xen_pt.h                             |   1 -
>  include/exec/plugin-gen.h                   |   1 +
>  include/hw/acpi/erst.h                      |   3 +
>  include/hw/acpi/piix4.h                     |   2 +-
>  include/hw/arm/allwinner-a10.h              |   1 +
>  include/hw/boards.h                         |   3 +
>  include/hw/char/cmsdk-apb-uart.h            |   1 +
>  include/hw/char/goldfish_tty.h              |   1 +
>  include/hw/char/xilinx_uartlite.h           |   1 +
>  include/hw/cris/etraxfs.h                   |   1 +
>  include/hw/cxl/cxl.h                        |   5 +-
>  include/hw/cxl/cxl_cdat.h                   |   1 +
>  include/hw/cxl/cxl_component.h              |   1 +
>  include/hw/cxl/cxl_device.h                 |   2 +
>  include/hw/cxl/cxl_host.h                   |   1 -
>  include/hw/cxl/cxl_pci.h                    |   3 -
>  include/hw/display/macfb.h                  |   3 +-
>  include/hw/dma/sifive_pdma.h                |   2 +
>  include/hw/i386/ich9.h                      |   4 -
>  include/hw/i386/ioapic_internal.h           |   1 +
>  include/hw/i386/sgx-epc.h                   |   1 +
>  include/hw/i386/x86-iommu.h                 |   1 -
>  include/hw/ide/pci.h                        |   2 +-
>  include/hw/input/pl050.h                    |   1 -
>  include/hw/intc/goldfish_pic.h              |   2 +
>  include/hw/intc/loongarch_pch_msi.h         |   2 +
>  include/hw/intc/loongarch_pch_pic.h         |   2 +
>  include/hw/intc/nios2_vic.h                 |   2 +
>  include/hw/isa/vt82c686.h                   |   1 -
>  include/hw/misc/macio/macio.h               |   2 +-
>  include/hw/misc/mchp_pfsoc_dmc.h            |   2 +
>  include/hw/misc/mchp_pfsoc_ioscb.h          |   2 +
>  include/hw/misc/mchp_pfsoc_sysreg.h         |   2 +
>  include/hw/misc/pvpanic.h                   |   1 +
>  include/hw/misc/sifive_e_prci.h             |   3 +-
>  include/hw/misc/sifive_u_otp.h              |   3 +-
>  include/hw/misc/sifive_u_prci.h             |   3 +-
>  include/hw/misc/virt_ctrl.h                 |   2 +
>  include/hw/misc/xlnx-versal-pmc-iou-slcr.h  |   1 +
>  include/hw/net/lasi_82596.h                 |   2 +-
>  include/hw/net/xlnx-zynqmp-can.h            |   1 +
>  include/hw/pci-host/designware.h            |   3 -
>  include/hw/pci-host/gpex.h                  |   2 +-
>  include/hw/pci-host/i440fx.h                |   2 +-
>  include/hw/pci-host/ls7a.h                  |   2 -
>  include/hw/pci-host/pnv_phb3.h              |   2 -
>  include/hw/pci-host/pnv_phb4.h              |   3 +-
>  include/hw/pci-host/q35.h                   |   2 +-
>  include/hw/pci-host/sabre.h                 |   2 +-
>  include/hw/pci-host/xilinx-pcie.h           |   1 -
>  include/hw/pci/msi.h                        |   2 +-
>  include/hw/pci/pci.h                        | 341 ---------------------------
>  include/hw/pci/pci_bridge.h                 |   3 +-
>  include/hw/pci/pci_device.h                 | 350 ++++++++++++++++++++++++++++
>  include/hw/pci/pcie.h                       |   1 -
>  include/hw/pci/pcie_port.h                  |   1 +
>  include/hw/pci/pcie_sriov.h                 |   2 +
>  include/hw/pci/shpc.h                       |   2 +-
>  include/hw/ppc/pnv_psi.h                    |   2 +-
>  include/hw/remote/iohub.h                   |   2 +-
>  include/hw/remote/proxy.h                   |   2 +-
>  include/hw/riscv/boot_opensbi.h             |   2 +
>  include/hw/riscv/microchip_pfsoc.h          |   3 +
>  include/hw/riscv/numa.h                     |   1 +
>  include/hw/riscv/sifive_u.h                 |   2 +
>  include/hw/riscv/spike.h                    |   2 +-
>  include/hw/riscv/virt.h                     |   2 +-
>  include/hw/sd/sdhci.h                       |   2 +-
>  include/hw/southbridge/piix.h               |   3 +-
>  include/hw/ssi/sifive_spi.h                 |   3 +
>  include/hw/timer/sse-timer.h                |   1 +
>  include/hw/tricore/triboard.h               |   1 -
>  include/hw/usb/hcd-dwc3.h                   |   1 +
>  include/hw/usb/hcd-musb.h                   |   2 +
>  include/hw/usb/xlnx-usb-subsystem.h         |   2 +
>  include/hw/usb/xlnx-versal-usb2-ctrl-regs.h |   3 +
>  include/hw/virtio/vhost-backend.h           |   3 +
>  include/hw/virtio/vhost-vdpa.h              |   2 +
>  include/hw/virtio/vhost.h                   |   4 +
>  include/hw/virtio/virtio-mmio.h             |   2 +-
>  include/hw/virtio/virtio-pci.h              |   4 +-
>  include/hw/virtio/virtio-scsi.h             |   1 -
>  include/hw/virtio/virtio.h                  |   8 +-
>  include/hw/xen/xen_common.h                 |   2 +-
>  include/net/vhost-user.h                    |   1 +
>  include/net/vhost_net.h                     |   4 +
>  include/qemu/plugin-memory.h                |   3 +
>  include/qemu/userfaultfd.h                  |   1 -
>  include/sysemu/dirtyrate.h                  |   2 +
>  include/sysemu/dump.h                       |   1 +
>  include/user/syscall-trace.h                |   1 +
>  net/vmnet_int.h                             |   1 -
>  qga/cutils.h                                |   1 -
>  target/hexagon/hex_arch_types.h             |   1 -
>  target/hexagon/mmvec/macros.h               |   1 -
>  target/riscv/pmu.h                          |   1 -
>  hw/acpi/aml-build.c                         |   2 +-
>  hw/acpi/cpu_hotplug.c                       |   3 +
>  hw/acpi/erst.c                              |   2 +-
>  hw/alpha/pci.c                              |   1 +
>  hw/alpha/typhoon.c                          |   2 +-
>  hw/audio/ac97.c                             |   2 +-
>  hw/audio/es1370.c                           |   2 +-
>  hw/audio/via-ac97.c                         |   2 +-
>  hw/char/serial-pci-multi.c                  |   2 +-
>  hw/char/serial-pci.c                        |   2 +-
>  hw/core/machine-smp.c                       |   2 +
>  hw/core/qdev-properties-system.c            |   1 +
>  hw/display/bochs-display.c                  |   2 +-
>  hw/display/cirrus_vga.c                     |   2 +-
>  hw/display/sm501.c                          |   2 +-
>  hw/display/vga-pci.c                        |   2 +-
>  hw/display/vhost-user-gpu.c                 |  18 ++
>  hw/display/vmware_vga.c                     |   2 +-
>  hw/i386/acpi-build.c                        |   2 +-
>  hw/i386/xen/xen_pvdevice.c                  |   2 +-
>  hw/ipack/tpci200.c                          |   2 +-
>  hw/ipmi/pci_ipmi_bt.c                       |   2 +-
>  hw/ipmi/pci_ipmi_kcs.c                      |   2 +-
>  hw/isa/i82378.c                             |   2 +-
>  hw/mips/gt64xxx_pci.c                       |   2 +-
>  hw/misc/pci-testdev.c                       |   2 +-
>  hw/misc/pvpanic-pci.c                       |   2 +-
>  hw/net/can/can_kvaser_pci.c                 |   2 +-
>  hw/net/can/can_mioe3680_pci.c               |   2 +-
>  hw/net/can/can_pcm3680_pci.c                |   2 +-
>  hw/net/can/ctucan_pci.c                     |   2 +-
>  hw/net/e1000.c                              |   2 +-
>  hw/net/e1000x_common.c                      |   2 +-
>  hw/net/eepro100.c                           |   2 +-
>  hw/net/ne2000-pci.c                         |   2 +-
>  hw/net/net_tx_pkt.c                         |   2 +-
>  hw/net/pcnet-pci.c                          |   2 +-
>  hw/net/rocker/rocker.c                      |   2 +-
>  hw/net/rocker/rocker_desc.c                 |   2 +-
>  hw/net/rtl8139.c                            |   2 +-
>  hw/net/sungem.c                             |   2 +-
>  hw/net/sunhme.c                             |   2 +-
>  hw/net/tulip.c                              |   2 +-
>  hw/net/vhost_net-stub.c                     |  14 ++
>  hw/net/vhost_net.c                          |  18 ++
>  hw/net/virtio-net.c                         |  60 +++--
>  hw/pci-bridge/i82801b11.c                   |   2 +-
>  hw/pci-bridge/pci_expander_bridge.c         |   1 -
>  hw/pci-host/bonito.c                        |   2 +-
>  hw/pci-host/dino.c                          |   2 +-
>  hw/pci-host/grackle.c                       |   2 +-
>  hw/pci-host/mv64361.c                       |   2 +-
>  hw/pci-host/ppce500.c                       |   2 +-
>  hw/pci-host/raven.c                         |   2 +-
>  hw/pci-host/sh_pci.c                        |   2 +-
>  hw/pci-host/uninorth.c                      |   2 +-
>  hw/pci-host/versatile.c                     |   2 +-
>  hw/pci/pci-hmp-cmds.c                       |   1 +
>  hw/pci/pcie_host.c                          |   2 +-
>  hw/pci/pcie_sriov.c                         |   2 +-
>  hw/pci/slotid_cap.c                         |   2 +-
>  hw/ppc/ppc440_pcix.c                        |   2 +-
>  hw/ppc/ppc4xx_pci.c                         |   2 +-
>  hw/ppc/spapr_pci_vfio.c                     |   1 +
>  hw/rdma/rdma_utils.c                        |   1 +
>  hw/s390x/s390-pci-inst.c                    |   1 +
>  hw/scsi/esp-pci.c                           |   2 +-
>  hw/scsi/lsi53c895a.c                        |   2 +-
>  hw/scsi/vhost-scsi-common.c                 |   1 +
>  hw/scsi/virtio-scsi.c                       |   1 +
>  hw/smbios/smbios.c                          |   1 +
>  hw/usb/hcd-ohci-pci.c                       |   2 +-
>  hw/virtio/vdpa-dev.c                        |   9 +
>  hw/virtio/vhost-user-fs.c                   |  18 ++
>  hw/virtio/vhost-user-gpio.c                 |  10 +
>  hw/virtio/vhost-vdpa.c                      |  40 +++-
>  hw/virtio/vhost-vsock-common.c              |  18 ++
>  hw/virtio/vhost.c                           | 122 ++++++++--
>  hw/virtio/virtio-crypto.c                   |  18 ++
>  hw/virtio/virtio-mmio.c                     |  27 +++
>  hw/virtio/virtio-pci.c                      | 305 ++++++++++++++++--------
>  hw/virtio/virtio-qmp.c                      | 192 ++++++++++++++-
>  hw/virtio/virtio.c                          | 225 +++---------------
>  hw/watchdog/wdt_i6300esb.c                  |   2 +-
>  net/vhost-user.c                            |  27 ++-
>  net/vhost-vdpa.c                            |  32 +--
>  qga/cutils.c                                |   3 +-
>  tests/qtest/bios-tables-test.c              |  19 ++
>  tests/qtest/fuzz/generic_fuzz.c             |   1 +
>  ui/util.c                                   |   2 +-
>  docs/devel/style.rst                        |   7 +
>  hw/acpi/Kconfig                             |   9 +-
>  hw/acpi/meson.build                         |   2 +-
>  hw/i2c/meson.build                          |   2 +-
>  hw/i386/Kconfig                             |   3 +-
>  hw/isa/Kconfig                              |   4 +-
>  hw/ppc/Kconfig                              |   2 -
>  hw/virtio/trace-events                      |   1 +
>  qemu-options.hx                             |   3 +
>  tests/data/acpi/virt/APIC.topology          | Bin 0 -> 732 bytes
>  tests/data/acpi/virt/DSDT.topology          | Bin 0 -> 5398 bytes
>  tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
>  tests/data/acpi/virt/PPTT.acpihmatvirt      | Bin 196 -> 156 bytes
>  tests/data/acpi/virt/PPTT.topology          | Bin 0 -> 336 bytes
>  217 files changed, 1418 insertions(+), 839 deletions(-)
>  create mode 100644 include/hw/pci/pci_device.h
>  create mode 100644 tests/data/acpi/virt/APIC.topology
>  create mode 100644 tests/data/acpi/virt/DSDT.topology
>  create mode 100644 tests/data/acpi/virt/PPTT.topology
> 



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

* Re: [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
  2023-01-05  9:56   ` Michael S. Tsirkin
@ 2023-01-05 16:01     ` Laszlo Ersek
  2023-01-05 16:29       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 73+ messages in thread
From: Laszlo Ersek @ 2023-01-05 16:01 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Ani Sinha, Ard Biesheuvel, Igor Mammedov,
	Paolo Bonzini, qemu-stable, Philippe Mathieu-Daudé

On 1/5/23 10:56, Michael S. Tsirkin wrote:
> On Thu, Jan 05, 2023 at 04:17:06AM -0500, Michael S. Tsirkin wrote:
>> From: Laszlo Ersek <lersek@redhat.com>
> 
> I noticed v2 is forthcoming. dropped now.
> 

Yes, thanks.

I'm picking up the "Reviewed-by: Michael S. Tsirkin <mst@redhat.com>"
tag from your commit message. I'm not taking the "Fixes:" tag,
originally suggested by Phil, because we've agreed that that was not
correct. The other tags (from Igor, Phil and Ard) I've picked up
already, and I've updated the commit message too. I'll post v2 soon.

Thanks!
Laszlo



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

* Re: [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
  2023-01-05 16:01     ` Laszlo Ersek
@ 2023-01-05 16:29       ` Philippe Mathieu-Daudé
  2023-01-05 16:35         ` Michael S. Tsirkin
  0 siblings, 1 reply; 73+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-05 16:29 UTC (permalink / raw)
  To: Laszlo Ersek, Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Ani Sinha, Ard Biesheuvel, Igor Mammedov,
	Paolo Bonzini, qemu-stable

On 5/1/23 17:01, Laszlo Ersek wrote:
> On 1/5/23 10:56, Michael S. Tsirkin wrote:
>> On Thu, Jan 05, 2023 at 04:17:06AM -0500, Michael S. Tsirkin wrote:
>>> From: Laszlo Ersek <lersek@redhat.com>
>>
>> I noticed v2 is forthcoming. dropped now.
>>
> 
> Yes, thanks.
> 
> I'm picking up the "Reviewed-by: Michael S. Tsirkin <mst@redhat.com>"
> tag from your commit message. I'm not taking the "Fixes:" tag,
> originally suggested by Phil, because we've agreed that that was not
> correct.

I suppose the tool MST is using automatically included the Fixes: tag.

> The other tags (from Igor, Phil and Ard) I've picked up
> already, and I've updated the commit message too. I'll post v2 soon.
> 
> Thanks!
> Laszlo
> 



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

* [PULL v2 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
  2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
                   ` (51 preceding siblings ...)
  2023-01-05  9:56 ` [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
@ 2023-01-05 16:30 ` Michael S. Tsirkin
  52 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05 16:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laszlo Ersek, Ani Sinha, Ard Biesheuvel, Igor Mammedov,
	Paolo Bonzini, Peter Maydell, Philippe Mathieu-Daudé,
	qemu-stable

From: Laszlo Ersek <lersek@redhat.com>

The modern ACPI CPU hotplug interface was introduced in the following
series (aa1dd39ca307..679dd1a957df), released in v2.7.0:

  1  abd49bc2ed2f docs: update ACPI CPU hotplug spec with new protocol
  2  16bcab97eb9f pc: piix4/ich9: add 'cpu-hotplug-legacy' property
  3  5e1b5d93887b acpi: cpuhp: add CPU devices AML with _STA method
  4  ac35f13ba8f8 pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook
  5  d2238cb6781d acpi: cpuhp: implement hot-add parts of CPU hotplug
                  interface
  6  8872c25a26cc acpi: cpuhp: implement hot-remove parts of CPU hotplug
                  interface
  7  76623d00ae57 acpi: cpuhp: add cpu._OST handling
  8  679dd1a957df pc: use new CPU hotplug interface since 2.7 machine type

Before patch#1, "docs/specs/acpi_cpu_hotplug.txt" only specified 1-byte
accesses for the hotplug register block.  Patch#1 preserved the same
restriction for the legacy register block, but:

- it specified DWORD accesses for some of the modern registers,

- in particular, the switch from the legacy block to the modern block
  would require a DWORD write to the *legacy* block.

The latter functionality was then implemented in cpu_status_write()
[hw/acpi/cpu_hotplug.c], in patch#8.

Unfortunately, all DWORD accesses depended on a dormant bug: the one
introduced in earlier commit a014ed07bd5a ("memory: accept mismatching
sizes in memory_region_access_valid", 2013-05-29); first released in
v1.6.0.  Due to commit a014ed07bd5a, the DWORD accesses to the *legacy*
CPU hotplug register block would work in spite of the above series *not*
relaxing "valid.max_access_size = 1" in "hw/acpi/cpu_hotplug.c":

> static const MemoryRegionOps AcpiCpuHotplug_ops = {
>     .read = cpu_status_read,
>     .write = cpu_status_write,
>     .endianness = DEVICE_LITTLE_ENDIAN,
>     .valid = {
>         .min_access_size = 1,
>         .max_access_size = 1,
>     },
> };

Later, in commits e6d0c3ce6895 ("acpi: cpuhp: introduce 'Command data 2'
field", 2020-01-22) and ae340aa3d256 ("acpi: cpuhp: spec: add typical
usecases", 2020-01-22), first released in v5.0.0, the modern CPU hotplug
interface (including the documentation) was extended with another DWORD
*read* access, namely to the "Command data 2" register, which would be
important for the guest to confirm whether it managed to switch the
register block from legacy to modern.

This functionality too silently depended on the bug from commit
a014ed07bd5a.

In commit 5d971f9e6725 ('memory: Revert "memory: accept mismatching sizes
in memory_region_access_valid"', 2020-06-26), first released in v5.1.0,
the bug from commit a014ed07bd5a was fixed (the commit was reverted).
That swiftly exposed the bug in "AcpiCpuHotplug_ops", still present from
the v2.7.0 series quoted at the top -- namely the fact that
"valid.max_access_size = 1" didn't match what the guest was supposed to
do, according to the spec ("docs/specs/acpi_cpu_hotplug.txt").

The symptom is that the "modern interface negotiation protocol"
described in commit ae340aa3d256:

> +      Use following steps to detect and enable modern CPU hotplug interface:
> +        1. Store 0x0 to the 'CPU selector' register,
> +           attempting to switch to modern mode
> +        2. Store 0x0 to the 'CPU selector' register,
> +           to ensure valid selector value
> +        3. Store 0x0 to the 'Command field' register,
> +        4. Read the 'Command data 2' register.
> +           If read value is 0x0, the modern interface is enabled.
> +           Otherwise legacy or no CPU hotplug interface available

falls apart for the guest: steps 1 and 2 are lost, because they are DWORD
writes; so no switching happens.  Step 3 (a single-byte write) is not
lost, but it has no effect; see the condition in cpu_status_write() in
patch#8.  And step 4 *misleads* the guest into thinking that the switch
worked: the DWORD read is lost again -- it returns zero to the guest
without ever reaching the device model, so the guest never learns the
switch didn't work.

This means that guest behavior centered on the "Command data 2" register
worked *only* in the v5.0.0 release; it got effectively regressed in
v5.1.0.

To make things *even more* complicated, the breakage was (and remains, as
of today) visible with TCG acceleration only.  Commit 5d971f9e6725 makes
no difference with KVM acceleration -- the DWORD accesses still work,
despite "valid.max_access_size = 1".

As commit 5d971f9e6725 suggests, fix the problem by raising
"valid.max_access_size" to 4 -- the spec now clearly instructs the guest
to perform DWORD accesses to the legacy register block too, for enabling
(and verifying!) the modern block.  In order to keep compatibility for the
device model implementation though, set "impl.max_access_size = 1", so
that wide accesses be split before they reach the legacy read/write
handlers, like they always have been on KVM, and like they were on TCG
before 5d971f9e6725 (v5.1.0).

Tested with:

- OVMF IA32 + qemu-system-i386, CPU hotplug/hot-unplug with SMM,
  intermixed with ACPI S3 suspend/resume, using KVM accel
  (regression-test);

- OVMF IA32X64 + qemu-system-x86_64, CPU hotplug/hot-unplug with SMM,
  intermixed with ACPI S3 suspend/resume, using KVM accel
  (regression-test);

- OVMF IA32 + qemu-system-i386, SMM enabled, using TCG accel; verified the
  register block switch and the present/possible CPU counting through the
  modern hotplug interface, during OVMF boot (bugfix test);

- I do not have any testcase (guest payload) for regression-testing CPU
  hotplug through the *legacy* CPU hotplug register block.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Ani Sinha <ani@anisinha.ca>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: qemu-stable@nongnu.org
Ref: "IO port write width clamping differs between TCG and KVM"
Link: http://mid.mail-archive.com/aaedee84-d3ed-a4f9-21e7-d221a28d1683@redhat.com
Link: https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg00199.html
Reported-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20230105161804.82486-1-lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/acpi/cpu_hotplug.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index 53654f8638..ff14c3f410 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -52,6 +52,9 @@ static const MemoryRegionOps AcpiCpuHotplug_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
     .valid = {
         .min_access_size = 1,
+        .max_access_size = 4,
+    },
+    .impl = {
         .max_access_size = 1,
     },
 };
-- 
MST



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-05  9:56 ` [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
@ 2023-01-05 16:31   ` Michael S. Tsirkin
  2023-01-05 21:04     ` Peter Maydell
  0 siblings, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05 16:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > 
> >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > 
> > are available in the Git repository at:
> > 
> >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > 
> > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> 
> 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> as v2 is forthcoming.

And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
patch with it's v2. Sorry about the back and forth, but it seemed
important :(

> 
> >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > 
> > ----------------------------------------------------------------
> > virtio,pc,pci: features, cleanups, fixes
> > 
> > mostly vhost-vdpa:
> >     guest announce feature emulation when using shadow virtqueue
> >     support for configure interrupt
> >     startup speed ups
> > 
> > an acpi change to only generate cluster node in PPTT when specified for arm
> > 
> > misc fixes, cleanups
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > ----------------------------------------------------------------
> > 
> > Note: linux-user build is failing for me on master, I just
> > disabled it for now as nothing I'm doing should affect linux-user.
> > Didn't debug yet.
> > 
> > 
> > Bernhard Beschow (7):
> >       hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9
> >       hw/acpi/Kconfig: Add missing dependencies to ACPI_ICH9
> >       hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines
> >       hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4
> >       hw/isa/Kconfig: Add missing dependency to VT82C686
> >       i386, mips: Resolve redundant ACPI and APM dependencies
> >       hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2
> > 
> > Cindy Lu (10):
> >       virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX
> >       virtio-pci: decouple notifier from interrupt process
> >       virtio-pci: decouple the single vector from the interrupt process
> >       vhost: introduce new VhostOps vhost_set_config_call
> >       vhost-vdpa: add support for config interrupt
> >       virtio: add support for configure interrupt
> >       vhost: add support for configure interrupt
> >       virtio-net: add support for configure interrupt
> >       virtio-mmio: add support for configure interrupt
> >       virtio-pci: add support for configure interrupt
> > 
> > Dongli Zhang (1):
> >       vhost-scsi: fix memleak of vsc->inflight
> > 
> > Eugenio Pérez (4):
> >       virtio_net: Modify virtio_net_get_config to early return
> >       virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it
> >       vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail
> >       vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa
> > 
> > Hyman Huang (3):
> >       vhost-user: Refactor vhost acked features saving
> >       vhost-user: Refactor the chr_closed_bh
> >       vhost-user: Fix the virtio features negotiation flaw
> > 
> > Laszlo Ersek (1):
> >       acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
> > 
> > Longpeng (Mike) (5):
> >       vdpa-dev: get iova range explicitly
> >       vdpa: harden the error path if get_iova_range failed
> >       vhost: simplify vhost_dev_enable_notifiers
> >       vhost: configure all host notifiers in a single MR transaction
> >       vdpa: commit all host notifier MRs in a single MR transaction
> > 
> > Markus Armbruster (11):
> >       include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h
> >       include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use
> >       include/hw/cxl: Include hw/cxl/*.h where needed
> >       include/hw/pci: Clean up a few things checkpatch.pl would flag
> >       include/hw/pci: Split pci_device.h off pci.h
> >       include/hw/pci: Include hw/pci/pci.h where needed
> >       include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h
> >       include/hw/virtio: Break inclusion loop
> >       include: Include headers where needed
> >       include: Don't include qemu/osdep.h
> >       docs/devel: Rules on #include in headers
> > 
> > Philippe Mathieu-Daudé (2):
> >       hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device()
> >       hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c
> > 
> > Yicong Yang (6):
> >       tests: virt: Allow changes to PPTT test table
> >       hw/acpi/aml-build: Only generate cluster node in PPTT when specified
> >       tests: virt: Update expected ACPI tables for virt test
> >       tests: acpi: Add and whitelist *.topology blobs
> >       tests: acpi: aarch64: Add topology test for aarch64
> >       tests: acpi: aarch64: Add *.topology tables
> > 
> > leixiang (1):
> >       virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers
> > 
> >  configs/devices/mips-softmmu/common.mak     |   3 -
> >  bsd-user/qemu.h                             |   1 -
> >  crypto/block-luks-priv.h                    |   1 -
> >  hw/alpha/alpha_sys.h                        |   1 -
> >  hw/display/ati_int.h                        |   2 +-
> >  hw/display/qxl.h                            |   3 +-
> >  hw/ide/ahci_internal.h                      |   2 +-
> >  hw/net/vmxnet3_defs.h                       |   2 +-
> >  hw/nvme/nvme.h                              |   2 +-
> >  hw/rdma/rdma_utils.h                        |   1 -
> >  hw/rdma/vmw/pvrdma.h                        |   2 +-
> >  hw/scsi/mptsas.h                            |   2 +-
> >  hw/usb/hcd-ehci.h                           |   3 +-
> >  hw/usb/hcd-uhci.h                           |   2 +-
> >  hw/usb/hcd-xhci-pci.h                       |   1 +
> >  hw/vfio/pci.h                               |   2 +-
> >  hw/virtio/virtio-qmp.h                      |  10 +
> >  hw/xen/xen_pt.h                             |   1 -
> >  include/exec/plugin-gen.h                   |   1 +
> >  include/hw/acpi/erst.h                      |   3 +
> >  include/hw/acpi/piix4.h                     |   2 +-
> >  include/hw/arm/allwinner-a10.h              |   1 +
> >  include/hw/boards.h                         |   3 +
> >  include/hw/char/cmsdk-apb-uart.h            |   1 +
> >  include/hw/char/goldfish_tty.h              |   1 +
> >  include/hw/char/xilinx_uartlite.h           |   1 +
> >  include/hw/cris/etraxfs.h                   |   1 +
> >  include/hw/cxl/cxl.h                        |   5 +-
> >  include/hw/cxl/cxl_cdat.h                   |   1 +
> >  include/hw/cxl/cxl_component.h              |   1 +
> >  include/hw/cxl/cxl_device.h                 |   2 +
> >  include/hw/cxl/cxl_host.h                   |   1 -
> >  include/hw/cxl/cxl_pci.h                    |   3 -
> >  include/hw/display/macfb.h                  |   3 +-
> >  include/hw/dma/sifive_pdma.h                |   2 +
> >  include/hw/i386/ich9.h                      |   4 -
> >  include/hw/i386/ioapic_internal.h           |   1 +
> >  include/hw/i386/sgx-epc.h                   |   1 +
> >  include/hw/i386/x86-iommu.h                 |   1 -
> >  include/hw/ide/pci.h                        |   2 +-
> >  include/hw/input/pl050.h                    |   1 -
> >  include/hw/intc/goldfish_pic.h              |   2 +
> >  include/hw/intc/loongarch_pch_msi.h         |   2 +
> >  include/hw/intc/loongarch_pch_pic.h         |   2 +
> >  include/hw/intc/nios2_vic.h                 |   2 +
> >  include/hw/isa/vt82c686.h                   |   1 -
> >  include/hw/misc/macio/macio.h               |   2 +-
> >  include/hw/misc/mchp_pfsoc_dmc.h            |   2 +
> >  include/hw/misc/mchp_pfsoc_ioscb.h          |   2 +
> >  include/hw/misc/mchp_pfsoc_sysreg.h         |   2 +
> >  include/hw/misc/pvpanic.h                   |   1 +
> >  include/hw/misc/sifive_e_prci.h             |   3 +-
> >  include/hw/misc/sifive_u_otp.h              |   3 +-
> >  include/hw/misc/sifive_u_prci.h             |   3 +-
> >  include/hw/misc/virt_ctrl.h                 |   2 +
> >  include/hw/misc/xlnx-versal-pmc-iou-slcr.h  |   1 +
> >  include/hw/net/lasi_82596.h                 |   2 +-
> >  include/hw/net/xlnx-zynqmp-can.h            |   1 +
> >  include/hw/pci-host/designware.h            |   3 -
> >  include/hw/pci-host/gpex.h                  |   2 +-
> >  include/hw/pci-host/i440fx.h                |   2 +-
> >  include/hw/pci-host/ls7a.h                  |   2 -
> >  include/hw/pci-host/pnv_phb3.h              |   2 -
> >  include/hw/pci-host/pnv_phb4.h              |   3 +-
> >  include/hw/pci-host/q35.h                   |   2 +-
> >  include/hw/pci-host/sabre.h                 |   2 +-
> >  include/hw/pci-host/xilinx-pcie.h           |   1 -
> >  include/hw/pci/msi.h                        |   2 +-
> >  include/hw/pci/pci.h                        | 341 ---------------------------
> >  include/hw/pci/pci_bridge.h                 |   3 +-
> >  include/hw/pci/pci_device.h                 | 350 ++++++++++++++++++++++++++++
> >  include/hw/pci/pcie.h                       |   1 -
> >  include/hw/pci/pcie_port.h                  |   1 +
> >  include/hw/pci/pcie_sriov.h                 |   2 +
> >  include/hw/pci/shpc.h                       |   2 +-
> >  include/hw/ppc/pnv_psi.h                    |   2 +-
> >  include/hw/remote/iohub.h                   |   2 +-
> >  include/hw/remote/proxy.h                   |   2 +-
> >  include/hw/riscv/boot_opensbi.h             |   2 +
> >  include/hw/riscv/microchip_pfsoc.h          |   3 +
> >  include/hw/riscv/numa.h                     |   1 +
> >  include/hw/riscv/sifive_u.h                 |   2 +
> >  include/hw/riscv/spike.h                    |   2 +-
> >  include/hw/riscv/virt.h                     |   2 +-
> >  include/hw/sd/sdhci.h                       |   2 +-
> >  include/hw/southbridge/piix.h               |   3 +-
> >  include/hw/ssi/sifive_spi.h                 |   3 +
> >  include/hw/timer/sse-timer.h                |   1 +
> >  include/hw/tricore/triboard.h               |   1 -
> >  include/hw/usb/hcd-dwc3.h                   |   1 +
> >  include/hw/usb/hcd-musb.h                   |   2 +
> >  include/hw/usb/xlnx-usb-subsystem.h         |   2 +
> >  include/hw/usb/xlnx-versal-usb2-ctrl-regs.h |   3 +
> >  include/hw/virtio/vhost-backend.h           |   3 +
> >  include/hw/virtio/vhost-vdpa.h              |   2 +
> >  include/hw/virtio/vhost.h                   |   4 +
> >  include/hw/virtio/virtio-mmio.h             |   2 +-
> >  include/hw/virtio/virtio-pci.h              |   4 +-
> >  include/hw/virtio/virtio-scsi.h             |   1 -
> >  include/hw/virtio/virtio.h                  |   8 +-
> >  include/hw/xen/xen_common.h                 |   2 +-
> >  include/net/vhost-user.h                    |   1 +
> >  include/net/vhost_net.h                     |   4 +
> >  include/qemu/plugin-memory.h                |   3 +
> >  include/qemu/userfaultfd.h                  |   1 -
> >  include/sysemu/dirtyrate.h                  |   2 +
> >  include/sysemu/dump.h                       |   1 +
> >  include/user/syscall-trace.h                |   1 +
> >  net/vmnet_int.h                             |   1 -
> >  qga/cutils.h                                |   1 -
> >  target/hexagon/hex_arch_types.h             |   1 -
> >  target/hexagon/mmvec/macros.h               |   1 -
> >  target/riscv/pmu.h                          |   1 -
> >  hw/acpi/aml-build.c                         |   2 +-
> >  hw/acpi/cpu_hotplug.c                       |   3 +
> >  hw/acpi/erst.c                              |   2 +-
> >  hw/alpha/pci.c                              |   1 +
> >  hw/alpha/typhoon.c                          |   2 +-
> >  hw/audio/ac97.c                             |   2 +-
> >  hw/audio/es1370.c                           |   2 +-
> >  hw/audio/via-ac97.c                         |   2 +-
> >  hw/char/serial-pci-multi.c                  |   2 +-
> >  hw/char/serial-pci.c                        |   2 +-
> >  hw/core/machine-smp.c                       |   2 +
> >  hw/core/qdev-properties-system.c            |   1 +
> >  hw/display/bochs-display.c                  |   2 +-
> >  hw/display/cirrus_vga.c                     |   2 +-
> >  hw/display/sm501.c                          |   2 +-
> >  hw/display/vga-pci.c                        |   2 +-
> >  hw/display/vhost-user-gpu.c                 |  18 ++
> >  hw/display/vmware_vga.c                     |   2 +-
> >  hw/i386/acpi-build.c                        |   2 +-
> >  hw/i386/xen/xen_pvdevice.c                  |   2 +-
> >  hw/ipack/tpci200.c                          |   2 +-
> >  hw/ipmi/pci_ipmi_bt.c                       |   2 +-
> >  hw/ipmi/pci_ipmi_kcs.c                      |   2 +-
> >  hw/isa/i82378.c                             |   2 +-
> >  hw/mips/gt64xxx_pci.c                       |   2 +-
> >  hw/misc/pci-testdev.c                       |   2 +-
> >  hw/misc/pvpanic-pci.c                       |   2 +-
> >  hw/net/can/can_kvaser_pci.c                 |   2 +-
> >  hw/net/can/can_mioe3680_pci.c               |   2 +-
> >  hw/net/can/can_pcm3680_pci.c                |   2 +-
> >  hw/net/can/ctucan_pci.c                     |   2 +-
> >  hw/net/e1000.c                              |   2 +-
> >  hw/net/e1000x_common.c                      |   2 +-
> >  hw/net/eepro100.c                           |   2 +-
> >  hw/net/ne2000-pci.c                         |   2 +-
> >  hw/net/net_tx_pkt.c                         |   2 +-
> >  hw/net/pcnet-pci.c                          |   2 +-
> >  hw/net/rocker/rocker.c                      |   2 +-
> >  hw/net/rocker/rocker_desc.c                 |   2 +-
> >  hw/net/rtl8139.c                            |   2 +-
> >  hw/net/sungem.c                             |   2 +-
> >  hw/net/sunhme.c                             |   2 +-
> >  hw/net/tulip.c                              |   2 +-
> >  hw/net/vhost_net-stub.c                     |  14 ++
> >  hw/net/vhost_net.c                          |  18 ++
> >  hw/net/virtio-net.c                         |  60 +++--
> >  hw/pci-bridge/i82801b11.c                   |   2 +-
> >  hw/pci-bridge/pci_expander_bridge.c         |   1 -
> >  hw/pci-host/bonito.c                        |   2 +-
> >  hw/pci-host/dino.c                          |   2 +-
> >  hw/pci-host/grackle.c                       |   2 +-
> >  hw/pci-host/mv64361.c                       |   2 +-
> >  hw/pci-host/ppce500.c                       |   2 +-
> >  hw/pci-host/raven.c                         |   2 +-
> >  hw/pci-host/sh_pci.c                        |   2 +-
> >  hw/pci-host/uninorth.c                      |   2 +-
> >  hw/pci-host/versatile.c                     |   2 +-
> >  hw/pci/pci-hmp-cmds.c                       |   1 +
> >  hw/pci/pcie_host.c                          |   2 +-
> >  hw/pci/pcie_sriov.c                         |   2 +-
> >  hw/pci/slotid_cap.c                         |   2 +-
> >  hw/ppc/ppc440_pcix.c                        |   2 +-
> >  hw/ppc/ppc4xx_pci.c                         |   2 +-
> >  hw/ppc/spapr_pci_vfio.c                     |   1 +
> >  hw/rdma/rdma_utils.c                        |   1 +
> >  hw/s390x/s390-pci-inst.c                    |   1 +
> >  hw/scsi/esp-pci.c                           |   2 +-
> >  hw/scsi/lsi53c895a.c                        |   2 +-
> >  hw/scsi/vhost-scsi-common.c                 |   1 +
> >  hw/scsi/virtio-scsi.c                       |   1 +
> >  hw/smbios/smbios.c                          |   1 +
> >  hw/usb/hcd-ohci-pci.c                       |   2 +-
> >  hw/virtio/vdpa-dev.c                        |   9 +
> >  hw/virtio/vhost-user-fs.c                   |  18 ++
> >  hw/virtio/vhost-user-gpio.c                 |  10 +
> >  hw/virtio/vhost-vdpa.c                      |  40 +++-
> >  hw/virtio/vhost-vsock-common.c              |  18 ++
> >  hw/virtio/vhost.c                           | 122 ++++++++--
> >  hw/virtio/virtio-crypto.c                   |  18 ++
> >  hw/virtio/virtio-mmio.c                     |  27 +++
> >  hw/virtio/virtio-pci.c                      | 305 ++++++++++++++++--------
> >  hw/virtio/virtio-qmp.c                      | 192 ++++++++++++++-
> >  hw/virtio/virtio.c                          | 225 +++---------------
> >  hw/watchdog/wdt_i6300esb.c                  |   2 +-
> >  net/vhost-user.c                            |  27 ++-
> >  net/vhost-vdpa.c                            |  32 +--
> >  qga/cutils.c                                |   3 +-
> >  tests/qtest/bios-tables-test.c              |  19 ++
> >  tests/qtest/fuzz/generic_fuzz.c             |   1 +
> >  ui/util.c                                   |   2 +-
> >  docs/devel/style.rst                        |   7 +
> >  hw/acpi/Kconfig                             |   9 +-
> >  hw/acpi/meson.build                         |   2 +-
> >  hw/i2c/meson.build                          |   2 +-
> >  hw/i386/Kconfig                             |   3 +-
> >  hw/isa/Kconfig                              |   4 +-
> >  hw/ppc/Kconfig                              |   2 -
> >  hw/virtio/trace-events                      |   1 +
> >  qemu-options.hx                             |   3 +
> >  tests/data/acpi/virt/APIC.topology          | Bin 0 -> 732 bytes
> >  tests/data/acpi/virt/DSDT.topology          | Bin 0 -> 5398 bytes
> >  tests/data/acpi/virt/PPTT                   | Bin 96 -> 76 bytes
> >  tests/data/acpi/virt/PPTT.acpihmatvirt      | Bin 196 -> 156 bytes
> >  tests/data/acpi/virt/PPTT.topology          | Bin 0 -> 336 bytes
> >  217 files changed, 1418 insertions(+), 839 deletions(-)
> >  create mode 100644 include/hw/pci/pci_device.h
> >  create mode 100644 tests/data/acpi/virt/APIC.topology
> >  create mode 100644 tests/data/acpi/virt/DSDT.topology
> >  create mode 100644 tests/data/acpi/virt/PPTT.topology
> > 



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

* Re: [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block
  2023-01-05 16:29       ` Philippe Mathieu-Daudé
@ 2023-01-05 16:35         ` Michael S. Tsirkin
  0 siblings, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05 16:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Laszlo Ersek, qemu-devel, Peter Maydell, Ani Sinha,
	Ard Biesheuvel, Igor Mammedov, Paolo Bonzini, qemu-stable

On Thu, Jan 05, 2023 at 05:29:54PM +0100, Philippe Mathieu-Daudé wrote:
> On 5/1/23 17:01, Laszlo Ersek wrote:
> > On 1/5/23 10:56, Michael S. Tsirkin wrote:
> > > On Thu, Jan 05, 2023 at 04:17:06AM -0500, Michael S. Tsirkin wrote:
> > > > From: Laszlo Ersek <lersek@redhat.com>
> > > 
> > > I noticed v2 is forthcoming. dropped now.
> > > 
> > 
> > Yes, thanks.
> > 
> > I'm picking up the "Reviewed-by: Michael S. Tsirkin <mst@redhat.com>"
> > tag from your commit message. I'm not taking the "Fixes:" tag,
> > originally suggested by Phil, because we've agreed that that was not
> > correct.
> 
> I suppose the tool MST is using automatically included the Fixes: tag.

Yes it tends to pick all tags. Anyway, it's replaced by v2 now.

> > The other tags (from Igor, Phil and Ard) I've picked up
> > already, and I've updated the commit message too. I'll post v2 soon.
> > 
> > Thanks!
> > Laszlo
> > 



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-05 16:31   ` Michael S. Tsirkin
@ 2023-01-05 21:04     ` Peter Maydell
  2023-01-05 21:50       ` Michael S. Tsirkin
  2023-01-05 21:53       ` Michael S. Tsirkin
  0 siblings, 2 replies; 73+ messages in thread
From: Peter Maydell @ 2023-01-05 21:04 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Thu, 5 Jan 2023 at 16:32, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> > On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > >
> > >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > >
> > > are available in the Git repository at:
> > >
> > >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > >
> > > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> >
> > 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> > as v2 is forthcoming.
>
> And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
> patch with it's v2. Sorry about the back and forth, but it seemed
> important :(
>
> >
> > >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > >
> > > ----------------------------------------------------------------
> > > virtio,pc,pci: features, cleanups, fixes
> > >
> > > mostly vhost-vdpa:
> > >     guest announce feature emulation when using shadow virtqueue
> > >     support for configure interrupt
> > >     startup speed ups
> > >
> > > an acpi change to only generate cluster node in PPTT when specified for arm
> > >
> > > misc fixes, cleanups
> > >
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > >
> > > ----------------------------------------------------------------
> > >
> > > Note: linux-user build is failing for me on master, I just
> > > disabled it for now as nothing I'm doing should affect linux-user.
> > > Didn't debug yet.

Compile failures on freebsd in the bsd-user build:

https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
https://gitlab.com/qemu-project/qemu/-/jobs/3561556071

Probably something in Markus' include-file cleanup, I suspect
some file is missing its osdep.h include.

thanks
-- PMM


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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-05 21:04     ` Peter Maydell
@ 2023-01-05 21:50       ` Michael S. Tsirkin
  2023-01-05 21:53       ` Michael S. Tsirkin
  1 sibling, 0 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05 21:50 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:
> On Thu, 5 Jan 2023 at 16:32, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> > > On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > > > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > > >
> > > >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > > >
> > > > are available in the Git repository at:
> > > >
> > > >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > > >
> > > > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> > >
> > > 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> > > as v2 is forthcoming.
> >
> > And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
> > patch with it's v2. Sorry about the back and forth, but it seemed
> > important :(
> >
> > >
> > > >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > > >
> > > > ----------------------------------------------------------------
> > > > virtio,pc,pci: features, cleanups, fixes
> > > >
> > > > mostly vhost-vdpa:
> > > >     guest announce feature emulation when using shadow virtqueue
> > > >     support for configure interrupt
> > > >     startup speed ups
> > > >
> > > > an acpi change to only generate cluster node in PPTT when specified for arm
> > > >
> > > > misc fixes, cleanups
> > > >
> > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > >
> > > > ----------------------------------------------------------------
> > > >
> > > > Note: linux-user build is failing for me on master, I just
> > > > disabled it for now as nothing I'm doing should affect linux-user.
> > > > Didn't debug yet.
> 
> Compile failures on freebsd in the bsd-user build:
> 
> https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
> https://gitlab.com/qemu-project/qemu/-/jobs/3561556071

yes - bsd-user/i386/signal.c

> 
> Probably something in Markus' include-file cleanup, I suspect
> some file is missing its osdep.h include.
> 
> thanks
> -- PMM



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-05 21:04     ` Peter Maydell
  2023-01-05 21:50       ` Michael S. Tsirkin
@ 2023-01-05 21:53       ` Michael S. Tsirkin
  2023-01-06 15:29         ` Peter Maydell
  1 sibling, 1 reply; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-05 21:53 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:
> On Thu, 5 Jan 2023 at 16:32, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> > > On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > > > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > > >
> > > >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > > >
> > > > are available in the Git repository at:
> > > >
> > > >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > > >
> > > > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> > >
> > > 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> > > as v2 is forthcoming.
> >
> > And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
> > patch with it's v2. Sorry about the back and forth, but it seemed
> > important :(
> >
> > >
> > > >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > > >
> > > > ----------------------------------------------------------------
> > > > virtio,pc,pci: features, cleanups, fixes
> > > >
> > > > mostly vhost-vdpa:
> > > >     guest announce feature emulation when using shadow virtqueue
> > > >     support for configure interrupt
> > > >     startup speed ups
> > > >
> > > > an acpi change to only generate cluster node in PPTT when specified for arm
> > > >
> > > > misc fixes, cleanups
> > > >
> > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > >
> > > > ----------------------------------------------------------------
> > > >
> > > > Note: linux-user build is failing for me on master, I just
> > > > disabled it for now as nothing I'm doing should affect linux-user.
> > > > Didn't debug yet.
> 
> Compile failures on freebsd in the bsd-user build:
> 
> https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
> https://gitlab.com/qemu-project/qemu/-/jobs/3561556071
> 
> Probably something in Markus' include-file cleanup, I suspect
> some file is missing its osdep.h include.
> 
> thanks
> -- PMM


Pushed a fixup, commit 1df76fab679e9a673b71531925fe12ceb89eaecb now.
Pls let me know, thanks!

-- 
MST



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-05 21:53       ` Michael S. Tsirkin
@ 2023-01-06 15:29         ` Peter Maydell
  2023-01-08 13:57           ` Michael S. Tsirkin
  0 siblings, 1 reply; 73+ messages in thread
From: Peter Maydell @ 2023-01-06 15:29 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Thu, 5 Jan 2023 at 21:53, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:
> > On Thu, 5 Jan 2023 at 16:32, Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> > > > On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > > > > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > > > >
> > > > >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > > > >
> > > > > are available in the Git repository at:
> > > > >
> > > > >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > > > >
> > > > > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> > > >
> > > > 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> > > > as v2 is forthcoming.
> > >
> > > And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
> > > patch with it's v2. Sorry about the back and forth, but it seemed
> > > important :(
> > >
> > > >
> > > > >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > > > >
> > > > > ----------------------------------------------------------------
> > > > > virtio,pc,pci: features, cleanups, fixes
> > > > >
> > > > > mostly vhost-vdpa:
> > > > >     guest announce feature emulation when using shadow virtqueue
> > > > >     support for configure interrupt
> > > > >     startup speed ups
> > > > >
> > > > > an acpi change to only generate cluster node in PPTT when specified for arm
> > > > >
> > > > > misc fixes, cleanups
> > > > >
> > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > >
> > > > > ----------------------------------------------------------------
> > > > >
> > > > > Note: linux-user build is failing for me on master, I just
> > > > > disabled it for now as nothing I'm doing should affect linux-user.
> > > > > Didn't debug yet.
> >
> > Compile failures on freebsd in the bsd-user build:
> >
> > https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
> > https://gitlab.com/qemu-project/qemu/-/jobs/3561556071
> >
> > Probably something in Markus' include-file cleanup, I suspect
> > some file is missing its osdep.h include.
> >
> > thanks
> > -- PMM
>
>
> Pushed a fixup, commit 1df76fab679e9a673b71531925fe12ceb89eaecb now.
> Pls let me know, thanks!

Still failing on FreeBSD, for a different reason:
https://gitlab.com/qemu-project/qemu/-/jobs/3565200188

thanks
-- PMM


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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-06 15:29         ` Peter Maydell
@ 2023-01-08 13:57           ` Michael S. Tsirkin
  2023-01-09 13:43             ` Markus Armbruster
  2023-01-09 15:54             ` Peter Maydell
  0 siblings, 2 replies; 73+ messages in thread
From: Michael S. Tsirkin @ 2023-01-08 13:57 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

On Fri, Jan 06, 2023 at 03:29:01PM +0000, Peter Maydell wrote:
> On Thu, 5 Jan 2023 at 21:53, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:
> > > On Thu, 5 Jan 2023 at 16:32, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > >
> > > > On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> > > > > On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > > > > > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > > > > >
> > > > > >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > > > > >
> > > > > > are available in the Git repository at:
> > > > > >
> > > > > >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > > > > >
> > > > > > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> > > > >
> > > > > 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> > > > > as v2 is forthcoming.
> > > >
> > > > And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
> > > > patch with it's v2. Sorry about the back and forth, but it seemed
> > > > important :(
> > > >
> > > > >
> > > > > >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > > > > >
> > > > > > ----------------------------------------------------------------
> > > > > > virtio,pc,pci: features, cleanups, fixes
> > > > > >
> > > > > > mostly vhost-vdpa:
> > > > > >     guest announce feature emulation when using shadow virtqueue
> > > > > >     support for configure interrupt
> > > > > >     startup speed ups
> > > > > >
> > > > > > an acpi change to only generate cluster node in PPTT when specified for arm
> > > > > >
> > > > > > misc fixes, cleanups
> > > > > >
> > > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > > >
> > > > > > ----------------------------------------------------------------
> > > > > >
> > > > > > Note: linux-user build is failing for me on master, I just
> > > > > > disabled it for now as nothing I'm doing should affect linux-user.
> > > > > > Didn't debug yet.
> > >
> > > Compile failures on freebsd in the bsd-user build:
> > >
> > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
> > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556071
> > >
> > > Probably something in Markus' include-file cleanup, I suspect
> > > some file is missing its osdep.h include.
> > >
> > > thanks
> > > -- PMM
> >
> >
> > Pushed a fixup, commit 1df76fab679e9a673b71531925fe12ceb89eaecb now.
> > Pls let me know, thanks!
> 
> Still failing on FreeBSD, for a different reason:
> https://gitlab.com/qemu-project/qemu/-/jobs/3565200188
> 
> thanks
> -- PMM

Dropped the offending patch, commit aba0d042b1c1be38818cec16af3f34e9e9e2aed2 
now.  Pls let me know, thanks!

-- 
MST



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

* Re: [PULL 37/51] docs/devel: Rules on #include in headers
  2023-01-05  9:16 ` [PULL 37/51] docs/devel: Rules on #include in headers Michael S. Tsirkin
@ 2023-01-09 12:03   ` Markus Armbruster
  0 siblings, 0 replies; 73+ messages in thread
From: Markus Armbruster @ 2023-01-09 12:03 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: qemu-devel, Peter Maydell, Bernhard Beschow, Alex Bennée,
	Philippe Mathieu-Daudé, Daniel P. Berrangé,
	Richard Henderson

"Michael S. Tsirkin" <mst@redhat.com> writes:

> From: Markus Armbruster <armbru@redhat.com>
>
> Rules for headers were proposed a long time ago, and generally liked:
>
>     Message-ID: <87h9g8j57d.fsf@blackfin.pond.sub.org>
>     https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html
>
> Wortk them into docs/devel/style.rst.

Alex spotted my typo "Wortk".  Perhaps you can still fix it.

> Suggested-by: Bernhard Beschow <shentey@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Message-Id: <20221222120813.727830-5-armbru@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Bernhard Beschow <shentey@gmail.com>



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-08 13:57           ` Michael S. Tsirkin
@ 2023-01-09 13:43             ` Markus Armbruster
  2023-01-10 18:28               ` Markus Armbruster
  2023-01-09 15:54             ` Peter Maydell
  1 sibling, 1 reply; 73+ messages in thread
From: Markus Armbruster @ 2023-01-09 13:43 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Peter Maydell, qemu-devel

"Michael S. Tsirkin" <mst@redhat.com> writes:

> On Fri, Jan 06, 2023 at 03:29:01PM +0000, Peter Maydell wrote:
>> On Thu, 5 Jan 2023 at 21:53, Michael S. Tsirkin <mst@redhat.com> wrote:
>> >
>> > On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:

[...]

>> > > Compile failures on freebsd in the bsd-user build:
>> > >
>> > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
>> > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556071
>> > >
>> > > Probably something in Markus' include-file cleanup, I suspect
>> > > some file is missing its osdep.h include.
>> > >
>> > > thanks
>> > > -- PMM
>> >
>> >
>> > Pushed a fixup, commit 1df76fab679e9a673b71531925fe12ceb89eaecb now.
>> > Pls let me know, thanks!
>> 
>> Still failing on FreeBSD, for a different reason:
>> https://gitlab.com/qemu-project/qemu/-/jobs/3565200188
>> 
>> thanks
>> -- PMM
>
> Dropped the offending patch, commit aba0d042b1c1be38818cec16af3f34e9e9e2aed2 
> now.  Pls let me know, thanks!

Appreciate the CI links.  I'll respin.



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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-08 13:57           ` Michael S. Tsirkin
  2023-01-09 13:43             ` Markus Armbruster
@ 2023-01-09 15:54             ` Peter Maydell
  1 sibling, 0 replies; 73+ messages in thread
From: Peter Maydell @ 2023-01-09 15:54 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Sun, 8 Jan 2023 at 13:58, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Jan 06, 2023 at 03:29:01PM +0000, Peter Maydell wrote:
> > On Thu, 5 Jan 2023 at 21:53, Michael S. Tsirkin <mst@redhat.com> wrote:
> > >
> > > On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:
> > > > On Thu, 5 Jan 2023 at 16:32, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > > >
> > > > > On Thu, Jan 05, 2023 at 04:56:39AM -0500, Michael S. Tsirkin wrote:
> > > > > > On Thu, Jan 05, 2023 at 04:14:20AM -0500, Michael S. Tsirkin wrote:
> > > > > > > The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
> > > > > > >
> > > > > > >   .gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
> > > > > > >
> > > > > > > are available in the Git repository at:
> > > > > > >
> > > > > > >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> > > > > > >
> > > > > > > for you to fetch changes up to 6529cb46fa76bb4b4f217d6fcc68b61b543062c4:
> > > > > >
> > > > > > 7c77271205339d3b161bdf925f5ead799b582e47 now - I dropped one patch
> > > > > > as v2 is forthcoming.
> > > > >
> > > > > And now it's c46dcec9f699508e811cb6a140250d07486b0e41 as I replaced that
> > > > > patch with it's v2. Sorry about the back and forth, but it seemed
> > > > > important :(
> > > > >
> > > > > >
> > > > > > >   vhost-scsi: fix memleak of vsc->inflight (2023-01-05 04:07:39 -0500)
> > > > > > >
> > > > > > > ----------------------------------------------------------------
> > > > > > > virtio,pc,pci: features, cleanups, fixes
> > > > > > >
> > > > > > > mostly vhost-vdpa:
> > > > > > >     guest announce feature emulation when using shadow virtqueue
> > > > > > >     support for configure interrupt
> > > > > > >     startup speed ups
> > > > > > >
> > > > > > > an acpi change to only generate cluster node in PPTT when specified for arm
> > > > > > >
> > > > > > > misc fixes, cleanups
> > > > > > >
> > > > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > > > >
> > > > > > > ----------------------------------------------------------------
> > > > > > >
> > > > > > > Note: linux-user build is failing for me on master, I just
> > > > > > > disabled it for now as nothing I'm doing should affect linux-user.
> > > > > > > Didn't debug yet.
> > > >
> > > > Compile failures on freebsd in the bsd-user build:
> > > >
> > > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
> > > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556071
> > > >
> > > > Probably something in Markus' include-file cleanup, I suspect
> > > > some file is missing its osdep.h include.
> > > >
> > > > thanks
> > > > -- PMM
> > >
> > >
> > > Pushed a fixup, commit 1df76fab679e9a673b71531925fe12ceb89eaecb now.
> > > Pls let me know, thanks!
> >
> > Still failing on FreeBSD, for a different reason:
> > https://gitlab.com/qemu-project/qemu/-/jobs/3565200188
> >
> > thanks
> > -- PMM
>
> Dropped the offending patch, commit aba0d042b1c1be38818cec16af3f34e9e9e2aed2
> now.  Pls let me know, thanks!
>


Applied, thanks.

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

-- PMM


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

* Re: [PULL 00/51] virtio,pc,pci: features, cleanups, fixes
  2023-01-09 13:43             ` Markus Armbruster
@ 2023-01-10 18:28               ` Markus Armbruster
  0 siblings, 0 replies; 73+ messages in thread
From: Markus Armbruster @ 2023-01-10 18:28 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Michael S. Tsirkin, qemu-devel

Markus Armbruster <armbru@redhat.com> writes:

> "Michael S. Tsirkin" <mst@redhat.com> writes:
>
>> On Fri, Jan 06, 2023 at 03:29:01PM +0000, Peter Maydell wrote:
>>> On Thu, 5 Jan 2023 at 21:53, Michael S. Tsirkin <mst@redhat.com> wrote:
>>> >
>>> > On Thu, Jan 05, 2023 at 09:04:37PM +0000, Peter Maydell wrote:
>
> [...]
>
>>> > > Compile failures on freebsd in the bsd-user build:
>>> > >
>>> > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556072
>>> > > https://gitlab.com/qemu-project/qemu/-/jobs/3561556071
>>> > >
>>> > > Probably something in Markus' include-file cleanup, I suspect
>>> > > some file is missing its osdep.h include.
>>> > >
>>> > > thanks
>>> > > -- PMM
>>> >
>>> >
>>> > Pushed a fixup, commit 1df76fab679e9a673b71531925fe12ceb89eaecb now.
>>> > Pls let me know, thanks!
>>> 
>>> Still failing on FreeBSD, for a different reason:
>>> https://gitlab.com/qemu-project/qemu/-/jobs/3565200188
>>> 
>>> thanks
>>> -- PMM
>>
>> Dropped the offending patch, commit aba0d042b1c1be38818cec16af3f34e9e9e2aed2 
>> now.  Pls let me know, thanks!
>
> Appreciate the CI links.  I'll respin.

I'd like to reproduce locally, and tried "make vm-build-freebsd".  No
luck.  Any other ideas?



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

* Re: [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified
  2023-01-05  9:16 ` [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified Michael S. Tsirkin
@ 2023-05-10 10:13   ` Philippe Mathieu-Daudé
  2023-05-13  7:22     ` Yicong Yang via
  0 siblings, 1 reply; 73+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-10 10:13 UTC (permalink / raw)
  To: Yicong Yang
  Cc: Michael S. Tsirkin, Peter Maydell, Yanan Wang, Igor Mammedov,
	Ani Sinha, Eduardo Habkost, Marcel Apfelbaum,
	Philippe Mathieu-Daudé,
	qemu-devel, Bernhard Beschow

Hi Yang,

On 5/1/23 10:16, Michael S. Tsirkin wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
> 
> Currently we'll always generate a cluster node no matter user has
> specified '-smp clusters=X' or not. Cluster is an optional level
> and will participant the building of Linux scheduling domains and
> only appears on a few platforms. It's unncessary to always build
> it when it cannot reflect the real topology on platforms having no
> cluster implementation and to avoid affecting the linux scheduling
> domains in the VM. So only generate the cluster topology in ACPI
> PPTT when the user has specified it explicitly in -smp.
> 
> Tested qemu-system-aarch64 with `-smp 8` and linux 6.1-rc1, without
> this patch:
> estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
> ff	# cluster_cpus
> 0-7	# cluster_cpus_list
> 56	# cluster_id
> 
> with this patch:
> estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
> ff	# cluster_cpus
> 0-7	# cluster_cpus_list
> 36	# cluster_id, with no cluster node kernel will make it to
> 	  physical package id
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
> Tested-by: Yanan Wang <wangyanan55@huawei.com>
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> Message-Id: <20221229065513.55652-3-yangyicong@huawei.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   include/hw/boards.h   | 3 +++
>   hw/acpi/aml-build.c   | 2 +-
>   hw/core/machine-smp.c | 2 ++
>   qemu-options.hx       | 3 +++
>   4 files changed, 9 insertions(+), 1 deletion(-)


> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 42feb4d4d7..ea331a20d1 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
>                   0, socket_id, NULL, 0);
>           }
>   
> -        if (mc->smp_props.clusters_supported) {
> +        if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
>               if (cpus->cpus[n].props.cluster_id != cluster_id) {
>                   assert(cpus->cpus[n].props.cluster_id > cluster_id);
>                   cluster_id = cpus->cpus[n].props.cluster_id;
> diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
> index b39ed21e65..c3dab007da 100644
> --- a/hw/core/machine-smp.c
> +++ b/hw/core/machine-smp.c
> @@ -158,6 +158,8 @@ void machine_parse_smp_config(MachineState *ms,
>       ms->smp.threads = threads;
>       ms->smp.max_cpus = maxcpus;
>   
> +    mc->smp_props.has_clusters = config->has_clusters;

In another patch Bernhard noticed a QOM class field updated from
a QOM object, which is an anti-OOP pattern:
https://lore.kernel.org/qemu-devel/6E514B4B-9185-424E-832E-01813DE8E83F@gmail.com/

Looking at the codebase I noticed this is what you are doing here.
By doing so, updating the class field from this particular instance
results in all other instances being affected.

Currently this isn't really an issue because there are at most 2
MachineState instances (in a migration case, where we want the same
machine). However it would be nice to have this bad code example
cleaned. (Also eventually this could become an issue with heterogeneous
machines, but I'm not sure yet).

Do you mind sending a patch?

Thanks,

Phil.

>       /* sanity-check of the computed topology */
>       if (sockets * dies * clusters * cores * threads != maxcpus) {
>           g_autofree char *topo_msg = cpu_hierarchy_to_string(ms);
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 7f99d15b23..8662568324 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -343,6 +343,9 @@ SRST
>       ::
>   
>           -smp 2
> +
> +    Note: The cluster topology will only be generated in ACPI and exposed
> +    to guest if it's explicitly specified in -smp.
>   ERST
>   
>   DEF("numa", HAS_ARG, QEMU_OPTION_numa,



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

* Re: [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified
  2023-05-10 10:13   ` Philippe Mathieu-Daudé
@ 2023-05-13  7:22     ` Yicong Yang via
  0 siblings, 0 replies; 73+ messages in thread
From: Yicong Yang via @ 2023-05-13  7:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Yicong Yang
  Cc: Michael S. Tsirkin, Peter Maydell, Yanan Wang, Igor Mammedov,
	Ani Sinha, Eduardo Habkost, Marcel Apfelbaum, qemu-devel,
	Bernhard Beschow

Hi Philippe,

On 2023/5/10 18:13, Philippe Mathieu-Daudé wrote:
> Hi Yang,
> 
> On 5/1/23 10:16, Michael S. Tsirkin wrote:
>> From: Yicong Yang <yangyicong@hisilicon.com>
>>
>> Currently we'll always generate a cluster node no matter user has
>> specified '-smp clusters=X' or not. Cluster is an optional level
>> and will participant the building of Linux scheduling domains and
>> only appears on a few platforms. It's unncessary to always build
>> it when it cannot reflect the real topology on platforms having no
>> cluster implementation and to avoid affecting the linux scheduling
>> domains in the VM. So only generate the cluster topology in ACPI
>> PPTT when the user has specified it explicitly in -smp.
>>
>> Tested qemu-system-aarch64 with `-smp 8` and linux 6.1-rc1, without
>> this patch:
>> estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
>> ff    # cluster_cpus
>> 0-7    # cluster_cpus_list
>> 56    # cluster_id
>>
>> with this patch:
>> estuary:/sys/devices/system/cpu/cpu0/topology$ cat cluster_*
>> ff    # cluster_cpus
>> 0-7    # cluster_cpus_list
>> 36    # cluster_id, with no cluster node kernel will make it to
>>       physical package id
>>
>> Acked-by: Michael S. Tsirkin <mst@redhat.com>
>> Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
>> Tested-by: Yanan Wang <wangyanan55@huawei.com>
>> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
>> Message-Id: <20221229065513.55652-3-yangyicong@huawei.com>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> ---
>>   include/hw/boards.h   | 3 +++
>>   hw/acpi/aml-build.c   | 2 +-
>>   hw/core/machine-smp.c | 2 ++
>>   qemu-options.hx       | 3 +++
>>   4 files changed, 9 insertions(+), 1 deletion(-)
> 
> 
>> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
>> index 42feb4d4d7..ea331a20d1 100644
>> --- a/hw/acpi/aml-build.c
>> +++ b/hw/acpi/aml-build.c
>> @@ -2030,7 +2030,7 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
>>                   0, socket_id, NULL, 0);
>>           }
>>   -        if (mc->smp_props.clusters_supported) {
>> +        if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
>>               if (cpus->cpus[n].props.cluster_id != cluster_id) {
>>                   assert(cpus->cpus[n].props.cluster_id > cluster_id);
>>                   cluster_id = cpus->cpus[n].props.cluster_id;
>> diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
>> index b39ed21e65..c3dab007da 100644
>> --- a/hw/core/machine-smp.c
>> +++ b/hw/core/machine-smp.c
>> @@ -158,6 +158,8 @@ void machine_parse_smp_config(MachineState *ms,
>>       ms->smp.threads = threads;
>>       ms->smp.max_cpus = maxcpus;
>>   +    mc->smp_props.has_clusters = config->has_clusters;
> 
> In another patch Bernhard noticed a QOM class field updated from
> a QOM object, which is an anti-OOP pattern:
> https://lore.kernel.org/qemu-devel/6E514B4B-9185-424E-832E-01813DE8E83F@gmail.com/
> 
> Looking at the codebase I noticed this is what you are doing here.
> By doing so, updating the class field from this particular instance
> results in all other instances being affected.
> 

Is it suggested to move this to machinestat so we won't touch the machineclass members
in the initialization here? In the initial version the has_clusters is placed in the
ms->smp structure but it's suggested that's not a good place, see the discussion [1]

[1] https://lore.kernel.org/qemu-devel/6fa8a6ca-765a-8a55-76fb-91714b740fe7@huawei.com/

Thanks.

> Currently this isn't really an issue because there are at most 2
> MachineState instances (in a migration case, where we want the same
> machine). However it would be nice to have this bad code example
> cleaned. (Also eventually this could become an issue with heterogeneous
> machines, but I'm not sure yet).
> 
> Do you mind sending a patch?
> 
> Thanks,
> 
> Phil.
> 
>>       /* sanity-check of the computed topology */
>>       if (sockets * dies * clusters * cores * threads != maxcpus) {
>>           g_autofree char *topo_msg = cpu_hierarchy_to_string(ms);
>> diff --git a/qemu-options.hx b/qemu-options.hx
>> index 7f99d15b23..8662568324 100644
>> --- a/qemu-options.hx
>> +++ b/qemu-options.hx
>> @@ -343,6 +343,9 @@ SRST
>>       ::
>>             -smp 2
>> +
>> +    Note: The cluster topology will only be generated in ACPI and exposed
>> +    to guest if it's explicitly specified in -smp.
>>   ERST
>>     DEF("numa", HAS_ARG, QEMU_OPTION_numa,
> 
> .


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

end of thread, other threads:[~2023-05-13  7:23 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05  9:14 [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 01/51] virtio_net: Modify virtio_net_get_config to early return Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 03/51] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 04/51] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 05/51] hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9 Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 06/51] hw/acpi/Kconfig: Add missing dependencies " Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 07/51] hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 08/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4 Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 09/51] hw/isa/Kconfig: Add missing dependency to VT82C686 Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 10/51] i386, mips: Resolve redundant ACPI and APM dependencies Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 11/51] hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2 Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 12/51] vhost-user: Refactor vhost acked features saving Michael S. Tsirkin
2023-01-05  9:14 ` [PULL 13/51] vhost-user: Refactor the chr_closed_bh Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 14/51] vhost-user: Fix the virtio features negotiation flaw Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 15/51] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX Michael S. Tsirkin
2023-01-05  9:15   ` [Virtio-fs] " Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 16/51] virtio-pci: decouple notifier from interrupt process Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 17/51] virtio-pci: decouple the single vector from the " Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 18/51] vhost: introduce new VhostOps vhost_set_config_call Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 19/51] vhost-vdpa: add support for config interrupt Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 20/51] virtio: add support for configure interrupt Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 21/51] vhost: " Michael S. Tsirkin
2023-01-05  9:21   ` Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 22/51] virtio-net: " Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 23/51] virtio-mmio: " Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 24/51] virtio-pci: " Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 25/51] hw/virtio: Rename virtio_device_find() -> qmp_find_virtio_device() Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 26/51] hw/virtio: Extract QMP QOM-specific functions to virtio-qmp.c Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 27/51] include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h Michael S. Tsirkin
2023-01-05  9:21   ` Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 29/51] include/hw/cxl: Include hw/cxl/*.h where needed Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 30/51] include/hw/pci: Clean up a few things checkpatch.pl would flag Michael S. Tsirkin
2023-01-05  9:15 ` [PULL 31/51] include/hw/pci: Split pci_device.h off pci.h Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 34/51] include/hw/virtio: Break inclusion loop Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 35/51] include: Include headers where needed Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 36/51] include: Don't include qemu/osdep.h Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 37/51] docs/devel: Rules on #include in headers Michael S. Tsirkin
2023-01-09 12:03   ` Markus Armbruster
2023-01-05  9:16 ` [PULL 38/51] vdpa-dev: get iova range explicitly Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 39/51] vdpa: harden the error path if get_iova_range failed Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 40/51] vhost: simplify vhost_dev_enable_notifiers Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 41/51] vhost: configure all host notifiers in a single MR transaction Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 42/51] vdpa: commit all host notifier MRs " Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 43/51] virtio-pci: fix proxy->vector_irqfd leak in virtio_pci_set_guest_notifiers Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 44/51] tests: virt: Allow changes to PPTT test table Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 45/51] hw/acpi/aml-build: Only generate cluster node in PPTT when specified Michael S. Tsirkin
2023-05-10 10:13   ` Philippe Mathieu-Daudé
2023-05-13  7:22     ` Yicong Yang via
2023-01-05  9:16 ` [PULL 46/51] tests: virt: Update expected ACPI tables for virt test Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 47/51] tests: acpi: Add and whitelist *.topology blobs Michael S. Tsirkin
2023-01-05  9:16 ` [PULL 48/51] tests: acpi: aarch64: Add topology test for aarch64 Michael S. Tsirkin
2023-01-05  9:17 ` [PULL 49/51] tests: acpi: aarch64: Add *.topology tables Michael S. Tsirkin
2023-01-05  9:17 ` [PULL 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin
2023-01-05  9:56   ` Michael S. Tsirkin
2023-01-05 16:01     ` Laszlo Ersek
2023-01-05 16:29       ` Philippe Mathieu-Daudé
2023-01-05 16:35         ` Michael S. Tsirkin
2023-01-05  9:17 ` [PULL 51/51] vhost-scsi: fix memleak of vsc->inflight Michael S. Tsirkin
2023-01-05  9:21 ` [PULL 28/51] include/hw/cxl: Move typedef PXBDev to cxl.h, and put it to use Michael S. Tsirkin
2023-01-05  9:22 ` [PULL 32/51] include/hw/pci: Include hw/pci/pci.h where needed Michael S. Tsirkin
2023-01-05  9:22 ` [PULL 33/51] include/hw/cxl: Break inclusion loop cxl_pci.h and cxl_cdat_h Michael S. Tsirkin
2023-01-05  9:56 ` [PULL 00/51] virtio,pc,pci: features, cleanups, fixes Michael S. Tsirkin
2023-01-05 16:31   ` Michael S. Tsirkin
2023-01-05 21:04     ` Peter Maydell
2023-01-05 21:50       ` Michael S. Tsirkin
2023-01-05 21:53       ` Michael S. Tsirkin
2023-01-06 15:29         ` Peter Maydell
2023-01-08 13:57           ` Michael S. Tsirkin
2023-01-09 13:43             ` Markus Armbruster
2023-01-10 18:28               ` Markus Armbruster
2023-01-09 15:54             ` Peter Maydell
2023-01-05 16:30 ` [PULL v2 50/51] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.