]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
3 years agogdbstub: ensure we clean-up when terminated
Alex Bennée [Fri, 8 Jan 2021 22:42:45 +0000 (22:42 +0000)]
gdbstub: ensure we clean-up when terminated

If you kill the inferior from GDB we end up leaving our socket lying
around. Fix this by calling gdb_exit() first.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210108224256.2321-10-alex.bennee@linaro.org>

3 years agogdbstub: drop gdbserver_cleanup in favour of gdb_exit
Alex Bennée [Fri, 8 Jan 2021 22:42:44 +0000 (22:42 +0000)]
gdbstub: drop gdbserver_cleanup in favour of gdb_exit

Despite it's name it didn't actually clean-up so let us document
gdb_exit() better and use that.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210108224256.2321-9-alex.bennee@linaro.org>

3 years agogdbstub: drop CPUEnv from gdb_exit()
Alex Bennée [Fri, 8 Jan 2021 22:42:43 +0000 (22:42 +0000)]
gdbstub: drop CPUEnv from gdb_exit()

gdb_exit() has never needed anything from env and I doubt we are going
to start now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210108224256.2321-8-alex.bennee@linaro.org>

3 years agogdbstub: add support to Xfer:auxv:read: packet
Lirong Yuan [Fri, 8 Jan 2021 22:42:42 +0000 (22:42 +0000)]
gdbstub: add support to Xfer:auxv:read: packet

This allows gdb to access the target’s auxiliary vector,
which can be helpful for telling system libraries important details
about the hardware, operating system, and process.

Signed-off-by: Lirong Yuan <yuanzi@google.com>
[AJB: minor tweaks to test case, update MAINTAINERS, restrict to Linux]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200730193932.3654677-1-yuanzi@google.com>
Message-Id: <20210108224256.2321-7-alex.bennee@linaro.org>

3 years agogdbstub: implement a softmmu based test
Alex Bennée [Fri, 8 Jan 2021 22:42:41 +0000 (22:42 +0000)]
gdbstub: implement a softmmu based test

This adds a new tests that allows us to test softmmu only features
including watchpoints. To do achieve this we need to:

  - add _exit: labels to the boot codes
  - write a memory.py test case
  - plumb the test case into the build system
  - tweak the run_test script to:
    - re-direct output when asked
    - use socket based connection for all tests
    - add a small pause before connection

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210108224256.2321-6-alex.bennee@linaro.org>

3 years agoRevert "tests/tcg/multiarch/Makefile.target: Disable run-gdbstub-sha1 test"
Alex Bennée [Fri, 8 Jan 2021 22:42:40 +0000 (22:42 +0000)]
Revert "tests/tcg/multiarch/Makefile.target: Disable run-gdbstub-sha1 test"

We won't attempt to run the test now it's gated on a newer version of
gdb.

This reverts commit a930cadd83b4681a98ce72abf530a791ee2e42a6.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210108224256.2321-5-alex.bennee@linaro.org>

3 years agoconfigure: gate our use of GDB to 8.3.1 or above
Alex Bennée [Fri, 8 Jan 2021 22:42:39 +0000 (22:42 +0000)]
configure: gate our use of GDB to 8.3.1 or above

The support of socket based debugging which we need for linux-user
testing is only really stable as of 8.3.1 so lets gate our use of GDB
on having a relatively modern version.

For direct testing you can just point to a locally compiled version of
gdb via configure, e.g.:

  ../../configure --gdb=$HOME/src/binutils-gdb.git/builds/all/install/bin/gdb

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210108224256.2321-4-alex.bennee@linaro.org>

3 years agotest/guest-debug: echo QEMU command as well
Alex Bennée [Fri, 8 Jan 2021 22:42:38 +0000 (22:42 +0000)]
test/guest-debug: echo QEMU command as well

This helps with debugging.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210108224256.2321-3-alex.bennee@linaro.org>

3 years agoscripts/checkpatch.pl: fix git-show invocation to include diffstat
Alex Bennée [Thu, 14 Jan 2021 16:57:30 +0000 (16:57 +0000)]
scripts/checkpatch.pl: fix git-show invocation to include diffstat

Without this checkpatch keeps complaining about new/changed files even
when MAINTAINERS has been updated. Normal invocations of checkpatch on
patch files rather than commit IDs are unaffected.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-13-alex.bennee@linaro.org>

3 years agogitlab: migrate the minimal tools and unit tests from Travis
Alex Bennée [Thu, 14 Jan 2021 16:57:29 +0000 (16:57 +0000)]
gitlab: migrate the minimal tools and unit tests from Travis

These tests are good at shaking out missing stubs which otherwise work
if we have built targets. Rather than create a new job just add the
checks to the existing tools-and-docs build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-12-alex.bennee@linaro.org>

3 years agoFix build with new yank feature by adding stubs
Lukas Straub [Thu, 14 Jan 2021 16:57:28 +0000 (16:57 +0000)]
Fix build with new yank feature by adding stubs

Fixes: 50186051f42 ("Introduce yank feature")
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
[AJB: tweak MAINTAINERS]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114141918.5201cc9c@gecko.fritz.box>
Message-Id: <20210114165730.31607-11-alex.bennee@linaro.org>

3 years agogitlab: move docs and tools build across from Travis
Alex Bennée [Thu, 14 Jan 2021 16:57:27 +0000 (16:57 +0000)]
gitlab: move docs and tools build across from Travis

While we are at it we might as well check the tag generation. For
bonus points we run GNU globals htags into the public pages directory
for publishing with the auto generated pages.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210114165730.31607-10-alex.bennee@linaro.org>

3 years agodocker: expand debian-amd64 image to include tag tools
Alex Bennée [Thu, 14 Jan 2021 16:57:26 +0000 (16:57 +0000)]
docker: expand debian-amd64 image to include tag tools

This is going to be helpful when we want to both test the tool
integration and in the case of global generate a xref doc build.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-9-alex.bennee@linaro.org>

3 years agoMakefile: wrap cscope in quiet-command calls
Alex Bennée [Thu, 14 Jan 2021 16:57:25 +0000 (16:57 +0000)]
Makefile: wrap cscope in quiet-command calls

For prettier output.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-8-alex.bennee@linaro.org>

3 years agoMakefile: wrap etags in quiet-command calls
Alex Bennée [Thu, 14 Jan 2021 16:57:24 +0000 (16:57 +0000)]
Makefile: wrap etags in quiet-command calls

For prettier output.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-7-alex.bennee@linaro.org>

