]> git.maquefel.me Git - qemu.git/log
qemu.git
3 years agohw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus()
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:03 +0000 (15:52 -0300)]
hw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus()

Read cpu_ptr->cfg.mmu directly. As a bonus, use cpu_ptr in
riscv_isa_string().

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-9-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv: remove RISCV_FEATURE_PMP
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:02 +0000 (15:52 -0300)]
target/riscv: remove RISCV_FEATURE_PMP

RISCV_FEATURE_PMP is being set via riscv_set_feature() by mirroring the
cpu->cfg.pmp flag. Use the flag instead.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-8-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv: remove RISCV_FEATURE_EPMP
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:01 +0000 (15:52 -0300)]
target/riscv: remove RISCV_FEATURE_EPMP

RISCV_FEATURE_EPMP is always set to the same value as the cpu->cfg.epmp
flag. Use the flag directly.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-7-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv/cpu.c: error out if EPMP is enabled without PMP
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:00 +0000 (15:52 -0300)]
target/riscv/cpu.c: error out if EPMP is enabled without PMP

Instead of silently ignoring the EPMP setting if there is no PMP
available, error out informing the user that EPMP depends on PMP
support:

$ ./qemu-system-riscv64 -cpu rv64,pmp=false,x-epmp=true
qemu-system-riscv64: Invalid configuration: EPMP requires PMP support

This will force users to pick saner options in the QEMU command line.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-6-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv: remove RISCV_FEATURE_DEBUG
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:59 +0000 (15:51 -0300)]
target/riscv: remove RISCV_FEATURE_DEBUG

RISCV_FEATURE_DEBUG will always follow the value defined by
cpu->cfg.debug flag. Read the flag instead.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-5-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv: allow MISA writes as experimental
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:58 +0000 (15:51 -0300)]
target/riscv: allow MISA writes as experimental

At this moment, and apparently since ever, we have no way of enabling
RISCV_FEATURE_MISA. This means that all the code from write_misa(), all
the nuts and bolts that handles how to properly write this CSR, has
always been a no-op as well because write_misa() will always exit
earlier.

This seems to be benign in the majority of cases. Booting an Ubuntu
'virt' guest and logging all the calls to 'write_misa' shows that no
writes to MISA CSR was attempted. Writing MISA, i.e. enabling/disabling
RISC-V extensions after the machine is powered on, seems to be a niche
use.

After discussions in the mailing list, most notably in [1], we reached
the consensus that this code is not suited to be exposed to users
because it's not well tested, but at the same time removing it is a bit
extreme because we would like to fix it, and it's easier to do so with
the code available to use instead of fetching it from git log.

The approach taken here is to get rid of RISCV_FEATURE_MISA altogether
and use a new experimental flag called x-misa-w. The default value is
false, meaning that we're keeping the existing behavior of doing nothing
if a write_misa() is attempted. As with any existing experimental flag,
x-misa-w is also a temporary flag that we need to remove once we fix
write_misa().

[1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg05092.html

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li<liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-4-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv: do not mask unsupported QEMU extensions in write_misa()
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:57 +0000 (15:51 -0300)]
target/riscv: do not mask unsupported QEMU extensions in write_misa()

The masking done using env->misa_ext_mask already filters any extension
that QEMU doesn't support. If the hart supports the extension then QEMU
supports it as well.

If the masking done by env->misa_ext_mask is somehow letting unsupported
QEMU extensions pass by, misa_ext_mask itself needs to be fixed instead.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Message-ID: <20230222185205.355361-3-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agotarget/riscv: introduce riscv_cpu_cfg()
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:56 +0000 (15:51 -0300)]
target/riscv: introduce riscv_cpu_cfg()

We're going to do changes that requires accessing the RISCVCPUConfig
struct from the RISCVCPU, having access only to a CPURISCVState 'env'
pointer. Add a helper to make the code easier to read.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20230222185205.355361-2-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agoreadline: fix hmp completion issue
Dongli Zhang [Tue, 7 Feb 2023 04:52:41 +0000 (20:52 -0800)]
readline: fix hmp completion issue

The auto completion does not work in some cases.

Case 1.

1. (qemu) info reg
2. Press 'Tab'.
3. It does not auto complete.

Case 2.

1. (qemu) block_resize flo
2. Press 'Tab'.
3. It does not auto complete 'floppy0'.

Since the readline_add_completion_of() may add any completion when
strlen(pfx) is zero, we remove the check with (name[0] == '\0') because
strlen() always returns zero in that case.

Fixes: 52f50b1e9f8f ("readline: Extract readline_add_completion_of() from monitor")
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Message-Id: <20230207045241.8843-1-dongli.zhang@oracle.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoMerge tag 'pull-tcg-20230301' of https://gitlab.com/rth7680/qemu into staging
Peter Maydell [Wed, 1 Mar 2023 19:19:20 +0000 (19:19 +0000)]
Merge tag 'pull-tcg-20230301' of https://gitlab.com/rth7680/qemu into staging

