]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agods1225y: use trace framework
Hervé Poussineau [Mon, 18 Jul 2011 21:34:21 +0000 (23:34 +0200)]
ds1225y: use trace framework

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agods1225y: Remove protection stuff, which doesn't belong to this device
Hervé Poussineau [Mon, 18 Jul 2011 21:34:20 +0000 (23:34 +0200)]
ds1225y: Remove protection stuff, which doesn't belong to this device

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: add missing break on fmovdcc
Tsuneo Saito [Mon, 18 Jul 2011 06:36:57 +0000 (15:36 +0900)]
SPARC64: add missing break on fmovdcc

"break" is missing on V9 fmovdcc (%icc).

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: fix VIS1 SIMD signed compare instructions
Tsuneo Saito [Mon, 18 Jul 2011 06:00:00 +0000 (15:00 +0900)]
SPARC64: fix VIS1 SIMD signed compare instructions

The destination registers of SIMD signed compare instructions
(fcmp*<16|32>) are not FP registers but general purpose r registers.
Comparisons should be freg_rs1 CMP freg_rs2, that were reversed.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Wed, 20 Jul 2011 20:23:01 +0000 (20:23 +0000)]
Merge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Fix BASEPRI, BASEPRI_MAX, and FAULTMASK access
  target-arm: Minimal implementation of performance counters
  Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
  Revert "target-arm: Use global env in neon_helper.c helpers"
  target-arm: Pass fp status pointer explicitly to neon fp helpers
  target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
  target-arm: Add helper function to generate code to get fpstatus pointer
  Revert "target-arm: Use global env in iwmmxt_helper.c helpers"

Conflicts:
Makefile.target

12 years agoAdd missing documentation for qemu-img -p
Jes Sorensen [Tue, 19 Jul 2011 13:01:34 +0000 (15:01 +0200)]
Add missing documentation for qemu-img -p

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqxl: upon reset, if spice worker is stopped, the command rings can be not empty
Yonit Halperin [Tue, 12 Jul 2011 08:51:58 +0000 (11:51 +0300)]
qxl: upon reset, if spice worker is stopped, the command rings can be not empty

Spice worker does no longer process commands when it is stopped.
Otherwise, it might crash during migration when attempting to process
commands while the guest is not completely loaded.

Cc: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: add sanity check for spice ports
Gerd Hoffmann [Thu, 7 Jul 2011 15:04:17 +0000 (17:04 +0200)]
spice: add sanity check for spice ports

Make sure at least one port (port=.. or tls-port=...)
is specified.  Also apply range checks to the port numbers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqcow2: Use Qcow2Cache in writeback mode during loadvm/savevm
Kevin Wolf [Tue, 19 Jul 2011 11:01:48 +0000 (13:01 +0200)]
qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm

In snapshotting there is no guest involved, so we can safely use a writeback
mode and do the flushes in the right place (i.e. at the very end). This
improves the time that creating/restoring an internal snapshot takes with an
image in writethrough mode.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add bdrv_get_allocated_file_size() operation
Fam Zheng [Tue, 12 Jul 2011 11:56:39 +0000 (19:56 +0800)]
block: add bdrv_get_allocated_file_size() operation

qemu-img.c wants to count allocated file size of image. Previously it
counts a single bs->file by 'stat' or Window API. As VMDK introduces
multiple file support, the operation becomes format specific with
platform specific meanwhile.

The functions are moved to block/raw-{posix,win32}.c and qemu-img.c calls
bdrv_get_allocated_file_size to count the bs. And also added VMDK code
to count his own extents.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: fix coding style
Fam Zheng [Tue, 12 Jul 2011 11:56:38 +0000 (19:56 +0800)]
VMDK: fix coding style

Conform coding style in vmdk.c to pass scripts/checkpatch.pl checks.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: create different subformats
Fam Zheng [Tue, 19 Jul 2011 00:45:23 +0000 (08:45 +0800)]
VMDK: create different subformats

Add create option 'format', with enums:
    monolithicSparse
    monolithicFlat
    twoGbMaxExtentSparse
    twoGbMaxExtentFlat
Each creates a subformat image file. The default is monolithicSparse.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: open/read/write for monolithicFlat image
Fam Zheng [Tue, 19 Jul 2011 00:38:22 +0000 (08:38 +0800)]
VMDK: open/read/write for monolithicFlat image

Parse vmdk decriptor file and open mono flat image.
Read/write the flat extent.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: change get_cluster_offset return type
Fam Zheng [Tue, 12 Jul 2011 11:56:35 +0000 (19:56 +0800)]
VMDK: change get_cluster_offset return type