3 years agoMakefile: wrap ctags in quiet-command calls
Alex Bennée [Thu, 14 Jan 2021 16:57:23 +0000 (16:57 +0000)]
Makefile: wrap ctags in quiet-command calls

For prettier output.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-6-alex.bennee@linaro.org>

3 years agoAdd newline when generating Dockerfile
Alessandro Di Federico [Thu, 14 Jan 2021 16:57:22 +0000 (16:57 +0000)]
Add newline when generating Dockerfile

Signed-off-by: Alessandro Di Federico <ale@rev.ng>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1610080146-14968-36-git-send-email-tsimpson@quicinc.com>
Message-Id: <20210114165730.31607-5-alex.bennee@linaro.org>

3 years agoshippable.yml: Remove jobs duplicated on Gitlab-CI
Philippe Mathieu-Daudé [Thu, 14 Jan 2021 16:57:21 +0000 (16:57 +0000)]
shippable.yml: Remove jobs duplicated on Gitlab-CI

The following jobs are duplicated on Gitlab-CI since commit
6bcb5fc0f7a ("gitlab-ci: Add cross-compiling build tests"):

- IMAGE=debian-armel-cross

  TARGET_LIST=arm-softmmu               -> cross-armel-system
  TARGET_LIST=arm-linux-user            -> cross-armel-user
  TARGET_LIST=armeb-linux-user          -> cross-armel-user

- IMAGE=debian-armhf-cross

  TARGET_LIST=arm-softmmu               -> cross-armhf-system
  TARGET_LIST=arm-linux-user            -> cross-armhf-user
  TARGET_LIST=armeb-linux-user          -> cross-armhf-user

- IMAGE=debian-arm64-cross

  TARGET_LIST=aarch64-softmmu           -> cross-arm64-system
  TARGET_LIST=aarch64-linux-user        -> cross-arm64-user

- IMAGE=debian-s390x-cross

  TARGET_LIST=s390x-softmmu             -> cross-s390x-system
  TARGET_LIST=s390x-linux-user          -> cross-s390x-user

- IMAGE=debian-mips-cross

  TARGET_LIST=mipsel-linux-user         -> cross-mips-user

- IMAGE=debian-mips64el-cross

  TARGET_LIST=mips64el-softmmu          -> cross-mips64el-system
  TARGET_LIST=mips64el-linux-user       -> cross-mips64el-user

- IMAGE=debian-ppc64el-cross

  TARGET_LIST=ppc64-softmmu             -> cross-ppc64el-system
  TARGET_LIST=ppc64-linux-user          -> cross-ppc64el-user
  TARGET_LIST=ppc64abi32-linux-user     -> cross-ppc64el-user

Remove them from Shippable CI.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210108145103.269353-1-f4bug@amsat.org>
Message-Id: <20210114165730.31607-4-alex.bennee@linaro.org>

3 years agoMakefile: add GNU global tags support
Alex Bennée [Thu, 14 Jan 2021 16:57:20 +0000 (16:57 +0000)]
Makefile: add GNU global tags support

GNU Global is another tags engine which is more like cscope in being
able to support finding both references and definitions. You will be
un-surprised to know it also integrates well with Emacs.

The main benefit of integrating it into find-src-path is it takes less
time to rebuild the database from scratch when you have a lot of build
directories under your source tree.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210114165730.31607-3-alex.bennee@linaro.org>

3 years agotests/docker: Remove Debian 9 remnant lines
Philippe Mathieu-Daudé [Thu, 14 Jan 2021 16:57:19 +0000 (16:57 +0000)]
tests/docker: Remove Debian 9 remnant lines

Debian 9 base container has been removed in commits
e3755276d1f and c9d78b06c06. Remove the last remnants.

Fixes: e3755276d1f ("tests/docker: Remove old Debian 9 containers")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20210107072933.3828450-1-f4bug@amsat.org>
Message-Id: <20210114165730.31607-2-alex.bennee@linaro.org>

