sim-card
/
qemu
Archived
10
0
Fork 0
Commit Graph

4230 Commits

Author SHA1 Message Date
Bernhard Kohl fa82e9c300 wdt_i6300esb: register a reset function
The device shall set its default hardware state after each reset.
This includes that the timer is stopped which is especially important
if the guest does a reboot independantly of a watchdog bite. I moved
the initialization of the state variables completely from the init
to the reset function which is called right after init during the
first boot and afterwards during each reboot.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 18:36:31 +00:00
Tristan Gingold 74782223de isa-bus.c: use hw_error instead of fprintf
Minor clean-up in isa-bus.c.  Using hw_error is more consistent.
There is a difference however: hw_error dumps the cpu state.

Signed-off-by: Tristan Gingold <gingold@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 18:34:15 +00:00
Alexander Graf 3455749191 usb_ohci: Always use little endian
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Because we don't depend on the target endianness anymore, we can also
move the driver over to Makefile.objs.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 968d683c04 isa_mmio: Always use little endian
This patch converts the ISA MMIO bridge code to always use little endian mmio.
All bswap code that existed was only there to convert from native cpu
endianness to little endian ISA devices.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf b093c1a327 heathrow_pic: Declare as little endian
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 5cf7a3ca5b rtl8139: Declare as little endian
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Because we don't depend on the target endianness anymore, we can also
move the driver over to Makefile.objs.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 82600641c1 openpic: Replace explicit byte swap with endian hints
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 0d2a73b3ab ppc4xx_pci: Declare as little endian
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 387c3e96bf versatile_pci: Declare as little endian
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 8cb7da5618 prep: Declare as little endian
This patch replaces explicit bswaps with endianness hints to the
mmio layer.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 32600a309f e1000: Make little endian
The e1000 has compatibility code to handle big endianness which makes it
mandatory 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.

Because we don't depend on the target endianness anymore, we can also
move the driver over to Makefile.objs.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf f23cea4d04 uninorth: Get rid of bswap
There's no need to bswap once we correctly set the mmio to be little endian.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:26 +00:00
Alexander Graf 6ebf5905f4 pci-host: Delegate bswap to mmio layer
The only reason we have bswap versions of the pci host code is that
most pci host devices are little endian. The ppc e500 is the only
odd one here, being big endian.

So let's directly pass the endianness down to the mmio layer and not
worry about it on the pci host layer.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:25 +00:00
Alexander Graf 0f4f039b98 dbdma: Make little endian
The device is only used on big endian systems, but always byte swaps. That's
a very good indicator that it's actually a little endian device ;-).

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:25 +00:00
Alexander Graf 6bef043655 Make simple io mem handler endian aware
As an alternative to the 3 individual handlers, there is also a simplified
io mem hook function. To be consistent, let's add an endianness parameter
there too.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:25 +00:00
Alexander Graf 2507c12ab0 Add endianness as io mem parameter
As stated before, devices can be little, big or native endian. The
target endianness is not of their concern, so we need to push things
down a level.

This patch adds a parameter to cpu_register_io_memory that allows a
device to choose its endianness. For now, all devices simply choose
native endian, because that's the same behavior as before.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-11 15:24:25 +00:00
Michael S. Tsirkin 513691b7ff pci/aer: factor out common code
Same logic is used to assert interrupts
and send msix messages, so add a static functin for this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-09 12:48:31 +02:00
Michael S. Tsirkin 5f47c187d9 pci/aer: remove dead code
Remove some unused variables and return values.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-12-09 12:48:29 +02:00
Michael S. Tsirkin 2b3cb353e7 pci/aer: fix interrupt on config write
config write handling for aer seems broken:
For example, it won't clear a level interrupt
when command register is set to 0.

Make it match the spec: level should equal
the logical or of enabled bits, msi only
be sent when the logical or changes.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-12-09 12:48:27 +02:00
Michael S. Tsirkin c3f33667a6 pci/aer: fix error injection
Fix the injection logic upon aer message to follow 6.2.4.1.2 more
closely: specifically only send an msi interrupt when the logical or of
the enabled bits changed, not when a bit which was previously clear
becomes set.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-12-09 12:48:26 +02:00
Michael S. Tsirkin 4a9dd66582 pci: untangle pci/msi dependency
msi depends on pci but pci should not depend on msi.
The only dependency we have is a recent addition
of pci_msi_ functions, IMO they add little enough to
open-code in the small number of users.