The return type of get_cluster_offset was an offset that use 0 to denote
'not allocated', this will be no longer true for flat extents, as we see
flat extent file as a single huge cluster whose offset is 0 and length
is the whole file length.
So now we use int return value, 0 means success and otherwise offset
invalid.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: move 'static' cid_update flag to bs field
Fam Zheng [Tue, 12 Jul 2011 11:56:34 +0000 (19:56 +0800)]
VMDK: move 'static' cid_update flag to bs field

Cid_update is the flag for updating CID on first write after opening the
image. This should be per image open rather than per program life cycle,
so change it from static var of vmdk_write to a field in BDRVVmdkState.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: flush multiple extents
Fam Zheng [Tue, 12 Jul 2011 11:56:33 +0000 (19:56 +0800)]
VMDK: flush multiple extents

Flush all the file that referenced by the image.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: add field BDRVVmdkState.desc_offset
Fam Zheng [Tue, 12 Jul 2011 11:56:32 +0000 (19:56 +0800)]
VMDK: add field BDRVVmdkState.desc_offset

There are several occurrence of magic number 0x200 as the descriptor
offset within mono sparse image file. This is not the case for images
with separate descriptor file. So a field is added to BDRVVmdkState to
hold the correct value.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: separate vmdk_open by format version
Fam Zheng [Tue, 12 Jul 2011 11:56:31 +0000 (19:56 +0800)]
VMDK: separate vmdk_open by format version

Separate vmdk_open by subformats to:
* vmdk_open_vmdk3
* vmdk_open_vmdk4

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: probe for monolithicFlat images
Fam Zheng [Tue, 12 Jul 2011 11:56:30 +0000 (19:56 +0800)]
VMDK: probe for monolithicFlat images

Probe as the same behavior as VMware does.
Recognize image as monolithicFlat descriptor file when the file is text
and the first effective line (not '#' leaded comment or space line) is
either 'version=1' or 'version=2'. No space or upper case charactors
accepted.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: bugfix, align offset to cluster in get_whole_cluster
Fam Zheng [Tue, 12 Jul 2011 11:56:29 +0000 (19:56 +0800)]
VMDK: bugfix, align offset to cluster in get_whole_cluster

In get_whole_cluster, the offset is not aligned to cluster when reading
from backing_hd. When the first write to child is not at the cluster
boundary, wrong address data from parent is copied to child.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoVMDK: introduce VmdkExtent
Fam Zheng [Tue, 12 Jul 2011 11:56:28 +0000 (19:56 +0800)]
VMDK: introduce VmdkExtent

Introduced VmdkExtent array into BDRVVmdkState, enable holding multiple
image extents for multiple file image support.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-config: Document -drive options
Luiz Capitulino [Tue, 12 Jul 2011 20:35:09 +0000 (17:35 -0300)]
qemu-config: Document -drive options

Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-options.hx: Document missing -drive options
Luiz Capitulino [Tue, 12 Jul 2011 20:35:08 +0000 (17:35 -0300)]
qemu-options.hx: Document missing -drive options

They are 'werror', 'rerror' and 'readonly'.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: Mask out serial number EVPD
Hannes Reinecke [Mon, 11 Jul 2011 13:02:26 +0000 (15:02 +0200)]
scsi-disk: Mask out serial number EVPD

If the serial number is not set we should mask it out in the
list of supported VPD pages and mark it as not supported.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi-disk: Fixup debugging statement
Hannes Reinecke [Mon, 11 Jul 2011 13:02:25 +0000 (15:02 +0200)]
scsi-disk: Fixup debugging statement

A debugging statement wasn't converted to the new interface.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoscsi: Add 'hba_private' to SCSIRequest
Hannes Reinecke [Mon, 11 Jul 2011 13:02:24 +0000 (15:02 +0200)]
scsi: Add 'hba_private' to SCSIRequest

'tag' is just an abstraction to identify the command
from the driver. So we should make that explicit by
replacing 'tag' with a driver-defined pointer 'hba_private'.
This saves the lookup for driver handling several commands
in parallel.
'tag' is still being kept for tracing purposes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoMerge remote-tracking branch 'agraf/xen-next' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:04:35 +0000 (08:04 -0500)]
Merge remote-tracking branch 'agraf/xen-next' into staging

12 years agoMerge remote-tracking branch 'kraxel/usb.19' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:03:20 +0000 (08:03 -0500)]
Merge remote-tracking branch 'kraxel/usb.19' into staging

12 years agoMerge remote-tracking branch 'spice/spice.v38' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:02:35 +0000 (08:02 -0500)]
Merge remote-tracking branch 'spice/spice.v38' into staging

