Commit Graph

6263 Commits

Author SHA1 Message Date
Paolo Bonzini e3cb6ba65d qom: push permission checks up into qdev_property_add_legacy
qdev_property_get and qdev_property_set can generate permission
denied errors themselves.  Do not duplicate this functionality in
qdev_get/set_legacy_property, and clean up excessive indentation.

Reviewed-by: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19 10:27:33 -06:00
Paolo Bonzini 0d41d9aabb qom: fix swapped parameters
Reviewed-by: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19 10:27:33 -06:00
Anthony Liguori f76d27b67c Merge remote-tracking branch 'qemu-kvm/memory/exec-obsolete' into staging 2011-12-19 09:45:17 -06:00
Anthony Liguori 4a1cc6800a Merge remote-tracking branch 'qemu-kvm/memory/xen' into staging 2011-12-19 09:45:12 -06:00
Avi Kivity 0eeb06b0dd etraxfs_eth: drop bogus cpu_unregister_io_memory()
Leftover call to cpu_unregister_io_memory() can segfault on cleanup.  Remove.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-12-19 17:23:27 +02:00
Avi Kivity fce537d4a7 memory, xen: pass MemoryRegion to xen_ram_alloc()
Currently xen_ram_alloc() relies on ram_addr, which is going away.
Give it something else to use as a cookie.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-12-19 17:23:24 +02:00
Anthony Liguori cde7fc31de Merge remote-tracking branch 'qemu-kvm/memory/mutators' into staging
Conflicts:
	memory.h
2011-12-19 09:12:25 -06:00
Anthony Liguori 3cfdd0da7e Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-12-19 09:10:49 -06:00
Anthony Liguori ddf83d0173 Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-12-19 08:50:47 -06:00
Anthony Liguori ea830ebb74 pc: fix event_idx compatibility for virtio devices
event_idx was introduced in 0.15 and must be disabled for all virtio-pci devices
(including virtio-balloon-pci).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-19 08:45:30 -06:00
Julian Pidancet 8ceb49fe45 Also create piix3 property when Xen is enabled
This recently added line in hw/pc_piix.c is causing a SEGV on a Xen
setup because the piix3 property is never created:

qdev_property_add_child(qdev_resolve_path("/i440fx/piix3", NULL),
                            "rtc", (DeviceState *)rtc_state, NULL);

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-19 10:52:14 +00:00
Anthony Liguori ce01a508e8 pc: add pc-0.15
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-18 12:59:12 -06:00
Peter Maydell bfc213af97 stellaris: Calculate system clock period on reset
Calculate the system clock period on reset; otherwise it remains
set to the default value of zero and attempting to use it provokes
a hang. This is one of the issues noted in LP:696094.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-16 10:04:05 +00:00
Paolo Bonzini b61744b391 ide: drop argument to dma_buf_commit
The argument is unused and even wrong when the function is called
by ide_handle_rw_error.  Drop it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-16 09:53:38 +00:00
Stefan Hajnoczi db3a5ed7e4 usb: fix usb_qdev_init() error handling again
Commit f462141f18 introduced clean up code
when usb_qdev_init() fails.  Unfortunately it calls .handle_destroy()
when .init() was never invoked or failed.  This can lead to crashes when
.handle_destroy() tries to clean up things that were never initialized.

This patch is careful to undo only those steps that completed along the
usb_qdev_init() code path.  It's not as pretty as the unified error
handling in f462141f18 but it's necessary.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:27:23 -06:00
Anthony Liguori cd34d667d4 qdev: add a qdev_get_type() function and expose as a 'type' property
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:49 -06:00
Anthony Liguori 6a146eba33 qom: add string property type
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:49 -06:00
Anthony Liguori ad6d45fa08 qom: add vga node to the pc composition tree
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:49 -06:00
Anthony Liguori b2b6c39a79 qom: optimize qdev_get_canonical_path using a parent link
The full tree search was a bit unreasonable.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:49 -06:00
Anthony Liguori 182970509b rtc: add a dynamic property for retrieving the date
This really shows the power of dynamic object properties compared to qdev
static properties.

This property represents a complex structure who's format is preserved over the
wire.  This is enabled by visitors.

