OSDN Git Service

qmiga/qemu.git
8 months agotarget/hppa: Replace tcg_gen_*_tl with tcg_gen_*_i64
Richard Henderson [Wed, 18 Oct 2023 04:49:54 +0000 (21:49 -0700)]
target/hppa: Replace tcg_gen_*_tl with tcg_gen_*_i64

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Use tcg_temp_new_i64 not tcg_temp_new
Richard Henderson [Wed, 18 Oct 2023 04:47:02 +0000 (21:47 -0700)]
target/hppa: Use tcg_temp_new_i64 not tcg_temp_new

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Adjust vmstate_env for pa2.0 tlb
Richard Henderson [Thu, 26 Oct 2023 17:42:21 +0000 (10:42 -0700)]
target/hppa: Adjust vmstate_env for pa2.0 tlb

Split out the tlb to a subsection so that it can be separately
versioned -- the format is only partially following the architecture
and is partially guided by the qemu implementation.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove remaining TARGET_REGISTER_BITS redirections
Richard Henderson [Wed, 18 Oct 2023 04:42:55 +0000 (21:42 -0700)]
target/hppa: Remove remaining TARGET_REGISTER_BITS redirections

The conversions to/from i64 can be eliminated entirely,
folding computation into adjacent operations.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove most of the TARGET_REGISTER_BITS redirections
Richard Henderson [Wed, 18 Oct 2023 04:31:08 +0000 (21:31 -0700)]
target/hppa: Remove most of the TARGET_REGISTER_BITS redirections

Remove all but those intended to change type to or from i64.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove TARGET_REGISTER_BITS
Richard Henderson [Wed, 18 Oct 2023 04:11:19 +0000 (21:11 -0700)]
target/hppa: Remove TARGET_REGISTER_BITS

Rely only on TARGET_LONG_BITS, fixed at 64, and hppa_is_pa20.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agohw/hppa: Use uint32_t instead of target_ureg
Richard Henderson [Fri, 20 Oct 2023 17:04:22 +0000 (10:04 -0700)]
hw/hppa: Use uint32_t instead of target_ureg

The size of target_ureg is going to change.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement IDTLBT, IITLBT
Richard Henderson [Fri, 13 Oct 2023 00:55:12 +0000 (17:55 -0700)]
target/hppa: Implement IDTLBT, IITLBT

Rename the existing insert tlb helpers to emphasize that they
are for pa1.1 cpus.  Implement a combined i/d tlb for pa2.0.
Still missing is the new 'P' tlb bit.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement STDBY
Richard Henderson [Wed, 20 Sep 2023 15:00:23 +0000 (17:00 +0200)]
target/hppa: Implement STDBY

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement CLRBTS, POPBTS, PUSHBTS, PUSHNOM
Richard Henderson [Wed, 20 Sep 2023 11:11:27 +0000 (13:11 +0200)]
target/hppa: Implement CLRBTS, POPBTS, PUSHBTS, PUSHNOM

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement SHRPD
Richard Henderson [Wed, 20 Sep 2023 10:44:23 +0000 (12:44 +0200)]
target/hppa: Implement SHRPD

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement EXTRD
Richard Henderson [Wed, 20 Sep 2023 10:04:29 +0000 (12:04 +0200)]
target/hppa: Implement EXTRD

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement DEPD, DEPDI
Richard Henderson [Wed, 20 Sep 2023 09:44:17 +0000 (11:44 +0200)]
target/hppa: Implement DEPD, DEPDI

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement LDD, LDCD, LDDA, STD, STDA
Richard Henderson [Sun, 17 Sep 2023 06:47:42 +0000 (23:47 -0700)]
target/hppa: Implement LDD, LDCD, LDDA, STD, STDA

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode ADDB double-word
Richard Henderson [Sun, 17 Sep 2023 05:25:30 +0000 (22:25 -0700)]
target/hppa: Decode ADDB double-word

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode CMPIB double-word
Richard Henderson [Sun, 17 Sep 2023 05:06:04 +0000 (22:06 -0700)]
target/hppa: Decode CMPIB double-word

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for cmpb instructions
Richard Henderson [Sun, 17 Sep 2023 04:56:39 +0000 (21:56 -0700)]
target/hppa: Decode d for cmpb instructions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for bb instructions
Richard Henderson [Sun, 17 Sep 2023 04:41:32 +0000 (21:41 -0700)]
target/hppa: Decode d for bb instructions

Manipulate the shift count so that the bit to be tested
is always placed at the MSB.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for sub instructions
Richard Henderson [Sun, 17 Sep 2023 04:25:44 +0000 (21:25 -0700)]
target/hppa: Decode d for sub instructions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for add instructions
Richard Henderson [Sun, 17 Sep 2023 03:51:13 +0000 (20:51 -0700)]
target/hppa: Decode d for add instructions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for cmpclr instructions
Richard Henderson [Sun, 17 Sep 2023 03:40:23 +0000 (20:40 -0700)]
target/hppa: Decode d for cmpclr instructions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for unit instructions
Richard Henderson [Sun, 17 Sep 2023 03:32:37 +0000 (20:32 -0700)]
target/hppa: Decode d for unit instructions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Decode d for logical instructions
Richard Henderson [Sun, 17 Sep 2023 03:21:14 +0000 (20:21 -0700)]
target/hppa: Decode d for logical instructions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove TARGET_HPPA64
Richard Henderson [Sun, 17 Sep 2023 04:06:49 +0000 (21:06 -0700)]
target/hppa: Remove TARGET_HPPA64

