OSDN Git Service

qmiga/qemu.git
16 months agotarget/s390x: Avoid tcg_const_i64
Richard Henderson [Sun, 26 Feb 2023 20:43:27 +0000 (10:43 -1000)]
target/s390x: Avoid tcg_const_i64

All uses are strictly read-only.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/rx: Avoid tcg_const_i32
Richard Henderson [Sun, 26 Feb 2023 20:13:07 +0000 (10:13 -1000)]
target/rx: Avoid tcg_const_i32

All remaining uses are strictly read-only.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/rx: Avoid tcg_const_i32 when new temp needed
Richard Henderson [Sun, 26 Feb 2023 20:12:45 +0000 (10:12 -1000)]
target/rx: Avoid tcg_const_i32 when new temp needed

These three cases use a constant as first input, and
then overwrite the temp in the output.  Separate them.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/rx: Use cpu_psw_z as temp in flags computation
Richard Henderson [Sun, 26 Feb 2023 20:09:44 +0000 (10:09 -1000)]
target/rx: Use cpu_psw_z as temp in flags computation

Since PSW_Z = PSW_S, we can move that assignment to the end
and use PSW_Z as a temporary while computing PSW_O.
Use tcg_constant_i32 instead of tcg_const_i32.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/rx: Use tcg_gen_abs_i32
Richard Henderson [Sun, 26 Feb 2023 20:03:02 +0000 (10:03 -1000)]
target/rx: Use tcg_gen_abs_i32

Remove the local definition of rx_abs.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/ppc: Avoid tcg_const_i64 in do_vector_shift_quad
Richard Henderson [Sun, 26 Feb 2023 04:16:43 +0000 (18:16 -1000)]
target/ppc: Avoid tcg_const_i64 in do_vector_shift_quad

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/ppc: Split out gen_vx_vmul10
Richard Henderson [Sun, 26 Feb 2023 04:01:07 +0000 (18:01 -1000)]
target/ppc: Split out gen_vx_vmul10

Move the body out of this large macro.
Use tcg_constant_i64.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Avoid tcg_const_* throughout
Richard Henderson [Sun, 26 Feb 2023 03:46:54 +0000 (17:46 -1000)]
target/mips: Avoid tcg_const_* throughout

All remaining uses are strictly read-only.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Avoid tcg_const_tl in gen_r6_ld
Richard Henderson [Sun, 26 Feb 2023 03:46:36 +0000 (17:46 -1000)]
target/mips: Avoid tcg_const_tl in gen_r6_ld

Allocate a separate temp for modification.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Split out gen_lxr
Richard Henderson [Sun, 26 Feb 2023 03:40:49 +0000 (17:40 -1000)]
target/mips: Split out gen_lxr

Common subroutine for LDR and LWR.
Use tcg_constant_tl of ~1 instead of tcg_const_tl of 0x..fe.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Split out gen_lxl
Richard Henderson [Sun, 26 Feb 2023 03:28:36 +0000 (17:28 -1000)]
target/mips: Split out gen_lxl

Common subroutine for LDL and LWL.
Use tcg_constant_tl instead of tcg_const_tl and t2.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/m68k: Avoid tcg_const_* throughout
Richard Henderson [Sun, 26 Feb 2023 01:39:06 +0000 (15:39 -1000)]
target/m68k: Avoid tcg_const_* throughout

All remaining uses are strictly read-only.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/m68k: Avoid tcg_const_i32 in bfop_reg
Richard Henderson [Sun, 26 Feb 2023 01:37:18 +0000 (15:37 -1000)]
target/m68k: Avoid tcg_const_i32 in bfop_reg

Tidy up the whole function, hoisting is_bfffo as a common test
for whether tlen and tofs needed. Use tcg_constant_i32, and load
a separate temporary for mask.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/m68k: Avoid tcg_const_i32 when modified
Richard Henderson [Sun, 26 Feb 2023 01:05:31 +0000 (15:05 -1000)]
target/m68k: Avoid tcg_const_i32 when modified

In several instances, a temp is initialized with a
for use as a constant, and then subsequently used
as an unrelated temp.  Split them.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/i386: Avoid use of tcg_const_* throughout
Richard Henderson [Sat, 25 Feb 2023 23:26:02 +0000 (13:26 -1000)]
target/i386: Avoid use of tcg_const_* throughout

All uses are strictly read-only.  Most of the obviously so,
as direct arguments to gen_helper_*.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/hppa: Avoid use of tcg_const_i32 throughout
Richard Henderson [Sat, 25 Feb 2023 23:05:46 +0000 (13:05 -1000)]
target/hppa: Avoid use of tcg_const_i32 throughout

All uses were read-write, so replace with a new
allocation and initialization.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/hppa: Avoid tcg_const_i64 in trans_fid_f
Richard Henderson [Sat, 25 Feb 2023 23:01:12 +0000 (13:01 -1000)]
target/hppa: Avoid tcg_const_i64 in trans_fid_f

Use a C test instead of a pre-processor test for the id.
Use tcg_constant_i64 instead of tcg_const_i64.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/cris: Avoid use of tcg_const_i32 throughout
Richard Henderson [Sat, 25 Feb 2023 22:44:04 +0000 (12:44 -1000)]
target/cris: Avoid use of tcg_const_i32 throughout

All remaining uses are strictly read-only.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/avr: Avoid use of tcg_const_i32 throughout
Richard Henderson [Sat, 25 Feb 2023 22:39:04 +0000 (12:39 -1000)]
target/avr: Avoid use of tcg_const_i32 throughout

All remaining uses are strictly read-only.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/avr: Avoid use of tcg_const_i32 in SBIC, SBIS
Richard Henderson [Sat, 25 Feb 2023 22:38:14 +0000 (12:38 -1000)]
target/avr: Avoid use of tcg_const_i32 in SBIC, SBIS

