sdk/emulator/qemu.git
15 years agoallow qdev busses allocations be inplace
Gerd Hoffmann [Wed, 16 Sep 2009 20:25:27 +0000 (22:25 +0200)]
allow qdev busses allocations be inplace

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotemporary fix for on_vcpu
Glauber Costa [Thu, 17 Sep 2009 18:10:06 +0000 (20:10 +0200)]
temporary fix for on_vcpu

Recent changes made on_vcpu hit the abort() path, even with the IO thread
disabled. This is because cpu_single_env is no longer set when we call this
function. Although the correct fix is a little bit more complicated that that,
the recent thread in which I proposed qemu_queue_work (which fixes that, btw),
is likely to go on a quite different direction.

So for the benefit of those using guest debugging, I'm proposing this simple
fix in the interim.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Fix guest single-stepping
Jan Kiszka [Thu, 17 Sep 2009 18:05:58 +0000 (20:05 +0200)]
kvm: Fix guest single-stepping

Hopefully the last regression of 4c0960c0: KVM_SET_GUEST_DEBUG requires
properly synchronized guest registers (on x86: eflags) on entry.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agogdbstub: x86: Switch 64/32 bit registers dynamically
Jan Kiszka [Thu, 17 Sep 2009 16:14:13 +0000 (18:14 +0200)]
gdbstub: x86: Switch 64/32 bit registers dynamically

Commit 56aebc891674cd2d07b3f64183415697be200084 changed gdbstub in way
that debugging 32 or 16-bit guest code is no longer possible with qemu
for x86_64 guest CPUs. Since that commit, qemu only provides registers
sets for 64-bit, forcing current and foreseeable gdb to also switch its
architecture to 64-bit. And this breaks if the inferior is 32 or 16 bit.

No question, this is a gdb issue. But, as it was confirmed in several
discusssions with gdb people, it is a non-trivial thing to fix. So until
qemu finds a gdb version attach with a rework x86 support, we have to
work around it by switching the register layout as the guest switches
its execution mode between 16/32 and 64 bit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoEnable host-clock-based RTC
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Enable host-clock-based RTC

Switch RTC emulations to the new host_clock instead of vm_clock by
default. This has the advantage that the emulated RTC will follow
automatically the host time while it might be tuned via NTP. vm_clock
can still be selected by passing '-rtc clock=vm' on the command line.

Note that some RTC emulations (at least M48T59) already use the host
time unconditionally while others (namely MC146818) do not. This patch
introduces the required infrastructure for selecting the base clock but
only converts MC146818 for now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRefactor RTC command line switches
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Refactor RTC command line switches

Deprecate -localtime, -setdate and -rtc-td-hack in favor of a new
unified command line switch:

    -rtc [base=utc|localtime|date][,driftfix=none|slew]

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoIntroduce QEMU_CLOCK_HOST
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Introduce QEMU_CLOCK_HOST

Despite its name QEMU_CLOCK_REALTIME is (normally) not using
CLOCK_REALTIME / the host system time as base. In order to allow also
non-trivial RTC emulations (MC146818) to follow the host time instead of
the virtual guest time, introduce the new clock type QEMU_CLOCK_HOST. It
is unconditionally based on CLOCK_REALTIME, thus will follow system time
changes of the host.

The only limitation of its current implementation is that pending
host_clock timers may not fire early if the host time is pushed forward
beyond their expiry. So far no urgent need to overcome this limitation
was identified, so it's left as simple as it is (expiry on next alarm
timer tick).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agowin32: Drop dead dyntick timer code
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
win32: Drop dead dyntick timer code

nearest_delta_us is calculated but not used. Drop it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename QEMU_TIMER_* to QEMU_CLOCK_*
Jan Kiszka [Tue, 15 Sep 2009 11:36:04 +0000 (13:36 +0200)]
Rename QEMU_TIMER_* to QEMU_CLOCK_*

These constants select clocks, not timers. And init_timers initializes
clocks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix exit on 'pci_add' Monitor command
Luiz Capitulino [Thu, 24 Sep 2009 14:16:01 +0000 (11:16 -0300)]
Fix exit on 'pci_add' Monitor command

If the user issues one of the following commands to the Monitor:

pci_add pci_addr=auto nic model=None
pci_add pci_addr=auto nic model=?

