include/hw/pci include/hw/cxl: Clean up includes
Subsystems (2)
cover include/hw/pci include/hw/cxl: Clean up includes
Back in 2016, we discussed[1] rules for headers, and these were generally liked:
1. Have a carefully curated header that's included everywhere first. We got that already thanks to Peter: osdep.h.
2. 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, put those into qemu/typedefs.h instead of including the header.
3. Cyclic inclusion is forbidden.
After this series, include/hw/pci and include/hw/cxl conform to these rules.
It is based on
[PATCH 0/3] block: Clean up includes
[PATCH 0/4] coroutine: Clean up includes
[1] Message-ID: <[email protected]>
https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html
Based-on: <[email protected]>
Markus Armbruster (5):
include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h 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
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/xen/xen_pt.h | 1 - include/hw/acpi/piix4.h | 2 +- include/hw/arm/allwinner-a10.h | 1 + include/hw/cxl/cxl.h | 1 - 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_pci.h | 2 - include/hw/i386/ich9.h | 4 - include/hw/i386/x86-iommu.h | 1 - include/hw/ide/pci.h | 2 +- include/hw/isa/vt82c686.h | 1 - include/hw/misc/macio/macio.h | 2 +- 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 | 352 ----------------------------- include/hw/pci/pci_bridge.h | 2 +- include/hw/pci/pci_device.h | 361 ++++++++++++++++++++++++++++++ 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/remote/iohub.h | 2 +- include/hw/remote/proxy.h | 2 +- include/hw/sd/sdhci.h | 2 +- include/hw/southbridge/piix.h | 3 +- include/hw/virtio/virtio-scsi.h | 1 - include/hw/xen/xen_common.h | 2 +- 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/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/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/virtio-net.c | 2 +- hw/pci-bridge/i82801b11.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/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/virtio-scsi.c | 1 + hw/smbios/smbios.c | 1 + hw/usb/hcd-ohci-pci.c | 2 +- hw/watchdog/wdt_i6300esb.c | 2 +- ui/util.c | 2 +- 114 files changed, 461 insertions(+), 462 deletions(-) create mode 100644 include/hw/pci/pci_device.h
Signature · 1 line
2.37.3
PATCH 1/5 include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h
--- 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(-)
hw/alpha/alpha_sys.h +0 -1
@@ -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"
hw/rdma/rdma_utils.h +0 -1
@@ -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, ...) \
hw/rdma/vmw/pvrdma.h +0 -1
@@ -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"
hw/usb/hcd-ehci.h +0 -1
@@ -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
hw/xen/xen_pt.h +0 -1
@@ -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"
include/hw/cxl/cxl.h +0 -1
@@ -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"
include/hw/cxl/cxl_cdat.h +1 -0
@@ -11,6 +11,7 @@#define CXL_CDAT_H #include "hw/cxl/cxl_pci.h" +#include "hw/pci/pcie_doe.h" /* * Reference:
include/hw/cxl/cxl_device.h +1 -0
@@ -10,6 +10,7 @@#ifndef CXL_DEVICE_H #define CXL_DEVICE_H +#include "hw/pci/pci.h" #include "hw/register.h" /*
include/hw/cxl/cxl_pci.h +0 -2
@@ -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
include/hw/i386/ich9.h +0 -4
@@ -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);
include/hw/i386/x86-iommu.h +0 -1
@@ -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"
include/hw/isa/vt82c686.h +0 -1
@@ -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"
include/hw/pci-host/designware.h +0 -3
@@ -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"
include/hw/pci-host/i440fx.h +1 -1
@@ -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"
include/hw/pci-host/ls7a.h +0 -2
@@ -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"
include/hw/pci-host/pnv_phb3.h +0 -2
@@ -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"
include/hw/pci-host/pnv_phb4.h +1 -2
@@ -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"
include/hw/pci-host/xilinx-pcie.h +0 -1
@@ -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"
include/hw/pci/pcie.h +0 -1
@@ -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 */
include/hw/virtio/virtio-scsi.h +0 -1
@@ -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"
hw/alpha/pci.c +1 -0
@@ -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"
hw/alpha/typhoon.c +1 -1
@@ -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"
hw/i386/acpi-build.c +1 -1
@@ -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"
hw/pci-bridge/i82801b11.c +1 -1
@@ -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"
hw/rdma/rdma_utils.c +1 -0
@@ -14,6 +14,7 @@*/ #include "qemu/osdep.h" +#include "hw/pci/pci.h" #include "trace.h" #include "rdma_utils.h"
hw/scsi/virtio-scsi.c +1 -0
@@ -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"
Signature · 1 line
2.37.3
Re: [PATCH 1/5] include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h
Quoted 1 line · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>
Thanks!
How can I verify this is correct, i.e. that none
of the headers that we remove is actually needed?
Quoted 362 lines
--- 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(-)hw/alpha/alpha_sys.h +0
-1@@ -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" hw/rdma/rdma_utils.h +0
-1@@ -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, ...) \hw/rdma/vmw/pvrdma.h +0
-1@@ -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" hw/usb/hcd-ehci.h +0
-1@@ -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 0hw/xen/xen_pt.h +0
-1@@ -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" include/hw/cxl/cxl.h +0
-1@@ -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" include/hw/cxl/cxl_cdat.h +1
-0@@ -11,6 +11,7 @@#define CXL_CDAT_H #include "hw/cxl/cxl_pci.h" +#include "hw/pci/pcie_doe.h" /* * Reference: include/hw/cxl/cxl_device.h +1
-0@@ -10,6 +10,7 @@#ifndef CXL_DEVICE_H #define CXL_DEVICE_H +#include "hw/pci/pci.h" #include "hw/register.h" /* include/hw/cxl/cxl_pci.h +0
-2@@ -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 0x1e98include/hw/i386/ich9.h +0
-4@@ -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);include/hw/i386/x86-iommu.h +0
-1@@ -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" include/hw/isa/vt82c686.h +0
-1@@ -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"include/hw/pci-host/designware.h +0
-3@@ -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" include/hw/pci-host/i440fx.h +1
-1@@ -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" include/hw/pci-host/ls7a.h +0
-2@@ -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" include/hw/pci-host/pnv_phb3.h +0
-2@@ -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" include/hw/pci-host/pnv_phb4.h +1
-2@@ -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" include/hw/pci-host/xilinx-pcie.h +0
-1@@ -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" include/hw/pci/pcie.h +0
-1@@ -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 */include/hw/virtio/virtio-scsi.h +0
-1@@ -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" hw/alpha/pci.c +1
-0@@ -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" hw/alpha/typhoon.c +1
-1@@ -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"hw/i386/acpi-build.c +1
-1@@ -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" hw/pci-bridge/i82801b11.c +1
-1@@ -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" hw/rdma/rdma_utils.c +1
-0@@ -14,6 +14,7 @@*/ #include "qemu/osdep.h" +#include "hw/pci/pci.h" #include "trace.h" #include "rdma_utils.h" hw/scsi/virtio-scsi.c +1
-0@@ -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" Signature · 1 line
2.37.3
Re: [PATCH 1/5] include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h
Quoted 6 lines · Michael S. Tsirkin
Quoted 1 line · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>Thanks!
How can I verify this is correct, i.e. that none
of the headers that we remove is actually needed?
I think the pragmatic way forward is to let the compiler check.
"But how can we be confident the compiler's check is complete?" you might ask. So let's consider how it could be incomplete.
Any .c that (transitively) includes one of the headers that now include less could be affected.
* Test builds fail to compile such a .c.
To actually miss a problem, the code not covered must use something from a header that is no longer included.
* Test builds compile such a .c, but fail to cover all build configurations.
To actually miss a problem, the conditional code not covered must use something from a header that is no longer included.
* Test builds silently miscompile such a .c, i.e. the build succeeds, "make check" passes, but the generated code is wrong.
For this, the code must use something from a header that is no longer included *and* it still needs to make sense to the compiler. Seems far-fetched to me, except for #ifdef FOO where FOO comes from such a header.
In my opinion, breaking something not covered by CI and in a way that is trivial to fix doesn't really matter.
In addition to building various configurations, I tested that each affected header compiles on its own, by compiling
#include "qemu/osdep.h"
#include THE_HEADERThere are two failures, hw/cxl/cxl_device.h and include/hw/pci/pcie.h, but they both fail before this patch as well, and they don't fail anymore at the end of this series.
Anything else you'd like me to do?
Re: [PATCH 1/5] include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h
In reply to Markus ArmbrusterOn Fri, 9 Dec 2022 14:47:58 +0100
Markus Armbruster <[email protected]> wrote:
Hi Markus,
One comment on the CXL ones. Others CXL related changes all looks fine to me.
Thanks for cleaning these up.
Jonathan
include/hw/cxl/cxl.h line 16
Quoted 9 lines
include/hw/cxl/cxl.h +0
-1@@ -13,7 +13,6 @@#include "qapi/qapi-types-machine.h" #include "qapi/qapi-visit-machine.h" -#include "hw/pci/pci_bridge.h"
If we drop this, we probably want a forwards def of struct PXBDev
I should probably be using the typedef in here as well rather than struct PXBDev * in CXLFixed Window so we'd need to deal with making that visible too.
Quoted 5 lines
include/hw/cxl/cxl.h +0
-0#include "hw/pci/pci_host.h" #include "cxl_pci.h" #include "cxl_component.h" #define
CXL_VENDOR_ID0x1e98
Re: [PATCH 1/5] include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h
Quoted 19 lines · Jonathan Cameron
On Fri, 9 Dec 2022 14:47:58 +0100
Markus Armbruster <[email protected]> wrote:Hi Markus,
One comment on the CXL ones. Others CXL related changes all looks fine to me.
Thanks for cleaning these up.
Jonathan
Quoted 6 lines
include/hw/cxl/cxl.h +0
-0@@ -13,7 +13,6 @@
Quoted 6 lines
include/hw/cxl/cxl.h line 16
Quoted 3 lines
include/hw/cxl/cxl.h +0
-1#include "qapi/qapi-types-machine.h" #include "qapi/qapi-visit-machine.h" -#include "hw/pci/pci_bridge.h" If we drop this, we probably want a forwards def of struct PXBDev
Why? Because it's used in the header?
Quoted 3 lines
I should probably be using the typedef in here as well rather than struct PXBDev * in CXLFixed Window so we'd need to deal with making that visible too.
We have two typedef struct PXBDev PXBDev, one n pci_bridge.h, and one in pci_expander_bridge.c. Both include cxl.h. Move it to cxl.h?
Quoted 5 lines
Quoted 5 lines
include/hw/cxl/cxl.h +0
-0#include "hw/pci/pci_host.h" #include "cxl_pci.h" #include "cxl_component.h" #define
CXL_VENDOR_ID0x1e98
Re: [PATCH 1/5] include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.h
Quoted 28 lines · On Thu, 15 Dec 2022 08:14:52 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 19 lines · Jonathan Cameron
On Fri, 9 Dec 2022 14:47:58 +0100
Markus Armbruster <[email protected]> wrote:Hi Markus,
One comment on the CXL ones. Others CXL related changes all looks fine to me.
Thanks for cleaning these up.
Jonathan
Quoted 6 lines
include/hw/cxl/cxl.h +0
-0@@ -13,7 +13,6 @@Quoted 6 lines
include/hw/cxl/cxl.h line 16
Quoted 3 lines
include/hw/cxl/cxl.h +0
-1#include "qapi/qapi-types-machine.h" #include "qapi/qapi-visit-machine.h" -#include "hw/pci/pci_bridge.h" If we drop this, we probably want a forwards def of struct PXBDev
Quoted 8 lines
Why? Because it's used in the header?
Quoted 3 lines
I should probably be using the typedef in here as well rather than struct PXBDev * in CXLFixed Window so we'd need to deal with making that visible too.
We have two typedef struct PXBDev PXBDev, one n
pci_bridge.h, and one inpci_expander_bridge.c. Both includecxl.h. Move it tocxl.h?
Sure.
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
include/hw/cxl/cxl.h +0
-0#include "hw/pci/pci_host.h" #include "cxl_pci.h" #include "cxl_component.h" #define
CXL_VENDOR_ID0x1e98
PATCH 2/5 include/hw/cxl: Include hw/cxl/*.h where needed
In reply to Markus Armbrusterhw/cxl/cxl_component.h needs CDATObject from hw/cxl/cxl_cdat.h.
hw/cxl/cxl_device.h needs CXLComponentState fromhw/cxl/cxl_component.h.
--- include/hw/cxl/cxl_component.h | 1 + include/hw/cxl/cxl_device.h | 1 + 2 files changed, 2 insertions(+)
include/hw/cxl/cxl_component.h +1 -0
@@ -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"
include/hw/cxl/cxl_device.h +1 -0
@@ -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"
Signature · 1 line
2.37.3
Re: [PATCH 2/5] include/hw/cxl: Include hw/cxl/*.h where needed
Quoted 6 lines · On Fri, 9 Dec 2022 14:47:59 +0100 Markus Armbruster <[email protected]> wrote:
hw/cxl/cxl_component.hneeds CDATObject fromhw/cxl/cxl_cdat.h.
hw/cxl/cxl_device.hneeds CXLComponentState fromhw/cxl/cxl_component.h.Signed-off-by Markus Armbruster <[email protected]>
Thanks,
Quoted 29 lines
--- include/hw/cxl/cxl_component.h | 1 + include/hw/cxl/cxl_device.h | 1 + 2 files changed, 2 insertions(+)include/hw/cxl/cxl_component.h +1
-0@@ -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" include/hw/cxl/cxl_device.h +1
-0@@ -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"
PATCH 3/5 include/hw/pci: Clean up a few things checkpatch.pl would flag
In reply to Markus ArmbrusterFix a few style violations so that checkpatch.pl won't complain when I move this code.
--- include/hw/pci/pci.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
include/hw/pci/pci.h +10 -7
@@ -292,8 +292,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 */
@@ -307,10 +309,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 ];
@@ -954,7 +957,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), \ }
Signature · 1 line
2.37.3
Re: [PATCH 3/5] include/hw/pci: Clean up a few things checkpatch.pl would flag
Quoted 7 lines · Markus Armbruster
Fix a few style violations so that checkpatch.pl won't complain when I move this code.
Signed-off-by Markus Armbruster <[email protected]>--- include/hw/pci/pci.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
PATCH 4/5 include/hw/pci: Split pci_device.h off pci.h
In reply to Markus ArmbrusterPCIDeviceClass 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.
--- 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 | 355 ------------------------------ include/hw/pci/pci_bridge.h | 2 +- include/hw/pci/pci_device.h | 361 +++++++++++++++++++++++++++++++ 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/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 +- ui/util.c | 2 +- 91 files changed, 450 insertions(+), 438 deletions(-) create mode 100644 include/hw/pci/pci_device.h
hw/display/ati_int.h +1 -1
@@ -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"
hw/display/qxl.h +1 -2
@@ -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"
hw/ide/ahci_internal.h +1 -1
@@ -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
hw/net/vmxnet3_defs.h +1 -1
@@ -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 ;
hw/nvme/nvme.h +1 -1
@@ -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"
hw/rdma/vmw/pvrdma.h +1 -0
@@ -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"
hw/scsi/mptsas.h +1 -1
@@ -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 */
hw/usb/hcd-ehci.h +1 -1
@@ -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
hw/usb/hcd-uhci.h +1 -1
@@ -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 ;
hw/usb/hcd-xhci-pci.h +1 -0
@@ -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"
hw/vfio/pci.h +1 -1
@@ -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"
include/hw/acpi/piix4.h +1 -1
@@ -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"
include/hw/arm/allwinner-a10.h +1 -0
@@ -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"
include/hw/cxl/cxl_device.h +1 -1
@@ -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" /*
include/hw/ide/pci.h +1 -1
@@ -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
include/hw/misc/macio/macio.h +1 -1
@@ -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"
include/hw/pci-host/gpex.h +1 -1
@@ -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"
include/hw/pci-host/i440fx.h +1 -1
@@ -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"
include/hw/pci-host/q35.h +1 -1
@@ -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"
include/hw/pci-host/sabre.h +1 -1
@@ -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"
include/hw/pci/msi.h +1 -1
@@ -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;
include/hw/pci/pci.h +0 -355
391 lines not on this page · raw message
include/hw/pci/pci_bridge.h +1 -1
@@ -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"
include/hw/pci/pci_device.h new file +361 -0
361 lines not on this page · raw message
include/hw/pci/pcie_port.h +1 -0
@@ -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"
include/hw/pci/shpc.h +1 -1
@@ -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 {
include/hw/remote/iohub.h +1 -1
@@ -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"
include/hw/remote/proxy.h +1 -1
@@ -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"
include/hw/sd/sdhci.h +1 -1
@@ -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"
include/hw/southbridge/piix.h +1 -2
@@ -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
include/hw/xen/xen_common.h +1 -1
@@ -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;
hw/acpi/erst.c +1 -1
@@ -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"
hw/audio/ac97.c +1 -1
@@ -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"
hw/audio/es1370.c +1 -1
@@ -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"
hw/audio/via-ac97.c +1 -1
@@ -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) {
hw/char/serial-pci-multi.c +1 -1
@@ -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"
hw/char/serial-pci.c +1 -1
@@ -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"
hw/core/qdev-properties-system.c +1 -0
@@ -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,
hw/display/bochs-display.c +1 -1
@@ -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"
hw/display/cirrus_vga.c +1 -1
@@ -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"
hw/display/sm501.c +1 -1
@@ -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"
hw/display/vga-pci.c +1 -1
@@ -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"
hw/display/vmware_vga.c +1 -1
@@ -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"
hw/i386/xen/xen_pvdevice.c +1 -1
@@ -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"
hw/ipack/tpci200.c +1 -1
@@ -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"
hw/ipmi/pci_ipmi_bt.c +1 -1
@@ -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"
hw/ipmi/pci_ipmi_kcs.c +1 -1
@@ -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"
hw/isa/i82378.c +1 -1
@@ -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"
hw/mips/gt64xxx_pci.c +1 -1
@@ -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"
hw/misc/pci-testdev.c +1 -1
@@ -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"
hw/misc/pvpanic-pci.c +1 -1
@@ -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 )
hw/net/can/can_kvaser_pci.c +1 -1
@@ -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"
hw/net/can/can_mioe3680_pci.c +1 -1
@@ -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"
hw/net/can/can_pcm3680_pci.c +1 -1
@@ -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"
hw/net/can/ctucan_pci.c +1 -1
@@ -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"
hw/net/e1000.c +1 -1
@@ -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"
hw/net/e1000x_common.c +1 -1
@@ -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"
hw/net/eepro100.c +1 -1
@@ -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"
hw/net/ne2000-pci.c +1 -1
@@ -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"
hw/net/net_tx_pkt.c +1 -1
@@ -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 ,
hw/net/pcnet-pci.c +1 -1
@@ -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"
hw/net/rocker/rocker.c +1 -1
@@ -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"
hw/net/rocker/rocker_desc.c +1 -1
@@ -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"
hw/net/rtl8139.c +1 -1
@@ -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"
hw/net/sungem.c +1 -1
@@ -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"
hw/net/sunhme.c +1 -1
@@ -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"
hw/net/tulip.c +1 -1
@@ -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"
hw/net/virtio-net.c +1 -1
@@ -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"
hw/pci-host/bonito.c +1 -1
@@ -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"
hw/pci-host/dino.c +1 -1
@@ -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"
hw/pci-host/grackle.c +1 -1
@@ -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"
hw/pci-host/mv64361.c +1 -1
@@ -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"
hw/pci-host/ppce500.c +1 -1
@@ -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"
hw/pci-host/raven.c +1 -1
@@ -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"
hw/pci-host/sh_pci.c +1 -1
@@ -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"
hw/pci-host/uninorth.c +1 -1
@@ -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"
hw/pci-host/versatile.c +1 -1
@@ -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"
hw/pci/pcie_host.c +1 -1
@@ -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"
hw/pci/pcie_sriov.c +1 -1
@@ -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"
hw/pci/slotid_cap.c +1 -1
@@ -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"
hw/ppc/ppc440_pcix.c +1 -1
@@ -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"
hw/ppc/ppc4xx_pci.c +1 -1
@@ -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"
hw/ppc/spapr_pci_vfio.c +1 -0
@@ -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"
hw/rdma/rdma_utils.c +1 -1
@@ -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"
hw/s390x/s390-pci-inst.c +1 -0
@@ -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"
hw/scsi/esp-pci.c +1 -1
@@ -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"
hw/scsi/lsi53c895a.c +1 -1
@@ -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"
hw/smbios/smbios.c +1 -0
@@ -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 */
hw/usb/hcd-ohci-pci.c +1 -1
@@ -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"
hw/watchdog/wdt_i6300esb.c +1 -1
@@ -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"
ui/util.c +1 -1
@@ -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"
Signature · 1 line
2.37.3
Re: [PATCH 4/5] include/hw/pci: Split pci_device.h off pci.h
Quoted 7 lines · Markus Armbruster
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 inpci_bus.h, PCIBridge inpci_bridge.h, PCIHostBridgeClass and PCIHostState inpci_host.h, PCIExpressHost inpcie_host.h, and PCIERootPortClass, PCIEPort, and PCIESlot inpcie_port.h.
Quoted 6 lines
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 <[email protected]>
checkpatch is unhappy:
./scripts/checkpatch.pl /tmp/patch
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #707:
new file mode 100644
ERROR: spaces required around that '*' (ctx:WxV)
#997: FILE: include/hw/pci/pci_device.h:286:
+ uint##_bits##_t *val, \
^It's right - we need a MAINTAINERS entry.
Not sure how to fix the error - any idea?
Quoted 2,015 lines
--- 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 | 355 ------------------------------ include/hw/pci/pci_bridge.h | 2 +- include/hw/pci/pci_device.h | 361 +++++++++++++++++++++++++++++++ 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/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 +- ui/util.c | 2 +- 91 files changed, 450 insertions(+), 438 deletions(-) create mode 100644 include/hw/pci/pci_device.hhw/display/ati_int.h +1
-1@@ -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" hw/display/qxl.h +1
-2@@ -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" hw/ide/ahci_internal.h +1
-1@@ -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 32hw/net/vmxnet3_defs.h +1
-1@@ -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 ;hw/nvme/nvme.h +1
-1@@ -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" hw/rdma/vmw/pvrdma.h +1
-0@@ -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" hw/scsi/mptsas.h +1
-1@@ -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 */ hw/usb/hcd-ehci.h +1
-1@@ -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 hw/usb/hcd-uhci.h +1
-1@@ -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 ;hw/usb/hcd-xhci-pci.h +1
-0@@ -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" hw/vfio/pci.h +1
-1@@ -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" include/hw/acpi/piix4.h +1
-1@@ -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" include/hw/arm/allwinner-a10.h +1
-0@@ -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" include/hw/cxl/cxl_device.h +1
-1@@ -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" /* include/hw/ide/pci.h +1
-1@@ -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 0x01include/hw/misc/macio/macio.h +1
-1@@ -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" include/hw/pci-host/gpex.h +1
-1@@ -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" include/hw/pci-host/i440fx.h +1
-1@@ -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" include/hw/pci-host/q35.h +1
-1@@ -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" include/hw/pci-host/sabre.h +1
-1@@ -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" include/hw/pci/msi.h +1
-1@@ -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;include/hw/pci/pci.h +0
-355@@ -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,32 +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 */ - -/* -* pci-to-pci bridge or normal device. -* This doesn't mean pci host switch. -* When card bus bridge is supported, this would be enhanced. -*/ -bool is_bridge; - -/* rom bar */ -const char *romfile; -}; -typedef void (*PCIINTxRoutingNotifier )(PCIDevice *dev);typedef int (*MSIVectorUseNotifier )(PCIDevice *dev,unsigned int vector,MSIMessage msg);@@ -270,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,@@ -753,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 );@@ -778,189 +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) -{ -void *buf; - - buf =dma_memory_map (pci_get_address_space (dev), addr, plen, dir, -MEMTXATTRS_UNSPECIFIED ); -return buf; -} - -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);include/hw/pci/pci_bridge.h +1
-1@@ -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" include/hw/pci/pci_device.h new file +361
-0@@ -0,0 +1,361 @@ +#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 */ + +/* +* pci-to-pci bridge or normal device. +* This doesn't mean pci host switch. +* When card bus bridge is supported, this would be enhanced. +*/ +bool is_bridge; + +/* rom bar */ +const char *romfile; +}; + +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) +{ +void *buf; + + buf =dma_memory_map (pci_get_address_space (dev), addr, plen, dir, +MEMTXATTRS_UNSPECIFIED ); +return buf; +} + +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 include/hw/pci/pcie_port.h +1
-0@@ -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"include/hw/pci/shpc.h +1
-1@@ -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 {include/hw/remote/iohub.h +1
-1@@ -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" include/hw/remote/proxy.h +1
-1@@ -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" include/hw/sd/sdhci.h +1
-1@@ -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" include/hw/southbridge/piix.h +1
-2@@ -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 0x60include/hw/xen/xen_common.h +1
-1@@ -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;hw/acpi/erst.c +1
-1@@ -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" hw/audio/ac97.c +1
-1@@ -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" hw/audio/es1370.c +1
-1@@ -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" hw/audio/via-ac97.c +1
-1@@ -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) {hw/char/serial-pci-multi.c +1
-1@@ -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" hw/char/serial-pci.c +1
-1@@ -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" hw/core/qdev-properties-system.c +1
-0@@ -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,hw/display/bochs-display.c +1
-1@@ -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" hw/display/cirrus_vga.c +1
-1@@ -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" hw/display/sm501.c +1
-1@@ -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" hw/display/vga-pci.c +1
-1@@ -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" hw/display/vmware_vga.c +1
-1@@ -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" hw/i386/xen/xen_pvdevice.c +1
-1@@ -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" hw/ipack/tpci200.c +1
-1@@ -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" hw/ipmi/pci_ipmi_bt.c +1
-1@@ -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"hw/ipmi/pci_ipmi_kcs.c +1
-1@@ -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"hw/isa/i82378.c +1
-1@@ -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" hw/mips/gt64xxx_pci.c +1
-1@@ -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" hw/misc/pci-testdev.c +1
-1@@ -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" hw/misc/pvpanic-pci.c +1
-1@@ -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 )hw/net/can/can_kvaser_pci.c +1
-1@@ -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" hw/net/can/can_mioe3680_pci.c +1
-1@@ -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" hw/net/can/can_pcm3680_pci.c +1
-1@@ -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" hw/net/can/ctucan_pci.c +1
-1@@ -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" hw/net/e1000.c +1
-1@@ -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" hw/net/e1000x_common.c +1
-1@@ -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" hw/net/eepro100.c +1
-1@@ -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" hw/net/ne2000-pci.c +1
-1@@ -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" hw/net/net_tx_pkt.c +1
-1@@ -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 ,hw/net/pcnet-pci.c +1
-1@@ -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" hw/net/rocker/rocker.c +1
-1@@ -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" hw/net/rocker/rocker_desc.c +1
-1@@ -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" hw/net/rtl8139.c +1
-1@@ -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" hw/net/sungem.c +1
-1@@ -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" hw/net/sunhme.c +1
-1@@ -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" hw/net/tulip.c +1
-1@@ -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" hw/net/virtio-net.c +1
-1@@ -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" hw/pci-host/bonito.c +1
-1@@ -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" hw/pci-host/dino.c +1
-1@@ -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" hw/pci-host/grackle.c +1
-1@@ -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" hw/pci-host/mv64361.c +1
-1@@ -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" hw/pci-host/ppce500.c +1
-1@@ -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" hw/pci-host/raven.c +1
-1@@ -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" hw/pci-host/sh_pci.c +1
-1@@ -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" hw/pci-host/uninorth.c +1
-1@@ -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" hw/pci-host/versatile.c +1
-1@@ -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" hw/pci/pcie_host.c +1
-1@@ -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" hw/pci/pcie_sriov.c +1
-1@@ -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" hw/pci/slotid_cap.c +1
-1@@ -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" hw/ppc/ppc440_pcix.c +1
-1@@ -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" hw/ppc/ppc4xx_pci.c +1
-1@@ -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" hw/ppc/spapr_pci_vfio.c +1
-0@@ -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" hw/rdma/rdma_utils.c +1
-1@@ -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" hw/s390x/s390-pci-inst.c +1
-0@@ -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" hw/scsi/esp-pci.c +1
-1@@ -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" hw/scsi/lsi53c895a.c +1
-1@@ -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" hw/smbios/smbios.c +1
-0@@ -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 */ hw/usb/hcd-ohci-pci.c +1
-1@@ -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" hw/watchdog/wdt_i6300esb.c +1
-1@@ -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" ui/util.c +1
-1@@ -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" Signature · 1 line
2.37.3
Re: [PATCH 4/5] include/hw/pci: Split pci_device.h off pci.h
Quoted 16 lines · Michael S. Tsirkin
Quoted 7 lines · Markus Armbruster
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 inpci_bus.h, PCIBridge inpci_bridge.h, PCIHostBridgeClass and PCIHostState inpci_host.h, PCIExpressHost inpcie_host.h, and PCIERootPortClass, PCIEPort, and PCIESlot inpcie_port.h.Quoted 6 lines
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 <[email protected]>
Quoted 6 lines
checkpatch is unhappy:
./scripts/checkpatch.pl/tmp/patch
WARNING: added, moved or deleted file(s), doesMAINTAINERSneed updating? #707:
new file mode 100644
We're good:
$ scripts/get_maintainer.pl -f include/hw/pci/pci_device.h
"Michael S. Tsirkin" <[email protected]> (supporter:PCI)
Marcel Apfelbaum <[email protected]> (supporter:PCI)
[email protected] (open list:All patches CC here)But checkpatch is too simple-minded to see that.
Quoted 4 lines
ERROR: spaces required around that '*' (ctx:WxV)
#997: FILE:include/hw/pci/pci_device.h:286:+ uint##_bits##_t *val, \ ^
False positive.
#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); \
}The part checkpatch objects to is actually a parameter declaration of the form
TYPE *NAME
The use of spaces is fine. Not fine would be
TYPE * NAME
Having a macro expand into a function definition confuses checkpatch.
Quoted 2 lines
It's right - we need a
MAINTAINERSentry.
Not sure how to fix the error - any idea?
There is nothing to fix :)
PATCH 5/5 include/hw/pci: Include hw/pci/pci.h where needed
In reply to Markus Armbrusterhw/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.
--- include/hw/pci/pcie_sriov.h | 2 ++ 1 file changed, 2 insertions(+)
include/hw/pci/pcie_sriov.h +2 -0
@@ -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 */
Signature · 1 line
2.37.3
Re: [PATCH 5/5] include/hw/pci: Include hw/pci/pci.h where needed
Quoted 10 lines · Markus Armbruster
hw/pci/pcie_sriov.hneedsPCI_NUM_REGIONS. Without the previous commit, this would close an inclusion loop:hw/pci/pci.hused to includehw/pci/pcie.hfor PCIExpressDevice, which includespcie_sriov.hfor PCIESriovPF, which now includeshw/pci/pci.hforPCI_NUM_REGIONS.Signed-off-by Markus Armbruster <[email protected]>--- include/hw/pci/pcie_sriov.h | 2 ++ 1 file changed, 2 insertions(+)
[PATCH 6/5] include/hw/cxl: Break inclusion loop
In reply to Markus Armbrusterhw/cxl/cxl_pci.h and hw/cxl/cxl_cdat.h include each other. Neither header actually needs the other one. Drop both #include directives.
--- include/hw/cxl/cxl_cdat.h | 1 - include/hw/cxl/cxl_pci.h | 1 - 2 files changed, 2 deletions(-)
include/hw/cxl/cxl_cdat.h +0 -1
@@ -10,7 +10,6 @@#ifndef CXL_CDAT_H #define CXL_CDAT_H -#include "hw/cxl/cxl_pci.h" #include "hw/pci/pcie_doe.h" /*
include/hw/cxl/cxl_pci.h +0 -1
@@ -11,7 +11,6 @@#define CXL_PCI_H #include "qemu/compiler.h" -#include "hw/cxl/cxl_cdat.h" #define CXL_VENDOR_ID 0x1e98
Signature · 1 line
2.37.3
Re: [PATCH 6/5] include/hw/cxl: Break inclusion loop
Quoted 26 lines · Markus Armbruster
hw/cxl/cxl_pci.handhw/cxl/cxl_cdat.hinclude each other. Neither header actually needs the other one. Drop both #include directives.Signed-off-by Markus Armbruster <[email protected]>--- include/hw/cxl/cxl_cdat.h | 1 - include/hw/cxl/cxl_pci.h | 1 - 2 files changed, 2 deletions(-)include/hw/cxl/cxl_cdat.h +0
-1@@ -10,7 +10,6 @@#ifndef CXL_CDAT_H #define CXL_CDAT_H -#include "hw/cxl/cxl_pci.h" #include "hw/pci/pcie_doe.h" /* include/hw/cxl/cxl_pci.h +0
-0
include/hw/cxl/cxl_pci.h line 15
Quoted 6 lines
include/hw/cxl/cxl_pci.h +0
-1@@ -11,7 +11,6 @@#define CXL_PCI_H #include "qemu/compiler.h" -#include "hw/cxl/cxl_cdat.h" #define CXL_VENDOR_ID 0x1e98
Friday afternoon post with insufficient testing... Everything still builds fine, but cxl_component.h is no longer self-contained. I'll squash in the appended patch and revise the commit message.
include/hw/cxl/cxl_component.h +1 -0
@@ -19,6 +19,7 @@#include "qemu/range.h" #include "qemu/typedefs.h" #include "hw/cxl/cxl_cdat.h" +#include "hw/cxl/cxl_pci.h" #include "hw/register.h" #include "qapi/error.h"
Re: [PATCH 6/5] include/hw/cxl: Break inclusion loop
Quoted 19 lines · On Sat, 10 Dec 2022 08:09:06 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 17 lines · Markus Armbruster
hw/cxl/cxl_pci.handhw/cxl/cxl_cdat.hinclude each other. Neither header actually needs the other one. Drop both #include directives.Signed-off-by Markus Armbruster <[email protected]>--- include/hw/cxl/cxl_cdat.h | 1 - include/hw/cxl/cxl_pci.h | 1 - 2 files changed, 2 deletions(-)include/hw/cxl/cxl_cdat.h +0
-0@@ -10,7 +10,6 @@#ifndef CXL_CDAT_H #define CXL_CDAT_H
Quoted 2 lines
include/hw/cxl/cxl_cdat.h line 13
Quoted 2 lines
include/hw/cxl/cxl_cdat.h +0
-1-#include "hw/cxl/cxl_pci.h" #include "hw/pci/pcie_doe.h"
The include was to get to CXL_VENDOR_ID which is in hw/cxl/cxl_pci.h Can move that elsewhere perhaps, though I don't think we need to if we break the loop by dropping the other one.
Quoted 11 lines
include/hw/cxl/cxl_pci.h line 14
Quoted 11 lines
include/hw/cxl/cxl_cdat.h +0
-0/* include/hw/cxl/cxl_pci.h +0
-1@@ -11,7 +11,6 @@#define CXL_PCI_H #include "qemu/compiler.h" -#include "hw/cxl/cxl_cdat.h"
Guess that's a left over of some earlier refactoring. Good to get rid of this one.
Quoted 6 lines
include/hw/cxl/cxl_pci.h line 14
Quoted 2 lines
include/hw/cxl/cxl_pci.h +0
-0#define CXL_VENDOR_ID 0x1e98Friday afternoon post with insufficient testing... Everything still builds fine, but
cxl_component.his no longer self-contained. I'll squash in the appended patch and revise the commit message.
By staring at the code rather than any automation I'm failing to spot what it needs from cxl_pci.h. Can you add that info to the commit message?
Quoted 15 lines
include/hw/cxl/cxl_component.h +1
-0@@ -19,6 +19,7 @@#include "qemu/range.h" #include "qemu/typedefs.h" #include "hw/cxl/cxl_cdat.h" +#include "hw/cxl/cxl_pci.h" #include "hw/register.h" #include "qapi/error.h"
Re: [PATCH 6/5] include/hw/cxl: Break inclusion loop
Quoted 22 lines · Jonathan Cameron
Quoted 19 lines · On Sat, 10 Dec 2022 08:09:06 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 17 lines · Markus Armbruster
hw/cxl/cxl_pci.handhw/cxl/cxl_cdat.hinclude each other. Neither header actually needs the other one. Drop both #include directives.Signed-off-by Markus Armbruster <[email protected]>--- include/hw/cxl/cxl_cdat.h | 1 - include/hw/cxl/cxl_pci.h | 1 - 2 files changed, 2 deletions(-)include/hw/cxl/cxl_cdat.h +0
-0@@ -10,7 +10,6 @@#ifndef CXL_CDAT_H #define CXL_CDAT_H
Quoted 6 lines
Quoted 2 lines
include/hw/cxl/cxl_cdat.h line 13
Quoted 2 lines
include/hw/cxl/cxl_cdat.h +0
-1-#include "hw/cxl/cxl_pci.h" #include "hw/pci/pcie_doe.h" The include was to get to
CXL_VENDOR_IDwhich is inhw/cxl/cxl_pci.hCan move that elsewhere perhaps, though I don't think we need to if we break the loop by dropping the other one.
It's used only in a macro. If you use the macro, you need to include cxl_pci.h.
Would you like me to keep this #include?
Quoted 14 lines
Quoted 10 lines
include/hw/cxl/cxl_pci.h line 14
Quoted 10 lines
include/hw/cxl/cxl_cdat.h +0
-0/* include/hw/cxl/cxl_pci.h +0
-1@@ -11,7 +11,6 @@#define CXL_PCI_H #include "qemu/compiler.h" -#include "hw/cxl/cxl_cdat.h" Guess that's a left over of some earlier refactoring. Good to get rid of this one.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
#define
CXL_VENDOR_ID0x1e98Friday afternoon post with insufficient testing... Everything still builds fine, but
cxl_component.his no longer self-contained. I'll squash in the appended patch and revise the commit message.By staring at the code rather than any automation I'm failing to spot what it needs from
cxl_pci.h. Can you add that info to the commit message?
It's CXL20_MAX_DVSEC.
Quoted 13 lines
Quoted 13 lines
include/hw/cxl/cxl_component.h +1
-0@@ -19,6 +19,7 @@#include "qemu/range.h" #include "qemu/typedefs.h" #include "hw/cxl/cxl_cdat.h" +#include "hw/cxl/cxl_pci.h" #include "hw/register.h" #include "qapi/error.h"
Re: [PATCH 6/5] include/hw/cxl: Break inclusion loop
Quoted 31 lines · On Thu, 15 Dec 2022 08:34:10 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 22 lines · Jonathan Cameron
Quoted 19 lines · On Sat, 10 Dec 2022 08:09:06 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 17 lines · Markus Armbruster
hw/cxl/cxl_pci.handhw/cxl/cxl_cdat.hinclude each other. Neither header actually needs the other one. Drop both #include directives.Signed-off-by Markus Armbruster <[email protected]>--- include/hw/cxl/cxl_cdat.h | 1 - include/hw/cxl/cxl_pci.h | 1 - 2 files changed, 2 deletions(-)include/hw/cxl/cxl_cdat.h +0
-0@@ -10,7 +10,6 @@#ifndef CXL_CDAT_H #define CXL_CDAT_H Quoted 6 lines
Quoted 2 lines
include/hw/cxl/cxl_cdat.h line 13
Quoted 2 lines
include/hw/cxl/cxl_cdat.h +0
-1-#include "hw/cxl/cxl_pci.h" #include "hw/pci/pcie_doe.h" The include was to get to
CXL_VENDOR_IDwhich is inhw/cxl/cxl_pci.hCan move that elsewhere perhaps, though I don't think we need to if we break the loop by dropping the other one.
Quoted 4 lines
It's used only in a macro. If you use the macro, you need to include
cxl_pci.h.Would you like me to keep this #include?
yes. That would be my preference.
Quoted 17 lines
Quoted 17 lines
Quoted 11 lines
include/hw/cxl/cxl_pci.h line 14
Quoted 11 lines
include/hw/cxl/cxl_cdat.h +0
-0/* include/hw/cxl/cxl_pci.h +0
-1@@ -11,7 +11,6 @@#define CXL_PCI_H #include "qemu/compiler.h" -#include "hw/cxl/cxl_cdat.h" Guess that's a left over of some earlier refactoring. Good to get rid of this one.
Quoted 3 lines
Quoted 2 lines
include/hw/cxl/cxl_pci.h +0
-0#define CXL_VENDOR_ID 0x1e98
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Friday afternoon post with insufficient testing... Everything still builds fine, but
cxl_component.his no longer self-contained. I'll squash in the appended patch and revise the commit message.By staring at the code rather than any automation I'm failing to spot what it needs from
cxl_pci.h. Can you add that info to the commit message?It's
CXL20_MAX_DVSEC.
ah. Make sense. Thanks.
Quoted 15 lines
Quoted 14 lines
Quoted 14 lines
include/hw/cxl/cxl_component.h +1
-0@@ -19,6 +19,7 @@#include "qemu/range.h" #include "qemu/typedefs.h" #include "hw/cxl/cxl_cdat.h" +#include "hw/cxl/cxl_pci.h" #include "hw/register.h" #include "qapi/error.h"
Quoted 6 lines · Markus Armbruster
Back in 2016, we discussed[1] rules for headers, and these were generally liked:
1. Have a carefully curated header that's included everywhere first. We got that already thanks to Peter:
osdep.h.
Quoted 6 lines
2. 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, put those intoqemu/typedefs.hinstead of including the header.3. Cyclic inclusion is forbidden.
Looks like this breaks fuzzer build:
https://gitlab.com/mstredhat/qemu/-/jobs/3506121308
Quoted 139 lines
After this series,
include/hw/pciandinclude/hw/cxlconform to these rules.It is based on
[PATCH 0/3] block: Clean up includes
[PATCH 0/4] coroutine: Clean up includes[1] Message-ID: <[email protected]>
https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.htmlBased-on: <[email protected]>
Markus Armbruster (5):
include/hw/pci: Clean up superfluous inclusion of pci*/*.h cxl/*.hinclude/hw/cxl: Include hw/cxl/*.h where neededinclude/hw/pci: Clean up a few things checkpatch.pl would flaginclude/hw/pci: Splitpci_device.hoffpci.hinclude/hw/pci: Includehw/pci/pci.hwhere neededhw/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/xen/xen_pt.h | 1 - include/hw/acpi/piix4.h | 2 +- include/hw/arm/allwinner-a10.h | 1 + include/hw/cxl/cxl.h | 1 - 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_pci.h | 2 - include/hw/i386/ich9.h | 4 - include/hw/i386/x86-iommu.h | 1 - include/hw/ide/pci.h | 2 +- include/hw/isa/vt82c686.h | 1 - include/hw/misc/macio/macio.h | 2 +- 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 | 352 ----------------------------- include/hw/pci/pci_bridge.h | 2 +- include/hw/pci/pci_device.h | 361 ++++++++++++++++++++++++++++++ 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/remote/iohub.h | 2 +- include/hw/remote/proxy.h | 2 +- include/hw/sd/sdhci.h | 2 +- include/hw/southbridge/piix.h | 3 +- include/hw/virtio/virtio-scsi.h | 1 - include/hw/xen/xen_common.h | 2 +- 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/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/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/virtio-net.c | 2 +- hw/pci-bridge/i82801b11.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/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/virtio-scsi.c | 1 + hw/smbios/smbios.c | 1 + hw/usb/hcd-ohci-pci.c | 2 +- hw/watchdog/wdt_i6300esb.c | 2 +- ui/util.c | 2 +- 114 files changed, 461 insertions(+), 462 deletions(-) create mode 100644 include/hw/pci/pci_device.hSignature · 1 line
2.37.3
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Markus Armbruster
Back in 2016, we discussed[1] rules for headers, and these were generally liked:
1. Have a carefully curated header that's included everywhere first. We got that already thanks to Peter:
osdep.h.2. 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, put those intoqemu/typedefs.hinstead of including the header.
Quoted 5 lines
Quoted 1 line
3. Cyclic inclusion is forbidden.
Looks like this breaks fuzzer build:
Will be fixed in v2, thanks!