sdk/emulator/qemu.git
9 years agoMerge remote-tracking branch 'remotes/lalrae/tags/mips-20150612' into staging
Peter Maydell [Fri, 12 Jun 2015 11:49:40 +0000 (12:49 +0100)]
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150612' into staging

MIPS patches 2015-06-12

Changes:
* improve dp8393x network card and rc4030 chipset emulation
* support misaligned R6 and MSA memory accesses
* support MIPS eXtended and Large Physical Addressing
* add Config5.FRE bit and ERETNC instruction (Config5.LLB)
* support ememsize on MALTA

# gpg: Signature made Fri Jun 12 09:38:11 2015 BST using RSA key ID 0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8DD3 2F98 5495 9D66 35D4  4FC0 5211 8E3C 0B29 DA6B

* remotes/lalrae/tags/mips-20150612: (29 commits)
  target-mips: enable XPA and LPA features
  target-mips: remove misleading comments in translate_init.c
  target-mips: add MTHC0 and MFHC0 instructions
  target-mips: add CP0.PageGrain.ELPA support
  target-mips: support Page Frame Number Extension field
  target-mips: extend selected CP0 registers to 64-bits in MIPS32
  target-mips: correct MFC0 for CP0.EntryLo in MIPS64
  net/dp8393x: fix hardware reset
  net/dp8393x: correctly reset in_use field
  net/dp8393x: add load/save support
  net/dp8393x: add PROM to store MAC address
  net/dp8393x: QOM'ify
  net/dp8393x: use dp8393x_ prefix for all functions
  net/dp8393x: do not use old_mmio accesses
  net/dp8393x: always calculate proper checksums
  dma/rc4030: convert to QOM
  dma/rc4030: use trace events instead of custom logging
  dma/rc4030: document register at offset 0x210
  dma/rc4030: do not use old_mmio accesses
  dma/rc4030: use AddressSpace and address_space_rw in users
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20150612' into...
Peter Maydell [Fri, 12 Jun 2015 10:06:03 +0000 (11:06 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150612' into staging

migration/next for 20150612

# gpg: Signature made Fri Jun 12 05:56:21 2015 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20150612: (21 commits)
  Remove unneeded memset
  Rename RDMA structures to make destination clear
  Teach analyze-migration.py about section footers
  Add a protective section footer
  Disable section footers on older machine types
  Merge section header writing
  Move loadvm_handlers into MigrationIncomingState
  Move copy out of qemu_peek_buffer
  Create MigrationIncomingState
  qemu_ram_foreach_block: pass up error value, and down the ramblock name
  Split header writing out of qemu_savevm_state_begin
  Add qemu_get_counted_string to read a string prefixed by a count byte
  migration: Use normal VMStateDescriptions for Subsections
  migration: create savevm_state
  migration: Remove duplicated assignment of SETUP status
  rdma: Fix qemu crash when IPv6 address is used for migration
  arch_init: Clean up the duplicate variable 'len' defining in ram_load()
  migration: reduce include files
  migration: Add myself to the copyright list of both files
  migration: move savevm.c inside migration/
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agotarget-mips: enable XPA and LPA features
Leon Alrae [Tue, 14 Apr 2015 09:33:43 +0000 (10:33 +0100)]
target-mips: enable XPA and LPA features

Enable XPA in MIPS32R5-generic and LPA in MIPS64R6-generic.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: remove misleading comments in translate_init.c
Leon Alrae [Tue, 14 Apr 2015 09:33:35 +0000 (10:33 +0100)]
target-mips: remove misleading comments in translate_init.c

PABITS are not hardcoded to 36 bits and we do not model 59 PABITS (which is
the architectural limit) in QEMU.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: add MTHC0 and MFHC0 instructions
Leon Alrae [Thu, 11 Sep 2014 15:28:17 +0000 (16:28 +0100)]
target-mips: add MTHC0 and MFHC0 instructions

Implement MTHC0 and MFHC0 instructions. In MIPS32 they are used to access
upper word of extended to 64-bits CP0 registers.

In MIPS64, when CP0 destination register specified is the EntryLo0 or
EntryLo1, bits 1:0 of the GPR appear at bits 31:30 of EntryLo0 or
EntryLo1. This is to compensate for RI and XI, which were shifted to bits
63:62 by MTC0 to EntryLo0 or EntryLo1. Therefore creating separate
functions for EntryLo0 and EntryLo1.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: add CP0.PageGrain.ELPA support
Leon Alrae [Tue, 14 Apr 2015 09:09:38 +0000 (10:09 +0100)]
target-mips: add CP0.PageGrain.ELPA support

CP0.PageGrain.ELPA enables support for large physical addresses. This field
is encoded as follows:
0: Large physical address support is disabled.
1: Large physical address support is enabled.

If this bit is a 1, the following changes occur to coprocessor 0 registers:
- The PFNX field of the EntryLo0 and EntryLo1 registers is writable and
  concatenated with the PFN field to form the full page frame number.
- Access to optional COP0 registers with PA extension, LLAddr, TagLo is
  defined.

P5600 can operate in 32-bit or 40-bit Physical Address Mode. Therefore if
XPA is disabled (CP0.PageGrain.ELPA = 0) then assume 32-bit Address Mode.
In MIPS64 assume 36 as default PABITS (when CP0.PageGrain.ELPA = 0).

env->PABITS value is constant and indicates maximum PABITS available on
a core, whereas env->PAMask is calculated from env->PABITS and is also
affected by CP0.PageGrain.ELPA.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: support Page Frame Number Extension field
Leon Alrae [Thu, 11 Sep 2014 15:28:16 +0000 (16:28 +0100)]
target-mips: support Page Frame Number Extension field

Update tlb->PFN to contain PFN concatenated with PFNX. PFNX is 0 if large
physical address is not supported.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: extend selected CP0 registers to 64-bits in MIPS32
Leon Alrae [Tue, 9 Jun 2015 16:14:13 +0000 (17:14 +0100)]
target-mips: extend selected CP0 registers to 64-bits in MIPS32

Extend EntryLo0, EntryLo1, LLAddr and TagLo from 32 to 64 bits in MIPS32.

Introduce gen_move_low32() function which moves low 32 bits from 64-bit
temp to GPR; it sign extends 32-bit value on MIPS64 and truncates on
MIPS32.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: correct MFC0 for CP0.EntryLo in MIPS64
Leon Alrae [Fri, 20 Mar 2015 12:06:10 +0000 (12:06 +0000)]
target-mips: correct MFC0 for CP0.EntryLo in MIPS64

CP0.EntryLo bits 31:30 have to be cleared.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agoRemove unneeded memset
Dr. David Alan Gilbert [Mon, 20 Apr 2015 15:57:21 +0000 (16:57 +0100)]
Remove unneeded memset

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoRename RDMA structures to make destination clear
Dr. David Alan Gilbert [Mon, 20 Apr 2015 15:57:16 +0000 (16:57 +0100)]
Rename RDMA structures to make destination clear

RDMA has two data types that are named confusingly;
   RDMALocalBlock (pointed to indirectly by local_ram_blocks)
   RDMARemoteBlock (pointed to by block in RDMAContext)

RDMALocalBlocks, as the name suggests is a data strucuture that
represents the RDMAable RAM Blocks on the current side of the migration
whichever that is.

RDMARemoteBlocks is always the shape of the RAMBlocks on the
destination, even on the destination.

Rename:
     RDMARemoteBlock -> RDMADestBlock
     context->'block' -> context->dest_blocks

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoTeach analyze-migration.py about section footers
Dr. David Alan Gilbert [Tue, 19 May 2015 11:29:53 +0000 (12:29 +0100)]
Teach analyze-migration.py about section footers

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoAdd a protective section footer
Dr. David Alan Gilbert [Tue, 19 May 2015 11:29:52 +0000 (12:29 +0100)]
Add a protective section footer

Badly formatted migration streams can go undetected or produce
misleading errors due to a lock of checking at the end of sections.
In particular a section that adds an extra 0x00 at the end
causes what looks like a normal end of stream and thus doesn't produce
any errors, and something that ends in a 0x01..0x04 kind of look
like real section headers and then fail when the section parser tries
to figure out which section they are.  This is made worse by the
choice of 0x00..0x04 being small numbers that are particularly common
in normal section data.

This patch adds a section footer consisting of a marker (0x7e - ~)
followed by the section-id that was also sent in the header.  If
they mismatch then it throws an error explaining which section was
being loaded.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoDisable section footers on older machine types
Dr. David Alan Gilbert [Tue, 19 May 2015 11:29:51 +0000 (12:29 +0100)]
Disable section footers on older machine types

The next patch adds section footers; but we don't want to
break migration compatibility so disable them on older
machine types

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoMerge section header writing
Dr. David Alan Gilbert [Tue, 19 May 2015 11:29:50 +0000 (12:29 +0100)]
Merge section header writing

The header writing for device sections is open coded in
a few places, merge it into one.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoMove loadvm_handlers into MigrationIncomingState
Dr. David Alan Gilbert [Thu, 21 May 2015 12:24:16 +0000 (13:24 +0100)]
Move loadvm_handlers into MigrationIncomingState

In postcopy we need the loadvm_handlers to be used in a couple
of different instances of the loadvm loop/routine, and thus
it can't be local any more.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoMove copy out of qemu_peek_buffer
Dr. David Alan Gilbert [Thu, 21 May 2015 12:24:15 +0000 (13:24 +0100)]
Move copy out of qemu_peek_buffer

qemu_peek_buffer currently copies the data it reads into a buffer,
however a future patch wants access to the buffer without the copy,
hence rework to remove the copy to the layer above.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoCreate MigrationIncomingState
Dr. David Alan Gilbert [Thu, 21 May 2015 12:24:14 +0000 (13:24 +0100)]
Create MigrationIncomingState

There are currently lots of pieces of incoming migration state scattered
around, and postcopy is adding more, and it seems better to try and keep
it together.

allocate MIS in process_incoming_migration_co

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoqemu_ram_foreach_block: pass up error value, and down the ramblock name
Dr. David Alan Gilbert [Thu, 21 May 2015 12:24:13 +0000 (13:24 +0100)]
qemu_ram_foreach_block: pass up error value, and down the ramblock name

check the return value of the function it calls and error if it's non-0
Fixup qemu_rdma_init_one_block that is the only current caller,
  and rdma_add_block the only function it calls using it.

Pass the name of the ramblock to the function; helps in debugging.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoSplit header writing out of qemu_savevm_state_begin
Dr. David Alan Gilbert [Thu, 21 May 2015 12:24:12 +0000 (13:24 +0100)]
Split header writing out of qemu_savevm_state_begin

Split qemu_savevm_state_begin to:
  qemu_savevm_state_header   That writes the initial file header.
  qemu_savevm_state_begin    That sets up devices and does the first
                             device pass.

Used later in postcopy.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoAdd qemu_get_counted_string to read a string prefixed by a count byte
Dr. David Alan Gilbert [Thu, 21 May 2015 12:24:11 +0000 (13:24 +0100)]
Add qemu_get_counted_string to read a string prefixed by a count byte

and use it in loadvm_state and ram_load.

Where ever it's used, check the return and error if it failed.

Minor: ram_load was using a 257 byte array for its string, the
       maximum length is 255 bytes + 0 terminator, so fix to 256

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agomigration: Use normal VMStateDescriptions for Subsections
Juan Quintela [Tue, 23 Sep 2014 12:09:54 +0000 (14:09 +0200)]
migration: Use normal VMStateDescriptions for Subsections

We create optional sections with this patch.  But we already have
optional subsections.  Instead of having two mechanism that do the
same, we can just generalize it.

For subsections we just change:

- Add a needed function to VMStateDescription
- Remove VMStateSubsection (after removal of the needed function
  it is just a VMStateDescription)
- Adjust the whole tree, moving the needed function to the corresponding
  VMStateDescription

Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agomigration: create savevm_state
Juan Quintela [Wed, 13 May 2015 11:37:04 +0000 (13:37 +0200)]
migration: create savevm_state

This way, we will put savevm global state here, instead of lots of variables.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9 years agomigration: Remove duplicated assignment of SETUP status
Juan Quintela [Wed, 20 May 2015 15:14:28 +0000 (17:14 +0200)]
migration: Remove duplicated assignment of SETUP status

We assign the MIGRATION_STATUS_SETUP status in two places.  Just in
succession.  Just remove the second one.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agordma: Fix qemu crash when IPv6 address is used for migration
Padmanabh Ratnakar [Tue, 2 Jun 2015 23:14:10 +0000 (04:44 +0530)]
rdma: Fix qemu crash when IPv6 address is used for migration

Qemu crashes when IPv6 address is specified for migration and access
to any RDMA uverbs device available on the system is blocked using cgroups.
Fix the crash by checking the return value of ibv_open_device routine.

Signed-off-by: Meghana Cheripady <meghana.cheripady@avagotech.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@avagotech.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agoarch_init: Clean up the duplicate variable 'len' defining in ram_load()
zhanghailiang [Fri, 15 May 2015 09:00:03 +0000 (17:00 +0800)]
arch_init: Clean up the duplicate variable 'len' defining in ram_load()

There are two places that define 'len' variable, It's OK for compiling,
but makes it difficult for reading.

Remove the local one which defined in the inside 'while' loop.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
9 years agomigration: reduce include files
Juan Quintela [Fri, 8 May 2015 11:54:36 +0000 (13:54 +0200)]
migration: reduce include files

To make changes easier, with the copy, I maintained almost all include
files.  Now I remove the unnecessary ones on this patch.  This compiles
on linux x64 with all architectures configured, and cross-compiles for
windows 32 and 64 bits.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agomigration: Add myself to the copyright list of both files
Juan Quintela [Fri, 8 May 2015 11:20:21 +0000 (13:20 +0200)]
migration: Add myself to the copyright list of both files

If anyone feels like adding himself to the list, just sent me a patch.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agomigration: move savevm.c inside migration/
Juan Quintela [Fri, 8 May 2015 10:49:01 +0000 (12:49 +0200)]
migration: move savevm.c inside migration/

Now, everything is in place.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agomigration: move ram stuff to migration/ram
Juan Quintela [Thu, 7 May 2015 17:33:31 +0000 (19:33 +0200)]
migration: move ram stuff to migration/ram

For historic reasons, ram migration have been on arch_init.c.  Just
split it into migration/ram.c, the same that happened with block.c.

There is only code movement, no changes altogether.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Thu, 11 Jun 2015 14:33:38 +0000 (15:33 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, acpi, virtio

Most notably this includes virtio 1 patches
Still not all devices converted, and not fully spec compliant,
so disabled by default.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Thu Jun 11 12:53:08 2015 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (42 commits)
  i386/acpi-build: fix PXB workarounds for unsupported BIOSes
  i386/acpi-build: more traditional _UID and _HID for PXB root buses
  vhost-scsi: move qdev properties into vhost-scsi.c
  virtio-9p-device: move qdev properties into virtio-9p-device.c
  virtio-serial-bus: move qdev properties into virtio-serial-bus.c
  virtio-rng: move qdev properties into virtio-rng.c
  virtio-scsi: move qdev properties into virtio-scsi.c
  virtio-net.h: Remove unsed DEFINE_VIRTIO_NET_PROPERTIES
  virtio-net: move qdev properties into virtio-net.c
  virtio-input: emulated devices [pci]
  virtio-input: core code & base class [pci]
  pci: add PCI_CLASS_INPUT_*
  virtio-pci: fill VirtIOPCIRegions early.
  virtio-pci: drop identical virtio_pci_cap
  virtio-pci: move cap type to VirtIOPCIRegion
  virtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map
  virtio-pci: add virtio_pci_modern_region_map()
  virtio-pci: add virtio_pci_modern_regions_init()
  virtio-pci: add struct VirtIOPCIRegion for virtio-1 regions
  virtio-balloon: switch to virtio_add_feature
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-20150611-1' into staging
Peter Maydell [Thu, 11 Jun 2015 13:40:25 +0000 (14:40 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-20150611-1' into staging

sdl2: fix crash in handle_windowevent() when restoring the screen size

# gpg: Signature made Thu Jun 11 08:57:38 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-sdl-20150611-1:
  sdl2: fix crash in handle_windowevent() when restoring the screen size

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agohw/vfio/platform: replace g_malloc0_n by g_new0
Eric Auger [Thu, 11 Jun 2015 08:44:40 +0000 (09:44 +0100)]
hw/vfio/platform: replace g_malloc0_n by g_new0

g_malloc0_n() is introduced since glib-2.24 while QEMU currently
requires glib-2.22. This may cause a link error on some distributions.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoMerge remote-tracking branch 'remotes/spice/tags/pull-spice-20150611-1' into staging
Peter Maydell [Thu, 11 Jun 2015 11:12:58 +0000 (12:12 +0100)]
Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20150611-1' into staging

spice: fix segfault in qemu_spice_create_update, ui_info tweaks.

# gpg: Signature made Thu Jun 11 08:48:49 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-20150611-1:
  spice: ui_info tweaks
  spice-display: fix segfault in qemu_spice_create_update

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agoi386/acpi-build: fix PXB workarounds for unsupported BIOSes
Laszlo Ersek [Thu, 11 Jun 2015 00:37:59 +0000 (02:37 +0200)]
i386/acpi-build: fix PXB workarounds for unsupported BIOSes

The patch

  apci: fix PXB behaviour if used with unsupported BIOS

uses the following condition to see if a "PXB mem/IO chunk" has *not* been
configured by the BIOS:

  (!range_base || range_base > range_limit)

When this condition evaluates to true, said patch *omits* the
corresponding entry from the _CRS.

Later on the patch checks for the opposite condition (with the intent of
*adding* entries to the _CRS if the "PXB mem/IO chunks" *have* been
configured). Unfortunately, the condition was negated incorrectly: only
the first ! operator was removed, which led to the nonsensical expression

  (range_base || range_base > range_limit)

leading to bogus entries in the _CRS, and causing BSOD in Windows Server
2012 R2 when it runs on OVMF.

The correct negative of the condition seen at the top is

  (range_base && range_base <= range_limit)

Fix the expressions.

Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoi386/acpi-build: more traditional _UID and _HID for PXB root buses
Laszlo Ersek [Thu, 11 Jun 2015 00:37:58 +0000 (02:37 +0200)]
i386/acpi-build: more traditional _UID and _HID for PXB root buses

The ACPI specification permits the _HID and _UID objects to evaluate to
strings. (See "6.1.5 _HID (Hardware ID)" and "6.1.12 _UID (Unique ID)" in
the ACPI v6.0 spec.)

With regard to related standards, the UEFI specification can also express
a device address composed from string _HID and _UID identifiers, inside
the Expanded ACPI Device Path Node. (See "9.3.3 ACPI Device Path", Table
49, in the UEFI v2.5 spec.)

However, numeric (integer) contents for both _HID and _UID are more
traditional. They are recommended by the UEFI spec for size reasons:

  [...] the ACPI Device Path node is smaller and should be used if
  possible to reduce the size of device paths that may potentially be
  stored in nonvolatile storage [...]

External tools support them better (for example the --acpi_hid and
--acpi_uid options of "efibootmgr" only take numeric identifiers).
Finally, numeric _HID and _UID contents are existing practice in the QEMU
source.

This patch was tested with a Fedora 20 LiveCD and a preexistent Windows
Server 2012 R2 guest. Using "acpidump" and "iasl" in the Fedora guest, we
get, in the SSDT:

> Scope (\_SB)
> {
>   Device (PC04)
>   {
>     Name (_UID, 0x04)  // _UID: Unique ID
>     Name (_HID, EisaId ("PNP0A03") /* PCI Bus */)  // _HID: Hardware ID

Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150611-1' into staging
Peter Maydell [Thu, 11 Jun 2015 10:18:11 +0000 (11:18 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150611-1' into staging

gtk: don't exit early in case gtk init fails

# gpg: Signature made Thu Jun 11 10:38:29 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-gtk-20150611-1:
  gtk: don't exit early in case gtk init fails

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agogtk: don't exit early in case gtk init fails
Gerd Hoffmann [Fri, 5 Jun 2015 11:07:58 +0000 (13:07 +0200)]
gtk: don't exit early in case gtk init fails

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
9 years agonet/dp8393x: fix hardware reset
Hervé Poussineau [Wed, 3 Jun 2015 20:45:49 +0000 (22:45 +0200)]
net/dp8393x: fix hardware reset

Documentation is not clear of what happens when doing a hardware reset,
but firmware expect all registers to be zero unless specified otherwise.

This fixes reboot on MIPS Magnum.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: correctly reset in_use field
Hervé Poussineau [Wed, 3 Jun 2015 20:45:48 +0000 (22:45 +0200)]
net/dp8393x: correctly reset in_use field

Don't write more than the field width, which is always 16 bit.
Fixes network in NetBSD 5.1/arc

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: add load/save support
Hervé Poussineau [Wed, 3 Jun 2015 20:45:47 +0000 (22:45 +0200)]
net/dp8393x: add load/save support

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: add PROM to store MAC address
Hervé Poussineau [Wed, 3 Jun 2015 20:45:46 +0000 (22:45 +0200)]
net/dp8393x: add PROM to store MAC address

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: QOM'ify
Hervé Poussineau [Wed, 3 Jun 2015 20:45:45 +0000 (22:45 +0200)]
net/dp8393x: QOM'ify

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: use dp8393x_ prefix for all functions
Hervé Poussineau [Wed, 3 Jun 2015 20:45:44 +0000 (22:45 +0200)]
net/dp8393x: use dp8393x_ prefix for all functions

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: do not use old_mmio accesses
Hervé Poussineau [Wed, 3 Jun 2015 20:45:43 +0000 (22:45 +0200)]
net/dp8393x: do not use old_mmio accesses

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agonet/dp8393x: always calculate proper checksums
Hervé Poussineau [Wed, 3 Jun 2015 20:45:42 +0000 (22:45 +0200)]
net/dp8393x: always calculate proper checksums

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agodma/rc4030: convert to QOM
Hervé Poussineau [Wed, 3 Jun 2015 20:45:41 +0000 (22:45 +0200)]
dma/rc4030: convert to QOM

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agodma/rc4030: use trace events instead of custom logging
Hervé Poussineau [Wed, 3 Jun 2015 20:45:40 +0000 (22:45 +0200)]
dma/rc4030: use trace events instead of custom logging

Remove also unneeded debug logs.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agodma/rc4030: document register at offset 0x210
Hervé Poussineau [Wed, 3 Jun 2015 20:45:39 +0000 (22:45 +0200)]
dma/rc4030: document register at offset 0x210

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agodma/rc4030: do not use old_mmio accesses
Hervé Poussineau [Wed, 3 Jun 2015 20:45:38 +0000 (22:45 +0200)]
dma/rc4030: do not use old_mmio accesses

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agodma/rc4030: use AddressSpace and address_space_rw in users
Hervé Poussineau [Wed, 3 Jun 2015 20:45:37 +0000 (22:45 +0200)]
dma/rc4030: use AddressSpace and address_space_rw in users

Now that rc4030 internally uses an AddressSpace for DMA handling, make its root
memory region public. This is especially usefull for dp8393x netcard, which now
uses well known QEMU types and methods.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agodma/rc4030: create custom DMA address space
Hervé Poussineau [Wed, 3 Jun 2015 20:45:36 +0000 (22:45 +0200)]
dma/rc4030: create custom DMA address space

Add a new memory region in system address space where DMA address space
definition (the 'translation table') belongs, so we can update on the fly
the DMA address space.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agomips jazz: compile only in 64 bit
Hervé Poussineau [Wed, 3 Jun 2015 20:45:35 +0000 (22:45 +0200)]
mips jazz: compile only in 64 bit

Remove now useless device models from other MIPS configurations

We're now compiling 12 files less than before.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: add ERETNC instruction and Config5.LLB bit
Leon Alrae [Thu, 4 Jun 2015 16:00:31 +0000 (17:00 +0100)]
target-mips: add ERETNC instruction and Config5.LLB bit

ERETNC is identical to ERET except that an ERETNC will not clear the LLbit
that is set by execution of an LL instruction, and thus when placed between
an LL and SC sequence, will never cause the SC to fail.

Presence of ERETNC is denoted by the Config5.LLB.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
9 years agotarget-mips: Misaligned memory accesses for MSA
Yongbok Kim [Mon, 1 Jun 2015 11:13:24 +0000 (12:13 +0100)]
target-mips: Misaligned memory accesses for MSA

MIPS SIMD Architecture vector loads and stores require misalignment support.
MSA Memory access should work as an atomic operation. Therefore, it has to
check validity of all addresses for a vector store access if it is spanning
into two pages.

Separating helper functions for each data format as format is known in
translation.
To use mmu_idx from cpu_mmu_index() instead of calculating it from hflag.
Removing save_cpu_state() call in translation because it is able to use
cpu_restore_state() on fault as GETRA() is passed.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
[leon.alrae@imgtec.com: remove unused do_* functions]
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agosoftmmu: Add probe_write()
Yongbok Kim [Mon, 1 Jun 2015 11:13:23 +0000 (12:13 +0100)]
softmmu: Add probe_write()

Probe for whether the specified guest write access is permitted.
If it is not permitted then an exception will be taken in the same
way as if this were a real write access (and we will not return).
Otherwise the function will return, and there will be a valid
entry in the TLB for this access.

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: Misaligned memory accesses for R6
Yongbok Kim [Mon, 1 Jun 2015 11:13:22 +0000 (12:13 +0100)]
target-mips: Misaligned memory accesses for R6

Release 6 requires misaligned memory access support for all ordinary memory
access instructions (for example, LW/SW, LWC1/SWC1).
However misaligned support is not provided for certain special memory accesses
such as atomics (for example, LL/SC).

Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agomips_malta: provide ememsize env variable to kernels
Paul Burton [Mon, 25 May 2015 13:21:04 +0000 (14:21 +0100)]
mips_malta: provide ememsize env variable to kernels

Commit 94c2b6aff43c (mips_malta: support up to 2GiB RAM) provided
support for using over 256MB of RAM with the MIPS Malta board, including
capping the memsize variable that QEMUs pseudo-bootloader provides to
the kernel at 256MB in order to match YAMON. It didn't however provide
the ememsize variable which kernels supporting memory outside of the
unmapped address spaces (ie. EVA or highmem) may use to determine the
true size of the RAM present in the system.

Set ememsize to the size of RAM so that such kernels may use all
available memory without the user having to manually specifying its size
& location.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: add Config5.FRE support allowing Status.FR=0 emulation
Leon Alrae [Tue, 21 Apr 2015 15:06:28 +0000 (16:06 +0100)]
target-mips: add Config5.FRE support allowing Status.FR=0 emulation

This relatively small architectural feature adds the following:

FIR.FREP: Read-only. If FREP=1, then Config5.FRE and Config5.UFE are
          available.

Config5.FRE: When enabled all single-precision FP arithmetic instructions,
             LWC1/LWXC1/MTC1, SWC1/SWXC1/MFC1 cause a Reserved Instructions
             exception.

Config5.UFE: Allows user to write/read Config5.FRE using CTC1/CFC1
             instructions.

Enable the feature in MIPS64R6-generic CPU.

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agotarget-mips: move group of functions above gen_load_fpr32()
Leon Alrae [Tue, 21 Apr 2015 15:06:27 +0000 (16:06 +0100)]
target-mips: move group of functions above gen_load_fpr32()

Move the "Tests" group of functions so that gen_load_fpr32() and
gen_store_fpr32() can use generate_exception().

Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
9 years agospice: ui_info tweaks
Gerd Hoffmann [Fri, 13 Mar 2015 11:21:50 +0000 (12:21 +0100)]
spice: ui_info tweaks

Use the new dpy_ui_info_supported function.
Clarifies the control flow.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agospice-display: fix segfault in qemu_spice_create_update
Gerd Hoffmann [Tue, 9 Jun 2015 19:08:47 +0000 (21:08 +0200)]
spice-display: fix segfault in qemu_spice_create_update

Although it is pretty unusual the stride for the guest image and the
mirror image maintained by spice-display can be different.  So use
separate variables for them.

https://bugzilla.redhat.com/show_bug.cgi?id=1163047

Cc: qemu-stable@nongnu.org
Reported-by: perrier vincent <clownix@clownix.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150610-1' into staging
Peter Maydell [Wed, 10 Jun 2015 17:13:58 +0000 (18:13 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150610-1' into staging

stdvga: factor out mmio subregion init
virtio-gpu: add virtio gpu core code, 2d mode

# gpg: Signature made Wed Jun 10 10:03:11 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-vga-20150610-1:
  virtio-gpu/2d: add virtio gpu core code
  virtio: update headers, add virtio-gpu (2d)
  stdvga: factor out mmio subregion init
  stdvga: pass VGACommonState instead of PCIVGAState
  stdvga: fix offset in pci_vga_ioport_read

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9 years agovhost-scsi: move qdev properties into vhost-scsi.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:36 +0000 (23:04 +0800)]
vhost-scsi: move qdev properties into vhost-scsi.c

As only one place in vhost-scsi.c uses DEFINE_VHOST_SCSI_PROPERTIES,
there is no need to expose it. Inline it into vhost-scsi.c to avoid
wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-9p-device: move qdev properties into virtio-9p-device.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:35 +0000 (23:04 +0800)]
virtio-9p-device: move qdev properties into virtio-9p-device.c

As only one place in virtio-9p-device.c uses
DEFINE_VIRTIO_9P_PROPERTIES, there is no need to expose it. Inline it
into virtio-9p-device.c to avoid wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-serial-bus: move qdev properties into virtio-serial-bus.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:34 +0000 (23:04 +0800)]
virtio-serial-bus: move qdev properties into virtio-serial-bus.c

As only one place in virtio-serial-bus.c uses
DEFINE_VIRTIO_SERIAL_PROPERTIES, there is no need to expose it. Inline
it into virtio-serial-bus.c to avoid wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-rng: move qdev properties into virtio-rng.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:33 +0000 (23:04 +0800)]
virtio-rng: move qdev properties into virtio-rng.c

As only one place in virtio-rng.c uses DEFINE_VIRTIO_RNG_PROPERTIES,
there is no need to expose it. Inline it into virtio-rng.c to avoid
wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-scsi: move qdev properties into virtio-scsi.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:32 +0000 (23:04 +0800)]
virtio-scsi: move qdev properties into virtio-scsi.c

As only one place in virtio-scsi.c uses DEFINE_VIRTIO_SCSI_PROPERTIES
and DEFINE_VIRTIO_SCSI_FEATURES, there is no need to expose them. Inline
them into virtio-scsi.c to avoid wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net.h: Remove unsed DEFINE_VIRTIO_NET_PROPERTIES
Shannon Zhao [Wed, 10 Jun 2015 15:04:31 +0000 (23:04 +0800)]
virtio-net.h: Remove unsed DEFINE_VIRTIO_NET_PROPERTIES

Remove unsed DEFINE_VIRTIO_NET_PROPERTIES in virtio-net.h and delete a
space typo.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: move qdev properties into virtio-net.c
Shannon Zhao [Wed, 10 Jun 2015 15:04:30 +0000 (23:04 +0800)]
virtio-net: move qdev properties into virtio-net.c

As only one place in virtio-net.c uses DEFINE_VIRTIO_NET_FEATURES,
there is no need to expose it. Inline it into virtio-net.c to avoid
wrongly use.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-input: emulated devices [pci]
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:42 +0000 (12:34 +0200)]
virtio-input: emulated devices [pci]

This patch adds virtio-pci support for the emulated virtio-input
devices.  Using them is as simple as adding "-device virtio-tablet-pci"
to your command line.  If you want add multiple devices but don't want
waste a pci slot for each you can compose a multifunction device this way:

qemu -device virtio-keyboard-pci,addr=0d.0,multifunction=on \
     -device virtio-tablet-pci,addr=0d.1,multifunction=on

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-input: core code & base class [pci]
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:41 +0000 (12:34 +0200)]
virtio-input: core code & base class [pci]

This patch adds the virtio-pci support bits for virtio-input-device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agopci: add PCI_CLASS_INPUT_*
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:40 +0000 (12:34 +0200)]
pci: add PCI_CLASS_INPUT_*

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: fill VirtIOPCIRegions early.
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:39 +0000 (12:34 +0200)]
virtio-pci: fill VirtIOPCIRegions early.

Initialize the modern bar and the VirtIOPCIRegion fields early, in
realize.  Also add a size field to VirtIOPCIRegion and variables for
pci bars to VirtIOPCIProxy.

This allows virtio-pci subclasses to change things before the
device_plugged callback applies them.  virtio-vga will use that to
arrange regions in a way that virtio-vga is compatible to both stdvga
(in vga mode) and virtio-gpu-pci (in pci mode).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: drop identical virtio_pci_cap
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:38 +0000 (12:34 +0200)]
virtio-pci: drop identical virtio_pci_cap

Now the three struct virtio_pci_caps are identical,
lets drop two of them ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: move cap type to VirtIOPCIRegion
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:37 +0000 (12:34 +0200)]
virtio-pci: move cap type to VirtIOPCIRegion

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:36 +0000 (12:34 +0200)]
virtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map