helper-head: Add fpu/softfloat-types.h
softmmu: Use memmove in flatview_write_continue
tcg: Add sign param to probe_access_flags, probe_access_full
tcg: Convert TARGET_TB_PCREL to CF_PCREL
tcg: Simplify temporary lifetimes for translators

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmP/jWUdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV9TcQf7B7+K/lrWvUVhZ4By
# 7zrNIJKGwsxuQhGq9mS2Nx9ds9es5mS8SQT1ieNG6a51n6Gq8S2B8yFCRFdlDZWD
# /QrMSjxrs+4c6pNHZu4v20Huy/VW0y004eYdGc8Lu5cXTDpy1mUZ2PrZYlWNQEVY
# 4Ts5rTWdSZHRU1+dbB8MTWlml9//++TPB+ZvzqSb8jnRJfw4z7ijVJjUEEb93gQg
# 8S3JiPU6d1ZzoXzGMK7Wd0MMi4pQUZkaX1HOpzvmQXjeErSP87CZvvji/Cucm8iW
# rJ4U7t99nmZDqG9W1zdZfYfKNp4nLlfVldQWFVIx45awSPS0mCzrmeBT5NHyrxYK
# 4OtuNQ==
# =vzqE
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 01 Mar 2023 17:37:41 GMT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-tcg-20230301' of https://gitlab.com/rth7680/qemu: (62 commits)
  tcg: Update docs/devel/tcg-ops.rst for temporary changes
  tcg: Remove tcg_temp_local_new_*, tcg_const_local_*
  exec/gen-icount: Don't use tcg_temp_local_new_i32
  target/xtensa: Don't use tcg_temp_local_new_*
  target/ppc: Don't use tcg_temp_local_new
  target/mips: Don't use tcg_temp_local_new
  target/i386: Don't use tcg_temp_local_new
  target/hppa: Don't use tcg_temp_local_new
  target/hexagon/idef-parser: Drop gen_tmp_local
  target/hexagon: Don't use tcg_temp_local_new_*
  target/cris: Don't use tcg_temp_local_new
  target/arm: Don't use tcg_temp_local_new_*
  target/arm: Drop copies in gen_sve_{ldr,str}
  tcg: Change default temp lifetime to TEMP_TB
  tcg: Don't re-use TEMP_TB temporaries
  accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers
  accel/tcg/plugin: Use tcg_temp_ebb_*
  tcg: Use tcg_constant_ptr in do_dup
  tcg: Use tcg_temp_ebb_new_* in tcg/
  tcg: Add tcg_temp_ebb_new_{i32,i64,ptr}
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agobsd-user: implement sysctlbyname(2)
Kyle Evans [Fri, 10 Feb 2023 18:16:25 +0000 (11:16 -0700)]
bsd-user: implement sysctlbyname(2)

do_freebsd_sysctlbyname needs to translate the 'name' back down to a OID
so we can intercept the special ones. Do that and call the common wrapper
do_freebsd_sysctl_oid.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: do_freebsd_sysctl helper for sysctl(2)
Kyle Evans [Fri, 10 Feb 2023 17:02:45 +0000 (10:02 -0700)]
bsd-user: do_freebsd_sysctl helper for sysctl(2)

Implement the wrapper function for sysctl(2). This puts the oid
arguments into a standard form and calls the common
do_freebsd_sysctl_oid.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Co-Authored-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Co-Authored-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: Start translation of arch-specific sysctls
Juergen Lock [Fri, 10 Feb 2023 22:24:45 +0000 (15:24 -0700)]
bsd-user: Start translation of arch-specific sysctls

