OSDN Git Service

qmiga/qemu.git
14 years agomips malta: fix indentation
Aurelien Jarno [Sat, 14 Nov 2009 12:10:43 +0000 (13:10 +0100)]
mips malta: fix indentation

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: fix indentation
Aurelien Jarno [Sat, 14 Nov 2009 12:10:00 +0000 (13:10 +0100)]
target-mips: fix indentation

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomips-malta: fix reset
Aurelien Jarno [Sat, 14 Nov 2009 12:04:29 +0000 (13:04 +0100)]
mips-malta: fix reset

(broken by 45a50b1668822c23afc2a89f724654e176518bc4)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomips: fix cpu_reset memory leak
Blue Swirl [Sun, 8 Nov 2009 10:50:21 +0000 (12:50 +0200)]
mips: fix cpu_reset memory leak

Remove cpu_mips_register()
- move mmu_init(), fpu_init() and mvp_init() into cpu_mips_init()
- move the other parts in cpu_mips_init()

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agofix make clean targets
Magnus Damm [Fri, 13 Nov 2009 09:51:05 +0000 (18:51 +0900)]
fix make clean targets

This patch fixes clean in case of missing directories and
also adds code to distclean that removes the following files:
 qemu-monitor.texi roms/seabios/config.mak roms/vgabios/config.mak

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosh4 disasm fixes
Magnus Damm [Fri, 13 Nov 2009 09:54:22 +0000 (18:54 +0900)]
sh4 disasm fixes

Add the sh4 target to the monitor disassembly function,
and remove a duplicate "0x" printout from the sh4 dis-
assembly code.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/i386: remove duplicate sar opcode
Magnus Damm [Fri, 13 Nov 2009 09:58:08 +0000 (18:58 +0900)]
tcg/i386: remove duplicate sar opcode

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agopci: Fix function pci_default_write_config
Stefan Weil [Fri, 13 Nov 2009 22:26:27 +0000 (23:26 +0100)]
pci: Fix function pci_default_write_config

Change 260c0cd3d985e51b15870ff47e17b7b930efbda1
(pci: use range helper functions) introduced a
bug which made pci cirrus vga on mips malta
(and maybe other pci devices) fail.

Don't change addr - its original value is needed
by ranges_overlap() and range_covers().

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Acked-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomips: fix CPU reset
Aurelien Jarno [Sat, 14 Nov 2009 00:04:29 +0000 (01:04 +0100)]
mips: fix CPU reset

Don't load the kernel twice during reset.
See f2d74978764f62d832d61ac17bb5d934ade58816.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix PPC crash
Blue Swirl [Fri, 13 Nov 2009 19:00:11 +0000 (19:00 +0000)]
Fix PPC crash

Because of a typo, structure field vga_bios_size was not initialized
properly and a bogus BAR6 for the nonexistent VGA BIOS appeared.

The bug was uncovered by c169998802505c244b8bcad562633f29de7d74a4.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoARM MPCore tweaks
Paul Brook [Fri, 13 Nov 2009 04:31:22 +0000 (04:31 +0000)]
ARM MPCore tweaks

Allow the user to specify the number of cores present on the
RealView EB + ARM11MPCore board.  Also split into its own config
rather than guessing from the CPU name.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoRealview/EB procid hacks
Paul Brook [Fri, 13 Nov 2009 03:30:33 +0000 (03:30 +0000)]
Realview/EB procid hacks

Guess core tile ID based on CPU type.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agopci: fix the conversion of config field from array to pointer
Juan Quintela [Wed, 11 Nov 2009 23:39:14 +0000 (00:39 +0100)]
pci: fix the conversion of config field from array to pointer

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu_system_reset: we need to call it before loadvm/migration
Juan Quintela [Wed, 11 Nov 2009 23:39:13 +0000 (00:39 +0100)]
qemu_system_reset: we need to call it before loadvm/migration

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofdc: fix vmstate variable passed
Juan Quintela [Wed, 11 Nov 2009 23:39:12 +0000 (00:39 +0100)]
fdc: fix vmstate variable passed

When code was transformed to use qdev_reset/vmstate registration, vmstate
was passed a variable of the wrong type

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: improve capslock handling.
Gerd Hoffmann [Mon, 2 Nov 2009 11:47:06 +0000 (12:47 +0100)]
vnc: improve capslock handling.