Also fill offset and length automatically,
from VirtIOPCIRegion->offset and region size.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add virtio_pci_modern_region_map()
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:35 +0000 (12:34 +0200)]
virtio-pci: add virtio_pci_modern_region_map()

Add function to map modern virtio regions.
Add offset to VirtIOPCIRegion.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add virtio_pci_modern_regions_init()
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:34 +0000 (12:34 +0200)]
virtio-pci: add virtio_pci_modern_regions_init()

Add init function for the modern pci regions,
move over the init code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add struct VirtIOPCIRegion for virtio-1 regions
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:33 +0000 (12:34 +0200)]
virtio-pci: add struct VirtIOPCIRegion for virtio-1 regions

For now just place the MemoryRegion there,
following patches will add more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-balloon: switch to virtio_add_feature
Cornelia Huck [Thu, 4 Jun 2015 10:34:32 +0000 (12:34 +0200)]
virtio-balloon: switch to virtio_add_feature

This was missed during the conversion of feature bit manipulation.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio_balloon: header update
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:31 +0000 (12:34 +0200)]
virtio_balloon: header update

add modern header

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: correctly set host notifiers for modern bar
Jason Wang [Thu, 4 Jun 2015 10:34:30 +0000 (12:34 +0200)]
virtio-pci: correctly set host notifiers for modern bar