The use of separate data/port variables is existing
practice elsewhere, e.g. SBI, CBI.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agoinclude/exec: Remove guards around `NB_MMU_MODES`
Anton Johansson [Mon, 6 Mar 2023 17:52:30 +0000 (18:52 +0100)]
include/exec: Remove guards around `NB_MMU_MODES`

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-24-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/xtensa: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:29 +0000 (18:52 +0100)]
target/xtensa: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-23-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/tricore: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:28 +0000 (18:52 +0100)]
target/tricore: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-22-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/sparc: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:27 +0000 (18:52 +0100)]
target/sparc: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-21-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/sh4: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:26 +0000 (18:52 +0100)]
target/sh4: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-20-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/s390x: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:25 +0000 (18:52 +0100)]
target/s390x: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-19-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/rx: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:24 +0000 (18:52 +0100)]
target/rx: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-18-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/riscv: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:23 +0000 (18:52 +0100)]
target/riscv: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-17-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/ppc: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:22 +0000 (18:52 +0100)]
target/ppc: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-16-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/openrisc: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:21 +0000 (18:52 +0100)]
target/openrisc: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-15-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/nios2: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:20 +0000 (18:52 +0100)]
target/nios2: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-14-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:19 +0000 (18:52 +0100)]
target/mips: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-13-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/microblaze: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:18 +0000 (18:52 +0100)]
target/microblaze: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-12-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/m68k: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:17 +0000 (18:52 +0100)]
target/m68k: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-11-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/loongarch: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:16 +0000 (18:52 +0100)]
target/loongarch: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-10-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/i386: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:15 +0000 (18:52 +0100)]
target/i386: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-9-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/hppa: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:14 +0000 (18:52 +0100)]
target/hppa: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-8-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/hexagon: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:13 +0000 (18:52 +0100)]
target/hexagon: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-7-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/cris: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:12 +0000 (18:52 +0100)]
target/cris: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-6-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/avr: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:11 +0000 (18:52 +0100)]
target/avr: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-5-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/arm: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:10 +0000 (18:52 +0100)]
target/arm: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-4-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/alpha: Remove `NB_MMU_MODES` define
Anton Johansson [Mon, 6 Mar 2023 17:52:09 +0000 (18:52 +0100)]
target/alpha: Remove `NB_MMU_MODES` define

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-3-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agoinclude/exec: Set default `NB_MMU_MODES` to 16
Anton Johansson [Mon, 6 Mar 2023 17:52:08 +0000 (18:52 +0100)]
include/exec: Set default `NB_MMU_MODES` to 16

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230306175230.7110-2-anjo@rev.ng>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotcg: Create tcg/tcg-temp-internal.h
Richard Henderson [Sat, 25 Feb 2023 08:45:43 +0000 (22:45 -1000)]
tcg: Create tcg/tcg-temp-internal.h

Move the tcg_temp_free_* and tcg_temp_ebb_new_* declarations
and inlines to the new header.  These are private to the
implementation, and will prevent tcg_temp_free_* from creeping
back into the guest front ends.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/s390x: Remove g_out, g_out2, g_in1, g_in2 from DisasContext
Richard Henderson [Sat, 25 Feb 2023 07:17:51 +0000 (21:17 -1000)]
target/s390x: Remove g_out, g_out2, g_in1, g_in2 from DisasContext

These fields are no longer read, so remove them and the writes.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/s390x: Remove assert vs g_in2
Richard Henderson [Sat, 25 Feb 2023 07:15:20 +0000 (21:15 -1000)]
target/s390x: Remove assert vs g_in2

These were trying to determine if o->in2 was available for
use as a temporary.  It's better to just allocate a new one.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/s390x: Drop tcg_temp_free from translate.c
Richard Henderson [Sat, 25 Feb 2023 06:58:59 +0000 (20:58 -1000)]
target/s390x: Drop tcg_temp_free from translate.c

Translators are no longer required to free tcg temporaries.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/s390x: Drop tcg_temp_free from translate_vx.c.inc
Richard Henderson [Sat, 25 Feb 2023 06:55:53 +0000 (20:55 -1000)]
target/s390x: Drop tcg_temp_free from translate_vx.c.inc

Translators are no longer required to free tcg temporaries.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/s390x: Drop free_compare
Richard Henderson [Sat, 25 Feb 2023 06:39:19 +0000 (20:39 -1000)]
target/s390x: Drop free_compare

Translators are no longer required to free tcg temporaries.
Remove the g1 and g2 members of DisasCompare, as they were
used to track which temps needed to be freed.

Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from translate.c
Richard Henderson [Sat, 25 Feb 2023 05:49:17 +0000 (19:49 -1000)]
target/mips: Drop tcg_temp_free from translate.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from vr54xx_translate.c
Richard Henderson [Sat, 25 Feb 2023 05:36:03 +0000 (19:36 -1000)]
target/mips: Drop tcg_temp_free from vr54xx_translate.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from tx79_translate.c
Richard Henderson [Sat, 25 Feb 2023 05:33:18 +0000 (19:33 -1000)]
target/mips: Drop tcg_temp_free from tx79_translate.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from translate_addr_const.c
Richard Henderson [Sat, 25 Feb 2023 05:30:25 +0000 (19:30 -1000)]
target/mips: Drop tcg_temp_free from translate_addr_const.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from octeon_translate.c
Richard Henderson [Sat, 25 Feb 2023 05:29:25 +0000 (19:29 -1000)]
target/mips: Drop tcg_temp_free from octeon_translate.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from nanomips_translate.c.inc
Richard Henderson [Sat, 25 Feb 2023 05:27:45 +0000 (19:27 -1000)]
target/mips: Drop tcg_temp_free from nanomips_translate.c.inc

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from mxu_translate.c
Richard Henderson [Sat, 25 Feb 2023 05:23:53 +0000 (19:23 -1000)]
target/mips: Drop tcg_temp_free from mxu_translate.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from msa_translate.c
Richard Henderson [Sat, 25 Feb 2023 05:22:28 +0000 (19:22 -1000)]
target/mips: Drop tcg_temp_free from msa_translate.c

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agotarget/mips: Drop tcg_temp_free from micromips_translate.c.inc
Richard Henderson [Sat, 25 Feb 2023 05:20:36 +0000 (19:20 -1000)]
target/mips: Drop tcg_temp_free from micromips_translate.c.inc

