sdk/emulator/qemu.git
13 years agotcx: convert to memory API
Avi Kivity [Wed, 5 Oct 2011 16:26:24 +0000 (18:26 +0200)]
tcx: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agotc63963xb: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:42:42 +0000 (14:42 +0200)]
tc63963xb: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosyborg: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:33:26 +0000 (14:33 +0200)]
syborg: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosun4u: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:31:12 +0000 (14:31 +0200)]
sun4u: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosun4m: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:27:32 +0000 (14:27 +0200)]
sun4m: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agostrongarm: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 12:14:20 +0000 (14:14 +0200)]
strongarm: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agospitz: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 11:03:56 +0000 (13:03 +0200)]
spitz: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agospapr: convert to memory API
Avi Kivity [Mon, 3 Oct 2011 10:56:38 +0000 (12:56 +0200)]
spapr: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosm501: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 15:56:06 +0000 (17:56 +0200)]
sm501: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agos390-virtio: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 15:06:42 +0000 (17:06 +0200)]
s390-virtio: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agorealview: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 15:04:26 +0000 (17:04 +0200)]
realview: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agor2d: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 14:48:42 +0000 (16:48 +0200)]
r2d: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoppcr500_mpc8544ds: convert to memory API
Avi Kivity [Sun, 2 Oct 2011 14:43:01 +0000 (16:43 +0200)]
ppcr500_mpc8544ds: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopci: simplify memory region registration
Avi Kivity [Thu, 11 Aug 2011 11:40:58 +0000 (14:40 +0300)]
pci: simplify memory region registration

The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are
identical.  Unify them.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopxa2xx: convert to memory API (part II)
Avi Kivity [Sun, 25 Sep 2011 15:19:19 +0000 (18:19 +0300)]
pxa2xx: convert to memory API (part II)

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopxa2xx: convert to memory API (part I)
Avi Kivity [Sun, 25 Sep 2011 15:19:19 +0000 (18:19 +0300)]
pxa2xx: convert to memory API (part I)

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoppc_prep: convert to memory API
Avi Kivity [Sun, 25 Sep 2011 13:57:45 +0000 (16:57 +0300)]
ppc_prep: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoppc_oldworld: convert to memory API
Avi Kivity [Sun, 25 Sep 2011 13:27:52 +0000 (16:27 +0300)]
ppc_oldworld: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoi8259: Move to hw library
Jan Kiszka [Sun, 16 Oct 2011 09:53:17 +0000 (11:53 +0200)]
i8259: Move to hw library

No target-specific bits remaining, let's move it over.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomonitor: Restrict pic/irq_info to supporting targets
Jan Kiszka [Sun, 16 Oct 2011 09:53:13 +0000 (11:53 +0200)]
monitor: Restrict pic/irq_info to supporting targets

This allows to drop various stubs and move the i8359 into hwlib.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Fix coding style
Jan Kiszka [Fri, 7 Oct 2011 07:19:54 +0000 (09:19 +0200)]
i8259: Fix coding style

No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Convert to qdev
Jan Kiszka [Fri, 7 Oct 2011 07:19:53 +0000 (09:19 +0200)]
i8259: Convert to qdev

This key cleanup step requires to move the IRQ debugging bit from
i8259_set_irq directly to the per-PIC pic_set_irq, to pass the PIC
parameters (I/O base, ELCR address and mask, master/slave mode) as
qdev properties, and to interconnect the PICs with their environment via
GPIO pins.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoqdev: Add HEX8 property
Jan Kiszka [Fri, 7 Oct 2011 07:19:52 +0000 (09:19 +0200)]
qdev: Add HEX8 property

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Eliminate PicState2
Jan Kiszka [Fri, 7 Oct 2011 07:19:51 +0000 (09:19 +0200)]
i8259: Eliminate PicState2