Currently, during host notifier set. We only add eventfd for legacy
bar, this is not correct since:

- Non-transitional device does not have legacy bar, so qemu will crash
  since proxy->bar was not initialized.
- Modern device uses modern bar and notify cap to notify the device,
  we should add eventfd for proxy->notify.

So this patch fixes the above two issues by adding eventfd based on
whether legacy or modern device were supported.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: make modern bar 64bit + prefetchable
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:29 +0000 (12:34 +0200)]
virtio-pci: make modern bar 64bit + prefetchable

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: change & document virtio pci bar layout.
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:28 +0000 (12:34 +0200)]
virtio-pci: change & document virtio pci bar layout.

This patch adds variables for the pci bars (to get rid of the magic
numbers in the code) and moves the modern virtio bar to region 4 so
regions 2+3 are kept free.  virtio-vga wants use them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT smaller
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:27 +0000 (12:34 +0200)]
virtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT smaller

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: add flags to enable/disable legacy/modern
Gerd Hoffmann [Thu, 4 Jun 2015 10:34:26 +0000 (12:34 +0200)]
virtio-pci: add flags to enable/disable legacy/modern

Add VIRTIO_PCI_FLAG_DISABLE_LEGACY and VIRTIO_PCI_FLAG_DISABLE_MODERN
for VirtIOPCIProxy->flags.  Also add properties for them.  They can be
used to disable modern (virtio 1.0) or legacy (virtio 0.9) modes.