Translators are no longer required to free tcg temporaries.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16 months agoMerge tag 'linux-user-for-8.0-pull-request' of https://gitlab.com/laurent_vivier...
Peter Maydell [Sun, 12 Mar 2023 10:57:00 +0000 (10:57 +0000)]
Merge tag 'linux-user-for-8.0-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

Pull request linux-user 20230308-v2

Fix gdt on i386/x86_64
Handle traps on sparc
Add translation for argument of msync
Emulate CLONE_PIDFD flag in clone
handle netlink flag NLA_F_NESTED
fix sockaddr_in6 endianness
Fix brk() to release pages
fill out task state in /proc/self/stat
add support for xtensa FDPIC
Fix unaligned memory access in prlimit64 syscall
add target to host netlink conversions
fix timerfd read endianness conversion
Fix access to /proc/self/exe
Add strace for prlimit64() syscall

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmQLqmMSHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748e+cP/3XYMvPbExNi09idDvgzzBrFFHgnkCnK
# WAV/laxjHSJkzRNK06jD5KN/G2Osy587GXAWLaN76Y8mYMNJs5x3wwlBrJm0RyeJ
# mWeETJOjxsFjW1+5LKhYv6fwiDxQcyJUoRKzJI27fYgDS+H+zIpa+uhy82Ah543z
# i/HPyerp25TWAuVyR6mQICt7cne+4yjhtcjg0GXmnvm2+UVp54FGjesjwpSdbALl
# OKdCre/JaNOkKoaRSsxm0UhNEyQarJIEf/dv0fTjsEpvNX2SMuLUGCm+n23wjXGN
# fdnSGkoVe8hHxBtG80Zx8AMfKEmJoVsQw9rSg4HwQKOyrYPnLhHjb8ln43X+f3MN
# gq9lDBIxH82LH2Q5JqQQe7S2UJycpYb+qj0xm7llH7Wl9VVKG6hRX/Cd7I1PQLEv
# baPIrtye5TuR6uo0kn6HBB+Hd9RNu2PPHelmEFIGEuNaAPkyOt4FhKFIE/j0BTcg
# mFVCNj6Os805ks0sjIBvpTU1DBtuqpLxdvvHOwxYKCNThTl70wfHJJEjumfvZ4qT
# T+me7hRsd+8v1rRjxYGuJn2gqC7JL8miuJCYlZkn2DfMAunmF00U5ULe9KiCJ8V3
# kDfvO+CdnIN4MSlbtwt+eRSFCmJGGkzZ/jshVxPF3ZVirFu/undphYQnaEZDH+Xd
# KsPOh8MekMgJ
# =e55j
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Mar 2023 22:08:35 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'linux-user-for-8.0-pull-request' of https://gitlab.com/laurent_vivier/qemu: (28 commits)
  linux-user: fix bug about incorrect base addresss of gdt on i386 and x86_64
  linux-user/sparc: Handle tag overflow traps
  linux-user/sparc: Handle floating-point exceptions
  linux-user/sparc: Handle unimplemented flush trap
  linux-user/sparc: Handle coprocessor disabled trap
  linux-user/sparc: Handle privilidged action trap
  linux-user/sparc: Handle priviledged opcode trap
  linux-user/sparc: Handle getcc, setcc, getpsr traps
  linux-user/sparc: Handle division by zero traps
  linux-user/sparc: Handle software breakpoint trap
  linux-user/sparc: Fix sparc64_{get, set}_context traps
  linux-user/sparc: Tidy window spill/fill traps
  linux-user/sparc: Use TT_TRAP for flush windows
  linux-user/sparc: Tidy syscall error return
  linux-user/sparc: Tidy syscall trap
  linux-user: Emulate CLONE_PIDFD flag in clone()
  linux-user: Add translation for argument of msync()
  linux-user: handle netlink flag NLA_F_NESTED
  linux-user: fix sockaddr_in6 endianness
  linux-user: Add strace for prlimit64() syscall
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16 months agoMerge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
Peter Maydell [Sun, 12 Mar 2023 10:56:23 +0000 (10:56 +0000)]
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging

Block layer patches

