qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 7666a8: target/arm: Mark exception helpers as


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 7666a8: target/arm: Mark exception helpers as noreturn
Date: Fri, 10 Jun 2022 13:18:21 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 7666a81d159e2ab76e8a1962e37615e8894552f5
      
https://github.com/qemu/qemu/commit/7666a81d159e2ab76e8a1962e37615e8894552f5
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/helper.h

  Log Message:
  -----------
  target/arm: Mark exception helpers as noreturn

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: fa33eead8674c08fee3ac770c20fd64970fa0142
      
https://github.com/qemu/qemu/commit/fa33eead8674c08fee3ac770c20fd64970fa0142
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/syndrome.h
    M target/arm/translate-a64.c
    M target/arm/translate-vfp.c

  Log Message:
  -----------
  target/arm: Add coproc parameter to syn_fp_access_trap

With ARMv8, this field is always RES0.
With ARMv7, targeting EL2 and TA=0, it is always 0xA.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 57287a6e953f6e6f614c87296f8c44ea9c4907b6
      
https://github.com/qemu/qemu/commit/57287a6e953f6e6f614c87296f8c44ea9c4907b6
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/internals.h
    M target/arm/op_helper.c

  Log Message:
  -----------
  target/arm: Move exception_target_el out of line

Move the function to op_helper.c, near raise_exception.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 55ba15b73734e09fc8a14c88c34cad4c0e61abb2
      
https://github.com/qemu/qemu/commit/55ba15b73734e09fc8a14c88c34cad4c0e61abb2
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/cpu.h
    M target/arm/debug_helper.c
    M target/arm/internals.h

  Log Message:
  -----------
  target/arm: Move arm_singlestep_active out of line

Move the function to debug_helper.c, and the
declaration to internals.h.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 31c8df53ee2c1bed06ea80644399d6998b887ad1
      
https://github.com/qemu/qemu/commit/31c8df53ee2c1bed06ea80644399d6998b887ad1
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/cpu.h
    M target/arm/debug_helper.c
    M target/arm/internals.h

  Log Message:
  -----------
  target/arm: Move arm_generate_debug_exceptions out of line

Move arm_generate_debug_exceptions and its two subroutines,
{aa32,aa64}_generate_debug_exceptions into debug_helper.c,
and the one interface declaration to internals.h.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 831c1b1087c3aace40a8de36c3780ead81ebbb73
      
https://github.com/qemu/qemu/commit/831c1b1087c3aace40a8de36c3780ead81ebbb73
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/debug_helper.c

  Log Message:
  -----------
  target/arm: Use is_a64 in arm_generate_debug_exceptions

Use the accessor rather than the raw structure member.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 16f9d5f6937d26f73a9694ba6bac0e113e3015e3
      
https://github.com/qemu/qemu/commit/16f9d5f6937d26f73a9694ba6bac0e113e3015e3
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/debug_helper.c
    M target/arm/op_helper.c

  Log Message:
  -----------
  target/arm: Move exception_bkpt_insn to debug_helper.c

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: a853e3ae559ddd6020012ee0e6475dfab65d1eb1
      
https://github.com/qemu/qemu/commit/a853e3ae559ddd6020012ee0e6475dfab65d1eb1
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/debug_helper.c
    M target/arm/internals.h

  Log Message:
  -----------
  target/arm: Move arm_debug_exception_fsr to debug_helper.c

This function now now only used in debug_helper.c, so there is
no reason to have a declaration in a header.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: d3c5d50a5c498e3c32c59db210d501a980091ad6
      
https://github.com/qemu/qemu/commit/d3c5d50a5c498e3c32c59db210d501a980091ad6
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/helper.h
    M target/arm/op_helper.c
    M target/arm/translate.c
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Rename helper_exception_with_syndrome

Rename to helper_exception_with_syndrome_el, to emphasize
that the target el is a parameter.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 9c9d03f0c556fb72be840773f0e8024a9a72d5e4
      