QEMU will exit, because the function used to perform sanity
checks (qemu_check_nic_model_list()) exits on error.

This function is used by the startup code, where it makes
sense to exit on error, but in the Monitor it doesn't.

Changing qemu_check_nic_model_list() to not exit on error
is not possible though, as it's used by the board init
code (the PC one), where all board specific code must have
void return.

The way I've chosen to fix this was to introduce a new function
called pci_nic_supported(), which checks if the NIC is supported
and returns true or false accordingly.

The new function is used only by the Monitor, it performs the
necessary check and returns an error in case the NIC is not
supported, thus qemu_check_nic_model_list()'s exit is never trigged.

The following should be observed:

1. Only the specified NIC is checked, the default one is assumed
to be supported

2. The NIC query command (model=?) won't work with pci_add, the
right way to do this with the Monitor is to add a new command

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoCorrectly free nd structure
Glauber Costa [Thu, 17 Sep 2009 20:53:39 +0000 (16:53 -0400)]
Correctly free nd structure

When we "free" a NICInfo structure, we can leak pointers, since we don't do
much more than setting used = 0.

We free() the model parameter, but we don't set it to NULL. This means that
a new user of this structure will see garbage in there. It was not noticed
before because reusing a NICInfo is not that common, but it can be, for
users of device pci hotplug.

A user hit it, described at https://bugzilla.redhat.com/show_bug.cgi?id=524022

This patch memset's the whole structure, guaranteeing that anyone reusing it
will see a fresh NICinfo. Also, we free some other strings that are currently
leaking.

This codebase is quite old, so this patch should feed all stable trees.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agodo proper cpu_self check
Glauber Costa [Mon, 28 Sep 2009 18:27:44 +0000 (15:27 -0300)]
do proper cpu_self check

Currently, our check for qemu_cpu_self only checks if there is a cpu
currently in execution (represented by cpu_single_env being set). While
this might be okay for tcg, it is certainly not okay for kvm, since multiple
cpus might be executing.

Instead, I propose we use pthread primitives to test if the caller thread is
the same as env->thread.

For tcg, it will have the same semantics as before, since all CPUStates will
point to the same thread, and we'll only have one in execution at a time.

Signed-off-by: Glauber Costa <glommer@mothafucka.localdomain>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agobdf: Remove last users of FALSE/TRUE
Juan Quintela [Tue, 29 Sep 2009 23:10:56 +0000 (01:10 +0200)]
bdf: Remove last users of FALSE/TRUE

This brings bfd_boolean to the wonderful world of <stdbool.h>, it is needed
because it defines bdf_boolean as an enum with values true and false,
and some architectures use TRUE, FALSE and give problems when you try to use
<stdbool.h>

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd -Wold-style-* flags
Juan Quintela [Tue, 29 Sep 2009 23:10:55 +0000 (01:10 +0200)]
Add -Wold-style-* flags

This time, I add them in configure only if target compiler supports it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: It needs to use QEMU_CFLAGS not CFLAGS
Juan Quintela [Tue, 29 Sep 2009 23:10:54 +0000 (01:10 +0200)]
slirp: It needs to use QEMU_CFLAGS not CFLAGS

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: Add VMState support
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Add VMState support

Register all relevant fields of Musicpal device states with the VMState
framework. This involves a few type changes of state variables.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: Make PIT emulation more robust
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Make PIT emulation more robust

Stop the periodic timers of the PIT on reset, disabling via the control
register and invalid parameters.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: True reset support for audio device
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: True reset support for audio device

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: True reset support for GPIO
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: True reset support for GPIO

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: Coding style fixes
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Coding style fixes

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: Clean up typecasts
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Clean up typecasts

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: Rework GPIO input events
Jan Kiszka [Fri, 18 Sep 2009 18:51:23 +0000 (20:51 +0200)]
musicpal: Rework GPIO input events

The qdev_gpio conversion of 343ec8e caused come polarity mismatch of key
event pins and left an overly complex solution behind. Take this chance
and refactor the GPIO input system of the Musicpal, moving it closer to
reality:
 - Instantiate all 32 GPIO input pins and do the routing only via
   qdev_connect_gpio_out.
 - Implement IMR and IER registers. They manage the GPIO pin IRQ. IMR
   seems to enable IRQs on rising edges, IER on falling ones. At least
   this matches what the Musicpal fireware require.
 - Move key pin logic inversion from the GPIO layer to musicpal_key.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomusicpal: Catch null TX qeueues