It also shows an entirely synthetic property that is not tied to device state.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:49 -06:00
Anthony Liguori d0c5be5870 rtc: make piix3 set the rtc as a child (v2)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:49 -06:00
Anthony Liguori 8eb02831af dev: add an anonymous peripheral container
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:48 -06:00
Anthony Liguori 1bdaacb18f qdev: add explicitly named devices to the root complex
We first add a 'peripheral' container to the root device that we add user
created devices to.  This provides all user created devices with a unique and
isolated namespace.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:48 -06:00
Anthony Liguori 83e94fb8d5 qom: add link properties (v2)
Links represent an ephemeral relationship between devices.  They are meant to
replace the qdev concept of busses by allowing more informal relationships
between devices.

Links are fairly limited in their usefulness without implementing QOM-style
subclassing and interfaces.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:48 -06:00
Anthony Liguori 3de1c3e82d qom: add child properties (composition) (v3)
Child properties express a relationship of composition.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:48 -06:00
Anthony Liguori dc45c21f39 qdev: provide a path resolution (v2)
There are two types of supported paths--absolute paths and partial paths.

Absolute paths are derived from the root device and can follow child<> or
link<> properties.  Since they can follow link<> properties, they can be
arbitrarily long.  Absolute paths look like absolute filenames and are prefixed
with a leading slash.

Partial paths are look like relative filenames.  They do not begin with a
prefix.  The matching rules for partial paths are subtle but designed to make
specifying devices easy.  At each level of the composition tree, the partial
path is matched as an absolute path.  The first match is not returned.  At
least two matches are searched for.  A successful result is only returned if
only one match is founded.  If more than one match is found, a flag is returned
to indicate that the match was ambiguous.

At the end of the day, partial path support means that if you create a device
called 'ide0', you can just say 'ide0' as the path name and it will Just Work.
If we internally create a device called 'i440fx', you can just say 'i440fx' and
it will Just Work and long as you don't do anything silly.

A management tool should probably always use absolute paths since then they
don't have to deal with the possibility of ambiguity.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:48 -06:00
Anthony Liguori f9fbd2fd0e qdev: provide an interface to return canonical path from root (v2)
The canonical path is the path in the composition tree from the root to the
device.  This is effectively the name of the device.

This is an incredibly unefficient implementation that will be optimized in
a future patch.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:47 -06:00
Anthony Liguori a10f07a7d0 qom: introduce root device
This is based on Jan's suggestion for how to do unique naming.  The root device
is the root of composition.  All devices are reachable via child<> links from
this device.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:47 -06:00
Anthony Liguori a5296ca9df qom: register legacy properties as new style properties (v2)
Expose all legacy properties through the new QOM property mechanism.  The qdev
property types are exposed through the 'legacy<>' namespace.  They are always
visited as strings since they do their own string parsing.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:47 -06:00
Anthony Liguori 44677ded43 qom: add new dynamic property infrastructure based on Visitors (v2)
qdev properties are settable only during construction and static to classes.
This isn't flexible enough for QOM.

This patch introduces a property interface for qdev that provides dynamic
properties that are tied to objects, instead of classes.  These properties are
Visitor based instead of string based too.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:47 -06:00
Anthony Liguori 85ed303bfe qom: add a reference count to qdev objects
To ensure that a device isn't removed from the graph until all of its links are
broken.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15 09:20:47 -06:00
Paolo Bonzini b9b2008bbf block: dma_bdrv_* does not return NULL
Initially attempted with the following semantic patch:

@ rule1 @
expression E;
statement S;
@@
  E =
(
   dma_bdrv_io
|  dma_bdrv_read
|  dma_bdrv_write
)
     (...);
(
- if (E == NULL) { ... }
|
- if (E)
    { <... S ...> }
)

which however did not match anything.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Paolo Bonzini ad54ae80c7 block: bdrv_aio_* do not return NULL
Initially done with the following semantic patch:

@ rule1 @
expression E;
statement S;
@@
  E =
(
   bdrv_aio_readv
|  bdrv_aio_writev
|  bdrv_aio_flush
|  bdrv_aio_discard
|  bdrv_aio_ioctl
)
     (...);
(
- if (E == NULL) { ... }
|
- if (E)
    { <... S ...> }
)