By default only legacy is advertized, modern will be turned on by
default once all remaining spec compilance issues are addressed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: switch to modern accessors for 1.0
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:25 +0000 (12:34 +0200)]
virtio-pci: switch to modern accessors for 1.0

virtio 1.0 config space is in LE format for all
devices, use modern wrappers when accessed through
the 1.0 BAR.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: add modern config accessors
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:24 +0000 (12:34 +0200)]
virtio: add modern config accessors

virtio 1.0 defines config space as LE,
as opposed to pre-1.0 which was native endian.

Add API for transports to execute word/dword accesses in
little endian format - will be useful for mmio
and pci (byte access is also wrapped, for completeness).

For simplicity, we still keep config in host native
endian format, byteswap to LE on guest access.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: generation counter support
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:23 +0000 (12:34 +0200)]
virtio: generation counter support

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-pci: initial virtio 1.0 support
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:22 +0000 (12:34 +0200)]
virtio-pci: initial virtio 1.0 support

This is somewhat functional.  With this, and linux driver from my tree,
I was able to use virtio net as virtio 1.0 device for light browsing.

At the moment, dataplane and vhost code is
still missing.

Based on Cornelia's virtio 1.0 patchset:
    Date: Thu, 11 Dec 2014 14:25:02 +0100
    From: Cornelia Huck <cornelia.huck@de.ibm.com>
    To: virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org