12 years agoMerge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Tue, 19 Jul 2011 12:43:54 +0000 (07:43 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging

12 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Tue, 19 Jul 2011 12:43:51 +0000 (07:43 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

12 years agoiov: Update parameter usage in iov_(to|from)_buf()
Hannes Reinecke [Mon, 11 Jul 2011 13:02:23 +0000 (15:02 +0200)]
iov: Update parameter usage in iov_(to|from)_buf()

iov_to_buf() has an 'offset' parameter, iov_from_buf() hasn't.
This patch adds the missing parameter to iov_from_buf().
It also renames the 'offset' parameter to 'iov_off' to
emphasize it's the offset into the iovec and not the buffer.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: Fix if scoping bug
Devin Nakamura [Mon, 11 Jul 2011 15:20:25 +0000 (11:20 -0400)]
qemu-io: Fix if scoping bug

Fix a bug caused by lack of braces in if statement

Lack of braces means that if(count & 0x1ff) is never reached

Signed-off-by: Devin Nakamura <devin122@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: Fix formatting
Devin Nakamura [Mon, 11 Jul 2011 15:22:16 +0000 (11:22 -0400)]
qemu-io: Fix formatting

Replaced tabs with spaces, 8 space indentations with 4 space
indentation, and other fixes to better adhere to CODING_STYLE

Signed-off-by: Devin Nakamura <devin122@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agosheepdog: add full data preallocation support
MORITA Kazutaka [Tue, 5 Jul 2011 18:38:48 +0000 (03:38 +0900)]
sheepdog: add full data preallocation support

This introduces qemu-img create option for sheepdog which allows the
data to be fully preallocated (note that sheepdog always preallocates
metadata).

The option is disabled by default and you need to enable it like the
following:

qemu-img create sheepdog:test -o preallocation=full 1G

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovirtio-console: Prevent abort()s in case of host chardev close
Amit Shah [Thu, 7 Jul 2011 12:05:27 +0000 (17:35 +0530)]
virtio-console: Prevent abort()s in case of host chardev close

A host chardev could close just before the guest sends some data to be
written.  This will cause an -EPIPE error.  This shouldn't be propagated
to virtio-serial-bus.

Ideally we should close the port once -EPIPE is received, but since the
chardev interface doesn't return such meaningful values to its users,
all we get is -1 for any kind of error.  Just return 0 for now and wait
for chardevs to return better error messages to act better on the return
messages.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
12 years agovirtio-serial-bus: Fix trailing \n in error_report string
Amit Shah [Thu, 7 Jul 2011 12:46:13 +0000 (18:16 +0530)]
virtio-serial-bus: Fix trailing \n in error_report string

Markus fixed offenders in the file but one instance sneaked in via
another patch.  Fix it.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
12 years agovirtio-console: Add some trace events
Amit Shah [Tue, 5 Jul 2011 11:07:49 +0000 (16:37 +0530)]
virtio-console: Add some trace events

Add some trace events for messages passed between the char layer and the
virtio-serial bus.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
12 years agovirtio-serial-bus: Add trace events
Amit Shah [Tue, 5 Jul 2011 11:06:39 +0000 (16:36 +0530)]
virtio-serial-bus: Add trace events

Add some trace events for messages passed between the guest and host.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
12 years agovirtio: fix indirect descriptor buffer overflow
Michael S. Tsirkin [Mon, 20 Jun 2011 10:42:27 +0000 (13:42 +0300)]
virtio: fix indirect descriptor buffer overflow

We were previously allowing arbitrarily-long indirect descriptors, which
could lead to a buffer overflow in qemu-kvm process.

CVE-2011-2212

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoxen: move to new pci initializers
Michael S. Tsirkin [Sun, 26 Jun 2011 13:30:45 +0000 (16:30 +0300)]
xen: move to new pci initializers

move ids to pci info structure

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agohw/piix_pci.c: Fix PIIX3-xen to initialize ids
Anthony PERARD [Wed, 22 Jun 2011 15:58:31 +0000 (16:58 +0100)]
hw/piix_pci.c: Fix PIIX3-xen to initialize ids

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopci_ids: tweak names to match linux/pci_ids.h
Michael S. Tsirkin [Sun, 26 Jun 2011 13:17:27 +0000 (16:17 +0300)]
pci_ids: tweak names to match linux/pci_ids.h

Sync xen names to ones used by linux. Add
xen platform device id as well.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agovhost: fix double free on device stop
Michael S. Tsirkin [Tue, 21 Jun 2011 17:34:17 +0000 (20:34 +0300)]
vhost: fix double free on device stop

vhost dev stop failed to clear the log field.
Typically not an issue as dev start overwrites this field,
but if logging gets disabled before the following start,
it doesn't so this causes a double free.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoxen_console: fall back to qemu serial device
Alexander Graf [Sun, 3 Jul 2011 07:44:48 +0000 (09:44 +0200)]
xen_console: fall back to qemu serial device

The new xen_console protocol changed the default xen_console output device
from whatever Qemu chose to whatever xenstore choses and "pty" as fallback.

This is not how Qemu works. It has its own serial redirection semantics. So
it xenstore doesn't contain information on what to do, Qemu is the place to
ask.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen_console: support the new extended xenstore protocol
Stefano Stabellini [Thu, 30 Jun 2011 17:26:29 +0000 (18:26 +0100)]
xen_console: support the new extended xenstore protocol

Since CS 21994 on xen-unstable.hg and CS
466608f3a32e1f9808acdf832a5843af37e5fcec on qemu-xen-unstable.git, few
changes have been introduced to the PV console xenstore protocol, as
described by the document docs/misc/console.txt under xen-unstable.hg.

From the Qemu point of view, very few modifications are needed to
correctly support the protocol: read from xenstore the "output" node
that tell us what the output of the PV console is going to be.
In case the output is a tty, write to xenstore the device name.

Changes in v2:

- fix error paths: free malloc'ed strings and close the xenstore
connection before returning;

- remove useless snprintf in xenstore_store_pv_console_info if i == 0.

Changes in v3:

- replace xs_daemon_open/xs_daemon_close with xs_open/xs_close.

Changes in v4:

- add a compatibility implementation of xs_open/xs_close.

Changes in v5:

- fix code style.

[agraf] fix build error due to missing stub

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agocheckpatch: don't error out on },{ lines
Alexander Graf [Wed, 29 Jun 2011 06:04:27 +0000 (08:04 +0200)]
checkpatch: don't error out on },{ lines

When having code like this:

    static PCIDeviceInfo piix_ide_info[] = {
        {
            .qdev.name    = "piix3-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371SB_1,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            .qdev.name    = "piix4-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371AB,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            /* end of list */
        }
    };

checkpatch currently errors out, claiming that spaces need to follow
commas. However, this particular style of defining structs is pretty
common in qemu code and very readable. So let's declare it as supported
for the above case.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen_disk: treat "aio" as "raw"
Stefano Stabellini [Thu, 30 Jun 2011 14:42:31 +0000 (15:42 +0100)]
xen_disk: treat "aio" as "raw"

Sometimes the toolstack uses "aio" without an additional format
identifier, in such cases use "raw".

Updated in v2:

- fix code style.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoqemu_ram_ptr_length: take ram_addr_t as arguments
Stefano Stabellini [Mon, 27 Jun 2011 17:26:06 +0000 (18:26 +0100)]
qemu_ram_ptr_length: take ram_addr_t as arguments

qemu_ram_ptr_length should take ram_addr_t as argument rather than
target_phys_addr_t because is doing comparisons with RAMBlock addresses.

cpu_physical_memory_map should create a ram_addr_t address to pass to
qemu_ram_ptr_length from PhysPageDesc phys_offset.

Remove code after abort() in qemu_ram_ptr_length.

Changes in v2:

- handle 0 size in qemu_ram_ptr_length;

- rename addr1 to raddr;

- initialize raddr to ULONG_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen_disk: cope with missing xenstore "params" node
Stefano Stabellini [Mon, 27 Jun 2011 15:10:01 +0000 (16:10 +0100)]
xen_disk: cope with missing xenstore "params" node

When disk is a cdrom and the drive is empty the "params" node in
xenstore might be missing completely: cope with it instead of
segfaulting.

Updated in v2:

- actually removed the strchr(blkdev->params, ':') that caused the
segfault;

- free all the allocated strings from xenstore before returning;

Updated in v3:

- set blkdev fields to NULL after free'ing them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: add vkbd support for PV on HVM guests
Stefano Stabellini [Fri, 24 Jun 2011 16:36:11 +0000 (17:36 +0100)]
xen: add vkbd support for PV on HVM guests

Register the vkbd backend even when running as device emulator for HVM
guests: it is useful because it doesn't need a frequent timer like usb.

Check whether the XenInput DisplayState has been set in the initialise
state, rather than the input state.
In case the DisplayState hasn't been set and there is no vfb for this
domain, then set the XenInput DisplayState to the default one.

Changed in v2:

- use qemu_free instead of free;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen_console: fix memory leak
Stefano Stabellini [Fri, 24 Jun 2011 15:59:46 +0000 (16:59 +0100)]
xen_console: fix memory leak

con_init leaks the string "type", fix it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: enable console and disk backend in HVM mode
Stefano Stabellini [Fri, 24 Jun 2011 14:54:48 +0000 (15:54 +0100)]
xen: enable console and disk backend in HVM mode

Initialize the Xen console backend and the Xen disk backend even when
running in HVM mode so that PV on HVM drivers can connect to them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN
Jan Kiszka [Tue, 21 Jun 2011 20:59:09 +0000 (22:59 +0200)]
xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN

Xen won't be enabled if there is no backend support available for the
host. And that also means the map cache will work. So drop the separate
config switch and move the required stubs over to xen-stub.c.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: Clean up map cache API naming
Jan Kiszka [Tue, 21 Jun 2011 20:59:08 +0000 (22:59 +0200)]
xen: Clean up map cache API naming

The map cache is a Xen thing, so its API should make this clear.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxen: Clean up build system
Jan Kiszka [Tue, 21 Jun 2011 20:59:07 +0000 (22:59 +0200)]
xen: Clean up build system

Introduce CONFIG_XEN_BACKEND so that this new config solely controls the
target-independent backend build and CONFIG_XEN can focus on per-target
building.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoFix signal handling of SIG_IPI when io-thread is enabled
Alexandre Raymond [Wed, 15 Jun 2011 05:20:31 +0000 (01:20 -0400)]
Fix signal handling of SIG_IPI when io-thread is enabled

Both the signal thread (via sigwait()) and the cpu thread (via
a normal signal handler) were attempting to catch SIG_IPI.

This resulted in random freezes under Darwin.

This patch separates SIG_IPI from the rest of the signals handled
by the signal thread, because it is independently caught by the cpu
thread.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoFix signal handling when io-thread is disabled
Alexandre Raymond [Tue, 14 Jun 2011 14:05:36 +0000 (10:05 -0400)]
Fix signal handling when io-thread is disabled

Changes since v1:
- take pthread_sigmask() out of the ifdef as it is now common
to both parts.

This fix effectively blocks, in the main thread, the signals handled
by signalfd or the compatibility signal thread.

This way, such signals are received synchronously in the main thread
through sigfd_handler() instead of triggering the signal handler
directly, asynchronously.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg/README: Expand advice on number of TCG ops per target insn
Peter Maydell [Wed, 22 Jun 2011 14:40:06 +0000 (15:40 +0100)]
tcg/README: Expand advice on number of TCG ops per target insn

Expand the note on the number of TCG ops generated per target insn,
to be clearer about the range of applicability of the 20 op rule
of thumb. Also add a note about the hard MAX_OP_PER_INSTR limit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoset ELF_HWCAP for SPARC and SPARC64
Artyom Tarasenko [Thu, 14 Jul 2011 17:37:06 +0000 (19:37 +0200)]
set ELF_HWCAP for SPARC and SPARC64

setting ELF_HWCAP fixes dynamic library loading for Linux/sparc64
This patch allows loading busybox from Debian 6 initrd

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSparc: fix FPU and AM enable checks for translation
Blue Swirl [Thu, 14 Jul 2011 17:30:43 +0000 (17:30 +0000)]
Sparc: fix FPU and AM enable checks for translation

Translation used incorrectly CPUState fields directly to check
for FPU enable state and 32 bit address masking on Sparc64.

Fix by using TB flags instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: C99 comment fix for block-transfer ASIs
Tsuneo Saito [Thu, 14 Jul 2011 09:41:43 +0000 (18:41 +0900)]
SPARC64: C99 comment fix for block-transfer ASIs

Fixed C99 comments on block-tranfer ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: Add JPS1 ASI_BLK_AIU[PS]L ASIs for ldfa and stfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:42 +0000 (18:41 +0900)]
SPARC64: Add JPS1 ASI_BLK_AIU[PS]L ASIs for ldfa and stfa

Support JPS1 little endian block transfer ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for stfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:41 +0000 (18:41 +0900)]
SPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for stfa