Allow both user-only and system mode to run pa2.0 cpus.
Avoid creating a separate qemu-system-hppa64 binary;
force the qemu-hppa binary to use TARGET_ABI32.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Drop attempted gdbstub support for hppa64
Richard Henderson [Wed, 18 Oct 2023 03:48:38 +0000 (20:48 -0700)]
target/hppa: Drop attempted gdbstub support for hppa64

There is no support for hppa64 in gdb.  Any attempt to provide the
data for the larger hppa64 registers results in an error from gdb.
Mask CR_SAR writes to the width of the register: 5 or 6 bits.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agolinux-user/hppa: Fixes for TARGET_ABI32
Richard Henderson [Tue, 17 Oct 2023 21:09:58 +0000 (14:09 -0700)]
linux-user/hppa: Fixes for TARGET_ABI32

Avoid target_ulong and use abi_* types.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Pass d to do_unit_cond
Richard Henderson [Sun, 17 Sep 2023 02:52:46 +0000 (19:52 -0700)]
target/hppa: Pass d to do_unit_cond

Hoist the resolution of d up one level above do_unit_cond.
All computations are logical, and are simplified by using a mask of the
correct width, after which the result may be compared with zero.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Pass d to do_sed_cond
Richard Henderson [Sun, 17 Sep 2023 02:34:39 +0000 (19:34 -0700)]
target/hppa: Pass d to do_sed_cond

Hoist the resolution of d up one level above do_sed_cond.
The MOVB comparison and the existing shift/extract/deposit
are all 32-bit.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Pass d to do_log_cond
Richard Henderson [Sun, 17 Sep 2023 02:30:10 +0000 (19:30 -0700)]
target/hppa: Pass d to do_log_cond

Hoist the resolution of d up one level above do_log_cond.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Pass d to do_sub_cond
Richard Henderson [Sun, 17 Sep 2023 02:28:12 +0000 (19:28 -0700)]
target/hppa: Pass d to do_sub_cond

Hoist the resolution of d up one level above do_sub_cond.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Pass d to do_cond
Richard Henderson [Sun, 17 Sep 2023 02:26:15 +0000 (19:26 -0700)]
target/hppa: Pass d to do_cond

Hoist the resolution of d up one level above do_cond.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: sar register allows only 5 bits on 32-bit CPU
Helge Deller [Mon, 16 Oct 2023 12:43:18 +0000 (14:43 +0200)]
target/hppa: sar register allows only 5 bits on 32-bit CPU

The sar shift amount register is limited to 5 bits when running
a 32-bit CPU. Strip off the remaining bits.

The interesting part is, that this register allows to detect at runtime
if a physical CPU is capable to execute PA2.0 (64-bit) instructions.

Signed-off-by: Helge Deller <deller@gmx.de>
8 months agotarget/hppa: Mask inputs in copy_iaoq_entry
Richard Henderson [Fri, 27 Oct 2023 02:03:34 +0000 (19:03 -0700)]
target/hppa: Mask inputs in copy_iaoq_entry

Ensure that the destination is always a valid GVA offset.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Use copy_iaoq_entry for link in do_ibranch
Richard Henderson [Fri, 27 Oct 2023 01:55:54 +0000 (18:55 -0700)]
target/hppa: Use copy_iaoq_entry for link in do_ibranch

We need to make sure the link is masked properly along the
use_nullify_skip path.  The other three settings of a link
register already use this.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Always use copy_iaoq_entry to set cpu_iaoq_[fb]
Richard Henderson [Fri, 27 Oct 2023 01:51:25 +0000 (18:51 -0700)]
target/hppa: Always use copy_iaoq_entry to set cpu_iaoq_[fb]

This will be how we ensure that the IAOQ is always
valid per PSW.W, therefore all stores to these two
variables must be done with this function.

Use third argument -1 if the destination is always dynamic,
and fourth argument NULL if the destination is always static.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Pass DisasContext to copy_iaoq_entry
Richard Henderson [Fri, 27 Oct 2023 01:34:01 +0000 (18:34 -0700)]
target/hppa: Pass DisasContext to copy_iaoq_entry

Interface change only, no functional effect.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix hppa64 addressing
Richard Henderson [Sat, 16 Sep 2023 23:52:51 +0000 (16:52 -0700)]
target/hppa: Fix hppa64 addressing

In form_gva and cpu_get_tb_cpu_state, we must truncate when PSW_W == 0.
In space_select, the bits that choose the space depend on PSW_W.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Adjust hppa_cpu_dump_state for hppa64
Richard Henderson [Tue, 19 Sep 2023 13:43:57 +0000 (15:43 +0200)]
target/hppa: Adjust hppa_cpu_dump_state for hppa64

