summaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)AuthorFilesLines
2016-01-13omap: Don't use hw_error() in device init() methodsMarkus Armbruster3-13/+34
Device init() methods aren't supposed to call hw_error(), they should report the error and fail cleanly. Do that. The errors are all device misconfiguration. All callers use qdev_init_nofail(), so this patch merely converts hw_error() crashes into &error_abort crashes. Improvement, because now it crashes closer to where the misconfiguration bug would be, and a few more bad examples of hw_error() use are gone. Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Markus Armbruster <armbru@pond.sub.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <1450370121-5768-3-git-send-email-armbru@redhat.com>
2016-01-13hw: Don't use hw_error() for machine initialization errorsMarkus Armbruster8-30/+48
Printing CPU registers is not helpful during machine initialization. Moreover, these are straightforward configuration or "can get resources" errors, so dumping core isn't appropriate either. Replace hw_error() by error_report(); exit(1). Matches how we report these errors in other machine initializations. Cc: Richard Henderson <rth@twiddle.net> Cc: qemu-arm@nongnu.org Cc: qemu-ppc@nongnu.org Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Markus Armbruster <armbru@pond.sub.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <1450370121-5768-2-git-send-email-armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-01-13hw: Inline the qdev_prop_set_drive_nofail() wrapperMarkus Armbruster7-20/+21
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1449764955-10741-3-git-send-email-armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-13Use error_fatal to simplify obvious fatal errorsMarkus Armbruster11-150/+30
Done with this Coccinelle semantic patch: @@ type T; identifier FUN, RET; expression list ARGS; expression ERR, EC; @@ ( - T RET = FUN(ARGS, &ERR); + T RET = FUN(ARGS, &error_fatal); | - RET = FUN(ARGS, &ERR); + RET = FUN(ARGS, &error_fatal); | - FUN(ARGS, &ERR); + FUN(ARGS, &error_fatal); ) - if (ERR != NULL) { - error_report_err(ERR); - exit(EC); - } This is actually a more elegant version of my initial semantic patch by courtesy of Eduardo. It leaves dead Error * variables behind, cleaned up manually. Cc: qemu-arm@nongnu.org Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
2016-01-12Merge remote-tracking branch 'remotes/kvaneesh/tags/for-upstream-signed' ↵Peter Maydell23-618/+667
into staging VirtFS update: Cleanups mostly isolating virtio related details into separate files. This is done to enable easy addition of Xen transport for VirtFS. The changes include: 1. Rename a bunch of files and functions to make clear they are generic. 2. disentangle virtio transport code and generic 9pfs code. 3. Some function name clean-up. # gpg: Signature made Tue 12 Jan 2016 06:04:35 GMT using RSA key ID 04C4E23A # gpg: Good signature from "Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 4846 9DE7 1860 360F A6E9 968C DE41 A4FE 04C4 E23A * remotes/kvaneesh/tags/for-upstream-signed: (25 commits) 9pfs: introduce V9fsVirtioState 9pfs: factor out v9fs_device_{,un}realize_common 9pfs: rename virtio-9p.c to 9p.c 9pfs: rename virtio_9p_set_fd_limit to use v9fs_ prefix 9pfs: move handle_9p_output and make it static function 9pfs: export pdu_{submit,alloc,free} 9pfs: factor out virtio_9p_push_and_notify 9pfs: break out 9p.h from virtio-9p.h 9pfs: break out virtio_init_iov_from_pdu 9pfs: factor out pdu_push_and_notify 9pfs: factor out virtio_pdu_{,un}marshal 9pfs: make pdu_{,un}marshal proper functions 9pfs: PDU processing functions should start pdu_ prefix 9pfs: PDU processing functions don't need to take V9fsState as argument fsdev: rename virtio-9p-marshal.{c,h} to 9p-iov-marshal.{c,h} fsdev: break out 9p-marshal.{c,h} from virtio-9p-marshal.{c,h} 9pfs: remove dead code 9pfs: merge hw/virtio/virtio-9p.h into hw/9pfs/virtio-9p.h 9pfs: rename virtio-9p-xattr{,-user}.{c,h} to 9p-xattr{,-user}.{c,h} 9pfs: rename virtio-9p-synth.{c,h} to 9p-synth.{c,h} ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-129pfs: introduce V9fsVirtioStateWei Liu6-40/+71
V9fsState now only contains generic fields. Introduce V9fsVirtioState for virtio transport. Change virtio-pci and virtio-ccw to use V9fsVirtioState. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2016-01-11ide: ahci: reset ncq object to unused on errorPrasad J Pandit1-0/+1
When processing NCQ commands, AHCI device emulation prepares a NCQ transfer object; To which an aio control block(aiocb) object is assigned in 'execute_ncq_command'. In case, when the NCQ command is invalid, the 'aiocb' object is not assigned, and NCQ transfer object is left as 'used'. This leads to a use after free kind of error in 'bdrv_aio_cancel_async' via 'ahci_reset_port'. Reset NCQ transfer object to 'unused' to avoid it. [Maintainer edit: s/ACHI/AHCI/ in the commit message. --js] Reported-by: Qinghao Tang <luodalongde@gmail.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 1452282511-4116-1-git-send-email-ppandit@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
2016-01-11macio: fix overflow in lba to offset conversion for ATAPI devicesMark Cave-Ayland1-1/+1
As the IDEState lba field is an int32_t, make sure we cast to int64_t before shifting to calculate the offset. Otherwise we end up with an overflow when trying to access sectors beyond 2GB as can occur when using DVD images. [Maintainer edit: fixed extraneous parentheses. --js] Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: 1451928613-29476-1-git-send-email-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow <jsnow@redhat.com>
2016-01-11hw/arm/virt: Support legacy -nic command line syntaxAshok Kumar1-0/+14
Support the legacy -nic syntax for creating PCI network devices as well as the new-style -device options. This makes life easier for people moving from x86 KVM virtualization to ARM KVM virtualization and expecting their network configuration options to work the same way for both setups. We use "virtio" as the default NIC model if the user doesn't specify one. Signed-off-by: Ashok Kumar <ashoks@broadcom.com> Message-id: 1452091659-17698-1-git-send-email-ashoks@broadcom.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: expanded and clarified commit message] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-11hw/dma/xilinx_axidma: remove dead codeAndrew Jones1-10/+0
stream_desc_show() (and DEBUG_ENET) appear to be unused, as the function isn't compilable (there are broken PRI format strings). Signed-off-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Message-id: 1452084792-17424-1-git-send-email-drjones@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-11i.MX: move i.MX31 CCM object to register arrayJean-Christophe DUBOIS1-103/+85
With this i.MX25 and i.MX31 will have closer implementations. Moreover all i.MX31 CCM registers are now present. Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-11Merge remote-tracking branch ↵Peter Maydell11-34/+19
'remotes/mjt/tags/pull-trivial-patches-2016-01-11' into staging trivial patches for 2016-01-11 # gpg: Signature made Mon 11 Jan 2016 08:39:32 GMT using RSA key ID A4C3D7DB # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" * remotes/mjt/tags/pull-trivial-patches-2016-01-11: hw/s390x: Remove superfluous return statements hw/core/qdev: Remove superfluous return statement hw/acpi: Remove superfluous return statement hw/ide: Remove superfluous return statements osdep.h: Include glib-compat.h in osdep.h rather than qemu-common.h scripts/checkpatch.pl: Don't allow special cases of unspaced operators PCI Bonito: QOMify and cleanup SH PCI Host: convert to realize() gt64120: convert to realize() Add missing syscall nrs. according to more recent Linux kernels hw/misc/edu: Convert to realize() configure: fix trace backend check xen/Makefile.objs: simplify crypto: Fix typo in example MAINTAINERS: Add the correct device_tree.h file iscsi: fix readcapacity error message net: convert qemu_log to error_report, fix message linux-user: enable sigaltstack for all architectures unicore32: convert get_sp_from_cpustate from macro to inline Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-11Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into ↵Peter Maydell6-88/+250
staging # gpg: Signature made Mon 11 Jan 2016 05:22:16 GMT using RSA key ID 398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: (24 commits) ether/slirp: Avoid redefinition of the same constants l2tpv3: fix cookie decoding net: ne2000: fix bounds check in ioport operations net: rocker: fix an incorrect array bounds check vmxnet3: Introduce 'x-disable-pcie' back-compat property vmxnet3: Report the Device Serial Number capability vmxnet3: The vmxnet3 device is a PCIE endpoint vmxnet3: coding: Introduce VMXNET3Class vmxnet3: Introduce 'x-old-msi-offsets' back-compat property vmxnet3: Change the offset of the MSIX PBA table vmxnet3: Change offsets of msi/msix pci capabilities net/filter: fix nf->netdev_id leak net/dump: fix nfds->filename leak net/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISION net/vmxnet3: return 0 on unknown command net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFO net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* command net/vmxnet3: return 1 on device activation failure MAINTAINERS: Add an entry for the net/slirp.c file net: vmxnet3: avoid memory leakage in activate_device ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-11Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.6-20160111' ↵Peter Maydell3-129/+146
into staging ppc patch queue 2016-01-11 Biggest content is a thorough cleanups of spapr machine type handling. Also contains several other minor cleanups, bugfixes and extensions. # gpg: Signature made Mon 11 Jan 2016 04:34:38 GMT using RSA key ID 20D9B392 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" # gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" # gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-for-2.6-20160111: hw/ppc/spapr: fix spapr->kvm_type leak spapr vio: fix to incomplete QOMify hw/ppc/spapr: Use XHCI as host controller for new spapr machines pseries: Add pseries-2.6 machine type pseries: Improve setting of default machine version pseries: Restructure class_options functions pseries: DEFINE_SPAPR_MACHINE pseries: Use SET_MACHINE_COMPAT Move SET_MACHINE_COMPAT macro to boards.h pseries: Remove versions from mc->desc pseries: Remove redundant calls to spapr_machine_initfn() pseries: Rearrange versioned machine type code pseries: Remove redundant setting of mc->name for pseries-2.5 machine spapr: Add /system-id target-ppc: Define kvmppc_read_int_dt() hw/ppc/spapr_rtc: Remove bad class_size value Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-11hw/s390x: Remove superfluous return statementsThomas Huth2-5/+0
The "return;" statements at the end of functions do not make much sense, so let's remove them. Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Alexander Graf <agraf@suse.de> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11hw/core/qdev: Remove superfluous return statementThomas Huth1-1/+0
The "return;" statement at the end of device_set_realized() does not make much sense, so let's remove it. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11hw/acpi: Remove superfluous return statementThomas Huth1-1/+0
The "return;" statement at the end of acpi_memory_plug_cb() does not make much sense, so let's remove it. Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11hw/ide: Remove superfluous return statementsThomas Huth2-3/+0
The "return;" statements at the end of functions do not make much sense, so let's remove them. Cc: qemu-block@nongnu.org Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11PCI Bonito: QOMify and cleanupCao jin1-11/+12
Also clear the code Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11SH PCI Host: convert to realize()Cao jin1-3/+2
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11gt64120: convert to realize()Cao jin1-4/+2
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11hw/misc/edu: Convert to realize()Cao jin1-4/+2
for educational PCI device Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11xen/Makefile.objs: simplifyCao jin1-2/+1
merge last two lines, keep alphabetic order. Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2016-01-11hw/ppc/spapr: fix spapr->kvm_type leakDavid Gibson1-0/+8
Cc: David Gibson <david@gibson.dropbear.id.au> Cc: Alexander Graf <agraf@suse.de> Cc: qemu-ppc@nongnu.org Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> [fixed return type of spapr_machine_finalizefn()] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-11spapr vio: fix to incomplete QOMifyCao jin1-7/+5
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-11hw/ppc/spapr: Use XHCI as host controller for new spapr machinesThomas Huth1-1/+8
The OHCI has some bugs and performance issues, so for newer machines it's preferable to use XHCI instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-11pseries: Add pseries-2.6 machine typeDavid Gibson1-2/+20
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Improve setting of default machine versionDavid Gibson1-10/+10
This tweaks the way the default machine version is controlled, so that there will be a bit less churn when each new version is introduced. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Restructure class_options functionsDavid Gibson1-4/+17
Currently each of the *_class_options() functions for the pseries-2.1 .. pseries-2.5 machine types are standalone. This will become harder to maintain as new versions are added. This patch restructures them similarly to x86 where each function calls the one from the next version, then overrides anything necessary for compatibility with the specific version and older. The default behaviour - that for the most recent machine are set up in the base class initializer spapr_machine_class_init(). Previously it had some things set up to default to older behaviour with the more recent machines overriding it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: DEFINE_SPAPR_MACHINEDavid Gibson1-70/+49
At the moment all the class_init functions and TypeInfo structures for the various versioned pseries machine types are open-coded. As more versions are created this is getting increasingly clumsy. This patch borrows the approach used in PC, using a DEFINE_SPAPR_MACHINE() macro to construct most of the boilerplate from simpler 'class_options' and 'instance_options' functions. This patch makes a small semantic change - the versioned machine types are now registered through machine_init() instead of type_init(). Since the new way is how PC already did it, I'm assuming that's correct. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Sam Bobroff <sam.bobroff@au1.ibm.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Use SET_MACHINE_COMPATDavid Gibson1-20/+4
To make the spapr_machine_*_class_init() functions a little less bulky. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Remove versions from mc->descDavid Gibson1-5/+1
Currently, the versioned spapr machine types put the machine type version into the description string. PC does not do this, using just the name itself to distinguish. Doing the same lets us move setting the description into the common base class, simplifying the code slightly. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Remove redundant calls to spapr_machine_initfn()David Gibson1-3/+0
The instance_init() functions for several of the pseries-x.y versioned machine types explicitly call spapr_machine_initfn(). But that's the instance_init function for the common parent of all those machine types, so will already have been called beforehand by the QOM infrastructure. Remove the redundant calls. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Rearrange versioned machine type codeDavid Gibson1-82/+98
hw/ppc/spapr.c has a number of definitions related to the various versioned machine types ("pseries-2.1" .. "pseries-2.5") it defines. These are mostly arranged by type of function first, then machine version second, and it's not consistent about whether it goes in increasing or decreasing version order. This rearranges the code to keep all the definitions for a particular machine version together, and arrange then consistently in order most recent to least recent. This brings us closer to matching the way PC does things, and makes later cleanups easier to follow. Apart from adding some comments marking each section, this is a pure mechanical rearrangement with no semantic changes. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11pseries: Remove redundant setting of mc->name for pseries-2.5 machineDavid Gibson1-1/+0
98cec76 "machine: Set MachineClass::name automatically" removed the setting of mc->name for the pseries machine types, since it can be derived automatically from the type names constructed with MACHINE_TYPE_NAME(). Unfortunately fb0fc8f "spapr: Create pseries-2.5 machine" went in later and brought one of them back. This removes it again. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-11spapr: Add /system-idAlexey Kardashevskiy1-0/+3
Section B.6.2.1 Root Node Properties of PAPR specification defines a set of properties which shall be present in the device tree root, one of these properties is "system-id" which "should be unique across all systems and all manufacturers". Since UUID is meant to be unique, it makes sense to use it as "system-id". This adds "system-id" property to the device tree root when not empty. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-11ether/slirp: Avoid redefinition of the same constantsDr. David Alan Gilbert1-1/+0
eth.h and slirp.h both define ETH_ALEN and ETH_P_IP rtl8139.c and eth.h both define ETH_HLEN Move the related constant (ETH_P_ARP) from slirp.h to eth.h, and remove the duplicates; make slirp.h include eth.h Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11net: ne2000: fix bounds check in ioport operationsPrasad J Pandit1-4/+6
While doing ioport r/w operations, ne2000 device emulation suffers from OOB r/w errors. Update respective array bounds check to avoid OOB access. Reported-by: Ling Liu <liuling-it@360.cn> Cc: qemu-stable@nongnu.org Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11net: rocker: fix an incorrect array bounds checkPrasad J Pandit1-4/+4
While processing transmit(tx) descriptors in 'tx_consume' routine the switch emulator suffers from an off-by-one error, if a descriptor was to have more than allowed(ROCKER_TX_FRAGS_MAX=16) fragments. Fix an incorrect bounds check to avoid it. Reported-by: Qinghao Tang <luodalongde@gmail.com> Cc: qemu-stable@nongnu.org Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: Introduce 'x-disable-pcie' back-compat propertyShmulik Ladkani1-0/+2
Following the previous patch which changed vmxnet3 to be a pci express device, this patch introduces a boolean property 'x-disable-pcie' whose default is false. Setting 'x-disable-pcie' to 'on' preserves the old 'pci device' (non express) behavior. This allows migration to older versions. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: Report the Device Serial Number capabilityShmulik Ladkani1-2/+26
Report the DSN extended PCI capability at 0x100. DSN value is a transformation of device MAC address, as calculated by VMware virtual hardware. DSN is reported only if device is pcie. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: The vmxnet3 device is a PCIE endpointShmulik Ladkani1-1/+52
Report the 'express endpoint' capability if on a PCIE bus. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: coding: Introduce VMXNET3ClassShmulik Ladkani1-0/+10
Introduce a class type for vmxnet3, and the usual DEVICE_CLASS/DEVICE_GET_CLASS macros. No semantic change. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: Introduce 'x-old-msi-offsets' back-compat propertyShmulik Ladkani1-0/+2
Following the previous patches, where vmxnet3's pci's msi/msix capability offsets and msix's PBA table offsets have been changed, this patch introduces a boolean property 'x-old-msi-offsets' to vmxnet3, whose default is false. Setting 'x-old-msi-offsets' to 'on' preserves the old offsets behavior, which allows migration to older versions. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: Change the offset of the MSIX PBA tableShmulik Ladkani1-2/+3
Place the PBA table at 0x1000, as placed by VMware virtual hardware. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11vmxnet3: Change offsets of msi/msix pci capabilitiesShmulik Ladkani1-3/+15
Place device reported PCI capabilities at the same offsets as placed by the VMware virtual hardware: MSI at [84], MSI-X at [9c]. Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11net/vmxnet3: rename VMXNET3_DEVICE_VERSION to VMXNET3_UPT_REVISIONMiao Yan1-2/+2
VMXNET3_DEVICE_VERSION is used as return value for accessing UPT Revision Report and Selection register. So rename it to VMXNET3_UPT_REVISION. Signed-off-by: Miao Yan <yanmiaoebest@gmail.com> Reviewed-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11net/vmxnet3: return 0 on unknown commandMiao Yan1-1/+1
Return 0 on unknown command, this is what esxi (5.x+) behaves. Signed-off-by: Miao Yan <yanmiaobest@gmail.com> Reviewed-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11net/vmxnet3: return correct value for VMXNET3_CMD_GET_DEV_EXTRA_INFOMiao Yan1-0/+5
VMXNET3_CMD_GET_DEV_EXTRA_INFO should return 0 for emulation mode This behavior can be observed by the following steps: 1) run a Linux distro on esxi server (5.x+) 2) modify vmxnet3 Linux driver to read the register: VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DEV_EXTRA_INFO); ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); pr_info("vmxnet3 dev_info: 0x%x\n", ret); The kernel log will have some like the following message: [ 7005.111170] vmxnet3 dev_info: 0x0 Signed-off-by: Miao Yan <yanmiaobest@gmail.com> Reviewed-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-01-11net/vmxnet3: return correct value for VMXNET3_CMD_GET_DID_* commandMiao Yan1-0/+16
VMXNET3_CMD_GET_DID_LO should return PCI ID of the device and VMXNET3_CMD_GET_DID_HI should return vmxnet3 revision ID. This behavior can be observed by the following steps: 1) run a Linux distro on esxi server (5.x+) 2) modify vmxnet3 Linux driver to read DID_HI and DID_LO: VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_LO); lo = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_DID_HI); high = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); pr_info("vmxnet3 DID lo: 0x%x, high: 0x%x\n", lo, high); The kernel log will have something like the following message: [ 7005.111170] vmxnet3 DID lo: 0x7b0, high: 0x1 Signed-off-by: Miao Yan <yanmiaobest@gmail.com> Reviewed-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Jason Wang <jasowang@redhat.com>