Support UA2007 block store ASIs for stfa instructions.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for ldfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:40 +0000 (18:41 +0900)]
SPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for ldfa

Support UA2007 block load ASIs for ldfa instructions.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: fp_disabled checks on stfa/stdfa/stqfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:39 +0000 (18:41 +0900)]
SPARC64: fp_disabled checks on stfa/stdfa/stqfa

stfa/stdfa/stqfa instructions should raise fp_disabled exceptions
if %pstate.PEF==0 or %fprs.FEF==0.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: Implement stfa/stdfa/stqfa instrcutions properly
Tsuneo Saito [Thu, 14 Jul 2011 09:41:38 +0000 (18:41 +0900)]
SPARC64: Implement stfa/stdfa/stqfa instrcutions properly

This patch implements sparcv9 stfa/stdfa/stqfa instructions
with non block-store ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: fp_disabled checks on ldfa/lddfa/ldqfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:37 +0000 (18:41 +0900)]
SPARC64: fp_disabled checks on ldfa/lddfa/ldqfa

ldfa/lddfa/ldqfa instructions should raise fp_disabled exceptions
if %pstate.PEF==0 or %fprs.FEF==0.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoSPARC64: Implement ldfa/lddfa/ldqfa instructions properly
Tsuneo Saito [Thu, 14 Jul 2011 09:41:36 +0000 (18:41 +0900)]
SPARC64: Implement ldfa/lddfa/ldqfa instructions properly