Follow-up patches add more cleanups.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2010-12-09 12:48:18 +02:00
Isaku Yamahata b1aeb92666 pci: make command SERR bit writable
pcie aer needs SERR bit to be writable, and the PCI spec requires
this as well.  For compatibility, introduce compat global property
command_serr_enable and make this bit readonly for a pre 0.14 pc
machine.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-09 12:47:48 +02:00
Michael S. Tsirkin 783e770693 virtio-net: stop/start bh when appropriate
Avoid sending out packets, and modifying
memory, when VM is stopped.
Add assert statements to verify this does not happen.

Avoid scheduling bh when vhost-net is started.

Stop bh when driver disabled bus mastering
(we must not access memory after this).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-09 12:47:48 +02:00
Michael S. Tsirkin 9547732304 virtio-net: don't dma while vm is stopped
DMA into memory while VM is stopped makes it
hard to debug migration (consequitive saves
result in different files).
Fixing this completely is a large effort,
this patch does this for virtio-net.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-09 12:47:48 +02:00
Blue Swirl e6e055c9d7 Fix mingw32 and OpenBSD warnings
ffsl() is not universally available, so there are these warnings
on both mingw32 and OpenBSD:
/src/qemu/hw/pcie_aer.c: In function 'pcie_aer_update_log':
/src/qemu/hw/pcie_aer.c:399: warning: implicit declaration of function 'ffsl'

Since status field in PCIEAERErr is uint32_t, we can just use ffs() instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-04 18:36:22 +00:00
Hidetoshi Seto 3867142346 virtio-9p: fix build on !CONFIG_UTIMENSAT
This patch introduce a fallback mechanism for old systems that do not
support utimensat().  This fix build failure with following warnings:

hw/virtio-9p-local.c: In function 'local_utimensat':
hw/virtio-9p-local.c:479: warning: implicit declaration of function 'utimensat'
hw/virtio-9p-local.c:479: warning: nested extern declaration of 'utimensat'

and:

hw/virtio-9p.c: In function 'v9fs_setattr_post_chmod':
hw/virtio-9p.c:1410: error: 'UTIME_NOW' undeclared (first use in this function)
hw/virtio-9p.c:1410: error: (Each undeclared identifier is reported only once
hw/virtio-9p.c:1410: error: for each function it appears in.)
hw/virtio-9p.c:1413: error: 'UTIME_OMIT' undeclared (first use in this function)
hw/virtio-9p.c: In function 'v9fs_wstat_post_chmod':
hw/virtio-9p.c:2905: error: 'UTIME_OMIT' undeclared (first use in this function)

[NOTE: At this time virtio-9p is only user of utimensat(), and is available
       only when host is linux and CONFIG_VIRTFS is defined.  So there are
       no similar warning for win32.  Please provide a wrapper for win32 in
       oslib-win32.c if new user really requires it.]

v5:
  - Allow fallback on runtime
  - Move qemu_utimensat() to oslib-posix.c
  - Rebased on latest qemu.git
v4:
  - Use tv_now.tv_usec
v3:
  - Use better alternative handling for UTIME_NOW/OMIT
  - Move qemu_utimensat() to cutils.c
V2:
  - Introduce qemu_utimensat()

Acked-by: Chris Wright <chrisw@sous-sol.org>
Acked-by: M. Mohan Kumar <mohan@in.ibm.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-12-02 16:08:40 -08:00
Kusanagi Kouichi 0562c67432 virtio-9p: Check the return value of llistxattr.
If llistxattr returned 0, qemu aborts.

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-12-02 16:08:27 -08:00
Harsh Prateek Bora d04e2826f5 hw/virtio9p: Use appropriate debug print functions in TLINK path
Running fsstress with debug enabled causes assertion failure
because of inappropriate usage of debug print functions.
With this patch, fsstress passes without assertion failure.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-12-02 16:07:49 -08:00
Venkateswararao Jujjuri (JV) 49594973fb [virtio-9p] Add datasync to server side TFSYNC/RFSYNC for dotl
SYNOPSIS
    size[4] Tfsync tag[2] fid[4] datasync[4]

    size[4] Rfsync tag[2]

