OSDN Git Service

qmiga/qemu.git
2 years agotcg/loongarch64: Implement tcg_target_init
WANG Xuerui [Tue, 21 Dec 2021 05:41:00 +0000 (13:41 +0800)]
tcg/loongarch64: Implement tcg_target_init

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-27-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement exit_tb/goto_tb
WANG Xuerui [Tue, 21 Dec 2021 05:40:59 +0000 (13:40 +0800)]
tcg/loongarch64: Implement exit_tb/goto_tb

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-26-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement tcg_target_qemu_prologue
WANG Xuerui [Tue, 21 Dec 2021 05:40:58 +0000 (13:40 +0800)]
tcg/loongarch64: Implement tcg_target_qemu_prologue

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-25-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Add softmmu load/store helpers, implement qemu_ld/qemu_st ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:57 +0000 (13:40 +0800)]
tcg/loongarch64: Add softmmu load/store helpers, implement qemu_ld/qemu_st ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-24-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement simple load/store ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:56 +0000 (13:40 +0800)]
tcg/loongarch64: Implement simple load/store ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-23-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement tcg_out_call
WANG Xuerui [Tue, 21 Dec 2021 05:40:55 +0000 (13:40 +0800)]
tcg/loongarch64: Implement tcg_out_call

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-22-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement setcond ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:54 +0000 (13:40 +0800)]
tcg/loongarch64: Implement setcond ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-21-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement br/brcond ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:53 +0000 (13:40 +0800)]
tcg/loongarch64: Implement br/brcond ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-20-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement mul/mulsh/muluh/div/divu/rem/remu ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:52 +0000 (13:40 +0800)]
tcg/loongarch64: Implement mul/mulsh/muluh/div/divu/rem/remu ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-19-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement add/sub ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:51 +0000 (13:40 +0800)]
tcg/loongarch64: Implement add/sub ops

The neg_i{32,64} ops is fully expressible with sub, so omitted for
simplicity.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-18-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement shl/shr/sar/rotl/rotr ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:50 +0000 (13:40 +0800)]
tcg/loongarch64: Implement shl/shr/sar/rotl/rotr ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-17-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement clz/ctz ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:49 +0000 (13:40 +0800)]
tcg/loongarch64: Implement clz/ctz ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-16-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement bswap{16,32,64} ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:48 +0000 (13:40 +0800)]
tcg/loongarch64: Implement bswap{16,32,64} ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-15-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement deposit/extract ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:47 +0000 (13:40 +0800)]
tcg/loongarch64: Implement deposit/extract ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-14-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement not/and/or/xor/nor/andc/orc ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:46 +0000 (13:40 +0800)]
tcg/loongarch64: Implement not/and/or/xor/nor/andc/orc ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-13-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement sign-/zero-extension ops
WANG Xuerui [Tue, 21 Dec 2021 05:40:45 +0000 (13:40 +0800)]
tcg/loongarch64: Implement sign-/zero-extension ops

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-12-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement goto_ptr
WANG Xuerui [Tue, 21 Dec 2021 05:40:44 +0000 (13:40 +0800)]
tcg/loongarch64: Implement goto_ptr

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-11-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement tcg_out_mov and tcg_out_movi
WANG Xuerui [Tue, 21 Dec 2021 05:40:43 +0000 (13:40 +0800)]
tcg/loongarch64: Implement tcg_out_mov and tcg_out_movi

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-10-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement the memory barrier op
WANG Xuerui [Tue, 21 Dec 2021 05:40:42 +0000 (13:40 +0800)]
tcg/loongarch64: Implement the memory barrier op

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-9-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Implement necessary relocation operations
WANG Xuerui [Tue, 21 Dec 2021 05:40:41 +0000 (13:40 +0800)]
tcg/loongarch64: Implement necessary relocation operations

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-8-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Define the operand constraints
WANG Xuerui [Tue, 21 Dec 2021 05:40:40 +0000 (13:40 +0800)]
tcg/loongarch64: Define the operand constraints

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-7-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Add register names, allocation order and input/output sets
WANG Xuerui [Tue, 21 Dec 2021 05:40:39 +0000 (13:40 +0800)]
tcg/loongarch64: Add register names, allocation order and input/output sets

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-6-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Add generated instruction opcodes and encoding helpers
WANG Xuerui [Tue, 21 Dec 2021 05:40:38 +0000 (13:40 +0800)]
tcg/loongarch64: Add generated instruction opcodes and encoding helpers

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211221054105.178795-5-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotcg/loongarch64: Add the tcg-target.h file
WANG Xuerui [Tue, 21 Dec 2021 05:40:37 +0000 (13:40 +0800)]
tcg/loongarch64: Add the tcg-target.h file