Intercept some syscalls that we need to translate (like the archiecture
we're running on) and translate them. These are only the simplest ones
so far.

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Co-Authored-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Co-Authored-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants
Juergen Lock [Fri, 10 Feb 2023 22:24:45 +0000 (15:24 -0700)]
bsd-user: common routine do_freebsd_sysctl_oid for all sysctl variants

do_freebsd_sysctl_oid filters out some of the binary and special sysctls
where host != target. None of the sysctls that have to be translated from
host to target are handled here.

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Co-Authored-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Co-Authored-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: sysctl helper funtions: sysctl_name2oid and sysctl_oidfmt
Juergen Lock [Fri, 10 Feb 2023 22:13:30 +0000 (15:13 -0700)]
bsd-user: sysctl helper funtions: sysctl_name2oid and sysctl_oidfmt

Helper functions for sysctl implementations. sysctl_name2oid and
sysctl_oidfmt convert oids between host and targets

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: Helper routines oidfmt
Stacey Son [Fri, 10 Feb 2023 17:17:29 +0000 (10:17 -0700)]
bsd-user: Helper routines oidfmt

oidfmt uses undocumented system call to get the type of the sysctl.

Co-Authored-by: Sean Bruno <sbruno@FreeBSD.org>
Signed-off-by: Sean Bruno <sbruno@FreeBSD.org>
Co-Authored-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Co-Authored-by: Raphael Kubo da Costa <rakuco@FreeBSD.org>
Signed-off-by: Raphael Kubo da Costa <rakuco@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: various helper routines for sysctl
Warner Losh [Mon, 13 Feb 2023 23:02:03 +0000 (16:02 -0700)]
bsd-user: various helper routines for sysctl

cap_memory - Caps the memory to just below MAXINT
scale_to_guest_pages - Account for difference in host / guest page size
h2g_long_sat - converts a int64_t to a int32_t, saturating at max / min values
h2g_ulong_sat - converts a uint64_t to a uint32_t, saturating at max value

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobsd-user: Add sysarch syscall
Stacey Son [Fri, 10 Feb 2023 16:48:19 +0000 (09:48 -0700)]
bsd-user: Add sysarch syscall

Connect up the sysarch system call.

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Co-authored-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agobuild: Don't specify -no-pie for --static user-mode programs
Warner Losh [Fri, 10 Feb 2023 18:12:46 +0000 (11:12 -0700)]
build: Don't specify -no-pie for --static user-mode programs

When building with clang, -no-pie gives a warning on every single build,
so remove it.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3 years agobsd-user: Don't truncate the return value from freebsd_syscall
Doug Rabson [Sat, 10 Dec 2022 08:38:04 +0000 (08:38 +0000)]
bsd-user: Don't truncate the return value from freebsd_syscall

System call return values on FreeBSD are in a register (which is spelled
abi_long in qemu). This was being assigned into an int variable which
causes problems for 64bit targets.

Resolves: https://github.com/qemu-bsd-user/qemu-bsd-user/issues/40
Signed-off-by: Doug Rabson <dfr@rabson.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
[ Edited commit message for upstreaming into qemu-project ]
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Update docs/devel/tcg-ops.rst for temporary changes
Richard Henderson [Mon, 30 Jan 2023 20:26:25 +0000 (10:26 -1000)]
tcg: Update docs/devel/tcg-ops.rst for temporary changes

Rewrite the sections which talked about 'local temporaries'.
Remove some assumptions which no longer hold.

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Remove tcg_temp_local_new_*, tcg_const_local_*
Richard Henderson [Mon, 30 Jan 2023 00:48:55 +0000 (14:48 -1000)]
tcg: Remove tcg_temp_local_new_*, tcg_const_local_*

These symbols are now unused.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoexec/gen-icount: Don't use tcg_temp_local_new_i32
Richard Henderson [Mon, 30 Jan 2023 00:47:48 +0000 (14:47 -1000)]
exec/gen-icount: Don't use tcg_temp_local_new_i32

Since tcg_temp_new_i32 is now identical, use that.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/xtensa: Don't use tcg_temp_local_new_*
Richard Henderson [Mon, 30 Jan 2023 00:45:57 +0000 (14:45 -1000)]
target/xtensa: Don't use tcg_temp_local_new_*

Since tcg_temp_new_* is now identical, use those.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/ppc: Don't use tcg_temp_local_new
Richard Henderson [Mon, 30 Jan 2023 00:45:12 +0000 (14:45 -1000)]
target/ppc: Don't use tcg_temp_local_new

Since tcg_temp_new is now identical, use that.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/mips: Don't use tcg_temp_local_new
Richard Henderson [Mon, 30 Jan 2023 00:44:25 +0000 (14:44 -1000)]
target/mips: Don't use tcg_temp_local_new

Since tcg_temp_new is now identical, use that.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/i386: Don't use tcg_temp_local_new
Richard Henderson [Mon, 30 Jan 2023 00:43:49 +0000 (14:43 -1000)]
target/i386: Don't use tcg_temp_local_new

Since tcg_temp_new is now identical, use that.
In some cases we can avoid a copy from A0 or T0.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/hppa: Don't use tcg_temp_local_new
Richard Henderson [Mon, 30 Jan 2023 00:42:26 +0000 (14:42 -1000)]
target/hppa: Don't use tcg_temp_local_new

This wasn't actually used at all, just some unused
macro re-definitions.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/hexagon/idef-parser: Drop gen_tmp_local
Richard Henderson [Mon, 27 Feb 2023 02:01:00 +0000 (16:01 -1000)]
target/hexagon/idef-parser: Drop gen_tmp_local

This is now equivalent to gen_tmp.

Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/hexagon: Don't use tcg_temp_local_new_*
Richard Henderson [Mon, 30 Jan 2023 00:41:33 +0000 (14:41 -1000)]
target/hexagon: Don't use tcg_temp_local_new_*

Since tcg_temp_new_* is now identical, use those.

Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/cris: Don't use tcg_temp_local_new
Richard Henderson [Mon, 30 Jan 2023 00:40:21 +0000 (14:40 -1000)]
target/cris: Don't use tcg_temp_local_new

Since tcg_temp_new is now identical, use that.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/arm: Don't use tcg_temp_local_new_*
Richard Henderson [Mon, 30 Jan 2023 00:46:29 +0000 (14:46 -1000)]
target/arm: Don't use tcg_temp_local_new_*

Since tcg_temp_new_* is now identical, use those.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/arm: Drop copies in gen_sve_{ldr,str}
Richard Henderson [Mon, 30 Jan 2023 00:39:06 +0000 (14:39 -1000)]
target/arm: Drop copies in gen_sve_{ldr,str}

Since we now get TEMP_TB temporaries by default, we no longer
need to make copies across these loops.  These were the only
uses of new_tmp_a64_local(), so remove that as well.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Change default temp lifetime to TEMP_TB
Richard Henderson [Mon, 30 Jan 2023 00:09:00 +0000 (14:09 -1000)]
tcg: Change default temp lifetime to TEMP_TB

Guest front-ends now get temps that span the lifetime of
the translation block by default, which avoids accidentally
using the temp across branches and invalidating the data.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Don't re-use TEMP_TB temporaries
Richard Henderson [Mon, 30 Jan 2023 00:02:59 +0000 (14:02 -1000)]
tcg: Don't re-use TEMP_TB temporaries

Reusing TEMP_TB interferes with detecting whether the
temp can be adjusted to TEMP_EBB.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers
Richard Henderson [Sun, 29 Jan 2023 23:28:53 +0000 (13:28 -1000)]
accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers

Here we are creating a temp whose value needs to be replaced,
but always storing NULL into CPUState.plugin_mem_cbs.
Use tcg_constant_ptr(0) explicitly.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg/plugin: Use tcg_temp_ebb_*
Richard Henderson [Sun, 29 Jan 2023 23:29:24 +0000 (13:29 -1000)]
accel/tcg/plugin: Use tcg_temp_ebb_*

All of these uses have quite local scope.
Avoid tcg_const_*, because we haven't added a corresponding
interface for TEMP_EBB.  Use explicit tcg_gen_movi_* instead.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Use tcg_constant_ptr in do_dup
Richard Henderson [Sat, 25 Feb 2023 01:35:45 +0000 (15:35 -1000)]
tcg: Use tcg_constant_ptr in do_dup

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Use tcg_temp_ebb_new_* in tcg/
Richard Henderson [Sun, 29 Jan 2023 23:26:49 +0000 (13:26 -1000)]
tcg: Use tcg_temp_ebb_new_* in tcg/

All of these have obvious and quite local scope.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Add tcg_temp_ebb_new_{i32,i64,ptr}
Richard Henderson [Sun, 29 Jan 2023 22:59:52 +0000 (12:59 -1000)]
tcg: Add tcg_temp_ebb_new_{i32,i64,ptr}

TCG internals will want to be able to allocate and reuse
explicitly life-limited temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Add tcg_gen_movi_ptr
Richard Henderson [Sun, 29 Jan 2023 23:15:45 +0000 (13:15 -1000)]
tcg: Add tcg_gen_movi_ptr

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Use tcg_constant_i32 in tcg_gen_io_start
Richard Henderson [Sat, 25 Feb 2023 00:53:35 +0000 (14:53 -1000)]
tcg: Use tcg_constant_i32 in tcg_gen_io_start

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Pass TCGTempKind to tcg_temp_new_internal
Richard Henderson [Sun, 29 Jan 2023 23:46:06 +0000 (13:46 -1000)]
tcg: Pass TCGTempKind to tcg_temp_new_internal

While the argument can only be TEMP_EBB or TEMP_TB,
it's more obvious this way.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Remove TEMP_NORMAL
Richard Henderson [Sun, 29 Jan 2023 22:42:10 +0000 (12:42 -1000)]
tcg: Remove TEMP_NORMAL

TEMP_NORMAL is a subset of TEMP_EBB.  Promote single basic
block temps to single extended basic block.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Add liveness_pass_0
Richard Henderson [Sun, 29 Jan 2023 21:50:20 +0000 (11:50 -1000)]
tcg: Add liveness_pass_0

Attempt to reduce the lifetime of TEMP_TB.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Use noinline for major tcg_gen_code subroutines
Richard Henderson [Fri, 24 Feb 2023 22:07:33 +0000 (12:07 -1000)]
tcg: Use noinline for major tcg_gen_code subroutines

This makes it easier to assign blame with perf.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Rename TEMP_LOCAL to TEMP_TB
Richard Henderson [Sun, 29 Jan 2023 20:55:52 +0000 (10:55 -1000)]
tcg: Rename TEMP_LOCAL to TEMP_TB

Use TEMP_TB as that is more explicit about the default
lifetime of the data.  While "global" and "local" used
to be contrasting, we have more lifetimes than that now.

Do not yet rename tcg_temp_local_new_*, just the enum.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Remove branch-to-next regardless of reference count
Richard Henderson [Sun, 29 Jan 2023 20:37:19 +0000 (10:37 -1000)]
tcg: Remove branch-to-next regardless of reference count

Just because the label reference count is more than 1 does
not mean we cannot remove a branch-to-next.  By doing this
first, the label reference count may drop to 0, and then
the label itself gets removed as before.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg: Use more accurate max_insns for tb_overflow
Richard Henderson [Sun, 29 Jan 2023 05:11:20 +0000 (19:11 -1000)]
accel/tcg: Use more accurate max_insns for tb_overflow

Write back the number of insns that we attempt to translate,
so that if we longjmp out we have a more accurate limit for
the next attempt.  This results in fewer restarts when some
limit is consumed by few instructions.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg: Pass max_insn to gen_intermediate_code by pointer
Richard Henderson [Sun, 29 Jan 2023 01:19:22 +0000 (15:19 -1000)]
accel/tcg: Pass max_insn to gen_intermediate_code by pointer

In preparation for returning the number of insns generated
via the same pointer.  Adjust only the prototypes so far.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotcg: Adjust TCGContext.temps_in_use check
Richard Henderson [Sat, 28 Jan 2023 23:05:14 +0000 (13:05 -1000)]
tcg: Adjust TCGContext.temps_in_use check

Change the temps_in_use check to use assert not fprintf.
Move the assert for double-free before the check for count,
since that is the more immediate problem.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoinclude/exec: Remove `tb_pc()`
Anton Johansson [Mon, 27 Feb 2023 13:52:02 +0000 (14:52 +0100)]
include/exec: Remove `tb_pc()`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-28-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/arm: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:52:01 +0000 (14:52 +0100)]
target/arm: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-27-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/avr: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:52:00 +0000 (14:52 +0100)]
target/avr: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-26-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/hexagon: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:59 +0000 (14:51 +0100)]
target/hexagon: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <20230227135202.9710-25-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/hppa: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:58 +0000 (14:51 +0100)]
target/hppa: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-24-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/i386: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:57 +0000 (14:51 +0100)]
target/i386: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-23-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/loongarch: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:56 +0000 (14:51 +0100)]
target/loongarch: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-22-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/microblaze: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:55 +0000 (14:51 +0100)]
target/microblaze: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-21-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/mips: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:54 +0000 (14:51 +0100)]
target/mips: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-20-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/openrisc: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:53 +0000 (14:51 +0100)]
target/openrisc: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-19-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/riscv: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:52 +0000 (14:51 +0100)]
target/riscv: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-18-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/rx: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:51 +0000 (14:51 +0100)]
target/rx: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-17-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/sh4: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:50 +0000 (14:51 +0100)]
target/sh4: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-16-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/sparc: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:49 +0000 (14:51 +0100)]
target/sparc: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-15-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/tricore: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:48 +0000 (14:51 +0100)]
target/tricore: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-14-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg: Replace `tb_pc()` with `tb->pc`
Anton Johansson [Mon, 27 Feb 2023 13:51:47 +0000 (14:51 +0100)]
accel/tcg: Replace `tb_pc()` with `tb->pc`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-13-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg: Move jmp-cache `CF_PCREL` checks to caller
Anton Johansson [Mon, 27 Feb 2023 13:51:46 +0000 (14:51 +0100)]
accel/tcg: Move jmp-cache `CF_PCREL` checks to caller

