sdk/emulator/qemu.git
15 years agoIntroduce PIIX3IrqState for piix3 irq's state
Juan Quintela [Fri, 28 Aug 2009 13:28:19 +0000 (15:28 +0200)]
Introduce PIIX3IrqState for piix3 irq's state

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoCreate PIIX3State instead of using PCIDevice for PIIX3
Juan Quintela [Fri, 28 Aug 2009 13:28:18 +0000 (15:28 +0200)]
Create PIIX3State instead of using PCIDevice for PIIX3

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoWe want the argument pass to set_irq to be opaque
Juan Quintela [Fri, 28 Aug 2009 13:28:17 +0000 (15:28 +0200)]
We want the argument pass to set_irq to be opaque

piix_pci want to pass more things that the pic

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMove smm_enabled and isa_memory_mappings to PCII440FXState
Juan Quintela [Fri, 28 Aug 2009 13:28:16 +0000 (15:28 +0200)]
Move smm_enabled and isa_memory_mappings to PCII440FXState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUse PCII440FXState instead of generic PCIDevice
Juan Quintela [Fri, 28 Aug 2009 13:28:15 +0000 (15:28 +0200)]
Use PCII440FXState instead of generic PCIDevice

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolow_set_irq is not used anywhere
Juan Quintela [Fri, 28 Aug 2009 13:28:14 +0000 (15:28 +0200)]
low_set_irq is not used anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSplit piix4 support from piix_pci.c
Juan Quintela [Fri, 28 Aug 2009 13:28:13 +0000 (15:28 +0200)]
Split piix4 support from piix_pci.c

Now mips_malta uses piix4 and pc's use piix_pci definitions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopiix4 don't use pci_irq_levels at all
Juan Quintela [Fri, 28 Aug 2009 13:28:12 +0000 (15:28 +0200)]
piix4 don't use pci_irq_levels at all

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomicroblaze: Trap on illegal load/store sizes.
Edgar E. Iglesias [Fri, 4 Sep 2009 08:38:59 +0000 (10:38 +0200)]
microblaze: Trap on illegal load/store sizes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Correct FPU decoding masks.
Edgar E. Iglesias [Fri, 4 Sep 2009 07:40:49 +0000 (09:40 +0200)]
microblaze: Correct FPU decoding masks.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Compute masks for alignment checks at translation time.
Edgar E. Iglesias [Thu, 3 Sep 2009 20:28:21 +0000 (22:28 +0200)]
microblaze: Compute masks for alignment checks at translation time.

Thanks to Blue Swirl for reporting.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Trap on bus accesses to unmapped areas.
Edgar E. Iglesias [Thu, 3 Sep 2009 11:25:09 +0000 (13:25 +0200)]
microblaze: Trap on bus accesses to unmapped areas.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: MMU shows more respect to synthesis config.
Edgar E. Iglesias [Thu, 3 Sep 2009 11:04:02 +0000 (13:04 +0200)]
microblaze: MMU shows more respect to synthesis config.

The microblaze MMU can be synthesized in different configurations.
Have the MMU model show more respect to the chosen configuration.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Trap on unaligned data accesses.
Edgar E. Iglesias [Thu, 3 Sep 2009 10:59:46 +0000 (12:59 +0200)]
microblaze: Trap on unaligned data accesses.

Untested...

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Trap on divizions by zero.
Edgar E. Iglesias [Thu, 3 Sep 2009 10:52:01 +0000 (12:52 +0200)]
microblaze: Trap on divizions by zero.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Correct mfs into r0.
Edgar E. Iglesias [Thu, 3 Sep 2009 09:18:55 +0000 (11:18 +0200)]
microblaze: Correct mfs into r0.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Catch illegal insns and privilege violations.
Edgar E. Iglesias [Thu, 3 Sep 2009 09:12:30 +0000 (11:12 +0200)]
microblaze: Catch illegal insns and privilege violations.

Raise illegal instruction exceptions when executing instructions that
require units not available on the particulare microblaze configuration.

