History | View | Annotate | Download (39.1 kB)
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and thenrebased it into a single step which avoids repeatedly touching every file inthe tree.
The first step was a sed-based addition of the parent type to the subclass...
pci: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: don't access name through info
We already have a QOM interface for this so let's use it.
qdev: move qdev->info to class
Right now, DeviceInfo acts as the class for qdev. In order to switch to aproper ObjectClass derivative, we need to ween all of the callers off ofinteracting directly with the info pointer.
e1000: Preserve link state across device reset
A device reset does not affect the link state, only set_link does.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
e1000: bounds packet size against buffer size
Otherwise we can write beyond the buffer and corrupt memory. This is trackedas CVE-2012-0029.
Remove unnecessary casts from PCI DMA code in e1000
This patch removes some unnecessary casts in the e1000 device,introduced by commit 62ecbd353d25e62c4a6c327ea88ba5404e13507a 'e1000:Use PCI DMA stub functions'.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
e1000: Use PCI DMA stub functions
This updates the e1000 device emulation to use the explicit PCI DMAfunctions, instead of directly calling physical memory access functions.
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>Signed-off-by: David Gibson <david@gibson.dropbear.id.au>...
e1000: Don't set the Capabilities List bit
[Originally sent to qemu-kvm list, but I was redirected here]
The Capabilities Pointer is NULL, so this bit shouldn't be set. The state ofthis bit doesn't appear to change any behavior on Linux/Windows versions we've...
pci: interrupt pin documentation update
Fix up some erroneous comments in code:interrupt pins are named A-D, theinterrupt pin register is always readonlyand isn't zeroed out on reset.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
e1000: use MII status register for link up/down
Some guests will use the standard MII status registerto verify link state. They will not notice link changesunless this register is updated.
Verified with Linux 3.0 and Windows XP guests.
Without this patch, ethtool will report speed and duplex as...
pci: rename pci_register_bar_region() to pci_register_bar()
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
e1000: convert to memory API
hw/e1000.c: convert to PCIDeviceInfo to initialize ids
use PCIDeviceInfo to initialize ids.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
PXE: Use consistent naming for PXE ROMs
And add missing ROMs to tarbin build target.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
e1000: Mask out lower bits of RDBAL/TDBAL
Rx and Tx descriptors are 16 byte aligned, so the lower bits areignored by real hardware. In fact, they always read back as zero on realhardware, but probably nobody relies on that.
Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>...
e1000: check buffer availability
Reduce spurious packet drops on RX ring emptyby verifying that we have at least 1 bufferahead of the time.
e1000: Fix multi-descriptor packet checksum offload
The PCI/PCI-X Family of Gigabit Ethernet Controllers SoftwareDeveloper’s Manual states the following about the POPTS field:
Provides a number of options which control the handling of this packet. This field is ignored except on the first data descriptor of...
e1000: verify we have buffers, upfront
The spec says: Any descriptor with a non-zero status byte has beenprocessed by the hardware, and is ready to be handled by the software.
Thus, once we change a descriptor status to non-zero we shouldnever move the head backwards and try to reuse this...
e1000: clear EOP for multi-buffer descriptors
The e1000 spec says: if software statically allocatesbuffers, and uses memory read to check for completed descriptors, itsimply has to zero the status byte in the descriptor to make it readyfor reuse by hardware. This is not a hardware requirement (moving the...
e1000: multi-buffer packet support
e1000 supports multi-buffer packets larger than rxbuf_size.
This fixes the following (on linux):- in guest: ifconfig eth1 mtu 16110- in host: ifconfig tap0 mtu 16110 ping -s 16082 <guest-ip>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes devicein firmware readable way is added into sorted list. Later this list willbe passed into firmware to control boot order.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
e1000: Make little endian
The e1000 has compatibility code to handle big endianness which makes itmandatory to be recompiled on different targets.
With the generic mmio endianness solution, there's no need for that anymore.We just declare all mmio to be little endian and call it a day....
Add endianness as io mem parameter
As stated before, devices can be little, big or native endian. Thetarget endianness is not of their concern, so we need to push thingsdown a level.
This patch adds a parameter to cpu_register_io_memory that allows adevice to choose its endianness. For now, all devices simply choose...
Merge remote branch 'origin/master' into pci
Conflicts: Makefile.objs hw/virtio.c
pci: Replace unneeded type casts in calls of pci_register_bar
There is no need for these type casts (as other existingcode shows). So re-write the first argument withouttype cast (and remove a related TODO comment).
Cc: Michael S. Tsirkin <mst@redhat.com>...
Add missing braces
This patch adds missing braces around if/else statements that callmacros which are likely to result in errors if the macro ischanged. It also makes the code comply better with CODING_STYLE.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>...
e1000: Fix TCP checksum overflow with TSO
When adding the length to the pseudo header, we're not properlyaccounting for overflow.
From: Mark Wu <dwu@redhat.com>Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
e1000: Pad short frames to minimum size (60 bytes)
The OpenIndiana (Solaris) e1000g driver drops frames that are too longor too short. It expects to receive frames of at least the Ethernetminimum size. ARP requests in particular are small and will be dropped...
qemu: e1000 fix TOR math
Patch b0b900070c7cb29bbefb732ec00397abe5de6d73 madeTOR valuer incorrect: the spec says it should alwaysinclude the CRC field.No one seems to use this field, but better to stick to spec.
Merge remote branch 'mst/for_anthony' into staging
e1000: Fix wrong microwire EEPROM state initialization
This change fixes initialization of e1000's microwire EEPROM internalstate values so that qemu's e1000 emulation works on NetBSD,which doesn't use Intel's em driver but has its own wm driverfor the Intel i8254x Gigabit Ethernet....
e1000: fix access 4 bytes beyond buffer end
We do range check for size, and get size as buffer,but copy size + 4 bytes (4 is for FCS).Let's copy size bytes but put size + 4 in length.
e1000: secrc support
Add support for secrc field. Reportedly needed by old RHEL guests.
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c
Change #define DEBUG to #define E1000_DEBUG in hw/e1000.c to makeit possible to build QEMU with -DDEBUG
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
e1000: make some tables 'const'
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
e1000: fix build on Ubuntu with _FORTIFY_SOURCE
There was a pointer cast warning on Ubuntu since _FORTIFY_SOURCE has been reenabled.
_FORTIFY_SOURCE had been disabled by 4a24470497360d8b77568b83008d0e9d6eb0787dand reenabled by 849583050d5f6f782718be8cb50688978973fbea....
e1000: add link to data sheet
Link to data sheet at intel.com so people can find it.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
e1000: switch to symbolic names for pci registers
No functional changes. I verified that the generatedobject binary does not change.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>Acked-by: Glauber Costa <glommer@gmail.com>
e1000: Don't muck with PCI commmand register
Otherwise, the driver does not work in Linux after the INT_DISABLE changes inPCI.
Michael Tsirkin had a patch to do this, I'm not sure what happened to it.
Support PCI based option rom loading
Currently, we preload option roms into the option rom space in memory. Thisprevents DDIM from functioning correctly which severely limits the numberof roms we can support.
This patch introduces a pci_add_option_rom() which registers the...
pci romfiles: add property, add default to PCIDeviceInfo
This patch adds a romfile property to the pci bus. It allows to specifya romfile to load into the rom bar of the pci device. The default valuecomes from a new field in PCIDeviceInfo. The property allows to change...
e1000: Fix warning from code review
A code review run by Steve Grubb complained about code in e1000.c:
In hw/e1000.c at line 89, vlan is declared to be 4 bytes.At line 382 is an attempt to do a memmove over it with a size of 12.
This was fixed by splitting the memmove in two calls and...
savevm: Port to qdev.vmsd all devices that have qdev
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: convert e1000 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
e1000 fix: read access to some registers is missing.
While writing working on an e1000 driver for my university's OS Inoticed that some registers aren't readable in QEMU, but they shouldbe readable as stated in Intels Driver Developer Manual (and alsoverified on real hardware)....
pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t
This patch is preliminary for 64 bit BAR support.Introduce dedicated type, pcibus_t, to represent pci bus address/sizeinstead of uint32_t.Later this type will be changed to uint64_t....
pci: introduce FMT_PCIBUS for printf format for pcibus_t.
This patch is preliminary for 64bit BAR.Later pcibus_t will be changed from uint32_t to uint64_t.Introduce FMT_PCIBUS for printf format for pcibus_t.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>...
pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h
make constants for pci base address match pci_regs.h byrenaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Acked-by: Michael S. Tsirkin <mst@redhat.com>...
v3: don't call reset functions on cpu initialization
There is absolutely no need to call reset functions when initializingdevices. Since we are already registering them, calling qemu_system_reset()should suffice. Actually, it is what happens when we reboot the machine,...
Remove e1000 rom loading hack
The gPXE rom supports BEV properly.
net: move net-checksum.c under net/
Also add a new net/checksum.h header
e1000: unfold mac_reg_tosave array
e1000: unfold mac_regarraystosave array
e1000: port to vmstate
e1000: use qdev properties for configuration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pci: move unregister from PCIDevice to PCIDeviceInfo
One more cleanup while being at it ;)
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
e1000 cleanup
Remove un needed casts from void *.Use DO_UPCAST() instead of blind casts
qdev: add return value to init() callbacks.
Sorry folks, but it has to be. One more of these invasive qdev patches.
We have a serious design bug in the qdev interface: device initcallbacks can't signal failure because the init() callback has noreturn value. This patch fixes it....
Make CPURead/WriteFunc structure 'const'
e1000.c doesn't properly emulate EERD and ICS registers
Once again, the emulation of the EERD and ICS registers in e1000.c isincorrect. Nobody has noticed this before because none of the Intel-writtene1000 drivers use these registers, and all of the independently written open...
fix for bad macaddr of e1000 in Windows 2003 server with original MS driver
The sequence of reading from eeprom is "offset by one" moved because of a falsedetection of a clock cycle after an eeprom reset. Keeping the last clock valueafter a reset keeps it in sync....
Update to a hopefully more future proof FSF address
qdev: update pci device registration.
Makes pci_qdev_register take a PCIDeviceInfo struct instead of a bunchof parameters. Also adds config_read and config_write callbacks toPCIDeviceInfo, so drivers needing these can be converted to the qdevdevice API too....
Revert "Introduce reset notifier order"
This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (andupdates later added users of qemu_register_reset), we solved theproblem it originally addressed less invasively.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Revert "Update irqs on reset and device load"
This reverts commit 3dcd219f09d6c1817bf9a132899e6b925f7a0914.
It is incorrect to call qemu_irq functions (or any other functions thataccess other device state) during savevm/loadvm.
Rename pci_register_io_region() to pci_register_bar()
This function is used to manage a PCI BAR, so make the more genericpci_register_io_region() available to other uses.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove io_index argument from cpu_register_io_memory()
The parameter is always zero except when registering the three internalio regions (ROM, unassigned, notdirty). Remove the parameter to reducethe API's power, thus facilitating future change.
Signed-off-by: Avi Kivity <avi@redhat.com>...
Merge branch 'net-queue'
Update irqs on reset and device load
Register reset functions for e1000 and rtl8139
net: add fd_readv() handler to qemu_new_vlan_client() args
This, apparently, is the style we prefer - all VLANClientStateshould be an argument to qemu_new_vlan_client().
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
net: re-name vc->fd_read() to vc->receive()
VLANClientState's fd_read() handler doesn't read from filedescriptors, it adds a buffer to the client's receive queue.
Re-name the handlers to make things a little less confusing.
net: pass VLANClientState* as first arg to receive handlers
Give static type checking a chance to catch errors.
net: add return value to packet receive handler
This allows us to handle queue full conditions rather than droppingthe packet on the floor.
e1000: Ignore reset command
When a reset is requested, the current e1000 emulation never clears thereset bit which may cause a driver to hang. This patch masks the resetbit out when setting the control registert, so the reset is immediatelycompleted....
PCI network qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Replace gcc variadic macro extension with C99 version (missed one)
e1000: Do not reinit pci config space to 0
pci_register_device already mallocs the pci config space buffer filledwith zeroes.
Doing this again breaks some default config space writes likesetting the subsystem vendor id and subsystem device id.
Signed-off-by: Amit Shah <amit.shah@redhat.com>...
Pci nic: pci_register_device can fail
The pci_register_device() call in PCI nic initialization routines canfail. Handle this failure and propagate a meaningful error message tothe user instead of generating a SEGV.
Cc: Marcelo Tosatti <mtosatti@redhat.com>...
Introduce VLANClientState::cleanup() (Mark McLoughlin)
We're currently leaking memory and file descriptors on devicehot-unplug.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
Remove NICInfo from e1000 and mipsnet state (Mark McLoughlin)
NICInfo isn't used after initialization, so remove it from the driverstate structures.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
e1000: Fix RX descriptor low threshold interrupt logic (Alex Williamson)
The RXDMT0 interrupt is supposed to fire when the number of freeRX descriptors drops to some fraction of the total descriptors.However in practice, it seems like we're adding this interrupt...
qemu: LSI SCSI and e1000 unregister callbacks (Marcelo Tosatti)
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6605 c046a42c-6fe2-441c-8c8c-71466251a162
qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti)
Change the PCI network drivers init functions to return the PCIDev, toinform which slot has been hot-plugged.
Also record PCIDevice structure on NICInfo to locate for release on...
Add and use #defines for PCI device classes
This patch adds and uses #defines for PCI device classes and subclases,using a new pci_config_set_class() function, similar to the recentlyadded pci_config_set_vendor_id() and pci_config_set_device_id().
Change since v1: fixed compilation of hw/sun4u.c...
Define PCI vendor and device IDs in pci.h (Stuart Brady)
This patch defines PCI vendor and device IDs in pci.h (matching thosefrom Linux's pci_ids.h), and uses those definitions where appropriate.
Change from v1: Introduces pci_config_set_vendor_id() / pci_config_set_device_id()...
Implement e1000 link status (Mark McLoughlin)
On link up or down we set the E1000_STATUS_LU ("link up") bitin the status register and set the E1000_ICR_LSC ("linkstatus changed") bit in the interrupt cause register beforeinterrupting the guest.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
Add a -net name=foo parameter (Mark McLoughlin)
Allow the user to supply a vlan client name on the command line.
This is probably only useful for management tools so that they canuse their own names rather than parsing the output of 'info network'.
Add qemu_format_nic_info_str() (Mark McLoughlin)
Factor out a simple little function for formatting a NIC'sinfo_str and make all NICs use it.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6218 c046a42c-6fe2-441c-8c8c-71466251a162
Add a model string to VLANClientState (Mark McLoughlin)
Don't lose track of what type/model a vlan client is so that we cane.g. assign a global per-model id to clients.
The entire patch is basically a tedious excercise in making sure thetype/model string gets propagated down to qemu_new_vlan_client()....
Update FSF address in GPL/LGPL boilerplate
The attached patch updates the FSF address in the GPL/LGPL boilerplatein most GPL/LGPLed files, and also in COPYING.LIB.
Signed-off-by: Stuart Brady <stuart.brady@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>...
Use the ARRAY_SIZE() macro where appropriate.
Change from v1: Avoid changing the existing coding style in certain files.
Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6120 c046a42c-6fe2-441c-8c8c-71466251a162
KVM: Coalesced MMIO support
MMIO exits are more expensive in KVM or Xen than in QEMU because theyinvolve, at least, privilege transitions. However, MMIO writeoperations can be effectively batched if those writes do not have sideeffects.
Good examples of this include VGA pixel operations when in a planar...
Change MMIO callbacks to use offsets, not absolute addresses.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5849 c046a42c-6fe2-441c-8c8c-71466251a162