When capslock is toggled while the vnc window hasn't the focus qemu
will miss the state change.  Add sanity checks for the capslock state
and toggle it if needed, so hosts and guests idea of capslock state
stay in sync.  Simliar logic for numlock is present in qemu already.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoe1000 fix: read access to some registers is missing.
Kay Ackermann [Sat, 31 Oct 2009 17:29:43 +0000 (18:29 +0100)]
e1000 fix: read access to some registers is missing.

While writing working on an e1000 driver for my university's OS I
noticed that some registers aren't readable in QEMU, but they should
be readable as stated in Intels Driver Developer Manual (and also
verified on real hardware).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix 32-bit overflow in parallels image support
David Woodhouse [Sat, 7 Nov 2009 14:10:01 +0000 (14:10 +0000)]
Fix 32-bit overflow in parallels image support

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokvm ppc: Remove unused label
Hollis Blanchard [Mon, 9 Nov 2009 21:05:38 +0000 (21:05 +0000)]
kvm ppc: Remove unused label

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agokvm: Move KVM mp_state accessors to i386-specific code
Hollis Blanchard [Mon, 9 Nov 2009 21:05:37 +0000 (21:05 +0000)]
kvm: Move KVM mp_state accessors to i386-specific code

Unbreaks PowerPC and S390 KVM builds.

Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-blk: Pass read errors to the guest
Kevin Wolf [Thu, 5 Nov 2009 12:08:59 +0000 (13:08 +0100)]
virtio-blk: Pass read errors to the guest

We need to signal not only write errors, but also read errors to the guest
driver. This fixes a regression introduced by 869a5c6d.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosavevm: Delete existing snapshots in all images
Kevin Wolf [Tue, 3 Nov 2009 16:34:37 +0000 (17:34 +0100)]
savevm: Delete existing snapshots in all images

When creating a snapshot we can run into the situation that the first disk
doesn't have a snapshot, but the second one does have one with the same name as
the new snapshot.

In this case, qemu doesn't recognize that there is a snapshot to be
overwritten, so it starts to save the new snapshot and errors out later when it
tries to snapshot the second image. With this patch, snapshots on secondary
images are overwritten just like on the first image.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix incoming migration
Juan Quintela [Fri, 6 Nov 2009 14:58:06 +0000 (15:58 +0100)]
Fix incoming migration

commit b04c4134d6de28c249277de19e523bfbe4aebbd6
broke incoming migration.  After talking with Gleb, code was intended
to be the way is in this fix.  This fixes migration here.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix type in CFLAGS name
Juan Quintela [Thu, 5 Nov 2009 16:19:58 +0000 (17:19 +0100)]
fix type in CFLAGS name

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix parallel build
Juan Quintela [Thu, 5 Nov 2009 16:19:57 +0000 (17:19 +0100)]
fix parallel build

Based on a ideas of Daniel Jacobowitz + Stefan Weil

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Check if unplug handler exists before calling it
Amit Shah [Mon, 2 Nov 2009 09:26:41 +0000 (14:56 +0530)]
qdev: Check if unplug handler exists before calling it

A bus may have hotplugging enabled but not have the 'unplug'
callback defined, which would lead to a crash on trying to
unplug a device on the bus.

Fix by introducing an assert to check if the callback is valid.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMakefile: Fix definition of pxe-*.bin blobs
Stefan Weil [Mon, 2 Nov 2009 18:59:06 +0000 (19:59 +0100)]
Makefile: Fix definition of pxe-*.bin blobs

* Remove 2nd entry for pxe-pcnet.bin.
  This kind of error can be avoided by sorting
  entries. So all pxe-*.bin entries are now sorted
  alphabetically.
* Rename pxe-eepro100.bin -> pxe-i82559er.bin.
  This change completes another patch which did
  the rename on the pxe image for i82559er.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoeepro100: Add missing .exit initialisation
Stefan Weil [Mon, 2 Nov 2009 16:34:53 +0000 (17:34 +0100)]
eepro100: Add missing .exit initialisation

Some devices did not have an initialisation value
for entry ".exit". This is fixed here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoeepro100: Fix boot ROM support
Stefan Weil [Sat, 31 Oct 2009 12:38:33 +0000 (13:38 +0100)]
eepro100: Fix boot ROM support

* Rename pxe-eepro100.bin to pxe-i82559er.bin.
  The other devices supported by eepro100.c need
  additional pxe boot ROM images.
* Call rom_add_option during initialisation.
  The code won't work with two or more different
  eepro100 devices, because it only adds one option
  ROM, but this use case is perhaps never needed.