Introduce a reference to the slave PIC for the few cases we need to
access it without a proper pointer at hand and drop PicState2. We could
even live without slave_pic if we had a better way of modeling the
cascade bus the PICs are attached to (in addition to the ISA bus).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Replace PicState::pics_state with master flag
Jan Kiszka [Fri, 7 Oct 2011 07:19:50 +0000 (09:19 +0200)]
i8259: Replace PicState::pics_state with master flag

This reflects how real PICs indentify their role (in non-buffered mode):
Pass the state of the /SP input on pic_init and use it instead of
pics_state to differentiate between master and slave mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: PREP: Replace pic_intack_read with pic_read_irq
Jan Kiszka [Fri, 7 Oct 2011 07:19:49 +0000 (09:19 +0200)]
i8259: PREP: Replace pic_intack_read with pic_read_irq

There is nothing in the i8259 spec that justifies the special
pic_intack_read. At least the Linux PREP kernels configure the PICs
properly so that pic_read_irq returns identical values, and setting
read_reg_select in PIC0 cannot be derived from any special i8259 mode.

So switch ppc_prep to pic_read_irq and drop the now unused PIC code.

CC: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Clean up pic_ioport_read
Jan Kiszka [Fri, 7 Oct 2011 07:19:48 +0000 (09:19 +0200)]
i8259: Clean up pic_ioport_read

Drop redundant local address variable.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Fix poll command
Jan Kiszka [Fri, 7 Oct 2011 07:19:47 +0000 (09:19 +0200)]
i8259: Fix poll command

This was probably never used so far: According to the spec, polling
means ack'ing the pending IRQ and setting its corresponding bit in isr.
Moreover, we have to signal a pending IRQ via bit 7 of the returned
value, and we must not return a spurious IRQ if none is pending.

This implements the poll command without the help of pic_poll_read which
is left untouched as pic_intack_read is still using it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Switch to per-PIC IRQ update
Jan Kiszka [Fri, 7 Oct 2011 07:19:46 +0000 (09:19 +0200)]
i8259: Switch to per-PIC IRQ update

This converts pic_update_irq to work against a single PIC instead of the
complete cascade. Along this change, the required update after
pic_set_irq1 is now moved into that function.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Clear ELCR on reset
Jan Kiszka [Fri, 7 Oct 2011 07:19:45 +0000 (09:19 +0200)]
i8259: Clear ELCR on reset

The ELCR is actually part of the chipset but we model it here for
simplicity reasons. The PIIX3 clears the ELCR on reset, which was once
broken by 4dbe19e181. Fix this by splitting up pic_init_reset from
pic_reset and clearing the register in the latter.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Update IRQ state after reset
Jan Kiszka [Fri, 7 Oct 2011 07:19:44 +0000 (09:19 +0200)]
i8259: Update IRQ state after reset

MIPS and PPC users of the i8259 output signal expect us to report state
updates also after reset. As no consumer (including the master PIC) can
misinterpret the deassert as an activation event, it is safe to simply
update the IRQ state after reset.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Reorder intack in pic_read_irq
Jan Kiszka [Fri, 7 Oct 2011 07:19:43 +0000 (09:19 +0200)]
i8259: Reorder intack in pic_read_irq

As we want to move the IRQ update to pic_intack, ordering matters: the
slave ack must be executed before the master ack to avoid missing
further pending slave IRQs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Do not update IRQ output after spurious pic_poll_read
Jan Kiszka [Fri, 7 Oct 2011 07:19:42 +0000 (09:19 +0200)]
i8259: Do not update IRQ output after spurious pic_poll_read

If pic_poll_read finds no pending IRQ and return a spurious one instead,
no PIC state is changed, thus we do not need to call pic_update_irq.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8239: Introduce per-PIC output interrupt
Jan Kiszka [Fri, 7 Oct 2011 07:19:41 +0000 (09:19 +0200)]
i8239: Introduce per-PIC output interrupt