which however missed the occurrence in block/blkverify.c
(as it should have done), and left behind some unused
variables.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:07 +01:00
Anthony Liguori 9423a2e8dd Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging 2011-12-14 07:59:21 -06:00
Stefan Weil a1b6abe76b hw: Fix spelling in comments and code
compatiblity->compatibility
transfered->transferred
transfering->transferring

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:09:38 +00:00
Stefan Weil 26404edcce hw: Fix spelling in comments
adress->address
advertisment->advertisement
begining->beginning
bondary->boundary
controler->controller
controll->control
convertion->conversion
doesnt->doesn't
existant->existent
instuction->instruction
loosing->losing
managment->management
multipled->multiplied
negotation->negotiation
runing->running
teh->the
unchangable->unchangeable
writen->written
yeild->yield

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:09:12 +00:00
Stefan Weil 4d8db4e4a0 hw: Fix spelling (licenced->licensed)
New code introduced old misspellings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:08:23 +00:00
Stefan Weil c11e80e299 fmopl: Fix spelling in code and comments
algorythm->algorithm
rythm->rhythm

I did not try to fix the coding standard, so checkpatch.pl
reports lots of violations.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:08:20 +00:00
Paolo Bonzini da5361cc68 ccid: make threads joinable
Destroying a mutex that another thread might have just unlocked
is racy.  It usually works, but you cannot do that in general and
can lead to deadlocks or segfaults.  Change ccid to use joinable
threads instead.

(Also, qemu_mutex_init/qemu_cond_init were missing).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Jan Kiszka cf21871479 qemu-thread: add API for joinable threads
Split from Jan's original qemu-thread-posix.c patch.  No semantic change,
just introduce the new API that POSIX and Win32 implementations will
conform to.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Stefan Hajnoczi d396a657ba syborg: drop support for Symbian Virtual Platform
The Symbian Virtual Platform was an ARM-based development and debugging
board.  Since Symbian has been disbanded and the code is no longer being
used it can now be removed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Eduardo Habkost 90d8454ed0 QEMUFileCloseFunc: add return value documentation (v2)
qemu_fclose() and QEMUFile->close will return -errno on error, and any
positive value on success.

We need the positive non-zero success values because
migration-exec.c:exec_close() relies on non-zero return values to get
the process exit code.

Changes v1 -> v2:
 - Cosmetic spelling change on comment text

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:19 -06:00
Peter Maydell 98d2370413 hw/usb-net.c: Fix precedence bug when checking rndis_state
"!X == 2" is always false (spotted by Coverity), so the checks
for whether rndis is in the correct state would never fire.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:53 -06:00
David Gibson 9fe2fd6716 Remove unnecessary casts from PCI DMA code in usb-uhci
This patch removes some unnecessary casts in the usb-uhci device,
introduced by commit fff23ee9a5
'usb-uhci: Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:52 -06:00
David Gibson 4bf8011910 Remove unnecessary casts from PCI DMA code in usb-ehci
This patch removes some unnecessary casts in the usb-ehci device,
introduced by commit 68d553587c
'usb-ehci: Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:52 -06:00
David Gibson a6a29eeaff Remove unnecessary casts from PCI DMA code in rtl8139
This patch removes some unnecessary casts in the rtl8139 device,
introduced by commit 3ada003aee
'rtl8139: Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:52 -06:00
David Gibson 9e486d6765 Remove unnecessary casts from PCI DMA code in lsi53c895a
This patch removes some unnecessary casts in the lsi53c895a device,
introduced by commit 9ba4524cda
'lsi53c895a: Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:52 -06:00
David Gibson 859e538d50 Remove unnecessary casts from PCI DMA code in PCI IDE
This patch removes some unnecessary casts in the PCI IDE device,
introduced by commit 552908fef5
'PCI IDE: Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:52 -06:00
David Gibson 00c3a05b25 Remove unnecessary casts from PCI DMA code in e1000
This patch removes some unnecessary casts in the e1000 device,
introduced by commit 62ecbd353d 'e1000:
Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:50 -06:00
David Gibson e965d4bce3 Remove unnecessary casts from PCI DMA code in eepro100
This patch removes some unnecessary casts in the eepro100 device,
introduced by commit 16ef60c9a8
'eepro100: Use PCI DMA stub functions'.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:16:50 -06:00