https://github.com/qemu/qemu/commit/9c9d03f0c556fb72be840773f0e8024a9a72d5e4
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate.c

  Log Message:
  -----------
  target/arm: Introduce gen_exception_insn_el_v

Create a function below gen_exception_insn that takes
the target_el as a TCGv_i32, replacing gen_exception_el.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 8c5d24dc7dace7aeb9d3d1f9eebd679c3b22e3ff
      
https://github.com/qemu/qemu/commit/8c5d24dc7dace7aeb9d3d1f9eebd679c3b22e3ff
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate-a64.c
    M target/arm/translate-m-nocp.c
    M target/arm/translate-mve.c
    M target/arm/translate-vfp.c
    M target/arm/translate.c
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Rename gen_exception_insn to gen_exception_insn_el

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 486d6c9699a5fc1f11c48dbe73b46e183020fa49
      
https://github.com/qemu/qemu/commit/486d6c9699a5fc1f11c48dbe73b46e183020fa49
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate-a64.c
    M target/arm/translate-m-nocp.c
    M target/arm/translate-mve.c
    M target/arm/translate.c
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Introduce gen_exception_insn

Create a new wrapper function that passes the default
exception target to gen_exception_insn_el.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: f0d7c2054aee5d17ed0a84a11cc8c89b38902d3c
      
https://github.com/qemu/qemu/commit/f0d7c2054aee5d17ed0a84a11cc8c89b38902d3c
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/debug_helper.c
    M target/arm/helper.h
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Create helper_exception_swstep

Move the computation from gen_swstep_exception into a helper.

This fixes a bug when:
  - MDSCR_EL1.KDE == 1 to enable debug exceptions within EL_D itself
  - we singlestep an ERET from EL_D to some lower EL

Previously we were computing 'same el' based on the EL which
executed the ERET instruction, whereas it ought to be computed
based on the EL to which ERET returned.  This happens naturally
with the new helper, which runs after EL has been changed.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-14-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 8480e933edf112d3ee775929106a2bdbaf002fbe
      
https://github.com/qemu/qemu/commit/8480e933edf112d3ee775929106a2bdbaf002fbe
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/cpu.h
    M target/arm/helper.c
    M target/arm/translate-a64.c
    M target/arm/translate.c
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL

We no longer need this value during translation,
as it is now handled within the helpers.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: cc5e672b85da3dd972cc04cd8020aeb5a60519a8
      
https://github.com/qemu/qemu/commit/cc5e672b85da3dd972cc04cd8020aeb5a60519a8
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate.c
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Move gen_exception to translate.c

This function is not required by any other translation file.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: bca6f24f0189c0e1a2ff091250d2d46c89a76401
      
https://github.com/qemu/qemu/commit/bca6f24f0189c0e1a2ff091250d2d46c89a76401
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate.c

  Log Message:
  -----------
  target/arm: Rename gen_exception to gen_exception_el

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-17-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 1a13b9a86334d85546afc4e8b568bee970d7a828
      
https://github.com/qemu/qemu/commit/1a13b9a86334d85546afc4e8b568bee970d7a828
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate.c

  Log Message:
  -----------
  target/arm: Introduce gen_exception

Create a new wrapper function that passes the default
exception target to gen_exception_el.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: d6d7f818a9eafeff01d19b70a796bf42248c3690
      
https://github.com/qemu/qemu/commit/d6d7f818a9eafeff01d19b70a796bf42248c3690
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate.c

  Log Message:
  -----------
  target/arm: Introduce gen_exception_el_v

Split out a common helper function for gen_exception_el
and gen_exception_insn_el_v.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-19-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: eeaf596022233818476bf2d1c7a41011fbba7faa
      
https://github.com/qemu/qemu/commit/eeaf596022233818476bf2d1c7a41011fbba7faa
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/helper.h
    M target/arm/op_helper.c
    M target/arm/translate.c

  Log Message:
  -----------
  target/arm: Introduce helper_exception_with_syndrome