- fuse: Fix fallocate(PUNCH_HOLE) to zero out the range
- qed: remove spurious BDRV_POLL_WHILE()

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmQLbtURHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9YekQ//SvVXzKbQCNoKJtbkmx9RYSVZt3C19Nfy
# +E3vUauBMvO1RA38J+ff3pBp7R2rWu1QQXZCVu0a5bg7R2cYSKs82Ua5Z6SG9KxZ
# TZSGw2vsYk5pcRJwUS+4lGkvV4zrUsm7gru5h+aL51YS20AaPfSaa/kKKMuWWabm
# O/7ct/gQdiH+8I3d1WpXTE69ZJoH6WK87TUg9HgdQWPwDgam0gbNEjsGjKioCKIz
# xuz28v1UufXL2PRIWmPh4X+XSvD81q3adgf+vM5tWOaeAL87Q0eLeyiAI0UrvE64
# X9IGsiDcbM3PaLSlZPborg/yDatWjnnBimbxAMuT7d4pbZXjbYPBOeLR7zPJQ2qQ
# x/sFgiAVGiR6pgWIC85E2rIsWfBIEAla/YowZRdNmCO7ar82wBhoGdUQx6nHP18U
# eJg50EhX9Fhf5kMt3tZf4AaJzn48QsBA+O7PKbc/DZBLrthOLKzyLM6SusbpBG8g
# jFsdlDYMy9dIB6g3BC6fwZAqQNqbEMlU63ZvQzeq5yPpjFyS5H3IGHLzDiYg/9m6
# WdRUM/wQKkq0YwF1OumQ+Uu8ClTJPDi/177+hOyQeIFZao3NgznDtA12rNroYOU2
# pDIff9K9gwOFFNmDDtsjm8h967pF7RJMZylvNilT+7xkMy2kwYdCo76TBYDyN8Kk
# aYBIDpWtPps=
# =PUFU
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Mar 2023 17:54:29 GMT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'for-upstream' of https://repo.or.cz/qemu/kevin:
  qed: remove spurious BDRV_POLL_WHILE()
  iotests/308: Add test for 'write -zu'
  block/fuse: Let PUNCH_HOLE write zeroes

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16 months agoMerge tag 'pull-gitdm-100323-1' of https://gitlab.com/stsquad/qemu into staging
Peter Maydell [Sat, 11 Mar 2023 17:17:31 +0000 (17:17 +0000)]
Merge tag 'pull-gitdm-100323-1' of https://gitlab.com/stsquad/qemu into staging

gitdm updates for:

  - IBM
  - Facebook
  - Individual contributors
  - Ventana

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmQLUy8ACgkQ+9DbCVqe
# KkRCdwf+L7Y0mHKKvxVyfRO2W51HbzUYqzPF6bFgqxqwbL6CRdPw5Ks3RHGV8N6C
# Er4MIsVhzLUY7BX+IcHZG1C9/8UrtymY2tUA1Qg5L2NQ/pNvDN9OHA/HXw+JkOq2
# l/l1ZkWmlT0IZwtTrKYHjZnqxMfEOey33y+t623wtMh7Bpj/ZPjYLsYxhhkwobvc
# fPFAZ2tukkECFkvylnaoE+3S2g86EY9soZEmeSdOYPtIbeb42o38cTchaAHQnc09
# sQJ1hguRUpwi1Y1CaP3QCqS8TkdV1oObWJ4+ZfHHXmDWfI0yQfbNFBU7bGZkxGkI
# i9EKqF+xfdklrqJz9Y7jEjFfetUghA==
# =p/39
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Mar 2023 15:56:31 GMT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-gitdm-100323-1' of https://gitlab.com/stsquad/qemu:
  contrib/gitdm: add Idan to IBM's group map
  contrib/gitdm: Add Facebook the domain map
  contrib/gitdm: add Tsukasa as an individual contributor
  contrib/gitdm: Add Ventana Micro Systems to the domain map
  contrib/gitdm: Add VRULL to the domain map

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16 months agoMerge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging
Peter Maydell [Sat, 11 Mar 2023 17:17:17 +0000 (17:17 +0000)]
Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging

# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1
#
# iQEcBAABAgAGBQJkCvgFAAoJEO8Ells5jWIRHiUH/jhydpJHIqnAPxHQAwGtmyhb
# 9Z52UOzW5V6KxfZJ+bQ4RPFkS2UwcxmeadPHY4zvvJTVBLAgG3QVgP4igj8CXKCI
# xRnwMgTNeu655kZQ5P/elTwdBTCJFODk7Egg/bH3H1ZiUhXBhVRhK7q/wMgtlZkZ
# Kexo6txCK4d941RNzEh45ZaGhdELE+B+D7cRuQgBs/DXZtJpsyEzBbP8KYSMHuER
# AXfWo0YIBYj7X3ek9D6j0pbOkB61vqtYd7W6xV4iDrJCcFBIOspJbbBb1tGCHola
# AXo5/OhRmiQnp/c/HTbJIDbrj0sq/r7LxYK4zY1x7UPbewHS9R+wz+FfqSmoBF0=
# =056y
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Mar 2023 09:27:33 GMT
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* tag 'net-pull-request' of https://github.com/jasowang/qemu: (44 commits)
  ebpf: fix compatibility with libbpf 1.0+
  docs/system/devices/igb: Add igb documentation
  tests/avocado: Add igb test
  igb: Introduce qtest for igb device
  tests/qtest/libqos/e1000e: Export macreg functions
  tests/qtest/e1000e-test: Fabricate ethernet header
  Intrdocue igb device emulation
  e1000: Split header files
  pcie: Introduce pcie_sriov_num_vfs
  net/eth: Introduce EthL4HdrProto
  e1000e: Implement system clock
  net/eth: Report if headers are actually present
  e1000e: Count CRC in Tx statistics
  e1000: Count CRC in Tx statistics
  e1000e: Combine rx traces
  MAINTAINERS: Add e1000e test files
  MAINTAINERS: Add Akihiko Odaki as a e1000e reviewer
  e1000e: Do not assert when MSI-X is disabled later
  hw/net/net_tx_pkt: Check the payload length
  hw/net/net_tx_pkt: Implement TCP segmentation
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16 months agolinux-user: fix bug about incorrect base addresss of gdt on i386 and x86_64
fanwj@mail.ustc.edu.cn [Wed, 8 Feb 2023 15:49:12 +0000 (23:49 +0800)]
linux-user: fix bug about incorrect base addresss of gdt on i386 and x86_64

On linux user mode, CPUX86State::gdt::base from Different CPUX86State
Objects have same value, It is incorrect! Every CPUX86State::gdt::base
Must points to independent memory space.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1405
Signed-off-by: fanwenjie <fanwj@mail.ustc.edu.cn>
Message-Id: <4172b90.58b08.18631b77860.Coremail.fanwj@mail.ustc.edu.cn>
[lv: remove unnecessary casts, split overlong line]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle tag overflow traps
Richard Henderson [Thu, 16 Feb 2023 05:45:16 +0000 (19:45 -1000)]
linux-user/sparc: Handle tag overflow traps