Jan Kiszka [Fri, 18 Sep 2009 18:51:22 +0000 (20:51 +0200)]
musicpal: Catch null TX qeueues

They likely represent invalid queues that should be skipped. We already
do this for RX queues. Wish I had a spec...

Credits go to malc for analyzing the issue and suggesting this fix.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: port cpu to vmstate
Juan Quintela [Tue, 29 Sep 2009 20:49:08 +0000 (22:49 +0200)]
x86: port cpu to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Add suppot for field_exist() test
Juan Quintela [Tue, 29 Sep 2009 20:49:07 +0000 (22:49 +0200)]
vmstate: Add suppot for field_exist() test

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: factor out cpu_get/put_fpreg()
Juan Quintela [Tue, 29 Sep 2009 20:49:06 +0000 (22:49 +0200)]
x86: factor out cpu_get/put_fpreg()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: factor out cpu_get/put_mttr_var()
Juan Quintela [Tue, 29 Sep 2009 20:49:05 +0000 (22:49 +0200)]
x86: factor out cpu_get/put_mttr_var()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: factor out cpu_get/put_xmm_reg()
Juan Quintela [Tue, 29 Sep 2009 20:49:04 +0000 (22:49 +0200)]
x86: factor out cpu_get/put_xmm_reg()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: factor out cpu_pre/post_load()
Juan Quintela [Tue, 29 Sep 2009 20:49:03 +0000 (22:49 +0200)]
x86: factor out cpu_pre/post_load()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: factor out cpu_pre_save()
Juan Quintela [Tue, 29 Sep 2009 20:49:02 +0000 (22:49 +0200)]
x86: factor out cpu_pre_save()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: port segments to vmstate
Juan Quintela [Tue, 29 Sep 2009 20:49:01 +0000 (22:49 +0200)]
x86: port segments to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd *TL functions to vmstate
Juan Quintela [Tue, 29 Sep 2009 20:49:00 +0000 (22:49 +0200)]
Add *TL functions to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: split MTRRVar union
Juan Quintela [Tue, 29 Sep 2009 20:48:59 +0000 (22:48 +0200)]
x86: split MTRRVar union

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: split FPReg union
Juan Quintela [Tue, 29 Sep 2009 20:48:58 +0000 (22:48 +0200)]
x86: split FPReg union

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: mcg_cap is never 0
Juan Quintela [Tue, 29 Sep 2009 20:48:57 +0000 (22:48 +0200)]
x86: mcg_cap is never 0

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: send mce_banks as an array
Juan Quintela [Tue, 29 Sep 2009 20:48:56 +0000 (22:48 +0200)]
x86: send mce_banks as an array

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: mce_banks always have the same size
Juan Quintela [Tue, 29 Sep 2009 20:48:55 +0000 (22:48 +0200)]
x86: mce_banks always have the same size

mce_banks is always MCE_BANKS_DEF * 4 in size, value never change

CC: Huang Ying <ying.huang@intel.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: add fpregs_format_vmstate
Juan Quintela [Tue, 29 Sep 2009 20:48:54 +0000 (22:48 +0200)]
x86: add fpregs_format_vmstate

Don't even ask, being able to load/save between 64<->80bit floats should be forbidden

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: add pending_irq_vmstate to the state
Juan Quintela [Tue, 29 Sep 2009 20:48:53 +0000 (22:48 +0200)]
x86: add pending_irq_vmstate to the state

It is needed to save the interrupt_bitmap

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: add fptag_vmstate to the state
Juan Quintela [Tue, 29 Sep 2009 20:48:52 +0000 (22:48 +0200)]
x86: add fptag_vmstate to the state

It is needed to store fptags

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: fpus is uint16_t not unsigned int
Juan Quintela [Tue, 29 Sep 2009 20:48:51 +0000 (22:48 +0200)]
x86: fpus is uint16_t not unsigned int

We save more that fpus on that 16 bits (fpstt), we need an additional field

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: fpuc is uint16_t not unsigned int
Juan Quintela [Tue, 29 Sep 2009 20:48:50 +0000 (22:48 +0200)]
x86: fpuc is uint16_t not unsigned int

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: make a20_mask int32_t
Juan Quintela [Tue, 29 Sep 2009 20:48:49 +0000 (22:48 +0200)]
x86: make a20_mask int32_t