DESCRIPTION

    The Tfsync transaction transfers ("flushes") all modified in-core data of
    file identified by fid to the disk device (or other  permanent  storage
    device)  where that  file  resides.

    If datasync flag is specified data will be fleshed but does not flush
    modified metadata unless  that  metadata  is  needed  in order to allow a
    subsequent data retrieval to be correctly handled.

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
2010-12-02 16:06:47 -08:00
Jason Wang 0c600ce2a7 vhost: Fix address calculation in vhost_dev_sync_region()
We still need advance address even we find there's no dirty pages in
current chunk.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-02 21:13:39 +02:00
Michael S. Tsirkin 3d002df33e migration: allow rate > 4g
I'd like to disable bandwidth limit or make it very high,
Use int64_t all over to make values >= 4g work.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-02 21:13:39 +02:00
Michael S. Tsirkin c924f36a30 Merge remote branch 'origin/master' into pci
Conflicts:
	Makefile.objs
	hw/virtio.c
2010-12-01 07:11:51 +02:00
Anthony Liguori 09fa35e5cd Merge remote branch 'kwolf/for-anthony' into staging 2010-11-30 15:25:34 -06:00
Kevin Wolf b76876e602 ide: Reset current_addr after stopping DMA
Whenever SSBM is reset in the command register all state information is lost.
Restarting DMA means that current_addr must be reset to the base address of the
PRD table. The OS is not required to change the base address register before
starting a DMA operation, it can reuse the value it wrote for an earlier
request.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:04 +01:00
Kevin Wolf c29947bbb0 ide: Ignore double DMA transfer starts/stops
You can only start a DMA transfer if it's not running yet, and you can only
cancel it if it's running.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:02 +01:00
Kevin Wolf e3982b3cf6 ide: Set bus master inactive on error
BMIDEA in the status register must be cleared on error. This makes FreeBSD
respond (more) correctly to I/O errors.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:01 +01:00
Kevin Wolf 8337606d35 ide: Factor ide_dma_set_inactive out
Several places that stop a DMA transfer duplicate this code. Factor it out into
a common function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:01 +01:00
Paul Brook 661a1799ba Add pcnet-pci.c
Add file missing from last commit.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 11:56:02 +00:00
Paul Brook a4c75a21f3 Split out common pcnet code
The core pcnet emulation code is used by both the PCI "pcnet" device
and the SPARC "lance" device.  Split the common code frm the PCI code so
that that can be configures independantly.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 11:23:34 +00:00
Hannes Reinecke 2dd791b630 scsi-disk: Remove duplicate cdb parsing
We parse the CDB twice, which is completely unnecessary.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:51:50 +01:00
Hannes Reinecke a6d96eb78b scsi: Move sense handling into the driver
The current sense handling in scsi-bus is only used by the
scsi-disk driver; the scsi-generic driver is using its own.
So we should move the current sense handling into the
scsi-disk driver.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:19:28 +01:00
Hannes Reinecke 39d989823f scsi: INQUIRY VPD fixes
We should announce and support the block device characterics page
only on block devices, not on CDROMs. And the VPD page 0x83 has
an off-by-one error.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:15:23 +01:00
Hannes Reinecke f017132793 scsi: Return SAM status codes
Traditionally, the linux stack is using SCSI status codes
which are shifted by one as compared to those defined in SAM.
A SCSI emulation should naturally return the SAM defined codes,
not the linux ones.
So to avoid any confusion this patch modifies the existing
definitions to match those found in SAM and removes any
(now obsolete) byte-shift from the returned status codes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:00:10 +01:00
Hannes Reinecke 622b520fb4 scsi: Increase the number of possible devices
The SCSI parallel interface has a limit of 8 devices, but
not the SCSI stack in general. So we should be removing the
hard-coded limit and use MAX_SCSI_DEVS instead.
And we only need to scan those devices which are allocated
by the bus.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 11:57:32 +01:00
Stefano Stabellini 5cbdebe39e qemu and qemu-xen: support empty write barriers in xen_disk
This patch can be applied to both qemu-xen and qemu and adds support
for empty write barriers to xen_disk.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24 17:31:06 +01:00
Avi Kivity 9fbef1ac7c ide: convert bmdma address ioport to ioport_register()
cmd646, via compile tested, pci lightly boot tested.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24 17:31:06 +01:00
Stefan Hajnoczi 6fa2c95f27 scsi-disk: Move active request asserts
SCSI read/write requests should not be re-issued before the current
fragment of I/O completes.  There are asserts in scsi-disk.c that guard
this constraint but they trigger on SPARC Linux 2.4.  It turns out that
the asserts are too early in the code path and don't allow for read
requests to terminate.