tb-jmp-cache.h contains a few small functions that only exist to hide a
CF_PCREL check, however the caller often already performs such a check.

This patch moves CF_PCREL checks from the callee to the caller, and also
removes these functions which now only hide an access of the jmp-cache.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-12-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/i386: Remove `TARGET_TB_PCREL` define
Anton Johansson [Mon, 27 Feb 2023 13:51:45 +0000 (14:51 +0100)]
target/i386: Remove `TARGET_TB_PCREL` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-11-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/arm: Remove `TARGET_TB_PCREL` define
Anton Johansson [Mon, 27 Feb 2023 13:51:44 +0000 (14:51 +0100)]
target/arm: Remove `TARGET_TB_PCREL` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-10-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoinclude/exec: Remove `TARGET_TB_PCREL` define
Anton Johansson [Mon, 27 Feb 2023 13:51:43 +0000 (14:51 +0100)]
include/exec: Remove `TARGET_TB_PCREL` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-9-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/i386: Replace `TARGET_TB_PCREL` with `CF_PCREL`
Anton Johansson [Mon, 27 Feb 2023 13:51:42 +0000 (14:51 +0100)]
target/i386: Replace `TARGET_TB_PCREL` with `CF_PCREL`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-8-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/arm: Replace `TARGET_TB_PCREL` with `CF_PCREL`
Anton Johansson [Mon, 27 Feb 2023 13:51:41 +0000 (14:51 +0100)]
target/arm: Replace `TARGET_TB_PCREL` with `CF_PCREL`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-7-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoinclude/exec: Replace `TARGET_TB_PCREL` with `CF_PCREL`
Anton Johansson [Mon, 27 Feb 2023 13:51:40 +0000 (14:51 +0100)]
include/exec: Replace `TARGET_TB_PCREL` with `CF_PCREL`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-6-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoaccel/tcg: Replace `TARGET_TB_PCREL` with `CF_PCREL`
Anton Johansson [Mon, 27 Feb 2023 13:51:39 +0000 (14:51 +0100)]
accel/tcg: Replace `TARGET_TB_PCREL` with `CF_PCREL`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-5-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/arm: set `CF_PCREL` in `arm_cpu_realizefn`
Anton Johansson [Mon, 27 Feb 2023 13:51:38 +0000 (14:51 +0100)]
target/arm: set `CF_PCREL` in `arm_cpu_realizefn`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-4-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agotarget/i386: set `CF_PCREL` in `x86_cpu_realizefn`
Anton Johansson [Mon, 27 Feb 2023 13:51:37 +0000 (14:51 +0100)]
target/i386: set `CF_PCREL` in `x86_cpu_realizefn`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-3-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoinclude/exec: Introduce `CF_PCREL`
Anton Johansson [Mon, 27 Feb 2023 13:51:36 +0000 (14:51 +0100)]
include/exec: Introduce `CF_PCREL`

