Commit graph

18436 commits

Author SHA1 Message Date
Ronnie Sahlberg f9dadc9855 iSCSI: add configuration variables for iSCSI
This patch adds configuration variables for iSCSI to set
initiator-name to use when logging in to the target,
which type of header-digest to negotiate with the target
and username and password for CHAP authentication.

This allows specifying a initiator-name either from the command line
-iscsi initiator-name=iqn.2004-01.com.example:test
or from a configuration file included with -readconfig
    [iscsi]
      initiator-name = iqn.2004-01.com.example:test
      header-digest = CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
      user = CHAP username
      password = CHAP password

If you use several different targets, you can also configure this on a per
target basis by using a group name:
    [iscsi "iqn.target.name"]
    ...

The configuration file can be read using -readconfig.
Example :
qemu-system-i386 -drive file=iscsi://127.0.0.1/iqn.ronnie.test/1
 -readconfig iscsi.conf

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Stefan Hajnoczi 71b58b82da qemu-io: add write -z option for bdrv_co_write_zeroes
Extend the qemu-io write command with the -z option to call
bdrv_co_write_zeroes().  Exposing the zero write interface from qemu-io
allows us to write tests that exercise this new block layer interface.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Stefan Hajnoczi 0e71be1932 qed: add .bdrv_co_write_zeroes() support
Zero writes are a dedicated interface for writing regions of zeroes into
the image file.  If clusters are not yet allocated it is possible to use
an efficient metadata representation which keeps the image file compact
and does not store individual zero bytes.

Implementing this for the QED image format is fairly straightforward.
The only issue is that when a zero write touches an existing cluster we
have to allocate a bounce buffer and perform a regular write.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Stefan Hajnoczi 6e4f59bd0d qed: replace is_write with flags field
Per-request attributes like read/write are currently implemented as bool
fields in the QEDAIOCB struct.  This becomes unwiedly as the number of
attributes grows.  For example, the qed_aio_setup() function would have
to take multiple bool arguments and at call sites it would be hard to
distinguish the meaning of each bool.

Instead use a flags field with bitmask constants.  This will be used
when zero write support is added.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Stefan Hajnoczi 79c053bde9 block: perform zero-detection during copy-on-read
Copy-on-Read populates the image file with data read from a backing
image.  In order to avoid bloating the image file when all zeroes are
read we should scan the buffer and perform an optimized zero write
operation.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Stefan Hajnoczi f08f2ddae0 block: add .bdrv_co_write_zeroes() interface
The ability to zero regions of an image file is a useful primitive for
higher-level features such as image streaming or zero write detection.

Image formats may support an optimized metadata representation instead
of writing zeroes into the image file.  This allows zero writes to be
potentially faster than regular write operations and also preserve
sparseness of the image file.

The .bdrv_co_write_zeroes() interface should be implemented by block
drivers that wish to provide efficient zeroing.

Note that this operation is different from the discard operation, which
may leave the contents of the region indeterminate.  That means
discarded blocks are not guaranteed to contain zeroes and may contain
junk data instead.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Stefan Hajnoczi 1a6d39fd71 cutils: extract buffer_is_zero() from qemu-img.c
The qemu-img.c:is_not_zero() function checks if a buffer contains all
zeroes.  This function will come in handy for zero-detection in the
block layer, so clean it up and move it to cutils.c.

Note that the function now returns true if the buffer is all zeroes.
This avoids the double-negatives (i.e. !is_not_zero()) that the old
function can cause in callers.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-02-09 16:17:50 +01:00
Peter Maydell 7a65c8cc31 ARM devboards: Set arm_sysctl properties before init, not after
The ARM devboard models (vexpress-a9, realview, versatilepb, etc)
were accidentally trying to set one of the arm_sysctl properties
after device init. This has now become a fatal error; set the property
before device init where it should be done instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-02-09 12:10:35 +00:00
Anthony Liguori a642153013 Merge remote-tracking branch 'bonzini/qdev-props-for-anthony' into staging
* bonzini/qdev-props-for-anthony: (25 commits)
  qdev: remove unused fields from PropertyInfo
  qdev: initialize properties via QOM
  qdev: inline qdev_prop_set into qdev_prop_set_ptr
  qdev: access properties via QOM
  qdev: fix off-by-one
  qdev: let QOM free properties
  qdev: remove parse/print methods for pointer properties
  qdev: make the non-legacy pci address property accept an integer
  qdev: remove parse/print methods for mac properties
  qdev: remove print/parse methods from LostTickPolicy properties
  qdev: remove parse method for string properties
  qdev: allow reusing get/set for legacy property
  qdev: remove direct calls to print/parse
  qom: add property get/set wrappers for links
  qom: fix canonical paths vs. interfaces
  qom: use object_resolve_path_type for links
  qom: add object_resolve_path_type
  qom: fix off-by-one
  qom: add property get/set wrappers for C types
  qom: add QObject-based property get/set wrappers
  ...
