virtio-net: remove layout assumptions for ctrl vq
Virtio-net code makes assumption about virtqueue descriptor layout(e.g. sg0 is the header, sg1 is the data buffer).
This patch makes code not rely on the layout of descriptors.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
virtio-net: introduce a new macaddr control
In virtio-net guest driver, currently we write MAC address topci config space byte by byte, this means that we have anintermediate step where mac is wrong. This patch introduceda new control command to set MAC address, it's atomic....
e1000: document ICS read behaviour
Add code comment to clarify the reason we set ICS with ICR:the reason was previously undocumented and gitlog confused rather than clarified the comments.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio-net: revert mac on reset
Once guest overrides virtio net primary mac,it retains the value set until qemu exit.This is inconsistent with standard nic behaviour.To fix, revert the mac to the original value on reset.
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Merge remote-tracking branch 'luiz/queue/qmp' into staging
fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init()
PC will not use max_cpus for that field, so move it outside the commoncode so it can use a different value on PC.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
pc: Set fw_cfg data based on APIC ID calculation
This changes FW_CFG_MAX_CPUS and FW_CFG_NUMA to use apic_id_for_cpu(),so the NUMA table can be based on the APIC IDs, instead of CPU index(SeaBIOS knows nothing about CPU indexes, just APIC IDs).
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>...
pc: Generate APIC IDs according to CPU topology
This keeps compatibility on machine-types pc-1.2 and older, and prints awarning in case the requested configuration won't get the correcttopology.
I couldn't think of a better way to warn about broken topology when in...
pc: Reverse pc_init_pci() compatibility logic
Currently, the pc-1.4 machine init function enables PV EOI and thencalls the pc-1.2 machine init function. The problem with this approachis that now we can't enable any additional compatibility code inside the...
xilinx_ethlite: Avoid build warnings in debug code
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
m25p80.c: Return state to IDLE after COLLECTING
Default to moving back to the IDLE state after the COLLECTING_DATAstate. For a well behaved guest this patch has no consequence, butA bad guest could crash QEMU by using one of the erase commandsfollowed by a longer than 5 byte argument (undefined behaviour)....
xilinx_ethlite: Flush queued packets on SW service
Software services a received packet by clearing the CTRL_S bit in the RX_CTRLnregister. If this bit is cleared, flush any packets queued for the device.
Reported-by: John Williams <john.williams@xilinx.com>...
xilinx_ethlite: fix eth_can_rx() for ping-pong
The eth_can_rx() function only checks the first buffers status ("ping"). Thecontroller should be able to receive into "pong" when ping-pong is enabled.Checks the active buffer (either "ping" or "pong") when determining can_rx()...
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
vmware_vga: fix out of bounds and invalid rects updating
This is a follow up for several attempts to fix this issue.
Previous incarnations:
1. http://thread.gmane.org/gmane.linux.ubuntu.bugs.general/3156089https://bugs.launchpad.net/bugs/918791"qemu-kvm dies when using vmvga driver and unity in the guest" bug....
hw/arm_boot: Align device tree to 4KB boundary, not page
Align the device tree blob to a 4KB boundary, not to QEMU'sidea of a page boundary -- the latter is the smallest possiblepage size for the architecture, which on ARM is 1KB.The documentation for Linux does not impose separation...
fw_cfg: Drop a few superfluous initializers
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
fw_cfg: Splash image loader can overrun a stack variable, fix
read_splashfile() passes the address of an int variable as size_t *parameter to g_file_get_contents(), with a cast to gag the compiler.
No problem on machines where sizeof(size_t) == sizeof(int)....
hw/omap1.c: Add fallthrough markers and breaks
Explicitly mark cases where we are deliberately fallingthrough to the following code. In one case we insert a'break' instead of falling through to a 'break', as thisseems slightly clearer.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
hw/omap_dma, hw/omap_spi: Explicitly mark fallthroughs
Explicitly mark the fallthroughs as intentional in the codepattern where we gradually increment an index before fallinginto the code to read/write that array entry: case THINGY_3: idx++; case THINGY_2: idx++;...
hw/pflash_cfi02.c: Mark deliberate fallthrough
Mark the deliberate fallthrough where we treat the case ofan attempt to read flash when it is an unknown commandstate as if it were a normal read.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/smc91c111: Add explicit 'return' rather than relying on fallthrough
Add an explicit 'return' statement to a case in smc91c111_readbrather than relying on fallthrough to the following case'sreturn statement, for code clarity and to placate static analysers....
hw/pxa2xx_timer: Explicitly mark fallthroughs
hw/arm_sysctl.c: Add missing 'break' statements
Add some break statements that were accidentally omittedfrom some cases of arm_sysctl_write(). The omission washarmless because in both cases the following case didan immediate break, but adding the breaks explicitly...
build: remove extra-obj-y
extra-obj-y is somewhat complicated to understand. Replace it with aspecial CONFIG_ALL symbol that is defined only at toplevel.This limits the case of directories defining more than one*-obj-y target.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
build: remove universal-obj-y
All of universal-obj-y, user-obj-y (right now unused) and common-obj-y canbe unified into common-obj-y if we take care of defining CONFIG_SOFTMMUand CONFIG_USER_ONLY in the toplevel makefile. This is similar to howwe define symbols for hardware components....
openpic: fix remaining issues from idr-to-destmask conversion
openpic_update_irq() was checking idr rather than destmask, treatingit as if it were a simple bitmap of cpus. Changed to use destmask.
IPI delivery was removing bits directly from .idr, without calling...
openpic: fix timer address decoding
The timer memory range begins at 0x10f0, so that address 0x1120 showsup as 0x30, 0x1130 shows up as 0x40, etc. However, the addressdecoding (other than TFRR) is not adjusted for this, causing thewrong registers to be accessed....
openpic: add basic support for MPIC v4.2
Besides the new value in the version register, this provides:- ILR support, which includes: - IDR becoming a pure CPU bitmap, allowing 32 CPUs - machine check output support (though other parts of QEMU need to...
PPC: e500: fix mpic_iack address
MPIC+0xa0 is IACK for the current CPU. MPIC+0x200a0 is IACK for CPU 0.This fix allows EPR to work with an SMP target.
Signed-off-by: Scott Wood <scottwood@freescale.com>Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: e500: Select MPIC v4.2 on ppce500 platform
The compatible string is changed to fsl,mpic on all e500 platforms, toadvertise the existence of BRR1. This matches what the device tree willhave on real hardware.
With MPIC v4.2 max_cpu can be increased from 15 to 32....
adb: QOM'ify Apple Desktop Bus
It was not a qbus before, turn it into a first-class bus and initializeit properly from CUDA. Leave it a global variable as long as devices arenot QOM'ified yet.
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
adb: QOM'ify ADB devices
They were not qdev'ified before. Derive ADBDevice from DeviceState andconvert reset callbacks to DeviceClass::reset, ADBDevice::opaque pointerto ADBDevice subtypes for mouse and keyboard and adb_{kbd,mouse}_init()to regular qdev functions....
cuda: Move ADB bus into CUDA state
Replace the global adb_bus with a CUDA-internal one, accessed usingregular qdev child bus accessor.
pseries: Improve handling of multiple PCI host bridges
Multiple - even many - PCI host bridges (i.e. PCI domains) are verycommon on real PAPR compliant hardware. For reasons related to thePAPR specified IOMMU interfaces, PCI device assignment with VFIO will...
pseries: Adjust default VIO address allocations to play better with libvirt
Currently, if VIO devices for pseries don't have addresses explicitlyallocated, they get automatically numbered from 0x1000. This is in thesame general range that libvirt will typically assign VIO device addresses....
macio: QOM'ify some more
Move bar MemoryRegion initialization to an instance_init.
macio: Delay qdev init until all fields are initialized
This turns macio_bar_setup() into an implementation detail of the qdevinitfn, to be removed step by step.
macio: Split MacIO in two
Let the machines create two different types. This prepares to moveknowledge about sub-devices from the machines into the devices.
mac_nvram: Clean up public API
The state data field is accessed in uint8_t quantities, so switch fromuint32_t argument and return value to uint8_t.
Fix debug format specifiers while at it.
mac_nvram: Mark as Big Endian
mac_nvram: QOM'ify MacIO NVRAM
It was not qdev'ified before. Turn it into a SysBusDevice andinitialize it via static properties.
Prepare Old World specific MacIO state and embed the NVRAM state there.
Drop macio_nvram_setup_bar() in favor of sysbus_mmio_map() or...
ide/macio: QOM'ify MacIO IDE
It was not qdev'ified before. Turn it into a SysBusDevice.Embed them into the MacIO devices.
cuda: QOM'ify CUDA
It was not qdev'ified before. Turn it into a SysBusDevice and embed itin MacIO.
ppc: Move Mac machines to hw/ppc/
Signed-off-by: Andreas Färber <afaerber@suse.de>[agraf: squash in MAINTAINERS fix]Signed-off-by: Alexander Graf <agraf@suse.de>
ide: Add fall through annotations
Add comments to help static analysers detect that these cases areintentional, and clean up some whitespace in the environment of thesecomments.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>
ahci: Remove unused AHCIDevice fields
'dma_status' and 'dma_cb' are written to, but never read.Remove these fields in preparation for AHCI migration bits.
Signed-off-by: Jason Baron <jbaron@redhat.com>Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ahci: Change data types in preparation for migration
The size of an int depends on the host, so in order to be able tomigrate these fields, make them either int32_t or bool, depending on theuse.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ahci: Add migration support
Jason tested these patches by migrating Windows 7 and Fedora 17 guests(while under I/O) on both piix with ahci attached and on q35 (which hasa built-in AHCI controller).
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Jason Baron <jbaron@redhat.com>...
balloon: re-enable balloon stats
The statistics are now available through device properties via apolling mechanism. First a client has to enable polling, then itcan query available stats.
Polling is enabled by setting an update interval (in seconds)to a property named guest-stats-polling-interval, like this:...
balloon: drop old stats code & API
Next commit will re-enable balloon stats with a different interface, butthis old code conflicts with it. Let's drop it.
It's important to note that the QMP and HMP interfaces are also droppedby this commit. That shouldn't be a problem though, because:...
Revert "serial: fix retry logic"
This reverts commit 67c5322d7000fd105a926eec44bc1765b7d70bdd:
I'm not sure if the retry logic has ever worked when not using FIFO mode. I found this while writing a test case although code inspection confirms it is...
trivial: etraxfs_eth: Eliminate checkpatch errors
This is a trivial patch to harmonize the coding style onhw/etraxfs_eth.c. This is in preparation to split off the bitbang mdiocode into a separate file.
Cc: Peter Maydell <peter.maydell@linaro.org>Cc: Paul Brook <paul@codesourcery.com>...
Merge remote-tracking branch 'bonzini/scsi-next' into staging
Merge remote-tracking branch 'kraxel/usb.77' into staging
scsi: fix segfault with 0-byte disk
When a 0-sized disk is found, READ CAPACITY will return aLUN NOT READY error. However, because it returns -1 insteadof zero, the HBA will call scsi_req_continue. This willtypically cause a segmentation fault or an assertion failure....
lsi: use qbus_reset_all to reset SCSI bus
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
scsi: Drop useless null test in scsi_unit_attention()
req was created by scsi_req_alloc(), which initializes req->dev to avalue it dereferences. req->dev isn't changed anywhere else.Therefore, req->dev can't be null.
Drop the useless null test; it spooks Coverity....
ohci: add missing break
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: add usb-bot device (scsi bulk-only transport).
Basically the same as usb-storage, but without automatic scsidevice setup. Also features support for up to 16 LUNs.
Revert "usb-storage: Drop useless null test in usb_msd_handle_data()"
This reverts commit a1cbfd554e11bb8af38c2f3e1f1574bf4c563cd2.
Test isn't useless. scsi_req_enqueue() may finish the request (willactually happen for requests which don't trigger any I/O such as...
qxl: change rom size to 8192
This is a simpler solution to 869981, where migration breaks since qxl'srom bar size has changed. Instead of ignoring fields in QXLRom, which is what hasactually changed, we remove some of the modes, a mechanism alreadyaccounted for by the guest. The modes left allow for portrait and...
qxl: stop using non revision 4 rom fields for revision < 4
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
sysbus: Drop sysbus_from_qdev() cast macro
Replace by SYS_BUS_DEVICE() QOM cast macro using a scripted conversion.Avoids the old macro creeping into new code.
Resolve a Coding Style warning in openpic code.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
virtio-s390-device: create a virtio-s390-bus during init.
A virtio-s390-bus is created during the init. So one VirtIODevice can beconnected on the virtio-s390-device through this bus.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-pci: refactor virtio-pci device.
Create the virtio-pci device which is abstract. This transport device willcreate a virtio-pci-bus, so one VirtIODevice can be connected.
virtio-s390-bus: add virtio-s390-bus.
This add the virtio-s390-bus which extends virtio-bus. So one VirtIODevice canbe connected on this bus.
qdev: add a maximum device allowed field for the bus.
Add a max_dev field to BusClass to specify the maximum amount of devices allowedon the bus (has no effect if max_dev=0)
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
virtio-bus: introduce virtio-bus
Introduce virtio-bus. Refactored transport device will create a bus whichextends virtio-bus.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-device: refactor virtio-device.
Create the virtio-device which is abstract. All the virtio-device can extendthis class. It also add some functions to virtio-bus.
virtio-pci-bus: introduce virtio-pci-bus.
Introduce virtio-pci-bus, which extends virtio-bus. It is used with virtio-pcitransport device.
hw/tpci200: Fix compiler warning (redefined symbol with MinGW)
STATUS_TIMEOUT is defined in winnt.h:
CC hw/tpci200.ohw/tpci200.c:34:0: warning: "STATUS_TIMEOUT" redefined [enabled by default]/usr/lib/gcc/x86_64-w64-mingw32/4.6/../../../../x86_64-w64-mingw32/include/winnt.h:1036:0:...
hw: Spelling fix in log message
defineition -> definition
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas F=E4rber <afaerber@suse.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
acpitable: open the data file in binary mode
-acpitable {file|data}=file reads the content of file, but it isin binary form, so the file should be opened usin O_BINARY flag.On *nix it is a no-op, but on windows and other weird platformit is really needed....
Merge remote-tracking branch 'stefanha/block' into staging
usb: Fix compilation for MinGW (regression)
84f2d0ea added an argument to function usb_host_info.The stub function must match the declaration in usb.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
vl: Use size_t for sizes in get_boot_devices_list()
Code mixes uint32_t, int and size_t. Very unlikely to go wrong inpractice, but clean it up anyway.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
fw_cfg: Use void *, size_t instead of uint8_t *, uint32_t for blobs
Many callers pass size_t, which gets silently truncated to uint32_t.Harmless, because all practical sizes are well below 4GiB. Clean itup anyway. Size overflow now fails assertions....
pc: Clean up bochs_bios_init()'s (non-)use of sizeof
sun4: Fix unchecked strdup() by switching to fw_cfg_add_string()
fw_cfg: New fw_cfg_add_string()
pc: Fix unchecked strdup() by switching to fw_cfg_add_string()
fw_cfg: Dumb down fw_cfg_add_*() not to return success / failure
No caller is checking the value, so all errors get ignored, usuallysilently. assert() instead.
fw_cfg: Replace debug prints by tracepoints
s390: Move IPL code into a separate device
Lets move the code to setup IPL for external kernelor via the zipl rom into a separate file. This allows to
- define a reboot handler, setting up the PSW appropriately- enhance the boot code to IPL disks that contain a bootmap that...
S390: Enable -cpu help and QMP query-cpu-definitions
This enables qemu -cpu help to return a list of supported CPU modelson s390 and also to query for cpu definitions in the monitor.Initially only cpu model = host is returned. This needs to be reworked...
s390: Add a hypercall registration interface.
Allow virtio machines to register for different diag500 functioncodes and convert s390-virtio to use it.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: E500: Calculate loading blob offsets properly
We have 3 blobs we need to load when booting the system:
- kernel - initrd - dtb
We place them in physical memory in that order. At least we should.This patch fixes the location calculation up to take any module into...
PPC: e500: Change in-memory order of load blobs
Today, we load
<kernel> <initrd> <dtb>
into memory in that order. However, Linux has a bug where it can onlyhandle the dtb if it's within the first 64MB of where <kernel> starts.
So instead, let's change the order to...
openpic: export e500 epr enable into a ppc.c function
Enabling and disabling the EPR capability (mpic_proxy) is a systemwide operation. As such, it belongs into the ppc.c file, since that'swhere PPC specific machine wide logic happens.
Signed-off-by: Alexander Graf <agraf@suse.de>
PPC: KVM: Add support for EPR with KVM
This patch links KVM EPR support to the existing TCG support we have now.
openpic: move gcr write into a function
The GCR register contains too much functionality to be covered insideof the register switch statement. Move it out into a separate function.
openpic: unify gcr mode mask updates
The mode mask already masks out bits we don't care about, so theactual handling code can stay intact regardless.
openpic: set mixed mode as supported
The Raven MPIC implementation supports the "Mixed" mode to work withan i8259. While we don't implement mixed mode, we should mark it asa supported mode in the mode bitmap.
dataplane: support viostor virtio-pci status bit setting
The viostor virtio-blk driver for Windows does not use theVIRTIO_CONFIG_S_DRIVER bit. It only sets the VIRTIO_CONFIG_S_DRIVER_OKbit.
The viostor driver refreshes the virtio-pci status byte sometimes while...
dataplane: avoid reentrancy during virtio_blk_data_plane_stop()
When dataplane is stopping, the s->vdev->binding->set_host_notifier(...,false) call can invoke the virtqueue handler if an ioeventfdnotification is pending. This causes hw/virtio-blk.c to invoke...