sdk/emulator/qemu.git
12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:18:44 +0000 (10:18 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  pci_bridge_dev: fix error path in pci_bridge_dev_initfn()
  qdev: release parent properties on dc->init failure
  msi: Use msi/msix_present more consistently
  msi: Invoke msi/msix_write_config from PCI core
  msi: Guard msi/msix_write_config with msi_present
  msi: Invoke msi/msix_reset from PCI core
  msi: Guard msi_reset with msi_present
  ahci: Clean up reset functions
  intel-hda: Fix reset of MSI function
  ahci: Fix reset of MSI function
  rtl8139: honor RxOverflow flag in can_receive method
  shpc: unparent device before free

12 years agoMerge remote-tracking branch 'sweil/for-anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:18:26 +0000 (10:18 -0500)]
Merge remote-tracking branch 'sweil/for-anthony' into staging

* sweil/for-anthony:
  Fix some more license versions (GPL2+ instead of GPL2)
  dump: Fix license version (GPL2+ instead of GPL2)
  configure: Fix build for some versions of glibc (9pfs)
  monitor: Fix memory leak with readline completion

12 years agoaudio/winwave: Fix typo
malc [Fri, 15 Jun 2012 16:58:54 +0000 (20:58 +0400)]
audio/winwave: Fix typo

Signed-off-by: malc <av1474@comtv.ru>
12 years agoMerge branch 'master' of git://git.qemu.org/qemu
malc [Fri, 15 Jun 2012 11:53:34 +0000 (15:53 +0400)]
Merge branch 'master' of git://git.qemu.org/qemu

12 years agoqcow2: Silence false warning
Kevin Wolf [Fri, 15 Jun 2012 11:43:18 +0000 (13:43 +0200)]
qcow2: Silence false warning

Some gcc versions seem not to be able to figure out that the switch
statement covers all possible values and that c is therefore always
initialised. Add a default branch for them.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
12 years agocris: Fix NMI-flag handling on crisv10.
Lars Persson [Thu, 14 Jun 2012 14:23:55 +0000 (16:23 +0200)]
cris: Fix NMI-flag handling on crisv10.

- The M-flag is encoded in different bits on cris v10 and cris v32.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_axidma: changed device name
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:51 +0000 (14:46 +1000)]
xilinx_axidma: changed device name

Changed device name to xlnx,axi-dma. This is the exact name of the device in the
Xilinx EDK development tools.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_axienet: changed device name
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:49 +0000 (14:46 +1000)]
xilinx_axienet: changed device name

Changed device name to xlnx,axi-ethernet. This is the exact name of the
device in the xilinx EDK development tools.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_axienet: droped the c_ on parameters
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:48 +0000 (14:46 +1000)]
xilinx_axienet: droped the c_ on parameters

Even though the xilinx tools do have C_ on all params by default, drop this
for consistency with all the other xilinx IP (I.E. param names are the xilinx
names without the C_ prefix)

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_ethlite: changed device name
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:47 +0000 (14:46 +1000)]
xilinx_ethlite: changed device name

Changed device name to xlnx,xps-ethernetlite. This is the exact name of the
device in the xilinx EDK development tools.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_ethlite: tweaked naming of ping-pong props
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:46 +0000 (14:46 +1000)]
xilinx_ethlite: tweaked naming of ping-pong props

Changed "txpingpong" prop to "tx-ping-pong". Same for rx. This is done to
make the property name exactly match what is output by the xilinx tools for
this IP.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_intc: changed device name
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:45 +0000 (14:46 +1000)]
xilinx_intc: changed device name

Changed device name to xlnx,xps-intc. This is the exact name of the device
in the xilinx EDK development tools.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_timer: changed device name
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:44 +0000 (14:46 +1000)]
xilinx_timer: changed device name

Changed device name to xlnx,xps-timer. This is the exact name of the device
in the xilinx EDK development tools.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_timer: changed nr_timers to one_timer_only
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:43 +0000 (14:46 +1000)]
xilinx_timer: changed nr_timers to one_timer_only

The configurable property for this IP in the Xilinx tools is a boolean switch
"one-timer-only" that flicks this timer from being dual channel to single.
Updated QEMU to work the same way for better match with the IP core and its TRM.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_timer: added default frequency
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:42 +0000 (14:46 +1000)]
xilinx_timer: added default frequency

Added a reasonable default frequency for the xilinx timer (the 62MHz from
s3adsp machine model).

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_uartlite: changed device name
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:41 +0000 (14:46 +1000)]
xilinx_uartlite: changed device name

Changed device name to xlnx,xps-uartlite. This is the exact name of the device
in the xilinx EDK development tools.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_axidma: (un)reversed irq initialisation
Peter A. G. Crosthwaite [Wed, 13 Jun 2012 04:46:50 +0000 (14:46 +1000)]
xilinx_axidma: (un)reversed irq initialisation