This patch implements sparcv9 ldfa/lddfa/ldqfa instructions
with non block-load ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agolinux-user/signal.c: Rename s390 target_ucontext fields to fix ia64
Peter Maydell [Tue, 12 Jul 2011 20:27:15 +0000 (21:27 +0100)]
linux-user/signal.c: Rename s390 target_ucontext fields to fix ia64

The ia64 sys/ucontext.h defines macros 'uc_link', 'uc_sigmask' and
'uc_stack'. Rename the s390 target_ucontext struct members to tuc_*,
bringing them into line with the other targets and fixing a compile
failure on ia64 hosts caused by this clash.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: make MIPS and ARM eabi use same argument reordering
Riku Voipio [Tue, 12 Jul 2011 12:40:51 +0000 (15:40 +0300)]
linux-user: make MIPS and ARM eabi use same argument reordering

MIPS uses similar calling convention than ARM eabi, where when using
64-bit values some registers are skipped. This patch makes MIPS and ARM
eabi share the argument reordering code.

This affects ftruncate64, creating insane sized fails (or just failing).

Cc: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: correct syscall 123 on sh4
Riku Voipio [Tue, 12 Jul 2011 13:01:54 +0000 (16:01 +0300)]
linux-user: correct syscall 123 on sh4

As reported by Cédric VINCENT:

The syscall #123 on SH4 should be "TARGET_NR_cacheflush" instead of
"TARGET_NR_modify_ldt" [1].  The only consequence of this misnaming is
that many "Unsupported syscall" warnings are issued when emulating JIT
compilers.

Reported-by: Cédric VINCENT <cedric.vincent@st.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agoos-posix: set groups properly for -runas
Stefan Hajnoczi [Sat, 9 Jul 2011 09:22:07 +0000 (10:22 +0100)]
os-posix: set groups properly for -runas

Andrew Griffiths reports that -runas does not set supplementary group
IDs.  This means that gid 0 (root) is not dropped when switching to an
unprivileged user.

Add an initgroups(3) call to use the -runas user's /etc/groups
membership to update the supplementary group IDs.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: cancel current request only if some request is in flight
Hervé Poussineau [Sat, 9 Jul 2011 14:44:41 +0000 (16:44 +0200)]
esp: cancel current request only if some request is in flight

This bug was introduced in 94d3f98a3f3caddd7875f9a11776daeb84962a7b:
scsi_cancel_io was checking if some request was pending before trying
to cancel it, while scsi_req_cancel always cancels the request.

This may lead to a crash of Qemu due to dereferencing a NULL pointer,
as exhibited by NetBSD 5.1 installer on MIPS Magnum emulation.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-alpha, target-ppc: Remove unnecessary setjmp.h include
Peter Maydell [Mon, 4 Jul 2011 21:02:46 +0000 (22:02 +0100)]
target-alpha, target-ppc: Remove unnecessary setjmp.h include

Remove the include of setjmp.h from the cpu.h of target-alpha
and target-ppc. This is unnecessary because cpu-defs.h already
includes this header; this change brings these two targets
into line with all the rest.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoRemove unneeded setjmp.h (fix compilation on Debian "lenny")
Stefan Weil [Mon, 4 Jul 2011 18:52:38 +0000 (20:52 +0200)]
Remove unneeded setjmp.h (fix compilation on Debian "lenny")

Some versions of png.h cannot be included after setjmp.h,
even when PNG_SKIP_SETJMP_CHECK was defined.

setjmp.h was included from qemu-common.h and is not needed there.
Removing the include statement fixes compilation of ui/vnc-enc-tight.c
with CONFIG_VNC_PNG defined.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcg: Reload local variables after return from longjmp
Jan Kiszka [Sat, 2 Jul 2011 07:50:51 +0000 (09:50 +0200)]
tcg: Reload local variables after return from longjmp

