]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agoMerge remote-tracking branch 'remotes/elmarco/tags/machine-props-pull-request' into...
Peter Maydell [Mon, 7 Jan 2019 15:32:24 +0000 (15:32 +0000)]
Merge remote-tracking branch 'remotes/elmarco/tags/machine-props-pull-request' into staging

Generalize machine compatibility properties

During "[PATCH v2 05/10] qom/globals: generalize
object_property_set_globals()" review, Eduardo suggested to rework the
GlobalProperty handling, so that -global is limited to QDev only and
we avoid mixing the machine compats and the user-provided -global
properties (instead of generalizing -global to various object kinds,
like I proposed in v2).

"qdev: do not mix compat props with global props" patch decouples a
bit user-provided -global from machine compat properties. This allows
to get rid of "user_provided" and "errp" fields in following patches.

A new compat property "x-use-canonical-path-for-ramblock-id" is added
to hostmem for legacy canonical path names, set to true for -file and
-memfd with qemu < 4.0.

(this series was initially titled "[PATCH v2 00/10] hostmem: use
object "id" for memory region name with >= 3.1", but its focus is more
in refactoring the global and compatilibity properties handling now)

# gpg: Signature made Mon 07 Jan 2019 12:22:43 GMT
# gpg:                using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/machine-props-pull-request: (28 commits)
  hostmem: use object id for memory region name with >= 4.0
  arm: replace instance_post_init()
  qdev-props: call object_apply_global_props()
  qdev-props: remove errp from GlobalProperty
  qdev-props: convert global_props to GPtrArray
  qdev: all globals are now user-provided
  qdev: make a separate helper function to apply compat properties
  compat: remove remaining PC_COMPAT macros
  include: remove compat.h
  compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
  compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
  compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros
  compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros
  compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros
  compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros
  compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros
  compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros
  compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros
  compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
  compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohostmem: use object id for memory region name with >= 4.0
Marc-André Lureau [Wed, 12 Sep 2018 12:18:00 +0000 (16:18 +0400)]
hostmem: use object id for memory region name with >= 4.0

hostmem-file and hostmem-memfd use the whole object path for the
memory region name, and hostname-ram uses only the path component (the
object id, or canonical path basename):