Also trap priviliege violations made by userspace.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Add infrastructure for supporting hw exceptions.
Edgar E. Iglesias [Thu, 3 Sep 2009 08:25:00 +0000 (10:25 +0200)]
microblaze: Add infrastructure for supporting hw exceptions.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Clear exception in dslot ESR bit if not in dslot.
Edgar E. Iglesias [Thu, 3 Sep 2009 08:15:17 +0000 (10:15 +0200)]
microblaze: Clear exception in dslot ESR bit if not in dslot.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agomicroblaze: Correct MMU debug log.
Edgar E. Iglesias [Thu, 3 Sep 2009 08:13:08 +0000 (10:13 +0200)]
microblaze: Correct MMU debug log.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15 years agoFix warning on x86_64
Kirill A. Shutemov [Wed, 2 Sep 2009 15:18:04 +0000 (18:18 +0300)]
Fix warning on x86_64

audio/esdaudio.c: In function 'qesd_thread_out':
audio/esdaudio.c:136: error: format '%d' expects type 'int', but
argument 3 has type 'ssize_t'
audio/esdaudio.c: In function 'qesd_thread_in':
audio/esdaudio.c:366: error: format '%d' expects type 'int', but
argument 3 has type 'ssize_t'

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: malc <av1474@comtv.ru>
15 years agoSparc32: port sun4c interrupt controller to VMState design
Blue Swirl [Mon, 31 Aug 2009 19:30:21 +0000 (19:30 +0000)]
Sparc32: port sun4c interrupt controller to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port timers to VMState design
Blue Swirl [Mon, 31 Aug 2009 19:30:18 +0000 (19:30 +0000)]
Sparc32: port timers to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: timer field is never NULL
Blue Swirl [Mon, 31 Aug 2009 19:30:17 +0000 (19:30 +0000)]
Sparc32: timer field is never NULL

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoAdd VMState support for ptimers
Blue Swirl [Mon, 31 Aug 2009 19:30:15 +0000 (19:30 +0000)]
Add VMState support for ptimers

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoesp (sparc32) Extra scsi data.
Artyom Tarasenko [Mon, 31 Aug 2009 17:03:51 +0000 (19:03 +0200)]
esp (sparc32) Extra scsi data.

> ESP: Message Accepted (12)
> ESP: Transfer status (sense=0)
> ESP: read reg[5]: 0x20
> ESP: read reg[4]: 0x07
> ESP: read reg[7]: 0x02
> Extra scsi data. Fatal error.

It looks like "Message Accepted" shouldn't write a response. At least
ESP_RFLAGS must definetely be 0. With the following fix OBP goes one
step further:

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix compiler warnings
Stefan Weil [Mon, 31 Aug 2009 14:29:34 +0000 (16:29 +0200)]
Fix compiler warnings

Starting with commit df7a86ed735eafefbd046c8cad7134652fe3f600,
mingw32 builds result in a compiler warning for dns_addr:

  CC    slirp/slirp.o
/home/stefan/src/qemu/savannah/qemu/slirp/slirp.c:50: warning: missing braces around initializer
/home/stefan/src/qemu/savannah/qemu/slirp/slirp.c:50: warning: (near initialization for ‘dns_addr.S_un’)

Removing the assignment fixes the warning without the need of special code
for mingw32 (and also saves some bytes in the resulting binary).

To fix another potential compiler warning, the missing 'static'
attribute was added.

The same changes were applied to dns_addr_time.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix breakage due to __thread
Blue Swirl [Mon, 31 Aug 2009 15:14:40 +0000 (15:14 +0000)]
Fix breakage due to __thread

Thread-local storage is not supported on all hosts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix gcc 3 warning: comparison is always true due to limited range of data type
Blue Swirl [Sat, 29 Aug 2009 13:37:34 +0000 (16:37 +0300)]
Fix gcc 3 warning: comparison is always true due to limited range of data type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix gcc 3 warning about uninitialized variable
Blue Swirl [Sat, 29 Aug 2009 13:37:26 +0000 (16:37 +0300)]
Fix gcc 3 warning about uninitialized variable