Cc: rusty@rustcorp.com.au, thuth@linux.vnet.ibm.com, mst@redhat.com,
    Cornelia Huck <cornelia.huck@de.ibm.com>
    Subject: [PATCH RFC v6 00/20] qemu: towards virtio-1 host support
    Message-Id: <1418304322-7546-1-git-send-email-cornelia.huck@de.ibm.com>

which is itself still missing some core bits.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agolinux-headers: add virtio_pci
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:21 +0000 (12:34 +0200)]
linux-headers: add virtio_pci

Easier than duplicating code.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost: 64 bit features
Cornelia Huck [Thu, 4 Jun 2015 10:34:20 +0000 (12:34 +0200)]
vhost: 64 bit features

Make sure that all vhost interfaces use 64 bit features, as the virtio
core does, and make sure to use ULL everywhere possible to be on the
safe side.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovhost_net: add version_1 feature
Michael S. Tsirkin [Thu, 4 Jun 2015 10:34:19 +0000 (12:34 +0200)]
vhost_net: add version_1 feature

Add VERSION_1 to list of features that we should
test at the backend.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: enable virtio 1.0
Cornelia Huck [Thu, 4 Jun 2015 10:34:18 +0000 (12:34 +0200)]
virtio-net: enable virtio 1.0