Only the read assert needs to be moved but move the write assert too for
consistency.

Reported-by: Nigel Horne <njh@bandsman.co.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24 17:30:19 +01:00
Michael S. Tsirkin 1abeb5a65d virtio: fix up VQ checks
When migration triggers before a VQ is initialized,
base pa is 0 and last_used_index must be 0 too:
we don't have a ring to compare to.

Reported-by: Juan Quintela <quintela@redhat.com>
Tested-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-24 17:25:44 +02:00
Stefan Hajnoczi ce67ed6500 virtio: Convert fprintf() to error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit cd92f4cc22)
2010-11-24 17:25:35 +02:00
Michael S. Tsirkin 929176c3b9 pci: fix bus walk under secondary bus reset
Take into account secondary bus reset bit for
bus walk: devices behind a reset bus should not
respond to configuration cycles.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-24 17:04:59 +02:00
Isaku Yamahata a5fce077b1 pci bridge: implement secondary bus reset
Trigger secondary bus reset when secondary bus reset bit
value changes from 0 to 1.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Isaku Yamahata 9bb3358627 pci: use qdev reset framework for pci bus reset
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Isaku Yamahata 5af0a04bea qdev: trigger reset from a given device
Introduce a helper function which triggers reset from a given device.
Will be used by pci bus emulation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Isaku Yamahata b4694b7ce8 qdev: introduce reset call back for qbus level
and make it called via qbus_reset_all().
The qbus reset callback will be used by pci bus reset.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Anthony Liguori ec990eb622 qdev: reset qdev along with qdev tree
This patch changes the reset handling so that qdev has no knowledge of the
global system reset.  Instead, a new bus/device level function is introduced
that allows all devices/buses on the bus/device to be reset using a depth
first transversal.

N.B. we have to expose the implicit system bus because we have various hacks
that result in an implicit system bus existing.  Instead, we ought to have an
explicitly created system bus that we can trigger reset from.  That's a topic
for a future patch though.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Anthony Liguori 81699d8a90 qbus: add functions to walk both devices and busses
There are some cases where you want to walk the busses, in particular, when
searching for a bus either by name or DeviceInfo.
Paolo suggested that we model the return values on how GCC's walkers work which
allows an actor to skip child transversal, or terminate walking with a positive
value that's returned as the qbus_walk_children's result.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Stefan Weil 0389ced419 eepro100: Use a single rom file for all i825xx devices
Patching the rom data during load (in qemu) now
also supports i82801 (which had no rom file).

We only need a single rom file for the whole device family,
so remove the second one which is no longer needed.

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Stefan Weil ab85ceb1ad pci: Automatically patch PCI vendor id and device id in PCI ROM
PCI devices with different vendor or device ids sometimes share
the same rom code. Only the ids and the checksum
differs in a boot rom for such devices.

The i825xx ethernet controller family is a typical example
which is implemented in hw/eepro100.c. It uses at least
3 different device ids, so normally 3 boot roms would be needed.

By automatically patching vendor id and device id (and the checksum)
in qemu, all emulated family members can share the same boot rom.