Dump all 64 bits for pa2.0 and low 32 bits for pa1.x.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Handle absolute addresses for pa2.0
Richard Henderson [Sun, 17 Sep 2023 21:54:16 +0000 (14:54 -0700)]
target/hppa: Handle absolute addresses for pa2.0

With pa2.0, absolute addresses are not the same as physical addresses,
and undergo a transformation based on PSW_W.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Update cpu_hppa_get/put_psw for hppa64
Richard Henderson [Thu, 21 Sep 2023 08:13:35 +0000 (10:13 +0200)]
target/hppa: Update cpu_hppa_get/put_psw for hppa64

With 64-bit registers, there are 16 carry bits in the PSW.
Clear reserved bits based on cpu revision.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement hppa_cpu_class_by_name
Richard Henderson [Mon, 18 Sep 2023 01:42:27 +0000 (18:42 -0700)]
target/hppa: Implement hppa_cpu_class_by_name

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Implement cpu_list
Richard Henderson [Mon, 18 Sep 2023 01:38:59 +0000 (18:38 -0700)]
target/hppa: Implement cpu_list

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Make HPPA_BTLB_ENTRIES variable
Richard Henderson [Fri, 13 Oct 2023 00:46:55 +0000 (17:46 -0700)]
target/hppa: Make HPPA_BTLB_ENTRIES variable

Depend on hppa_is_pa20.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Introduce TYPE_HPPA64_CPU
Richard Henderson [Sun, 17 Sep 2023 22:31:47 +0000 (15:31 -0700)]
target/hppa: Introduce TYPE_HPPA64_CPU

Prepare for the qemu binary supporting both pa10 and pa20
at the same time.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix extrw and depw with sar for hppa64
Richard Henderson [Tue, 19 Sep 2023 14:07:14 +0000 (16:07 +0200)]
target/hppa: Fix extrw and depw with sar for hppa64

These are 32-bit operations regardless of processor.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix bb_sar for hppa64
Richard Henderson [Tue, 17 Oct 2023 23:39:47 +0000 (16:39 -0700)]
target/hppa: Fix bb_sar for hppa64

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix do_add, do_sub for hppa64
Richard Henderson [Tue, 17 Oct 2023 23:16:03 +0000 (16:16 -0700)]
target/hppa: Fix do_add, do_sub for hppa64

Select the proper carry bit for input to the arithmetic
and for output for the condition.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix trans_ds for hppa64
Richard Henderson [Sat, 16 Sep 2023 23:28:23 +0000 (16:28 -0700)]
target/hppa: Fix trans_ds for hppa64

This instruction always uses the input carry from bit 32,
but produces all 16 output carry bits.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Truncate rotate count in trans_shrpw_sar
Richard Henderson [Sat, 16 Sep 2023 23:22:14 +0000 (16:22 -0700)]
target/hppa: Truncate rotate count in trans_shrpw_sar

When forcing rotate by i32, the shift count must be as well.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix load in do_load_32
Richard Henderson [Sat, 16 Sep 2023 23:20:28 +0000 (16:20 -0700)]
target/hppa: Fix load in do_load_32

The destination is TCGv_i32, so use tcg_gen_qemu_ld_i32
not tcg_gen_qemu_ld_reg.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Fix hppa64 case in machine.c
Richard Henderson [Sat, 16 Sep 2023 23:19:27 +0000 (16:19 -0700)]
target/hppa: Fix hppa64 case in machine.c

Typo of VMSTATE_UINTTR_V and VMSTATE_UINTTR_ARRAY_V macros.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove load_const
Richard Henderson [Wed, 20 Sep 2023 09:47:02 +0000 (11:47 +0200)]
target/hppa: Remove load_const

Replace with tcg_constant_reg.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove get_temp_tl
Richard Henderson [Sun, 17 Sep 2023 04:05:03 +0000 (21:05 -0700)]
target/hppa: Remove get_temp_tl

Replace with tcg_temp_new_tl without recording into ctx.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Remove get_temp
Richard Henderson [Sun, 17 Sep 2023 04:02:42 +0000 (21:02 -0700)]
target/hppa: Remove get_temp

Replace with tcg_temp_new without recording into ctx.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Populate an interval tree with valid tlb entries
Richard Henderson [Fri, 27 Oct 2023 07:24:30 +0000 (00:24 -0700)]
target/hppa: Populate an interval tree with valid tlb entries

Complete the data structure conversion started earlier.  This reduces
the perf overhead of hppa_get_physical_address from ~5% to ~0.25%.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Split out hppa_flush_tlb_range
Richard Henderson [Wed, 1 Nov 2023 23:07:48 +0000 (16:07 -0700)]
target/hppa: Split out hppa_flush_tlb_range

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Always report one page to tlb_set_page
Richard Henderson [Fri, 27 Oct 2023 08:09:21 +0000 (01:09 -0700)]
target/hppa: Always report one page to tlb_set_page

No need to trigger the large_page_mask code unnecessarily.
Drop the now unused HPPATLBEntry.page_size field.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Use IntervalTreeNode in HPPATLBEntry
Richard Henderson [Fri, 27 Oct 2023 05:21:47 +0000 (22:21 -0700)]
target/hppa: Use IntervalTreeNode in HPPATLBEntry