qemu -m 1024 -object memory-backend-file,id=mem,size=1G,mem-path=/tmp/foo -numa node,memdev=mem -monitor stdio
(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
            /objects/mem    4 KiB  0x0000000000000000 0x0000000040000000 0x0000000040000000

qemu -m 1024 -object memory-backend-memfd,id=mem,size=1G -numa node,memdev=mem -monitor stdio
(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
            /objects/mem    4 KiB  0x0000000000000000 0x0000000040000000 0x0000000040000000

qemu -m 1024 -object memory-backend-ram,id=mem,size=1G -numa node,memdev=mem -monitor stdio
(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
                     mem    4 KiB  0x0000000000000000 0x0000000040000000 0x0000000040000000

For consistency, change to use object id for -file and -memfd as well
with >= 4.0.

Having a consistent naming allows to migrate to different hostmem
backends.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoarm: replace instance_post_init()
Marc-André Lureau [Tue, 27 Nov 2018 08:55:59 +0000 (12:55 +0400)]
arm: replace instance_post_init()

Replace arm_cpu_post_init() instance callback by calling it from leaf
classes, to avoid potential ordering issue with other post_init callbacks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Suggested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev-props: call object_apply_global_props()
Marc-André Lureau [Wed, 7 Nov 2018 11:35:34 +0000 (15:35 +0400)]
qdev-props: call object_apply_global_props()

It's now possible to use the common function.

Teach object_apply_global_props() to warn if Error argument is NULL.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev-props: remove errp from GlobalProperty
Marc-André Lureau [Wed, 7 Nov 2018 11:25:58 +0000 (15:25 +0400)]
qdev-props: remove errp from GlobalProperty

All qdev_prop_register_global() set &error_fatal for errp, except
'-rtc driftfix=slew', which arguably should also use &error_fatal, as
otherwise failing to apply the property would only report a warning.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev-props: convert global_props to GPtrArray
Marc-André Lureau [Wed, 7 Nov 2018 09:11:25 +0000 (13:11 +0400)]
qdev-props: convert global_props to GPtrArray

A step towards being able to call a common function,
object_apply_global_props().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev: all globals are now user-provided
Marc-André Lureau [Tue, 6 Nov 2018 11:59:23 +0000 (15:59 +0400)]
qdev: all globals are now user-provided

All globals are now either provided via -global or through -cpu
features (CPU features are implemented by registering globals).

If the global isn't being used, it should warn in either case.

We can thus consider that all global_props are "user-provided"
globals. No need to track this per-globals anymore.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoqdev: make a separate helper function to apply compat properties
Marc-André Lureau [Sat, 1 Dec 2018 21:23:27 +0000 (01:23 +0400)]
qdev: make a separate helper function to apply compat properties

This will allow to apply compat properties on other objects than QDev easily.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: remove remaining PC_COMPAT macros
Marc-André Lureau [Wed, 12 Dec 2018 17:57:53 +0000 (21:57 +0400)]
compat: remove remaining PC_COMPAT macros

Use static arrays instead.  I decided to rename the conflicting
pc_compat_2_1() function with pc_compat_2_1_fn().

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoinclude: remove compat.h
Marc-André Lureau [Wed, 12 Dec 2018 17:50:26 +0000 (21:50 +0400)]
include: remove compat.h

The header is now empty.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros

Use static arrays instead.  I decided to rename the conflicting
pc_compat_2_1() function with pc_compat_2_1_fn().

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros

Use static arrays instead.  I decided to rename the conflicting
pc_compat_2_2() function with pc_compat_2_2_fn().

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros

Use static arrays instead.  I decided to rename the conflicting
pc_compat_2_3() function with pc_compat_2_3_fn().

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_2_12 & HW_COMPAT_2_12 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_3_0 & HW_COMPAT_3_0 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agocompat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros
Marc-André Lureau [Wed, 12 Dec 2018 15:36:30 +0000 (19:36 +0400)]
compat: replace PC_COMPAT_3_1 & HW_COMPAT_3_1 macros

Use static arrays instead.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohw: remove SET_MACHINE_COMPAT
Marc-André Lureau [Mon, 26 Nov 2018 18:25:57 +0000 (22:25 +0400)]
hw: remove SET_MACHINE_COMPAT

No longer needed.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomachine: move compat properties out of globals
Marc-André Lureau [Wed, 12 Dec 2018 14:01:23 +0000 (18:01 +0400)]
machine: move compat properties out of globals

Move the compat arrays inside functions that use them.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohw: apply machine compat properties without touching globals
Marc-André Lureau [Sat, 1 Dec 2018 19:44:11 +0000 (23:44 +0400)]
hw: apply machine compat properties without touching globals

Similarly to accel properties, move compat properties out of globals
registration, and apply the machine compat properties during
device_post_init().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agomachines: replace COMPAT define with a static array
Marc-André Lureau [Wed, 12 Dec 2018 12:30:28 +0000 (16:30 +0400)]
machines: replace COMPAT define with a static array

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agohw: apply accel compat properties without touching globals
Marc-André Lureau [Mon, 26 Nov 2018 18:04:32 +0000 (22:04 +0400)]
hw: apply accel compat properties without touching globals

Instead of registering compat properties as globals, let's keep them
in their own array, to avoid mixing with user globals.

Introduce object_apply_global_props() function, to apply compatibility
properties from a GPtrArray.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-01-05' into staging
Peter Maydell [Mon, 7 Jan 2019 11:55:52 +0000 (11:55 +0000)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-01-05' into staging

nbd patches for 2019-01-05

Error and trace improvements in NBD code, such as less noise for
common disconnect scenarios.

- Vladimir Sementsov-Ogievskiy: 0/3 nbd-client: drop extra error noise
- Eric Blake: portions of 0/22 nbd: add qemu-nbd --list

# gpg: Signature made Sat 05 Jan 2019 13:58:54 GMT
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2019-01-05:
  nbd/client: Drop pointless buf variable
  qemu-nbd: Fail earlier for -c/-d on non-linux
  nbd/client: More consistent error messages
  nbd: Document timeline of various features
  qemu-nbd: Use program name in error messages
  block/nbd-client: use traces instead of noisy error_report_err
  nbd/client: Trace all server option error messages
  nbd: publish _lookup functions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonbd/client: Drop pointless buf variable
Eric Blake [Sat, 15 Dec 2018 13:53:10 +0000 (07:53 -0600)]
nbd/client: Drop pointless buf variable

There's no need to read into a temporary buffer (oversized
since commit 7d3123e1) followed by a byteswap into a uint64_t
to check for a magic number via memcmp(), when the code
immediately below demonstrates reading into the uint64_t then
byteswapping in place and checking for a magic number via
integer math.  What's more, having a different error message
when the server's first reply byte is 0 is unusual - it's no
different from any other wrong magic number, and we already
detected short reads. That whole strlen() issue has been
present and useless since commit 1d45f8b5 in 2010; perhaps it
was leftover debugging (since the correct magic number happens
to be ASCII)?  Make the error messages more consistent and
detailed while touching things.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181215135324.152629-9-eblake@redhat.com>

5 years agoqemu-nbd: Fail earlier for -c/-d on non-linux
Eric Blake [Sat, 15 Dec 2018 13:53:08 +0000 (07:53 -0600)]
qemu-nbd: Fail earlier for -c/-d on non-linux

Connecting to a /dev/nbdN device is a Linux-specific action.
We were already masking -c and -d from 'qemu-nbd --help' on
non-linux.  However, while -d fails with a sensible error
message, it took hunting through a couple of files to prove
that.  What's more, the code for -c doesn't fail until after
it has created a pthread and tried to open a device - possibly
even printing an error message with %m on a non-Linux platform
in spite of the comment that %m is glibc-specific.  Make the
failure happen sooner, then get rid of stubs that are no
longer needed because of the early exits.

While at it: tweak the blank newlines in --help output to be
consistent, whether or not built on Linux.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181215135324.152629-7-eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd/client: More consistent error messages
Eric Blake [Sat, 15 Dec 2018 13:53:07 +0000 (07:53 -0600)]
nbd/client: More consistent error messages

Consolidate on using decimal (not hex), on outputting the
option reply name (not just value), and a consistent comma between
clauses, when the client reports protocol discrepancies from the
server.  While it won't affect normal operation, it makes
debugging additions easier.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181215135324.152629-6-eblake@redhat.com>

5 years agonbd: Document timeline of various features
Eric Blake [Sat, 15 Dec 2018 13:53:04 +0000 (07:53 -0600)]
nbd: Document timeline of various features

It can be useful to figure out which NBD protocol features are
exposed by a server, as well as what features a client will
take advantage of if available, for a given qemu release.  It's
not always precise to base features on version numbers (thanks
to downstream backports), but any documentation is better than
making users search through git logs themselves.

This patch originally stemmed from a request to document that
pristine 3.0 has a known bug where NBD_OPT_LIST_META_CONTEXT
with 0 queries forgot to advertise an available
"qemu:dirty-bitmap" context, but documenting bugs like this (or
the fact that 3.0 also botched NBD_CMD_CACHE) gets to be too
much details, especially since buggy releases will be less
likely connection targets over time.  Instead, I chose to just
remind users to check stable release branches.

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181215135324.152629-3-eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agoqemu-nbd: Use program name in error messages
Eric Blake [Sat, 15 Dec 2018 13:53:03 +0000 (07:53 -0600)]
qemu-nbd: Use program name in error messages

This changes output from:

$ qemu-nbd nosuch
Failed to blk_new_open 'nosuch': Could not open 'nosuch': No such file or directory

to something more consistent with qemu-img and qemu:

$ qemu-nbd nosuch
qemu-nbd: Failed to blk_new_open 'nosuch': Could not open 'nosuch': No such file or directory

Update the lone affected test to match.  (Hmm - is it sad that we don't
do much testing of expected failures?)

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181215135324.152629-2-eblake@redhat.com>

5 years agoblock/nbd-client: use traces instead of noisy error_report_err
Vladimir Sementsov-Ogievskiy [Fri, 2 Nov 2018 15:11:52 +0000 (18:11 +0300)]
block/nbd-client: use traces instead of noisy error_report_err

Reduce extra noise of nbd-client, change 083 correspondingly.

In various commits (be41c100 in 2.10, f140e300 in 2.11, 78a33ab
in 2.12), we added spots where qemu as an NBD client would report
problems communicating with the server to stderr, because there
was no where else to send the error to.  However, this is racy,
particularly since the most common source of these errors is when
either the client or the server abruptly hangs up, leaving one
coroutine to report the error only if it wins (or loses) the
race in attempting the read from the server before another
thread completes its cleanup of a protocol error that caused the
disconnect in the first place.  The race is also apparent in the
fact that differences in the flush behavior of the server can
alter the frequency of encountering the race in the client (see
commit 6d39db96).

Rather than polluting stderr, it's better to just trace these
situations, for use by developers debugging a flaky connection,
particularly since the real error that either triggers the abrupt
disconnection in the first place, or that results from the EIO
when a request can't receive a reply, DOES make it back to the
user in the normal Error propagation channels.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181102151152.288399-4-vsementsov@virtuozzo.com>
[eblake: drop depedence on error hint, enhance commit message]
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agonbd/client: Trace all server option error messages
Eric Blake [Tue, 18 Dec 2018 22:57:13 +0000 (16:57 -0600)]
nbd/client: Trace all server option error messages

Not all servers send free-form text alongside option error replies, but
for servers that do (such as qemu), we pass the server's message as a
hint alongside our own error reporting.  However, it would also be
useful to trace such server messages, since we can't guarantee how the
hint may be consumed.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181218225714.284495-3-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5 years agonbd: publish _lookup functions
Vladimir Sementsov-Ogievskiy [Fri, 2 Nov 2018 15:11:51 +0000 (18:11 +0300)]
nbd: publish _lookup functions

These functions are used for formatting pretty trace points. We are
going to add some in block/nbd-client, so, let's publish all these
functions at once. Note, that nbd_reply_type_lookup is already
published, and constants, "named" by these functions live in
include/block/nbd.h too.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20181102151152.288399-3-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/philmd/tags/fw_cfg-20190104-pull-request' into...
Peter Maydell [Fri, 4 Jan 2019 18:23:13 +0000 (18:23 +0000)]
Merge remote-tracking branch 'remotes/philmd/tags/fw_cfg-20190104-pull-request' into staging

fw_cfg patches for 2019-01-04

Two fixes from Li Qiang:
- Improve error message when can't load splash file
- Fix boot bootsplash and reboot-timeout error checking

# gpg: Signature made Fri 04 Jan 2019 16:22:24 GMT
# gpg:                using RSA key E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>"
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd/tags/fw_cfg-20190104-pull-request:
  fw_cfg: Make qemu_extra_params_fw locally
  fw_cfg: Fix -boot reboot-timeout error checking
  fw_cfg: Fix -boot bootsplash error checking
  fw_cfg: Improve error message when can't load splash file

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agofw_cfg: Make qemu_extra_params_fw locally
Li Qiang [Wed, 21 Nov 2018 05:10:26 +0000 (21:10 -0800)]
fw_cfg: Make qemu_extra_params_fw locally

qemu_extra_params_fw[] has external linkage, but is used
only in fw_cfg_bootsplash(), it makes sense to make it
locally.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1542777026-2788-4-git-send-email-liq3ea@gmail.com>
[PMD: Removed qemu_extra_params_fw declaration in vl.c]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agofw_cfg: Fix -boot reboot-timeout error checking
Li Qiang [Wed, 21 Nov 2018 05:10:25 +0000 (21:10 -0800)]
fw_cfg: Fix -boot reboot-timeout error checking

fw_cfg_reboot() gets option parameter "reboot-timeout" with
qemu_opt_get(), then converts it to an integer by hand. It neglects to
check that conversion for errors, and fails to reject negative values.
Positive values above the limit get reported and replaced by the limit.
This patch checks for conversion errors properly, and reject all values
outside 0...0xffff.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1542777026-2788-3-git-send-email-liq3ea@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agofw_cfg: Fix -boot bootsplash error checking
Li Qiang [Wed, 21 Nov 2018 05:10:24 +0000 (21:10 -0800)]
fw_cfg: Fix -boot bootsplash error checking

fw_cfg_bootsplash() gets option parameter "splash-time"
with qemu_opt_get(), then converts it to an integer by hand.
It neglects to check that conversion for errors. This is
needlessly complicated and error-prone. But as "splash-time
not specified" is not the same as "splash-time=T" for any T,
we need use qemu_opt_get() to check if splash time exists.
This patch also make the qemu exit when finding or loading
splash file failed.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1542777026-2788-2-git-send-email-liq3ea@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agofw_cfg: Improve error message when can't load splash file
Li Qiang [Thu, 1 Nov 2018 06:02:28 +0000 (23:02 -0700)]
fw_cfg: Improve error message when can't load splash file

read_splashfile() reports "failed to read splash file" without
further details. Get the details from g_file_get_contents(), and
include them in the error message. Also remove unnecessary 'res'
variable.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1541052148-28752-1-git-send-email-liq3ea@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Fri, 4 Jan 2019 13:22:51 +0000 (13:22 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

Bug fixes for the .dmg image file format.

# gpg: Signature made Fri 04 Jan 2019 11:21:18 GMT
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  dmg: don't skip zero chunk
  dmg: use enumeration type instead of hard coding number
  dmg: fix binary search
  dmg: Fixing wrong dmg block type value for block terminator.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agodmg: don't skip zero chunk
yuchenlin [Thu, 3 Jan 2019 11:47:00 +0000 (19:47 +0800)]
dmg: don't skip zero chunk

The dmg file has many tables which describe: "start from sector XXX to
sector XXX, the compression method is XXX and where the compressed data
resides on".

Each sector in the expanded file should be covered by a table. The table
will describe the offset of compressed data (or raw depends on the type)
in the dmg.

For example:

[-----------The expanded file------------]
[---bzip table ---]/* zeros */[---zlib---]
    ^
    | if we want to read this sector.

we will find bzip table which contains this sector, and get the
compressed data offset, read it from dmg, uncompress it, finally write to
expanded file.

If we skip zero chunk (table), some sector cannot find the table which
will cause search_chunk() return s->n_chunks, dmg_read_chunk() return -1
and finally causing dmg_co_preadv() return EIO.

See:

[-----------The expanded file------------]
[---bzip table ---]/* zeros */[---zlib---]
                    ^
                    | if we want to read this sector.

Oops, we cannot find the table contains it...

In the original implementation, we don't have zero table. When we try to
read sector inside the zero chunk. We will get EIO, and skip reading.

After this patch, we treat zero chunk the same as ignore chunk, it will
directly write zero and avoid some sector may not find the table.

After this patch:

[-----------The expanded file------------]
[---bzip table ---][--zeros--][---zlib---]

Signed-off-by: yuchenlin <npes87184@gmail.com>
Reviewed-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20190103114700.9686-4-npes87184@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agodmg: use enumeration type instead of hard coding number
yuchenlin [Thu, 3 Jan 2019 11:46:59 +0000 (19:46 +0800)]
dmg: use enumeration type instead of hard coding number

Signed-off-by: yuchenlin <npes87184@gmail.com>
Reviewed-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20190103114700.9686-3-npes87184@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agodmg: fix binary search
yuchenlin [Thu, 3 Jan 2019 11:46:58 +0000 (19:46 +0800)]
dmg: fix binary search

There is a possible hang in original binary search implementation. That is
if chunk1 = 4, chunk2 = 5, chunk3 = 4, and we go else case.

The chunk1 will be still 4, and so on.

Signed-off-by: yuchenlin <npes87184@gmail.com>
Message-id: 20190103114700.9686-2-npes87184@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agodmg: Fixing wrong dmg block type value for block terminator.
Julio Faracco [Fri, 28 Dec 2018 14:50:55 +0000 (12:50 -0200)]
dmg: Fixing wrong dmg block type value for block terminator.

This is a trivial patch to fix a wrong value for block terminator.
The old value was 0x7fffffff which is wrong. It was not affecting the
code because QEMU dmg block is not handling block terminator right now.
Neverthless, it should be fixed.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: yuchenlin <yuchenlin@synology.com>
Message-id: 20181228145055.18039-1-jcfaracco@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-december-2018-v3...
Peter Maydell [Fri, 4 Jan 2019 10:11:18 +0000 (10:11 +0000)]
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-december-2018-v3' into staging

MIPS queue for December 2018 - v3

# gpg: Signature made Thu 03 Jan 2019 16:53:47 GMT
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.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: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-december-2018-v3: (44 commits)
  tests/tcg: mips: Test R5900 three-operand MADDU1
  tests/tcg: mips: Test R5900 three-operand MADDU
  tests/tcg: mips: Test R5900 three-operand MADD1
  tests/tcg: mips: Test R5900 three-operand MADD
  disas: nanoMIPS: Add a note on documentation
  disas: nanoMIPS: Reorder declarations and definitions of gpr decoders
  disas: nanoMIPS: Comment the decoder of 'gpr1' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr1' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr2.reg2' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr2.reg2' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr2.reg1' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr2.reg1' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr4.zero' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr4.zero' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr4' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr4' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr3.src.store' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr3.src.store' gpr encoding type
  disas: nanoMIPS: Comment the decoder of 'gpr3' gpr encoding type
  disas: nanoMIPS: Rename the decoder of 'gpr3' gpr encoding type
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotests/tcg: mips: Test R5900 three-operand MADDU1
Fredrik Noring [Thu, 27 Dec 2018 20:25:41 +0000 (21:25 +0100)]
tests/tcg: mips: Test R5900 three-operand MADDU1

Test R5900 three-operand MADDU1.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
5 years agotests/tcg: mips: Test R5900 three-operand MADDU
Fredrik Noring [Thu, 27 Dec 2018 20:25:18 +0000 (21:25 +0100)]
tests/tcg: mips: Test R5900 three-operand MADDU

Test R5900 three-operand MADDU.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
5 years agotests/tcg: mips: Test R5900 three-operand MADD1
Fredrik Noring [Thu, 27 Dec 2018 20:24:22 +0000 (21:24 +0100)]
tests/tcg: mips: Test R5900 three-operand MADD1

Test R5900 three-operand MADD1.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
5 years agotests/tcg: mips: Test R5900 three-operand MADD
Fredrik Noring [Thu, 27 Dec 2018 20:23:52 +0000 (21:23 +0100)]
tests/tcg: mips: Test R5900 three-operand MADD

Test R5900 three-operand MADD.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
5 years agodisas: nanoMIPS: Add a note on documentation
Aleksandar Markovic [Wed, 26 Dec 2018 18:06:47 +0000 (19:06 +0100)]
disas: nanoMIPS: Add a note on documentation

Add "nanoMIPS32 Instruction Set Technical Reference Manual" as
a reference.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Reorder declarations and definitions of gpr decoders
Aleksandar Markovic [Wed, 26 Dec 2018 17:46:28 +0000 (18:46 +0100)]
disas: nanoMIPS: Reorder declarations and definitions of gpr decoders

Reorder declarations and definitions of gpr decoders by number of
input bits of corresponding encoding type.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr1' gpr encoding type
Aleksandar Markovic [Wed, 26 Dec 2018 17:41:23 +0000 (18:41 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr1' gpr encoding type

Comment the decoder of 'gpr1' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr1' gpr encoding type
Aleksandar Markovic [Wed, 26 Dec 2018 17:35:52 +0000 (18:35 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr1' gpr encoding type

Rename the decoder of 'gpr1' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr2.reg2' gpr encoding type
Aleksandar Markovic [Wed, 26 Dec 2018 13:42:13 +0000 (14:42 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr2.reg2' gpr encoding type

Comment the decoder of 'gpr2.reg2' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr2.reg2' gpr encoding type
Aleksandar Markovic [Wed, 26 Dec 2018 13:40:17 +0000 (14:40 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr2.reg2' gpr encoding type

Rename the decoder of 'gpr2.reg2' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr2.reg1' gpr encoding type
Aleksandar Markovic [Wed, 26 Dec 2018 13:38:15 +0000 (14:38 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr2.reg1' gpr encoding type

Comment the decoder of 'gpr2.reg1' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr2.reg1' gpr encoding type
Aleksandar Markovic [Wed, 26 Dec 2018 13:30:39 +0000 (14:30 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr2.reg1' gpr encoding type

Rename the decoder of 'gpr2.reg1' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr4.zero' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:55:09 +0000 (15:55 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr4.zero' gpr encoding type

Comment the decoder of 'gpr4.zero' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr4.zero' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:46:00 +0000 (15:46 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr4.zero' gpr encoding type

Rename the decoder of 'gpr4.zero' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr4' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:42:58 +0000 (15:42 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr4' gpr encoding type

Comment the decoder of 'gpr4' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr4' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:30:07 +0000 (15:30 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr4' gpr encoding type

Rename the decoder of 'gpr4' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr3.src.store' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:18:18 +0000 (15:18 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr3.src.store' gpr encoding type

Comment the decoder of 'gpr3.src.store' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr3.src.store' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:09:49 +0000 (15:09 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr3.src.store' gpr encoding type

Rename the decoder of 'gpr3.src.store' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Comment the decoder of 'gpr3' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 14:06:15 +0000 (15:06 +0100)]
disas: nanoMIPS: Comment the decoder of 'gpr3' gpr encoding type

Comment the decoder of 'gpr3' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Rename the decoder of 'gpr3' gpr encoding type
Aleksandar Markovic [Tue, 25 Dec 2018 13:19:12 +0000 (14:19 +0100)]
disas: nanoMIPS: Rename the decoder of 'gpr3' gpr encoding type

Rename the decoder of 'gpr3' gpr encoding type in nanoMIPS
disassembler.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix order of more invocations
Aleksandar Markovic [Mon, 24 Dec 2018 15:18:53 +0000 (16:18 +0100)]
disas: nanoMIPS: Fix order of more invocations

Fix order of extraction function invocations so that extraction
goes from MSB side to LSB side of the given instruction coding
content. This is desireable because of consistency and easier
visual spotting of errors.

After this patch, all such invocations should be in the desired
order.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Name more functions in a more descriptive way
Aleksandar Markovic [Mon, 24 Dec 2018 14:36:04 +0000 (15:36 +0100)]
disas: nanoMIPS: Name more functions in a more descriptive way

Rename more functions that have names that are hard to understand.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix an FP-related misnomer 3
Aleksandar Markovic [Tue, 18 Dec 2018 03:19:28 +0000 (04:19 +0100)]
disas: nanoMIPS: Fix an FP-related misnomer 3

Rename NMD::extract_ft_20_19_18_17_16(uint64 instruction) to
NMD::extract_ft_25_24_23_22_21(uint64 instruction).

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix an FP-related misnomer 2
Aleksandar Markovic [Tue, 18 Dec 2018 03:16:15 +0000 (04:16 +0100)]
disas: nanoMIPS: Fix an FP-related misnomer 2

Rename NMD::extract_fs_15_14_13_12_11(uint64 instruction) to
NMD::extract_fs_20_19_18_17_16(uint64 instruction).

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix an FP-related misnomer 1
Aleksandar Markovic [Tue, 18 Dec 2018 03:12:53 +0000 (04:12 +0100)]
disas: nanoMIPS: Fix an FP-related misnomer 1

Rename NMD::extract_fd_10_9_8_7_6(uint64 instruction) to
NMD::extract_fd_15_14_13_12_11(uint64 instruction).

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Name some functions in a more descriptive way
Aleksandar Markovic [Mon, 17 Dec 2018 14:23:35 +0000 (15:23 +0100)]
disas: nanoMIPS: Name some functions in a more descriptive way

Rename some functions that have names that are hard to understand.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix order of some invocations
Aleksandar Markovic [Mon, 17 Dec 2018 02:01:16 +0000 (03:01 +0100)]
disas: nanoMIPS: Fix order of some invocations

Fix order of extraction function invocations so that extraction
goes from MSB side to LSB side of the given instruction coding
content. This is desireable because of consistency and easier
visual spotting of errors.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix a function misnomer
Aleksandar Markovic [Mon, 17 Dec 2018 00:44:04 +0000 (01:44 +0100)]
disas: nanoMIPS: Fix a function misnomer

Fix wrong function name. The convention in these files is that names of
extraction functions should reflect bit patterns they are extracting.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Remove functions that are not used
Aleksandar Markovic [Mon, 17 Dec 2018 00:38:33 +0000 (01:38 +0100)]
disas: nanoMIPS: Remove functions that are not used

Some functions were not used at all. Compiler doesn't complain
since they are class memebers. Remove them - no future usage is
planned.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix preamble text in nanomips.* files
Aleksandar Markovic [Mon, 17 Dec 2018 00:28:44 +0000 (01:28 +0100)]
disas: nanoMIPS: Fix preamble text in nanomips.* files

Fix several mistakes in preambles of nanomips disassembler source
files.

Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agodisas: nanoMIPS: Fix types and format strings
Stefan Weil [Thu, 27 Dec 2018 16:56:04 +0000 (17:56 +0100)]
disas: nanoMIPS: Fix types and format strings

Use POSIX types and format strings.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5 years agotarget/mips: Support R5900 three-operand MADD1 and MADDU1 instructions
Fredrik Noring [Thu, 27 Dec 2018 19:29:14 +0000 (20:29 +0100)]
target/mips: Support R5900 three-operand MADD1 and MADDU1 instructions

The three-operand MADD and MADDU are specific to R5900 cores.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
5 years agotarget/mips: Support R5900 three-operand MADD and MADDU instructions
Philippe Mathieu-Daudé [Thu, 27 Dec 2018 18:00:44 +0000 (19:00 +0100)]
target/mips: Support R5900 three-operand MADD and MADDU instructions

The three-operand MADD and MADDU are specific to Sony R5900 core,
and Toshiba TX19/TX39/TX79 cores as well.

The "32-Bit TX System RISC TX39 Family Architecture manual"
is available at https://wiki.qemu.org/File:DSAE0022432.pdf

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Tested-by: Fredrik Noring <noring@nocrew.org>
5 years agotarget/mips: MXU: Add handler for an align instruction
Aleksandar Markovic [Mon, 31 Dec 2018 12:14:56 +0000 (13:14 +0100)]
target/mips: MXU: Add handler for an align instruction

Add translation handler for S32ALNI MXU instruction.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agotarget/mips: MXU: Add handlers for max/min instructions
Aleksandar Markovic [Mon, 31 Dec 2018 12:14:34 +0000 (13:14 +0100)]
target/mips: MXU: Add handlers for max/min instructions

Add translation handlers for six max/min MXU instructions.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agotarget/mips: MXU: Add handlers for logic instructions
Aleksandar Markovic [Mon, 31 Dec 2018 12:14:13 +0000 (13:14 +0100)]
target/mips: MXU: Add handlers for logic instructions

Add translation handlers for four logic MXU instructions.

It should be noted that there is an error in MXU documentation (dated
June 2017) regarding opcodes for this group of instructions. This was
confirmed by running tests on hardware, and also by looking up other
related public source trees (binutils, Android NDK). In initial MXU
patches to QEMU, opcodes for MXU logic instructions were created to
be in accordance with the MXU documentation, therefore the error from
was propagated. This patch corrects that, changing the involved code.
Besides that, as MXU was designed and implemented only for 32-bit
CPUs, corresponding preprosessor conditions were added around MXU
code, which allows more flexible implementation of MXU handlers.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agotarget/mips: MXU: Improve the comment containing MXU overview
Aleksandar Markovic [Thu, 27 Dec 2018 16:25:00 +0000 (17:25 +0100)]
target/mips: MXU: Improve the comment containing MXU overview

Improve textual description of MXU extension. These are mostly
comment formatting changes.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agotarget/mips: MXU: Add generic naming for optn2 constants
Aleksandar Markovic [Thu, 27 Dec 2018 16:20:38 +0000 (17:20 +0100)]
target/mips: MXU: Add generic naming for optn2 constants

Add generic naming involving generig suffixes OPTN0, OPTN1, OPTN2,
OPTN3 for four optn2 constants. Existing suffixes WW, LW, HW, XW
are not quite appropriate for some instructions using optn2.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agotarget/mips: MXU: Add missing opcodes/decoding for LX* instructions
Aleksandar Markovic [Thu, 27 Dec 2018 16:17:35 +0000 (17:17 +0100)]
target/mips: MXU: Add missing opcodes/decoding for LX* instructions

Add missing opcodes and decoding engine for LXB, LXH, LXW, LXBU,
and LXHU instructions. They were for some reason forgotten in
previous commits. The MXU opcode list and decoding engine should
be now complete.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agoatomics: Set ATOMIC_REG_SIZE=8 for MIPS n32
Paul Burton [Thu, 27 Dec 2018 15:32:11 +0000 (16:32 +0100)]
atomics: Set ATOMIC_REG_SIZE=8 for MIPS n32

ATOMIC_REG_SIZE is currently defined as the default sizeof(void *) for
all MIPS host builds, including those using the n32 ABI. n32 is the
MIPS64 ILP32 ABI and as such tcg/mips/tcg-target.h defines
TCG_TARGET_REG_BITS as 64 for n32 builds. If we attempt to build QEMU
for an n32 host with support for a 64b target architecture then
TCG_OVERSIZED_GUEST is 0 and accel/tcg/cputlb.c attempts to use
atomic_* functions. This fails because ATOMIC_REG_SIZE is 4, causing
the calls to QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE) in the
various atomic_* functions to generate errors.

Fix this by defining ATOMIC_REG_SIZE as 8 for all MIPS64 builds, which
will cover both n32 (ILP32) & n64 (LP64) ABIs in much the same was as
we already do for x86_64/x32.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Paul Burton <pburton@wavecomp.com>
5 years agoMAINTAINERS: Add Aleksandar Rikalo as a reviewer for MIPS content
Aleksandar Markovic [Wed, 26 Dec 2018 16:46:56 +0000 (17:46 +0100)]
MAINTAINERS: Add Aleksandar Rikalo as a reviewer for MIPS content

Add Aleksandar Rikalo as a reviewer for MIPS content. Aleksandar
brings to us more than six years of experience in working on a variety
of development tools for MIPS architectures, and will greatly help
QEMU community understand and support intricacies of MIPS better.

Acked-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agoMAINTAINERS: target/mips: Reorder items alphabetically
Aleksandar Markovic [Mon, 17 Dec 2018 16:50:09 +0000 (17:50 +0100)]
MAINTAINERS: target/mips: Reorder items alphabetically

Reorder items alphabetically for better visibility.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agoMAINTAINERS: target/mips: Add filter for mips in email subjects
Aleksandar Markovic [Mon, 17 Dec 2018 16:43:11 +0000 (17:43 +0100)]
MAINTAINERS: target/mips: Add filter for mips in email subjects

Add ability to redirect mails (sent to qemu-devel) containing
"mips" in the subject line to MIPS maintainers and reviewers.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agoMAINTAINERS: target/mips: Add MIPS files under default-configs directory
Aleksandar Markovic [Mon, 17 Dec 2018 16:30:51 +0000 (17:30 +0100)]
MAINTAINERS: target/mips: Add MIPS files under default-configs directory

Add following files as maintained within the main MIPS target
section in MAINTAINERS:

default-configs/mips64el-linux-user.mak
default-configs/mips64-linux-user.mak
default-configs/mipsn32el-linux-user.mak
default-configs/mipsn32-linux-user.mak
default-configs/mipsel-linux-user.mak
default-configs/mips-linux-user.mak
default-configs/mips64el-softmmu.mak
default-configs/mips64-softmmu.mak
default-configs/mipsel-softmmu.mak
default-configs/mips-softmmu.mak
default-configs/mips-softmmu-common.mak

Future nanoMIPS user mode will also have its .mak file, and
because of that "*mips*" was used instead of "mips*" as a
shorthand in the new item in MAINTAINERS.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
5 years agoMerge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part1' into...
Peter Maydell [Thu, 3 Jan 2019 13:26:30 +0000 (13:26 +0000)]
Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-3.2-part1' into staging

RISC-V Changes for 3.2, Part 1

This pull request contains the first set of RISC-V patches I'd like to
target for the 3.2 development cycle.  It's really just a collection of
bug fixes with one major new feature: PCIe can now be attached to RISC-V
guests.

This has passed my usual test of booting the latest Linux RC into a
Fedora disk image on the virt machine.

# gpg: Signature made Fri 21 Dec 2018 16:01:29 GMT
# gpg:                using RSA key EF4CA1502CCBAB41
# gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>"
# gpg:                 aka "Palmer Dabbelt <palmer@sifive.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: 00CE 76D1 8349 60DF CE88  6DF8 EF4C A150 2CCB AB41

* remotes/palmer/tags/riscv-for-master-3.2-part1:
  MAINTAINERS: Mark RISC-V as Supported
  riscv/cpu: use device_class_set_parent_realize
  target/riscv/pmp.c: Fix pmp_decode_napot()
  sifive_uart: Implement interrupt pending register
  RISC-V: Enable second UART on sifive_e and sifive_u
  RISC-V: Fix PLIC pending bitfield reads
  RISC-V: Fix CLINT timecmp low 32-bit writes
  RISC-V: Add hartid and \n to interrupt logging
  sifive_u: Set 'clock-frequency' DT property for SiFive UART
  sifive_u: Add clock DT node for GEM ethernet
  riscv: Enable VGA and PCIE_VGA
  hw/riscv/virt: Connect the gpex PCIe
  hw/riscv/virt: Adjust memory layout spacing
  hw/riscv/virt: Increase the number of interrupts

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20181226' into staging
Peter Maydell [Thu, 3 Jan 2019 10:42:21 +0000 (10:42 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20181226' into staging

Host support for riscv64.
Dead code elimination pass.
Register allocation improvements.

# gpg: Signature made Tue 25 Dec 2018 20:52:34 GMT
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20181226: (42 commits)
  tcg: Improve call argument loading
  tcg: Record register preferences during liveness
  tcg: Add TCG_OPF_BB_EXIT
  tcg: Split out more subroutines from liveness_pass_1
  tcg: Rename and adjust liveness_pass_1 helpers
  tcg: Reindent parts of liveness_pass_1
  tcg: Dump register preference info with liveness
  tcg: Improve register allocation for matching constraints
  tcg: Add output_pref to TCGOp
  tcg: Add preferred_reg argument to tcg_reg_alloc_do_movi
  tcg: Add preferred_reg argument to temp_sync
  tcg: Add preferred_reg argument to temp_load
  tcg: Add preferred_reg argument to tcg_reg_alloc
  tcg: Add reachable_code_pass
  tcg: Reference count labels
  tcg: Add TCG_CALL_NO_RETURN
  tcg: Renumber TCG_CALL_* flags
  linux-user: Add safe_syscall for riscv64 host
  disas/microblaze: Remove unused REG_SP macro
  configure: Add support for building RISC-V host
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotcg: Improve call argument loading
Richard Henderson [Tue, 11 Dec 2018 16:25:02 +0000 (10:25 -0600)]
tcg: Improve call argument loading

Free the argument register only after we have verified that the
temporary is not already in that register.  This case is likely
now that we are back propagating the preferred register.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotcg: Record register preferences during liveness
Richard Henderson [Tue, 27 Nov 2018 20:45:26 +0000 (12:45 -0800)]
tcg: Record register preferences during liveness

With these preferences, we can arrange for function call arguments to
be computed into the proper registers instead of requiring extra moves.

Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotcg: Add TCG_OPF_BB_EXIT
Richard Henderson [Tue, 27 Nov 2018 21:45:08 +0000 (13:45 -0800)]
tcg: Add TCG_OPF_BB_EXIT

Use this to notice the opcodes that exit the TB, which implies
that local temps are really dead and need not be synced.

Previously we so marked the true end of the TB, but that was
immediately overwritten by the la_bb_end invoked by any
TCG_OPF_BB_END opcode, like exit_tb.

Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotcg: Split out more subroutines from liveness_pass_1
Richard Henderson [Tue, 27 Nov 2018 22:00:35 +0000 (14:00 -0800)]
tcg: Split out more subroutines from liveness_pass_1

Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agotcg: Rename and adjust liveness_pass_1 helpers
Richard Henderson [Tue, 27 Nov 2018 21:37:24 +0000 (13:37 -0800)]
tcg: Rename and adjust liveness_pass_1 helpers

No need for a "tcg_" prefix for a static function; we already
have another "la_" prefix for indicating liveness analysis.
Pass in nb_globals and nb_temps, as we will already have them
in registers for other loops within the parent function.

Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>