VGA bios roms are another example with different vendor and device ids.

Only qemu's built-in default rom files will be patched.

v2:
    * Patch also the vendor id (and remove the sanity check for vendor id).

v3:
    * Don't patch a rom file when its name was set by the user.
      Thus we avoid modifications of unknown rom data.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:07 +02:00
Stefan Weil b90c73cf47 pci: Replace unneeded type casts in calls of pci_register_bar
There is no need for these type casts (as other existing
code shows). So re-write the first argument without
type cast (and remove a related TODO comment).

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata bba5ed772a pcie/port: fix bridge control register wmask
pci generic layer initialized wmask for bridge control register
according to pci spec. pcie deviates slightly from it,
so initialize it properly.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Michael S. Tsirkin f6bdfcc935 pci: fix bridge control bit wmask
Bits 12 to 15 in bridge control register are reserver and must be
read-only zero, curent mask is 0xffff which makes them writeable. Fix
this up by using symbolic bit names for writeable bits instead of a
hardcoded constant.

Fix a comment w1mask -> w1cmask as well.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata 09b926d446 x3130/downstream: support aer.
add aer support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata a158f92fa7 x3130/upstream: support aer
add aer support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata 61620c2fff ioh3420: support aer
Add aer support.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Michael S. Tsirkin d33d9156fd pcie_aer: complete unwinding recursion
Open-code functions created in the previous patch,
to make code more compact and clear.
Detcted and documented what looks like a bug in code
that becomes apparent from this refactoring.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Michael S. Tsirkin 247c97f3f5 pcie_aer: get rid of recursion
Added some TODOs: they are trivial but omitted here
to make the patch logic as transparent as possible.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata 34e65944c0 pcie/aer: helper functions for pcie aer capability
This patch implements helper functions for pcie aer capability
which will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata 1a1ea6f093 pcie_regs.h: more constants
Add constants for PCI AER log.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Isaku Yamahata 89d437df5e pci: add W1C bits to pci status register
This patch adds W1C bit support in the initialization/reset of pci
status registers.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22 10:00:06 +02:00
Stefan Hajnoczi 4e02d460dd virtio-pci: Convert fprintf() to error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:58 -06:00
Stefan Hajnoczi e7b43f7e60 virtio-net: Convert fprintf() to error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:58 -06:00
Stefan Hajnoczi cd92f4cc22 virtio: Convert fprintf() to error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:58 -06:00
Stefan Hajnoczi 870cef1dae virtio-blk: Convert fprintf() to error_report()
Errors should be logged using error_report() so they go to the
appropriate monitor.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Gerd Hoffmann 281a26b15b vgabios update: handle compatibility with older qemu versions
As pointed out by avi the vgabios update is guest-visible and thus has
migration implications.

One change is that the vga has a valid pci rom bar now.  We already have
a pci bus property to enable/disable the rom bar and we'll load the bios
via fw_cfg as fallback for the no-rom-bar case.  So we just have to add
compat properties to handle this case.

A second change is that the magic bochs lfb @ 0xe0000000 is gone.  When
live-migrating a guest from a older qemu version it might be using the
lfb though, so we have to keep it for the old machine types.  The patch
enables the bochs lfb in case we don't have the pci rom bar enabled
(i.e. we are in 0.13+older compat mode).

This patch depends on these patches which add (and use) the pc-0.13
machine type:
  http://patchwork.ozlabs.org/patch/70797/
  http://patchwork.ozlabs.org/patch/70798/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: avi@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Jan Kiszka c1ded3dc9f pcnet: Do not receive external frames in loopback mode