Adds a new field to TranslationBlock.cflags denoting whether or not the
instructions of a given translation block are pc-relative. This field
aims to replace the macro `TARGET_TB_PCREL`.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230227135202.9710-2-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoMerge branch 'xenfv-kvm-15' of git://git.infradead.org/users/dwmw2/qemu into HEAD
Paolo Bonzini [Wed, 1 Mar 2023 14:02:13 +0000 (15:02 +0100)]
Merge branch 'xenfv-kvm-15' of git://git.infradead.org/users/dwmw2/qemu into HEAD

This adds support for emulating Xen under Linux/KVM, based on kernel
patches which have been present since Linux v5.12. As with the kernel
support, it's derived from work started by João Martins of Oracle in
2018.

This series just adds the basic platform support — CPUID, hypercalls,
event channels, a stub of XenStore.

A full single-tenant internal implementation of XenStore, and patches
to make QEMU's Xen PV drivers work with this Xen emulation, are waiting
in the wings to be submitted in a follow-on patch series.

As noted in the documentation, it's enabled by setting the xen-version
property on the KVM accelerator, e.g.:

 qemu-system-x86_64 -serial mon:stdio -M q35 -display none -m 1G -smp 2 \
    -accel kvm,xen-version=0x4000e,kernel-irqchip=split \
    -kernel vmlinuz-6.0.7-301.fc37.x86_64 \
    -append "console=ttyS0 root=/dev/sda1" \
    -drive file=/var/lib/libvirt/images/fedora28.qcow2,if=none,id=disk \
    -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0