3 years agoMerge remote-tracking branch 'remotes/kraxel/tags/audio-20210115-pull-request' into...
Peter Maydell [Fri, 15 Jan 2021 22:21:21 +0000 (22:21 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20210115-pull-request' into staging

audio: improvements for sdl, pulse, fsound.
audio: cleanups & codestyle fixes.

# gpg: Signature made Fri 15 Jan 2021 13:20:56 GMT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20210115-pull-request: (30 commits)
  audio: space prohibited between function name and parenthesis'('
  audio: Suspect code indent for conditional statements
  audio: Don't use '%#' in format strings
  audio: Fix lines over 90 characters
  audio: foo* bar" should be "foo *bar".
  audio: Add spaces around operator/delete redundant spaces
  audio: Add braces for statements/fix braces' position
  dsoundaudio: fix log message
  dsoundaudio: enable f32 audio sample format
  dsoundaudio: rename dsound_open()
  dsoundaudio: replace GetForegroundWindow()
  paaudio: send recorded data in smaller chunks
  paaudio: limit minreq to 75% of audio timer_rate
  paaudio: comment bugs in functions qpa_init_*
  paaudio: remove unneeded code
  paaudio: wait until the playback stream is ready
  paaudio: wait for PA_STREAM_READY in qpa_write()
  paaudio: avoid to clip samples multiple times
  audio: remove remaining unused plive code
  sdlaudio: enable (in|out).mixing-engine=off
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20210115-pull-request' into...
Peter Maydell [Fri, 15 Jan 2021 16:35:18 +0000 (16:35 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20210115-pull-request' into staging

ui/gtk: refresh rate fixes.
ui/vnc: add support for desktop resize and power contol.
ui/vnc: misc bugfixes.

# gpg: Signature made Fri 15 Jan 2021 10:24:10 GMT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20210115-pull-request:
  vnc: add support for extended desktop resize
  vnc: move initialization to framebuffer_update_request
  vnc: move check into vnc_cursor_define
  vnc: Fix a memleak in vnc_display_connect()
  ui: add support for remote power control to VNC server
  vnc: fix unfinalized tlscreds for VncDisplay
  ui/gtk: update monitor interval on egl displays
  ui/gtk: expose gd_monitor_update_interval
  ui/gtk: limit virtual console max update interval
  ui/gtk: rename variable window to widget
  ui/gtk: don't try to redefine SI prefixes

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/gkurz-gitlab/tags/9p-next-2021-01-15' into...
Peter Maydell [Fri, 15 Jan 2021 15:32:05 +0000 (15:32 +0000)]
Merge remote-tracking branch 'remotes/gkurz-gitlab/tags/9p-next-2021-01-15' into staging

Fix for CVE-2021-20181

# gpg: Signature made Fri 15 Jan 2021 08:52:19 GMT
# gpg:                using RSA key B4828BAF943140CEF2A3491071D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <groug@kaod.org>" [full]
# gpg:                 aka "Gregory Kurz <gregory.kurz@free.fr>" [full]
# gpg:                 aka "[jpeg image of size 3330]" [full]
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6

* remotes/gkurz-gitlab/tags/9p-next-2021-01-15:
  9pfs: Fully restart unreclaim loop (CVE-2021-20181)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-20210114' into staging
Peter Maydell [Fri, 15 Jan 2021 13:22:54 +0000 (13:22 +0000)]
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/mips-20210114' into staging

MIPS patches queue

- Simplify CPU/ISA definitions
- Various maintenance code movements in translate.c
- Convert part of the MSA ASE instructions to decodetree
- Convert some instructions removed from Release 6 to decodetree
- Remove deprecated 'fulong2e' machine alias

# gpg: Signature made Thu 14 Jan 2021 16:16:29 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd-gitlab/tags/mips-20210114: (69 commits)
  docs/system: Remove deprecated 'fulong2e' machine alias
  target/mips: Remove vendor specific CPU definitions
  target/mips: Remove CPU_NANOMIPS32 definition
  target/mips: Remove CPU_R5900 definition
  target/mips: Convert Rel6 LL/SC opcodes to decodetree
  target/mips: Convert Rel6 LLD/SCD opcodes to decodetree
  target/mips: Convert Rel6 LDL/LDR/SDL/SDR opcodes to decodetree
  target/mips: Convert Rel6 LWLE/LWRE/SWLE/SWRE opcodes to decodetree
  target/mips: Convert Rel6 LWL/LWR/SWL/SWR opcodes to decodetree
  target/mips: Convert Rel6 CACHE/PREF opcodes to decodetree
  target/mips: Convert Rel6 COP1X opcode to decodetree
  target/mips: Convert Rel6 Special2 opcode to decodetree
  target/mips: Remove now unreachable LSA/DLSA opcodes code
  target/mips: Introduce decodetree helpers for Release6 LSA/DLSA opcodes
  target/mips: Introduce decodetree helpers for MSA LSA/DLSA opcodes
  target/mips: Extract LSA/DLSA translation generators
  target/mips: Use decode_ase_msa() generated from decodetree
  target/mips: Introduce decode tree bindings for MSA ASE
  target/mips: Pass TCGCond argument to MSA gen_check_zero_element()
  target/mips: Extract MSA translation routines
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoaudio: space prohibited between function name and parenthesis'('
Zhang Han [Fri, 15 Jan 2021 01:24:31 +0000 (09:24 +0800)]
audio: space prohibited between function name and parenthesis'('

Delete spaces between function name and open parenthesis'('

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-8-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: Suspect code indent for conditional statements
Zhang Han [Fri, 15 Jan 2021 01:24:30 +0000 (09:24 +0800)]
audio: Suspect code indent for conditional statements

Fix code indent.

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-7-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: Don't use '%#' in format strings
Zhang Han [Fri, 15 Jan 2021 01:24:29 +0000 (09:24 +0800)]
audio: Don't use '%#' in format strings

Use '0x' prefix instead of '%#'

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-6-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: Fix lines over 90 characters
Zhang Han [Fri, 15 Jan 2021 01:24:28 +0000 (09:24 +0800)]
audio: Fix lines over 90 characters

Fix the line width of code.

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-5-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: foo* bar" should be "foo *bar".
Zhang Han [Fri, 15 Jan 2021 01:24:27 +0000 (09:24 +0800)]
audio: foo* bar" should be "foo *bar".

transfer "foo* " to "foo *"

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-4-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: Add spaces around operator/delete redundant spaces
Zhang Han [Fri, 15 Jan 2021 01:24:26 +0000 (09:24 +0800)]
audio: Add spaces around operator/delete redundant spaces

Fix problems about spaces:
-operator needs spaces around it, add them.
-somespaces are redundant, remove them.

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-3-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: Add braces for statements/fix braces' position
Zhang Han [Fri, 15 Jan 2021 01:24:25 +0000 (09:24 +0800)]
audio: Add braces for statements/fix braces' position

Fix problems about braces:
-braces are necessary for all arms of if/for/while statements
-else should follow close brace '}'

Signed-off-by: Zhang Han <zhanghan64@huawei.com>
Message-id: 20210115012431.79533-1-zhanghan64@huawei.com
Message-Id: <20210115012431.79533-2-zhanghan64@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodsoundaudio: fix log message
Volker Rümelin [Sun, 10 Jan 2021 10:02:39 +0000 (11:02 +0100)]
dsoundaudio: fix log message

There is a mismatch between message and used argument. Change
the argument from frequency to format.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-23-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodsoundaudio: enable f32 audio sample format
Volker Rümelin [Sun, 10 Jan 2021 10:02:38 +0000 (11:02 +0100)]
dsoundaudio: enable f32 audio sample format

Enable the f32 audio sample format for the DirectSound backend.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-22-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodsoundaudio: rename dsound_open()
Volker Rümelin [Sun, 10 Jan 2021 10:02:37 +0000 (11:02 +0100)]
dsoundaudio: rename dsound_open()

Rename dsound_open() to dsound_set_cooperative_level(). The
only task of that function is to set the cooperative level for
DirectSound.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-21-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agodsoundaudio: replace GetForegroundWindow()
Volker Rümelin [Sun, 10 Jan 2021 10:02:36 +0000 (11:02 +0100)]
dsoundaudio: replace GetForegroundWindow()

GetForegroundWindow() doesn't necessarily return the own window
handle. It just returns a handle to the currently active window
and can even return NULL. At the time dsound_open() gets called
the active window is most likely the shell window and not the
QEMU window.

Replace GetForegroundWindow() with GetDesktopWindow() which
always returns a valid window handle, and at the same time
replace the DirectSound buffer flag DSBCAPS_STICKYFOCUS with
DSBCAPS_GLOBALFOCUS where Windows only expects a valid window
handle for DirectSound function SetCooperativeLevel(). The
Microsoft online docs for IDirectSound::SetCooperativeLevel
recommend this in the remarks.

This fixes a bug where you can't hear sound from the guest.

To reproduce start qemu with -machine pcspk-audiodev=audio0
-device intel-hda -device hda-duplex,audiodev=audio0
-audiodev dsound,id=audio0,out.mixing-engine=off
from a shell and start audio playback with the hda device in the
guest. The guest will be silent. To hear guest audio you have to
activate the shell window once.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-20-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: send recorded data in smaller chunks
Volker Rümelin [Sun, 10 Jan 2021 10:02:35 +0000 (11:02 +0100)]
paaudio: send recorded data in smaller chunks

Tell PulseAudio to send recorded audio data in smaller chunks
than timer_period, so there's a good chance that qemu can read
recorded audio data every time it looks for new data.

PulseAudio tries to send buffer updates at a fragsize / 2 rate.
With fragsize = timer_period / 2 * 3 the update rate is 75% of
timer_period. The lower limit for the recording buffer size
maxlength is fragsize * 2.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-19-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: limit minreq to 75% of audio timer_rate
Volker Rümelin [Sun, 10 Jan 2021 10:02:34 +0000 (11:02 +0100)]
paaudio: limit minreq to 75% of audio timer_rate

Currently with the playback buffer attribute minreq = -1 and flag
PA_STREAM_EARLY_REQUESTS PulseAudio uses minreq = tlength / 4.
To improve audio playback with larger PulseAudio server side
buffers, limit minreq to a maximum of 75% of audio timer_rate.
That way there is a good chance qemu receives a stream buffer
size update before it tries to write data to the playback stream.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-18-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: comment bugs in functions qpa_init_*
Volker Rümelin [Sun, 10 Jan 2021 10:02:33 +0000 (11:02 +0100)]
paaudio: comment bugs in functions qpa_init_*

The audio buffer size in audio/paaudio.c is typically larger
than expected. Just comment the bugs in qpa_init_in() and
qpa_init_out() for now. Fixing these bugs may break glitch free
audio playback with fine tuned user audio settings.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-17-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: remove unneeded code
Volker Rümelin [Sun, 10 Jan 2021 10:02:32 +0000 (11:02 +0100)]
paaudio: remove unneeded code

Commit baea032ec7 "audio/paaudio: fix ignored buffer_length setting"
added code to handle buffer_length defaults. This was unnecessary
because the audio_buffer_* functions in audio/audio.c already handle
this. Remove the unneeded code.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-16-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: wait until the playback stream is ready
Volker Rümelin [Sun, 10 Jan 2021 10:02:31 +0000 (11:02 +0100)]
paaudio: wait until the playback stream is ready

Don't call pa_stream_writable_size() in qpa_get_buffer_out()
before the playback stream is ready. This prevents a lot of the
following pulseaudio error messages.

pulseaudio: pa_stream_writable_size failed
pulseaudio: Reason: Bad state

To reproduce start qemu with
-parallel none -device gus,audiodev=audio0 -audiodev pa,id=audio0

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-15-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: wait for PA_STREAM_READY in qpa_write()
Volker Rümelin [Sun, 10 Jan 2021 10:02:30 +0000 (11:02 +0100)]
paaudio: wait for PA_STREAM_READY in qpa_write()

Don't call pa_stream_writable_size() in qpa_write() before the
playback stream is ready. This prevents a lot of the following
pulseaudio error messages.

pulseaudio: pa_stream_writable_size failed
pulseaudio: Reason: Bad state

To reproduce start qemu with
-parallel none -device gus,audiodev=audio0
-audiodev pa,id=audio0,out.mixing-engine=off

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-14-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agopaaudio: avoid to clip samples multiple times
Volker Rümelin [Sun, 10 Jan 2021 10:02:29 +0000 (11:02 +0100)]
paaudio: avoid to clip samples multiple times

The pulseaudio backend currently converts, clips and copies audio
playback samples in the mixing-engine sample buffer multiple
times.

In qpa_get_buffer_out() the function pa_stream_begin_write()
returns a rather large buffer and this allows audio_pcm_hw_run_out()
in audio/audio.c to copy all samples in the mixing-engine buffer
to the pulse audio buffer. Immediately after copying, qpa_write()
notices with a call to pa_stream_writable_size() that pulse audio
only needs a smaller part of the copied samples and ignores the
rest. This copy and ignore process happens several times for each
audio sample.

To fix this behaviour, call pa_stream_writable_size() in
qpa_get_buffer_out() to limit the number of samples
audio_pcm_hw_run_out() will convert. With this change the
pulseaudio pcm_ops functions put_buffer_out and write are no
longer identical and a separate qpa_put_buffer_out is needed.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-13-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: remove remaining unused plive code
Volker Rümelin [Sun, 10 Jan 2021 10:02:28 +0000 (11:02 +0100)]
audio: remove remaining unused plive code

Commit 73ad33ef7b "audio: remove plive" forgot to remove this code.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-12-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: enable (in|out).mixing-engine=off
Volker Rümelin [Sun, 10 Jan 2021 10:02:27 +0000 (11:02 +0100)]
sdlaudio: enable (in|out).mixing-engine=off

Enable the SDL2 backend options -audiodev sdl,out.mixing-
engine=off,in.mixing-engine=off.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-11-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: break generic buffer dependency on mixing-engine
Volker Rümelin [Sun, 10 Jan 2021 10:02:26 +0000 (11:02 +0100)]
audio: break generic buffer dependency on mixing-engine

Break the unnecessary dependency of the generic buffer management
code on mixing-engine. This is required for the next patch.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-10-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: add recording functions
Volker Rümelin [Sun, 10 Jan 2021 10:02:25 +0000 (11:02 +0100)]
sdlaudio: add recording functions

Add audio recording functions. SDL 2.0.5 or later is required to
use the recording functions. Playback continues to work with
earlier SDL 2.0 versions.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-9-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: split pcm_ops function get_buffer_in
Volker Rümelin [Sun, 10 Jan 2021 10:02:24 +0000 (11:02 +0100)]
audio: split pcm_ops function get_buffer_in

Split off pcm_ops function run_buffer_in from get_buffer_in and
call run_buffer_in before get_buffer_in.

The next patch only needs the generic buffer management part
from audio_generic_get_buffer_in().

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-8-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: replace legacy functions with modern ones
Volker Rümelin [Sun, 10 Jan 2021 10:02:23 +0000 (11:02 +0100)]
sdlaudio: replace legacy functions with modern ones

With the modern audio functions it's possible to add new
features like audio recording.

As a side effect this patch fixes a bug where SDL2 can't be used
on Windows. This bug was reported on the qemu-devel mailing list at

https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg04043.html

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-7-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: fill remaining sample buffer with silence
Volker Rümelin [Sun, 10 Jan 2021 10:02:22 +0000 (11:02 +0100)]
sdlaudio: fill remaining sample buffer with silence

Fill the remaining sample buffer with silence. To fill it with
zeroes is wrong for unsigned samples because this is silence
with a DC bias.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-6-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: always clear the sample buffer
Volker Rümelin [Sun, 10 Jan 2021 10:02:21 +0000 (11:02 +0100)]
sdlaudio: always clear the sample buffer

Always fill the remaining audio callback buffer with silence.
SDL 2.0 doesn't initialize the audio callback buffer. This was
an incompatible change compared to SDL 1.2. For reference read
the SDL 1.2 to 2.0 migration guide.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-5-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: don't start playback in init routine
Volker Rümelin [Sun, 10 Jan 2021 10:02:20 +0000 (11:02 +0100)]
sdlaudio: don't start playback in init routine

Every emulated audio device has a way to enable audio playback. Don't
start playback until the guest enables the audio device. This patch
keeps the SDL2 device pause state in sync with hw->enabled.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-4-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: add -audiodev sdl,out.buffer-count option
Volker Rümelin [Sun, 10 Jan 2021 10:02:19 +0000 (11:02 +0100)]
sdlaudio: add -audiodev sdl,out.buffer-count option

Currently there is a crackling noise with SDL2 audio playback.
Commit bcf19777df: "audio/sdlaudio: Allow audio playback with
SDL2" already mentioned the crackling noise.

Add an out.buffer-count option to give users a chance to select
sane settings for glitch free audio playback. The idea was taken
from the coreaudio backend.

The in.buffer-count option will be used with one of the next
patches.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-3-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoaudio: fix bit-rotted code
Volker Rümelin [Sun, 10 Jan 2021 10:02:18 +0000 (11:02 +0100)]
audio: fix bit-rotted code

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-2-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agosdlaudio: remove leftover SDL1.2 code
Volker Rümelin [Sun, 10 Jan 2021 10:02:17 +0000 (11:02 +0100)]
sdlaudio: remove leftover SDL1.2 code

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 9315afe5-5958-c0b4-ea1e-14769511a9d5@t-online.de
Message-Id: <20210110100239.27588-1-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agovnc: add support for extended desktop resize
Gerd Hoffmann [Tue, 12 Jan 2021 13:41:20 +0000 (14:41 +0100)]
vnc: add support for extended desktop resize

The extended desktop resize encoding adds support for (a) clients
sending resize requests to the server, and (b) multihead support.

This patch implements (a).  All resize requests are rejected by qemu.
Qemu can't resize the framebuffer on its own, this is in the hands of
the guest, so all qemu can do is forward the request to the guest.
Should the guest actually resize the framebuffer we can notify the vnc
client later with a separate message.

This requires support in the display device.  Works with virtio-gpu.

https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#extendeddesktopsize-pseudo-encoding

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20210112134120.2031837-4-kraxel@redhat.com

3 years agovnc: move initialization to framebuffer_update_request
Gerd Hoffmann [Tue, 12 Jan 2021 13:41:19 +0000 (14:41 +0100)]
vnc: move initialization to framebuffer_update_request

qemu sends various state info like current cursor shape to newly connected
clients in response to a set_encoding message.  This is not correct according
to the rfb spec.  Send that information in response to a full (incremental=0)
framebuffer update request instead.  Also send the resize information
unconditionally, not only in case of an actual server-side change.

This makes the qemu vnc server conform to the spec and allows clients to
request the complete vnc server state without reconnect.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20210112134120.2031837-3-kraxel@redhat.com

3 years agovnc: move check into vnc_cursor_define
Gerd Hoffmann [Tue, 12 Jan 2021 13:41:18 +0000 (14:41 +0100)]
vnc: move check into vnc_cursor_define

Move the check whenever a cursor exists into the vnc_cursor_define()
function so callers don't have to do it.

Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20210112134120.2031837-2-kraxel@redhat.com

3 years agovnc: Fix a memleak in vnc_display_connect()
Alex Chen [Thu, 26 Nov 2020 06:57:02 +0000 (06:57 +0000)]
vnc: Fix a memleak in vnc_display_connect()

Free the 'sioc' when the qio_channel_socket_connect_sync() fails.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20201126065702.35095-1-alex.chen@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoui: add support for remote power control to VNC server
Daniel P. Berrangé [Fri, 11 Dec 2020 16:08:25 +0000 (16:08 +0000)]
ui: add support for remote power control to VNC server

The "XVP" (Xen VNC Proxy) extension defines a mechanism for a VNC client
to issue power control requests to trigger graceful shutdown, reboot, or
hard reset.

This option is not enabled by default, since we cannot assume that users
with VNC access implicitly have administrator access to the guest OS.

Thus is it enabled with a boolean "power-control" option e.g.

   -vnc :1,power-control=on

While, QEMU can easily support shutdown and reset, there's no easy way
to wire up reboot support at this time. In theory it could be done by
issuing a shutdown, followed by a reset, but there's no convenient
wiring for such a pairing in QEMU. It also isn't possible to have the
VNC server directly talk to QEMU guest agent, since the agent chardev is
typically owned by an external mgmt app.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
[ kraxel: rebase to master  ]
[ kraxel: add missing break ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agovnc: fix unfinalized tlscreds for VncDisplay
Zihao Chang [Mon, 11 Jan 2021 13:19:11 +0000 (21:19 +0800)]
vnc: fix unfinalized tlscreds for VncDisplay

In vnc_display_open(), if tls-creds is enabled, do object_ref(object
ref 1->2) for tls-creds. While in vnc_display_close(), object_unparent
sets object ref to 1(2->1) and  unparent the object for root.
Problem:
1. the object can not be found from the objects_root, while the object
is not finalized.
2. the qemu_opts of tls-creds(id: creds0) is not deleted, so new tls
object with the same id(creds0) can not be delete & add.

Signed-off-by: Zihao Chang <changzihao1@huawei.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210111131911.805-1-changzihao1@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoui/gtk: update monitor interval on egl displays
Nikola Pavlica [Thu, 14 Jan 2021 14:01:53 +0000 (15:01 +0100)]
ui/gtk: update monitor interval on egl displays

When running QEMU's GTK UI without EGL or OGL, the
gd_monitor_update_interval function gets executed and the display refresh
rate gets updated accordingly. However, when using EGL or just regular
OGL, the function never gets executed.

Which is why I decided that the function should be in gd_egl_refresh
where the display output gets updated, in the same vain as how it's done
for normal GTK UIs (aka. those without EGL) - in it's display refresh
function.

Since the gd_monitor_update_interval function now is exposed, we are
going to use it to update the refresh rate.

Signed-off-by: Nikola Pavlica <pavlica.nikola@gmail.com>
Message-Id: <20210114140153.301473-3-pavlica.nikola@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoui/gtk: expose gd_monitor_update_interval
Nikola Pavlica [Thu, 14 Jan 2021 14:01:52 +0000 (15:01 +0100)]
ui/gtk: expose gd_monitor_update_interval

The gd_egl_refresh function, as the name suggests, is responsible for
refreshing displays when using EGL graphics with QEMU's GTK UI. This is
a perfect candidate for a function to update the refresh rate in.

Since gd_monitor_update_interval is inaccessible from the gd_egl_refresh
function, we need to expose/globalize it in the include/ui/gtk.h file.

Signed-off-by: Nikola Pavlica <pavlica.nikola@gmail.com>
Message-Id: <20210114140153.301473-2-pavlica.nikola@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoui/gtk: limit virtual console max update interval
Volker Rümelin [Sun, 13 Dec 2020 16:57:24 +0000 (17:57 +0100)]
ui/gtk: limit virtual console max update interval

Limit the virtual console maximum update interval to
GUI_REFRESH_INTERVAL_DEFAULT. This papers over a integer
overflow bug in gtk3 on Windows where the reported monitor
refresh frequency can be much smaller than the real refresh
frequency.

The gtk bug report can be found here:
https://gitlab.gnome.org/GNOME/gtk/-/issues/3394

On my Windows 10 system gtk reports a monitor refresh rate of
1.511Hz instead of 60.031Hz and slows down the screen update
rate in qemu to a crawl. Provided you are affected by the gtk
bug on Windows, these are the steps to reproduce the issue:

Start qemu with -display gtk and activate all qemu virtual
consoles and notice the reduced qemu refresh rate. Activating
all virtual consoles is necessary, because gui_update() in
ui/console.c uses the minimum of all display change listeners
update interval and not yet activated virtual consoles report
the default update interval (30ms).

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20201213165724.13418-3-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoui/gtk: rename variable window to widget
Volker Rümelin [Sun, 13 Dec 2020 16:57:23 +0000 (17:57 +0100)]
ui/gtk: rename variable window to widget

The type of the variable window is GtkWidget. Rename the variable
from window to widget, because windows and widgets are different
things.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20201213165724.13418-2-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agoui/gtk: don't try to redefine SI prefixes
Volker Rümelin [Sun, 13 Dec 2020 16:57:22 +0000 (17:57 +0100)]
ui/gtk: don't try to redefine SI prefixes

Redefining SI prefixes is always wrong. 1s has per definition
1000ms. Remove the misnamed named constant and replace it with
a comment explaining the frequency to period conversion in two
simple steps. Now you can cancel out the unit mHz in the comment
with the implicit unit mHz in refresh_rate_millihz and see why
the implicit unit ms for update_interval remains.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20201213165724.13418-1-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years ago9pfs: Fully restart unreclaim loop (CVE-2021-20181)
Greg Kurz [Thu, 14 Jan 2021 16:04:12 +0000 (17:04 +0100)]
9pfs: Fully restart unreclaim loop (CVE-2021-20181)

Depending on the client activity, the server can be asked to open a huge
number of file descriptors and eventually hit RLIMIT_NOFILE. This is
currently mitigated using a reclaim logic : the server closes the file
descriptors of idle fids, based on the assumption that it will be able
to re-open them later. This assumption doesn't hold of course if the
client requests the file to be unlinked. In this case, we loop on the
entire fid list and mark all related fids as unreclaimable (the reclaim
logic will just ignore them) and, of course, we open or re-open their
file descriptors if needed since we're about to unlink the file.

This is the purpose of v9fs_mark_fids_unreclaim(). Since the actual
opening of a file can cause the coroutine to yield, another client
request could possibly add a new fid that we may want to mark as
non-reclaimable as well. The loop is thus restarted if the re-open
request was actually transmitted to the backend. This is achieved
by keeping a reference on the first fid (head) before traversing
the list.

This is wrong in several ways:
- a potential clunk request from the client could tear the first
  fid down and cause the reference to be stale. This leads to a
  use-after-free error that can be detected with ASAN, using a
  custom 9p client
- fids are added at the head of the list : restarting from the
  previous head will always miss fids added by a some other
  potential request

All these problems could be avoided if fids were being added at the
end of the list. This can be achieved with a QSIMPLEQ, but this is
probably too much change for a bug fix. For now let's keep it
simple and just restart the loop from the current head.

Fixes: CVE-2021-20181
Buglink: https://bugs.launchpad.net/qemu/+bug/1911666
Reported-by: Zero Day Initiative <zdi-disclosures@trendmicro.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Message-Id: <161064025265.1838153.15185571283519390907.stgit@bahia.lan>
Signed-off-by: Greg Kurz <groug@kaod.org>
3 years agodocs/system: Remove deprecated 'fulong2e' machine alias
Philippe Mathieu-Daudé [Wed, 6 Jan 2021 18:38:00 +0000 (19:38 +0100)]
docs/system: Remove deprecated 'fulong2e' machine alias

The 'fulong2e' machine alias has been marked as deprecated since
QEMU v5.1 (commit c3a09ff68dd, the machine is renamed 'fuloong2e').
Time to remove it now.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Message-Id: <20210106184602.3771551-1-f4bug@amsat.org>

3 years agotarget/mips: Remove vendor specific CPU definitions
Philippe Mathieu-Daudé [Sun, 10 Jan 2021 21:46:43 +0000 (22:46 +0100)]
target/mips: Remove vendor specific CPU definitions

Vendor specific CPU definitions are not very useful. Use the
ISA definitions instead, which are more helpful when looking
at the various CPU definitions.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210112210152.2072996-4-f4bug@amsat.org>

3 years agotarget/mips: Remove CPU_NANOMIPS32 definition
Philippe Mathieu-Daudé [Sun, 10 Jan 2021 21:44:59 +0000 (22:44 +0100)]
target/mips: Remove CPU_NANOMIPS32 definition

nanoMIPS not a CPU, but an ISA. The nanoMIPS ISA is already
defined as ISA_NANOMIPS32.
Remove this incorrect definition and update the single CPU
implementing it, the I7200.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210112210152.2072996-3-f4bug@amsat.org>

3 years agotarget/mips: Remove CPU_R5900 definition
Philippe Mathieu-Daudé [Sun, 10 Jan 2021 21:41:22 +0000 (22:41 +0100)]
target/mips: Remove CPU_R5900 definition

Commit 823f2897bdd ("target/mips: Disable R5900 support")
removed the single CPU using the CPU_R5900 definition.
As it is unused, remove it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210112210152.2072996-2-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 LL/SC opcodes to decodetree
Philippe Mathieu-Daudé [Thu, 26 Nov 2020 10:59:21 +0000 (11:59 +0100)]
target/mips: Convert Rel6 LL/SC opcodes to decodetree

LL/SC opcodes have been removed from the Release 6.

Add a single decodetree entry for the opcodes, triggering
Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() calls.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-14-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 LLD/SCD opcodes to decodetree
Philippe Mathieu-Daudé [Thu, 26 Nov 2020 10:56:39 +0000 (11:56 +0100)]
target/mips: Convert Rel6 LLD/SCD opcodes to decodetree

LLD/SCD opcodes have been removed from the Release 6.

Add a single decodetree entry for the opcodes, triggering
Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() calls.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-13-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 LDL/LDR/SDL/SDR opcodes to decodetree
Philippe Mathieu-Daudé [Thu, 26 Nov 2020 10:56:15 +0000 (11:56 +0100)]
target/mips: Convert Rel6 LDL/LDR/SDL/SDR opcodes to decodetree

LDL/LDR/SDL/SDR opcodes have been removed from the Release 6.

Add a single decodetree entry for the opcodes, triggering
Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() calls.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-12-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 LWLE/LWRE/SWLE/SWRE opcodes to decodetree
Philippe Mathieu-Daudé [Thu, 26 Nov 2020 10:54:30 +0000 (11:54 +0100)]
target/mips: Convert Rel6 LWLE/LWRE/SWLE/SWRE opcodes to decodetree

LWLE/LWRE/SWLE/SWRE (EVA) opcodes have been removed from
the Release 6. Add a single decodetree entry for the opcodes,
triggering Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() calls.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-11-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 LWL/LWR/SWL/SWR opcodes to decodetree
Philippe Mathieu-Daudé [Thu, 26 Nov 2020 10:54:56 +0000 (11:54 +0100)]
target/mips: Convert Rel6 LWL/LWR/SWL/SWR opcodes to decodetree

LWL/LWR/SWL/SWR opcodes have been removed from the Release 6.

Add a single decodetree entry for the opcodes, triggering
Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() calls.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-10-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 CACHE/PREF opcodes to decodetree
Philippe Mathieu-Daudé [Thu, 26 Nov 2020 10:55:46 +0000 (11:55 +0100)]
target/mips: Convert Rel6 CACHE/PREF opcodes to decodetree

CACHE/PREF opcodes have been removed from the Release 6.

Add a single decodetree entry for the opcodes, triggering
Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() calls.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-9-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 COP1X opcode to decodetree
Philippe Mathieu-Daudé [Tue, 24 Nov 2020 10:53:46 +0000 (11:53 +0100)]
target/mips: Convert Rel6 COP1X opcode to decodetree

COP1x opcode has been removed from the Release 6.

Add a single decodetree entry for it, triggering
Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() call.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-8-f4bug@amsat.org>

3 years agotarget/mips: Convert Rel6 Special2 opcode to decodetree
Philippe Mathieu-Daudé [Tue, 24 Nov 2020 14:17:25 +0000 (15:17 +0100)]
target/mips: Convert Rel6 Special2 opcode to decodetree

Special2 opcode have been removed from the Release 6.

Add a single decodetree entry for all the opcode class,
triggering Reserved Instruction if ever used.

Remove unreachable check_insn_opc_removed() call.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-7-f4bug@amsat.org>

3 years agotarget/mips: Remove now unreachable LSA/DLSA opcodes code
Philippe Mathieu-Daudé [Tue, 8 Dec 2020 18:01:01 +0000 (19:01 +0100)]
target/mips: Remove now unreachable LSA/DLSA opcodes code

Since we switched to decodetree-generated processing,
we can remove this now unreachable code.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201208203704.243704-6-f4bug@amsat.org>

3 years agotarget/mips: Introduce decodetree helpers for Release6 LSA/DLSA opcodes
Philippe Mathieu-Daudé [Tue, 8 Dec 2020 18:00:44 +0000 (19:00 +0100)]
target/mips: Introduce decodetree helpers for Release6 LSA/DLSA opcodes

LSA and LDSA opcodes are also available with MIPS release 6.
Introduce the decodetree config files and call the decode()
helpers in the main decode_opc() loop.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-24-f4bug@amsat.org>

3 years agotarget/mips: Introduce decodetree helpers for MSA LSA/DLSA opcodes
Philippe Mathieu-Daudé [Tue, 8 Dec 2020 17:59:36 +0000 (18:59 +0100)]
target/mips: Introduce decodetree helpers for MSA LSA/DLSA opcodes

Add the LSA opcode to the MSA32 decodetree config, add DLSA
to a new config for the MSA64 ASE, and call decode_msa64()
in the main decode_opc() loop.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-23-f4bug@amsat.org>

3 years agotarget/mips: Extract LSA/DLSA translation generators
Philippe Mathieu-Daudé [Tue, 8 Dec 2020 17:55:47 +0000 (18:55 +0100)]
target/mips: Extract LSA/DLSA translation generators

Extract gen_lsa() from translate.c and explode it as
gen_LSA() and gen_DLSA().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-22-f4bug@amsat.org>

3 years agotarget/mips: Use decode_ase_msa() generated from decodetree
Philippe Mathieu-Daudé [Mon, 30 Nov 2020 13:10:32 +0000 (14:10 +0100)]
target/mips: Use decode_ase_msa() generated from decodetree

Now that we can decode the MSA ASE with decode_ase_msa(),
use it and remove the previous code, now unreachable.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-21-f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Introduce decode tree bindings for MSA ASE
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 21:24:40 +0000 (22:24 +0100)]
target/mips: Introduce decode tree bindings for MSA ASE

Introduce the 'msa32' decodetree config for the 32-bit MSA ASE.

We start by decoding:
- the branch instructions,
- all instructions based on the MSA opcode.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-20-f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Pass TCGCond argument to MSA gen_check_zero_element()
Philippe Mathieu-Daudé [Tue, 15 Dec 2020 21:40:50 +0000 (22:40 +0100)]
target/mips: Pass TCGCond argument to MSA gen_check_zero_element()

Simplify gen_check_zero_element() by passing the TCGCond
argument along.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-25-f4bug@amsat.org>

3 years agotarget/mips: Extract MSA translation routines
Philippe Mathieu-Daudé [Mon, 16 Nov 2020 04:13:37 +0000 (05:13 +0100)]
target/mips: Extract MSA translation routines

Extract 2200 lines from the huge translate.c to a new file,
'msa_translate.c'. As there are too many inter-dependencies
we don't compile it as another object yet, but keep including
it in the big translate.o. We gain in code maintainability.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201120210844.2625602-5-f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Declare gen_msa/_branch() in 'translate.h'
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 20:17:46 +0000 (21:17 +0100)]
target/mips: Declare gen_msa/_branch() in 'translate.h'

Make gen_msa() and gen_msa_branch() public declarations
so we can keep calling them once extracted from the big
translate.c in the next commit.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-18-f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Extract MSA helper definitions
Philippe Mathieu-Daudé [Mon, 16 Nov 2020 04:56:44 +0000 (05:56 +0100)]
target/mips: Extract MSA helper definitions

Keep all MSA-related code altogether.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201120210844.2625602-4-f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Extract MSA helpers from op_helper.c
Philippe Mathieu-Daudé [Sun, 22 Nov 2020 17:20:04 +0000 (18:20 +0100)]
target/mips: Extract MSA helpers from op_helper.c

We have ~400 lines of MSA helpers in the generic op_helper.c,
move them with the other helpers in 'msa_helper.c'.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201123204448.3260804-5-f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Move msa_reset() to msa_helper.c
Philippe Mathieu-Daudé [Mon, 30 Nov 2020 12:47:40 +0000 (13:47 +0100)]
target/mips: Move msa_reset() to msa_helper.c

translate_init.c.inc mostly contains CPU definitions.
msa_reset() doesn't belong here, move it with the MSA
helpers.

One comment style is updated to avoid checkpatch.pl warning.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201215225757.764263-15-f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 years agotarget/mips: Explode gen_msa_branch() as gen_msa_BxZ_V/BxZ()
Philippe Mathieu-Daudé [Mon, 30 Nov 2020 13:03:31 +0000 (14:03 +0100)]
target/mips: Explode gen_msa_branch() as gen_msa_BxZ_V/BxZ()

In preparation of using the decodetree script, explode
gen_msa_branch() as following:

- OPC_BZ_V              -> BxZ_V(EQ)
- OPC_BNZ_V             -> BxZ_V(NE)
- OPC_BZ_[BHWD]         -> BxZ(false)
- OPC_BNZ_[BHWD]        -> BxZ(true)

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-10-f4bug@amsat.org>

3 years agotarget/mips: Remove CPUMIPSState* argument from gen_msa*() methods
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 20:16:49 +0000 (21:16 +0100)]
target/mips: Remove CPUMIPSState* argument from gen_msa*() methods

The gen_msa*() methods don't use the "CPUMIPSState *env"
argument. Remove it to simplify.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-9-f4bug@amsat.org>

3 years agotarget/mips: Extract msa_translate_init() from mips_tcg_init()
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 20:12:53 +0000 (21:12 +0100)]
target/mips: Extract msa_translate_init() from mips_tcg_init()

The msa_wr_d[] registers are only initialized/used by MSA.

They are declared static. We want to move them to the new
'msa_translate.c' unit in few commits, without having to
declare them global (with extern).

Extract first the logic initialization of the MSA registers
from the generic initialization. We will later move this
function along with the MSA registers to the new C unit.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-8-f4bug@amsat.org>

3 years agotarget/mips: Alias MSA vector registers on FPU scalar registers
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 20:11:00 +0000 (21:11 +0100)]
target/mips: Alias MSA vector registers on FPU scalar registers

