]> Git Repo - qemu.git/log
qemu.git
2 years agotcg/s390x: Remove DISTINCT_OPERANDS facility check
Richard Henderson [Wed, 7 Dec 2022 17:50:15 +0000 (17:50 +0000)]
tcg/s390x: Remove DISTINCT_OPERANDS facility check

The distinct-operands facility is bundled into facility 45,
along with load-on-condition.  We are checking this at startup.
Remove the a0 == a1 checks for 64-bit sub, and, or, xor, as there
is no space savings for avoiding the distinct-operands insn.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Remove FAST_BCR_SER facility check
Richard Henderson [Wed, 7 Dec 2022 17:43:35 +0000 (17:43 +0000)]
tcg/s390x: Remove FAST_BCR_SER facility check

The fast-bcr-serialization facility is bundled into facility 45,
along with load-on-condition.  We are checking this at startup.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Check for load-on-condition facility at startup
Richard Henderson [Wed, 7 Dec 2022 17:38:42 +0000 (17:38 +0000)]
tcg/s390x: Check for load-on-condition facility at startup

The general-instruction-extension facility was introduced in z196,
which itself was end-of-life in 2021.  In addition, z196 is the
minimum CPU supported by our set of supported operating systems:
RHEL 7 (z196), SLES 12 (z196) and Ubuntu 16.04 (zEC12).

Check for facility number 45, which will be the consilidated check
for several facilities.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Check for general-instruction-extension facility at startup
Richard Henderson [Wed, 7 Dec 2022 16:51:27 +0000 (16:51 +0000)]
tcg/s390x: Check for general-instruction-extension facility at startup

The general-instruction-extension facility was introduced in z10,
which itself was end-of-life in 2019.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Check for extended-immediate facility at startup
Richard Henderson [Wed, 7 Dec 2022 16:28:07 +0000 (16:28 +0000)]
tcg/s390x: Check for extended-immediate facility at startup

The extended-immediate facility was introduced in z9-109,
which itself was end-of-life in 2017.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Check for long-displacement facility at startup
Richard Henderson [Wed, 7 Dec 2022 16:08:46 +0000 (16:08 +0000)]
tcg/s390x: Check for long-displacement facility at startup

We are already assuming the existance of long-displacement, but were
not being explicit about it.  This has been present since z990.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Remove USE_LONG_BRANCHES
Richard Henderson [Wed, 7 Dec 2022 15:44:33 +0000 (15:44 +0000)]
tcg/s390x: Remove USE_LONG_BRANCHES

The size of a compiled TB is limited by the uint16_t used by
gen_insn_end_off[] -- there is no need for a 32-bit branch.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Always set TCG_TARGET_HAS_direct_jump
Richard Henderson [Wed, 7 Dec 2022 18:47:39 +0000 (18:47 +0000)]
tcg/s390x: Always set TCG_TARGET_HAS_direct_jump

Since USE_REG_TB is removed, there is no need to load the
target TB address into a register.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/s390x: Remove TCG_REG_TB
Richard Henderson [Wed, 30 Nov 2022 00:17:50 +0000 (00:17 +0000)]
tcg/s390x: Remove TCG_REG_TB

This reverts 829e1376d940 ("tcg/s390: Introduce TCG_REG_TB"), and
several follow-up patches.  The primary motivation is to reduce the
less-tested code paths, pre-z10.  Secondarily, this allows the
unconditional use of TCG_TARGET_HAS_direct_jump, which might be more
important for performance than any slight increase in code size.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
---
v4: Do not simplify tgen_ori, tgen_xori.

2 years agotcg/s390x: Use register pair allocation for div and mulu2
Richard Henderson [Mon, 10 Oct 2022 15:41:15 +0000 (08:41 -0700)]
tcg/s390x: Use register pair allocation for div and mulu2

Previously we hard-coded R2 and R3.

Reviewed-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoMerge tag 'pull-tcg-20230105' of https://gitlab.com/rth7680/qemu into staging
Peter Maydell [Fri, 6 Jan 2023 15:40:37 +0000 (15:40 +0000)]
Merge tag 'pull-tcg-20230105' of https://gitlab.com/rth7680/qemu into staging

Fix race conditions in new user-only vma tracking.
Add tcg backend paired register allocation.
Cleanup tcg backend function call abi.

# gpg: Signature made Fri 06 Jan 2023 03:12:17 GMT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Richard Henderson <[email protected]>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-tcg-20230105' of https://gitlab.com/rth7680/qemu: (47 commits)
  tests/tcg/multiarch: add vma-pthread.c
  accel/tcg: Handle false negative lookup in page_check_range
  accel/tcg: Use g_free_rcu for user-exec interval trees
  accel/tcg: Fix tb_invalidate_phys_page_unwind
  tcg: Add TCGHelperInfo argument to tcg_out_call
  tcg/aarch64: Merge tcg_out_callr into tcg_out_call
  tcg: Move ffi_cif pointer into TCGHelperInfo
  tcg: Factor init_ffi_layouts() out of tcg_context_init()
  tcg: Convert typecode_to_ffi from array to function
  tcg: Reorg function calls
  tcg: Use output_pref wrapper function
  tcg: Vary the allocation size for TCGOp
  tcg: Pass number of arguments to tcg_emit_op() / tcg_op_insert_*()
  accel/tcg/plugin: Use copy_op in append_{udata,mem}_cb
  accel/tcg/plugin: Avoid duplicate copy in copy_call
  accel/tcg/plugin: Don't search for the function pointer index
  tcg: Use TCG_CALL_ARG_EVEN for TCI special case
  tcg: Replace TCG_TARGET_EXTEND_ARGS with TCG_TARGET_CALL_ARG_I32
  tcg: Replace TCG_TARGET_CALL_ALIGN_ARGS with TCG_TARGET_CALL_ARG_I64
  tcg: Introduce TCGCallReturnKind and TCGCallArgumentKind
  ...

Signed-off-by: Peter Maydell <[email protected]>
2 years agoMerge tag 'pull-hex-20230105' of https://github.com/quic/qemu into staging
Peter Maydell [Fri, 6 Jan 2023 12:11:22 +0000 (12:11 +0000)]
Merge tag 'pull-hex-20230105' of https://github.com/quic/qemu into staging

Hexagon update: patches from several folks

# gpg: Signature made Thu 05 Jan 2023 17:35:27 GMT
# gpg:                using RSA key 3635C788CE62B91FD4C59AB47B0244FB12DE4422
# gpg: Good signature from "Taylor Simpson (Rock on) <[email protected]>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 3635 C788 CE62 B91F D4C5  9AB4 7B02 44FB 12DE 4422