If nb_sectors is 0, cluster_offset will not be initialized.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port Slavio misc devices to VMState design
Blue Swirl [Sat, 29 Aug 2009 13:37:09 +0000 (16:37 +0300)]
Sparc32: port Slavio misc devices to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port ECC memory controller to VMState design
Blue Swirl [Sat, 29 Aug 2009 13:36:58 +0000 (16:36 +0300)]
Sparc32: port ECC memory controller to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port IOMMU to VMState design
Blue Swirl [Fri, 28 Aug 2009 20:46:21 +0000 (20:46 +0000)]
Sparc32: port IOMMU to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port DMA controller to VMState design
Blue Swirl [Fri, 28 Aug 2009 20:46:15 +0000 (20:46 +0000)]
Sparc32: port DMA controller to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port TCX to VMState design
Blue Swirl [Fri, 28 Aug 2009 20:43:01 +0000 (20:43 +0000)]
Sparc32: port TCX to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSparc32: port interrupt controller to VMState design
Blue Swirl [Fri, 28 Aug 2009 20:22:52 +0000 (20:22 +0000)]
Sparc32: port interrupt controller to VMState design

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoUpdate OpenBIOS images to r569
Blue Swirl [Fri, 28 Aug 2009 19:47:11 +0000 (19:47 +0000)]
Update OpenBIOS images to r569

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSuppress kraxelisms
Blue Swirl [Fri, 28 Aug 2009 19:12:16 +0000 (19:12 +0000)]
Suppress kraxelisms

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix Sparc64 breakage: add dummy ISA irqs
Blue Swirl [Fri, 28 Aug 2009 19:04:13 +0000 (19:04 +0000)]
Fix Sparc64 breakage: add dummy ISA irqs

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix merge of 59f2a78793b6d17634f39646d604e84af51e0919
Blue Swirl [Fri, 28 Aug 2009 18:30:54 +0000 (18:30 +0000)]
Fix merge of 59f2a78793b6d17634f39646d604e84af51e0919

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoDon't compile aio code if CONFIG_LINUX_AIO is undefined
Stefan Weil [Fri, 28 Aug 2009 12:39:31 +0000 (14:39 +0200)]
Don't compile aio code if CONFIG_LINUX_AIO is undefined

This patch fixes linker errors when building QEMU without Linux AIO support.

It is based on suggestions from malc and Kevin Wolf.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoFix sb16 breakage due to unassigned s->irq
malc [Fri, 28 Aug 2009 10:33:43 +0000 (14:33 +0400)]
Fix sb16 breakage due to unassigned s->irq

Signed-off-by: malc <av1474@comtv.ru>
15 years agoFix formatting
malc [Fri, 28 Aug 2009 10:33:10 +0000 (14:33 +0400)]
Fix formatting

Signed-off-by: malc <av1474@comtv.ru>
15 years agoMerge commit 'linux-user/linux-user-for-upstream' into staging
Anthony Liguori [Fri, 28 Aug 2009 01:55:01 +0000 (20:55 -0500)]
Merge commit 'linux-user/linux-user-for-upstream' into staging

15 years agoRelax pthreads check to avoid win32
Anthony Liguori [Tue, 25 Aug 2009 22:21:56 +0000 (17:21 -0500)]
Relax pthreads check to avoid win32

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoe1000 cleanup
Juan Quintela [Mon, 24 Aug 2009 16:43:00 +0000 (18:43 +0200)]
e1000 cleanup