Support for all optional TCG ops are initially marked disabled; the bits
are to be set in individual commits later.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-4-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMAINTAINERS: Add tcg/loongarch64 entry with myself as maintainer
WANG Xuerui [Tue, 21 Dec 2021 05:40:36 +0000 (13:40 +0800)]
MAINTAINERS: Add tcg/loongarch64 entry with myself as maintainer

I ported the initial code, so I should maintain it of course.

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-3-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoelf: Add machine type value for LoongArch
WANG Xuerui [Tue, 21 Dec 2021 05:40:35 +0000 (13:40 +0800)]
elf: Add machine type value for LoongArch

This is already officially allocated as recorded in GNU binutils
repo [1], and the description is updated in [2]. Add to enable further
work.

[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4cf2ad720078a9f490dd5b5bc8893a926479196e
[2]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=01a8c731aacbdbed0eb5682d13cc074dc7e25fb3

Signed-off-by: WANG Xuerui <git@xen0n.name>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211221054105.178795-2-git@xen0n.name>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'dbus-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
Richard Henderson [Tue, 21 Dec 2021 16:00:26 +0000 (08:00 -0800)]
Merge tag 'dbus-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging

Add D-Bus display backend

# gpg: Signature made Mon 20 Dec 2021 10:57:18 PM PST
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [unknown]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [unknown]
# 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: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'dbus-pull-request' of https://gitlab.com/marcandre.lureau/qemu: (36 commits)
  MAINTAINERS: update D-Bus section
  ui/dbus: register D-Bus VC handler
  ui/dbus: add chardev backend & interface
  option: add g_auto for QemuOpts
  chardev: make socket derivable
  chardev: teach socket to accept no addresses
  ui/dbus: add clipboard interface
  audio: add "dbus" audio backend
  tests: start dbus-display-test
  tests/qtests: add qtest_qmp_add_client()
  ui/dbus: add p2p=on/off option
  ui: add a D-Bus display backend
  build-sys: set glib dependency version
  docs: add dbus-display documentation
  docs: move D-Bus VMState documentation to source XML
  backends: move dbus-vmstate1.xml to backends/
  docs/sphinx: add sphinx modules to include D-Bus documentation
  scripts: teach modinfo to skip non-C sources
  console: save current scanout details
  ui: move qemu_spice_fill_device_address to ui/util.c
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMAINTAINERS: update D-Bus section
Marc-André Lureau [Sat, 9 Oct 2021 20:30:30 +0000 (00:30 +0400)]
MAINTAINERS: update D-Bus section

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/dbus: register D-Bus VC handler
Marc-André Lureau [Wed, 29 Sep 2021 16:32:28 +0000 (20:32 +0400)]
ui/dbus: register D-Bus VC handler

Export the default consoles over the D-Bus chardev.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/dbus: add chardev backend & interface
Marc-André Lureau [Thu, 22 Jul 2021 15:43:29 +0000 (19:43 +0400)]
ui/dbus: add chardev backend & interface

Add a new chardev backend which allows D-Bus client to handle the
chardev stream & events.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agooption: add g_auto for QemuOpts
Marc-André Lureau [Mon, 26 Jul 2021 06:32:37 +0000 (10:32 +0400)]
option: add g_auto for QemuOpts

Used in the next commit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agochardev: make socket derivable
Marc-André Lureau [Sun, 25 Jul 2021 20:03:01 +0000 (00:03 +0400)]
chardev: make socket derivable

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2 years agochardev: teach socket to accept no addresses
Marc-André Lureau [Sun, 25 Jul 2021 19:59:12 +0000 (23:59 +0400)]
chardev: teach socket to accept no addresses

The following patches are going to use CharSocket as a base class for
sockets that are created with a given fd (without a given address).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/dbus: add clipboard interface
Marc-André Lureau [Tue, 20 Jul 2021 12:02:52 +0000 (16:02 +0400)]
ui/dbus: add clipboard interface

Expose the clipboard API over D-Bus. See the interface documentation for
further details.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoaudio: add "dbus" audio backend
Marc-André Lureau [Tue, 9 Mar 2021 13:15:28 +0000 (17:15 +0400)]
audio: add "dbus" audio backend

Add a new -audio backend that accepts D-Bus clients/listeners to handle
playback & recording, to be exported via the -display dbus.

Example usage:
-audiodev dbus,in.mixing-engine=off,out.mixing-engine=off,id=dbus
-display dbus,audiodev=dbus

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agotests: start dbus-display-test
Marc-André Lureau [Wed, 6 Oct 2021 21:08:15 +0000 (01:08 +0400)]
tests: start dbus-display-test

Cover basic display interface usage. More cases to be added to cover
disconnections, multiple connections, corner cases. At this point, they
would be better written in Rust or Python though.

The proxy also covers reading the properties, since they are
automatically loaded at creation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agotests/qtests: add qtest_qmp_add_client()
Marc-André Lureau [Wed, 6 Oct 2021 21:07:30 +0000 (01:07 +0400)]
tests/qtests: add qtest_qmp_add_client()

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/dbus: add p2p=on/off option
Marc-André Lureau [Sat, 9 Oct 2021 20:16:57 +0000 (00:16 +0400)]
ui/dbus: add p2p=on/off option

Add an option to use direct connections instead of via the bus. Clients
are accepted with QMP add_client.

This allows to provide the D-Bus display without a bus. It also
simplifies the testing setup (some CI have issues to setup a D-Bus bus
in a container).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: add a D-Bus display backend
Marc-André Lureau [Thu, 15 Jul 2021 07:53:53 +0000 (11:53 +0400)]
ui: add a D-Bus display backend

The "dbus" display backend exports the QEMU consoles and other
UI-related interfaces over D-Bus.

By default, the connection is established on the session bus, but you
can specify a different bus with the "addr" option.

The backend takes the "org.qemu" service name, while still allowing
further instances to queue on the same name (so you can lookup all the
available instances too). It accepts any number of clients at this
point, although this is expected to evolve with options to restrict
clients, or only accept p2p via fd passing.

The interface is intentionally very close to the internal QEMU API,
and can be introspected or interacted with busctl/dfeet etc:

$ ./qemu-system-x86_64 -name MyVM -display dbus
$ busctl --user introspect org.qemu /org/qemu/Display1/Console_0

org.qemu.Display1.Console           interface -         -               -
.RegisterListener                   method    h         -               -
.SetUIInfo                          method    qqiiuu    -               -
.DeviceAddress                      property  s         "pci/0000/01.0" emits-change
.Head                               property  u         0               emits-change
.Height                             property  u         480             emits-change
.Label                              property  s         "VGA"           emits-change
.Type                               property  s         "Graphic"       emits-change
.Width                              property  u         640             emits-change
[...]

See the interfaces XML source file and Sphinx docs for the generated API
documentations.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agobuild-sys: set glib dependency version
Marc-André Lureau [Sat, 9 Oct 2021 13:37:40 +0000 (17:37 +0400)]
build-sys: set glib dependency version

Further meson configuration tests are to be added based on the glib
version. Also correct the version reporting in the config log.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2 years agodocs: add dbus-display documentation
Marc-André Lureau [Tue, 5 Oct 2021 21:41:01 +0000 (01:41 +0400)]
docs: add dbus-display documentation

Wire up the dbus-display documentation. The interface and feature is
implemented next.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agodocs: move D-Bus VMState documentation to source XML
Marc-André Lureau [Tue, 5 Oct 2021 21:35:29 +0000 (01:35 +0400)]
docs: move D-Bus VMState documentation to source XML

Use the source XML document as single reference, importing its
documentation via the dbus-doc directive.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agobackends: move dbus-vmstate1.xml to backends/
Marc-André Lureau [Tue, 5 Oct 2021 21:18:42 +0000 (01:18 +0400)]
backends: move dbus-vmstate1.xml to backends/

Although not used by the backend itself, use a common location for
documentation and sharing purposes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agodocs/sphinx: add sphinx modules to include D-Bus documentation
Marc-André Lureau [Tue, 5 Oct 2021 21:00:35 +0000 (01:00 +0400)]
docs/sphinx: add sphinx modules to include D-Bus documentation

Add a new dbus-doc directive to import D-Bus interfaces documentation
from the introspection XML. The comments annotations follow the
gtkdoc/kerneldoc style, and should be formatted with reST.

Note: I realize after the fact that I was implementing those modules
with sphinx 4, and that we have much lower requirements. Instead of
lowering the features and code (removing type annotations etc), let's
have a warning in the documentation when the D-Bus modules can't be
used, and point to the source XML file in that case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoscripts: teach modinfo to skip non-C sources
Marc-André Lureau [Thu, 15 Jul 2021 07:54:13 +0000 (11:54 +0400)]
scripts: teach modinfo to skip non-C sources

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoconsole: save current scanout details
Marc-André Lureau [Sat, 20 Feb 2021 12:23:03 +0000 (16:23 +0400)]
console: save current scanout details

Add a new DisplayScanout structure to save the current scanout details.
This allows to attach later UI backends and set the scanout.

Introduce displaychangelistener_display_console() helper function to
handle the dpy_gfx_switch/gl_scanout() & dpy_gfx_update() calls.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: move qemu_spice_fill_device_address to ui/util.c
Marc-André Lureau [Mon, 15 Feb 2021 11:10:36 +0000 (15:10 +0400)]
ui: move qemu_spice_fill_device_address to ui/util.c

Other backends can use it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: split the GL context in a different object
Marc-André Lureau [Sat, 9 Oct 2021 19:48:46 +0000 (23:48 +0400)]
ui: split the GL context in a different object

This will allow to have one GL context but a variable number of
listeners.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: dispatch GL events to all listeners
Marc-André Lureau [Mon, 25 Jan 2021 20:00:30 +0000 (00:00 +0400)]
ui: dispatch GL events to all listeners

For now, only one listener can receive GL events. Let's dispatch to all
listeners. (preliminary check ensure there is a single listener now
during regitration, and in next patches, compatible listeners only)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: simplify gl unblock & flush
Marc-André Lureau [Thu, 11 Mar 2021 08:11:37 +0000 (12:11 +0400)]
ui: simplify gl unblock & flush

GraphicHw.gl_flushed was introduced to notify the
device (vhost-user-gpu) that the GL resources (the display scanout) are
no longer needed.

It was decoupled from QEMU own gl-blocking mechanism, but that
difference isn't helping. Instead, we can reuse QEMU gl-blocking and
notify virtio_gpu_gl_flushed() when unblocking (to unlock
vhost-user-gpu).

An extra block/unblock is added arount dpy_gl_update() so existing
backends that don't block will have the flush event handled. It will
also help when there are no backends associated.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: add a gl-unblock warning timer
Marc-André Lureau [Thu, 11 Mar 2021 07:56:58 +0000 (11:56 +0400)]
ui: add a gl-unblock warning timer

Similar to the one that exists for Spice, so we can investigate if
something is locked.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: make gl_block use a counter
Marc-André Lureau [Thu, 11 Mar 2021 07:45:33 +0000 (11:45 +0400)]
ui: make gl_block use a counter

Track multiple callers blocking requests.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: associate GL context outside of display listener registration
Marc-André Lureau [Mon, 25 Jan 2021 11:10:36 +0000 (15:10 +0400)]
ui: associate GL context outside of display listener registration

Consoles can have an associated GL context, without listeners (they may
be added or removed later on).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: factor out qemu_console_set_display_gl_ctx()
Marc-André Lureau [Mon, 25 Jan 2021 10:53:18 +0000 (14:53 +0400)]
ui: factor out qemu_console_set_display_gl_ctx()

The next patch will make use of this function to dissociate
DisplayChangeListener from GL context.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2 years agoui: do not delay further remote resize
Marc-André Lureau [Tue, 13 Apr 2021 16:39:11 +0000 (20:39 +0400)]
ui: do not delay further remote resize

A remote client, such as Spice, will already avoid flooding the stream
by delaying the resize requests.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agovirtio-gpu: use VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP
Marc-André Lureau [Tue, 4 May 2021 08:07:46 +0000 (12:07 +0400)]
virtio-gpu: use VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP

It's part of Linux headers for a while now.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2 years agohw/display: report an error if virgl initialization failed
Marc-André Lureau [Thu, 1 Jul 2021 07:08:54 +0000 (11:08 +0400)]
hw/display: report an error if virgl initialization failed

Currently, virgl initialization error is silent. Make it verbose instead.

(this is likely going to bug later on, as the device isn't fully
initialized)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2 years agoui/clipboard: add a clipboard reset serial event
Marc-André Lureau [Mon, 19 Jul 2021 15:49:56 +0000 (19:49 +0400)]
ui/clipboard: add a clipboard reset serial event

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/clipboard: add qemu_clipboard_check_serial()
Marc-André Lureau [Wed, 21 Jul 2021 11:19:13 +0000 (15:19 +0400)]
ui/clipboard: add qemu_clipboard_check_serial()

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/vdagent: add serial capability support
Marc-André Lureau [Sun, 18 Jul 2021 20:33:31 +0000 (00:33 +0400)]
ui/vdagent: add serial capability support

The Spice agent implements a simple serial mechanism to avoid clipboard
races between client & guest. See:
https://gitlab.freedesktop.org/spice/spice-protocol/-/commit/045a6978d6dbbf7046affc5c321fa8177c8cce56

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui: generalize clipboard notifier
Marc-André Lureau [Mon, 19 Jul 2021 15:42:15 +0000 (19:42 +0400)]
ui: generalize clipboard notifier

Use a QemuClipboardNotify union type for extendable clipboard events.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/vdagent: replace #if 0 with protocol version check
Marc-André Lureau [Wed, 6 Oct 2021 10:25:44 +0000 (14:25 +0400)]
ui/vdagent: replace #if 0 with protocol version check

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION
Marc-André Lureau [Wed, 6 Oct 2021 10:18:09 +0000 (14:18 +0400)]
ui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoMerge tag 'pull-user-20211220' of https://gitlab.com/rth7680/qemu into staging
Richard Henderson [Mon, 20 Dec 2021 21:20:07 +0000 (13:20 -0800)]
Merge tag 'pull-user-20211220' of https://gitlab.com/rth7680/qemu into staging

Move errno processing from safe_syscall() to safe_syscall_base().
Move safe_syscall() from linux-user to common-user.
Add FreeBSD support to safe_syscall_base().
Tidy top-level meson.build wrt {bsd,linux}-user.

# gpg: Signature made Mon 20 Dec 2021 11:46:11 AM PST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [unknown]
# 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: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-user-20211220' of https://gitlab.com/rth7680/qemu:
  meson: Move bsd_user_ss to bsd-user/
  meson: Move linux_user_ss to linux-user/
  linux-user: Move thunk.c from top-level
  common-user: Adjust system call return on FreeBSD
  common-user: Move safe-syscall.* from linux-user
  bsd-user: Create special-errno.h
  linux-user: Create special-errno.h
  linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN
  bsd-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS
  linux-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS
  linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h
  linux-user/host/sparc64: Add safe-syscall.inc.S
  linux-user/host/mips: Add safe-syscall.inc.S
  linux-user: Move syscall error detection into safe_syscall_base
  linux-user: Untabify all safe-syscall.inc.S

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-riscv-to-apply-20211220-1' of github.com:alistair23/qemu into staging
Richard Henderson [Mon, 20 Dec 2021 18:25:40 +0000 (10:25 -0800)]
Merge tag 'pull-riscv-to-apply-20211220-1' of github.com:alistair23/qemu into staging

First RISC-V PR for QEMU 7.0

 - Add support for ratified 1.0 Vector extension
 - Drop support for draft 0.7.1 Vector extension
 - Support Zfhmin and Zfh extensions
 - Improve kernel loading for non-Linux platforms

# gpg: Signature made Sun 19 Dec 2021 08:56:08 PM PST
# gpg:                using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [unknown]
# 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: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054

* tag 'pull-riscv-to-apply-20211220-1' of github.com:alistair23/qemu: (88 commits)
  hw/riscv: Use load address rather than entry point for fw_dynamic next_addr
  target/riscv: Enable bitmanip Zb[abcs] instructions
  riscv: Set 5.4 as minimum kernel version for riscv32
  target/riscv: rvv-1.0: Add ELEN checks for widening and narrowing instructions
  target/riscv: rvv-1.0: update opivv_vadc_check() comment
  target/riscv: rvv-1.0: rename vmandnot.mm and vmornot.mm to vmandn.mm and vmorn.mm
  target/riscv: rvv-1.0: add vector unit-stride mask load/store insns
  target/riscv: rvv-1.0: add evl parameter to vext_ldst_us()
  target/riscv: rvv-1.0: add vsetivli instruction
  target/riscv: rvv-1.0: rename r2_zimm to r2_zimm11
  target/riscv: rvv-1.0: floating-point reciprocal estimate instruction
  target/riscv: rvv-1.0: floating-point reciprocal square-root estimate instruction
  target/riscv: gdb: support vector registers for rv64 & rv32
  target/riscv: rvv-1.0: trigger illegal instruction exception if frm is not valid
  target/riscv: rvv-1.0: implement vstart CSR
  target/riscv: rvv-1.0: relax RV_VLEN_MAX to 1024-bits
  target/riscv: rvv-1.0: narrowing floating-point/integer type-convert
  target/riscv: add "set round to odd" rounding mode helper function
  target/riscv: rvv-1.0: widening floating-point/integer type-convert
  target/riscv: rvv-1.0: floating-point/integer type-convert instructions
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agomeson: Move bsd_user_ss to bsd-user/
Richard Henderson [Wed, 17 Nov 2021 15:35:01 +0000 (16:35 +0100)]
meson: Move bsd_user_ss to bsd-user/

We have no need to reference bsd_user_ss outside of bsd-user.
Go ahead and merge it directly into specific_ss.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agomeson: Move linux_user_ss to linux-user/
Richard Henderson [Wed, 17 Nov 2021 15:32:06 +0000 (16:32 +0100)]
meson: Move linux_user_ss to linux-user/

We have no need to reference linux_user_ss outside of linux-user.
Go ahead and merge it directly into specific_ss.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agolinux-user: Move thunk.c from top-level
Richard Henderson [Wed, 17 Nov 2021 15:26:14 +0000 (16:26 +0100)]
linux-user: Move thunk.c from top-level

So far, linux-user is the only user of these functions.
Clean up the build machinery by restricting it to linux-user.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agocommon-user: Adjust system call return on FreeBSD
Richard Henderson [Tue, 23 Nov 2021 14:18:49 +0000 (15:18 +0100)]
common-user: Adjust system call return on FreeBSD

FreeBSD system calls return positive errno.  On the 4 hosts for
which we have support, error is indicated by the C bit set or clear.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agocommon-user: Move safe-syscall.* from linux-user
Richard Henderson [Wed, 17 Nov 2021 15:14:00 +0000 (16:14 +0100)]
common-user: Move safe-syscall.* from linux-user

Move linux-user safe-syscall.S and safe-syscall-error.c to common-user
so that bsd-user can also use it.  Also move safe-syscall.h to
include/user/.  Since there is nothing here that is related to the guest,
as opposed to the host, build it once.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agohw/riscv: Use load address rather than entry point for fw_dynamic next_addr
Jessica Clarke [Tue, 14 Dec 2021 03:24:56 +0000 (03:24 +0000)]
hw/riscv: Use load address rather than entry point for fw_dynamic next_addr

The original BBL boot method had the kernel embedded as an opaque blob
that was blindly jumped to, which OpenSBI implemented as fw_payload.
OpenSBI then implemented fw_jump, which allows the payload to be loaded
elsewhere, but still blindly jumps to a fixed address at which the
kernel is to be loaded. Finally, OpenSBI introduced fw_dynamic, which
allows the previous stage to inform it where to jump to, rather than
having to blindly guess like fw_jump, or embed the payload as part of
the build like fw_payload. When used with an opaque binary (i.e. the
output of objcopy -O binary), it matches the behaviour of the previous
methods. However, when used with an ELF, QEMU currently passes on the
ELF's entry point address, which causes a discrepancy compared with all
the other boot methods if that entry point is not the first instruction
in the binary.

This difference specific to fw_dynamic with an ELF is not apparent when
booting Linux, since its entry point is the first instruction in the
binary. However, FreeBSD has a separate ELF entry point, following the
calling convention used by its bootloader, that differs from the first
instruction in the binary, used for the legacy SBI entry point, and so
the specific combination of QEMU's default fw_dynamic firmware with
booting FreeBSD as an ELF rather than a raw binary does not work.

Thus, align the behaviour when loading an ELF with the behaviour when
loading a raw binary; namely, use the base address of the loaded kernel
in place of the entry point.

The uImage code is left as-is in using the U-Boot header's entry point,
since the calling convention for that entry point is the same as the SBI
one and it mirrors what U-Boot will do.

Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211214032456.70203-1-jrtc27@jrtc27.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: Enable bitmanip Zb[abcs] instructions
Vineet Gupta [Thu, 16 Dec 2021 05:18:44 +0000 (21:18 -0800)]
target/riscv: Enable bitmanip Zb[abcs] instructions

The bitmanip extension has now been ratified [1] and upstream tooling
(gcc/binutils) support it too, so move them out of experimental and also
enable by default (for better test exposure/coverage)

[1] https://wiki.riscv.org/display/TECH/Recently+Ratified+Extensions

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211216051844.3921088-1-vineetg@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agoriscv: Set 5.4 as minimum kernel version for riscv32
Khem Raj [Thu, 16 Dec 2021 07:31:11 +0000 (23:31 -0800)]
riscv: Set 5.4 as minimum kernel version for riscv32

5.4 is first stable API as far as rv32 is concerned see [1]

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=7a55dd3fb6d2c307a002a16776be84310b9c8989

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alistair Francis <alistair.francis@wdc.com>
Cc: Bin Meng <bin.meng@windriver.com>
Message-Id: <20211216073111.2890607-1-raj.khem@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: Add ELEN checks for widening and narrowing instructions
Frank Chang [Fri, 10 Dec 2021 07:57:03 +0000 (15:57 +0800)]
target/riscv: rvv-1.0: Add ELEN checks for widening and narrowing instructions

SEW has the limitation which cannot exceed ELEN.

Widening instructions have a destination group with EEW = 2*SEW
and narrowing instructions have a source operand with EEW = 2*SEW.
Both of the instructions have the limitation of: 2*SEW <= ELEN.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-78-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: update opivv_vadc_check() comment
Frank Chang [Fri, 10 Dec 2021 07:57:02 +0000 (15:57 +0800)]
target/riscv: rvv-1.0: update opivv_vadc_check() comment

Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions is
moved to Section 11.4 in RVV v1.0 spec. Update the comment, no
functional changes.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-77-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: rename vmandnot.mm and vmornot.mm to vmandn.mm and vmorn.mm
Frank Chang [Fri, 10 Dec 2021 07:57:01 +0000 (15:57 +0800)]
target/riscv: rvv-1.0: rename vmandnot.mm and vmornot.mm to vmandn.mm and vmorn.mm

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-76-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: add vector unit-stride mask load/store insns
Frank Chang [Fri, 10 Dec 2021 07:57:00 +0000 (15:57 +0800)]
target/riscv: rvv-1.0: add vector unit-stride mask load/store insns

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-75-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: add evl parameter to vext_ldst_us()
Frank Chang [Fri, 10 Dec 2021 07:56:59 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: add evl parameter to vext_ldst_us()

Add supports of Vector unit-stride mask load/store instructions
(vlm.v, vsm.v), which has:
    evl (effective vector length) = ceil(env->vl / 8).

The new instructions operate the same as unmasked byte loads and stores.
Add evl parameter to reuse vext_ldst_us().

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-74-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: add vsetivli instruction
Frank Chang [Fri, 10 Dec 2021 07:56:58 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: add vsetivli instruction

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-73-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: rename r2_zimm to r2_zimm11
Frank Chang [Fri, 10 Dec 2021 07:56:57 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: rename r2_zimm to r2_zimm11

Rename r2_zimm to r2_zimm11 for the upcoming vsetivli instruction.
vsetivli has 10-bits of zimm but vsetvli has 11-bits of zimm.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-72-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: floating-point reciprocal estimate instruction
Frank Chang [Fri, 10 Dec 2021 07:56:56 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: floating-point reciprocal estimate instruction

Implement the floating-point reciprocal estimate to 7 bits instruction.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-71-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: floating-point reciprocal square-root estimate instruction
Frank Chang [Fri, 10 Dec 2021 07:56:55 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: floating-point reciprocal square-root estimate instruction

Implement the floating-point reciprocal square-root estimate to 7 bits
instruction.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-70-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: gdb: support vector registers for rv64 & rv32
Hsiangkai Wang [Fri, 10 Dec 2021 07:56:54 +0000 (15:56 +0800)]
target/riscv: gdb: support vector registers for rv64 & rv32

Signed-off-by: Hsiangkai Wang <kai.wang@sifive.com>
Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-69-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: trigger illegal instruction exception if frm is not valid
Frank Chang [Fri, 10 Dec 2021 07:56:53 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: trigger illegal instruction exception if frm is not valid

If the frm field contains an invalid rounding mode (101-111),
attempting to execute any vector floating-point instruction, even
those that do not depend on the rounding mode, will raise an illegal
instruction exception.

Call gen_set_rm() with DYN rounding mode to check and trigger illegal
instruction exception if frm field contains invalid value at run-time
for vector floating-point instructions.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-68-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: implement vstart CSR
Frank Chang [Fri, 10 Dec 2021 07:56:52 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: implement vstart CSR

* Update and check vstart value for vector instructions.
* Add whole register move instruction helper functions as we have to
  call helper function for case where vstart is not zero.
* Remove probe_pages() calls in vector load/store instructions
  (except fault-only-first loads) to raise the memory access exception
  at the exact processed vector element.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-67-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: relax RV_VLEN_MAX to 1024-bits
Frank Chang [Fri, 10 Dec 2021 07:56:51 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: relax RV_VLEN_MAX to 1024-bits

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-66-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: narrowing floating-point/integer type-convert
Frank Chang [Fri, 10 Dec 2021 07:56:50 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: narrowing floating-point/integer type-convert

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-65-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: add "set round to odd" rounding mode helper function
Frank Chang [Fri, 10 Dec 2021 07:56:49 +0000 (15:56 +0800)]
target/riscv: add "set round to odd" rounding mode helper function

helper_set_rounding_mode() is responsible for SIGILL, and "round to odd"
should be an interface private to translation, so add a new independent
helper_set_rod_rounding_mode().

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-64-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: widening floating-point/integer type-convert
Frank Chang [Fri, 10 Dec 2021 07:56:48 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: widening floating-point/integer type-convert

Add the following instructions:

* vfwcvt.rtz.xu.f.v
* vfwcvt.rtz.x.f.v

Also adjust GEN_OPFV_WIDEN_TRANS() to accept multiple floating-point
rounding modes.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-63-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: floating-point/integer type-convert instructions
Frank Chang [Fri, 10 Dec 2021 07:56:47 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: floating-point/integer type-convert instructions

Add the following instructions:

* vfcvt.rtz.xu.f.v
* vfcvt.rtz.x.f.v

Also adjust GEN_OPFV_TRANS() to accept multiple floating-point rounding
modes.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-62-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: introduce floating-point rounding mode enum
Frank Chang [Fri, 10 Dec 2021 07:56:46 +0000 (15:56 +0800)]
target/riscv: introduce floating-point rounding mode enum

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-61-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: floating-point min/max instructions
Frank Chang [Fri, 10 Dec 2021 07:56:45 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: floating-point min/max instructions

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-60-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: remove integer extract instruction
Frank Chang [Fri, 10 Dec 2021 07:56:44 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: remove integer extract instruction

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-59-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: remove vmford.vv and vmford.vf
Frank Chang [Fri, 10 Dec 2021 07:56:43 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: remove vmford.vv and vmford.vf

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-58-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: remove widening saturating scaled multiply-add
Frank Chang [Fri, 10 Dec 2021 07:56:42 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: remove widening saturating scaled multiply-add

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-57-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: single-width scaling shift instructions
Frank Chang [Fri, 10 Dec 2021 07:56:41 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: single-width scaling shift instructions

log(SEW) truncate vssra.vi immediate value.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-56-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: widening floating-point reduction instructions
Frank Chang [Fri, 10 Dec 2021 07:56:40 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: widening floating-point reduction instructions

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-55-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: single-width floating-point reduction
Frank Chang [Fri, 10 Dec 2021 07:56:39 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: single-width floating-point reduction

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-54-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: narrowing fixed-point clip instructions
Frank Chang [Fri, 10 Dec 2021 07:56:38 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: narrowing fixed-point clip instructions

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211210075704.23951-53-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: rvv-1.0: floating-point slide instructions
Frank Chang [Fri, 10 Dec 2021 07:56:37 +0000 (15:56 +0800)]
target/riscv: rvv-1.0: floating-point slide instructions

Add the following instructions:

* vfslide1up.vf
* vfslide1down.vf

Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20211210075704.23951-52-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>