Replace the va_b and va_b fields with the interval tree node.
The actual interval tree is not yet used.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Rename hppa_tlb_entry to HPPATLBEntry
Richard Henderson [Fri, 27 Oct 2023 05:13:12 +0000 (22:13 -0700)]
target/hppa: Rename hppa_tlb_entry to HPPATLBEntry

Rename to CamelCase per coding style.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/hppa: Include PSW_P in tb flags and mmu index
Richard Henderson [Wed, 1 Nov 2023 22:17:04 +0000 (15:17 -0700)]
target/hppa: Include PSW_P in tb flags and mmu index

Use a separate mmu index for PSW_P enabled vs disabled.
This means we can elide the tlb flush in cpu_hppa_put_psw
when PSW_P changes.  This turns out to be the majority
of all tlb flushes.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agoMerge tag 'pull-sp-20231105' of https://gitlab.com/rth7680/qemu into staging
Stefan Hajnoczi [Mon, 6 Nov 2023 01:34:22 +0000 (09:34 +0800)]
Merge tag 'pull-sp-20231105' of https://gitlab.com/rth7680/qemu into staging

target/sparc: Explicitly compute condition codes

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmVH9oodHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/M8QgAgPTp/wFLVnSRFLaN
# fBoelVhM4WTWMQ+SUwZMtCvqcMHaBxIMu+hyk5MI11hFOUi9N+vWvRb+NZ6JbK+1
# sqWcx0NdYfNdOeoi1dgzGgcCkFA8u9zW/K7Ih0W8WuU20uiJ4Zw/qmnEELIl/mZR
# 5Ft1mhLMhQSYsH0KSypugLWBxR9SFNH1cV3C1SG2q+6snm/mhKk9NN18zJGFdmmY
# 4CQThx159P/DaPUONZbSAMN94opu6K8FSymELPDUZBYwJRq7fyGKYuDUGRvN1kxx
# I8p/MF1V5Vcth9lvGyBYulFWjo9BDMpkIdmWzXZLOWfzZVAed8PcglxoQqgMbU5u
# eyY/Cw==
# =Tv1h
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 06 Nov 2023 04:09:46 HKT
# 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-sp-20231105' of https://gitlab.com/rth7680/qemu: (21 commits)
  target/sparc: Check for invalid cond in gen_compare_reg
  target/sparc: Implement UDIV inline
  target/sparc: Implement UDIVX and SDIVX inline
  target/sparc: Discard cpu_cond at the end of each insn
  target/sparc: Record entire jump condition in DisasContext
  target/sparc: Merge gen_op_next_insn into only caller
  target/sparc: Pass displacement to advance_jump_cond
  target/sparc: Merge advance_jump_uncond_{never,always} into advance_jump_cond
  target/sparc: Merge gen_branch2 into advance_pc
  target/sparc: Do flush_cond in advance_jump_cond
  target/sparc: Always copy conditions into a new temporary
  target/sparc: Change DisasCompare.c2 to int
  target/sparc: Remove DisasCompare.is_bool
  target/sparc: Remove CC_OP leftovers
  target/sparc: Remove CC_OP_TADDTV, CC_OP_TSUBTV
  target/sparc: Remove CC_OP_SUB, CC_OP_SUBX, CC_OP_TSUB
  target/sparc: Remove CC_OP_ADD, CC_OP_ADDX, CC_OP_TADD
  target/sparc: Remove CC_OP_DIV
  target/sparc: Remove CC_OP_LOGIC
  target/sparc: Split psr and xcc into components
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 months agoMerge tag 'migration-20231103-pull-request' of https://gitlab.com/juan.quintela/qemu...
Stefan Hajnoczi [Mon, 6 Nov 2023 00:37:22 +0000 (08:37 +0800)]
Merge tag 'migration-20231103-pull-request' of https://gitlab.com/juan.quintela/qemu into staging

Migration Pull request (20231103)

Hi

In this PULL:
- dirty limit fixes (hyman)
- coverity issues (juan)