Remove un needed casts from void *.
Use DO_UPCAST() instead of blind casts

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopcnet: Add pci_pcnet_{save/load} functions, then remove PCNetState pci_dev field
Juan Quintela [Mon, 24 Aug 2009 16:42:59 +0000 (18:42 +0200)]
pcnet: Add pci_pcnet_{save/load} functions, then remove PCNetState pci_dev field

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopcnet: remove useless casts This are casts to the very type of the function
Juan Quintela [Mon, 24 Aug 2009 16:42:58 +0000 (18:42 +0200)]
pcnet: remove useless casts This are casts to the very type of the function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopcnet: Change casts to DO_UPCAST() for PCIPCNetState
Juan Quintela [Mon, 24 Aug 2009 16:42:57 +0000 (18:42 +0200)]
pcnet: Change casts to DO_UPCAST() for PCIPCNetState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd pci_cirrus_vga_{save/load} functions, then remove vga.pci_dev use
Juan Quintela [Mon, 24 Aug 2009 16:42:56 +0000 (18:42 +0200)]
Add pci_cirrus_vga_{save/load} functions, then remove vga.pci_dev use

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocirrus_vga: Change casts to DO_UPCAST() for PCICirrusVGAState
Juan Quintela [Mon, 24 Aug 2009 16:42:55 +0000 (18:42 +0200)]
cirrus_vga: Change casts to DO_UPCAST() for PCICirrusVGAState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocirrus_vga: remove pointless cast from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:54 +0000 (18:42 +0200)]
cirrus_vga: remove pointless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd pci_ne2000_{save/load} functions, then remove pci_dev NE2000State field
Juan Quintela [Mon, 24 Aug 2009 16:42:53 +0000 (18:42 +0200)]
Add pci_ne2000_{save/load} functions, then remove pci_dev NE2000State field

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoWe need PCINE2000State for save/load functions
Juan Quintela [Mon, 24 Aug 2009 16:42:52 +0000 (18:42 +0200)]
We need PCINE2000State for save/load functions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agone2000: Change casts to DO_UPCAST() for PCINE2000State
Juan Quintela [Mon, 24 Aug 2009 16:42:51 +0000 (18:42 +0200)]
ne2000: Change casts to DO_UPCAST() for PCINE2000State

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agone2000: pci_dev has this very value with the right type
Juan Quintela [Mon, 24 Aug 2009 16:42:50 +0000 (18:42 +0200)]
ne2000: pci_dev has this very value with the right type

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agone2000: remove casts from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:49 +0000 (18:42 +0200)]
ne2000: remove casts from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agousb-ohci: Change casts to DO_UPCAST() for OHCIPCIState
Juan Quintela [Mon, 24 Aug 2009 16:42:48 +0000 (18:42 +0200)]
usb-ohci: Change casts to DO_UPCAST() for OHCIPCIState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoEverything outside of vga.c should use VGACommonState
Juan Quintela [Mon, 24 Aug 2009 16:42:47 +0000 (18:42 +0200)]
Everything outside of vga.c should use VGACommonState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovga: Rename vga_state -> vga
Juan Quintela [Mon, 24 Aug 2009 16:42:46 +0000 (18:42 +0200)]
vga: Rename vga_state -> vga

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoIntroduce vga_common_reset() to be able to typcheck vga_reset()
Juan Quintela [Mon, 24 Aug 2009 16:42:45 +0000 (18:42 +0200)]
Introduce vga_common_reset() to be able to typcheck vga_reset()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: LSIState is a DeviceHost
Juan Quintela [Mon, 24 Aug 2009 16:42:44 +0000 (18:42 +0200)]
lsi53c895a: LSIState is a DeviceHost

Go figure.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)
Juan Quintela [Mon, 24 Aug 2009 16:42:43 +0000 (18:42 +0200)]
lsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: use DO_UPCAST to cast from PCIDevice
Juan Quintela [Mon, 24 Aug 2009 16:42:42 +0000 (18:42 +0200)]
lsi53c895a: use DO_UPCAST to cast from PCIDevice

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: remove pointless cast from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:41 +0000 (18:42 +0200)]
lsi53c895a: remove pointless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agortl8139: remove pointless cast from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:40 +0000 (18:42 +0200)]
rtl8139: remove pointless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agortl8139: Remove unneeded double indirection of PCIRTL8139State
Juan Quintela [Mon, 24 Aug 2009 16:42:39 +0000 (18:42 +0200)]
rtl8139: Remove unneeded double indirection of PCIRTL8139State

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: Remove unused indirection of PCIDevice
Juan Quintela [Mon, 24 Aug 2009 16:42:37 +0000 (18:42 +0200)]
eepro100: Remove unused indirection of PCIDevice

Once there, there is no way that we don't have a PCI Device at save/load time. Remove the check

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: cast a void * makes no sense
Juan Quintela [Mon, 24 Aug 2009 16:42:36 +0000 (18:42 +0200)]
eepro100: cast a void * makes no sense

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: convert casts to DO_UPCAST()
Juan Quintela [Mon, 24 Aug 2009 16:42:35 +0000 (18:42 +0200)]
eepro100: convert casts to DO_UPCAST()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Read host DNS config on demand
Ed Swierk [Fri, 21 Aug 2009 02:00:31 +0000 (19:00 -0700)]
slirp: Read host DNS config on demand