Using this patch, model=i82559er at least works partially.
For full support, more eepro100 patches are needed
(will follow later, can be fetched from ar7 branch
of QEMU).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMakefile: Prettify logging
Stefan Weil [Sat, 31 Oct 2009 10:36:16 +0000 (11:36 +0100)]
Makefile: Prettify logging

Replace
GEN  config-all-devices.mak
by
GEN   config-all-devices.mak

Like this, the logging output is column aligned.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoserial: Add interface to set reference oscillator frequency
Stefan Weil [Sat, 31 Oct 2009 10:28:11 +0000 (11:28 +0100)]
serial: Add interface to set reference oscillator frequency

Many (most?) serial interfaces have a programmable
clock which provides the reference frequency ("baudbase").
So a fixed baudbase which is only set once can be wrong.

omap1.c is an example which could use the new interface
to change baudbase when the programmable clock changes.
ar7 system emulation (still not part of standard QEMU)
is similar to omap and already uses serial_set_frequency.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomicroblaze: Move the kcmdline out of the way.
Edgar E. Iglesias [Thu, 12 Nov 2009 01:15:20 +0000 (02:15 +0100)]
microblaze: Move the kcmdline out of the way.

Avoids rom overlap conflicts.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agomicroblaze: Restore env when raising unmapped bus access.
Edgar E. Iglesias [Thu, 12 Nov 2009 01:14:45 +0000 (02:14 +0100)]
microblaze: Restore env when raising unmapped bus access.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agomicroblaze: Unbreak reset.
Edgar E. Iglesias [Thu, 12 Nov 2009 01:12:44 +0000 (02:12 +0100)]
microblaze: Unbreak reset.

Initialize synthesis config registers at reset to cope with the new
cpu_reset sequences.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoFix ARM MCore secondary cpu boot
Paul Brook [Wed, 11 Nov 2009 19:59:29 +0000 (19:59 +0000)]
Fix ARM MCore secondary cpu boot

Make MPCore secondary cpu initialization work with the new reset
handling.  Also change the inital FLAG value from 3 to zero to match
recent kenrels.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoReject late rom loading
Paul Brook [Wed, 11 Nov 2009 18:17:24 +0000 (18:17 +0000)]
Reject late rom loading

rom_+add_file/rom_add_blob only work correctly if called before
load_all_roms.  Enforce this rather than silently accepting and putting
the rom in the wrong place at reset.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoFix ARM system emulation
Paul Brook [Wed, 11 Nov 2009 18:07:53 +0000 (18:07 +0000)]
Fix ARM system emulation

Since 45a50b1 load_image_targphys should only be called once.
ARM boards incorrectly call it every time the system is reset.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoQemuOpts: command line switches for the config file.
Gerd Hoffmann [Wed, 14 Oct 2009 08:39:28 +0000 (10:39 +0200)]
QemuOpts: command line switches for the config file.

Adds -readconfig and -writeconfig command line switches to read/write
QemuOpts from config file.

In theory you should be able to do:

  qemu < machine config cmd line switches here > -writeconfig vm.cfg
  qemu -readconfig vm.cfg

In practice it will not work.  Not all command line switches are
converted to QemuOpts, so you'll have to keep the not-yet converted ones
on the second line.  Also there might be bugs lurking which prevent even
the converted ones from working correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQemuOpts: parse config from file.
Gerd Hoffmann [Wed, 14 Oct 2009 08:39:27 +0000 (10:39 +0200)]
QemuOpts: parse config from file.

Add functions to parse QemuOpts from a git-style config file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQemuOpts: dump config.
Gerd Hoffmann [Wed, 14 Oct 2009 08:39:26 +0000 (10:39 +0200)]
QemuOpts: dump config.

Add a function to write the QemuOpts configuration to a git-style
config file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQemuOpts: add find_list()
Gerd Hoffmann [Wed, 14 Oct 2009 08:39:25 +0000 (10:39 +0200)]
QemuOpts: add find_list()

Factor out the QemuOptsList search code for upcoming users.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoDocumentation: Add options to image format descriptions
Kevin Wolf [Wed, 28 Oct 2009 11:49:17 +0000 (12:49 +0100)]
Documentation: Add options to image format descriptions

Explain the existing format specific options that can be used with qemu-img
create/convert -o ...

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoDocumentation: Don't mention old qemu-img options
Kevin Wolf [Wed, 28 Oct 2009 11:49:16 +0000 (12:49 +0100)]
Documentation: Don't mention old qemu-img options