This trap is raised by taddcctv and tsubcctv insns.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-16-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle floating-point exceptions
Richard Henderson [Thu, 16 Feb 2023 05:45:15 +0000 (19:45 -1000)]
linux-user/sparc: Handle floating-point exceptions

Raise SIGFPE for ieee exceptions.

The other types, such as FSR_FTT_UNIMPFPOP, should not appear,
because we enable normal emulation of missing insns at the
start of sparc_cpu_realizefn().

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-15-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle unimplemented flush trap
Richard Henderson [Thu, 16 Feb 2023 05:45:14 +0000 (19:45 -1000)]
linux-user/sparc: Handle unimplemented flush trap

For sparc64, TT_UNIMP_FLUSH == TT_ILL_INSN, so this is
already handled.  For sparc32, the kernel uses SKIP_TRAP.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-14-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle coprocessor disabled trap
Richard Henderson [Thu, 16 Feb 2023 05:45:13 +0000 (19:45 -1000)]
linux-user/sparc: Handle coprocessor disabled trap

Since qemu does not implement a sparc coprocessor, all such
instructions raise this trap.  Because of that, we never raise
the coprocessor exception trap, which would be vector 0x28.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-13-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle privilidged action trap
Richard Henderson [Thu, 16 Feb 2023 05:45:12 +0000 (19:45 -1000)]
linux-user/sparc: Handle privilidged action trap

This is raised by using an %asi < 0x80 in user-mode.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-12-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle priviledged opcode trap
Richard Henderson [Thu, 16 Feb 2023 05:45:11 +0000 (19:45 -1000)]
linux-user/sparc: Handle priviledged opcode trap

For the most part priviledged opcodes are ifdefed out of the
user-only sparc translator, which will then incorrectly produce
illegal opcode traps.  But there are some code paths that
properly raise TT_PRIV_INSN, so we must handle it.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-11-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle getcc, setcc, getpsr traps
Richard Henderson [Thu, 16 Feb 2023 05:45:10 +0000 (19:45 -1000)]
linux-user/sparc: Handle getcc, setcc, getpsr traps

These are really only meaningful for sparc32, but they're
still present for backward compatibility for sparc64.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-10-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle division by zero traps
Richard Henderson [Thu, 16 Feb 2023 05:45:09 +0000 (19:45 -1000)]
linux-user/sparc: Handle division by zero traps

In addition to the hw trap vector, there is a software trap
assigned for older sparc without hw division instructions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-9-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Handle software breakpoint trap
Richard Henderson [Thu, 16 Feb 2023 05:45:08 +0000 (19:45 -1000)]
linux-user/sparc: Handle software breakpoint trap

This is 'ta 1' for both v9 and pre-v9.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-8-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Fix sparc64_{get, set}_context traps
Richard Henderson [Thu, 16 Feb 2023 05:45:07 +0000 (19:45 -1000)]
linux-user/sparc: Fix sparc64_{get, set}_context traps

These traps are present for sparc64 with ilp32, aka sparc32plus.
Enabling them means adjusting the defines over in signal.c,
and fixing an incorrect usage of abi_ulong when we really meant
the full register, target_ulong.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-7-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Tidy window spill/fill traps
Richard Henderson [Thu, 16 Feb 2023 05:45:06 +0000 (19:45 -1000)]
linux-user/sparc: Tidy window spill/fill traps

Add some macros to localize the hw difference between v9 and pre-v9.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230216054516.1267305-6-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Use TT_TRAP for flush windows
Richard Henderson [Thu, 16 Feb 2023 05:45:05 +0000 (19:45 -1000)]
linux-user/sparc: Use TT_TRAP for flush windows

The v9 and pre-v9 code can be unified with this macro.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230216054516.1267305-5-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Tidy syscall error return
Richard Henderson [Thu, 16 Feb 2023 05:45:04 +0000 (19:45 -1000)]
linux-user/sparc: Tidy syscall error return

Reduce ifdefs with #define syscall_cc.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230216054516.1267305-4-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user/sparc: Tidy syscall trap
Richard Henderson [Thu, 16 Feb 2023 05:45:03 +0000 (19:45 -1000)]
linux-user/sparc: Tidy syscall trap

Use TT_TRAP.

For sparc32, 0x88 is the "Slowaris" system call, currently BAD_TRAP
in the kernel's ttable_32.S.  For sparc64, 0x110 is tl0_linux32, the
sparc32 trap, now folded into the TARGET_ABI32 case via TT_TRAP.

For sparc64, there does still exist trap 0x111 as tl0_oldlinux64,
which was replaced by 0x16d as tl0_linux64 in 1998.  Since no one
has noticed, don't bother implementing it now.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230216054516.1267305-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Emulate CLONE_PIDFD flag in clone()
Helge Deller [Tue, 29 Nov 2022 11:08:20 +0000 (12:08 +0100)]
linux-user: Emulate CLONE_PIDFD flag in clone()

Add emulation for the CLONE_PIDFD flag of the clone() syscall.
This flag was added in Linux kernel 5.2.

Successfully tested on a x86-64 Linux host with hppa-linux target.
Can be verified by running the testsuite of the qcoro debian package,
which breaks hard and kills the currently logged-in user without this
patch.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <Y4XoJCpvUA1JD7Sj@p100>
[lv: define CLONE_PIDFD if it is not]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Add translation for argument of msync()
Helge Deller [Thu, 15 Dec 2022 07:27:46 +0000 (08:27 +0100)]
linux-user: Add translation for argument of msync()

msync() uses the flags MS_ASYNC, MS_INVALIDATE and MS_SYNC, which differ
between platforms, specifcally on alpha and hppa.

Add a target to host translation for those and wire up a nicer strace
output.