virtio-net (non-vhost) now should have everything in place to support
virtio 1.0: let's enable the feature bit for it.

Note that VIRTIO_F_VERSION_1 is technically a transport feature; once
every device is ready for virtio 1.0, we can move setting this
feature bit out of the individual devices.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: support longer header
Cornelia Huck [Thu, 4 Jun 2015 10:34:17 +0000 (12:34 +0200)]
virtio-net: support longer header

virtio-1 devices always use num_buffers in the header, even if
mergeable rx buffers have not been negotiated.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio-net: no writeable mac for virtio-1
Cornelia Huck [Thu, 4 Jun 2015 10:34:16 +0000 (12:34 +0200)]
virtio-net: no writeable mac for virtio-1

Devices operating as virtio 1.0 may not allow writes to the mac
address in config space.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: allow to fail setting status
Cornelia Huck [Thu, 4 Jun 2015 10:34:15 +0000 (12:34 +0200)]
virtio: allow to fail setting status

virtio-1 allow setting of the FEATURES_OK status bit to fail if
the negotiated feature bits are inconsistent: let's fail
virtio_set_status() in that case and update virtio-ccw to post an
error to the guest.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agovirtio: disallow late feature changes for virtio-1
Cornelia Huck [Thu, 4 Jun 2015 10:34:14 +0000 (12:34 +0200)]
virtio: disallow late feature changes for virtio-1

For virtio-1 devices, the driver must not attempt to set feature bits
after it set FEATURES_OK in the device status. Simply reject it in
that case.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9 years agodataplane: allow virtio-1 devices
Cornelia Huck [Thu, 4 Jun 2015 10:34:13 +0000 (12:34 +0200)]
dataplane: allow virtio-1 devices

Handle endianness conversion for virtio-1 virtqueues correctly.

Note that dataplane now needs to be built per-target.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>