Please apply.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEGJn/jt6/WMzuA0uC9IfvGFhy1yMFAmVE4dgACgkQ9IfvGFhy
# 1yPBgxAAvrsCHwU6/m9y+XGokyHTKKKIVysLip/14jAjDL+viLYgxdVyOGQKQGBa
# +yV+XHTaEyKdihKG4Z5nWuC0yM+sdZQpWXQAcHJLPaPs5wDGICICpdAFY2LbAWSK
# jtX9uq7crywIL4mVKiX+HOjRUPCAYUx/2TcqJf2+0+MKDEVC33ikxNbcx8ZELY+Q
# +hGyOws3mkHSQjyaNUVgnnQtGzikYqcNO2efa+zVPdXYd+TUWW2e9I++Qf48r0Hv
# OqeZAB7bSAb39PNRuj0I1gt4d3WTHzHt7BSpX1OuFqQnzLw8vS5iDQH943WAyGkY
# NblZVb8pyzSg1Jy18H/SmrJDXeufRwqFwD+1NHyxGjsF89KOuVUqGrGpRXhMBtmA
# DSzdgn5jqW5lI1po9FqGdlPTFlhstpMH3DSfPQWurvJh42oM38gmSEHLBNpc4tXo
# 8udMYI09H/kHUoNMTZNGjnZO9LfarGsag6eOJP1bMMublhRlKCaL9RIyV9oOHycE
# IeOeQFeBP/BmYFLWbVPeZej7uiqsEc7VPDJK2QXns210UYanaWmggkmpdAr0I0EV
# pEKHSfVv1qlIlFH4d7MhcJzP2/rY62EC5tYQjT0UaBnCRcDInKrNWa3kbDL0akwr
# 0aJgpbT5ipknVChtwnMWJlbqpeW/VUF5g0jVpYQ3jbe/Zf+OtmU=
# =Pv8z
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 Nov 2023 20:04:40 HKT
# gpg:                using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>" [full]
# gpg:                 aka "Juan Quintela <quintela@trasno.org>" [full]
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* tag 'migration-20231103-pull-request' of https://gitlab.com/juan.quintela/qemu:
  migration: Unlock mutex in error case
  docs/migration: Add the dirty limit section
  tests/migration: Introduce dirty-limit into guestperf
  tests/migration: Introduce dirty-ring-size option into guestperf
  tests: Add migration dirty-limit capability test
  system/dirtylimit: Drop the reduplicative check
  system/dirtylimit: Fix a race situation

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 months agoMerge tag 'dump-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
Stefan Hajnoczi [Mon, 6 Nov 2023 00:36:47 +0000 (08:36 +0800)]
Merge tag 'dump-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging

dump queue

Hi

The "dump" queue, with:
- [PATCH v3 qemu 0/3] Allow dump-guest-memory to output standard kdump format
- [PATCH v2 0/5] dump: Minor fixes & improvements

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmVEmsEcHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5YNkD/sFnz+I75mn6+DIdC3x
# aSVUU87JxAvWkt+G3KYGS+de2+g2YkRkPwwrIsIceiX7mlL4Es350AVcTl7+fXpu
# Jl9k9I32QI+U3pNXo9BStIqjKUMBxmmKs4aLCh9OHJ6oliTCG+aJTUmSl/dABIuw
# fAcW9vjhyR4ogAp8x7WhR6PKEAAb6OE/9k0w/z0GV2K09N/R0pPAvObQ36VQJ/Cl
# 6DN8tRRytl0IQmC/mZZ+MQPQ5cvamK78X3DmnYCGtyN9HTQERfUFMSSgD/sHLvNi
# rMKuwhXiGQfDs/xQ9Z6Vh2AL7JfAwbIQwUstepb78M/5GBLaZfwFYG4+eCohJE82
# s0GOQ45Yks+AOTGj6lNyOfJ8PIf0SocCTbnLWZicpdHIfoEkSmmL0VZ5w+w0EpDO
# WOZJRpANJGTLhKNb//X3A3OJ05LoavN3/criokhC19DW/yE/VEGd3dXlP6yvFOku
# vGUINGivg1bw7yO0S/rzXNw4+cHCPgBCXbKCNuMI6B+dxL5pUR5Zr4OqcYgwejqE
# RWMdqsHA4ohpzc3AfbuHLFilXJNAgLR3jAEiVUXyrz9U1FiYEiq/8RNuupe9Uveq
# pO1PDZ9fher0Zda4y28bHl/e5M9hVeCFqElcVk0FQGt97T5olVvSaL/hFUPf65ls
# 8A3lN6WaAT9dvM33pkeswZvGxg==
# =eSbp
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 Nov 2023 15:01:21 HKT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'dump-pull-request' of https://gitlab.com/marcandre.lureau/qemu:
  dump: Drop redundant check for empty dump
  dump: Improve some dump-guest-memory error messages
  dump: Recognize "fd:" protocols on Windows hosts
  dump: Fix g_array_unref(NULL) in dump-guest-memory
  dump: Rename qmp_dump_guest_memory() parameter to match QAPI schema
  dump: Add command interface for kdump-raw formats
  dump: Allow directly outputting raw kdump format
  dump: Pass DumpState to write_ functions

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 months agoMerge tag 'pull-loongarch-20231103' of https://gitlab.com/gaosong/qemu into staging
Stefan Hajnoczi [Mon, 6 Nov 2023 00:35:47 +0000 (08:35 +0800)]
Merge tag 'pull-loongarch-20231103' of https://gitlab.com/gaosong/qemu into staging

pull-loongarch-20231103

# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEKAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCZUSQIgAKCRBAov/yOSY+
# 31aIBADj5FzdUxyFB813SouAiEiyMdI4bN98AunomAk3Kt8PF1XPoP8kPzcjxcMI
# kCW4eoHb12MVs9OclkqFY3VyaxtSD3YSG/h8W9YxaDyU+L/q89RS+J4r6CAZ8ylg
# J4uxs3Lv8nwPEvRb4zITAt8JQllLey1100j/uu4fU0Rx7vUcMA==
# =9RMx
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 Nov 2023 14:16:02 HKT
# gpg:                using RSA key B8FF1DA0D2FDCB2DA09C6C2C40A2FFF239263EDF
# gpg: Good signature from "Song Gao <m17746591750@163.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B8FF 1DA0 D2FD CB2D A09C  6C2C 40A2 FFF2 3926 3EDF