As a first step towards more generic master-slave support, remove
parent_irq in favor of a per-PIC output interrupt line. The slave's
line is attached to IRQ2 of the master, but it remains unused for now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Move pic_set_irq1 after pic_update_irq
Jan Kiszka [Fri, 7 Oct 2011 07:19:40 +0000 (09:19 +0200)]
i8259: Move pic_set_irq1 after pic_update_irq

We are about to call the latter from the former. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Drop obsolete prototypes
Jan Kiszka [Fri, 7 Oct 2011 07:19:39 +0000 (09:19 +0200)]
i8259: Drop obsolete prototypes

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoi8259: Remove premature inline function attributes
Jan Kiszka [Fri, 7 Oct 2011 07:19:38 +0000 (09:19 +0200)]
i8259: Remove premature inline function attributes

The compiler is smarter in choosing the right optimization.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopc: Fix and clean up PIC-to-APIC IRQ path
Jan Kiszka [Fri, 7 Oct 2011 07:19:37 +0000 (09:19 +0200)]
pc: Fix and clean up PIC-to-APIC IRQ path

The master PIC is connected to the LINTIN0 of the APICs. As the APIC
currently does not track the state of that line, we have to ask the PIC
to reinject its IRQ after the CPU picked up an event from the APIC.

This introduces pic_get_output to read the master PIC IRQ line state
without changing it. The APIC uses this function to decide if a PIC IRQ
should be reinjected on apic_update_irq. This reflects better how the
real hardware works.

The patch fixes some failures of the kvm unit tests apic and eventinj by
allowing to enable the proper CPU IRQ deassertion when the guest masks
some pending IRQs at PIC level.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopc: Convert GSIState::i8259_irq into array
Jan Kiszka [Fri, 7 Oct 2011 07:19:36 +0000 (09:19 +0200)]
pc: Convert GSIState::i8259_irq into array

Will be required when we no longer let i8259_init allocate the PIC IRQs
but convert that chips to qdev.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopc: Generalize ISA IRQs to GSIs
Jan Kiszka [Fri, 7 Oct 2011 07:19:35 +0000 (09:19 +0200)]
pc: Generalize ISA IRQs to GSIs

The ISA bus IRQ range is 0..15. What isa_irq_handler and IsaIrqState are
actually dealing with are the Global System Interrupts. Refactor the
code to clarify this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopc: Drop useless test from isa_irq_handler
Jan Kiszka [Fri, 7 Oct 2011 07:19:34 +0000 (09:19 +0200)]
pc: Drop useless test from isa_irq_handler

IsaIrqState::ioapic is always non-NULL. Probably, the concrete
qemu_irq was supposed to be tested, but that's already done by
qemu_set_irq.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: add Avnet LX60/LX110/LX200 boards
Max Filippov [Sat, 15 Oct 2011 22:56:46 +0000 (02:56 +0400)]
target-xtensa: add Avnet LX60/LX110/LX200 boards

These boards carry similar hardware: SDRAM (48M for LX110, 64M for LX60,
96M for LX200), 16 Mbyte FLASH, FPGA, 10/100 Mbps Ethernet PHY and 16550
UART. FPGA may be loaded with almost any Tensilica processor. It is also
used to implement Ethernet MAC, e.g. OpenCores 10/100 Mbps Ethernet MAC
and LED/DIP switches access.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agohw: add OpenCores 10/100 Mbps Ethernet controller
Max Filippov [Sat, 15 Oct 2011 22:56:45 +0000 (02:56 +0400)]
hw: add OpenCores 10/100 Mbps Ethernet controller

This is OpenCores Ethernet MAC + subset of National Semiconductors
DP83838C PHY.
OpenCores Ethernet MAC project: http://opencores.org/project,ethmac

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: rename dc232b board to sim
Max Filippov [Sat, 15 Oct 2011 22:56:07 +0000 (02:56 +0400)]
target-xtensa: rename dc232b board to sim