This fixes the testsuite of the macaulay2 debian package with a hppa-linux
guest on a x86-64 host.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <Y5rMcts4qe15RaVN@p100>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: handle netlink flag NLA_F_NESTED
Mathis Marion [Tue, 7 Mar 2023 15:42:56 +0000 (16:42 +0100)]
linux-user: handle netlink flag NLA_F_NESTED

Newer kernel versions require this flag to be present contrary to older
ones. Depending on the libnl version it is added or not.

Typically when using rtnl_link_inet6_set_addr_gen_mode, the netlink
packet generated may contain the following attribute:

with libnl 3.4

  {nla_len=16, nla_type=IFLA_AF_SPEC},
  [
    {nla_len=12, nla_type=AF_INET6},
    [{nla_len=5, nla_type=IFLA_INET6_ADDR_GEN_MODE}, IN6_ADDR_GEN_MODE_NONE]
  ]

with libnl 3.7

  {nla_len=16, nla_type=NLA_F_NESTED|IFLA_AF_SPEC},
  [
    {nla_len=12, nla_type=NLA_F_NESTED|AF_INET6},
    [{nla_len=5, nla_type=IFLA_INET6_ADDR_GEN_MODE}, IN6_ADDR_GEN_MODE_NONE]]
  ]

Masking the type is likely needed in other places. Only the above cases
are implemented in this patch.

Signed-off-by: Mathis Marion <mathis.marion@silabs.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230307154256.101528-3-Mathis.Marion@silabs.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: fix sockaddr_in6 endianness
Mathis Marion [Tue, 7 Mar 2023 15:42:55 +0000 (16:42 +0100)]
linux-user: fix sockaddr_in6 endianness

The sin6_scope_id field uses the host byte order, so there is a
conversion to be made when host and target endianness differ.

Signed-off-by: Mathis Marion <mathis.marion@silabs.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230307154256.101528-2-Mathis.Marion@silabs.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Add strace for prlimit64() syscall
Helge Deller [Thu, 22 Dec 2022 19:06:39 +0000 (20:06 +0100)]
linux-user: Add strace for prlimit64() syscall

Add proper prlimit64() strace output.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20221222190639.124078-1-deller@gmx.de>
[lvivier: use print_raw_param64()]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Provide print_raw_param64() for 64-bit values
Helge Deller [Tue, 31 Jan 2023 17:18:36 +0000 (18:18 +0100)]
linux-user: Provide print_raw_param64() for 64-bit values

Add a new function print_raw_param64() to print 64-bit values in the
same way as print_raw_param(). This prevents that qemu_log() is used to
work around the problem that print_raw_param() can only print 32-bit
values when compiled for 32-bit targets.

Additionally convert the existing 64-bit users in print_timespec64(),
print_rlimit64() and print_preadwrite64() over to this new function and
drop some unneccessary spaces.

Suggested-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <Y9lNbFNyRSUhhrHa@p100>
[lvivier: remove print_preadwrite64 and print_rlimit64 part]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Fix brk() to release pages
Helge Deller [Sun, 25 Dec 2022 08:23:19 +0000 (09:23 +0100)]
linux-user: Fix brk() to release pages

The current brk() implementation does not de-allocate pages if a lower
address is given compared to earlier brk() calls.
But according to the manpage, brk() shall deallocate memory in this case
and currently it breaks a real-world application, specifically building
the debian gcl package in qemu-user.

Fix this issue by reworking the qemu brk() implementation.

Tested with the C-code testcase included in qemu commit 4d1de87c750, and
by building debian package of gcl in a hppa-linux guest on a x86-64
host.

Signed-off-by: Helge Deller <deller@gmx.de>
Message-Id: <Y6gId80ek49TK1xB@p100>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: fill out task state in /proc/self/stat
Andreas Schwab [Mon, 6 Mar 2023 09:59:29 +0000 (10:59 +0100)]
linux-user: fill out task state in /proc/self/stat

Some programs want to match an actual task state character.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <mvmedq2kxoe.fsf@suse.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: add support for xtensa FDPIC
Max Filippov [Sun, 5 Feb 2023 06:12:30 +0000 (22:12 -0800)]
linux-user: add support for xtensa FDPIC

Define xtensa-specific info_is_fdpic and fill in FDPIC-specific
registers in the xtensa version of init_thread.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Message-Id: <20230205061230.544451-1-jcmvbkbc@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Fix unaligned memory access in prlimit64 syscall
Ilya Leoshkevich [Fri, 24 Feb 2023 00:39:06 +0000 (01:39 +0100)]
linux-user: Fix unaligned memory access in prlimit64 syscall

target_rlimit64 contains uint64_t fields, so it's 8-byte aligned on
some hosts, while some guests may align their respective type on a
4-byte boundary. This may lead to an unaligned access, which is an UB.

Fix by defining the fields as abi_ullong. This makes the host alignment
match that of the guest, and lets the compiler know that it should emit
code that can deal with the guest alignment.

While at it, also use __get_user() and __put_user() instead of
tswap64().

Fixes: 163a05a8398b ("linux-user: Implement prlimit64 syscall")
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230224003907.263914-2-iii@linux.ibm.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: add target to host netlink conversions
Mathis Marion [Mon, 20 Feb 2023 08:58:21 +0000 (09:58 +0100)]
linux-user: add target to host netlink conversions

Added conversions for:
- IFLA_MTU
- IFLA_TXQLEN
- IFLA_AF_SPEC AF_INET6 IFLA_INET6_ADDR_GEN_MODE
These relate to the libnl functions rtnl_link_set_mtu,
rtnl_link_set_txqlen, and rtnl_link_inet6_set_addr_gen_mode.

Signed-off-by: Mathis Marion <mathis.marion@silabs.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230220085822.626798-4-Mathis.Marion@silabs.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: fix timerfd read endianness conversion
Mathis Marion [Mon, 20 Feb 2023 08:58:19 +0000 (09:58 +0100)]
linux-user: fix timerfd read endianness conversion