* tag 'pull-loongarch-20231103' of https://gitlab.com/gaosong/qemu:
  linux-user/loongarch64: Add LASX sigcontext save/restore
  linux-user/loongarch64: Add LSX sigcontext save/restore
  linux-user/loongarch64: Use abi_{ulong,uint} types
  linux-user/loongarch64: setup_sigframe() set 'end' context size 0
  linux-user/loongarch64: Fix setup_extcontext alloc wrong fpu_context size
  linux-user/loongarch64: Use traps to track LSX/LASX usage
  target/loongarch: Support 4K page size
  target/loongarch: Implement query-cpu-model-expansion
  target/loongarch: Allow user enable/disable LSX/LASX features
  target/loongarch: Add cpu model 'max'

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 months agotarget/sparc: Check for invalid cond in gen_compare_reg
Richard Henderson [Sat, 21 Oct 2023 07:46:33 +0000 (00:46 -0700)]
target/sparc: Check for invalid cond in gen_compare_reg

Consolidate the test here; drop the "inverted logic".
Fix MOVr and FMOVR, which were missing the invalid test.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Implement UDIV inline
Richard Henderson [Mon, 16 Oct 2023 23:16:05 +0000 (16:16 -0700)]
target/sparc: Implement UDIV inline

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Implement UDIVX and SDIVX inline
Richard Henderson [Mon, 16 Oct 2023 21:35:05 +0000 (14:35 -0700)]
target/sparc: Implement UDIVX and SDIVX inline

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Discard cpu_cond at the end of each insn
Richard Henderson [Mon, 16 Oct 2023 19:24:23 +0000 (12:24 -0700)]
target/sparc: Discard cpu_cond at the end of each insn

If the insn raises no exceptions, there will be no path in which
cpu_cond is used, and so the computation may be optimized away.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Record entire jump condition in DisasContext
Richard Henderson [Mon, 16 Oct 2023 18:24:32 +0000 (11:24 -0700)]
target/sparc: Record entire jump condition in DisasContext

Use the original condition instead of consuming cpu_cond,
which will now only be live along exception paths.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Merge gen_op_next_insn into only caller
Richard Henderson [Mon, 16 Oct 2023 18:07:31 +0000 (11:07 -0700)]
target/sparc: Merge gen_op_next_insn into only caller

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Pass displacement to advance_jump_cond
Richard Henderson [Sat, 21 Oct 2023 07:31:41 +0000 (00:31 -0700)]
target/sparc: Pass displacement to advance_jump_cond

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Merge advance_jump_uncond_{never,always} into advance_jump_cond
Richard Henderson [Mon, 16 Oct 2023 17:59:38 +0000 (10:59 -0700)]
target/sparc: Merge advance_jump_uncond_{never,always} into advance_jump_cond

Handle these via TCG_COND_{ALWAYS,NEVER}.
Allow dc->npc to be variable, using gen_mov_pc_npc.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Merge gen_branch2 into advance_pc
Richard Henderson [Mon, 16 Oct 2023 17:32:50 +0000 (10:32 -0700)]
target/sparc: Merge gen_branch2 into advance_pc

The function had only one caller.  Canonicalize the cpu_cond
test to TCG_COND_NE, the "natural" sense of its value.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Do flush_cond in advance_jump_cond
Richard Henderson [Tue, 17 Oct 2023 04:55:40 +0000 (21:55 -0700)]
target/sparc: Do flush_cond in advance_jump_cond

Do this here instead of in each caller.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Always copy conditions into a new temporary
Richard Henderson [Mon, 16 Oct 2023 16:03:10 +0000 (09:03 -0700)]
target/sparc: Always copy conditions into a new temporary

This will allow the condition to live across changes to
the global cc variables.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Change DisasCompare.c2 to int
Richard Henderson [Mon, 16 Oct 2023 15:55:51 +0000 (08:55 -0700)]
target/sparc: Change DisasCompare.c2 to int

We don't require c2 to be variable, so emphasize that.
We don't currently require c2 to be non-zero, but that will change.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove DisasCompare.is_bool
Richard Henderson [Mon, 16 Oct 2023 15:43:24 +0000 (08:43 -0700)]
target/sparc: Remove DisasCompare.is_bool

Since we're going to feed cpu_cond to another comparison, we don't
reqire a boolean value -- anything non-zero is sufficient.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove CC_OP leftovers
Richard Henderson [Sun, 15 Oct 2023 04:55:27 +0000 (21:55 -0700)]
target/sparc: Remove CC_OP leftovers

All instructions have been converted to generate
full condition codes explicitly.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove CC_OP_TADDTV, CC_OP_TSUBTV
Richard Henderson [Sun, 15 Oct 2023 04:38:12 +0000 (21:38 -0700)]
target/sparc: Remove CC_OP_TADDTV, CC_OP_TSUBTV

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove CC_OP_SUB, CC_OP_SUBX, CC_OP_TSUB
Richard Henderson [Sun, 15 Oct 2023 04:23:27 +0000 (21:23 -0700)]
target/sparc: Remove CC_OP_SUB, CC_OP_SUBX, CC_OP_TSUB