Even before this was merged, we've already been using it to find and fix
bugs in the Linux kernel Xen guest support:

https://lore.kernel.org/all/4bffa69a949bfdc92c4a18e5a1c3cbb3b94a0d32.camel@infradead.org/
https://lore.kernel.org/all/871qnunycr.ffs@tglx/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotests/avocado: disable BootLinuxPPC64 test in CI
Alex Bennée [Tue, 28 Feb 2023 19:06:53 +0000 (19:06 +0000)]
tests/avocado: disable BootLinuxPPC64 test in CI

This test is exceptionally heavyweight (nearly 330s) compared to the
two (both endians) TuxRun baseline tests which complete in under 160s.
The coverage is slightly reduced but a more directed test could make
up the difference.

tests/avocado/tuxrun_baselines.py:TuxRunBaselineTest.test_ppc64:

Overall coverage rate:
  lines......: 9.6% (44110 of 458817 lines)
  functions..: 16.5% (6767 of 41054 functions)
  branches...: 6.0% (13395 of 222634 branches)

tests/avocado/boot_linux.py:BootLinuxPPC64.test_pseries_tcg:

Overall coverage rate:
  lines......: 11.6% (53408 of 458817 lines)
  functions..: 18.7% (7691 of 41054 functions)
  branches...: 7.9% (17692 of 224218 branches)

So lets skip for GITLAB_CI and save a few CI minutes.

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

3 years agotests/docker: add zstdtools to the images
Alex Bennée [Tue, 28 Feb 2023 19:06:52 +0000 (19:06 +0000)]
tests/docker: add zstdtools to the images

We need this to be able to run the tuxrun_baseline tests in CI which
in turn helps us reduce overhead running other tests. We need to
update libvirt-ci and refresh the generated files by running 'make
lcitool-refresh' to get the new mapping.

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

3 years agogitlab: move the majority of artefact handling to a template
Alex Bennée [Tue, 28 Feb 2023 19:06:51 +0000 (19:06 +0000)]
gitlab: move the majority of artefact handling to a template

To avoid lots of copy and paste lets deal with artefacts in a
template. This way we can filter out most of the pre-binary object and
library files we no longer need as we have the final binaries.

build-system-alpine also saved .git-submodule-status so for simplicity
we bring that into the template as well.

As an example the build-system-ubuntu artefacts before this patch
where around 1.3 GB, after dropping the object files it comes to 970
MB.

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