The old options are still supported for compatibility, but they are
inconsistent (for example create -b vs. convert -B for backing files) and
incomplete (-F only exists for create) which tends to confuse people. Remove
all references to the old options from the documentation to guide users to the
more consistent -o options.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoDocumentation: Move image format descriptions to own section
Kevin Wolf [Wed, 28 Oct 2009 11:49:15 +0000 (12:49 +0100)]
Documentation: Move image format descriptions to own section

The description of the image formats is too long to be a subitem of a parameter
description. It will become even longer when we include the options provided by
the respective format.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoDocumentation: Add documentation for -chardev
Matthew Booth [Fri, 30 Oct 2009 13:41:12 +0000 (13:41 +0000)]
Documentation: Add documentation for -chardev

Adds documentation for all -chardev backends.

Signed-off-by: Matthew Booth <mbooth@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdded imlpementation for qemu_error for non-qemu executables
Naphtali Sprei [Wed, 28 Oct 2009 16:41:39 +0000 (18:41 +0200)]
Added imlpementation for qemu_error for non-qemu executables

Now qemu_error can be called also from shared files, e.g. block.c.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoeepro100: Improve support for different devices
Stefan Weil [Fri, 30 Oct 2009 12:36:21 +0000 (13:36 +0100)]
eepro100: Improve support for different devices

* Add device properties (size of statistical data,
  extended tcb support) to EEPRO100State and set
  these values for the different devices.

* Fix PCI configuration for existing devices.

* Add initialisation code for missing devices.

* Remove function device_supports_eTxCB.
  It is no longer needed.

* Fix dump of statistical data. It now respects
  the real size of the statistical data.
  An endianess issue was fixed here, too.

* CU_SHOWSTATS, CU_DUMPSTATS now write a
  completion value after the statistical data.
  There is no need to keep this value in
  eepro100_stats_t, so member "complete"
  could be removed.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci/monitor: print out bridge's filtering values and so on.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:26 +0000 (21:21 +0900)]
pci/monitor: print out bridge's filtering values and so on.

make pci_info_device() print out bridge's filtering value like
io base/limit, subbus and subordinate bus.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: implement pci bridge filtering.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:25 +0000 (21:21 +0900)]
pci: implement pci bridge filtering.

This patch implements pci bridge filtering.

TODO: currently almost all the map funcions assumes
filtered_size == size and addr & ~(size - 1) == addr.
However with bridge filtering, they aren't always true.
Teach them such cases, such that filtered_size < size and
addr & (size - 1) != 0.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: factor out pci_for_each_device().
Isaku Yamahata [Fri, 30 Oct 2009 12:21:24 +0000 (21:21 +0900)]
pci: factor out pci_for_each_device().

split out device iteration logic from pci_for_each_device().
factored out function, pci_for_each_device_under_bus() will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: cosmetic on pci_upadte_mappings()
Isaku Yamahata [Fri, 30 Oct 2009 12:21:23 +0000 (21:21 +0900)]
pci: cosmetic on pci_upadte_mappings()

Remove one indentation of pci_update_mappings.
Just for cosmetics, no logic change.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: initialize pci config headers depending it pci header type.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:22 +0000 (21:21 +0900)]
pci: initialize pci config headers depending it pci header type.

- Only sets default subsystem id for header type 00.(normal header type)
  because header type 01 doesn't have subsystem id, and uses the register
  for other purpose. So setting default subsystem id doesn't make sense.

- initialize wmask more for header type 01.(bridge header type)
  Without those wmasks, linux was confused not boot,
  and lspci was confused not to print out expected IO/memory range.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: teach pci_default_config_write() ROM bar for normal/bridge device .
Isaku Yamahata [Fri, 30 Oct 2009 12:21:21 +0000 (21:21 +0900)]
pci: teach pci_default_config_write() ROM bar for normal/bridge device .

When updated ROM expantion address of header type 0, it missed
to update mappings.
Add PCI_ROM_ADDRESS check whether to call pci_update_mappings()
Also update pci mapping when PCI_ROM_ADDRESS1 is written for header type 1.

pci_update_mapping() path isn't performance critical,
so call it even independent of header type.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: use range helper functions.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:20 +0000 (21:21 +0900)]
pci: use range helper functions.

clean up pci_default_write_config() by the range helper functions.

Suggested by Michael S. Tsirkin <mst@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: add helper functions to check ranges overlap.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:19 +0000 (21:21 +0900)]
pci: add helper functions to check ranges overlap.