This is to get aligned with the linux name for this machine.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: add fsf core
Max Filippov [Sat, 15 Oct 2011 22:56:06 +0000 (02:56 +0400)]
target-xtensa: add fsf core

This is FSF big endian core implemented through linux overlay.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: add dc232b core
Max Filippov [Sat, 15 Oct 2011 22:56:05 +0000 (02:56 +0400)]
target-xtensa: add dc232b core

This is Diamond 232L Standard Core Rev.B (LE), implemented through
linux/gdb overlay.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: extract core configuration from overlay
Max Filippov [Sat, 15 Oct 2011 22:56:04 +0000 (02:56 +0400)]
target-xtensa: extract core configuration from overlay

Introduce overlay_tool.h that defines core configuration blocks from
data available in the linux architecture variant overlay.

Overlay data is automatically generated in the core configuration
process by Tensilica tools and can be directly converted to qemu xtensa
core description by overlay_tool.h

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: implement external interrupt mapping
Max Filippov [Sat, 15 Oct 2011 22:56:03 +0000 (02:56 +0400)]
target-xtensa: implement external interrupt mapping

Xtensa cores may have different mapping of external interrupt pins to
internal IRQ numers. Implement API to acquire core IRQ by its external
interrupt number.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: remove hand-written xtensa cores implementations
Max Filippov [Sat, 15 Oct 2011 22:56:02 +0000 (02:56 +0400)]
target-xtensa: remove hand-written xtensa cores implementations

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: increase xtensa options accuracy
Max Filippov [Sat, 15 Oct 2011 22:56:01 +0000 (02:56 +0400)]
target-xtensa: increase xtensa options accuracy

- add separate options for each operation in the MISC_OP;
- add an option for MULSH/MULUH;
- put S32C1I under conditional store option.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: update qemu-doc.texi
Max Filippov [Mon, 10 Oct 2011 10:48:23 +0000 (14:48 +0400)]
target-xtensa: update qemu-doc.texi

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: add MAC16 unit tests
Max Filippov [Mon, 10 Oct 2011 02:25:41 +0000 (06:25 +0400)]
target-xtensa: add MAC16 unit tests

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: implement MAC16 option
Max Filippov [Mon, 10 Oct 2011 02:25:40 +0000 (06:25 +0400)]
target-xtensa: implement MAC16 option

See ISA, 4.3.7 for the details.

- add ACC and MR special registers;
- implement MAC16 and all inner MAC* opcode groups.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-xtensa: fix guest hang on masked CCOMPARE interrupt
Max Filippov [Mon, 10 Oct 2011 02:25:04 +0000 (06:25 +0400)]
target-xtensa: fix guest hang on masked CCOMPARE interrupt

QEMU timer is used to post CCOMPARE interrupt when the core is halted.
If that CCOMPARE interrupt is masked off then the timer must be rearmed
in the callback, otherwise it will be rearmed next time the core goes to
halt by the waiti instruction.

Add test case into timer testsuite.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoDrop obsolete nographic timer
Jan Kiszka [Fri, 30 Sep 2011 10:31:18 +0000 (12:31 +0200)]
Drop obsolete nographic timer

We flush coalesced MMIO in the device models now, and VNC - for which
this was once introduced - is also fine without it as it has its own
refresh timer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove graphic-related coalesced MMIO flushes to affected device models
Jan Kiszka [Fri, 30 Sep 2011 10:31:14 +0000 (12:31 +0200)]
Move graphic-related coalesced MMIO flushes to affected device models