The axidma irq orders are reversed in both the device model and the instantion.
Undid both reversal (for no net change). Also needs to be reversed for
consistency with Xilinx tools IRQ listing.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoxilinx_axi*: Share devices between microblaze and microblazeel
Andreas Färber [Sat, 9 Jun 2012 01:54:31 +0000 (03:54 +0200)]
xilinx_axi*: Share devices between microblaze and microblazeel

Speeds up the build.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoqemu-log: Allow usage in libhw
Andreas Färber [Sat, 9 Jun 2012 01:54:30 +0000 (03:54 +0200)]
qemu-log: Allow usage in libhw

Add #ifdef to avoid complaint about use of poisoned "env".

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agohw/xilinx_*: Share Xilinx devices between ppc and microblaze
Andreas Färber [Sat, 9 Jun 2012 01:54:29 +0000 (03:54 +0200)]
hw/xilinx_*: Share Xilinx devices between ppc and microblaze

Speeds up the build.

xilinx_ethlite uses tswap32() and is thus target-dependent.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agocris: Add break support for v10.
Edgar E. Iglesias [Tue, 5 Jul 2011 10:56:41 +0000 (12:56 +0200)]
cris: Add break support for v10.

Still no retb

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
12 years agoFix some more license versions (GPL2+ instead of GPL2)
Stefan Weil [Sun, 10 Jun 2012 19:49:18 +0000 (19:49 +0000)]
Fix some more license versions (GPL2+ instead of GPL2)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
12 years agodump: Fix license version (GPL2+ instead of GPL2)
Stefan Weil [Sun, 10 Jun 2012 19:34:04 +0000 (19:34 +0000)]
dump: Fix license version (GPL2+ instead of GPL2)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
12 years agoconfigure: Fix build for some versions of glibc (9pfs)
Stefan Weil [Wed, 6 Jun 2012 19:35:57 +0000 (19:35 +0000)]
configure: Fix build for some versions of glibc (9pfs)

Some versions declare open_by_handle_at, but don't define AT_EMPTY_PATH.
Extend the check in configure to test both preconditions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
12 years agomonitor: Fix memory leak with readline completion
Stefan Weil [Mon, 14 May 2012 09:47:20 +0000 (09:47 +0000)]
monitor: Fix memory leak with readline completion

Each string which is shown during readline completion in the QEMU monitor
is allocated dynamically but currently never deallocated.

Add the missing loop which calls g_free for the allocated strings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agopci_bridge_dev: fix error path in pci_bridge_dev_initfn()
Jason Baron [Thu, 3 May 2012 02:42:15 +0000 (22:42 -0400)]
pci_bridge_dev: fix error path in pci_bridge_dev_initfn()

Currently, we do not properly cleanup, if pci_bridge_dev_initfn
fails to initialize properly. Make sure to call pci_bridge_exitfn()
in the error path.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoqdev: release parent properties on dc->init failure
Jason Baron [Thu, 3 May 2012 02:42:10 +0000 (22:42 -0400)]
qdev: release parent properties on dc->init failure

While looking into hot-plugging bridges, I can create a qemu segfault via:

$ device_add pci-bridge

Bridge chassis not specified. Each bridge is required to be assigned a unique chassis id > 0.
**
ERROR:qom/object.c:389:object_delete: assertion failed: (obj->ref == 0)

I'm proposing to fix this by adding a call to 'object_unparent()', before the
call to qdev_free(). I see there is already a precedent for this usage pattern as
seen in qdev_simple_unplug_cb():