* tag 'pull-hex-20230105' of https://github.com/quic/qemu:
  Update scripts/meson-buildoptions.sh
  Hexagon (target/hexagon) implement mutability mask for GPRs
  target/hexagon: suppress unused variable warning
  target/hexagon/idef-parser: fix two typos in README
  tests/tcg/hexagon: fix underspecifed asm constraints
  target/hexagon: rename aliased register HEX_REG_P3_0
  linux-user/hexagon: fix signal context save & restore

Signed-off-by: Peter Maydell <[email protected]>
2 years agoMerge tag 'pull-target-arm-20230105' of https://git.linaro.org/people/pmaydell/qemu...
Peter Maydell [Thu, 5 Jan 2023 21:04:52 +0000 (21:04 +0000)]
Merge tag 'pull-target-arm-20230105' of https://git.linaro.org/people/pmaydell/qemu-arm into staging

target-arm queue:
 * Implement AArch32 ARMv8-R support
 * Add Cortex-R52 CPU
 * fix handling of HLT semihosting in system mode
 * hw/timer/ixm_epit: cleanup and fix bug in compare handling
 * target/arm: Coding style fixes
 * target/arm: Clean up includes
 * nseries: minor code cleanups
 * target/arm: align exposed ID registers with Linux
 * hw/arm/smmu-common: remove unnecessary inlines
 * i.MX7D: Handle GPT timers
 * i.MX7D: Connect IRQs to GPIO devices
 * i.MX6UL: Add a specific GPT timer instance
 * hw/net: Fix read of uninitialized memory in imx_fec

# gpg: Signature made Thu 05 Jan 2023 16:43:18 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Peter Maydell <[email protected]>" [ultimate]
# gpg:                 aka "Peter Maydell <[email protected]>" [ultimate]
# gpg:                 aka "Peter Maydell <[email protected]>" [ultimate]
# gpg:                 aka "Peter Maydell <[email protected]>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20230105' of https://git.linaro.org/people/pmaydell/qemu-arm: (34 commits)
  hw/net: Fix read of uninitialized memory in imx_fec.
  i.MX7D: Connect IRQs to GPIO devices.
  i.MX6UL: Add a specific GPT timer instance for the i.MX6UL
  i.MX7D: Compute clock frequency for the fixed frequency clocks.
  i.MX7D: Connect GPT timers to IRQ
  hw/arm/smmu-common: Avoid using inlined functions with external linkage
  hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
  target/arm: align exposed ID registers with Linux
  hw/arm/nseries: Silent -Wmissing-field-initializers warning
  hw/arm/nseries: Constify various read-only arrays
  hw/input/tsc2xxx: Constify set_transform()'s MouseTransformInfo arg
  target/arm: cleanup cpu includes
  target/arm: Remove unused includes from helper.c
  target/arm: Remove unused includes from m_helper.c
  target/arm: Fix checkpatch brace errors in helper.c
  target/arm: Fix checkpatch space errors in helper.c
  target/arm: Fix checkpatch comment style warnings in helper.c
  hw/timer/imx_epit: fix compare timer handling
  hw/timer/imx_epit: remove explicit fields cnt and freq
  hw/timer/imx_epit: factor out register write handlers
  ...

Signed-off-by: Peter Maydell <[email protected]>
2 years agotests/tcg/multiarch: add vma-pthread.c
Ilya Leoshkevich [Fri, 23 Dec 2022 12:02:52 +0000 (13:02 +0100)]
tests/tcg/multiarch: add vma-pthread.c

Add a test that locklessly changes and exercises page protection bits
from various threads. This helps catch race conditions in the VMA
handling.