With the helper we can use exception_target_el at runtime,
instead of default_exception_el at translate time.
While we're at it, remove the DisasContext parameter from
gen_exception, as it is no longer used.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-20-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 82303761c6fccfd7b166949149fedae9cee15efd
      
https://github.com/qemu/qemu/commit/82303761c6fccfd7b166949149fedae9cee15efd
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/translate-a64.c
    M target/arm/translate.c
    M target/arm/translate.h

  Log Message:
  -----------
  target/arm: Remove default_exception_el

This function is no longer used.  At the same time, remove
DisasContext.secure_routed_to_el3, as it in turn becomes unused.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-21-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 04eacf6e79e7489579d188acbfe3046874d7ec3e
      
https://github.com/qemu/qemu/commit/04eacf6e79e7489579d188acbfe3046874d7ec3e
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/debug_helper.c

  Log Message:
  -----------
  target/arm: Create raise_exception_debug

Handle the debug vs current el exception test in one place.
Leave EXCP_BKPT alone, since that treats debug < current differently.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-22-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 38e8a13c116b114c100f488dc6a32c9c9df3ccd0
      
https://github.com/qemu/qemu/commit/38e8a13c116b114c100f488dc6a32c9c9df3ccd0
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/cpu.h
    M target/arm/debug_helper.c

  Log Message:
  -----------
  target/arm: Move arm_debug_target_el to debug_helper.c

This function is no longer used outside debug_helper.c.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-23-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 02e1de14bcf7cc686bf4f542b36033521f22d1ee
      
https://github.com/qemu/qemu/commit/02e1de14bcf7cc686bf4f542b36033521f22d1ee
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: Fix Secure PL1 tests in fp_exception_el

We were using arm_is_secure and is_a64, which are
tests against the current EL, as opposed to
arm_el_is_aa64 and arm_is_secure_below_el3, which
can be applied to a different EL than current.
Consolidate the two tests.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609202901.1177572-24-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 284ad5e70c41e02553aeb2c1eaf4e828499cb315
      
https://github.com/qemu/qemu/commit/284ad5e70c41e02553aeb2c1eaf4e828499cb315
  Author: Hao Wu <wuhaotsh@google.com>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M tests/qtest/npcm7xx_sdhci-test.c

  Log Message:
  -----------
  tests/qtest: Reduce npcm7xx_sdhci test image size

Creating 1GB image for a simple qtest is unnecessary
and could lead to failures. We reduce the image size
to 1MB to reduce the test overhead.

Signed-off-by: Hao Wu <wuhaotsh@google.com>
Message-id: 20220609214125.4192212-1-wuhaotsh@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: bfe43e3d14687f2149451f278671c2c552d96b0a
      
https://github.com/qemu/qemu/commit/bfe43e3d14687f2149451f278671c2c552d96b0a
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: Adjust format test in scr_write

Because reset always initializes the AA64 version, SCR_EL3,
test the mode of EL3 instead of the type of the cpreg.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609214657.1217913-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 6bcbb07af6a601b2521b07a639861218fbf0c87e
      
https://github.com/qemu/qemu/commit/6bcbb07af6a601b2521b07a639861218fbf0c87e
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M target/arm/cpu.h
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: SCR_EL3.RW is RAO/WI without AArch32 EL[12]

Since DDI0487F.a, the RW bit is RAO/WI.  When specifically
targeting such a cpu, e.g. cortex-a76, it is legitimate to
ignore the bit within the secure monitor.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1062
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220609214657.1217913-3-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: ebf1b4cbb8ec357f5280dc8895548519b65a2d71
      
https://github.com/qemu/qemu/commit/ebf1b4cbb8ec357f5280dc8895548519b65a2d71
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M gdbstub.c

  Log Message:
  -----------
  gdbstub: Don't use GDB syscalls if no GDB is attached