While not explicitly stated in the spec, it was observed on real systems
that enabling loopback testing on the pcnet controller disables
reception of external frames. And some legacy software relies on it, so
provide this behavior.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Avi Kivity 2871a3f6b6 piix4 acpi: convert io BAR to type-safe ioport callbacks
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Gerd Hoffmann 9dbcca5aa1 virtfs: enable MSI-X
This patch enables MSI-X for virtfs-9p-pci.  It also adds a
compat property to pc-0.13 which turns it of there to stay
compatible to 0.13-stable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Gerd Hoffmann b903a0f721 pc: add 0.13 pc machine type
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Bernhard Kohl 0550f9c1b5 pc: disable the BOCHS BIOS panic port
We have an OS which writes to port 0x400 when probing for special hardware.
This causes an exit of the VM. With SeaBIOS this port isn't used anyway.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-By: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-21 09:16:57 -06:00
Alex Williamson 8ca209ad90 pc: Fix e820 fw_cfg for big endian
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Alex Williamson 67d4b0c190 pc: e820 qemu_cfg tables need to be packed
We can't let the compiler define the alignment for qemu_cfg data.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Jes Sorensen 43ad7e3e98 Add missing braces
This patch adds missing braces around if/else statements that call
macros which are likely to result in errors if the macro is
changed. It also makes the code comply better with CODING_STYLE.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Gleb Natapov d59f8ba938 Out off array access in usb-net
Properly check array bounds before accessing array element.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 14:35:00 -06:00
Adam Lackorzynski 9696846600 multiboot: Prevent loading of x86_64 images
A via -kernel supplied x86_64 ELF image is being started in 32bit mode.
Detect and exit if a 64bit image has been supplied.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 09:31:18 -06:00
Alex Williamson b538e53ee7 apic: Don't iterate past last used apic
local_apics are allocated sequentially and never removed, so
we can stop any iterations that go to MAX_APICS as soon as we
hit the first NULL.  Looking at a small guest running a virtio-net
workload with oprofile, this drops apic_get_delivery_bitmask()
from #3 in the profile to down in the noise.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-11-16 09:31:18 -06:00
Michael S. Tsirkin 4cff0a5994 pci: allow hotplug removal of cold-plugged devices
This patch fixes hot unplug of cold plugged devices
(those present at system start), which got broken by
5beb8ad503 .

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cam Macdonell <cam@cs.ualberta.ca>
Tested-by: Cam Macdonell <cam@cs.ualberta.ca>
Reported-by: Cam Macdonell <cam@cs.ualberta.ca>.
2010-11-16 08:40:08 -06:00
Alex Williamson a6a9239cd8 PCI: Bus number from the bridge, not the device
pcibus_dev_print() was erroneously retrieving the device bus
number from the secondary bus number offset of the device
instead of the bridge above the device.  This ends of landing
in the 2nd byte of the 3rd BAR for devices, which thankfully
is usually zero.

Note: pcibus_get_dev_path() copied this code,
inheriting the same bug.  pcibus_get_dev_path() is used for
ramblock naming, so changing it can effect migration.  However,
I've only seen this byte be non-zero for an assigned device,
which can't migrate anyway, so hopefully we won't run into
any issues.

This patch does not touch pcibus_get_dev_path, as
bus number is guest assigned for nested buses,
so using it for migration is broken anyway.
Fix it properly later.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-16 08:40:08 -06:00
Alex Williamson 1f892feb37 e1000: Fix TCP checksum overflow with TSO
When adding the length to the pseudo header, we're not properly
accounting 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>
2010-11-16 08:40:08 -06:00
Gerd Hoffmann 788954270d more stdvga cleanups.
video.x is gone now.  It was the only user of the
vga bios_offset + bios_size logic.  Zap it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-16 08:40:07 -06:00
Gerd Hoffmann 4eccfec494 switch vmware_vga to pci vgabios
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-16 08:40:07 -06:00
Gerd Hoffmann 543f8e3468 switch stdvga to pci vgabios
Make stdvga provide the new vgabios binary (with pcibios support)
using the PCI option rom bar.  Seabios will happily load it from
there.  The new vga bios will also lookup the framebuffer address
in pci config space, so the magic bochs lfb @ 0xe0000000 is not
needed any more -> zap it.

Without the patch:

  # dmesg | grep framebuffer
  vesafb: framebuffer at 0xe0000000, mapped to 0xf7e80000, using 1875k, total 8192k
  # lspci -vs2
  00:02.0 VGA compatible controller: Technical Corp. Device 1111 (prog-if 00 [VGA controller])
	Subsystem: Qumranet, Inc. Device 1100
	Physical Slot: 2
	Flags: fast devsel
	Memory at f0000000 (32-bit, prefetchable) [size=8M]
	Expansion ROM at <unassigned> [disabled]