Commits 863f264d10f ("add msa_reset(), global msa register") and
cb269f273fd ("fix multiple TCG registers covering same data")
removed the FPU scalar registers and replaced them by aliases to
the MSA vector registers.

It is not very clear to have FPU registers displayed with MSA
register names, even if MSA ASE is not present.

Instead of aliasing FPU registers to the MSA ones (even when MSA
is absent), we now alias the MSA ones to the FPU ones (only when
MSA is present).

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-7-f4bug@amsat.org>

3 years agotarget/mips: Remove now unused ASE_MSA definition
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 22:32:40 +0000 (23:32 +0100)]
target/mips: Remove now unused ASE_MSA definition

We don't use ASE_MSA anymore (replaced by ase_msa_available()
checking MSAP bit from CP0_Config3). Remove it.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-6-f4bug@amsat.org>

3 years agotarget/mips: Simplify MSA TCG logic
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 22:39:04 +0000 (23:39 +0100)]
target/mips: Simplify MSA TCG logic

Only decode MSA opcodes if MSA is present (implemented).

Now than check_msa_access() will only be called if MSA is
present, the only way to have MIPS_HFLAG_MSA unset is if
MSA is disabled (bit CP0C5_MSAEn cleared, see previous
commit). Therefore we can remove the 'reserved instruction'
exception.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-5-f4bug@amsat.org>