These are all related and implementable with common code.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove CC_OP_ADD, CC_OP_ADDX, CC_OP_TADD
Richard Henderson [Sun, 15 Oct 2023 04:03:26 +0000 (21:03 -0700)]
target/sparc: Remove CC_OP_ADD, CC_OP_ADDX, CC_OP_TADD

These are all related and implementable with common code.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove CC_OP_DIV
Richard Henderson [Sun, 15 Oct 2023 02:44:03 +0000 (19:44 -0700)]
target/sparc: Remove CC_OP_DIV

Return both result and overflow from helper_[us]div.
Compute all flags explicitly in gen_op_[us]divcc.

Marginally improve the INT64_MIN special case in helper_sdiv.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Remove CC_OP_LOGIC
Richard Henderson [Sun, 15 Oct 2023 03:15:19 +0000 (20:15 -0700)]
target/sparc: Remove CC_OP_LOGIC

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Split psr and xcc into components
Richard Henderson [Sun, 15 Oct 2023 01:24:19 +0000 (18:24 -0700)]
target/sparc: Split psr and xcc into components

Step in removing CC_OP: change the representation of CC_OP_FLAGS.
The 8 bits are distributed between 6 variables, which should make
it easy to keep up to date.

The code within cc_helper.c is quite ugly but is only temporary.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agotarget/sparc: Introduce cpu_put_psr_icc
Richard Henderson [Sat, 14 Oct 2023 21:01:08 +0000 (14:01 -0700)]
target/sparc: Introduce cpu_put_psr_icc

Isolate linux-user from changes to icc representation.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8 months agomigration: Unlock mutex in error case
Juan Quintela [Fri, 3 Nov 2023 07:42:45 +0000 (08:42 +0100)]
migration: Unlock mutex in error case

We were not unlocking bitmap mutex on the error case.  To fix it
forever change to enclose the code with WITH_QEMU_LOCK_GUARD().
Coverity CID 1523750.

Fixes: a2326705e5 ("migration: Stop migration immediately in RDMA error paths")
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231103074245.55166-1-quintela@redhat.com>

8 months agodocs/migration: Add the dirty limit section
Hyman Huang [Wed, 1 Nov 2023 14:04:09 +0000 (22:04 +0800)]
docs/migration: Add the dirty limit section

The dirty limit feature has been introduced since the 8.1
QEMU release but has not reflected in the document, add a
section for that.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <0f2b2c63fec22ea23e4926cdeb567b7a0ebd8152.1698847223.git.yong.huang@smartx.com>

8 months agotests/migration: Introduce dirty-limit into guestperf
Hyman Huang [Wed, 1 Nov 2023 14:04:08 +0000 (22:04 +0800)]
tests/migration: Introduce dirty-limit into guestperf

Currently, guestperf does not cover the dirty-limit
migration, support this feature.

Note that dirty-limit requires 'dirty-ring-size' set.

To enable dirty-limit, setting x-vcpu-dirty-limit-period
as 500ms and x-vcpu-dirty-limit as 10MB/s:
$ ./tests/migration/guestperf.py \
    --dirty-ring-size 4096 \
    --dirty-limit --x-vcpu-dirty-limit-period 500 \
    --vcpu-dirty-limit 10 --output output.json \

To run the entire standardized set of dirty-limit-enabled
comparisons, with unix migration:
$ ./tests/migration/guestperf-batch.py \
    --dirty-ring-size 4096 \
    --dst-host localhost --transport unix \
    --filter compr-dirty-limit* --output outputdir

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-Id: <516e7a55dfc6e33d33510be37eb24223de5dc072.1697815117.git.yong.huang@smartx.com>
Message-ID: <e1283565b00b34b0377bbd27bee4bb8fc7c255a8.1698847223.git.yong.huang@smartx.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
8 months agotests/migration: Introduce dirty-ring-size option into guestperf
Hyman Huang [Wed, 1 Nov 2023 14:04:07 +0000 (22:04 +0800)]
tests/migration: Introduce dirty-ring-size option into guestperf

Dirty ring size configuration is not supported by guestperf tool.

Introduce dirty-ring-size (ranges in [1024, 65536]) option so
developers can play with dirty-ring and dirty-limit feature easier.

To set dirty ring size with 4096 during migration test:
$ ./tests/migration/guestperf.py --dirty-ring-size 4096 xxx

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <8a388cec5c1f73a34d42515bbc43837e97ee3839.1698847223.git.yong.huang@smartx.com>

8 months agotests: Add migration dirty-limit capability test
Hyman Huang [Wed, 1 Nov 2023 14:04:06 +0000 (22:04 +0800)]
tests: Add migration dirty-limit capability test

Add migration dirty-limit capability test if kernel support
dirty ring.

Migration dirty-limit capability introduce dirty limit
capability, two parameters: x-vcpu-dirty-limit-period and
vcpu-dirty-limit are introduced to implement the live
migration with dirty limit.

The test case does the following things:
1. start src, dst vm and enable dirty-limit capability
2. start migrate and set cancel it to check if dirty limit
   stop working.