Currently the qemu user-mode networking stack reads the host DNS
configuration (/etc/resolv.conf or the Windows equivalent) only once
when qemu starts.  This causes name lookups in the guest to fail if the
host is moved to a different network from which the original DNS servers
are unreachable, a common occurrence when the host is a laptop.

This patch changes the slirp code to read the host DNS configuration on
demand, caching the results for at most 1 second to avoid unnecessary
overhead if name lookups occur in rapid succession.  On non-Windows
hosts, /etc/resolv.conf is re-read only if the file has been replaced or
if its size or mtime has changed.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Remove our_addr code
Ed Swierk [Fri, 21 Aug 2009 02:00:25 +0000 (19:00 -0700)]
slirp: Remove our_addr code

Three problems with our_addr:

- It's determined only once when qemu starts, but the address can change
(just like the DNS configuration can).

- It's supposed to be the IP address of a host network interface, but
there's no guarantee that gethostbyname(gethostname()) actually does
that: the host might be a laptop that has only a loopback interface up,
or the hostname might be localhost.localdomain, etc.

- It's useless at best: get_dns_addr() calls it, there's no reason to
send DNS requests to a different IP address if you're running a DNS
server on the host and resolv.conf points to 127.0.0.1.

These problems are easily solved by removing the code.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoswitch balloon initialization to -device.
Gerd Hoffmann [Fri, 14 Aug 2009 08:34:22 +0000 (10:34 +0200)]
switch balloon initialization to -device.

With that patch applied "-balloon virtio,args" becomes a shortcut for
"-device virtio-balloon-pci,args".

Side effects:
 - ballon device gains support for id=<tag>.
 - ballon device is off by default now.
 - initialization order changes, which may in different pci slot
   assignment depending on the VM configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: move code to hw/ide/
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:26 +0000 (15:22 +0200)]
ide: move code to hw/ide/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: add save/restore support for mmio
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:25 +0000 (15:22 +0200)]
ide: add save/restore support for mmio

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: add save/restore support for isa
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:24 +0000 (15:22 +0200)]
ide: add save/restore support for isa

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-microdrive.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:23 +0000 (15:22 +0200)]
ide: split away ide-microdrive.c

create ide-microdrive.c and place microdrive support there.
only build ide-microdrive support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-mmio.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:22 +0000 (15:22 +0200)]
ide: split away ide-mmio.c

create ide-mmio.c and place mmio support there.
only build ide-mmio support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-macio.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:21 +0000 (15:22 +0200)]
ide: split away ide-macio.c

create ide-macio.c and place macio support there.
only build ide-macio support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-pci.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:20 +0000 (15:22 +0200)]
ide: split away ide-pci.c

create ide-pci.c and place pci bus support there.
only build ide-pci support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix build (merge with isa mmio split)

15 years agoide: split away ide-isa.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:19 +0000 (15:22 +0200)]
ide: split away ide-isa.c

create ide-isa.c and place isa bus support there.
only build ide-isa support for platforms using it.
also create ide.h header file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-internal.h
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:18 +0000 (15:22 +0200)]
ide: split away ide-internal.h

move lots of IDE defines to the new file.
also make a bunch of functions non-static
and add declaration for them.  Needed by
the following patches of this series.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: add IDEBus struct, cleanups
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:17 +0000 (15:22 +0200)]
ide: add IDEBus struct, cleanups

The current IDE code uses an array of two IDEState structs to maintain
the IDE bus.  This patch adds a IDEBus to be used instead and does a
bunch of cleanups:

 * move ide bus state from IDEState to IDEBus.
 * drop a bunch of ugly pointer arithmetics to figure the active
   interface, explicitly save the interface number instead.
 * add helper functions to save/restore idebus state.

It also fixes a save/restore bug: loadvm allways stores the command in
the master's IDEState, even when it was saved from the slave.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev error logging
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:08 +0000 (10:36 +0200)]
qdev error logging

Use the new qemu_error() function in qdev.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-pci error logging
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:07 +0000 (10:36 +0200)]
virtio-pci error logging

Use the new qemu_error() function for virtio-blk-pci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoadd qemu_error() + friends
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:06 +0000 (10:36 +0200)]
add qemu_error() + friends

