]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agomigration: Rename FdMigrationState MigrationState
Juan Quintela [Tue, 11 May 2010 13:56:35 +0000 (15:56 +0200)]
migration: Rename FdMigrationState MigrationState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: Fold MigrationState into FdMigrationState
Juan Quintela [Tue, 11 May 2010 13:51:36 +0000 (15:51 +0200)]
migration: Fold MigrationState into FdMigrationState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: Use FdMigrationState instead of MigrationState when possible
Juan Quintela [Tue, 11 May 2010 13:46:39 +0000 (15:46 +0200)]
migration: Use FdMigrationState instead of MigrationState when possible

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: Make *start_outgoing_migration return FdMigrationState
Juan Quintela [Tue, 11 May 2010 13:18:38 +0000 (15:18 +0200)]
migration: Make *start_outgoing_migration return FdMigrationState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: make *save_live return errors
Juan Quintela [Wed, 19 Oct 2011 13:22:18 +0000 (15:22 +0200)]
migration: make *save_live return errors

Make *save_live() return negative values when there is one error, and
updates all callers to check for the error.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: use qemu_file_get_error() return value when possible
Juan Quintela [Tue, 4 Oct 2011 23:14:46 +0000 (01:14 +0200)]
migration: use qemu_file_get_error() return value when possible

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agosavevm: Rename has_error to last_error field
Juan Quintela [Tue, 4 Oct 2011 23:05:21 +0000 (01:05 +0200)]
savevm: Rename has_error to last_error field

Now the field contains the last error name, so rename acordingly.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: rename qemu_file_has_error to qemu_file_get_error
Juan Quintela [Tue, 4 Oct 2011 23:02:52 +0000 (01:02 +0200)]
migration: rename qemu_file_has_error to qemu_file_get_error

Now the function returned errno, so it is better the new name.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: return real error code
Juan Quintela [Thu, 22 Sep 2011 09:02:14 +0000 (11:02 +0200)]
migration: return real error code

make functions propagate errno, instead of just using -EIO.  Add a
comment about what are the return value of qemu_savevm_state_iterate().

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: change has_error to contain errno values
Juan Quintela [Wed, 21 Sep 2011 21:01:54 +0000 (23:01 +0200)]
migration: change has_error to contain errno values

We normally already have an errno value.  When not, abuse EIO.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: set error if select return one error
Juan Quintela [Wed, 21 Sep 2011 20:46:36 +0000 (22:46 +0200)]
migration: set error if select return one error

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: don't "write" when migration is not active
Juan Quintela [Wed, 21 Sep 2011 20:37:29 +0000 (22:37 +0200)]
migration: don't "write" when migration is not active

If migration is not active, just ignore writes.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agobuffered_file: reuse QEMUFile has_error field
Juan Quintela [Wed, 21 Sep 2011 20:32:08 +0000 (22:32 +0200)]
buffered_file: reuse QEMUFile has_error field

Instead of having two has_error fields in QEMUFile & QEMUBufferedFile,
reuse the 1st one.  Notice that the one in buffered_file is only set
after a file operation.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agobuffered_file: Use right "opaque"
Juan Quintela [Wed, 21 Sep 2011 16:12:58 +0000 (18:12 +0200)]
buffered_file: Use right "opaque"

buffered_close 's' variable is of type QEMUFileBuffered, and
wait_for_unfreeze() expect to receive a MigrationState, that
'coincidentaly' is s->opaque.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: If there is one error, it makes no sense to continue
Juan Quintela [Wed, 23 Feb 2011 19:17:45 +0000 (20:17 +0100)]
migration: If there is one error, it makes no sense to continue

Once there, add a comment about what each error mean.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agomigration: add error handling to migrate_fd_put_notify().
Yoshiaki Tamura [Tue, 22 Feb 2011 15:01:24 +0000 (00:01 +0900)]
migration: add error handling to migrate_fd_put_notify().

Although migrate_fd_put_buffer() sets MIG_STATE_ERROR if it failed,
since migrate_fd_put_notify() isn't checking error of underlying
QEMUFile, those resources are kept open.  This patch checks it and
calls migrate_fd_error() in case of error.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: Check that migration is active before cancel it
Juan Quintela [Tue, 11 May 2010 20:39:51 +0000 (22:39 +0200)]
migration: Check that migration is active before cancel it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomigration: simplify state assignmente
Juan Quintela [Tue, 13 Sep 2011 13:11:38 +0000 (15:11 +0200)]
migration: simplify state assignmente

Once there, make sure that if we already know that there is one error,
just call migration_fd_cleanup() with the ERROR state.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agods1225y: Use stdio instead of QEMUFile
Juan Quintela [Tue, 13 Sep 2011 12:41:18 +0000 (14:41 +0200)]
ds1225y: Use stdio instead of QEMUFile

QEMUFile * is only intended for migration nowadays.  Using it for
anything else just adds pain and a layer of buffers for no good
reason.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRevert "savevm: fix corruption in vmstate_subsection_load()."
Juan Quintela [Fri, 30 Sep 2011 17:46:43 +0000 (19:46 +0200)]
Revert "savevm: fix corruption in vmstate_subsection_load()."

This reverts commit eb60260de0b050a5e8ab725e84d377d0b44c43ae.

Conflicts:

savevm.c

We changed qemu_peek_byte() prototype, just fixed the rejects.

Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosavevm: improve subsections detection on load
Juan Quintela [Tue, 4 Oct 2011 13:28:31 +0000 (15:28 +0200)]
savevm: improve subsections detection on load

We add qemu_peek_buffer, that is identical to qemu_get_buffer, just
that it don't update f->buf_index.

We add a paramenter to qemu_peek_byte() to be able to peek more than
one byte.

Once this is done, to see if we have a subsection we look:
- 1st byte is QEMU_VM_SUBSECTION
- 2nd byte is a length, and is bigger than section name
- 3rd element is a string that starts with section_name

So, we shouldn't have false positives (yes, content could still get us
wrong but probabilities are really low).

v2:
- Alex Williamsom found that we could get negative values on index.
- Rework code to fix that part.
- Rewrite qemu_get_buffer() using qemu_peek_buffer()

v3:
- return "done" on error case

v4:
- fix qemu_file_skip() off by one.

Signed-off-by: Juan Quintela <quintela@redhat.com>
12 years agosavevm: define qemu_get_byte() using qemu_peek_byte()
Juan Quintela [Thu, 6 Oct 2011 12:29:32 +0000 (14:29 +0200)]
savevm: define qemu_get_byte() using qemu_peek_byte()

Signed-off-by: Juan Quintela<quintela@redhat.com>
12 years agosavevm: some coding style cleanups
Juan Quintela [Tue, 4 Oct 2011 11:55:32 +0000 (13:55 +0200)]
savevm: some coding style cleanups

This patch will make moving code on next patches and having checkpatch
happy easier.

Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agosavevm: teach qemu_fill_buffer to do partial refills
Juan Quintela [Fri, 30 Sep 2011 17:28:45 +0000 (19:28 +0200)]
savevm: teach qemu_fill_buffer to do partial refills

We will need on next patch to be able to lookahead on next patch

v2: rename "used" to "pending" (Alex Williams)

Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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

12 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

12 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

12 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

12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>
12 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>