With patch applied:

  # dmesg | grep framebuffer
  vesafb: framebuffer at 0xf0000000, mapped to 0xf7e80000, using 1875k, total 8192k
  # lspci -vs2
  00:02.0 VGA compatible controller: Technical Corp. Device 1111 (prog-if 00 [VGA controller])
	Subsystem: Qumranet, Inc. Device 1100
	Physical Slot: 2
	Flags: fast devsel
	Memory at f0000000 (32-bit, prefetchable) [size=8M]
	Expansion ROM at f0800000 [disabled] [size=64K]

cheers,
  Gerd

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2010-11-16 08:40:07 -06:00
Michael S. Tsirkin e927d48722 pci: allow hotplug removal of cold-plugged devices
This patch fixes hot unplug of cold plugged devices
(those present at system start), which got broken by
5beb8ad503 .

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cam Macdonell <cam@cs.ualberta.ca>
Tested-by: Cam Macdonell <cam@cs.ualberta.ca>
Reported-by: Cam Macdonell <cam@cs.ualberta.ca>.
2010-11-16 14:55:23 +02:00
Alex Williamson 7f5feab4dd PCI: Bus number from the bridge, not the device
pcibus_dev_print() was erroneously retrieving the device bus
number from the secondary bus number offset of the device
instead of the bridge above the device.  This ends of landing
in the 2nd byte of the 3rd BAR for devices, which thankfully
is usually zero.

Note: pcibus_get_dev_path() copied this code,
inheriting the same bug.  pcibus_get_dev_path() is used for
ramblock naming, so changing it can effect migration.  However,
I've only seen this byte be non-zero for an assigned device,
which can't migrate anyway, so hopefully we won't run into
any issues.

This patch does not touch pcibus_get_dev_path, as
bus number is guest assigned for nested buses,
so using it for migration is broken anyway.
Fix it properly later.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-16 14:53:43 +02:00
Alex Williamson e685b4eb64 e1000: Fix TCP checksum overflow with TSO
When adding the length to the pseudo header, we're not properly
accounting 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>
2010-11-13 23:22:08 +02:00
Gerd Hoffmann df0db2212d intel-hda: fix codec addressing.
The HDA bus supports up to 15 codecs, with addresses 0 ... 14.
We get that wrong in two places:

 * When handing out addresses we accept address 15 as valid.
 * The bitmasks for two registers (WAKEEN and STATESTS) don't
   have bit 14 set.

This patch fixes it.

[ v2: codestyle: add braces ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 19:32:59 +03:00
malc e2553eb44e Revert "intel-hda: fix codec addressing."
Misses braces

This reverts commit acc086837e.
2010-11-09 19:14:15 +03:00
Gerd Hoffmann acc086837e intel-hda: fix codec addressing.
The HDA bus supports up to 15 codecs, with addresses 0 ... 14.
We get that wrong in two places:

 * When handing out addresses we accept address 15 as valid.
 * The bitmasks for two registers (WAKEEN and STATESTS) don't
   have bit 14 set.

This patch fixes it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
Gerd Hoffmann 17786d52ac intel-hda: add msi support
This patch adds MSI support to the intel hda audio driver.  It is
enabled by default, use '-device intel-hda,msi=0' to disable it.

[ v2: codestyle: add braces ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
Gerd Hoffmann 6a0d02f5be intel-hda: update irq status on WAKEEN changes.
When the guest updates the WAKEEN register we
must re-calculate the IRQ status.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00
François Revol af93485cde intel-hda: Honor WAKEEN bits.
HDA: Honor WAKEEN bits when deciding to raise an interrupt on codec
status change.  This prevents an interrupt storm with the Haiku HDA
driver which does not handle codec status changes in the irq handler.

Signed-off-by: François Revol <revol@free.fr>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2010-11-09 16:51:12 +03:00