add helper function to check ranges overlap suggested by
Michael S. Tsirkin <mst@redhat.com>.
His original suggestion was to use [first, last], however I chosen
to use offset, length pair, i.e. [offset, offset + length)
because pci configuration space related functions all uses offset and length
pair, so it helps to avoid to type constant twice.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: pcie host and mmcfg support.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:18 +0000 (21:21 +0900)]
pci: pcie host and mmcfg support.

This patch adds common routines for pcie host bridge and pcie mmcfg.
This will be used by q35 based chipset emulation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmstate: introduce VMSTATE_BUFFER_UNSAFE_INFO.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:17 +0000 (21:21 +0900)]
vmstate: introduce VMSTATE_BUFFER_UNSAFE_INFO.

VMSTATE_BUFFER_UNSAFE_INFO for as a buffer with specified VMStateInfo.
It will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci_host: change the signature of pci_data_{read, write}.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:16 +0000 (21:21 +0900)]
pci_host: change the signature of pci_data_{read, write}.

change the first argument, void *opaque to PCIBus *s
of the pci_data_{read, write}.
They aren't used as direct callback so the argument type
don't have to be void*. So change it to the right type.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: move pci host stuff from pci.c to pci_host.c
Isaku Yamahata [Fri, 30 Oct 2009 12:21:15 +0000 (21:21 +0900)]
pci: move pci host stuff from pci.c to pci_host.c

Move pci host stuff from pci.c to pci_host.c.
And add some comments.
Later pcie host bridge functions will be defined in pcie_host.c
not to bloat pci.c.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: factor out the conversion logic from io port address into pci device.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:14 +0000 (21:21 +0900)]
pci: factor out the conversion logic from io port address into pci device.

factor out the logic which converts io port address into pci device
and offset in PCI configuration space.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: make pci configuration transaction more accurate.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:13 +0000 (21:21 +0900)]
pci: make pci configuration transaction more accurate.

This patch sorts out/enhances pci code to track pci bus topology
more accurately.
- Track host bus bridge with pci domain number. Although the
  current qemu implementation supports only pci domian 0 yet.
- Track pci bridge parent-child relationship.
When looking down from pci host bus for pci sub bus, be aware of
secondary bus/subordinate bus.
Thus pci configuration transaction is more accurately emulated.

This patch adds new member to PCIBus to track pci bus topology.
Since qdev already tracks down bus relationship, those new member
wouldn't be necessary.
However it would be addressed later because not all the pci device
isn't converted to qdev yet.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: remove bus_num member from struct PCIBus.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:12 +0000 (21:21 +0900)]
pci: remove bus_num member from struct PCIBus.

Since It can be retrieved from pci configuration space,
the member is unnecessary.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: 64bit bar support.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:11 +0000 (21:21 +0900)]
pci: 64bit bar support.

implemented pci 64bit bar support.
The tricky bit is pci_update_mapping().
An OS is allowed to set the BAR such that OS can't address the area
pointed by BAR. It doesn't make sense, though.
In that case, don't map the BAR.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: typedef pcibus_t as uint64_t instead of uint32_t.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:10 +0000 (21:21 +0900)]
pci: typedef pcibus_t as uint64_t instead of uint32_t.

This patch is preliminary for 64bit bar.
For 64bit bar support, change pcibus_t which represents
pci bus addr/size from uint32_t to uint64_t.
And also change FMT_pcibus for printf.

In pci_update_mapping() checks 32bit overflow.
So the check must be updated too.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: introduce FMT_PCIBUS for printf format for pcibus_t.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:09 +0000 (21:21 +0900)]
pci: introduce FMT_PCIBUS for printf format for pcibus_t.

This patch is preliminary for 64bit BAR.
Later pcibus_t will be changed from uint32_t to uint64_t.
Introduce FMT_PCIBUS for printf format for pcibus_t.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: introduce pcibus_t to represent pci bus address/size instead of uint32_t
Isaku Yamahata [Fri, 30 Oct 2009 12:21:08 +0000 (21:21 +0900)]
pci: introduce pcibus_t to represent pci bus address/size instead of uint32_t

This patch is preliminary for 64 bit BAR support.
Introduce dedicated type, pcibus_t, to represent pci bus address/size
instead of uint32_t.
Later this type will be changed to uint64_t.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci_host: consolidate pci config address access.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:07 +0000 (21:21 +0900)]
pci_host: consolidate pci config address access.

consolidate pci_config address access into pci_host.c

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci_host.h: move functions in pci_host.h into .c file.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:06 +0000 (21:21 +0900)]
pci_host.h: move functions in pci_host.h into .c file.