This patch adds some functions for error reporting to address the
problem that error messages should be routed to different destinations
depending on the context of the caller, i.e. monitor command errors
should go to the monitor, command line errors to stderr.

qemu_error() is a printf-like function to report errors.

qemu_errors_to_file() and qemu_errors_to_mon() switch the destination
for the error message to the specified file or monitor.  When setting a
new destination the old one will be kept.  One can switch back using
qemu_errors_to_previous().  i.e. it works like a stack.

main() calls qemu_errors_to_file(stderr), so errors go to stderr by
default.  monitor callbacks are wrapped into qemu_errors_to_mon() +
qemu_errors_to_previous(), so any errors triggered by monitor commands
will go to the monitor.

Each thread has its own error message destination.  qemu-kvm probably
should add a qemu_errors_to_file(stderr) call to the i/o-thread
initialization code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: add return value to init() callbacks.
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:05 +0000 (10:36 +0200)]
qdev: add return value to init() callbacks.

Sorry folks, but it has to be.  One more of these invasive qdev patches.

We have a serious design bug in the qdev interface:  device init
callbacks can't signal failure because the init() callback has no
return value.  This patch fixes it.

We have already one case in-tree where this is needed:
Try -device virtio-blk-pci (without drive= specified) and watch qemu
segfault.  This patch fixes it.

With usb+scsi being converted to qdev we'll get more devices where the
init callback can fail for various reasons.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix stack buffer overflows in eepro100.c tx
Reimar Döffinger [Thu, 20 Aug 2009 10:34:22 +0000 (12:34 +0200)]
fix stack buffer overflows in eepro100.c tx

Hello,
the real world issue is that the hardware allows sends up to 2600 bytes,
and for some reason FreeBSD sometimes sends frames larger than the
ethernet frame size (102+1460 is the maximum I have seen so far),
overflowing the on-stack tx buffer of the driver.
Independent of that, the code should avoid allowing the guest to
overwrite the stack.
This is a minimal patch to fix the issue (you could leave out the size
change of the buf array as well, networking still seems to work either
way). Obviously there are better ways to handle it, but a proper fix IMO
would involve first getting rid of the code duplication and given the
number of patches pending for that code I see no point in working on that now.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoCheck block driver read error in pflash_cfi0x
Vijay Kumar [Fri, 21 Aug 2009 04:57:38 +0000 (10:27 +0530)]
Check block driver read error in pflash_cfi0x

If a flash file of size smaller than the flash size is specified in
the -pflash option, the block driver returns error. But the
pflash_cfi0x ignores the error. This results in a flash content of all
zeroes. And the simulation aborts while executing code.

This patch adds the checks for errors from bdrv_read and escalates it
to the calling code.

Signed-off-by: Vijay Kumar B. <vijaykumar@bravegnu.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Simplify cpu_synchronize_state()
Avi Kivity [Mon, 17 Aug 2009 20:19:53 +0000 (23:19 +0300)]
kvm: Simplify cpu_synchronize_state()

cpu_synchronize_state() is a little unreadable since the 'modified'
argument isn't self-explanatory.  Simplify it by making it always
synchronize the kernel state into qemu, and automatically flush the
registers back to the kernel if they've been synchronized on this
exit.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: convert watchdogs
Markus Armbruster [Fri, 21 Aug 2009 08:31:34 +0000 (10:31 +0200)]
qdev: convert watchdogs

-watchdog NAME is now equivalent to -device NAME, except it treats
option argument '?' specially, and supports only one watchdog.

A side effect is that a device created with -watchdog may now receive
a different PCI address.

i6300esb is now available on any machine with a PCI bus, not just PCs.
ib700 is still PC only, but that could be changed easily.

The only remaining use of struct WatchdogTimerModel and
watchdog_add_model() is supporting '-watchdog ?'.  Should be replaced
by searching device_info_list for watchdog devices when we can
identify them there.

