virtio, vhost, pci: fixes, features
The following changes since commit a9e404600a9bd1e6a26431fc89e5069092e67f14:
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170124' into staging (2017-01-24 17:26:26 +0000)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to b562d945fc840131d290d4bf5af8d6cc3bb98a2b:
vhost-user: delete chardev on cleanup (2017-01-24 21:49:25 +0200)
----------------------------------------------------------------
virtio, vhost, pci: fixes, features
generic pci root port support
fixes and cleanups all over the place
----------------------------------------------------------------
Cao jin (3):
msix: Follow CODING_STYLE
hcd-xhci: check & correct param before using it
pci: Convert msix_init() to Error and fix callers
Haozhong Zhang (1):
hw/i386: check if nvdimm is enabled before plugging
Jason Wang (1):
intel_iommu: fix and simplify size calculation in process_device_iotlb_desc()
Marc-André Lureau (1):
vhost-user: delete chardev on cleanup
Marcel Apfelbaum (3):
hw/pcie: Introduce a base class for PCI Express Root Ports hw/ioh3420: derive from PCI Express Root Port base class hw/pcie: Introduce Generic PCI Express Root Port
Michael S. Tsirkin (6):
compiler: drop ; after BUILD_BUG_ON
compiler: rework BUG_ON using a struct
compiler: expression version of QEMU_BUILD_BUG_ON
ARRAY_SIZE: check that argument is an array
pci: mark ROMs read-only
vhost: skip ROM sections
Paolo Bonzini (1):
virtio: make virtio_should_notify static
default-configs/arm-softmmu.mak | 1 + default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + include/hw/pci/msix.h | 5 +- include/hw/pci/pci.h | 1 + include/hw/pci/pcie_port.h | 19 +++++ include/hw/virtio/virtio.h | 1 - include/qemu/compiler.h | 11 ++- include/qemu/osdep.h | 9 +- hw/block/nvme.c | 2 +- hw/i386/intel_iommu.c | 10 ++- hw/i386/pc.c | 5 ++ hw/misc/ivshmem.c | 8 +- hw/net/e1000e.c | 2 +- hw/net/rocker/rocker.c | 4 +- hw/net/vmxnet3.c | 2 +- hw/pci-bridge/gen_pcie_root_port.c | 87 +++++++++++++++++++ hw/pci-bridge/ioh3420.c | 121 ++++---------------------- hw/pci-bridge/pcie_root_port.c | 171 +++++++++++++++++++++++++++++++++++++ hw/pci/msix.c | 44 ++++++++-- hw/pci/pci.c | 2 +- hw/scsi/megasas.c | 4 +- hw/usb/hcd-xhci.c | 41 +++++---- hw/vfio/pci.c | 8 +- hw/virtio/vhost.c | 3 +- hw/virtio/virtio-pci.c | 4 +- hw/virtio/virtio.c | 2 +- net/vhost-user.c | 3 + hw/pci-bridge/Makefile.objs | 1 + 29 files changed, 416 insertions(+), 157 deletions(-) create mode 100644 hw/pci-bridge/gen_pcie_root_port.c create mode 100644 hw/pci-bridge/pcie_root_port.c
[Qemu-devel] [PULL 01/16] compiler: drop ; after BUILD_BUG_ON
All users include the trailing ; anyway, let's require that - it seems cleaner.
--- include/qemu/compiler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/qemu/compiler.h +2 -1
@@ -86,7 +86,8 @@#define type_check (t1,t2) ((t1*)0 - (t2*)0)#define QEMU_BUILD_BUG_ON (x) \ - typedef char glue(qemu_build_bug_on__,__LINE__)[(x)?-1:1] __attribute__((unused)); + typedef char glue(qemu_build_bug_on__, __LINE__)[(x) ? -1 : 1] \ + __attribute__((unused))#if defined __GNUC__# if !QEMU_GNUC_PREREQ (4 ,4 )
Signature · 1 line
MST
[Qemu-devel] [PULL 02/16] compiler: rework BUG_ON using a struct
In reply to Michael S. TsirkinThere are theoretical concerns that some compilers might not trigger build failures on attempts to define an array of size (x ? -1 : 1) where x is a variable and make it a variable sized array instead. Let rewrite using a struct with a negative bit field size instead as there are no dynamic bit field sizes. This is similar to what Linux does.
--- include/qemu/compiler.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
include/qemu/compiler.h +6 -3
@@ -85,9 +85,12 @@#define typeof_field (type, field) typeof(((type *)0)->field)#define type_check (t1,t2) ((t1*)0 - (t2*)0) -#define QEMU_BUILD_BUG_ON (x) \ - typedef char glue(qemu_build_bug_on__, __LINE__)[(x) ? -1 : 1] \ - __attribute__((unused)) +#define QEMU_BUILD_BUG_ON_STRUCT (x) \ + struct { \ + int:(x) ? -1 : 1; \ + } +#define QEMU_BUILD_BUG_ON (x) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \ + glue(qemu_build_bug_on__, __LINE__) __attribute__((unused))#if defined __GNUC__# if !QEMU_GNUC_PREREQ (4 ,4 )
Signature · 1 line
MST
[Qemu-devel] [PULL 03/16] compiler: expression version of QEMU_BUILD_BUG_ON
In reply to Michael S. TsirkinQEMU_BUILD_BUG_ON uses a typedef in order to be safe to use outside functions, but sometimes it's useful to have a version that can be used within an expression. Following what Linux does, introduce QEMU_BUILD_BUG_ON_ZERO that return zero after checking condition at build time.
--- include/qemu/compiler.h | 3 +++ 1 file changed, 3 insertions(+)
include/qemu/compiler.h +3 -0
@@ -92,6 +92,9 @@#define QEMU_BUILD_BUG_ON (x) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \ glue(qemu_build_bug_on__, __LINE__) __attribute__((unused)) +#define QEMU_BUILD_BUG_ON_ZERO (x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ + sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) +#if defined __GNUC__# if !QEMU_GNUC_PREREQ (4 ,4 )/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */
Signature · 1 line
MST
[Qemu-devel] [PULL 04/16] ARRAY_SIZE: check that argument is an array
In reply to Michael S. TsirkinIt's a familiar pattern: some code uses ARRAY_SIZE, then refactoring changes the argument from an array to a pointer to a dynamically allocated buffer. Code keeps compiling but any ARRAY_SIZE calls now return the size of the pointer divided by element size.
Let's add build time checks to ARRAY_SIZE before we allow more of these in the code-base.
--- include/qemu/osdep.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/qemu/osdep.h +8 -1
@@ -198,8 +198,15 @@ extern int daemon(int, int);#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d))#endif +/* +* &(x)[0] is always a pointer - if it's same type as x then the argument is a +* pointer, not an array. +*/ +#define QEMU_IS_ARRAY (x) (!__builtin_types_compatible_p(typeof(x), \ + typeof(&(x)[0])))#ifndef ARRAY_SIZE -#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0])) +#define ARRAY_SIZE (x) ((sizeof(x) / sizeof((x)[0])) + \ + QEMU_BUILD_BUG_ON_ZERO(!QEMU_IS_ARRAY(x)))#endif int qemu_daemon (int nochdir,int noclose);
Signature · 1 line
MST
[Qemu-devel] [PULL 05/16] pci: mark ROMs read-only
In reply to Michael S. TsirkinLooks like we didn't mark PCI ROMs as RO allowing mischief such as guests writing there. Further, e.g. vhost gets confused trying to allocate enough space to log writes there. Fix it up.
--- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
@@ -2192,7 +2192,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,snprintf (name,sizeof (name),"%s.rom" ,object_get_typename (OBJECT (pdev))); } pdev->has_rom = true; -memory_region_init_ram (&pdev->rom,OBJECT (pdev), name, size, &error_fatal); +memory_region_init_rom (&pdev->rom,OBJECT (pdev), name, size, &error_fatal);vmstate_register_ram (&pdev->rom, &pdev->qdev); ptr =memory_region_get_ram_ptr (&pdev->rom);load_image (path, ptr);
Signature · 1 line
MST
[Qemu-devel] [PULL 06/16] intel_iommu: fix and simplify size calculation in process_device_iotlb_desc()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
We don't use 1ULL which is wrong during size calculation. Fix it, and while at it, switch to use cto64() and adds a comments to make it simpler and easier to be understood.
--- hw/i386/intel_iommu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
hw/i386/intel_iommu.c +9 -1
@@ -1485,8 +1485,16 @@ static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, goto done; } +/* According to ATS spec table 2.4: +* S = 0, bits 15:12 = xxxx range size: 4K +* S = 1, bits 15:12 = xxx0 range size: 8K +* S = 1, bits 15:12 = xx01 range size: 16K +* S = 1, bits 15:12 = x011 range size: 32K +* S = 1, bits 15:12 = 0111 range size: 64K +* ... +*/ if (size) { - sz =1 << (ctz64 (~(addr | (VTD_PAGE_MASK_4K -1 ))) +1 ); + sz = (VTD_PAGE_SIZE *2 ) <<cto64 (addr >>VTD_PAGE_SHIFT ); addr &= ~(sz -1 ); }else { sz =VTD_PAGE_SIZE ;
Signature · 1 line
MST
[Qemu-devel] [PULL 07/16] hw/pcie: Introduce a base class for PCI Express Root Ports
In reply to Michael S. TsirkinFrom: Marcel Apfelbaum <[email protected]>
The 'base' PCI Express Root Port includes
the common code to be re-used for all
Root Ports implementations. Most of the code
was taken from the current implementation
of Intel's IOH 3420 Root Port.
--- default-configs/arm-softmmu.mak | 1 + default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + include/hw/pci/pcie_port.h | 19 +++++ hw/pci-bridge/pcie_root_port.c | 171 +++++++++++++++++++++++++++++++++++++ hw/pci-bridge/Makefile.objs | 1 + 6 files changed, 194 insertions(+) create mode 100644 hw/pci-bridge/pcie_root_port.c
default-configs/arm-softmmu.mak +1 -0
@@ -108,6 +108,7 @@ CONFIG_FSL_IMX25=y CONFIG_IMX_I2C=y +CONFIG_PCIE_PORT=y CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y
default-configs/i386-softmmu.mak +1 -0
@@ -51,6 +51,7 @@ CONFIG_PVPANIC=y CONFIG_MEM_HOTPLUG=y CONFIG_NVDIMM=y CONFIG_ACPI_NVDIMM=y +CONFIG_PCIE_PORT=y CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y
default-configs/x86_64-softmmu.mak +1 -0
@@ -51,6 +51,7 @@ CONFIG_PVPANIC=y CONFIG_MEM_HOTPLUG=y CONFIG_NVDIMM=y CONFIG_ACPI_NVDIMM=y +CONFIG_PCIE_PORT=y CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y
include/hw/pci/pcie_port.h +19 -0
@@ -57,4 +57,23 @@ PCIESlot *pcie_chassis_find_slot(uint8_t chassis, uint16_t slot);int pcie_chassis_add_slot (struct PCIESlot *slot);void pcie_chassis_del_slot (PCIESlot *s); +#define TYPE_PCIE_ROOT_PORT "pcie-root-port-base" +#define PCIE_ROOT_PORT_CLASS (klass) \ + OBJECT_CLASS_CHECK(PCIERootPortClass, (klass), TYPE_PCIE_ROOT_PORT) +#define PCIE_ROOT_PORT_GET_CLASS (obj) \ + OBJECT_GET_CLASS(PCIERootPortClass, (obj), TYPE_PCIE_ROOT_PORT) + +typedef struct PCIERootPortClass { +PCIDeviceClass parent_class; + +uint8_t (*aer_vector)(const PCIDevice *dev); +int (*interrupts_init)(PCIDevice *dev,Error **errp); +void (*interrupts_uninit)(PCIDevice *dev); + +int exp_offset; +int aer_offset; +int ssvid_offset; +int ssid; +}PCIERootPortClass ; +#endif /* QEMU_PCIE_PORT_H */
hw/pci-bridge/pcie_root_port.c new file +171 -0
171 lines not on this page · raw message
hw/pci-bridge/Makefile.objs +1 -0
@@ -1,5 +1,6 @@ common-obj-y += pci_bridge_dev.o common-obj-y += pci_expander_bridge.o +common-obj-$(CONFIG_PCIE_PORT) += pcie_root_port.o common-obj-$(CONFIG_XIO3130) += xio3130_upstream.o xio3130_downstream.o common-obj-$(CONFIG_IOH3420) += ioh3420.o common-obj-$(CONFIG_I82801B11) += i82801b11.o
Signature · 1 line
MST
[Qemu-devel] [PULL 08/16] hw/ioh3420: derive from PCI Express Root Port base class
In reply to Michael S. TsirkinFrom: Marcel Apfelbaum <[email protected]>
Preserve only Intel specific details.
--- hw/pci-bridge/ioh3420.c | 121 ++++++------------------------------------------ 1 file changed, 15 insertions(+), 106 deletions(-)
hw/pci-bridge/ioh3420.c +15 -106
@@ -61,119 +61,28 @@ static uint8_t ioh3420_aer_vector(const PCIDevice *d)return 0 ; } -static void ioh3420_aer_vector_update (PCIDevice *d) +static int ioh3420_interrupts_init (PCIDevice *d,Error **errp) { -pcie_aer_root_set_vector (d,ioh3420_aer_vector (d)); -} - -static void ioh3420_write_config (PCIDevice *d, -uint32_t address,uint32_t val,int len) -{ -uint32_t root_cmd = -pci_get_long (d->config + d->exp.aer_cap +PCI_ERR_ROOT_COMMAND ); - -pci_bridge_write_config (d, address, val, len); -ioh3420_aer_vector_update (d); -pcie_cap_slot_write_config (d, address, val, len); -pcie_aer_write_config (d, address, val, len); -pcie_aer_root_write_config (d, address, val, len, root_cmd); -} - -static void ioh3420_reset (DeviceState *qdev) -{ -PCIDevice *d =PCI_DEVICE (qdev); - -ioh3420_aer_vector_update (d); -pcie_cap_root_reset (d); -pcie_cap_deverr_reset (d); -pcie_cap_slot_reset (d); -pcie_cap_arifwd_reset (d); -pcie_aer_root_reset (d); -pci_bridge_reset (qdev); -pci_bridge_disable_base_limit (d); -} - -static int ioh3420_initfn (PCIDevice *d) -{ -PCIEPort *p =PCIE_PORT (d); -PCIESlot *s =PCIE_SLOT (d);int rc; -Error *err =NULL ; - -pci_config_set_interrupt_pin (d->config,1 ); -pci_bridge_initfn (d,TYPE_PCIE_BUS ); -pcie_port_init_reg (d); - - rc =pci_bridge_ssvid_init (d,IOH_EP_SSVID_OFFSET , -IOH_EP_SSVID_SVID ,IOH_EP_SSVID_SSID ); -if (rc <0 ) { - goto err_bridge; - } +Error *local_err =NULL ; rc =msi_init (d,IOH_EP_MSI_OFFSET ,IOH_EP_MSI_NR_VECTOR ,IOH_EP_MSI_SUPPORTED_FLAGS &PCI_MSI_FLAGS_64BIT , -IOH_EP_MSI_SUPPORTED_FLAGS &PCI_MSI_FLAGS_MASKBIT , &err); +IOH_EP_MSI_SUPPORTED_FLAGS &PCI_MSI_FLAGS_MASKBIT , + &local_err);if (rc <0 ) {assert (rc == -ENOTSUP ); -error_report_err (err); - goto err_bridge; +error_propagate (errp, local_err); } - rc =pcie_cap_init (d,IOH_EP_EXP_OFFSET ,PCI_EXP_TYPE_ROOT_PORT , p->port); -if (rc <0 ) { - goto err_msi; - } - -pcie_cap_arifwd_init (d); -pcie_cap_deverr_init (d); -pcie_cap_slot_init (d, s->slot); -pcie_cap_root_init (d); - -pcie_chassis_create (s->chassis); - rc =pcie_chassis_add_slot (s); -if (rc <0 ) { - goto err_pcie_cap; - } - - rc =pcie_aer_init (d,PCI_ERR_VER ,IOH_EP_AER_OFFSET , -PCI_ERR_SIZEOF , &err); -if (rc <0 ) { -error_report_err (err); - goto err; - } -pcie_aer_root_init (d); -ioh3420_aer_vector_update (d); - -return 0 ; - -err: -pcie_chassis_del_slot (s); -err_pcie_cap: -pcie_cap_exit (d); -err_msi: -msi_uninit (d); -err_bridge: -pci_bridge_exitfn (d);return rc; } -static void ioh3420_exitfn (PCIDevice *d) +static void ioh3420_interrupts_uninit (PCIDevice *d) { -PCIESlot *s =PCIE_SLOT (d); - -pcie_aer_exit (d); -pcie_chassis_del_slot (s); -pcie_cap_exit (d);msi_uninit (d); -pci_bridge_exitfn (d); } -static Property ioh3420_props[] = { -DEFINE_PROP_BIT (COMPAT_PROP_PCP , PCIDevice, cap_present, -QEMU_PCIE_SLTCAP_PCP_BITNR , true), -DEFINE_PROP_END_OF_LIST () -}; -static const VMStateDescription vmstate_ioh3420 = { .name ="ioh-3240-express-root-port" , .version_id =1 ,
@@ -191,25 +100,25 @@ static void ioh3420_class_init(ObjectClass *klass, void *data) {DeviceClass *dc =DEVICE_CLASS (klass);PCIDeviceClass *k =PCI_DEVICE_CLASS (klass); +PCIERootPortClass *rpc =PCIE_ROOT_PORT_CLASS (klass); - k->is_express =1 ; - k->is_bridge =1 ; - k->config_write = ioh3420_write_config; - k->init = ioh3420_initfn; - k->exit = ioh3420_exitfn; k->vendor_id =PCI_VENDOR_ID_INTEL ; k->device_id =PCI_DEVICE_ID_IOH_EPORT ; k->revision =PCI_DEVICE_ID_IOH_REV ; -set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); dc->desc ="Intel IOH device id 3420 PCIE Root Port" ; - dc->reset = ioh3420_reset; dc->vmsd = &vmstate_ioh3420; - dc->props = ioh3420_props; + rpc->aer_vector = ioh3420_aer_vector; + rpc->interrupts_init = ioh3420_interrupts_init; + rpc->interrupts_uninit = ioh3420_interrupts_uninit; + rpc->exp_offset =IOH_EP_EXP_OFFSET ; + rpc->aer_offset =IOH_EP_AER_OFFSET ; + rpc->ssvid_offset =IOH_EP_SSVID_OFFSET ; + rpc->ssid =IOH_EP_SSVID_SSID ; }static const TypeInfo ioh3420_info = { .name ="ioh3420" , - .parent =TYPE_PCIE_SLOT , + .parent =TYPE_PCIE_ROOT_PORT , .class_init = ioh3420_class_init, };
Signature · 1 line
MST
[Qemu-devel] [PULL 09/16] hw/pcie: Introduce Generic PCI Express Root Port
In reply to Michael S. TsirkinFrom: Marcel Apfelbaum <[email protected]>
The Generic Root Port behaves almost the same as the Intel's IOH device with id 3420, without having Intel specific attributes.
The device has two purposes:
(1) Can be used on both X86 and ARM machines.
(2) It will allow us to tweak the behaviour
(e.g add vendor-specific PCI capabilities)
- something that obviously cannot be done
on a known device.
--- include/hw/pci/pci.h | 1 + hw/pci-bridge/gen_pcie_root_port.c | 88 ++++++++++++++++++++++++++++++++++++++ hw/pci-bridge/Makefile.objs | 2 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 hw/pci-bridge/gen_pcie_root_port.c
include/hw/pci/pci.h +1 -0
@@ -96,6 +96,7 @@#define PCI_DEVICE_ID_REDHAT_PXB 0x0009#define PCI_DEVICE_ID_REDHAT_BRIDGE_SEAT 0x000a#define PCI_DEVICE_ID_REDHAT_PXB_PCIE 0x000b +#define PCI_DEVICE_ID_REDHAT_PCIE_RP 0x000c#define PCI_DEVICE_ID_REDHAT_QXL 0x0100#define FMT_PCIBUS PRIx64
hw/pci-bridge/gen_pcie_root_port.c new file +88 -0
88 lines not on this page · raw message
hw/pci-bridge/Makefile.objs +1 -1
@@ -1,6 +1,6 @@ common-obj-y += pci_bridge_dev.o common-obj-y += pci_expander_bridge.o -common-obj-$(CONFIG_PCIE_PORT) += pcie_root_port.o +common-obj-$(CONFIG_PCIE_PORT) += pcie_root_port.o gen_pcie_root_port.o common-obj-$(CONFIG_XIO3130) += xio3130_upstream.o xio3130_downstream.o common-obj-$(CONFIG_IOH3420) += ioh3420.o common-obj-$(CONFIG_I82801B11) += i82801b11.o
Signature · 1 line
MST
[Qemu-devel] [PULL 10/16] hw/i386: check if nvdimm is enabled before plugging
In reply to Michael S. TsirkinFrom: Haozhong Zhang <[email protected]>
The missing of 'nvdimm' in the machine type option '-M' means NVDIMM is disabled. QEMU should refuse to plug any NVDIMM device in this case and report the misconfiguration.
The behavior of NVDIMM on unsupported platform (HW/FW) is vendor specific. For some vendors, it's undefined and the platform may do anything. Thus, I think QEMU is free to choose the implementation. Aborting QEMU (i.e. refusing to boot) is the easiest one.
Message-Id: [email protected]
Message-Id: [email protected]
--- hw/i386/pc.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/i386/pc.c +5 -0
@@ -1708,6 +1708,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev, }if (object_dynamic_cast (OBJECT (dev),TYPE_NVDIMM )) { +if (!pcms->acpi_nvdimm_state.is_enabled) { +error_setg (&local_err, +"nvdimm is not enabled: missing 'nvdimm' in '-M'" ); + goto out; + }nvdimm_plug (&pcms->acpi_nvdimm_state); }
Signature · 1 line
MST
[Qemu-devel] [PULL 11/16] msix: Follow CODING_STYLE
In reply to Michael S. TsirkinFrom: Cao jin <[email protected]>
--- hw/pci/msix.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/pci/msix.c +6 -2
@@ -447,8 +447,10 @@ void msix_notify(PCIDevice *dev, unsigned vector) {MSIMessage msg; -if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector]) +if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector]) {return ; + } +if (msix_is_masked (dev, vector)) {msix_set_pending (dev, vector);return ;
@@ -483,8 +485,10 @@ void msix_reset(PCIDevice *dev)/* Mark vector as used. */ int msix_vector_use (PCIDevice *dev,unsigned vector) { -if (vector >= dev->msix_entries_nr) +if (vector >= dev->msix_entries_nr) {return -EINVAL ; + } + dev->msix_entry_used[vector]++;return 0 ; }
Signature · 1 line
MST
[Qemu-devel] [PULL 12/16] hcd-xhci: check & correct param before using it
In reply to Michael S. TsirkinFrom: Cao jin <[email protected]>
usb_xhci_realize() corrects invalid values of property "intrs" automatically, but the uncorrected value is passed to msi_init(), which chokes on invalid values. Delay that until after the correction.
Resources allocated by usb_xhci_init() are leaked when msi_init() fails. Fix by calling it after msi_init().
--- hw/usb/hcd-xhci.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-)
hw/usb/hcd-xhci.c +18 -19
@@ -3627,25 +3627,6 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp) dev->config[PCI_CACHE_LINE_SIZE ] =0x10 ; dev->config[0x60 ] =0x30 ;/* release number */ -usb_xhci_init (xhci); - -if (xhci->msi !=ON_OFF_AUTO_OFF ) { - ret =msi_init (dev,0x70 , xhci->numintrs, true, false, &err); -/* Any error other than -ENOTSUP(board's MSI support is broken) -* is a programming error */ -assert (!ret || ret == -ENOTSUP ); -if (ret && xhci->msi ==ON_OFF_AUTO_ON ) { -/* Can't satisfy user's explicit msi=on request, fail */ -error_append_hint (&err,"You have to use msi=auto (default) or " -"msi=off with this machine type.\n" ); -error_propagate (errp, err); -return ; - } -assert (!err || xhci->msi ==ON_OFF_AUTO_AUTO ); -/* With msi=auto, we fall back to MSI off silently */ -error_free (err); - } -if (xhci->numintrs >MAXINTRS ) { xhci->numintrs =MAXINTRS ; }
@@ -3667,6 +3648,24 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp) xhci->max_pstreams_mask =0 ; } +if (xhci->msi !=ON_OFF_AUTO_OFF ) { + ret =msi_init (dev,0x70 , xhci->numintrs, true, false, &err); +/* Any error other than -ENOTSUP(board's MSI support is broken) +* is a programming error */ +assert (!ret || ret == -ENOTSUP ); +if (ret && xhci->msi ==ON_OFF_AUTO_ON ) { +/* Can't satisfy user's explicit msi=on request, fail */ +error_append_hint (&err,"You have to use msi=auto (default) or " +"msi=off with this machine type.\n" ); +error_propagate (errp, err); +return ; + } +assert (!err || xhci->msi ==ON_OFF_AUTO_AUTO ); +/* With msi=auto, we fall back to MSI off silently */ +error_free (err); + } + +usb_xhci_init (xhci); xhci->mfwrap_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , xhci_mfwrap_timer, xhci);memory_region_init (&xhci->mem,OBJECT (xhci),"xhci" ,LEN_REGS );
Signature · 1 line
MST
[Qemu-devel] [PULL 14/16] virtio: make virtio_should_notify static
In reply to Michael S. TsirkinFrom: Paolo Bonzini <[email protected]>
--- include/hw/virtio/virtio.h | 1 - hw/virtio/virtio.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
include/hw/virtio/virtio.h +0 -1
@@ -182,7 +182,6 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,unsigned int *out_bytes, unsigned max_in_bytes, unsigned max_out_bytes); -bool virtio_should_notify (VirtIODevice *vdev,VirtQueue *vq);void virtio_notify_irqfd (VirtIODevice *vdev,VirtQueue *vq);void virtio_notify (VirtIODevice *vdev,VirtQueue *vq);
hw/virtio/virtio.c +1 -1
@@ -1383,7 +1383,7 @@ static void virtio_set_isr(VirtIODevice *vdev, int value) } } -bool virtio_should_notify (VirtIODevice *vdev,VirtQueue *vq) +static bool virtio_should_notify (VirtIODevice *vdev,VirtQueue *vq) {uint16_t old, new;bool v;
Signature · 1 line
MST
[Qemu-devel] [PULL 15/16] vhost: skip ROM sections
In reply to Michael S. Tsirkinvhost does not support RO protections on memory at the moment - adding ROMs would mean that e.g. a buggy guest might change them in-memory - a condition from which guest reset does not recover. Not nice.
We also definitely don't want to try logging writes into ROMs - in particular guests set very high addresses for ROM BARs so logging these writes would waste a lot of memory.
Maybe ROMs could be supported with the iotlb variant - not sure, but there seems to be no good reason for virtio to try to do DMA from ROM. So let's just skip ROM memory.
--- hw/virtio/vhost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/vhost.c +2 -1
@@ -612,7 +612,8 @@ static void vhost_set_memory(MemoryListener *listener,static bool vhost_section (MemoryRegionSection *section) { -return memory_region_is_ram (section->mr); +return memory_region_is_ram (section->mr) && + !memory_region_is_rom (section->mr); }static void vhost_begin (MemoryListener *listener)
Signature · 1 line
MST
[Qemu-devel] [PULL 13/16] pci: Convert msix_init() to Error and fix callers
In reply to Michael S. TsirkinFrom: Cao jin <[email protected]>
msix_init() reports errors with error_report(), which is wrong when it's used in realize(). The same issue was fixed for msi_init() in commit 1108b2f. In order to make the API change as small as possible, leave the return value check to later patch.
For some devices(like e1000e, vmxnet3, nvme) who won't fail because of msix_init's failure, suppress the error report by passing NULL error object.
Bonus: add comment for msix_init.
--- include/hw/pci/msix.h | 5 +++-- hw/block/nvme.c | 2 +- hw/misc/ivshmem.c | 8 ++++---- hw/net/e1000e.c | 2 +- hw/net/rocker/rocker.c | 4 +++- hw/net/vmxnet3.c | 2 +- hw/pci-bridge/gen_pcie_root_port.c | 3 +-- hw/pci/msix.c | 36 +++++++++++++++++++++++++++++++----- hw/scsi/megasas.c | 4 +++- hw/usb/hcd-xhci.c | 4 ++-- hw/vfio/pci.c | 8 ++++++-- hw/virtio/virtio-pci.c | 4 ++-- 12 files changed, 58 insertions(+), 24 deletions(-)
include/hw/pci/msix.h +3 -2
@@ -9,9 +9,10 @@ MSIMessage msix_get_message(PCIDevice *dev, unsigned int vector);int msix_init (PCIDevice *dev,unsigned short nentries,MemoryRegion *table_bar,uint8_t table_bar_nr,unsigned table_offset,MemoryRegion *pba_bar, -uint8_t pba_bar_nr,unsigned pba_offset,uint8_t cap_pos); +uint8_t pba_bar_nr,unsigned pba_offset,uint8_t cap_pos, +Error **errp);int msix_init_exclusive_bar (PCIDevice *dev,unsigned short nentries, -uint8_t bar_nr); +uint8_t bar_nr,Error **errp);void msix_write_config (PCIDevice *dev,uint32_t address,uint32_t val,int len);
hw/block/nvme.c +1 -1
@@ -872,7 +872,7 @@ static int nvme_init(PCIDevice *pci_dev)pci_register_bar (&n->parent_obj,0 ,PCI_BASE_ADDRESS_SPACE_MEMORY |PCI_BASE_ADDRESS_MEM_TYPE_64 , &n->iomem); -msix_init_exclusive_bar (&n->parent_obj, n->num_queues,4 ); +msix_init_exclusive_bar (&n->parent_obj, n->num_queues,4 ,NULL ); id->vid =cpu_to_le16 (pci_get_word (pci_conf +PCI_VENDOR_ID )); id->ssvid =cpu_to_le16 (pci_get_word (pci_conf +PCI_SUBSYSTEM_VENDOR_ID ));
hw/misc/ivshmem.c +4 -4
@@ -749,13 +749,13 @@ static void ivshmem_reset(DeviceState *d) } } -static int ivshmem_setup_interrupts (IVShmemState *s) +static int ivshmem_setup_interrupts (IVShmemState *s,Error **errp) {/* allocate QEMU callback data for receiving interrupts */ s->msi_vectors =g_malloc0 (s->vectors *sizeof (MSIVector));if (ivshmem_has_feature (s,IVSHMEM_MSI )) { -if (msix_init_exclusive_bar (PCI_DEVICE (s), s->vectors,1 )) { +if (msix_init_exclusive_bar (PCI_DEVICE (s), s->vectors,1 , errp)) {return -1 ; }
@@ -897,8 +897,8 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)qemu_chr_fe_set_handlers (&s->server_chr, ivshmem_can_receive, ivshmem_read,NULL , s,NULL , true); -if (ivshmem_setup_interrupts (s) <0 ) { -error_setg (errp,"failed to initialize interrupts" ); +if (ivshmem_setup_interrupts (s, errp) <0 ) { +error_prepend (errp,"Failed to initialize interrupts: " );return ; } }
hw/net/e1000e.c +1 -1
@@ -292,7 +292,7 @@ e1000e_init_msix(E1000EState *s)E1000E_MSIX_IDX ,E1000E_MSIX_TABLE , &s->msix,E1000E_MSIX_IDX ,E1000E_MSIX_PBA , - 0xA0); + 0xA0, NULL);if (res <0 ) {trace_e1000e_msix_init_fail (res);
hw/net/rocker/rocker.c +3 -1
@@ -1256,14 +1256,16 @@ static int rocker_msix_init(Rocker *r) {PCIDevice *dev =PCI_DEVICE (r);int err; +Error *local_err =NULL ; err =msix_init (dev,ROCKER_MSIX_VEC_COUNT (r->fp_ports), &r->msix_bar,ROCKER_PCI_MSIX_BAR_IDX ,ROCKER_PCI_MSIX_TABLE_OFFSET , &r->msix_bar,ROCKER_PCI_MSIX_BAR_IDX ,ROCKER_PCI_MSIX_PBA_OFFSET , -0 ); +0 , &local_err);if (err) { +error_report_err (local_err);return err; }
hw/net/vmxnet3.c +1 -1
@@ -2191,7 +2191,7 @@ vmxnet3_init_msix(VMXNET3State *s)VMXNET3_MSIX_BAR_IDX ,VMXNET3_OFF_MSIX_TABLE , &s->msix_bar,VMXNET3_MSIX_BAR_IDX ,VMXNET3_OFF_MSIX_PBA (s), - VMXNET3_MSIX_OFFSET(s)); + VMXNET3_MSIX_OFFSET(s), NULL);if (0 > res) {VMW_WRPRN ("Failed to initialize MSI-X, error %d" , res);
hw/pci-bridge/gen_pcie_root_port.c +1 -2
@@ -29,11 +29,10 @@ static int gen_rp_interrupts_init(PCIDevice *d, Error **errp) {int rc; - rc =msix_init_exclusive_bar (d,GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR ,0 ); + rc =msix_init_exclusive_bar (d,GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR ,0 , errp);if (rc <0 ) {assert (rc == -ENOTSUP ); -error_setg (errp,"Unable to init msix vectors" ); }else {msix_vector_use (d,0 ); }
hw/pci/msix.c +31 -5
@@ -21,6 +21,7 @@#include "hw/pci/pci.h" #include "hw/xen/xen.h" #include "qemu/range.h" +#include "qapi/error.h" #define MSIX_CAP_LENGTH 12
@@ -238,11 +239,31 @@ static void msix_mask_all(struct PCIDevice *dev, unsigned nentries) } } -/* Initialize the MSI-X structures */ +/* +* Make PCI device @dev MSI-X capable +* @nentries is the max number of MSI-X vectors that the device support. +* @table_bar is the MemoryRegion that MSI-X table structure resides. +* @table_bar_nr is number of base address register corresponding to @table_bar. +* @table_offset indicates the offset that the MSI-X table structure starts with +* in @table_bar. +* @pba_bar is the MemoryRegion that the Pending Bit Array structure resides. +* @pba_bar_nr is number of base address register corresponding to @pba_bar. +* @pba_offset indicates the offset that the Pending Bit Array structure +* starts with in @pba_bar. +* Non-zero @cap_pos puts capability MSI-X at that offset in PCI config space. +* @errp is for returning errors. +* +* Return 0 on success; set @errp and return -errno on error: +* -ENOTSUP means lacking msi support for a msi-capable platform. +* -EINVAL means capability overlap, happens when @cap_pos is non-zero, +* also means a programming error, except device assignment, which can check +* if a real HW is broken. +*/ int msix_init (struct PCIDevice *dev,unsigned short nentries,MemoryRegion *table_bar,uint8_t table_bar_nr,unsigned table_offset,MemoryRegion *pba_bar, -uint8_t pba_bar_nr,unsigned pba_offset,uint8_t cap_pos) +uint8_t pba_bar_nr,unsigned pba_offset,uint8_t cap_pos, +Error **errp) {int cap;unsigned table_size, pba_size;
@@ -250,10 +271,12 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,/* Nothing to do if MSI is not supported by interrupt controller */ if (!msi_nonbroken) { +error_setg (errp,"MSI-X is not supported by interrupt controller" );return -ENOTSUP ; }if (nentries <1 || nentries >PCI_MSIX_FLAGS_QSIZE +1 ) { +error_setg (errp,"The number of MSI-X vectors is invalid" );return -EINVAL ; }
@@ -266,10 +289,13 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries, table_offset + table_size > memory_region_size(table_bar) || pba_offset + pba_size > memory_region_size(pba_bar) || (table_offset | pba_offset) & PCI_MSIX_FLAGS_BIRMASK) { +error_setg (errp,"table & pba overlap, or they don't fit in BARs," +" or don't align" );return -EINVAL ; } - cap =pci_add_capability (dev,PCI_CAP_ID_MSIX , cap_pos,MSIX_CAP_LENGTH ); + cap =pci_add_capability2 (dev,PCI_CAP_ID_MSIX , + cap_pos,MSIX_CAP_LENGTH , errp);if (cap <0 ) {return cap; }
@@ -306,7 +332,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries, }int msix_init_exclusive_bar (PCIDevice *dev,unsigned short nentries, -uint8_t bar_nr) +uint8_t bar_nr,Error **errp) {int ret;char *name;
@@ -338,7 +364,7 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, ret =msix_init (dev, nentries, &dev->msix_exclusive_bar, bar_nr,0 , &dev->msix_exclusive_bar, bar_nr, bar_pba_offset, -0 ); +0 , errp);if (ret) {return ret; }
hw/scsi/megasas.c +3 -1
@@ -2367,9 +2367,11 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp)if (megasas_use_msix (s) &&msix_init (dev,15 , &s->mmio_io, b->mmio_bar,0x2000 , - &s->mmio_io, b->mmio_bar,0x3800 ,0x68 )) { + &s->mmio_io, b->mmio_bar,0x3800 ,0x68 ,NULL )) { +/* TODO: check msix_init's error, and should fail on msix=on */ s->msix =ON_OFF_AUTO_OFF ; } +if (pci_is_express (dev)) {pcie_endpoint_cap_init (dev,0xa0 ); }
hw/usb/hcd-xhci.c +2 -2
@@ -3703,11 +3703,11 @@ static void usb_xhci_realize(struct PCIDevice *dev, Error **errp) }if (xhci->msix !=ON_OFF_AUTO_OFF ) { -/* TODO check for errors */ +/* TODO check for errors, and should fail when msix=on */ msix_init (dev, xhci->numintrs, &xhci->mem,0 ,OFF_MSIX_TABLE , &xhci->mem,0 ,OFF_MSIX_PBA , -0x90 ); +0x90 ,NULL ); } }
hw/vfio/pci.c +6 -2
@@ -1432,6 +1432,7 @@ static void vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)static int vfio_msix_setup (VFIOPCIDevice *vdev,int pos,Error **errp) {int ret; +Error *err =NULL ; vdev->msix->pending =g_malloc0 (BITS_TO_LONGS (vdev->msix->entries) *sizeof (unsigned long ));
@@ -1439,12 +1440,15 @@ static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp) vdev->bars[vdev->msix->table_bar].region.mem, vdev->msix->table_bar, vdev->msix->table_offset, vdev->bars[vdev->msix->pba_bar].region.mem, - vdev->msix->pba_bar, vdev->msix->pba_offset, pos); + vdev->msix->pba_bar, vdev->msix->pba_offset, pos, + &err);if (ret <0 ) {if (ret == -ENOTSUP ) { +error_report_err (err);return 0 ; } -error_setg (errp,"msix_init failed" ); + +error_propagate (errp, err);return ret; }
hw/virtio/virtio-pci.c +2 -2
@@ -1682,9 +1682,9 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)if (proxy->nvectors) {int err =msix_init_exclusive_bar (&proxy->pci_dev, proxy->nvectors, - proxy->msix_bar_idx); + proxy->msix_bar_idx,NULL );if (err) { -/* Notice when a system that supports MSIx can't initialize it. */ +/* Notice when a system that supports MSIx can't initialize it */ if (err != -ENOTSUP ) {error_report ("unable to init msix vectors to %" PRIu32, proxy->nvectors);
Signature · 1 line
MST
[Qemu-devel] [PULL 16/16] vhost-user: delete chardev on cleanup
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Remove the chardev implicitly when cleaning up the netdev. This prevents from reusing the chardev since it would be in an incorrect state with the slave.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1256618
--- net/vhost-user.c | 3 +++ 1 file changed, 3 insertions(+)
net/vhost-user.c +3 -0
@@ -151,7 +151,10 @@ static void vhost_user_cleanup(NetClientState *nc) s->vhost_net =NULL ; }if (nc->queue_index ==0 ) { +CharDriverState *chr =qemu_chr_fe_get_driver (&s->chr); +qemu_chr_fe_deinit (&s->chr); +qemu_chr_delete (chr); }qemu_purge_queued_packets (nc);
Signature · 1 line
MST
Quoted 12 lines · Michael S. Tsirkin
The following changes since commit
a9e404600a9bd1e6a26431fc89e5069092e67f14:Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170124' into staging (2017-01-24 17:26:26 +0000)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
b562d945fc840131d290d4bf5af8d6cc3bb98a2b:vhost-user: delete chardev on cleanup (2017-01-24 21:49:25 +0200)
Quoted 7 lines
----------------------------------------------------------------
virtio, vhost, pci: fixes, featuresgeneric pci root port support
fixes and cleanups all over the placeSigned-off-by Michael S. Tsirkin <[email protected]>
Hi; I'm afraid this fails to build:
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:9: error:
implicit declaration of function ‘VMSTATE_PCIE_DEVICE’ [-Werror=implicit-function-declaration]
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
^
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:29: error:
‘parent_obj’ undeclared here (not in a function)
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
^
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:63: error:
expected expression before ‘PCIESlot’
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
^thanks
-- PMM
Quoted 32 lines · Peter Maydell
Quoted 12 lines · Michael S. Tsirkin
The following changes since commit
a9e404600a9bd1e6a26431fc89e5069092e67f14:Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20170124' into staging (2017-01-24 17:26:26 +0000)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
b562d945fc840131d290d4bf5af8d6cc3bb98a2b:vhost-user: delete chardev on cleanup (2017-01-24 21:49:25 +0200)
Quoted 7 lines
----------------------------------------------------------------
virtio, vhost, pci: fixes, featuresgeneric pci root port support
fixes and cleanups all over the placeSigned-off-by Michael S. Tsirkin <[email protected]>Hi; I'm afraid this fails to build:
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:9: error:
implicit declaration of function ‘VMSTATE_PCIE_DEVICE’ [-Werror=implicit-function-declaration]VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot), ^ /home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:29: error: ‘parent_obj’ undeclared here (not in a function) VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot), ^
Quoted 4 lines
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:63: error:
expected expression before ‘PCIESlot’
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
Hi Peter,
Strange, I re-based in the same day I posted and compiled just fine... However, I get the same error using today's master.
I'll fix and re-post the series.
Thanks,
Marcel
^
Quoted 4 lines
thanks
-- PMM
Quoted 4 lines · Marcel Apfelbaum
Strange, I re-based in the same day I posted and compiled just fine... However, I get the same error using today's master.
I'll fix and re-post the series.
mst has done a rebase of the pull request which I'll retry later.
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 4 lines · Marcel Apfelbaum
Strange, I re-based in the same day I posted and compiled just fine... However, I get the same error using today's master.
I'll fix and re-post the series.
mst has done a rebase of the pull request which I'll retry later.
Understood, anyway the problem is that commit
20daa90 (PCI/migration merge vmstate_pci_device and vmstate_pcie_device) removed the VMSTATE_PCIE_DEVICE macro.
I'll re-post anyway and Michael can decide if he tweaks the macro name or use the updated series.
Thanks,
Marcel
Quoted 3 lines
thanks
-- PMM
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Marcel Apfelbaum
Strange, I re-based in the same day I posted and compiled just fine... However, I get the same error using today's master.
I'll fix and re-post the series.
mst has done a rebase of the pull request which I'll retry later.
Results:/home/petmay01/linaro/qemu-for-merges/hw/display/qxl.c: In function ‘qxl_rom_size’:/home/petmay01/linaro/qemu-for-merges/hw/display/qxl.c:313:20: error:
bit-field ‘<anonymous>’ width not an integer constant
QEMU_BUILD_BUG_ON(required_rom_size > rom_size);
^x86-64 linux host; I guess the usage in this file conflicts with your series' rephrasing of the macro for some versions of gcc. This is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
If I rewrite the build-assert in qxl.c as
QEMU_BUILD_BUG_ON(sizeof(QXLRom) + sizeof(QXLModes) +sizeof(qxl_modes) > 8192);
it compiles OK (and the build then runs into the error below).
All the other build hosts fell over like this:
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:9: error:
implicit declaration of function ‘VMSTATE_PCIE_DEVICE’ [-Werror=implicit-function-declaration]
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
^
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:29: error:
‘parent_obj’ undeclared here (not in a function)
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
^/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:63: error:
expected expression before ‘PCIESlot’
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
thanks
-- PMM
Quoted 15 lines · Peter Maydell
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Marcel Apfelbaum
Strange, I re-based in the same day I posted and compiled just fine... However, I get the same error using today's master.
I'll fix and re-post the series.
mst has done a rebase of the pull request which I'll retry later.
Results:
/home/petmay01/linaro/qemu-for-merges/hw/display/qxl.c: In function ‘qxl_rom_size’:/home/petmay01/linaro/qemu-for-merges/hw/display/qxl.c:313:20: error:
bit-field ‘<anonymous>’ width not an integer constant
Quoted 6 lines
QEMU_BUILD_BUG_ON(required_rom_size > rom_size); ^x86-64 linux host; I guess the usage in this file conflicts with your series' rephrasing of the macro for some versions of gcc. This is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
I guess what happened previously is that gcc did not actually check this size at all. I posted a patch to rewrite using macros. Trivial but I still will give maintainer a bit of time to take a look.
Quoted 23 lines
If I rewrite the build-assert in
qxl.cas
QEMU_BUILD_BUG_ON(sizeof(QXLRom) + sizeof(QXLModes) +sizeof(qxl_modes)> 8192);
it compiles OK (and the build then runs into the error below).All the other build hosts fell over like this:
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:9: error:
implicit declaration of function ‘VMSTATE_PCIE_DEVICE’ [-Werror=implicit-function-declaration]VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot), ^ /home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:29: error: ‘parent_obj’ undeclared here (not in a function) VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot), ^
/home/pm215/qemu/hw/pci-bridge/gen_pcie_root_port.c:54:63: error:
expected expression before ‘PCIESlot’
VMSTATE_PCIE_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),thanks
-- PMM