This is conceptually cleaner and will allow us to drop the nographic
timer. Moreover, it will be mandatory to fully exploit future per-device
coalesced MMIO rings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 14 Oct 2011 17:36:50 +0000 (12:36 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 14 Oct 2011 15:47:33 +0000 (10:47 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.28' into staging
Anthony Liguori [Fri, 14 Oct 2011 15:46:35 +0000 (10:46 -0500)]
Merge remote-tracking branch 'kraxel/usb.28' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging
Anthony Liguori [Fri, 14 Oct 2011 15:44:52 +0000 (10:44 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging

13 years agoblock: drop bdrv_has_async_rw()
Stefan Hajnoczi [Thu, 13 Oct 2011 20:09:32 +0000 (21:09 +0100)]
block: drop bdrv_has_async_rw()

Commit cd74d83345e0e3b708330ab8c4cd9111bb82cda6 ("block: switch
bdrv_read()/bdrv_write() to coroutines") removed the bdrv_has_async_rw()
callers.  This patch removes bdrv_has_async_rw() since it is no longer
used.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: drop .bdrv_read()/.bdrv_write() emulation
Stefan Hajnoczi [Thu, 13 Oct 2011 20:09:31 +0000 (21:09 +0100)]
block: drop .bdrv_read()/.bdrv_write() emulation

There is no need to emulate .bdrv_read()/.bdrv_write() since these
interfaces are only called if aio and coroutine interfaces are not
present.  All valid BlockDrivers must implement either sync, aio, or
coroutine interfaces.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: use coroutine interface for raw format
Stefan Hajnoczi [Thu, 13 Oct 2011 20:09:30 +0000 (21:09 +0100)]
block: use coroutine interface for raw format

The raw format delegates all operations to bs->file (the protocol).
Previously this block driver exposed both sync and aio interfaces.
Since the block layer now works in terms of coroutines, expose the
coroutine interfaces and drop the others.  This avoids unnecessary
emulation of sync and aio interfaces.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoraw-posix: remove bdrv_read()/bdrv_write()
Stefan Hajnoczi [Thu, 13 Oct 2011 20:09:29 +0000 (21:09 +0100)]
raw-posix: remove bdrv_read()/bdrv_write()

Block drivers only need to provide one of sync, aio, or coroutine
interfaces.  Since raw-posix.c provides aio interfaces, simply drop the
synchronous interfaces since they can be emulated using aio and
coroutines.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: drop emulation functions that use coroutines
Stefan Hajnoczi [Thu, 13 Oct 2011 20:09:28 +0000 (21:09 +0100)]
block: drop emulation functions that use coroutines

Block drivers that implement coroutine functions used to get sync and
aio wrappers.  This is no longer necessary since all request processing
now happens in a coroutine.  If a block driver implements the coroutine
interface then none of the other interfaces will be invoked.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock/qcow: Fix use of free() instead of g_free()
Stefan Weil [Fri, 7 Oct 2011 05:32:47 +0000 (07:32 +0200)]
block/qcow: Fix use of free() instead of g_free()

cppcheck reported this error:

qemu/block/qcow.c:599: error: Mismatching allocation and deallocation: cluster_data

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agosheepdog: correct spelling
Dong Xu Wang [Fri, 14 Oct 2011 07:41:06 +0000 (15:41 +0800)]
sheepdog: correct spelling

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agotcg: Fix spelling in comment (varables -> variables)
Stefan Weil [Tue, 11 Oct 2011 17:43:15 +0000 (19:43 +0200)]
tcg: Fix spelling in comment (varables -> variables)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoremove hpet.h
Paolo Bonzini [Tue, 11 Oct 2011 07:49:43 +0000 (09:49 +0200)]
remove hpet.h

It is unused since the HPET and RTC timers were removed (commit
25f3151, 2011-05-31).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoarm_pic: Fix typo
Andreas Färber [Sun, 9 Oct 2011 23:27:01 +0000 (01:27 +0200)]
arm_pic: Fix typo

interrput -> interrupt

Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoqemu-char: Fix use of free() instead of g_free()
Stefan Weil [Fri, 7 Oct 2011 05:38:46 +0000 (07:38 +0200)]
qemu-char: Fix use of free() instead of g_free()

cppcheck reported these errors:

qemu-char.c:1667: error: Mismatching allocation and deallocation: s
qemu-char.c:1668: error: Mismatching allocation and deallocation: chr
qemu-char.c:1769: error: Mismatching allocation and deallocation: s
qemu-char.c:1770: error: Mismatching allocation and deallocation: chr

Tested-by: Dongxu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoqemu-options: avoid #if in spicevmc texi help
Stefan Hajnoczi [Thu, 6 Oct 2011 10:24:12 +0000 (11:24 +0100)]
qemu-options: avoid #if in spicevmc texi help

Preprocessor directives cannot be used in STEXI/ETEXI sections since
they are not passed through the preprocessor.  The spicevmc chardev
option help currently uses #if, which is included verbatim in the man
page output.

Fix this by simply stating that spicevmc chardevs are available only in
builds with spice support.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agolinux-aio: Allow reads beyond the end of growable images
Kevin Wolf [Thu, 13 Oct 2011 13:42:52 +0000 (15:42 +0200)]
linux-aio: Allow reads beyond the end of growable images

This is the linux-aio version of commits 22afa7b5 (raw-posix, synchronous) and
ba1d1afd (posix-aio-compat). Reads now produce zeros after the end of file
instead of failing or resulting in short reads, making linux-aio compatible
with the behaviour of synchronous raw-posix requests and posix-aio-compat.

The problem can be reproduced like this:

dd if=/dev/zero of=/tmp/test.raw bs=1 count=1234
./qemu-io -k -n -g -c 'read -p 1024 512' /tmp/test.raw

Previously, the result of this was 'read failed: Invalid argument', now the
read completes successfully.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoblock: switch bdrv_aio_writev() to coroutines
Stefan Hajnoczi [Thu, 13 Oct 2011 12:08:25 +0000 (13:08 +0100)]
block: switch bdrv_aio_writev() to coroutines

More sync, aio, and coroutine unification.  Make bdrv_aio_writev() go
through coroutine request processing.

Remove the dirty block callback mechanism which was needed only for aio
processing and can be done more naturally in coroutine context.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: mark blocks dirty on coroutine write completion
Stefan Hajnoczi [Thu, 13 Oct 2011 12:08:24 +0000 (13:08 +0100)]
block: mark blocks dirty on coroutine write completion

The aio write operation marks blocks dirty when the write operation
completes.  The coroutine write operation marks blocks dirty before
issuing the write operation.

It seems safest to mark the block dirty when the operation completes so
that anything tracking dirty blocks will not act before the change has
been made to the image file.

Make the coroutine write operation dirty blocks on write completion.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: switch bdrv_aio_readv() to coroutines
Stefan Hajnoczi [Thu, 13 Oct 2011 12:08:23 +0000 (13:08 +0100)]
block: switch bdrv_aio_readv() to coroutines

More sync, aio, and coroutine unification.  Make bdrv_aio_readv() go
through coroutine request processing.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: switch bdrv_read()/bdrv_write() to coroutines
Stefan Hajnoczi [Thu, 13 Oct 2011 12:08:22 +0000 (13:08 +0100)]
block: switch bdrv_read()/bdrv_write() to coroutines

The bdrv_read()/bdrv_write() functions call .bdrv_read()/.bdrv_write().
They should go through bdrv_co_do_readv() and bdrv_co_do_writev()
instead in order to unify request processing code across sync, aio, and
coroutine interfaces.  This is also an important step towards removing
BlockDriverState .bdrv_read()/.bdrv_write() in the future.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: split out bdrv_co_do_readv() and bdrv_co_do_writev()
Stefan Hajnoczi [Wed, 5 Oct 2011 16:17:03 +0000 (17:17 +0100)]
block: split out bdrv_co_do_readv() and bdrv_co_do_writev()

The public interface for I/O in coroutine context is bdrv_co_readv() and
bdrv_co_writev().  Split out the request processing code into
bdrv_co_do_readv() and bdrv_co_writev() so that it can be called
internally when we refactor all request processing to use coroutines.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: directly invoke .bdrv_* from emulation functions
Stefan Hajnoczi [Thu, 13 Oct 2011 12:08:21 +0000 (13:08 +0100)]
block: directly invoke .bdrv_* from emulation functions

The emulation functions which supply default BlockDriver .bdrv_*()
functions given another implemented .bdrv_*() function should not use
public bdrv_*() interfaces.  This patch ensures they invoke .bdrv_*()
directly to avoid adding an extra layer of coroutine request processing
and possibly entering an infinite loop.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: directly invoke .bdrv_aio_*() in bdrv_co_io_em()
Stefan Hajnoczi [Wed, 5 Oct 2011 16:17:02 +0000 (17:17 +0100)]
block: directly invoke .bdrv_aio_*() in bdrv_co_io_em()

We will unify block layer request processing across sync, aio, and
coroutines and this means a .bdrv_co_*() emulation function should not
call back into the public interface.  There's no need here, just call
.bdrv_aio_*() directly.

The gory details: bdrv_co_io_em() cannot call back into the public
bdrv_aio_*() interface since that will be handled using coroutines,
which causes us to call into bdrv_co_io_em() again in an infinite loop
:).

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agousb-hub: don't trigger assert on packet completion.
Gerd Hoffmann [Thu, 13 Oct 2011 10:52:47 +0000 (12:52 +0200)]
usb-hub: don't trigger assert on packet completion.

Calling usb_packet_complete() recursively when passing up the completion
event up the chain for devices connected via usb hub will trigger an
assert.  So don't do that, make the usb hub emulation call the upstream
completion callback directly instead.

Based on a patch from Stefan Hajnoczi <stefanha@gmail.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-hid: activate usb tablet / mouse after migration.
Gerd Hoffmann [Wed, 12 Oct 2011 10:54:35 +0000 (12:54 +0200)]
usb-hid: activate usb tablet / mouse after migration.

qemu uses the ps/2 mouse by default.  The usb tablet (or mouse) is
activated as soon as qemu sees some guest activity on the device,
i.e. polling for HID events.  That used to work fine for both fresh
boot and migration.

Remote wakeup support changed the picture though: There will be no
polling after migration in case the guest suspended the usb bus,
waiting for wakeup events.  Result is that the ps/2 mouse stays
active.

Fix this by activating the usb tablet / mouse in post_load() in case
the guest enabled remote wakeup.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agohw/usb-ohci: Honour endpoint maximum packet size
Peter Maydell [Wed, 14 Sep 2011 17:48:59 +0000 (18:48 +0100)]
hw/usb-ohci: Honour endpoint maximum packet size

Honour the maximum packet size for endpoints; this applies when
sending non-isochronous data and means we transfer only as
much as the endpoint allows, leaving the transfer descriptor
on the list for another go next time around. This allows
usb-net to work when connected to an OHCI controller model.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agohw/usb-ohci: Fix OHCI_TD_T1 bit position definition
Peter Maydell [Wed, 14 Sep 2011 17:49:00 +0000 (18:49 +0100)]
hw/usb-ohci: Fix OHCI_TD_T1 bit position definition

The OHCI Transfer Descriptor T (DataToggle) bits are 24 and 25;
fix an error which accidentally overlaid them both on the same bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: handle USBDEVFS_SETCONFIGURATION returning EBUSY
Gerd Hoffmann [Tue, 13 Sep 2011 09:55:15 +0000 (11:55 +0200)]
usb-host: handle USBDEVFS_SETCONFIGURATION returning EBUSY

In case the host uses the usb device usbfs will refuse to set the
configuration due to the device being busy.  Handle this case by
disconnection the interfaces, then trying again.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-host: factor out code
Gerd Hoffmann [Tue, 13 Sep 2011 09:37:47 +0000 (11:37 +0200)]
usb-host: factor out code

Move code to claim usb ports and to disconnect usb interfaces into
usb_host_claim_port and usb_host_disconnect_ifaces functions.  No
functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: fix port reset
Gerd Hoffmann [Thu, 15 Sep 2011 10:10:21 +0000 (12:10 +0200)]
usb: fix port reset

commit 891fb2cd4592b6fe76106a69e0ca40efbf82726a removed the implicit
detach before (re-)attaching in usb_attach().  Some usb host controllers
used that behavior though to do a port reset by a detach+attach
sequence.

This patch establishes old behavior by adding a new usb_reset() function
for port resets and putting it into use, thereby also unifying port
reset behavior of all host controllers.  The patch also adds asserts to
usb_attach() and usb_detach() to make sure the calls are symmetrical.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-hub: need to check dev->attached
Gerd Hoffmann [Thu, 15 Sep 2011 07:20:02 +0000 (09:20 +0200)]
usb-hub: need to check dev->attached

commit 891fb2cd4592b6fe76106a69e0ca40efbf82726a did that for all host
controllers, the usb hub was left out by accident.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-storage: fix NULL pointer dereference.
Gerd Hoffmann [Fri, 2 Sep 2011 11:05:13 +0000 (13:05 +0200)]
usb-storage: fix NULL pointer dereference.

When a usb packet is canceled we need to check whenever we actually have
a scsi request in flight before we try to cancel it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoisa: Remove isa_init_ioport_range and isa_init_ioport
Richard Henderson [Tue, 16 Aug 2011 16:02:36 +0000 (09:02 -0700)]
isa: Remove isa_init_ioport_range and isa_init_ioport

All users have been converted to either isa_register_ioport
or isa_register_old_portio_list.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoide: Convert to isa_register_portio_list
Richard Henderson [Tue, 16 Aug 2011 15:59:00 +0000 (08:59 -0700)]
ide: Convert to isa_register_portio_list

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agovmport: Convert to isa_register_ioport
Richard Henderson [Tue, 16 Aug 2011 15:38:14 +0000 (08:38 -0700)]
vmport: Convert to isa_register_ioport

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agopc: Convert port92 to isa_register_ioport
Richard Henderson [Tue, 16 Aug 2011 15:32:44 +0000 (08:32 -0700)]
pc: Convert port92 to isa_register_ioport

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agovga: Convert to isa_register_portio_list
Richard Henderson [Tue, 16 Aug 2011 15:27:39 +0000 (08:27 -0700)]
vga: Convert to isa_register_portio_list

[jan: fix cut'n'paste errors]
[avi: adjust pci variants not to use isa functions]

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosb16: Convert to isa_register_portio_list
Richard Henderson [Mon, 15 Aug 2011 23:10:47 +0000 (16:10 -0700)]
sb16: Convert to isa_register_portio_list

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoparallel: Convert to isa_register_portio_list
Richard Henderson [Mon, 15 Aug 2011 22:55:09 +0000 (15:55 -0700)]
parallel: Convert to isa_register_portio_list

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agone2000: Convert to isa_register_ioport
Richard Henderson [Mon, 15 Aug 2011 22:42:46 +0000 (15:42 -0700)]
ne2000: Convert to isa_register_ioport

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agortc: Convert to isa_register_ioport
Richard Henderson [Mon, 15 Aug 2011 22:40:21 +0000 (15:40 -0700)]
rtc: Convert to isa_register_ioport

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agom48t59: Convert to isa_register_ioport
Richard Henderson [Mon, 15 Aug 2011 22:33:40 +0000 (15:33 -0700)]
m48t59: Convert to isa_register_ioport

The sysbus interface is as yet unconverted.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agogus: Convert to isa_register_portio_list
Richard Henderson [Mon, 15 Aug 2011 22:25:26 +0000 (15:25 -0700)]
gus: Convert to isa_register_portio_list

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>