Also fixes ib700 not to use vm_clock before it is initialized: in
wdt_ib700_init(), called from register_watchdogs(), which runs before
init_timers().  The bug made ib700_write_enable_reg() crash in
qemu_del_timer().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoClean up upcast from PCIDevice to I6300State
Markus Armbruster [Fri, 21 Aug 2009 08:31:33 +0000 (10:31 +0200)]
Clean up upcast from PCIDevice to I6300State

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMove watchdog, watchdog_action, give them internal linkage
Markus Armbruster [Fri, 21 Aug 2009 08:31:32 +0000 (10:31 +0200)]
Move watchdog, watchdog_action, give them internal linkage

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-blk: handle NULL returns from bdrv_aio_{read, write}
Christoph Hellwig [Thu, 13 Aug 2009 14:49:56 +0000 (16:49 +0200)]
virtio-blk: handle NULL returns from bdrv_aio_{read, write}

The bdrv_aio_{read,write} routines can return a NULL pointer when the
I/O submission fails.  Currently we ignore this and will wait forever
for an I/O completion and leading to a hang of the guest.

I can easily reproduce this using the native Linux AIO patch, but it's
also possible using normal pthreads-based AIO.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoraw-posix: add Linux native AIO support
Christoph Hellwig [Thu, 20 Aug 2009 14:58:35 +0000 (16:58 +0200)]
raw-posix: add Linux native AIO support

Now that do have a nicer interface to work against we can add Linux native
AIO support.  It's an extremly thing layer just setting up an iocb for
the io_submit system call in the submission path, and registering an
eventfd with the qemu poll handler to do complete the iocbs directly
from there.

This started out based on Anthony's earlier AIO patch, but after
estimated 42,000 rewrites and just as many build system changes
there's not much left of it.

To enable native kernel aio use the aio=native sub-command on the
drive command line.  I have also added an option to qemu-io to
test the aio support without needing a guest.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoraw-posix: refactor AIO support
Christoph Hellwig [Thu, 20 Aug 2009 14:58:19 +0000 (16:58 +0200)]
raw-posix: refactor AIO support

Currently the raw-posix.c code contains a lot of knowledge about the
asynchronous I/O scheme that is mostly implemented in posix-aio-compat.c.
All this code does not really belong here and is getting a bit in the
way of implementing native AIO on Linux.

So instead move all the guts of the AIO implementation into
posix-aio-compat.c (which might need a better name, btw).

There's now a very small interface between the AIO providers and raw-posix.c:

 - an init routine is called from raw_open_common to return an AIO context
   for this drive.  An AIO implementation may either re-use one context
   for all drives, or use a different one for each as the Linux native
   AIO support will do.
 - an submit routine is called from the aio_reav/writev methods to submit
   an AIO request

There are no indirect calls involved in this interface as we need to
decide which one to call manually.  We will only call the Linux AIO native
init function if we were requested to by vl.c, and we will only call
the native submit function if we are asked to and the request is properly
aligned.  That's also the reason why the alignment check actually does
the inverse move and now goes into raw-posix.c.

The old posix-aio-compat.h headers is removed now that most of it's
content is private to posix-aio-compat.c, and instead we add a new
block/raw-posix-aio.h headers is created containing only the tiny interface
between raw-posix.c and the AIO implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-console: rename dvq to ovq
Amit Shah [Thu, 20 Aug 2009 09:33:25 +0000 (15:03 +0530)]
virtio-console: rename dvq to ovq

It isn't obvious what 'dvq' stands for. Since it's the output queue and
the corresponding input queue is called 'ivq', call this 'ovq'

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopci ids: remove redundant defines
Amit Shah [Wed, 12 Aug 2009 19:20:28 +0000 (00:50 +0530)]
pci ids: remove redundant defines

Remove some redundant definitions for PCI classes:
PCI_CLASS_SERIAL_OTHER already exists as PCI_CLASS_COMMUNICATION_OTHER
and PCI_CLASS_PROCESSOR_CO is redefined.

PCI_CLASS_SERIAL_OTHER is not used anywhere.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomultiboot.raw is a generated file
Juan Quintela [Wed, 19 Aug 2009 10:19:31 +0000 (12:19 +0200)]
multiboot.raw is a generated file

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort ACPI to VMState
Juan Quintela [Thu, 20 Aug 2009 17:42:41 +0000 (19:42 +0200)]
Port ACPI to VMState

This uses a run_after_load() function, and VMSTATE_PCI_DEVICE()
It could be made smaller changing the type of pm_io_space_update()
to return an int.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>