split static functions in pci_host.h into pci_host.c and
pci_host_template.h.
Later a structures declared in pci_host.h, PCIHostState, will be used.
However pci_host.h doesn't allow to include itself easily. This patches
addresses it.

pci_host.h includes functions which are instantiated in .c by including
pci_host.h with typedefing pci_addr_t.
pci_addr_t is per pci host bridge and is typedef'ed to uint32_t for ioio
or target_phys_addr_t for mmio in .c file.
That prevents from including pci_host.h to use PCIHostState because of
requiring type, pci_addr_t.

Its purpose to include is to instantiate io function for mmio or ioio
depending on which pci host bridge requires ioio or mmio.
To avoid including code, we always instantiate both version.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: make pci_bar() aware of header type 1.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:05 +0000 (21:21 +0900)]
pci: make pci_bar() aware of header type 1.

make pci_bar() aware of header type 1. When PCI_ROM_SLOT
it should return PCI_ROM_ADDRESS1 (!= PCI_ROM_ADDRESS)

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: clean up of pci_default_read_config.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:04 +0000 (21:21 +0900)]
pci: clean up of pci_default_read_config.

This patch cleans up pci_default_read_config() removing
ugly length and range check.

Suggested by "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h
Isaku Yamahata [Fri, 30 Oct 2009 12:21:03 +0000 (21:21 +0900)]
pci: s/PCI_ADDRESS_SPACE_/PCI_BASE_ADDRESS_SPACE_/ to match pci_regs.h

make constants for pci base address match pci_regs.h by
renaming PCI_ADDRESS_SPACE_xxx to PCI_BASE_ADDRESS_SPACE_xxx.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: clean up pci_init_wmask()
Isaku Yamahata [Fri, 30 Oct 2009 12:21:02 +0000 (21:21 +0900)]
pci: clean up pci_init_wmask()

use pci_set_word() for pci command register.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci/bridge: clean up of pci_bridge_initfn()
Isaku Yamahata [Fri, 30 Oct 2009 12:21:01 +0000 (21:21 +0900)]
pci/bridge: clean up of pci_bridge_initfn()

- use symbolic constant
- use helper function pci_set_xxx()
- removed lines which initializes to 0.
  It is unnecessary because it is already zeroed.
- add some comments on command registers.

Some initial values are suspicious because they seems to
be specific to apb_pci.c which is the only user of pci bridge right now.
For now don't touch those values to avoid breakage.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: use helper functions to access pci config space.
Isaku Yamahata [Fri, 30 Oct 2009 12:21:00 +0000 (21:21 +0900)]
pci: use helper functions to access pci config space.

use pci_[gs]et_{byte, word, long}() to access pci configuration
space.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: helper functions to access PCIDevice::config
Isaku Yamahata [Fri, 30 Oct 2009 12:20:59 +0000 (21:20 +0900)]
pci: helper functions to access PCIDevice::config

add helper functions to get/set PCIDevice::config
Those will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: define a constant to represent a unmapped bar and use it.
Isaku Yamahata [Fri, 30 Oct 2009 12:20:58 +0000 (21:20 +0900)]
pci: define a constant to represent a unmapped bar and use it.

define a constant to represent a unmapped bar instead of -1 and use it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: use PCI_SLOT() and PCI_FUNC().
Isaku Yamahata [Fri, 30 Oct 2009 12:20:57 +0000 (21:20 +0900)]
pci: use PCI_SLOT() and PCI_FUNC().

use PCI_SLOT() and PCI_FUNC() where appropriate instead of
direct use of bit operation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
Isaku Yamahata [Fri, 30 Oct 2009 12:20:56 +0000 (21:20 +0900)]
pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.

introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
and use it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopci: fix PCI_DPRINTF() wrt variadic macro.
Isaku Yamahata [Fri, 30 Oct 2009 12:20:55 +0000 (21:20 +0900)]
pci: fix PCI_DPRINTF() wrt variadic macro.

add missing ## in PCI_DPRINTF() to compile.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMakefile: make qemu-io dependent on config-host.h
Paolo Bonzini [Thu, 29 Oct 2009 18:46:35 +0000 (19:46 +0100)]
Makefile: make qemu-io dependent on config-host.h