When reading the expiration count from a timerfd, the endianness of the
64bit value read is the one of the host, just as for eventfds.

Signed-off-by: Mathis Marion <mathis.marion@silabs.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230220085822.626798-2-Mathis.Marion@silabs.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agolinux-user: Fix access to /proc/self/exe
Helge Deller [Mon, 5 Dec 2022 11:38:25 +0000 (12:38 +0100)]
linux-user: Fix access to /proc/self/exe

When accsssing /proc/self/exe from a userspace program, linux-user tries
to resolve the name via realpath(), which may fail if the process
changed the working directory in the meantime.

An example:
- a userspace program ist started with ./testprogram
- the program runs chdir("/tmp")
- then the program calls readlink("/proc/self/exe")
- linux-user tries to run realpath("./testprogram") which fails
  because ./testprogram isn't in /tmp
- readlink() will return -ENOENT back to the program

Avoid this issue by resolving the full path name of the started process
at startup of linux-user and store it in real_exec_path[]. This then
simplifies the emulation of readlink() and readlinkat() as well, because
they can simply copy the path string to userspace.

I noticed this bug because the testsuite of the debian package "pandoc"
failed on linux-user while it succeeded on real hardware.  The full log
is here:
https://buildd.debian.org/status/fetch.php?pkg=pandoc&arch=hppa&ver=2.17.1.1-1.1%2Bb1&stamp=1670153210&raw=0

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20221205113825.20615-1-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
16 months agocontrib/gitdm: add Idan to IBM's group map
Alex Bennée [Mon, 19 Dec 2022 12:19:13 +0000 (12:19 +0000)]
contrib/gitdm: add Idan to IBM's group map

According to LinkedIn Idan works at IBM. Please confirm if you want
these contributions counted under IBM or as personal contributions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Idan Horowitz <idan.horowitz@gmail.com>
Message-Id: <20221219121914.851488-11-alex.bennee@linaro.org>

16 months agocontrib/gitdm: Add Facebook the domain map
Alex Bennée [Mon, 19 Dec 2022 12:19:11 +0000 (12:19 +0000)]
contrib/gitdm: Add Facebook the domain map

A number of Facebook developers contribute to the project. Peter can
you confirm your want pjd.dev contributions counted here or as
an individual contributor?

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Iris Chen <irischenlj@fb.com>
Cc: Daniel Müller <muellerd@fb.com>
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
Message-Id: <20221219121914.851488-9-alex.bennee@linaro.org>

16 months agocontrib/gitdm: add Tsukasa as an individual contributor
Alex Bennée [Mon, 19 Dec 2022 12:19:09 +0000 (12:19 +0000)]
contrib/gitdm: add Tsukasa as an individual contributor

I wasn't sure if you want to be added as an individual contributor or
an academic so please confirm.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Tsukasa OI <research_trasio@irq.a4lg.com>
Message-Id: <20221219121914.851488-7-alex.bennee@linaro.org>

16 months agocontrib/gitdm: Add Ventana Micro Systems to the domain map
Alex Bennée [Mon, 19 Dec 2022 12:19:08 +0000 (12:19 +0000)]
contrib/gitdm: Add Ventana Micro Systems to the domain map

We have a number of contributors from this domain which looks like it
is a corporate endeavour.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Rahul Pathak <rpathak@ventanamicro.com>
Cc: Anup Patel <apatel@ventanamicro.com>
Message-Id: <20221219121914.851488-6-alex.bennee@linaro.org>

16 months agocontrib/gitdm: Add VRULL to the domain map
Alex Bennée [Mon, 19 Dec 2022 12:19:06 +0000 (12:19 +0000)]
contrib/gitdm: Add VRULL to the domain map

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Message-Id: <20221219121914.851488-4-alex.bennee@linaro.org>

16 months agoMerge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into...
Peter Maydell [Fri, 10 Mar 2023 14:31:37 +0000 (14:31 +0000)]
Merge tag 'for_upstream' of https://git./virt/kvm/mst/qemu into staging

virtio,pc,pci: features, fixes

Several features that landed at the last possible moment:

Passthrough HDM decoder emulation
Refactor cryptodev
RAS error emulation and injection
acpi-index support on non-hotpluggable slots
Dynamically switch to vhost shadow virtqueues at vdpa net migration

Plus a couple of bugfixes that look important to have in the release.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmQJ8TYPHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRp37YIAMpQA5/ddmKKz/ABtBMHB5JX/SVYcG+1xkBR
# j9IFYusOfmmDfmgAhv0Qxi9+Wik95lszVZUnphvocSGd0PXH47pK7yv9RZ1ttaYX
# oAbXrGqXo8rUhl1ksQsJ8Iasj2di1BLP0byPuozbRkg1Kkz5TqRd9+hBqSBGEx21
# tsP5708UVCDAriwYYO78Cx0ZasmB9bqqeom5FdEsg9sYJ5aElOOvitp9YO1p2xhU
# gRvhD+k/aqNi+mfOUF7qGDBanxKgx75VV/KU1cjjS9R1vNtwRhfc/26PBrROY00a
# wkZWnAxmzDFKRS6cEfeb+eDGEVjC3IqLAjcFeuAIT/78CwdvIiY=
# =e1yv
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 09 Mar 2023 14:46:14 GMT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (72 commits)
  virtio: fix reachable assertion due to stale value of cached region size
  hw/virtio/vhost-user: avoid using unitialized errp
  hw/pxb-cxl: Support passthrough HDM Decoders unless overridden
  hw/pci: Add pcie_count_ds_port() and pcie_find_port_first() helpers
  hw/mem/cxl_type3: Add CXL RAS Error Injection Support.
  hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use.
  hw/cxl: Fix endian issues in CXL RAS capability defaults / masks
  hw/mem/cxl-type3: Add AER extended capability
  hw/pci-bridge/cxl_root_port: Wire up MSI
  hw/pci-bridge/cxl_root_port: Wire up AER
  hw/pci/aer: Add missing routing for AER errors
  hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register
  pcihp: add ACPI PCI hotplug specific is_hotpluggable_bus() callback
  pcihp: move fields enabling hotplug into AcpiPciHpState
  acpi: pci: move out ACPI PCI hotplug generator from generic slot generator build_append_pci_bus_devices()
  acpi: pci: move BSEL into build_append_pcihp_slots()
  acpi: pci: drop BSEL usage when deciding that device isn't hotpluggable
  pci: move acpi-index uniqueness check to generic PCI device code
  tests: acpi: update expected blobs
  tests: acpi: add non zero function device with acpi-index on non-hotpluggble bus
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16 months agoqed: remove spurious BDRV_POLL_WHILE()
Stefan Hajnoczi [Thu, 9 Mar 2023 16:31:34 +0000 (11:31 -0500)]
qed: remove spurious BDRV_POLL_WHILE()