In two places in gdbstub.c we look at gdbserver_state.init to decide
whether we're going to do a semihosting syscall via the gdb remote
protocol:
 * when setting up, if the user didn't explicitly select either
   native semihosting or gdb semihosting, we autoselect, with the
   intended behaviour "use gdb if gdb is connected"
 * when the semihosting layer attempts to do a syscall via gdb, we
   silently ignore it if the gdbstub wasn't actually set up

However, if the user's commandline sets up the gdbstub but tells QEMU
to start rather than waiting for a GDB to connect (eg using '-s' but
not '-S'), then we will have gdbserver_state.init true but no actual
connection; an attempt to use gdb syscalls will then crash because we
try to use gdbserver_state.c_cpu when it hasn't been set up:

#0  0x00007ffff6803ba8 in qemu_cpu_kick (cpu=0x0) at ../../softmmu/cpus.c:457
#1  0x00007ffff6c03913 in gdb_do_syscallv (cb=0x7ffff6c19944 <common_semi_cb>,
    fmt=0x7ffff7573b7e "", va=0x7ffff56294c0) at ../../gdbstub.c:2946
#2  0x00007ffff6c19c3a in common_semi_gdb_syscall (cs=0x7ffff83fe060,
    cb=0x7ffff6c19944 <common_semi_cb>, fmt=0x7ffff7573b75 "isatty,%x")
    at ../../semihosting/arm-compat-semi.c:494
#3  0x00007ffff6c1a064 in gdb_isattyfn (cs=0x7ffff83fe060, gf=0x7ffff86a3690)
    at ../../semihosting/arm-compat-semi.c:636
#4  0x00007ffff6c1b20f in do_common_semihosting (cs=0x7ffff83fe060)
    at ../../semihosting/arm-compat-semi.c:967
#5  0x00007ffff693a037 in handle_semihosting (cs=0x7ffff83fe060)
    at ../../target/arm/helper.c:10316

You can probably also get into this state via some odd
corner cases involving connecting a GDB and then telling it
to detach from all the vCPUs.

Abstract out the test into a new gdb_attached() function
which returns true only if there's actually a GDB connected
to the debug stub and attached to at least one vCPU.

Reported-by: Liviu Ionescu <ilg@livius.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Message-id: 20220526190053.521505-2-peter.maydell@linaro.org


  Commit: 90c072e063737e9e8f431489bbd334452f89056e
      
https://github.com/qemu/qemu/commit/90c072e063737e9e8f431489bbd334452f89056e
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M semihosting/config.c

  Log Message:
  -----------
  semihosting/config: Merge --semihosting-config option groups

Currently we mishandle the --semihosting-config option if the
user specifies it on the command line more than once. For
example with:
 --semihosting-config target=gdb --semihosting-config arg=foo,arg=bar

the function qemu_semihosting_config_options() is called twice, once
for each argument.  But that function expects to be called only once,
and it always unconditionally sets the semihosting.enabled,
semihost_chardev and semihosting.target variables.  This means that
if any of those options were set anywhere except the last
--semihosting-config option on the command line, those settings are
ignored.  In the example above, 'target=gdb' in the first option is
overridden by an implied default 'target=auto' in the second.

The QemuOptsList machinery has a flag for handling this kind of
"option group is setting global state": by setting
 .merge_lists = true;
we make the machinery merge all the --semihosting-config arguments
the user passes into a single set of options and call our
qemu_semihosting_config_options() just once.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Message-id: 20220526190053.521505-3-peter.maydell@linaro.org


  Commit: 2663c41cfa2c3be34c62de97902a375b81027efd
      