3 years agotests/docker: use direct RUNC call to run test jobs
Alex Bennée [Tue, 28 Feb 2023 19:06:50 +0000 (19:06 +0000)]
tests/docker: use direct RUNC call to run test jobs

If we build them without the script we can certainly run them without
it.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-22-alex.bennee@linaro.org>

3 years agotests/docker: use direct RUNC call to build containers
Alex Bennée [Tue, 28 Feb 2023 19:06:49 +0000 (19:06 +0000)]
tests/docker: use direct RUNC call to build containers

We don't really need stuff from docker.py to do the build as we have
everything we need with a direct call. We do rely on the dockerfiles
being able to tweak the UID/name mapping as the last step.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-21-alex.bennee@linaro.org>

3 years agotests/docker: add USER stanzas to non-lci images
Alex Bennée [Tue, 28 Feb 2023 19:06:48 +0000 (19:06 +0000)]
tests/docker: add USER stanzas to non-lci images

These are flat but not generated by lcitool so we need to manually
update them with the `useradd` stanza.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-20-alex.bennee@linaro.org>

3 years agotests/lcitool: append user setting stanza to dockerfiles
Alex Bennée [Tue, 28 Feb 2023 19:06:47 +0000 (19:06 +0000)]
tests/lcitool: append user setting stanza to dockerfiles

For the cross-compilation use-case it is important to add the host
user to the dockerfile so we can map them to the docker environment
when cross-building files.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230228190653.1602033-19-alex.bennee@linaro.org>

3 years agoconfigure: expose the direct container command
Alex Bennée [Tue, 28 Feb 2023 19:06:46 +0000 (19:06 +0000)]
configure: expose the direct container command

In the process of migrating away from using docker.py to build our
containers we need to expose the command to the build environment. The
script is still a useful way to probe which command works though.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-18-alex.bennee@linaro.org>

3 years agotests: Ensure TAP version is printed before other messages
Richard W.M. Jones [Tue, 28 Feb 2023 19:06:45 +0000 (19:06 +0000)]
tests: Ensure TAP version is printed before other messages

These two tests were failing with this error:

  stderr:
  TAP parsing error: version number must be on the first line
  [...]
  Unknown TAP version. The first line MUST be `TAP version <int>`. Assuming version 12.

This can be fixed by ensuring we always call g_test_init first in the
body of main.

Thanks: Daniel Berrange, for diagnosing the problem
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Message-Id: <20230227174019.1164205-1-rjones@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230228190653.1602033-17-alex.bennee@linaro.org>

3 years agoMakefile: qemu-bundle is a directory
Juan Quintela [Wed, 1 Mar 2023 11:19:10 +0000 (12:19 +0100)]
Makefile: qemu-bundle is a directory

So make distclean should remove it with -rf, not -f alone.

It has been that way since it was included.

ommit cf60ccc3306ca4726cbd286a156863863b00ff4f
Author: Akihiko Odaki <akihiko.odaki@gmail.com>
Date:   Fri Jun 24 23:50:37 2022 +0900

    cutils: Introduce bundle mechanism

Fixes: cf60ccc3306ca4726cbd286a156863863b00ff4f
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20230301111910.1660-1-quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoqapi: Add 'acpi' field to 'query-machines' output
Peter Krempa [Tue, 28 Feb 2023 08:12:34 +0000 (09:12 +0100)]
qapi: Add 'acpi' field to 'query-machines' output

Report which machine types support ACPI so that management applications
can properly use the 'acpi' property even on platforms such as ARM where
support for ACPI depends on the machine type and thus checking presence
of '-machine acpi=' in 'query-command-line-options' is insufficient.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <537625d3e25d345052322c42ca19812b98b4f49a.1677571792.git.pkrempa@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agogitlab: Use plain docker in container-template.yml
Fabiano Rosas [Tue, 28 Feb 2023 19:06:44 +0000 (19:06 +0000)]
gitlab: Use plain docker in container-template.yml

Our dockerfiles no longer reference layers from other qemu images so
we can now use 'docker build' on them.

Also reinstate the caching that was disabled due to bad interactions
with certain runners. See commit 6ddc3dc7a8 ("tests/docker: don't use
BUILDKIT in GitLab either"). We now believe those issues to be fixed.

The COMMON_TAG needed to be fixed for the caching to work. The
docker.py script was not using the variable, but constructing the
correct URL directly.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230227151110.31455-2-farosas@suse.de>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-16-alex.bennee@linaro.org>

3 years agotests/dockerfiles: unify debian-toolchain references
Alex Bennée [Tue, 28 Feb 2023 19:06:43 +0000 (19:06 +0000)]
tests/dockerfiles: unify debian-toolchain references

We use the debian release number elsewhere so fix it for consistency
along with the broken comment.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230228190653.1602033-15-alex.bennee@linaro.org>

3 years agocirrus.yml: Improve the windows_msys2_task
Thomas Huth [Tue, 28 Feb 2023 19:06:42 +0000 (19:06 +0000)]
cirrus.yml: Improve the windows_msys2_task

There's no need to run a full-blown bash just to create a directory.
And we can skip the "cd build" each time by doing it once at the
beginning.

Additionally, let's exclude some targets (that we already compile-test
with MinGW in the gitlab jobs) from the build, since the build time of
this task is very long already (between 80 and 90 minutes).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230208103046.618154-1-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230228190653.1602033-14-alex.bennee@linaro.org>