Recent compilers look deep into cpu_exec, find longjmp as a noreturn
function and decide to smash some stack variables as they won't be used
again. This may lead to env becoming invalid after return from setjmp,
causing crashes. Fix it by reloading env from cpu_single_env in that
case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec-all.h: Make MAX_OP_PER_INSTR large enough for target-arm's uses
Peter Maydell [Wed, 22 Jun 2011 14:16:32 +0000 (15:16 +0100)]
exec-all.h: Make MAX_OP_PER_INSTR large enough for target-arm's uses

The target-arm frontend's worst-case TCG ops per instr is 194 (and in
general many of the "load multiple registers" ARM instructions generate
more than 100 TCG ops). Raise MAX_OP_PER_INSTR accordingly to avoid
possible buffer overruns.

Since it doesn't make any sense for the "64 bit guest on 32 bit host"
case to have a smaller limit than the normal case, we collapse the
two cases back into each other again.

(This increase costs us about 14K in extra static buffer space and
21K of extra margin at the end of a 32MB codegen buffer.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec.c: Fix calculation of code_gen_buffer_max_size
Peter Maydell [Wed, 22 Jun 2011 10:58:25 +0000 (11:58 +0100)]
exec.c: Fix calculation of code_gen_buffer_max_size

When calculating the point at which we should not try to put another
TB into the code gen buffer, we have to allow not just for OPC_MAX_SIZE
but OPC_BUF_SIZE. This is because the target translate.c will only
stop when an instruction has put it past the OPC_MAX_SIZE limit, so
we have to include the MAX_OP_PER_INSTR margin which that final insn
might have used.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agospapr: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:10 +0000 (18:28 +0200)]
spapr: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agos390-virtio: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:09 +0000 (18:28 +0200)]
s390-virtio: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoppc405_uc: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:08 +0000 (18:28 +0200)]
ppc405_uc: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agopl080: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:07 +0000 (18:28 +0200)]
pl080: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomsix: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:06 +0000 (18:28 +0200)]
msix: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomsi: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:05 +0000 (18:28 +0200)]
msi: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agointel-hda: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:04 +0000 (18:28 +0200)]
intel-hda: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohpet: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:03 +0000 (18:28 +0200)]
hpet: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec: add endian specific phys ld/st functions
Alexander Graf [Wed, 6 Jul 2011 07:09:23 +0000 (09:09 +0200)]
exec: add endian specific phys ld/st functions

Device code some times needs to access physical memory and does that
through the ld./st._phys functions. However, these are the exact same
functions that the CPU uses to access memory, which means they will
be endianness swapped depending on the target CPU.

However, devices don't know about the CPU's endianness, but instead
access memory directly using their own interface to the memory bus,
so they need some way to read data with their native endianness.

This patch adds _le and _be functions to ld./st._phys.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomips: rlimit codes are not the same
Wesley W. Terpstra [Tue, 12 Jul 2011 11:42:00 +0000 (14:42 +0300)]
mips: rlimit codes are not the same

The codes for get/setrlimit differ between linux target platforms.
This patch adds conversion.
This is important else programs (rsyslog, python, ...) can go into a
near infinite loop trying to close all the file descriptors from 0 to
-1.

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agomips: rlimit incorrectly converts values
Wesley W. Terpstra [Tue, 12 Jul 2011 11:38:22 +0000 (14:38 +0300)]
mips: rlimit incorrectly converts values

Byte swap was applied in the wrong order with testing for
RLIM_INFINITY. On mips bigendian from an amd64 system this results in
infinity being misinterpretted as 2^31-1.

This is a serious bug because it causes setrlimit stack size to kill
all child processes. This means (for example) that 'make' can run no
children. The mechanism of failure:
1. parent sets stack size rlimit to 'infinity'
2. qemu screws this value up
3. child process fetches stack size as a large (but non-infinite) value
4. qemu tries to allocate stack before execution
5. stack allocation fails (too big) and child process dies

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agomips: null pointer deref should segfault
Wesley W. Terpstra [Tue, 12 Jul 2011 11:34:23 +0000 (14:34 +0300)]
mips: null pointer deref should segfault

Dereferencing a null pointer causes an exception 0xC (EXCP_AdEL)
instead of EXCP_TLBL. This should also trigger a segfault.

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agomips: missing syscall returns wrong errno
Wesley W. Terpstra [Tue, 12 Jul 2011 11:33:23 +0000 (14:33 +0300)]
mips: missing syscall returns wrong errno

Return -TARGET_ENOSYS instead of -ENOSYS from linux-user/main.c
   * Caused strange 'Level 2 synchronization messages' instead of