3 years agotarget/mips: Use CP0_Config3 to set MIPS_HFLAG_MSA
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 22:32:27 +0000 (23:32 +0100)]
target/mips: Use CP0_Config3 to set MIPS_HFLAG_MSA

MSA presence is expressed by the MSAP bit of CP0_Config3.
We don't need to check anything else.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-4-f4bug@amsat.org>

3 years agotarget/mips: Simplify msa_reset()
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 22:57:02 +0000 (23:57 +0100)]
target/mips: Simplify msa_reset()

Call msa_reset() unconditionally, but only reset
the MSA registers if MSA is implemented.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-3-f4bug@amsat.org>

3 years agotarget/mips: Introduce ase_msa_available() helper
Philippe Mathieu-Daudé [Sun, 29 Nov 2020 22:22:20 +0000 (23:22 +0100)]
target/mips: Introduce ase_msa_available() helper

Instead of accessing CP0_Config3 directly and checking
the 'MSA Present' bit, introduce an explicit helper,
making the code easier to read.

Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201208003702.4088927-2-f4bug@amsat.org>

3 years agotarget/mips/translate: Expose check_mips_64() to 32-bit mode
Philippe Mathieu-Daudé [Mon, 14 Dec 2020 23:54:34 +0000 (00:54 +0100)]
target/mips/translate: Expose check_mips_64() to 32-bit mode

To allow compiling 64-bit specific translation code more
generically (and removing #ifdef'ry), allow compiling
check_mips_64() on 32-bit targets.
If ever called on 32-bit, we obviously emit a reserved
instruction exception.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Message-Id: <20201215225757.764263-3-f4bug@amsat.org>