https://github.com/qemu/qemu/commit/2663c41cfa2c3be34c62de97902a375b81027efd
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M gdbstub.c
    M semihosting/config.c
    M target/arm/cpu.h
    M target/arm/debug_helper.c
    M target/arm/helper.c
    M target/arm/helper.h
    M target/arm/internals.h
    M target/arm/op_helper.c
    M target/arm/syndrome.h
    M target/arm/translate-a64.c
    M target/arm/translate-m-nocp.c
    M target/arm/translate-mve.c
    M target/arm/translate-vfp.c
    M target/arm/translate.c
    M target/arm/translate.h
    M tests/qtest/npcm7xx_sdhci-test.c

  Log Message:
  -----------
  Merge tag 'pull-target-arm-20220610' of 
https://git.linaro.org/people/pmaydell/qemu-arm into staging

 * refactor exception routing code
 * fix SCR_EL3 RAO/RAZ bits
 * gdbstub: Don't use GDB syscalls if no GDB is attached
 * semihosting/config: Merge --semihosting-config option groups
 * tests/qtest: Reduce npcm7xx_sdhci test image size

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmKjbBoZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3iMGEACAA+c88ifpbMlqmDaxPArw
# pcUNbwAel9IzCMSb/SiX0JYyf6omGx84RfKQ7hoCGnn23L47tTcRwGDXkr0vOKLG
# +JUXvkIYO9Ylp0M/PnJFL90aO7B6uMGQVfK57yjn+URlchm+wzphI/6V1jGLMVk/
# UaUHCOW2jFWXxsiUnj3HTyh46T+ZPMMebv4ZEaMH41jZs8D8DrEM65UFmCaBljPB
# eEZPMRUClveosB6O9cj9qAHT5198Za7emzvsWie6AQFI/7TVxQ5oPf8QaeB74w28
# EypXlIlMvOqF0W3mE00IPAgi8f/PgB0X6iqiwXxo+nFwm3J6rPoxo7aI5psXHQn4
# uo2U9Ngvz/A2KVm+j7Qpgst70MScDJey7h1c4w//P8gjqLGL8OxJiyGz+rv+xLkd
# L9Q4gIRJ0FK6brOVZX5aRXMqsnDzVZ8Ki5b6tCoAnfNNAq5y8i3gOss/DDYTKmO0
# C4Ectuq65Qodp82EeMPW25UT1EouCQVDgD2VkaPumI3uVn6+XKDGpM36UOctPOXm
# 6RsGvJAWsV7k0llAKjrl8p+B+bCoT6hH41oFkpl96nJuTdx7tS3+OccvEINKZwT1
# rJ5q7IcwbMJwVTbZIJckDXvbTwcj/A9e0SqSOb7AbBiHuATUZxyRbwsQFpazigsa
# t7Lj+Y/obz5shrq3BsIlYQ==
# =yMh4
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Jun 2022 09:06:50 AM PDT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" 
[full]

* tag 'pull-target-arm-20220610' of 
https://git.linaro.org/people/pmaydell/qemu-arm: (28 commits)
  semihosting/config: Merge --semihosting-config option groups
  gdbstub: Don't use GDB syscalls if no GDB is attached
  target/arm: SCR_EL3.RW is RAO/WI without AArch32 EL[12]
  target/arm: Adjust format test in scr_write
  tests/qtest: Reduce npcm7xx_sdhci test image size
  target/arm: Fix Secure PL1 tests in fp_exception_el
  target/arm: Move arm_debug_target_el to debug_helper.c
  target/arm: Create raise_exception_debug
  target/arm: Remove default_exception_el
  target/arm: Introduce helper_exception_with_syndrome
  target/arm: Introduce gen_exception_el_v
  target/arm: Introduce gen_exception
  target/arm: Rename gen_exception to gen_exception_el
  target/arm: Move gen_exception to translate.c
  target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL
  target/arm: Create helper_exception_swstep
  target/arm: Introduce gen_exception_insn
  target/arm: Rename gen_exception_insn to gen_exception_insn_el
  target/arm: Introduce gen_exception_insn_el_v
  target/arm: Rename helper_exception_with_syndrome
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/a5df4fd1e119...2663c41cfa2c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]