This is needed also for qemu-io, but not for qemu-nbd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move scsi-disk.h -> scsi.h
Gerd Hoffmann [Fri, 30 Oct 2009 08:54:00 +0000 (09:54 +0100)]
scsi: move scsi-disk.h -> scsi.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi: move scsi.h -> esp.h
Gerd Hoffmann [Fri, 30 Oct 2009 08:53:59 +0000 (09:53 +0100)]
scsi: move scsi.h -> esp.h

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMakefile: make qemu-img dependant on config-host.h
Uri Lublin [Thu, 29 Oct 2009 18:40:01 +0000 (14:40 -0400)]
Makefile: make qemu-img dependant on config-host.h

Since config-host.h is generated by the Makefile (1215c6e76),
building (only) qemu-img fails:

[user@f12-uri qemu]$ make distclean (or git clone qemu)
[user@f12-uri qemu]$ ./configure ...
[user@f12-uri qemu]$ make qemu-img
GEN  config-all-devices.mak
GEN   qemu-img-cmds.h
CC    qemu-img.o
In file included from qemu-img.c:24:
qemu-common.h:32:25: error: config-host.h: No such file or directory

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agowhitelist host virtio networking features
Dustin Kirkland [Thu, 29 Oct 2009 15:34:15 +0000 (10:34 -0500)]
whitelist host virtio networking features

This patch is a followup to 8eca6b1bc770982595db2f7207c65051572436cb,
fixing crashes when guests with 2.6.25 virtio drivers have saturated
virtio network connections.

https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/458521

That patch should have been whitelisting *_HOST_* rather than the the
*_GUEST_* features.

I tested this by running an Ubuntu 8.04 Hardy guest (2.6.24 kernel +
2.6.25-virtio driver).  I saturated both the incoming, and outgoing
network connection with nc, seeing sustained 6MB/s up and 6MB/s down
bitrates for ~20 minutes.  Previously, this crashed immediately.  Now,
the guest does not crash and maintains network connectivity throughout
the test.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-img: Allow creating zero sized images
Kevin Wolf [Wed, 28 Oct 2009 10:36:07 +0000 (11:36 +0100)]
qemu-img: Allow creating zero sized images

A size of 0 should be valid and cannot be treated as "missing value". Use -1
for this purpose instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotap: drain queue in tap_send()
Mark McLoughlin [Tue, 27 Oct 2009 18:16:39 +0000 (18:16 +0000)]
tap: drain queue in tap_send()

Okay, let's try re-enabling the drain-entire-queue behaviour, with a
difference - before each subsequent packet, use qemu_can_send_packet()
to check that we can send it. This is similar to how we check before
polling the tap fd and avoids having to drop a packet if the receiver
cannot handle it.

This patch should be a performance improvement since we no longer have
to go through the mainloop for each packet.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-net: split the has_buffers() logic from can_receive()
Mark McLoughlin [Tue, 27 Oct 2009 18:16:38 +0000 (18:16 +0000)]
virtio-net: split the has_buffers() logic from can_receive()

We should only return zero from receive() for a condition which we'll
get notification of when it changes. Currently, we're returning zero
if the guest driver is not ready, but we won't ever flush our queue
when that status changes.

Also, don't check buffer space in can_receive(), but instead just allow
receive() to return zero when this condition occurs and have the caller
handle queueing the packet.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet/queue: queue packets even if sender doesn't supply a callback
Mark McLoughlin [Tue, 27 Oct 2009 18:16:37 +0000 (18:16 +0000)]
net/queue: queue packets even if sender doesn't supply a callback

Now that we disable any receiver whose queue is full, we do not require
senders to handle a zero return by supplying a sent callback.

This is a second step towards allowing can_receive() handlers to return
true even if no buffer space is available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: disable receiving if client returns zero
Mark McLoughlin [Tue, 27 Oct 2009 18:16:36 +0000 (18:16 +0000)]
net: disable receiving if client returns zero

If a receiver returns zero, that means its queue is full and it will
notify us when room is available using qemu_flush_queued_packets().

Take note of that and disable that receiver until it flushes its queue.

This is a first step towards allowing can_receive() handlers to return
true even if no buffer space is available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotap: disable draining queue in one go
Mark McLoughlin [Tue, 27 Oct 2009 18:16:35 +0000 (18:16 +0000)]
tap: disable draining queue in one go

If qemu_send_packet_async() returns zero, it means the packet has been
queued and the sent callback will be invoked once it has been flushed.

This is only possible where the NIC's receive() handler returns zero
and promises to notify the networking core that room is available in its
queue again.

In the case where the receive handler does not have this capability
(and its queue fills up) it returns -1 and the networking core does not
queue up the packet. This condition is indicated by a -1 return from
qemu_send_packet_async().