2012-02-08 07:24:37 -06:00
Anthony Liguori dc717bfd05 Merge remote-tracking branch 'aneesh/for-upstream' into staging
* aneesh/for-upstream:
  hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode
  hw/9pfs: Update MAINTAINERS file
  fsdev: Fix parameter parsing for proxy helper
  hw/9pfs: Fix crash when mounting with synthfs
  hw/9pfs: Preserve S_ISGID
  hw/9pfs: Add new security model mapped-file.
2012-02-08 07:23:55 -06:00
Anthony Liguori a283b1b8eb Merge remote-tracking branch 'sweil/w32' into staging
* sweil/w32:
  w32: Initialise critical section before starting thread (fix #922131)
  w32: Build windows and console executables
2012-02-08 07:23:23 -06:00
malc cf4dc461a4 Restore consistent formatting
Signed-off-by: malc <av1474@comtv.ru>
2012-02-07 22:11:04 +04:00
Stefan Weil edc1de9713 w32: Initialise critical section before starting thread (fix #922131)
This patch was contributed by Bogdan Harjoc. I added some assertions.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-02-07 18:11:41 +01:00
Stefan Weil 0fa5491eed w32: Build windows and console executables
System emulation executables with SDL are typically windows
executables. Sometimes console executables are more useful,
so create both variants if linker option -mwindows was detected.

v2:
This version uses QEMU_PROGW / QEMU_PROG instead of QEMU_PROG / QEMU_PROGC.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-02-07 18:11:41 +01:00
Paolo Bonzini a3d4a1b047 qdev: remove unused fields from PropertyInfo
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:42 +01:00
Paolo Bonzini 4f2d3d705c qdev: initialize properties via QOM
Similarly, use the object properties also to set the default
values of the qdev properties.  This requires reordering
registration and initialization.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:42 +01:00
Paolo Bonzini 7a7aae21cc qdev: inline qdev_prop_set into qdev_prop_set_ptr
qdev_prop_set is not needed anymore except for hacks, simplify it and
inline it.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:42 +01:00
Paolo Bonzini 9b170e60ad qdev: access properties via QOM
Do not poke anymore in the struct when accessing qdev properties.
Instead, ask the object to set the right value.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:42 +01:00
Paolo Bonzini 6350b09046 qdev: fix off-by-one
Integer properties did not work.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:42 +01:00
Paolo Bonzini dd0ba250ca qdev: let QOM free properties
Drop the special free callback.  Instead, register a "regular"
release method in the non-legacy property.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:42 +01:00
Paolo Bonzini 7b009e5d09 qdev: remove parse/print methods for pointer properties
Pointer properties (except for PROP_PTR of course) should not need a
legacy counterpart.  In the future, relative paths will ensure that
QEMU will support the same syntax as now for drives etc..

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini b403298adb qdev: make the non-legacy pci address property accept an integer
PCI addresses are set with qdev_prop_uint32.  Thus we make the QOM
property accept a device and function encoded in an 8-bit integer,
instead of the magic dd.f hex string.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini e39e5d60c9 qdev: remove parse/print methods for mac properties
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 1ce0512557 qdev: remove print/parse methods from LostTickPolicy properties
Also generalize the code so that we can have more enum properties
in the future.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini acbac4a1dc qdev: remove parse method for string properties
We need the print method to put double quotes, but parsing is not special.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 68ee356941 qdev: allow reusing get/set for legacy property
In some cases, a legacy property does need a special print method
but not a special parse method.  In this case, we can reuse the get/set
from the static (non-legacy) property.

If neither parse nor print is needed, though, do not register the
legacy property at all.  The previous patch ensures that the right
fallback will be used.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini d822979bdf qdev: remove direct calls to print/parse
There's no need to call into ->parse and ->print manually.  The
QOM legacy properties do that for us.

Furthermore, in some cases legacy and static properties have exactly
the same behavior, and we could drop the legacy properties right away.
Add an appropriate fallback to prepare for this.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 1d9c5a12ce qom: add property get/set wrappers for links
These can set a link to any object, as long as it is included in
the composition tree.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini a1e7efdcef qom: fix canonical paths vs. interfaces
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 11e35bfdc7 qom: use object_resolve_path_type for links
This allows to restrict partial matches to objects of the expected
type.  It will let people use bare names to reference drives
even though their name might be the same as a device's (e.g.
-drive id=hd0,if=none,... -device ...,drive=hd0,id=hd0).

As a useful byproduct, this fixes a problem with links of interface
type.  When a link property's type is an interface, the code expects
the implementation object (not the parent object) to be stored in the
variable.  The parent object does not contain the right vtable.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 02fe2db631 qom: add object_resolve_path_type
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 8f770d3905 qom: fix off-by-one
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:41 +01:00
Paolo Bonzini 7b7b7d18e4 qom: add property get/set wrappers for C types
Add wrappers that let you get/set properties using normal C data types.

Reviewed-by: Anthony Liguori <anthony@aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:40 +01:00
Paolo Bonzini 9f5f135058 qom: add QObject-based property get/set wrappers
Move the creation of QmpInputVisitor and QmpOutputVisitor from qmp.c
to qom/object.c, since it's the only practical way to access object
properties.

Keep this isolated such that it's easy to remove.  At some point, we need
to remove all usage of QObject in the tree and replace it with GVariant.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:40 +01:00
Paolo Bonzini b46d9b1082 qom: do not include qdev header file
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:40 +01:00
Paolo Bonzini 9970bd887d qom: avoid useless conversions from string to type
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:52:38 +01:00
Paolo Bonzini acc4af3fec qom: clean up/optimize object_dynamic_cast
The interface loop can be performed only on the parent object.  It
does not need to be done on each interface.  Similarly, we can
simplify the code by switching early from the implementation
object to the parent object.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 13:51:37 +01:00
Paolo Bonzini 0815a85949 qom: more documentation on subclassing
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 10:21:30 +01:00
Paolo Bonzini 1ed5b918ce qom: clean up cast macros
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-02-07 10:20:12 +01:00
Anthony Liguori e87f7fc679 s390x: fix qom-ification fall-out
Tested-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-06 11:16:20 -06:00
Jan Kiszka 4cafe60604 KVM: Fix breakages of QOM conversion
KVM APIC and PIC require instance sizes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-06 10:17:20 -06:00
Anthony Liguori 3bc3634972 usb-redir: convert to QOM
This was missed due to the fact that it's in the top level and it uses
'struct DeviceInfo' instead of 'DeviceInfo' for some strange reason.

Tested-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-06 10:16:50 -06:00
Blue Swirl 53a19a3052 Fix previous commit
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 17:29:00 +00:00
Anthony Liguori d217d208b5 usb-bsd: convert to QOM
Simple enough.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 17:24:41 +00:00
Blue Swirl 47c012e21c vga: improve documentation
Add links to chipset docs and FreeVGA site.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 12:45:10 +00:00
Blue Swirl 5e55efc9e7 vga: use constants from vga.h
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 12:45:10 +00:00
Blue Swirl 0dad6c35fc vga.h: remove unused stuff and reformat
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 12:45:10 +00:00
Blue Swirl b134886a9e Add vga.h unmodified from Linux
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 12:45:10 +00:00
Blue Swirl 94d7b48334 vga: move Cirrus VGA template to its own file
Standard VGA does not use vga_draw_cursor_line_* functions.
Move the template to cirrus_vga_template.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 12:45:10 +00:00
Blue Swirl cd7a45c95e memory: change dirty getting API to take a size
Instead of each device knowing or guessing the guest page size,
just pass the desired size of dirtied memory area.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-04 12:45:10 +00:00