/* can be used as ->unplug() callback for the simple cases */
int qdev_simple_unplug_cb(DeviceState *dev)
{
    /* just zap it */
    object_unparent(OBJECT(dev));
    qdev_free(dev);
    return 0;
}

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 11 Jun 2012 17:15:52 +0000 (12:15 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvm: i8254: Fix conversion of in-kernel to userspace state
  kvm/apic: correct short memset

12 years agoMerge remote-tracking branch 'sstabellini/for_1.1.1' into staging
Anthony Liguori [Mon, 11 Jun 2012 17:15:51 +0000 (12:15 -0500)]
Merge remote-tracking branch 'sstabellini/for_1.1.1' into staging

* sstabellini/for_1.1.1:
  qemu/xendisk: set maximum number of grants to be used

12 years agoMerge remote-tracking branch 'afaerber-or/qom-cpu-3a' into staging
Anthony Liguori [Mon, 11 Jun 2012 17:15:51 +0000 (12:15 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-cpu-3a' into staging

* afaerber-or/qom-cpu-3a: (27 commits)
  target-s390x: Pass S390CPU to s390_cpu_restart()
  s390-virtio: Let s390_cpu_addr2state() return S390CPU
  s390-virtio: Use cpu_s390x_init() to obtain S390CPU
  target-s390x: Let cpu_s390x_init() return S390CPU
  xen_machine_pv: Use cpu_x86_init() to obtain X86CPU
  arm_pic: Pass ARMCPU to arm_pic_init_cpu()
  arm_boot: Pass ARMCPU to arm_load_kernel()
  xilinx_zynq: Use cpu_arm_init() to obtain ARMCPU
  pxa2xx_gpio: Store ARMCPU in PXA2xxGPIOInfo
  pxa2xx_pic: Store ARMCPU in PXA2xxPICState
  pxa2xx: Pass ARMCPU to pxa2xx_pic_init()
  exynos4210: Use cpu_arm_init() to store ARMCPU
  vexpress: Use cpu_arm_init() to obtain ARMCPU
  realview: Use cpu_arm_init() to obtain ARMCPU
  arm_boot: Pass ARMCPU to arm_boot_info::secondary_cpu_reset_hook()
  arm_boot: Pass ARMCPU to arm_boot_info::write_secondary_boot()
  versatilepb: Use cpu_arm_init() to obtain ARMCPU
  musicpal: Use cpu_arm_init() to obtain ARMCPU
  integratorcp: Use cpu_arm_init() to obtain ARMCPU
  strongarm: Use cpu_arm_init() to store ARMCPU in StrongARMState
  ...

12 years agoMerge remote-tracking branch 'afaerber-or/qom-next-1' into staging
Anthony Liguori [Mon, 11 Jun 2012 17:15:51 +0000 (12:15 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-next-1' into staging

* afaerber-or/qom-next-1:
  target-i386: Use uint32 visitor for [x]level properties
  qdev: Remove PropertyInfo range checking
  qdev: Switch property accessors to fixed-width visitor interfaces
  qdev: Use int32_t container for devfn property
  qapi: Add String visitor coverage to serialization unit tests
  qapi: String visitor, use %f representation for floats
  qapi: Unit tests for visitor-based serialization
  qapi: Add Visitor interfaces for uint*_t and int*_t

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 11 Jun 2012 17:15:51 +0000 (12:15 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  configure: report missing libraries for virtfs
  trace/simple.c: fix deprecated glib2 interface
  Clarify comments of tb_invalidate_phys_[page_]range

12 years agoMerge remote-tracking branch 'kraxel/usb.52' into staging
Anthony Liguori [Mon, 11 Jun 2012 17:07:00 +0000 (12:07 -0500)]
Merge remote-tracking branch 'kraxel/usb.52' into staging

* kraxel/usb.52: (37 commits)
  ehci: rework frame skipping
  ehci: adaptive wakeup rate.
  ehci: create ehci_update_frindex
  ehci: remove unused attach_poll_counter
  ehci: fix halt status handling
  ehci: update status bits in ehci_set_state
  ehci: add ehci_*_enabled() helpers
  ehci: fix reset
  ehci: kick async schedule on wakeup
  ehci: schedule async bh on async packet completion
  ehci: move async schedule to bottom half
  ehci: add async field to EHCIQueue
  ehci: tweak queue initialization
  ehci: add queuing support
  ehci: move ehci_flush_qh
  ehci: cache USBDevice in EHCIQueue
  ehci: make ehci_execute work on EHCIPacket instead of EHCIQueue
  ehci: add EHCIPacket
  xhci: trace: slots
  xhci: trace: transfers
  ...

12 years agokvm: i8254: Fix conversion of in-kernel to userspace state
Jan Kiszka [Wed, 6 Jun 2012 14:28:42 +0000 (16:28 +0200)]
kvm: i8254: Fix conversion of in-kernel to userspace state

Due to a offset between the clock used to generate the in-kernel
count_load_time (CLOCK_MONOTONIC) and the clock used for processing this
in userspace (vm_clock), reading back the output of PIT channel 2 via
port 0x61 was broken. One use cases that suffered from it was the CPU
frequency calibration of SeaBIOS, which also affected IDE/AHCI timeouts.

This fixes it by calibrating the offset between both clocks on
kvm_pit_get and adjusting the kernel value before saving it in the
userspace state. As the calibration only works while the vm_clock is
running, we cache the in-kernel state across stopped phases.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoqemu/xendisk: set maximum number of grants to be used
Jan Beulich [Mon, 11 Jun 2012 09:52:27 +0000 (09:52 +0000)]
qemu/xendisk: set maximum number of grants to be used

Legacy (non-pvops) gntdev drivers may require this to be done when the
number of grants intended to be used simultaneously exceeds a certain
driver specific default limit.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agokvm/apic: correct short memset
Jim Meyering [Thu, 10 May 2012 16:19:47 +0000 (18:19 +0200)]
kvm/apic: correct short memset

kvm_put_apic_state's attempt to clear *kapic before setting its
bits cleared sizeof(void*) bytes (no more than 8) rather than the
intended 1024 (KVM_APIC_REG_SIZE) bytes. Spotted by coverity.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agotarget-s390x: Pass S390CPU to s390_cpu_restart()
Andreas Färber [Thu, 3 May 2012 02:32:00 +0000 (04:32 +0200)]
target-s390x: Pass S390CPU to s390_cpu_restart()

Needed for qemu_cpu_kick().

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agos390-virtio: Let s390_cpu_addr2state() return S390CPU
Andreas Färber [Thu, 3 May 2012 02:28:14 +0000 (04:28 +0200)]
s390-virtio: Let s390_cpu_addr2state() return S390CPU

Convert ipi_states to S390CPU**.

Needed for s390_cpu_restart() in handle_sigp().

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agos390-virtio: Use cpu_s390x_init() to obtain S390CPU
Andreas Färber [Thu, 3 May 2012 02:16:07 +0000 (04:16 +0200)]
s390-virtio: Use cpu_s390x_init() to obtain S390CPU

Needed to store S390CPU in ipi_states[].

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-s390x: Let cpu_s390x_init() return S390CPU
Andreas Färber [Thu, 3 May 2012 02:13:04 +0000 (04:13 +0200)]
target-s390x: Let cpu_s390x_init() return S390CPU

Let cpu_init() return CPUS390XState for backwards compatibility.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoxen_machine_pv: Use cpu_x86_init() to obtain X86CPU
Andreas Färber [Tue, 22 May 2012 23:51:57 +0000 (01:51 +0200)]
xen_machine_pv: Use cpu_x86_init() to obtain X86CPU

Needed for moving halted field to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
12 years agoarm_pic: Pass ARMCPU to arm_pic_init_cpu()
Andreas Färber [Mon, 14 May 2012 02:21:52 +0000 (04:21 +0200)]
arm_pic: Pass ARMCPU to arm_pic_init_cpu()

Pass it through to arm_pic_cpu_handler().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> (for exynos)
12 years agoarm_boot: Pass ARMCPU to arm_load_kernel()
Andreas Färber [Mon, 14 May 2012 00:39:57 +0000 (02:39 +0200)]
arm_boot: Pass ARMCPU to arm_load_kernel()

In particular this simplifies the &s->mpu->cpu->env expression again.

first_cpu and ->next_cpu are expected to be QOM'ified later.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> (for exynos)
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoxilinx_zynq: Use cpu_arm_init() to obtain ARMCPU
Andreas Färber [Mon, 14 May 2012 00:55:25 +0000 (02:55 +0200)]
xilinx_zynq: Use cpu_arm_init() to obtain ARMCPU

Needed for arm_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com>
12 years agopxa2xx_gpio: Store ARMCPU in PXA2xxGPIOInfo
Andreas Färber [Thu, 3 May 2012 22:23:14 +0000 (00:23 +0200)]
pxa2xx_gpio: Store ARMCPU in PXA2xxGPIOInfo

Prepares for moving halted field into CPUState.

Add missing braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agopxa2xx_pic: Store ARMCPU in PXA2xxPICState
Andreas Färber [Thu, 3 May 2012 22:05:29 +0000 (00:05 +0200)]
pxa2xx_pic: Store ARMCPU in PXA2xxPICState

Prepares for moving halted field to CPUState.

Add missing braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agopxa2xx: Pass ARMCPU to pxa2xx_pic_init()
Andreas Färber [Thu, 3 May 2012 22:01:27 +0000 (00:01 +0200)]
pxa2xx: Pass ARMCPU to pxa2xx_pic_init()

Cleans up after storing ARMCPU in PXA2xxState.
Prepares for storing ARMCPU in PXA2xxPICState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoexynos4210: Use cpu_arm_init() to store ARMCPU
Andreas Färber [Mon, 14 May 2012 02:09:55 +0000 (04:09 +0200)]
exynos4210: Use cpu_arm_init() to store ARMCPU

Needed for arm_pic_init_cpu().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
12 years agovexpress: Use cpu_arm_init() to obtain ARMCPU
Andreas Färber [Mon, 14 May 2012 01:58:46 +0000 (03:58 +0200)]
vexpress: Use cpu_arm_init() to obtain ARMCPU

Needed for arm_pic_init_cpu().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agorealview: Use cpu_arm_init() to obtain ARMCPU
Andreas Färber [Mon, 14 May 2012 01:50:56 +0000 (03:50 +0200)]
realview: Use cpu_arm_init() to obtain ARMCPU

Needed for arm_pic_init_cpu().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoarm_boot: Pass ARMCPU to arm_boot_info::secondary_cpu_reset_hook()
Andreas Färber [Sun, 13 May 2012 23:05:40 +0000 (01:05 +0200)]
arm_boot: Pass ARMCPU to arm_boot_info::secondary_cpu_reset_hook()

Adapt highbank accordingly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoarm_boot: Pass ARMCPU to arm_boot_info::write_secondary_boot()
Andreas Färber [Sun, 13 May 2012 22:08:10 +0000 (00:08 +0200)]
arm_boot: Pass ARMCPU to arm_boot_info::write_secondary_boot()

Adapt exynos4210 and highbank accordingly.
The parameter itself is unused.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> (for exynos)
12 years agoversatilepb: Use cpu_arm_init() to obtain ARMCPU
Andreas Färber [Mon, 14 May 2012 00:04:38 +0000 (02:04 +0200)]
versatilepb: Use cpu_arm_init() to obtain ARMCPU

Needed for arm_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agomusicpal: Use cpu_arm_init() to obtain ARMCPU
Andreas Färber [Sun, 13 May 2012 23:54:18 +0000 (01:54 +0200)]
musicpal: Use cpu_arm_init() to obtain ARMCPU

Needed for arm_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agointegratorcp: Use cpu_arm_init() to obtain ARMCPU
Andreas Färber [Sun, 13 May 2012 23:51:01 +0000 (01:51 +0200)]
integratorcp: Use cpu_arm_init() to obtain ARMCPU

Needed for arm_load_kernel().

Add missing braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agostrongarm: Use cpu_arm_init() to store ARMCPU in StrongARMState
Andreas Färber [Sun, 13 May 2012 23:42:57 +0000 (01:42 +0200)]
strongarm: Use cpu_arm_init() to store ARMCPU in StrongARMState

Adapt collie accordingly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoz2: Rename PXA2xxState variable
Andreas Färber [Sun, 13 May 2012 23:25:55 +0000 (01:25 +0200)]
z2: Rename PXA2xxState variable

Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotosa: Rename PXA2xxState variable
Andreas Färber [Sun, 13 May 2012 23:24:05 +0000 (01:24 +0200)]
tosa: Rename PXA2xxState variable

Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agospitz: Rename PXA2xxState variable
Andreas Färber [Sun, 13 May 2012 23:22:03 +0000 (01:22 +0200)]
spitz: Rename PXA2xxState variable

Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agomainstone: Rename PXA2xxState variable
Andreas Färber [Sun, 13 May 2012 23:11:15 +0000 (01:11 +0200)]
mainstone: Rename PXA2xxState variable

Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agopalm: Rename omap_mpu_state_s variable
Andreas Färber [Sun, 13 May 2012 23:20:13 +0000 (01:20 +0200)]
palm: Rename omap_mpu_state_s variable

Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoomap_sx1: Rename omap_mpu_state_s variable
Andreas Färber [Sun, 13 May 2012 23:17:03 +0000 (01:17 +0200)]
omap_sx1: Rename omap_mpu_state_s variable

Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agonseries: Rename n800_s::cpu to mpu
Andreas Färber [Sun, 13 May 2012 20:13:15 +0000 (22:13 +0200)]
nseries: Rename n800_s::cpu to mpu

omap_mpu_state_s::env was renamed to cpu while changing its type.
With n800_s::cpu of type omap_mpu_state_s* this leads to s->cpu->cpu.

Rename the field to "mpu" to avoid this ugliness.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoRevert "build: compile oslib-obj-y once"
Blue Swirl [Sun, 10 Jun 2012 20:29:19 +0000 (20:29 +0000)]
Revert "build: compile oslib-obj-y once"

This reverts commit 25f27a4f7160d077d6992e811021b4bc3a82abc1
because of bsd-user breakage.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: switch to AREG0-free mode
Max Filippov [Sun, 10 Jun 2012 07:33:12 +0000 (11:33 +0400)]
target-xtensa: switch to AREG0-free mode

Add env parameter to every helper function that needs it, update
'configure' script.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add attributes to helper functions
Max Filippov [Sun, 10 Jun 2012 07:33:11 +0000 (11:33 +0400)]
target-xtensa: add attributes to helper functions

Mark exception generating functions 'noreturn' and pure constant
functions as such.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: remove unnecessary include of dyngen-exec.h
Peter Portante [Sun, 10 Jun 2012 07:33:10 +0000 (11:33 +0400)]
target-xtensa: remove unnecessary include of dyngen-exec.h

Signed-off-by: Peter Portante <peter.portante@redhat.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: fix CCOUNT for conditional branches
Max Filippov [Sun, 27 May 2012 23:18:33 +0000 (03:18 +0400)]
target-xtensa: fix CCOUNT for conditional branches

Taken conditional branches fail to update CCOUNT register because
accumulated ccount_delta is reset during translation of non-taken
branch. To fix it only update CCOUNT once per conditional branch
instruction translation.

This fixes guest linux freeze on LTP waitpid06 test.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec: fix TB invalidation after breakpoint insertion/deletion
Max Filippov [Sun, 27 May 2012 16:21:08 +0000 (20:21 +0400)]
exec: fix TB invalidation after breakpoint insertion/deletion

tb_invalidate_phys_addr has to be called with the exact physical address of
the breakpoint we add/remove, not just the page's base address.
Otherwise we easily fail to flush the right TB.

This breakage was introduced by the commit f3705d5329 "memory: make
phys_page_find() return an unadjusted".

This appeared to work for some guest architectures because their
cpu_get_phys_page_debug implementation returns full translated physical
address, not just the base of the TARGET_PAGE_SIZE-sized page.

Reported-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add MMU pagewalking tests
Max Filippov [Sun, 27 May 2012 14:34:54 +0000 (18:34 +0400)]
target-xtensa: add MMU pagewalking tests

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: control page table lookup explicitly
Max Filippov [Sun, 27 May 2012 14:34:53 +0000 (18:34 +0400)]
target-xtensa: control page table lookup explicitly

Hardware pagetable walking may not be nested. Stop guessing and pass
explicit flag to the get_physical_addr_mmu function that controls page
table lookup.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: update autorefill TLB entries conditionally
Max Filippov [Sun, 27 May 2012 14:34:52 +0000 (18:34 +0400)]
target-xtensa: update autorefill TLB entries conditionally

This is to avoid interference of internal QEMU helpers
(cpu_get_phys_page_debug, tb_invalidate_virtual_addr) with guest-visible
TLB state.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: extract TLB entry setting method
Max Filippov [Sun, 27 May 2012 14:34:51 +0000 (18:34 +0400)]
target-xtensa: extract TLB entry setting method

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: update EXCVADDR in case of page table lookup
Max Filippov [Sun, 27 May 2012 14:34:50 +0000 (18:34 +0400)]
target-xtensa: update EXCVADDR in case of page table lookup

According to ISA, 4.4.2.6, EXCVADDR may be changed by any TLB miss, even
if the miss is handled entirely by processor hardware.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: flush TLB page for new MMU mapping
Max Filippov [Sun, 27 May 2012 14:34:49 +0000 (18:34 +0400)]
target-xtensa: flush TLB page for new MMU mapping

Both old and new mappings need flushing because their VPN may be
different in MMU case.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agow32: Fix broken build (missing include file)
Stefan Weil [Thu, 7 Jun 2012 13:45:35 +0000 (15:45 +0200)]
w32: Fix broken build (missing include file)

dump.c was recently added to the code. It unconditionally
includes sys/procfs which is not available with MinGW (w32, w64).

It looks like this file is not needed at all (tested on Linux),
so I removed it completely.

Some other include statements are also redundant because they are
already included in qemu-common, therefore they were removed, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agodo not include <libutil.h> needlessly or if it doesn't exist
Michael Tokarev [Sat, 2 Jun 2012 19:43:33 +0000 (23:43 +0400)]
do not include <libutil.h> needlessly or if it doesn't exist

<libutil.h> and <util.h> on *BSD (some have one, some another)
were #included just for openpty() declaration.  The only file
where this function is actually used is qemu-char.c.

In vl.c and net/tap-bsd.c, none of functions declared in libutil.h
(login logout logwtmp timdomain openpty forkpty uu_lock realhostname
fparseln and a few others depending on version) are used.

Initially the code which is currently in qemu-char.c was in vl.c,
it has been removed into separate file in commit 0e82f34d077dc2542
Fri Oct 31 18:44:40 2008, but the #includes were left in vl.c.
So with vl.c, we just remove includes - libutil.h, util.h and
pty.h (which declares only openpty() and forkpty()) from there.

The code in net/tap-bsd.c, which come from net/tap.c, had this

commit 5281d757efa6e40d74ce124be048b08d43887555
Author: Mark McLoughlin <markmc@redhat.com>
Date:   Thu Oct 22 17:49:07 2009 +0100

    net: split all the tap code out into net/tap.c

Note this commit not only moved stuff out of net.c to net/tap.c,
but also rewrote large portions of the tap code, and added these
completely unnecessary #includes -- as usual, I question why such
a misleading commit messages are allowed.

Again, no functions defined in libutil.h or util.h on *BSD are
used by neither net/tap.c nor net/tap-bsd.c.  Removing them.

And finally, the only real user for these #includes, qemu-char.c,
which actually uses openpty().  There, the #ifdef logic is wrong.
A GLIBC-based system has <pty.h>, even if it is a variant of *BSD.
So __GLIBC__ should be checked first, and instead of trying to
include <libutil.h> or <util.h>, we include <pty.h>.  If it is not
GLIBC-based, we check for variations between <*util.h> as before.

This patch fixes build of qemu 1.1 on Debian/kFreebsd (well, one
of the two problems): it is a distribution with a FreeBSD kernel,
so it #defines at least __FreeBSD_kernel__, but since it is based
on GLIBC, it has <pty.h>, but current version does not have neither
<util.h> nor <libutil.h>, which the code tries to include 3 times
but uses only once.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-ppc: Unbreak kvm_ppc.c build
Andreas Färber [Sat, 9 Jun 2012 01:43:05 +0000 (03:43 +0200)]
target-ppc: Unbreak kvm_ppc.c build

The file is located in target-ppc/, not hw/.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agodump: Fix build breakage (missing sys/procfs.h)
Stefan Weil [Fri, 8 Jun 2012 17:57:25 +0000 (19:57 +0200)]
dump: Fix build breakage (missing sys/procfs.h)

sys/procfs is not available everywhere (MingW does not have it).

Remove this and more unused or redundant include statements.
This fixes the broken build.

qerror.h was previously included indirectly.
Add an explicit include statement for it because it is needed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-i386: Use uint32 visitor for [x]level properties
Andreas Färber [Tue, 1 May 2012 21:33:13 +0000 (23:33 +0200)]
target-i386: Use uint32 visitor for [x]level properties

This simplifies the code and resolves TODOs.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoqdev: Remove PropertyInfo range checking
Paolo Bonzini [Thu, 12 Apr 2012 13:32:26 +0000 (15:32 +0200)]
qdev: Remove PropertyInfo range checking

Range checking in PropertyInfo is now used only for pci_devfn
properties and some error reporting.  Remove all code that implements
it in the various property types, and the now unused fields.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Fix blocksize min/max for 32-bit hosts by using const int64_t.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Switch property accessors to fixed-width visitor interfaces
Michael Roth [Wed, 22 Feb 2012 18:26:37 +0000 (12:26 -0600)]
qdev: Switch property accessors to fixed-width visitor interfaces

This introduces {get,set}_uint{8,16,32,64}() functions for the
respective qdev types.
TADDR and VLAN are switched to explicit int64, BLOCKSIZE to uint16.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Use int32_t container for devfn property
Michael Roth [Sun, 4 Mar 2012 19:38:27 +0000 (13:38 -0600)]
qdev: Use int32_t container for devfn property

Valid range for devfn is -1 to 255 (-1 for automatic assignment). We do
not currently validate this due to devfn being stored as a uint32_t.
This can lead to segfaults and other strange behavior.

We could technically just cast it to int32_t to implement the checking,
but this will not work for visitor-based setting where we may do additional
bounds-checking based on target container type, which is int32_t for this
case.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqapi: Add String visitor coverage to serialization unit tests
Michael Roth [Wed, 22 Feb 2012 16:16:31 +0000 (10:16 -0600)]
qapi: Add String visitor coverage to serialization unit tests

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqapi: String visitor, use %f representation for floats
Michael Roth [Mon, 30 Apr 2012 14:33:30 +0000 (09:33 -0500)]
qapi: String visitor, use %f representation for floats

Currently string-output-visitor formats floats as %g, which is nice in
that trailing 0's are automatically truncated, but otherwise this causes
some issues:

 - it uses 6 significant figures instead of 6 decimal places, which
   means something like 155777.5 (which even has an exact floating point
   representation) will be rounded to 155778 when converted to a string.

 - output will be presented in scientific notation when the normalized
   form requires a 10^x multiplier. Not a huge deal, but arguably less
   readable for command-line arguments.

 - due to using scientific notation for numbers requiring more than 6
   significant figures, instead of hard-defined decimal places, it
   fails a lot of the test-visitor-serialization unit tests for floats.

Instead, let's just use %f, which is what the QJSON and the QMP visitors
use.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqapi: Unit tests for visitor-based serialization
Michael Roth [Wed, 22 Feb 2012 03:05:07 +0000 (21:05 -0600)]
qapi: Unit tests for visitor-based serialization

Currently we test our visitors individually, and seperately for input
vs. output. This is useful for validating internal representations
against the native C types and vice-versa, and other visitor-specific
testing, but it doesn't cover the potential use-case of using visitor
pairs for serialization/deserialization very well, and makes it
hard to easily extend the coverage for different C types / boundary
conditions.

To cover that we add a set of unit tests that takes a number of native C
values, passes them into an output visitor, extracts the values with an
input visitor, then compares the result to the original.

Plugging in new visitors to the test harness only requires a user to
implement the SerializeOps interface and add it to a list.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqapi: Add Visitor interfaces for uint*_t and int*_t
Michael Roth [Thu, 25 Aug 2011 15:44:50 +0000 (10:44 -0500)]
qapi: Add Visitor interfaces for uint*_t and int*_t

This adds visitor interfaces for fixed-width integers types.
Implementing these in visitors is optional, otherwise we fall back to
visit_type_int() (int64_t) with some additional bounds checking to avoid
integer overflows for cases where the value fetched exceeds the bounds
of our target C type.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[LE: exclude negative values in uint*_t Visitor interfaces]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[AF: Merged fix by Laszlo]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoconfigure: report missing libraries for virtfs
Harsh Prateek Bora [Thu, 7 Jun 2012 21:50:43 +0000 (03:20 +0530)]
configure: report missing libraries for virtfs

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace/simple.c: fix deprecated glib2 interface
Harsh Prateek Bora [Thu, 7 Jun 2012 21:50:42 +0000 (03:20 +0530)]
trace/simple.c: fix deprecated glib2 interface

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoClarify comments of tb_invalidate_phys_[page_]range
Jan Kiszka [Thu, 24 May 2012 02:41:53 +0000 (23:41 -0300)]
Clarify comments of tb_invalidate_phys_[page_]range

They could suggest that all TBs of the page containing the range would
be invalidated.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agomsi: Use msi/msix_present more consistently
Jan Kiszka [Mon, 4 Jun 2012 14:53:48 +0000 (16:53 +0200)]
msi: Use msi/msix_present more consistently

Replace some open-coded msi/msix_present checks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agomsi: Invoke msi/msix_write_config from PCI core
Jan Kiszka [Fri, 11 May 2012 14:42:40 +0000 (11:42 -0300)]
msi: Invoke msi/msix_write_config from PCI core

Also this functions is better invoked by the core than by each and every
device. This allows to drop the config_write callbacks from ich and
intel-hda.

CC: Alexander Graf <agraf@suse.de>
CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agomsi: Guard msi/msix_write_config with msi_present
Jan Kiszka [Fri, 11 May 2012 14:42:39 +0000 (11:42 -0300)]
msi: Guard msi/msix_write_config with msi_present

Terminate msi/msix_write_config early if support is not enabled. This
allows to remove checks at the caller site if MSI is optional.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agomsi: Invoke msi/msix_reset from PCI core
Jan Kiszka [Tue, 15 May 2012 23:09:56 +0000 (20:09 -0300)]
msi: Invoke msi/msix_reset from PCI core

There is no point in pushing this burden to the devices, they tend to
forget to call them (like intel-hda, ahci, xhci did). Instead, reset
functions are now called from pci_device_reset. They do nothing if
MSI/MSI-X is not in use.

CC: Alexander Graf <agraf@suse.de>
CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agomsi: Guard msi_reset with msi_present
Jan Kiszka [Fri, 11 May 2012 14:42:37 +0000 (11:42 -0300)]
msi: Guard msi_reset with msi_present

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoahci: Clean up reset functions
Jan Kiszka [Fri, 11 May 2012 14:42:36 +0000 (11:42 -0300)]
ahci: Clean up reset functions

Properly register reset functions via the device class.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agointel-hda: Fix reset of MSI function
Jan Kiszka [Fri, 11 May 2012 14:42:35 +0000 (11:42 -0300)]
intel-hda: Fix reset of MSI function

Call msi_reset on device reset as still required by the core.

CC: Gerd Hoffmann <kraxel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoahci: Fix reset of MSI function
Jan Kiszka [Fri, 11 May 2012 14:42:34 +0000 (11:42 -0300)]
ahci: Fix reset of MSI function

Call msi_reset on device reset as still required by the core.

CC: Alexander Graf <agraf@suse.de>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agortl8139: honor RxOverflow flag in can_receive method
Fernando Luis Vazquez Cao [Mon, 4 Jun 2012 14:35:11 +0000 (17:35 +0300)]
rtl8139: honor RxOverflow flag in can_receive method

Some drivers (Linux' 8139too among them) rely on the NIC
injecting an interrupt in the event of a receive buffer overflow
and, accordingly, set the RxOverflow bit in the interrupt
mask. Unfortunately rtl8139's can_receive method ignores the
RxOverflow flag, which may lead to a situation where rtl8139
stops receiving packets (can_receive returns 0) when the receive
buffer becomes full.

If the driver eventually read from the receive buffer or reset
the card the emulator could recover from this situation. However
some implementations only do this upon receiving an interrupt
with either RxOK or RxOverflow set in the ISR; interrupt that
will never come because QEMU's flow control mechanisms would
prevent rtl8139 from receiving any packet.

Letting packets go through when the overflow interrupt is enabled
makes the QEMU emulator compliant to the spec and solves the
problem.

This patch should fix a relatively common (in our experience)
network stall observed when running enterprise distros with
rtl8139 as the NIC; in some cases the 8139too device driver gets
loaded and when under heavy load the network eventually stops
working.

Reported-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Tested-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Acked-by: Igor Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoshpc: unparent device before free
Michael S. Tsirkin [Mon, 4 Jun 2012 14:29:54 +0000 (17:29 +0300)]
shpc: unparent device before free

Recent core change removed unparent
so we need to do this in all callers now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>