3. restart dst vm
4. start migrate and enable dirty-limit capability
5. check if migration satisfy the convergence condition
   during pre-switchover phase.

Note that this test case involves many passes, so it runs
in slow mode only.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <e55a302df9da7dbc00ad825f47f57c1a756d303e.1698847223.git.yong.huang@smartx.com>

8 months agosystem/dirtylimit: Drop the reduplicative check
Hyman Huang [Wed, 1 Nov 2023 14:04:05 +0000 (22:04 +0800)]
system/dirtylimit: Drop the reduplicative check

Checking if dirty limit is in service is done by the
dirtylimit_query_all function, drop the reduplicative
check in the qmp_query_vcpu_dirty_limit function.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <df9c3514933ff6750ef88068af18d3054bedf746.1698847223.git.yong.huang@smartx.com>

8 months agosystem/dirtylimit: Fix a race situation
Hyman Huang [Wed, 1 Nov 2023 14:04:04 +0000 (22:04 +0800)]
system/dirtylimit: Fix a race situation

Fix a race situation for global variable dirtylimit_state.

Also, replace usleep by g_usleep to increase platform
accessibility to the sleep function.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <27c86239e21eda03d11ce5a3d07da3c229f562e3.1698847223.git.yong.huang@smartx.com>

8 months agolinux-user/loongarch64: Add LASX sigcontext save/restore
Song Gao [Wed, 1 Nov 2023 03:08:16 +0000 (11:08 +0800)]
linux-user/loongarch64: Add LASX sigcontext save/restore

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-7-gaosong@loongson.cn>

8 months agolinux-user/loongarch64: Add LSX sigcontext save/restore
Song Gao [Wed, 1 Nov 2023 03:08:15 +0000 (11:08 +0800)]
linux-user/loongarch64: Add LSX sigcontext save/restore

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-6-gaosong@loongson.cn>

8 months agolinux-user/loongarch64: Use abi_{ulong,uint} types
Song Gao [Wed, 1 Nov 2023 03:08:14 +0000 (11:08 +0800)]
linux-user/loongarch64: Use abi_{ulong,uint} types

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-5-gaosong@loongson.cn>

8 months agolinux-user/loongarch64: setup_sigframe() set 'end' context size 0
Song Gao [Wed, 1 Nov 2023 03:08:13 +0000 (11:08 +0800)]
linux-user/loongarch64: setup_sigframe() set 'end' context size 0

See:
  https://github.com/torvalds/linux/blob/master/arch/loongarch/kernel/signal.c

The kernel setup_sigcontext() set end context size 0.

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-4-gaosong@loongson.cn>

8 months agolinux-user/loongarch64: Fix setup_extcontext alloc wrong fpu_context size
Song Gao [Wed, 1 Nov 2023 03:08:12 +0000 (11:08 +0800)]
linux-user/loongarch64: Fix setup_extcontext alloc wrong fpu_context size

See:
 https://github.com/torvalds/linux/blob/master/arch/loongarch/kernel/signal.c

The alloc size is sizeof(struct target_fpu_context).

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-3-gaosong@loongson.cn>

8 months agolinux-user/loongarch64: Use traps to track LSX/LASX usage
Richard Henderson [Wed, 1 Nov 2023 03:08:11 +0000 (11:08 +0800)]
linux-user/loongarch64: Use traps to track LSX/LASX usage

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-2-gaosong@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
8 months agotarget/loongarch: Support 4K page size
Song Gao [Mon, 23 Oct 2023 02:40:59 +0000 (10:40 +0800)]
target/loongarch: Support 4K page size

The LoongArch kernel supports 4K page size.
Change TARGET_PAGE_BITS to 12.

Signed-off-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20231023024059.3858349-1-gaosong@loongson.cn>

8 months agotarget/loongarch: Implement query-cpu-model-expansion
Song Gao [Fri, 20 Oct 2023 08:49:25 +0000 (16:49 +0800)]
target/loongarch: Implement query-cpu-model-expansion

Add support for the query-cpu-model-expansion QMP command to LoongArch.
We support query the cpu features.

  e.g
    la464 and max cpu support LSX/LASX, default enable,
    la132 not support LSX/LASX.

    1. start with '-cpu max,lasx=off'

    (QEMU) query-cpu-model-expansion type=static  model={"name":"max"}
    {"return": {"model": {"name": "max", "props": {"lasx": false, "lsx": true}}}}

    2. start with '-cpu la464,lasx=off'
    (QEMU) query-cpu-model-expansion type=static  model={"name":"la464"}
    {"return": {"model": {"name": "max", "props": {"lasx": false, "lsx": true}}}

    3. start with '-cpu la132,lasx=off'
    qemu-system-loongarch64: can't apply global la132-loongarch-cpu.lasx=off: Property 'la132-loongarch-cpu.lasx' not found

    4. start with '-cpu max,lasx=off' or start with '-cpu la464,lasx=off' query cpu model la132
    (QEMU) query-cpu-model-expansion type=static  model={"name":"la132"}
    {"return": {"model": {"name": "la132"}}}

Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231020084925.3457084-4-gaosong@loongson.cn>