Acked-by: Alex Bennée <[email protected]>
Signed-off-by: Ilya Leoshkevich <[email protected]>
Message-Id: <20221223120252[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg: Handle false negative lookup in page_check_range
Richard Henderson [Sat, 24 Dec 2022 14:37:56 +0000 (06:37 -0800)]
accel/tcg: Handle false negative lookup in page_check_range

As in page_get_flags, we need to try again with the mmap
lock held if we fail a page lookup.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg: Use g_free_rcu for user-exec interval trees
Richard Henderson [Sat, 24 Dec 2022 13:06:29 +0000 (05:06 -0800)]
accel/tcg: Use g_free_rcu for user-exec interval trees

Because we allow lockless lookups, we have to be careful
when it is freed.  Use rcu to delay the free until safe.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg: Fix tb_invalidate_phys_page_unwind
Richard Henderson [Sat, 24 Dec 2022 12:35:22 +0000 (04:35 -0800)]
accel/tcg: Fix tb_invalidate_phys_page_unwind

When called from syscall(), we are not within a TB and pc == 0.
We can skip the check for invalidating the current TB.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Add TCGHelperInfo argument to tcg_out_call
Richard Henderson [Tue, 18 Oct 2022 07:51:41 +0000 (17:51 +1000)]
tcg: Add TCGHelperInfo argument to tcg_out_call

This eliminates an ifdef for TCI, and will be required for
expanding the call for TCGv_i128.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg/aarch64: Merge tcg_out_callr into tcg_out_call
Richard Henderson [Thu, 3 Nov 2022 05:39:56 +0000 (05:39 +0000)]
tcg/aarch64: Merge tcg_out_callr into tcg_out_call

There is only one use, and BLR is perhaps even more
self-documentary than CALLR.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Move ffi_cif pointer into TCGHelperInfo
Richard Henderson [Tue, 22 Nov 2022 18:08:04 +0000 (19:08 +0100)]
tcg: Move ffi_cif pointer into TCGHelperInfo

Instead of requiring a separate hash table lookup,
put a pointer to the CIF into TCGHelperInfo.

Signed-off-by: Richard Henderson <[email protected]>
Message-Id: <20221111074101.2069454[email protected]>
[PMD: Split from bigger patch]
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20221122180804[email protected]>

2 years agotcg: Factor init_ffi_layouts() out of tcg_context_init()
Philippe Mathieu-Daudé [Tue, 22 Nov 2022 18:08:03 +0000 (19:08 +0100)]
tcg: Factor init_ffi_layouts() out of tcg_context_init()

Signed-off-by: Richard Henderson <[email protected]>
Message-Id: <20221111074101.2069454[email protected]>
[PMD: Split from bigger patch]
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20221122180804[email protected]>

2 years agotcg: Convert typecode_to_ffi from array to function
Philippe Mathieu-Daudé [Tue, 22 Nov 2022 18:08:02 +0000 (19:08 +0100)]
tcg: Convert typecode_to_ffi from array to function

In the unlikely case of invalid typecode mask, the function
will abort instead of returning a NULL pointer.

Signed-off-by: Richard Henderson <[email protected]>
Message-Id: <20221111074101.2069454[email protected]>
[PMD: Split from bigger patch]
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20221122180804[email protected]>

2 years agotcg: Reorg function calls
Richard Henderson [Fri, 11 Nov 2022 00:09:37 +0000 (10:09 +1000)]
tcg: Reorg function calls

Pre-compute the function call layout for each helper at startup.
Drop TCG_CALL_DUMMY_ARG, as we no longer need to leave gaps
in the op->args[] array.  This allows several places to stop
checking for NULL TCGTemp, to which TCG_CALL_DUMMY_ARG mapped.

For tcg_gen_callN, loop over the arguments once.  Allocate the TCGOp
for the call early but delay emitting it, collecting arguments first.
This allows the argument processing loop to emit code for extensions
and have them sequenced before the call.

For tcg_reg_alloc_call, loop over the arguments in reverse order,
which allows stack slots to be filled first naturally.

Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Use output_pref wrapper function
Richard Henderson [Fri, 11 Nov 2022 05:10:51 +0000 (15:10 +1000)]
tcg: Use output_pref wrapper function

We will shortly have the possibility of more that two outputs,
though only for calls (for which preferences are moot).  Avoid
direct references to op->output_pref[] when possible.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Vary the allocation size for TCGOp
Richard Henderson [Sun, 18 Dec 2022 21:18:32 +0000 (22:18 +0100)]
tcg: Vary the allocation size for TCGOp

We have been allocating a worst case number of arguments
to support calls.  Instead, allow the size to vary.
By default leave space for 4 args, to maximize reuse,
but allow calls to increase the number of args to 32.

Signed-off-by: Richard Henderson <[email protected]>
[PMD: Split patch in two]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20221218211832[email protected]>

2 years agotcg: Pass number of arguments to tcg_emit_op() / tcg_op_insert_*()
Philippe Mathieu-Daudé [Sun, 18 Dec 2022 21:18:31 +0000 (22:18 +0100)]
tcg: Pass number of arguments to tcg_emit_op() / tcg_op_insert_*()

In order to have variable size allocated TCGOp, pass the number
of arguments we use (and would allocate) up to tcg_op_alloc().

This alters tcg_emit_op(), tcg_op_insert_before() and
tcg_op_insert_after() prototypes.

In tcg_op_alloc() ensure the number of arguments is in range.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
[PMD: Extracted from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20221218211832[email protected]>

2 years agoaccel/tcg/plugin: Use copy_op in append_{udata,mem}_cb
Richard Henderson [Thu, 10 Nov 2022 13:18:52 +0000 (23:18 +1000)]
accel/tcg/plugin: Use copy_op in append_{udata,mem}_cb

Better to re-use the existing function for copying ops.

Acked-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg/plugin: Avoid duplicate copy in copy_call
Richard Henderson [Thu, 10 Nov 2022 13:16:36 +0000 (23:16 +1000)]
accel/tcg/plugin: Avoid duplicate copy in copy_call

We copied all of the arguments in copy_op_nocheck.
We only need to replace the one argument that we change.

Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg/plugin: Don't search for the function pointer index
Richard Henderson [Thu, 10 Nov 2022 12:58:57 +0000 (22:58 +1000)]
accel/tcg/plugin: Don't search for the function pointer index

The function pointer is immediately after the output and input
operands; no need to search.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Use TCG_CALL_ARG_EVEN for TCI special case
Richard Henderson [Mon, 17 Oct 2022 05:55:56 +0000 (15:55 +1000)]
tcg: Use TCG_CALL_ARG_EVEN for TCI special case

Change 32-bit tci TCG_TARGET_CALL_ARG_I32 to TCG_CALL_ARG_EVEN, to
force 32-bit values to be aligned to 64-bit.  With a small reorg
to the argument processing loop, this neatly replaces an ifdef for
CONFIG_TCG_INTERPRETER.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Replace TCG_TARGET_EXTEND_ARGS with TCG_TARGET_CALL_ARG_I32
Richard Henderson [Sun, 16 Oct 2022 10:07:48 +0000 (20:07 +1000)]
tcg: Replace TCG_TARGET_EXTEND_ARGS with TCG_TARGET_CALL_ARG_I32

For 64-bit hosts that had TCG_TARGET_EXTEND_ARGS, set
TCG_TARGET_CALL_ARG_I32 to TCG_CALL_ARG_EXTEND.
Otherwise, use TCG_CALL_ARG_NORMAL.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Replace TCG_TARGET_CALL_ALIGN_ARGS with TCG_TARGET_CALL_ARG_I64
Richard Henderson [Sun, 16 Oct 2022 02:48:48 +0000 (13:48 +1100)]
tcg: Replace TCG_TARGET_CALL_ALIGN_ARGS with TCG_TARGET_CALL_ARG_I64

For 32-bit hosts when TCG_TARGET_CALL_ALIGN_ARGS was set, use
TCG_CALL_ARG_EVEN.  For 64-bit hosts, TCG_TARGET_CALL_ALIGN_ARGS
was silently ignored, so always use TCG_CALL_ARG_NORMAL.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Introduce TCGCallReturnKind and TCGCallArgumentKind
Richard Henderson [Sun, 16 Oct 2022 02:47:00 +0000 (13:47 +1100)]
tcg: Introduce TCGCallReturnKind and TCGCallArgumentKind

Prepare to replace a bunch of separate ifdefs with a
consistent way to describe the ABI of a function call.

Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Introduce tcg_type_size
Richard Henderson [Wed, 19 Oct 2022 02:41:15 +0000 (12:41 +1000)]
tcg: Introduce tcg_type_size

Add a helper function for computing the size of a type.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Move TCG_TYPE_COUNT outside enum
Richard Henderson [Wed, 19 Oct 2022 02:24:37 +0000 (12:24 +1000)]
tcg: Move TCG_TYPE_COUNT outside enum

The count is not itself an enumerator.  Move it outside to
prevent the compiler from considering it with -Wswitch-enum.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Allocate TCGTemp pairs in host memory order
Richard Henderson [Wed, 19 Oct 2022 01:53:27 +0000 (11:53 +1000)]
tcg: Allocate TCGTemp pairs in host memory order

Allocate the first of a pair at the lower address, and the
second of a pair at the higher address.  This will make it
easier to find the beginning of the larger memory block.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Simplify calls to temp_sync vs mem_coherent
Richard Henderson [Fri, 21 Oct 2022 01:00:35 +0000 (11:00 +1000)]
tcg: Simplify calls to temp_sync vs mem_coherent

The first thing that temp_sync does is check mem_coherent,
so there's no need for the caller to do so.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Add temp_subindex to TCGTemp
Richard Henderson [Wed, 19 Oct 2022 01:26:37 +0000 (11:26 +1000)]
tcg: Add temp_subindex to TCGTemp

Record the location of a TCGTemp within a larger object.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Move TCG_{LOW,HIGH} to tcg-internal.h
Richard Henderson [Mon, 17 Oct 2022 01:07:39 +0000 (11:07 +1000)]
tcg: Move TCG_{LOW,HIGH} to tcg-internal.h

Move the error-generating fallback from tcg-op.c, and
replace "_link_error" with modern QEMU_ERROR markup.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotarget/sparc: Avoid TCGV_{LOW,HIGH}
Richard Henderson [Mon, 17 Oct 2022 00:57:03 +0000 (10:57 +1000)]
target/sparc: Avoid TCGV_{LOW,HIGH}

Use the official extend/extract functions instead of routines
that will shortly be internal to tcg.

Cc: Mark Cave-Ayland <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg: Set cflags_next_tb in cpu_common_initfn
Richard Henderson [Wed, 19 Oct 2022 10:33:28 +0000 (20:33 +1000)]
accel/tcg: Set cflags_next_tb in cpu_common_initfn

While we initialize this value in cpu_common_reset, that
isn't called during startup, so set it as well in init.
This fixes -singlestep versus the very first TB.

Fixes: 04f5b647ed07 ("accel/tcg: Handle -singlestep in curr_cflags")
Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Introduce paired register allocation
Richard Henderson [Thu, 13 Oct 2022 20:37:38 +0000 (07:37 +1100)]
tcg: Introduce paired register allocation

There are several instances where we need to be able to
allocate a pair of registers to related inputs/outputs.
Add 'p' and 'm' register constraints for this, in order to
be able to allocate the even/odd register first or second.

Signed-off-by: Richard Henderson <[email protected]>
2 years agoUpdate scripts/meson-buildoptions.sh
Alessandro Di Federico [Mon, 2 Jan 2023 10:41:13 +0000 (11:41 +0100)]
Update scripts/meson-buildoptions.sh

Note: `Makefile` relies on modification dates in the source tree to
detect changes to `meson_options.txt`. However, git does not track
those. Therefore, the following was necessary to regenerate
`meson-buildoptions.sh`:

    touch meson_options.txt
    cd "$BUILD_DIR"
    make update-buildoptions

Signed-off-by: Alessandro Di Federico <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Message-Id: <20230102104113.3438895[email protected]>

2 years agoHexagon (target/hexagon) implement mutability mask for GPRs
Marco Liebel [Thu, 5 Jan 2023 10:23:49 +0000 (02:23 -0800)]
Hexagon (target/hexagon) implement mutability mask for GPRs

Some registers are defined to have immutable bits, this commit
will implement that behavior.

Signed-off-by: Marco Liebel <[email protected]>
Reviewed-by: Taylor Simpson <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Message-Id: <20230105102349.2181856[email protected]>

2 years agotarget/hexagon: suppress unused variable warning
Alessandro Di Federico [Wed, 21 Dec 2022 15:53:27 +0000 (16:53 +0100)]
target/hexagon: suppress unused variable warning

This patch manually suppresses a warning for an unused variable
(yynerrs) emitted by bison.

This warning has been triggered for the first time by clang 15.

This patch also disables `-Wextra`, which is not usually adopted in
QEMU. However, clang 15 triggers the warning fixed in this patch even in
absence of `-Wextra`.

Signed-off-by: Alessandro Di Federico <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Taylor Simpson <[email protected]>
Tested-by: Taylor Simpson <[email protected]>
Message-Id: <20221221155327.1504117[email protected]>

2 years agotarget/hexagon/idef-parser: fix two typos in README
Matheus Tavares Bernardino [Tue, 27 Dec 2022 20:49:04 +0000 (17:49 -0300)]
target/hexagon/idef-parser: fix two typos in README

Signed-off-by: Matheus Tavares Bernardino <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Reviewed-by: Alessandro Di Federico <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <fe67371e03f9dde38eb7554937da0a96a230730e.1672174122[email protected]>

2 years agotests/tcg/hexagon: fix underspecifed asm constraints
Mukilan Thiyagarajan [Thu, 29 Dec 2022 08:18:36 +0000 (13:48 +0530)]
tests/tcg/hexagon: fix underspecifed asm constraints

There are two test cases where the inline asm doesn't
have the correct constraints causing them to fail.

In misc.c, the 'result' output needs the early clobber
modifier since the rest of the inputs are read after
assignment to the output register.

In mem_noshuf.c, the register r7 is written to but
not specified in the clobber list.

Signed-off-by: Mukilan Thiyagarajan <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Reviewed-by: Taylor Simpson <[email protected]>
Message-Id: <20221229081836[email protected]>

2 years agotarget/hexagon: rename aliased register HEX_REG_P3_0
Mukilan Thiyagarajan [Thu, 29 Dec 2022 09:20:06 +0000 (14:50 +0530)]
target/hexagon: rename aliased register HEX_REG_P3_0

The patch renames the identifier of the 32bit register
HEX_REG_P3_0 to HEX_REG_P3_0_ALIASED.

This change is to intended to provide some warning that
HEX_REG_P3_0 is an aliased register which has multiple
representations in CPU state and therefore might require
special handling in some contexts. The hope is to prevent
accidental misuse of this register e.g the issue reported
for the signals tests failure [here][1].

[1]: https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg01102.html

Signed-off-by: Mukilan Thiyagarajan <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Reviewed-by: Taylor Simpson <[email protected]>
Message-Id: <20221229092006[email protected]>

2 years agolinux-user/hexagon: fix signal context save & restore
Mukilan Thiyagarajan [Thu, 29 Dec 2022 09:20:05 +0000 (14:50 +0530)]
linux-user/hexagon: fix signal context save & restore

This patch fixes the issue originally reported in
this thread:

https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg01102.html

The root cause of the issue is a bug in the hexagon specific
logic for saving & restoring context during signal delivery.
The CPU state has two different representations for the
predicate registers. The current logic saves & restores only
the aliased HEX_REG_P3_O register, which is part of env->gpr[]
field in the CPU state, but not the individual byte-level
predicate registers (pO, p1, p2, p3) backed by env->pred[].

Since all predicated instructions refer only to the
indiviual registers, switching to and back from a signal handler
can clobber these registers if the signal handler writes to them
causing the normal application code to behave unpredictably when
context is restored.

In the reported issue with the 'signals' test, since the updated
hexagon toolchain had built musl with -O2, the functions called
from non_trivial_free were inlined. This meant that the code
emitted reused predicate P0 computed in the entry translation
block of the function non_trivial_free in one of the child TB
as part of an assertion. Since P0 is clobbered by the signal
handler in the signals test, the assertion in non_trivial_free
fails incorectly. Since musl for hexagon implements the 'abort'
function by deliberately writing to memory via null pointer,
this causes the test to fail with segmentation fault.

This patch modifies the signal context save & restore logic
to include the individual p0, p1, p2, p3 and excludes the
32b p3_0 register since its value is derived from the former
registers. It also adds a new test case that reliabily
reproduces the issue for all four predicate registers.

Buglink: https://github.com/quic/toolchain_for_hexagon/issues/6
Signed-off-by: Mukilan Thiyagarajan <[email protected]>
Signed-off-by: Taylor Simpson <[email protected]>
Reviewed-by: Taylor Simpson <[email protected]>
Message-Id: <20221229092006[email protected]>

2 years agoMerge tag 'python-pull-request' of https://gitlab.com/jsnow/qemu into staging
Peter Maydell [Thu, 5 Jan 2023 16:59:22 +0000 (16:59 +0000)]
Merge tag 'python-pull-request' of https://gitlab.com/jsnow/qemu into staging

Python patch roundup

Mostly CI fixes and some small debugging improvements.

# gpg: Signature made Wed 04 Jan 2023 21:04:26 GMT
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <[email protected]>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* tag 'python-pull-request' of https://gitlab.com/jsnow/qemu:
  python: add 3.11 to supported list
  iotests/check: Fix typing for sys.exit() value
  Python: fix flake8 config
  python/machine: Handle termination cases without QMP
  python/machine: Add debug logging to key state changes

Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/net: Fix read of uninitialized memory in imx_fec.
Stephen Longfield [Wed, 21 Dec 2022 18:32:02 +0000 (10:32 -0800)]
hw/net: Fix read of uninitialized memory in imx_fec.

Size is used at lines 1088/1188 for the loop, which reads the last 4
bytes from the crc_ptr so it does need to get increased, however it
shouldn't be increased before the buffer is passed to CRC computation,
or the crc32 function will access uninitialized memory.

This was pointed out to me by [email protected] during the code review of
a similar patch to hw/net/ftgmac100.c

Change-Id: Ib0464303b191af1e28abeb2f5105eb25aadb5e9b
Signed-off-by: Stephen Longfield <[email protected]>
Reviewed-by: Patrick Venture <[email protected]>
Message-id: 20221221183202.3788132[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agoi.MX7D: Connect IRQs to GPIO devices.
Jean-Christophe Dubois [Mon, 26 Dec 2022 10:14:18 +0000 (11:14 +0100)]
i.MX7D: Connect IRQs to GPIO devices.

IRQs were not associated to the various GPIO devices inside i.MX7D.
This patch brings the i.MX7D on par with i.MX6.

Signed-off-by: Jean-Christophe Dubois <[email protected]>
Message-id: 20221226101418[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agoi.MX6UL: Add a specific GPT timer instance for the i.MX6UL
Jean-Christophe Dubois [Tue, 20 Dec 2022 17:27:43 +0000 (18:27 +0100)]
i.MX6UL: Add a specific GPT timer instance for the i.MX6UL

The i.MX6UL doesn't support CLK_HIGH ou CLK_HIGH_DIV clock source.

Signed-off-by: Jean-Christophe Dubois <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agoi.MX7D: Compute clock frequency for the fixed frequency clocks.
Jean-Christophe Dubois [Tue, 20 Dec 2022 17:27:39 +0000 (18:27 +0100)]
i.MX7D: Compute clock frequency for the fixed frequency clocks.

CCM derived clocks will have to be added later.

Signed-off-by: Jean-Christophe Dubois <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agoi.MX7D: Connect GPT timers to IRQ
Jean-Christophe Dubois [Tue, 20 Dec 2022 17:27:30 +0000 (18:27 +0100)]
i.MX7D: Connect GPT timers to IRQ

So far the GPT timers were unable to raise IRQs to the processor.

Signed-off-by: Jean-Christophe Dubois <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/arm/smmu-common: Avoid using inlined functions with external linkage
Philippe Mathieu-Daudé [Fri, 16 Dec 2022 21:49:24 +0000 (22:49 +0100)]
hw/arm/smmu-common: Avoid using inlined functions with external linkage

When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)")
and building with -Wall we get:

  hw/arm/smmu-common.c:173:33: warning: static function 'smmu_hash_remove_by_asid_iova' is used in an inline function with external linkage [-Wstatic-in-inline]
  hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage
    void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
    ^
    static

None of our code base require / use inlined functions with external
linkage. Some places use internal inlining in the hot path. These
two functions are certainly not in any hot path and don't justify
any inlining, so these are likely oversights rather than intentional.

Reported-by: Stefan Weil <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Message-id: 20221216214924[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
Philippe Mathieu-Daudé [Fri, 16 Dec 2022 21:49:23 +0000 (22:49 +0100)]
hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope

This function is not used anywhere outside this file,
so we can make the function "static void".

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Message-id: 20221216214924[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: align exposed ID registers with Linux
Zhuojia Shen [Sat, 17 Dec 2022 01:01:26 +0000 (17:01 -0800)]
target/arm: align exposed ID registers with Linux

In CPUID registers exposed to userspace, some registers were missing
and some fields were not exposed.  This patch aligns exposed ID
registers and their fields with what the upstream kernel currently
exposes.

Specifically, the following new ID registers/fields are exposed to
userspace:

ID_AA64PFR1_EL1.BT:       bits 3-0
ID_AA64PFR1_EL1.MTE:      bits 11-8
ID_AA64PFR1_EL1.SME:      bits 27-24

ID_AA64ZFR0_EL1.SVEver:   bits 3-0
ID_AA64ZFR0_EL1.AES:      bits 7-4
ID_AA64ZFR0_EL1.BitPerm:  bits 19-16
ID_AA64ZFR0_EL1.BF16:     bits 23-20
ID_AA64ZFR0_EL1.SHA3:     bits 35-32
ID_AA64ZFR0_EL1.SM4:      bits 43-40
ID_AA64ZFR0_EL1.I8MM:     bits 47-44
ID_AA64ZFR0_EL1.F32MM:    bits 55-52
ID_AA64ZFR0_EL1.F64MM:    bits 59-56

ID_AA64SMFR0_EL1.F32F32:  bit 32
ID_AA64SMFR0_EL1.B16F32:  bit 34
ID_AA64SMFR0_EL1.F16F32:  bit 35
ID_AA64SMFR0_EL1.I8I32:   bits 39-36
ID_AA64SMFR0_EL1.F64F64:  bit 48
ID_AA64SMFR0_EL1.I16I64:  bits 55-52
ID_AA64SMFR0_EL1.FA64:    bit 63

ID_AA64MMFR0_EL1.ECV:     bits 63-60

ID_AA64MMFR1_EL1.AFP:     bits 47-44

ID_AA64MMFR2_EL1.AT:      bits 35-32

ID_AA64ISAR0_EL1.RNDR:    bits 63-60

ID_AA64ISAR1_EL1.FRINTTS: bits 35-32
ID_AA64ISAR1_EL1.BF16:    bits 47-44
ID_AA64ISAR1_EL1.DGH:     bits 51-48
ID_AA64ISAR1_EL1.I8MM:    bits 55-52

ID_AA64ISAR2_EL1.WFxT:    bits 3-0
ID_AA64ISAR2_EL1.RPRES:   bits 7-4
ID_AA64ISAR2_EL1.GPA3:    bits 11-8
ID_AA64ISAR2_EL1.APA3:    bits 15-12

The code is also refactored to use symbolic names for ID register fields
for better readability and maintainability.

The test case in tests/tcg/aarch64/sysregs.c is also updated to match
the intended behavior.

Signed-off-by: Zhuojia Shen <[email protected]>
Message-id: DS7PR12MB6309FB585E10772928F14271ACE79@DS7PR12MB6309.namprd12.prod.outlook.com
Reviewed-by: Peter Maydell <[email protected]>
[PMM: use Sn_n_Cn_Cn_n syntax to work with older assemblers
that don't recognize id_aa64isar2_el1 and id_aa64mmfr2_el1]
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/arm/nseries: Silent -Wmissing-field-initializers warning
Philippe Mathieu-Daudé [Tue, 20 Dec 2022 14:25:20 +0000 (15:25 +0100)]
hw/arm/nseries: Silent -Wmissing-field-initializers warning

Silent when compiling with -Wextra:

  ../hw/arm/nseries.c:1081:12: warning: missing field 'line' initializer [-Wmissing-field-initializers]
      { NULL }
             ^

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20221220142520[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/arm/nseries: Constify various read-only arrays
Philippe Mathieu-Daudé [Tue, 20 Dec 2022 14:25:19 +0000 (15:25 +0100)]
hw/arm/nseries: Constify various read-only arrays

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20221220142520[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/input/tsc2xxx: Constify set_transform()'s MouseTransformInfo arg
Philippe Mathieu-Daudé [Tue, 20 Dec 2022 14:25:18 +0000 (15:25 +0100)]
hw/input/tsc2xxx: Constify set_transform()'s MouseTransformInfo arg

The pointed MouseTransformInfo structure is accessed read-only.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20221220142520[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agoMerge tag 'mem-2023-01-02' of https://github.com/davidhildenbrand/qemu into staging
Peter Maydell [Thu, 5 Jan 2023 14:05:21 +0000 (14:05 +0000)]
Merge tag 'mem-2023-01-02' of https://github.com/davidhildenbrand/qemu into staging

Hi,

"Host Memory Backends" and "Memory devices" queue ("mem"):
- virtio-mem fixes
- Use new MPOL_PREFERRED_MANY mbind() policy for memory backends if
  possible

# gpg: Signature made Mon 02 Jan 2023 11:22:04 GMT
# gpg:                using RSA key 1BD9CAAD735C4C3A460DFCCA4DDE10F700FF835A
# gpg:                issuer "[email protected]"
# gpg: Good signature from "David Hildenbrand <[email protected]>" [marginal]
# gpg:                 aka "David Hildenbrand <[email protected]>" [full]
# gpg:                 aka "David Hildenbrand <[email protected]>" [unknown]
# Primary key fingerprint: 1BD9 CAAD 735C 4C3A 460D  FCCA 4DDE 10F7 00FF 835A

* tag 'mem-2023-01-02' of https://github.com/davidhildenbrand/qemu:
  hostmem: Honor multiple preferred nodes if possible
  virtio-mem: Fix typo in function name
  virtio-mem: Fix the iterator variable in a vmem->rdl_list loop
  virtio-mem: Fix the bitmap index of the section offset

Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: cleanup cpu includes
Claudio Fontana [Tue, 13 Dec 2022 19:05:37 +0000 (16:05 -0300)]
target/arm: cleanup cpu includes

Remove some unused headers.

Signed-off-by: Claudio Fontana <[email protected]>
Acked-by: Richard Henderson <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Signed-off-by: Fabiano Rosas <[email protected]>
Message-id: 20221213190537[email protected]
[added back some includes that are still needed at this point]
Signed-off-by: Fabiano Rosas <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Remove unused includes from helper.c
Fabiano Rosas [Tue, 13 Dec 2022 19:05:36 +0000 (16:05 -0300)]
target/arm: Remove unused includes from helper.c

Signed-off-by: Fabiano Rosas <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-id: 20221213190537[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Remove unused includes from m_helper.c
Fabiano Rosas [Tue, 13 Dec 2022 19:05:35 +0000 (16:05 -0300)]
target/arm: Remove unused includes from m_helper.c

Signed-off-by: Fabiano Rosas <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-id: 20221213190537[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Fix checkpatch brace errors in helper.c
Fabiano Rosas [Tue, 13 Dec 2022 19:05:34 +0000 (16:05 -0300)]
target/arm: Fix checkpatch brace errors in helper.c

Fix this:
ERROR: braces {} are necessary for all arms of this statement

Signed-off-by: Fabiano Rosas <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-id: 20221213190537[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Fix checkpatch space errors in helper.c
Fabiano Rosas [Tue, 13 Dec 2022 19:05:33 +0000 (16:05 -0300)]
target/arm: Fix checkpatch space errors in helper.c

Fix the following:

ERROR: spaces required around that '|' (ctx:VxV)
ERROR: space required before the open parenthesis '('
ERROR: spaces required around that '+' (ctx:VxB)
ERROR: space prohibited between function name and open parenthesis '('

(the last two still have some occurrences in macros which I left
behind because it might impact readability)

Signed-off-by: Fabiano Rosas <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-id: 20221213190537[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Fix checkpatch comment style warnings in helper.c
Fabiano Rosas [Tue, 13 Dec 2022 19:05:32 +0000 (16:05 -0300)]
target/arm: Fix checkpatch comment style warnings in helper.c

Fix these:

WARNING: Block comments use a leading /* on a separate line
WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Fabiano Rosas <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Message-id: 20221213190537[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: fix compare timer handling
Axel Heider [Sun, 20 Nov 2022 19:05:25 +0000 (20:05 +0100)]
hw/timer/imx_epit: fix compare timer handling

- fix #1263 for CR writes
- rework compare time handling
  - The compare timer has to run even if CR.OCIEN is not set,
    as SR.OCIF must be updated.
  - The compare timer fires exactly once when the
    compare value is less than the current value, but the
    reload values is less than the compare value.
  - The compare timer will never fire if the reload value is
    less than the compare value. Disable it in this case.

Signed-off-by: Axel Heider <[email protected]>
[PMM: fixed minor style nits]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: remove explicit fields cnt and freq
Axel Heider [Tue, 25 Oct 2022 10:33:42 +0000 (12:33 +0200)]
hw/timer/imx_epit: remove explicit fields cnt and freq

The CNT register is a read-only register. There is no need to
store it's value, it can be calculated on demand.
The calculated frequency is needed temporarily only.

Note that this is a migration compatibility break for all boards
types that use the EPIT peripheral.

Signed-off-by: Axel Heider <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: factor out register write handlers
Axel Heider [Thu, 27 Oct 2022 13:09:58 +0000 (15:09 +0200)]
hw/timer/imx_epit: factor out register write handlers

Signed-off-by: Axel Heider <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: hard reset initializes CR with 0
Axel Heider [Sat, 19 Nov 2022 16:09:59 +0000 (17:09 +0100)]
hw/timer/imx_epit: hard reset initializes CR with 0

Signed-off-by: Axel Heider <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: update interrupt state on CR write access
Axel Heider [Tue, 25 Oct 2022 18:32:30 +0000 (20:32 +0200)]
hw/timer/imx_epit: update interrupt state on CR write access

The interrupt state can change due to:
- reset clears both SR.OCIF and CR.OCIE
- write to CR.EN or CR.OCIE

Signed-off-by: Axel Heider <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: define SR_OCIF
Axel Heider [Sat, 19 Nov 2022 14:59:40 +0000 (15:59 +0100)]
hw/timer/imx_epit: define SR_OCIF

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: cleanup CR defines
Axel Heider [Sun, 30 Oct 2022 23:59:29 +0000 (00:59 +0100)]
hw/timer/imx_epit: cleanup CR defines

remove unused defines, add needed defines

Signed-off-by: Axel Heider <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agohw/timer/imx_epit: improve comments
Axel Heider [Tue, 25 Oct 2022 15:33:43 +0000 (17:33 +0200)]
hw/timer/imx_epit: improve comments

Fix typos, add background information

Signed-off-by: Axel Heider <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: fix handling of HLT semihosting in system mode
Alex Bennée [Thu, 5 Jan 2023 11:43:04 +0000 (11:43 +0000)]
target/arm: fix handling of HLT semihosting in system mode

The check semihosting_enabled() wants to know if the guest is
currently in user mode. Unlike the other cases the test was inverted
causing us to block semihosting calls in non-EL0 modes.

Cc: [email protected]
Fixes: 19b26317e9 (target/arm: Honour -semihosting-config userspace=on)
Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Add ARM Cortex-R52 CPU
Tobias Röhmel [Tue, 6 Dec 2022 10:25:04 +0000 (11:25 +0100)]
target/arm: Add ARM Cortex-R52 CPU

All constants are taken from the ARM Cortex-R52 Processor TRM Revision: r1p3

Signed-off-by: Tobias Röhmel <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Add PMSAv8r functionality
Tobias Röhmel [Tue, 6 Dec 2022 10:25:03 +0000 (11:25 +0100)]
target/arm: Add PMSAv8r functionality

Add PMSAv8r translation.

Signed-off-by: Tobias Röhmel <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Add PMSAv8r registers
Tobias Röhmel [Tue, 6 Dec 2022 10:25:02 +0000 (11:25 +0100)]
target/arm: Add PMSAv8r registers

Signed-off-by: Tobias Röhmel <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Enable TTBCR_EAE for ARMv8-R AArch32
Tobias Röhmel [Tue, 6 Dec 2022 10:25:01 +0000 (11:25 +0100)]
target/arm: Enable TTBCR_EAE for ARMv8-R AArch32

ARMv8-R AArch32 CPUs behave as if TTBCR.EAE is always 1 even
tough they don't have the TTBCR register.
See ARM Architecture Reference Manual Supplement - ARMv8, for the ARMv8-R
AArch32 architecture profile Version:A.c section C1.2.

Signed-off-by: Tobias Röhmel <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Make stage_2_format for cache attributes optional
Tobias Röhmel [Tue, 6 Dec 2022 10:25:00 +0000 (11:25 +0100)]
target/arm: Make stage_2_format for cache attributes optional

The v8R PMSAv8 has a two-stage MPU translation process, but, unlike
VMSAv8, the stage 2 attributes are in the same format as the stage 1
attributes (8-bit MAIR format). Rather than converting the MAIR
format to the format used for VMSA stage 2 (bits [5:2] of a VMSA
stage 2 descriptor) and then converting back to do the attribute
combination, allow combined_attrs_nofwb() to accept s2 attributes
that are already in the MAIR format.

We move the assert() to combined_attrs_fwb(), because that function
really does require a VMSA stage 2 attribute format. (We will never
get there for v8R, because PMSAv8 does not implement FEAT_S2FWB.)

Signed-off-by: Tobias Röhmel <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Make RVBAR available for all ARMv8 CPUs
Tobias Röhmel [Tue, 6 Dec 2022 10:24:59 +0000 (11:24 +0100)]
target/arm: Make RVBAR available for all ARMv8 CPUs

RVBAR shadows RVBAR_ELx where x is the highest exception
level if the highest EL is not EL3. This patch also allows
ARMv8 CPUs to change the reset address with
the rvbar property.

Signed-off-by: Tobias Röhmel <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm: Don't add all MIDR aliases for cores that implement PMSA
Tobias Röhmel [Tue, 6 Dec 2022 10:24:58 +0000 (11:24 +0100)]
target/arm: Don't add all MIDR aliases for cores that implement PMSA

Cores with PMSA have the MPUIR register which has the
same encoding as the MIDR alias with opc2=4. So we only
add that alias if we are not realizing a core that
implements PMSA.

Signed-off-by: Tobias Röhmel <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20221206102504[email protected]
Signed-off-by: Peter Maydell <[email protected]>
2 years agotarget/arm:Set lg_page_size to 0 if either S1 or S2 asks for it
Peter Maydell [Mon, 12 Dec 2022 14:27:08 +0000 (14:27 +0000)]
target/arm:Set lg_page_size to 0 if either S1 or S2 asks for it

In get_phys_addr_twostage() we set the lg_page_size of the result to
the maximum of the stage 1 and stage 2 page sizes.  This works for
the case where we do want to create a TLB entry, because we know the
common TLB code only creates entries of the TARGET_PAGE_SIZE and
asking for a size larger than that only means that invalidations
invalidate the whole larger area.  However, if lg_page_size is
smaller than TARGET_PAGE_SIZE this effectively means "don't create a
TLB entry"; in this case if either S1 or S2 said "this covers less
than a page and can't go in a TLB" then the final result also should
be marked that way.  Set the resulting page size to 0 if either
stage asked for a less-than-a-page entry, and expand the comment
to explain what's going on.

This has no effect for VMSA because currently the VMSA lookup always
returns results that cover at least TARGET_PAGE_SIZE; however when we
add v8R support it will reuse this code path, and for v8R the S1 and
S2 results can be smaller than TARGET_PAGE_SIZE.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20221212142708[email protected]

2 years agotcg: Massage process_op_defs()
Philippe Mathieu-Daudé [Mon, 19 Dec 2022 22:09:23 +0000 (23:09 +0100)]
tcg: Massage process_op_defs()

In preparation of introducing paired registers,
massage a bit process_op_defs()'s switch case.

Signed-off-by: Richard Henderson <[email protected]>
[PMD: Split from bigger patch, 1/3]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20221219220925[email protected]>

2 years agotcg: Remove check_regs
Richard Henderson [Thu, 1 Dec 2022 17:12:36 +0000 (09:12 -0800)]
tcg: Remove check_regs

We now check the consistency of reg_to_temp[] with each update,
so the utility of checking consistency at the end of each
opcode is minimal.  In addition, the form of this check is
quite expensive, consuming 10% of a checking-enabled build.

Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Centralize updates to reg_to_temp
Richard Henderson [Thu, 1 Dec 2022 09:05:05 +0000 (01:05 -0800)]
tcg: Centralize updates to reg_to_temp

Create two new functions, set_temp_val_{reg,nonreg}.
Assert that the reg_to_temp mapping is correct before
any changes are made.

Reviewed-by: Alex Bennée <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Fix tcg_reg_alloc_dup*
Richard Henderson [Thu, 1 Dec 2022 08:44:13 +0000 (00:44 -0800)]
tcg: Fix tcg_reg_alloc_dup*

The assignment to mem_coherent should be done with any
modification, not simply with a newly allocated register.

Signed-off-by: Richard Henderson <[email protected]>
2 years agotci: MAX_OPC_PARAM_IARGS is no longer used
Richard Henderson [Thu, 10 Nov 2022 13:29:47 +0000 (23:29 +1000)]
tci: MAX_OPC_PARAM_IARGS is no longer used

Unused since commit 7b7d8b2d9a ("tcg/tci: Use ffi for calls").

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Remove TCG_TARGET_STACK_GROWSUP
Richard Henderson [Sun, 16 Oct 2022 12:05:14 +0000 (22:05 +1000)]
tcg: Remove TCG_TARGET_STACK_GROWSUP

The hppa host code has been removed since 2013; this
should have been deleted at the same time.

Fixes: 802b5081233a ("tcg-hppa: Remove tcg backend")
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Tidy tcg_reg_alloc_op
Richard Henderson [Mon, 10 Oct 2022 04:06:31 +0000 (21:06 -0700)]
tcg: Tidy tcg_reg_alloc_op

Replace goto allocate_in_reg with a boolean.
Remove o_preferred_regs which isn't used, except to copy.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoaccel/tcg: Use QEMU_IOTHREAD_LOCK_GUARD in io_readx/io_writex
Richard Henderson [Fri, 18 Nov 2022 03:59:16 +0000 (19:59 -0800)]
accel/tcg: Use QEMU_IOTHREAD_LOCK_GUARD in io_readx/io_writex

Narrow the scope of the lock to the actual read/write,
moving the cpu_transation_failed call outside the lock.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agohw/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_set_irq
Richard Henderson [Fri, 18 Nov 2022 03:17:18 +0000 (19:17 -0800)]
hw/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_set_irq

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotarget/riscv: Use QEMU_IOTHREAD_LOCK_GUARD in riscv_cpu_update_mip
Richard Henderson [Fri, 18 Nov 2022 03:15:31 +0000 (19:15 -0800)]
target/riscv: Use QEMU_IOTHREAD_LOCK_GUARD in riscv_cpu_update_mip

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotarget/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_interrupt_exittb
Richard Henderson [Fri, 18 Nov 2022 03:11:26 +0000 (19:11 -0800)]
target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_interrupt_exittb

In addition, use tcg_enabled instead of !kvm_enabled.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotarget/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_maybe_interrupt
Richard Henderson [Fri, 18 Nov 2022 03:07:11 +0000 (19:07 -0800)]
target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_maybe_interrupt

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agohw/mips: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_mips_irq_request
Richard Henderson [Fri, 18 Nov 2022 03:00:22 +0000 (19:00 -0800)]
hw/mips: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_mips_irq_request

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agoqemu/main-loop: Introduce QEMU_IOTHREAD_LOCK_GUARD
Richard Henderson [Fri, 18 Nov 2022 02:51:43 +0000 (18:51 -0800)]
qemu/main-loop: Introduce QEMU_IOTHREAD_LOCK_GUARD

Create a wrapper for locking/unlocking the iothread lock.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
2 years agotcg: Cleanup trailing whitespace
Richard Henderson [Thu, 1 Dec 2022 06:38:25 +0000 (22:38 -0800)]
tcg: Cleanup trailing whitespace

Remove whitespace at end of line, plus one place this also
highlights some missing braces.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
This page took 0.087324 seconds and 4 git commands to generate.