Currently, tap handles this condition simply by dropping the packet. It
should do its best to avoid getting into this situation by checking such
NIC's have room for a packet before copying the packet from the tap
interface.

tap_send() used to achieve this by only reading a single packet before
returning to the mainloop. That way, tap_can_send() is called before
reading each packet.

tap_send() was changed to completely drain the tap interface queue
without taking into account the situation where the NIC returns an
error and the packet is not queued. Let's start fixing this by
reverting to the previous behaviour of reading one packet at a time.

Reported-by: Scott Tsai <scottt.tw@gmail.com>
Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoConfigurable block format whitelist
Markus Armbruster [Tue, 27 Oct 2009 17:41:44 +0000 (18:41 +0100)]
Configurable block format whitelist

We have code for a quite a few block formats.  While I trust that all
of these formats are useful at least for some people in some
circumstances, some of them are of a kind that friends don't let
friends use in production.

This patch provides an optional block format whitelist, default off.
If a whitelist is configured with --block-drv-whitelist, QEMU proper
can use only whitelisted formats.  Other programs, like qemu-img, are
not affected.

Drivers for formats off the whitelist still participate in format
probing, to ensure all programs probe exactly the same.  Without that,
QEMU proper would be prone to treat images with a format off the
whitelist as raw when the image's format is probed.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user
Markus Armbruster [Tue, 27 Oct 2009 12:52:13 +0000 (13:52 +0100)]
qdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user

These devices are created automatically, and attempting to create
another one with -device fails with "qemu: hardware error:
register_ioport_write: invalid opaque".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoPass the drive's readonly attribute to the guest OS
Naphtali Sprei [Thu, 29 Oct 2009 09:42:11 +0000 (11:42 +0200)]
Pass the drive's readonly attribute to the guest OS

Implemented for virtio-blk and for scsi

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdded readonly flag to -drive command
Naphtali Sprei [Mon, 26 Oct 2009 14:25:16 +0000 (16:25 +0200)]
Added readonly flag to -drive command

This is a slightly revised patch for adding readonly flag to the -drive command.
Even though this patch is "stand-alone", it assumes a previous related patch (in Anthony staging tree), that passes
the readonly attribute of the drive to the guest OS, applied first.

This enables sharing same image between guests, with readonly access.
Implementaion mark the drive as read_only and changes the flags when actually opening the file.
The readonly attribute of a qcow also passed to it's base file.
For ide that cannot pass the readonly attribute to the guest OS, disallow the readonly flag.

Also, return error code from bdrv_truncate for readonly drive.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Allow qcow2 disk images with size zero
Stefan Weil [Mon, 26 Oct 2009 15:11:16 +0000 (16:11 +0100)]
qcow2: Allow qcow2 disk images with size zero

Images with disk size 0 may be used for
VM snapshots, but not to save normal block data.

It is possible to create such images using
qemu-img, but opening them later fails.

So even "qemu-img info image.qcow2" is not
possible for an image created with
"qemu-img create -f qcow2 image.qcow2 0".

This is fixed here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years ago(x86/Sparc/PPC)-user: fix cpu_copy
Blue Swirl [Sat, 7 Nov 2009 16:34:12 +0000 (16:34 +0000)]
(x86/Sparc/PPC)-user: fix cpu_copy

b55a37c981914aa8ecd21b9a2a2fb37f39b917c5 moved the call to cpu_reset
to user emulators. But cpu_copy also initializes a CPU structure, so add the
call also there.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoIDE: Fix reset handling
Blue Swirl [Sat, 7 Nov 2009 14:13:05 +0000 (14:13 +0000)]
IDE: Fix reset handling

Problem: x86 systems could not survive a few system_resets.

Clear most of IDE state when reset. Implement the missing reset handlers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agouser: move CPU reset call to main.c for x86/PPC/Sparc
Blue Swirl [Sat, 7 Nov 2009 10:37:06 +0000 (10:37 +0000)]
user: move CPU reset call to main.c for x86/PPC/Sparc

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPPC: rename cpu_ppc_reset to cpu_reset for consistency
Blue Swirl [Sat, 7 Nov 2009 10:36:04 +0000 (10:36 +0000)]
PPC: rename cpu_ppc_reset to cpu_reset for consistency

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc64/x86: remove unneeded calls to device reset
Blue Swirl [Sat, 7 Nov 2009 10:05:03 +0000 (10:05 +0000)]
Sparc64/x86: remove unneeded calls to device reset

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>