This looks like a copy-paste or merge error. BDRV_POLL_WHILE() is
already called above. It's not needed in the qemu_in_coroutine() case.

Fixes: 9fb4dfc570ce ("qed: make bdrv_qed_do_open a coroutine_fn")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230309163134.398707-1-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
16 months agoiotests/308: Add test for 'write -zu'
Hanna Czenczek [Mon, 27 Feb 2023 10:47:25 +0000 (11:47 +0100)]
iotests/308: Add test for 'write -zu'

Try writing zeroes to a FUSE export while allowing the area to be
unmapped; block/file-posix.c generally implements writing zeroes with
BDRV_REQ_MAY_UNMAP ('write -zu') by calling fallocate(PUNCH_HOLE).  This
used to lead to a blk_pdiscard() in the FUSE export, which may or may
not lead to the area being zeroed.  HEAD^ fixed this to use
blk_pwrite_zeroes() instead (again with BDRV_REQ_MAY_UNMAP), so verify
that running `qemu-io 'write -zu'` on a FUSE exports always results in
zeroes being written.

Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230227104725.33511-3-hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
16 months agoblock/fuse: Let PUNCH_HOLE write zeroes
Hanna Czenczek [Mon, 27 Feb 2023 10:47:24 +0000 (11:47 +0100)]
block/fuse: Let PUNCH_HOLE write zeroes

fallocate(2) says about PUNCH_HOLE: "After a successful call, subsequent
reads from this range will return zeros."  As it is, PUNCH_HOLE is
implemented as a call to blk_pdiscard(), which does not guarantee this.

We must call blk_pwrite_zeroes() instead.  The difference to ZERO_RANGE
is that we pass the `BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK` flags to
the call -- the storage is supposed to be unmapped, and a slow fallback
by actually writing zeroes as data is not allowed.

Closes: https://gitlab.com/qemu-project/qemu/-/issues/1507
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230227104725.33511-2-hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
16 months agoMerge tag 'qga-pull-2023-03-08' of github.com:kostyanf14/qemu into staging
Peter Maydell [Fri, 10 Mar 2023 11:31:33 +0000 (11:31 +0000)]
Merge tag 'qga-pull-2023-03-08' of github.com:kostyanf14/qemu into staging

qga-pull-2023-03-08

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEwsLBCepDxjwUI+uE711egWG6hOcFAmQI6V0ACgkQ711egWG6
# hOegDBAAk9S6bszwuvPUIupNofujYkFKrrgHiujTOmPVXvD52C8FhojKTlW3d1QT
# f50vkMkMgavewPzsJU0SAu9kX80uOprDZwUYZ/3awSRPgL1zfFnZSZj5C/Pk4tD2
# 9rD8YjVPgvRpIhqZGTaAr97NFpigslMdba8SaucHPA1FmwRUzs1lWCX2hK9ewWuD
# /3/6Dy9mVoFGdEru2kNO5uZFUVsfatZMUQS8oOdgwHtYRkVwV7olPglQZ/iqACor
# yegxAt5tUL3WJIiYAVntiGSos0QnD7AgrGnSM5398uA4/oMVdehpAf5TyUOJ0QEy
# aq51TGZQ6Vc/0sYrsO65zaNXNsgNx1jAl7BcBleawyrdM8q/ILStXelk3MFR7Dbz
# dNi5NNHK4acEStk5XJZHc+bPQybjeWGCsQY9NBO5zLmZO2gCWnjN/nWxT6ivAgzF
# JlYfiiuLku/sZBGun7giHsKQ0EFeMzi+DdKsX3AoJhA+RJ/XEa88MTIh4EIK/tsj
# BwoPtrngsHvkazwgpb1Fa204kTAhmjx+2bpyEiNAxcRTgShxXIsm09xGOi5w8z3Q
# 48kLmkPL/xwKLImh1hx4z612VhCwdhMaLgKmri5i99jWoKJqwpnUf04JtEvyYM0d
# ErlBQsz1GOjVZTm9yCtqZwjZeM5kK83lRu7fUxmtTTA3G1H/EAM=
# =wWvd
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 08 Mar 2023 20:00:29 GMT
# gpg:                using RSA key C2C2C109EA43C63C1423EB84EF5D5E8161BA84E7
# gpg: Good signature from "Kostiantyn Kostiuk (Upstream PR sign) <kkostiuk@redhat.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: C2C2 C109 EA43 C63C 1423  EB84 EF5D 5E81 61BA 84E7

* tag 'qga-pull-2023-03-08' of github.com:kostyanf14/qemu:
  qga/win/vss: requester_freeze changes
  qga/win/vss: query VSS backup type
  qga/win/installer: add VssOption to installer
  qga/win32: Use rundll for VSS installation
  qga/win32: Remove change action from MSI installer

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>