correctly reporting the syscall was missing.
   * Made glibc simply fail instead of using older syscalls

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
12 years agomips: sigaltstack args
Wesley W. Terpstra [Tue, 12 Jul 2011 11:32:31 +0000 (14:32 +0300)]
mips: sigaltstack args

The syscall sigaltstack takes two parameters, not zero. This patch
should have no impact as only values above 4 influence the runtime
behaviour. Nevertheless, it is wrong.

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user/syscall.c: Enforce pselect6 sigset size restrictions
Peter Maydell [Tue, 28 Jun 2011 11:21:57 +0000 (12:21 +0100)]
linux-user/syscall.c: Enforce pselect6 sigset size restrictions

Enforce the same restriction on the size of the sigset passed to
pselect6 as the Linux kernel does. This is both correct and silences
a gcc 4.6 warning about a write-only variable.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Implement prlimit64 syscall
Peter Maydell [Mon, 27 Jun 2011 16:44:52 +0000 (17:44 +0100)]
linux-user: Implement prlimit64 syscall

Implement the prlimit64 syscall.

Slightly modified to apply upstream -Riku

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Add syscall numbers from kernel 2.6.39.2
Peter Maydell [Mon, 27 Jun 2011 16:44:51 +0000 (17:44 +0100)]
linux-user: Add syscall numbers from kernel 2.6.39.2

Add syscall numbers for new syscall numbers; this brings us
into line with Linux 2.6.39.2.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Add support for even more FB ioctls
Cédric VINCENT [Wed, 29 Jun 2011 13:09:11 +0000 (15:09 +0200)]
linux-user: Add support for even more FB ioctls

This patch was validated with programs from DirectFB-1.0 and
WebKit/DirectFB.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Add support for more VT ioctls
Cédric VINCENT [Wed, 29 Jun 2011 13:09:10 +0000 (15:09 +0200)]
linux-user: Add support for more VT ioctls

DirectFB-1.0 uses at least two of the four added ioctls, and the two
others were added for completeness.  This patch was validated with the
program "vlock -all/-new".

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Add support for KD...LED ioctls
Cédric VINCENT [Wed, 29 Jun 2011 13:09:09 +0000 (15:09 +0200)]
linux-user: Add support for KD...LED ioctls

DirectFB-1.0 uses at least one of the four added ioctls, and the three
others were added for completeness.  This patch was validated with the
program "setleds" and the following Makefile:

    SETLEDS_INIT  = setleds -v -num -caps -scroll
    SETLEDS_TESTS = sh -c ' \
setleds -v +num +caps +scroll; \
setleds -v -num -caps -scroll; \
setleds -v +num -caps -scroll; \
setleds -v +num +caps -scroll; \
setleds -v +num +caps +scroll; \
setleds -v -num +caps +scroll; \
setleds -v -num -caps +scroll; \
setleds -v -num -caps -scroll'

    SETLEDS_HOST = setleds
    SETLEDS_QEMU = "SETLEDS_QEMU not set"

    .PHONY: setleds_tests
    setleds_tests:
rm -f setleds.host setleds.target
$(SETLEDS_INIT:setleds=$(SETLEDS_HOST))
$(SETLEDS_TESTS:setleds=$(SETLEDS_HOST)) >> setleds.host
$(SETLEDS_INIT:setleds=$(SETLEDS_QEMU))
$(SETLEDS_TESTS:setleds=$(SETLEDS_QEMU)) >> setleds.target
cmp setleds.host setleds.target

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agoarm-semi: Provide access to CLI arguments passed through the "-append" option
Cédric VINCENT [Wed, 29 Jun 2011 10:49:41 +0000 (12:49 +0200)]
arm-semi: Provide access to CLI arguments passed through the "-append" option

This patch basically adapts the new semi-hosting command-line support
-- introduced by Wolfgang Schildbach in the commit 2e8785ac -- for use
in system-mode.

Note that the "arm_cmdline_len" and "host_cmdline_len" variables were
renamed respectively "input_size" and "output_size" because:

    * in C, the term "length" is generally used to count the number of
      character in a string, not to count the number of bytes in a
      buffer (as it is the case here).

    * in QEMU, the term "host" is used to name variables that are in
      the host address space, not to name variables in the target
      address space (as it is the case here).

    * in the case of this system-call, the terms "input" and "output"
      fit the semantic of the official ARM semi-hosting specification
      quite well.

I know renaming can be considered harmful but I do think in this case
the semantic really matters to keep this code more understandable.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Reviewed-by: Christophe Lyon <christophe.lyon@st.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Paul Brook <paul@codesourcery.com>
Cc: Wolfgang Schildbach <wschi@dolby.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>