3 years agotests: ensure we export job results for some cross builds
Alex Bennée [Tue, 28 Feb 2023 19:06:41 +0000 (19:06 +0000)]
tests: ensure we export job results for some cross builds

We do run tests on some cross builds. Provide a template to ensure we
export the testlog to the build artefacts and report the test results
via the junit.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230228190653.1602033-13-alex.bennee@linaro.org>

3 years agotests/docker: Use binaries for debian-tricore-cross
Bastian Koppelmann [Tue, 28 Feb 2023 19:06:40 +0000 (19:06 +0000)]
tests/docker: Use binaries for debian-tricore-cross

since binutils is pretty old, it fails our CI repeatedly during the
compilation of tricore-binutils. We created a precompiled version using
the debian docker image and download it instead of building it ourself.

We also updated the package to include a newer version of binutils, gcc,
and newlib. The default TriCore ISA version used by tricore-as changed
from the old version, so we have to specify it now. If we don't
'test_fadd' fails with 'unknown opcode'.

The new assembler also picks a new encoding in ld.h which fails the
'test_ld_h' test. We fix that by using the newest TriCore CPU for QEMU.

The old assembler accepted an extra ')' in 'test_imask'. The new one
does not, so lets remove it.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20230209145812.46730-1-kbastian@mail.uni-paderborn.de>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230228190653.1602033-12-alex.bennee@linaro.org>

3 years agotests: add tuxrun baseline test to avocado
Alex Bennée [Tue, 28 Feb 2023 19:06:39 +0000 (19:06 +0000)]
tests: add tuxrun baseline test to avocado

The TuxRun project (www.tuxrun.org) uses QEMU to run tests on a wide
variety of kernel configurations on wide range of our emulated
platforms. They publish a known good set of images at:

  https://storage.tuxboot.com/

to help with bisecting regressions in either the kernel, firmware or
QEMU itself. The tests are pretty lightweight as they contain just a
kernel with a minimal rootfs which boots a lot faster than most of the
distros. In time they might be persuaded to version their known good
baselines and we can then enable proper checksums.

For a couple of tests we currently skip:

  - mips64, a regression against previous stable release
  - sh4, very unstable with intermittent oops

Total run time: 340s (default) -> 890s (debug)

Overall coverage rate (tested targets + disabled tests):
  lines......: 16.1% (126894 of 789848 lines)
  functions..: 20.6% (15954 of 77489 functions)
  branches...: 9.3% (40727 of 439365 branches)

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Anders Roxell <anders.roxell@linaro.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230228190653.1602033-11-alex.bennee@linaro.org>

3 years agotests: skip the nios2 replay_kernel test
Alex Bennée [Tue, 28 Feb 2023 19:06:38 +0000 (19:06 +0000)]
tests: skip the nios2 replay_kernel test

It is buggy and keeps failing.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230228190653.1602033-10-alex.bennee@linaro.org>

3 years agotesting: update ubuntu2004 to ubuntu2204
Alex Bennée [Tue, 28 Feb 2023 19:06:37 +0000 (19:06 +0000)]
testing: update ubuntu2004 to ubuntu2204

The 22.04 LTS release has been out for almost a year now so its time
to update all the remaining images to the current LTS. We can also
drop some hacks we need for older clang TSAN support.

We will keep the ubuntu2004 container around for those who wish to
test builds on the currently still supported baseline.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230228190653.1602033-9-alex.bennee@linaro.org>

3 years agotests: don't run benchmarks for the tsan build
Alex Bennée [Tue, 28 Feb 2023 19:06:36 +0000 (19:06 +0000)]
tests: don't run benchmarks for the tsan build

All we are really doing here is checking that TSAN builds compile and are
therefor a tool available to developers. The benchmarks are not
representative of QEMU's actual threading behaviour and they burn
precious CI time. Indeed switching to check-unit reveals many
unaddressed issues which have been logged at:

  https://gitlab.com/qemu-project/qemu/-/issues/1496

So for now disable the make check and make this a build only
test.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230228190653.1602033-8-alex.bennee@linaro.org>

3 years agogitlab: extend custom runners with base_job_template
Alex Bennée [Tue, 28 Feb 2023 19:06:35 +0000 (19:06 +0000)]
gitlab: extend custom runners with base_job_template

The base job template is responsible for controlling how we kick off
testing on our various branches. Rename and extend the
custom_runner_template so we can take advantage of all that control.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230228190653.1602033-7-alex.bennee@linaro.org>