This makes the savevm code correct, and sign extensins gives us exactly
what we need (namely, sign extend to 64 bits when used with 64bit addresess.

Once there, change 0x100000 for 1 << 20, that maks all a20 use the same syntax.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: hflags is not modified at all, just save it directly
Juan Quintela [Tue, 29 Sep 2009 20:48:48 +0000 (22:48 +0200)]
x86: hflags is not modified at all, just save it directly

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: remove i2c_slave_load/save
Juan Quintela [Tue, 29 Sep 2009 20:48:44 +0000 (22:48 +0200)]
vmstate: remove i2c_slave_load/save

All its users moved to vmstate

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port lm832x device
Juan Quintela [Tue, 29 Sep 2009 20:48:43 +0000 (22:48 +0200)]
vmstate: port lm832x device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolm832x: make fields to have the same types that they are saved/loaded
Juan Quintela [Tue, 29 Sep 2009 20:48:42 +0000 (22:48 +0200)]
lm832x: make fields to have the same types that they are saved/loaded

They were saved as uint8_t already.  To make things simpler, I just
reg == -1 used to indicate an error, I create LM832x_GENERAL_ERROR
with vale 0xff to represet it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: add support for arrays of pointers
Juan Quintela [Tue, 29 Sep 2009 20:48:41 +0000 (22:48 +0200)]
vmstate: add support for arrays of pointers

We need this to send arrays of timers

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port twl92230 device
Juan Quintela [Tue, 29 Sep 2009 20:48:40 +0000 (22:48 +0200)]
vmstate: port twl92230 device

Just don't look.  struct tm members are ints' and they are sent as uint16_t.
VMState code complains as it should.  Have to create hacky int32_as_uint16
type.  Don't ever think about copying it

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotwl92230: change pwrbtn_state to uint8_t
Juan Quintela [Tue, 29 Sep 2009 20:48:39 +0000 (22:48 +0200)]
twl92230: change pwrbtn_state to uint8_t

its value is always the level of an interrupt, 0 or 1

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port tmp105 device
Juan Quintela [Tue, 29 Sep 2009 20:48:38 +0000 (22:48 +0200)]
vmstate: port tmp105 device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agotmp105: change len and alorm to uint8_t
Juan Quintela [Tue, 29 Sep 2009 20:48:37 +0000 (22:48 +0200)]
tmp105: change len and alorm to uint8_t

They were using only with very small integers, and they are sent/read as
bytes.  They can't become negative as far as I can see

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: create VMSTATE_INT16_ARRAY
Juan Quintela [Tue, 29 Sep 2009 20:48:36 +0000 (22:48 +0200)]
vmstate: create VMSTATE_INT16_ARRAY

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port ssd0303 device
Juan Quintela [Tue, 29 Sep 2009 20:48:35 +0000 (22:48 +0200)]
vmstate: port ssd0303 device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port pxa2xx_i2c device
Juan Quintela [Tue, 29 Sep 2009 20:48:34 +0000 (22:48 +0200)]
vmstate: port pxa2xx_i2c device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: create VMSTATE_STRUCT_POINTER
Juan Quintela [Tue, 29 Sep 2009 20:48:33 +0000 (22:48 +0200)]
vmstate: create VMSTATE_STRUCT_POINTER

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port max7310 device
Juan Quintela [Tue, 29 Sep 2009 20:48:32 +0000 (22:48 +0200)]
vmstate: port max7310 device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port wm8750 device
Juan Quintela [Tue, 29 Sep 2009 20:48:31 +0000 (22:48 +0200)]
vmstate: port wm8750 device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: create VMSTATE_I2C_SLAVE
Juan Quintela [Tue, 29 Sep 2009 20:48:30 +0000 (22:48 +0200)]
vmstate: create VMSTATE_I2C_SLAVE

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: add uint8 array
Juan Quintela [Tue, 29 Sep 2009 20:48:29 +0000 (22:48 +0200)]
vmstate: add uint8 array

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port i2c_slave device
Juan Quintela [Tue, 29 Sep 2009 20:48:28 +0000 (22:48 +0200)]
vmstate: port i2c_slave device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: port i2c_bus device
Juan Quintela [Tue, 29 Sep 2009 20:48:27 +0000 (22:48 +0200)]
vmstate: port i2c_bus device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoi2c: addresses are load/save as uint8_t values, change types to reflect this
Juan Quintela [Tue, 29 Sep 2009 20:48:26 +0000 (22:48 +0200)]
i2c: addresses are load/save as uint8_t values, change types to reflect this

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: Add support for uint8_t
Juan Quintela [Tue, 29 Sep 2009 20:48:25 +0000 (22:48 +0200)]
qdev: Add support for uint8_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: Add support for sending partial arrays
Juan Quintela [Tue, 29 Sep 2009 20:48:24 +0000 (22:48 +0200)]
vmstate: Add support for sending partial arrays

This one is needed for changees happening on fdc.  It allows you to send
arrays of structs whose size we want to send it is another field with type
uint8_t.  (If you have been able to read the whole sentence without
stoping for breathing, you can use it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: remove ps2_kbd_load_old()
Juan Quintela [Tue, 29 Sep 2009 20:48:23 +0000 (22:48 +0200)]
vmstate: remove ps2_kbd_load_old()

Now that we have version_id on post_load() we don't need the old load
function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: remove const from pre_save() functions
Juan Quintela [Tue, 29 Sep 2009 20:48:22 +0000 (22:48 +0200)]
vmstate: remove const from pre_save() functions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: add version_id argument to post_load
Juan Quintela [Tue, 29 Sep 2009 20:48:21 +0000 (22:48 +0200)]
vmstate: add version_id argument to post_load

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovmstate: remove const for put operations
Juan Quintela [Tue, 29 Sep 2009 20:48:20 +0000 (22:48 +0200)]
vmstate: remove const for put operations

In a later patch, we introduce pre_save() and post_save() functions.
The whole point of that operation is to change things in the state.
Without this patch, we have to remove the const qualifier in each
use with a cast

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovga: move back dirty_log functions to vga.c
Juan Quintela [Mon, 21 Sep 2009 12:35:18 +0000 (14:35 +0200)]
vga: move back dirty_log functions to vga.c

They are needed there on qemu-kvm.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocirrus_vga: also assign gr0/1 when writting shadow_gr0/1
Juan Quintela [Mon, 21 Sep 2009 12:35:17 +0000 (14:35 +0200)]
cirrus_vga: also assign gr0/1 when writting shadow_gr0/1

This is a regression/bug caused by previous vga_cleanup.  This fixes
Ubuntu installer reported by:
 Pierre Riteau

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRevert "eepro100: Remove unused device status entries"
Aurelien Jarno [Mon, 5 Oct 2009 14:29:33 +0000 (16:29 +0200)]
Revert "eepro100: Remove unused device status entries"

This reverts commit 3031efabd0bb744126a53f32c5426580b5d394d5.

15 years agotarget-i386: Fix exceptions for fxsave/fxrstor
Kevin Wolf [Fri, 2 Oct 2009 20:28:57 +0000 (22:28 +0200)]
target-i386: Fix exceptions for fxsave/fxrstor

This patch corrects the following aspects of exception generation in
fxsave/fxrstor:

* Generate #GP if the operand is not aligned to a 16 byte boundary
* Generate #UD if the LOCK prefix is used
* For CR0.EM = 1 #NM is generated, not #UD

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotcg: allocate s->op_dead_iargs dynamically
Aurelien Jarno [Sun, 4 Oct 2009 13:30:44 +0000 (15:30 +0200)]
tcg: allocate s->op_dead_iargs dynamically

Similarly to what is already done in tcg_liveness_analysis() when
USE_LIVENESS_ANALYSIS is not set.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotcg: remove dead code
Aurelien Jarno [Sun, 4 Oct 2009 13:16:46 +0000 (15:16 +0200)]
tcg: remove dead code

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agobsd-user: fix "#if 0"'d printf()
Paul Bolle [Sun, 4 Oct 2009 12:49:54 +0000 (14:49 +0200)]
bsd-user: fix "#if 0"'d printf()

Make an "#if 0"'d printf() in load_elf_binary() reflect what the actual
code does (see commit 3bc0bdcaadef1100ce2413af818d9c8e2f6319fc).

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoeepro100: Add more i825xx devices
Stefan Weil [Sat, 19 Sep 2009 11:02:09 +0000 (13:02 +0200)]
eepro100: Add more i825xx devices

The new devices added here are still not functional -
partially because some patches are still missing,
partially because I cannot test them. Nevertheless
they belong to the same family and will be supported
by this driver some day.

As soon as they work, they will also be added to hw/pci.c.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoeepro100: Remove unused device status entries
Stefan Weil [Sat, 19 Sep 2009 11:41:15 +0000 (13:41 +0200)]
eepro100: Remove unused device status entries

A lot of entries are unused (they were added by copy + paste
from other drivers during development of eepro100.c).

Removing them from nic_save, nic_load makes any
old saved status incompatible, so a new version
for the virtual machine data was needed, too.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotarget-i386: add RDTSCP support
Andre Przywara [Fri, 18 Sep 2009 22:30:49 +0000 (00:30 +0200)]
target-i386: add RDTSCP support

RDTSCP reads the time stamp counter and atomically also the content
of a 32-bit MSR, which can be freely set by the OS. This allows CPU
local data to be queried by userspace.
Linux uses this to allow a fast implementation of the getcpu()
syscall, which uses the vsyscall page to avoid a context switch.
AMD CPUs since K8RevF and Intel CPUs since Nehalem support this
instruction.
RDTSCP is guarded by the RDTSCP CPUID bit (Fn8000_0001:EDX[27]).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotarget-i386: add SSE4a instruction support
Andre Przywara [Fri, 18 Sep 2009 22:30:48 +0000 (00:30 +0200)]
target-i386: add SSE4a instruction support

This adds support for the AMD Phenom/Barcelona's SSE4a instructions.
Those include insertq and extrq, which are doing shift and mask on
XMM registers, in two versions (immediate shift/length values and
stored in another XMM register).
Additionally it implements movntss, movntsd, which are scalar
non-temporal stores (avoiding cache trashing). These are implemented
as normal stores, though.
SSE4a is guarded by the SSE4A CPUID bit (Fn8000_0001:ECX[6]).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotarget-i386: add lock mov cr0 = cr8
Andre Przywara [Fri, 18 Sep 2009 22:30:47 +0000 (00:30 +0200)]
target-i386: add lock mov cr0 = cr8

AMD CPUs featuring a shortcut to access CR8 even from 32-bit mode.
If you use the LOCK prefix with "mov CR0", it accesses CR8 instead.
This behavior is guarded by the CR8_LEGACY CPUID bit
(Fn8000_0001:ECX[1]).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotcg/i386: add support for ext{8,16}u_i32 TCG ops
Aurelien Jarno [Fri, 2 Oct 2009 18:55:24 +0000 (20:55 +0200)]
tcg/i386: add support for ext{8,16}u_i32 TCG ops

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotcg/x86_64: add support for ext{8,16,32}u_i{32,64} TCG ops
Aurelien Jarno [Wed, 30 Sep 2009 21:44:51 +0000 (23:44 +0200)]
tcg/x86_64: add support for ext{8,16,32}u_i{32,64} TCG ops

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agotcg: add ext{8,16,32}u_i{32,64} TCG ops
Aurelien Jarno [Wed, 30 Sep 2009 21:09:35 +0000 (23:09 +0200)]
tcg: add ext{8,16,32}u_i{32,64} TCG ops

Currently zero extensions ops are implemented by a and op with a
constant. This is then catched in some backend, and replaced by
a zero extension instruction. While this works well on RISC
machines, this adds a useless register move on non-RISC machines.

Example on x86:
  ext16u_i32 r1, r2
is translated into
  mov    %eax,%ebx
  movzwl %bx, %ebx
while the optimized version should be:
  movzwl %ax, %ebx

This patch adds ext{8,16,32}u_i{32,64} TCG ops that can be
implemented in the backends to avoid emitting useless register
moves.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agolinux-user: fix "#if 0"'d printf()
Paul Bolle [Fri, 2 Oct 2009 12:06:47 +0000 (14:06 +0200)]
linux-user: fix "#if 0"'d printf()

Make an "#if 0"'d printf() in load_elf_binary(), probably left to aid in
debugging, reflect what the actual code does. The current printf() will
only confuse those who "#if 1" it (it certainly confused me enough to
write this trivial patch).

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoCheck availability of uuid header / library
Stefan Weil [Thu, 1 Oct 2009 18:10:37 +0000 (20:10 +0200)]
Check availability of uuid header / library

If available, the Universally Unique Identifier library
is used by the vdi block driver.

Other parts of QEMU (vl.c) could also use it.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agohw/omap_dma: add matching {} in if 0
Michael S. Tsirkin [Thu, 1 Oct 2009 17:30:49 +0000 (19:30 +0200)]
hw/omap_dma: add matching {} in if 0

MULTI_REQ is never defined, so it doesn't matter much, but since
we have an if statement there, let's add {} to clarify what it
should do if it's uncommented, and indent the code properly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agooss/alsa: Do not invoke UB described in 7.15.1.1 (this time for ADC)
malc [Fri, 2 Oct 2009 23:30:06 +0000 (03:30 +0400)]
oss/alsa: Do not invoke UB described in 7.15.1.1 (this time for ADC)

Signed-off-by: malc <av1474@comtv.ru>
15 years agolibuser is a generated directory
Juan Quintela [Fri, 2 Oct 2009 09:13:43 +0000 (11:13 +0200)]
libuser is a generated directory

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoUse GNU ld to link roms on OpenSolaris
Blue Swirl [Fri, 2 Oct 2009 19:38:25 +0000 (19:38 +0000)]
Use GNU ld to link roms on OpenSolaris

OpenSolaris ld seems to miss the equivalent of GNU ld's "-Ttext 0".

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix warning about undefined madvise() on OpenSolaris
Blue Swirl [Fri, 2 Oct 2009 19:32:12 +0000 (19:32 +0000)]
Fix warning about undefined madvise() on OpenSolaris

OpenSolaris headers can't export madvise() with a sane set of #defines.
For background, see MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156)
for discussion about Solaris header problems.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agolinux-user: fix up oversealous nitpicking
Michael S. Tsirkin [Fri, 2 Oct 2009 17:59:12 +0000 (17:59 +0000)]
linux-user: fix up oversealous nitpicking

Looks like linux-user code was correct, just unreadable: what it wanted
to do with "-=" was really assign a negative number, not decrement.  Fix
up accordingly.

Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agotests: missing ; in if 0
Michael S. Tsirkin [Fri, 2 Oct 2009 17:59:10 +0000 (17:59 +0000)]
tests: missing ; in if 0

Fix missing ; in commented out code

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoalsa: Change default buffer/period size
malc [Thu, 1 Oct 2009 23:19:30 +0000 (03:19 +0400)]
alsa: Change default buffer/period size

Increase buffer size but do not rely on ALSA picking up default period
size.

Signed-off-by: malc <av1474@comtv.ru>
15 years agooss/alsa: Do not invoke UB described in 7.15.1.1
malc [Thu, 1 Oct 2009 22:37:40 +0000 (02:37 +0400)]
oss/alsa: Do not invoke UB described in 7.15.1.1

Additional argument (whether to try poll mode) is only passed with
VOICE_ENABLE command.

Thanks to Markus Armbruster for noticing the potential breakage.

15 years agoRevert "Get rid of _t suffix"
Anthony Liguori [Thu, 1 Oct 2009 21:12:16 +0000 (16:12 -0500)]
Revert "Get rid of _t suffix"

In the very least, a change like this requires discussion on the list.

The naming convention is goofy and it causes a massive merge problem.  Something
like this _must_ be presented on the list first so people can provide input
and cope with it.

This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoGet rid of _t suffix
malc [Thu, 1 Oct 2009 18:20:47 +0000 (22:20 +0400)]
Get rid of _t suffix

Some not so obvious bits, slirp and Xen were left alone for the time
being.

Signed-off-by: malc <av1474@comtv.ru>
15 years agoInclude microblaze binaries in tarbin.
Edgar E. Iglesias [Thu, 1 Oct 2009 13:18:36 +0000 (15:18 +0200)]
Include microblaze binaries in tarbin.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agotarget-mips: make sure constants are in the second argument
Aurelien Jarno [Mon, 28 Sep 2009 21:40:59 +0000 (23:40 +0200)]
target-mips: make sure constants are in the second argument

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agox86: use globals for CPU registers
Laurent Desnogues [Tue, 29 Sep 2009 09:58:04 +0000 (11:58 +0200)]
x86: use globals for CPU registers

Use globals for the 8 or 16 CPU registers on i386 and x86_64.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>