qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 63888f: target/arm: Fix sve_zcr_len_for_el fo


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 63888f: target/arm: Fix sve_zcr_len_for_el for VHE mode ru...
Date: Tue, 08 Feb 2022 07:03:18 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 63888fa78be5825647ce1187dcd7b2470d8bb452
      
https://github.com/qemu/qemu/commit/63888fa78be5825647ce1187dcd7b2470d8bb452
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: Fix sve_zcr_len_for_el for VHE mode running

When HCR_EL2.{E2H,TGE} == '11', ZCR_EL1 is unused.

Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Message-id: 20220127063428.30212-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 7701cee545109f737d43c73ac9d8be2523b9d54c
      
https://github.com/qemu/qemu/commit/7701cee545109f737d43c73ac9d8be2523b9d54c
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: Tidy sve_exception_el for CPACR_EL1 access

Extract entire fields for ZEN and FPEN, rather than testing specific bits.
This makes it easier to follow the code versus the ARM spec.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Message-id: 20220127063428.30212-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: d5a6fa2dcf9ea66cc5d0852ebeb4861423758be0
      
https://github.com/qemu/qemu/commit/d5a6fa2dcf9ea66cc5d0852ebeb4861423758be0
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: Fix {fp, sve}_exception_el for VHE mode running

When HCR_EL2.E2H is set, the format of CPTR_EL2 changes to
look more like CPACR_EL1, with ZEN and FPEN fields instead
of TZ and TFP fields.

Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220127063428.30212-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: a7b66ada6e88aa9a9f420f1116569b2df47fa1ab
      
https://github.com/qemu/qemu/commit/a7b66ada6e88aa9a9f420f1116569b2df47fa1ab
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M target/arm/helper.c

  Log Message:
  -----------
  target/arm: Use CPTR_TFP with CPTR_EL3 in fp_exception_el

Use the named bit rather than a bare extract32.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Message-id: 20220127063428.30212-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: c74ccb5dd6955736907256aab8229f63385a5e2e
      
https://github.com/qemu/qemu/commit/c74ccb5dd6955736907256aab8229f63385a5e2e
  Author: Francisco Iglesias <francisco.iglesias@xilinx.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/xlnx-zynqmp.c
    M include/hw/arm/xlnx-zynqmp.h

  Log Message:
  -----------
  hw/arm/xlnx-zynqmp: 'Or' the QSPI / QSPI DMA IRQs

'Or' the IRQs coming from the QSPI and QSPI DMA models. This is done for
avoiding the situation where one of the models incorrectly deasserts an
interrupt asserted from the other model (which will result in that the IRQ
is lost and will not reach guest SW).

Signed-off-by: Francisco Iglesias <francisco.iglesias@xilinx.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Message-id: 20220203151742.1457-1-francisco.iglesias@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: bddd892ef1920c9ede00ad2009b3c3b3b0cf7a44
      
https://github.com/qemu/qemu/commit/bddd892ef1920c9ede00ad2009b3c3b3b0cf7a44
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M target/arm/cpu.c

  Log Message:
  -----------
  target/arm: make psci-conduit settable after realize

We want to allow the psci-conduit property to be set after realize,
because the parts of the code which are best placed to decide if it's
OK to enable QEMU's builtin PSCI emulation (the board code and the
arm_load_kernel() function are distant from the code which creates
and realizes CPUs (typically inside an SoC object's init and realize
method) and run afterwards.

Since the DEFINE_PROP_* macros don't have support for creating
properties which can be changed after realize, change the property to
be created with object_property_add_uint32_ptr(), which is what we
already use in this function for creating settable-after-realize
properties like init-svtor and init-nsvtor.

Note that it doesn't conceptually make sense to change the setting of
the property after the machine has been completely initialized,
beacuse this would mean that the behaviour of the machine when first
started would differ from its behaviour when the system is
subsequently reset.  (It would also require the underlying state to
be migrated, which we don't do.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20220127154639.2090164-2-peter.maydell@linaro.org


  Commit: 0c3c25fcda4b7e8a458ab5ca8e5c74be3cc456f1
      
https://github.com/qemu/qemu/commit/0c3c25fcda4b7e8a458ab5ca8e5c74be3cc456f1
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M cpu.c

  Log Message:
  -----------
  cpu.c: Make start-powered-off settable after realize

The CPU object's start-powered-off property is currently only
settable before the CPU object is realized.  For arm machines this is
awkward, because we would like to decide whether the CPU should be
powered-off based on how we are booting the guest code, which is
something done in the machine model code and in common code called by
the machine model, which runs much later and in completely different
parts of the codebase from the SoC object code that is responsible
for creating and realizing the CPU objects.

Allow start-powered-off to be set after realize.  Since this isn't
something that's supported by the DEFINE_PROP_* macros, we have to
switch the property definition to use the
object_class_property_add_bool() function.

Note that it doesn't conceptually make sense to change the setting of
the property after the machine has been completely initialized,
beacuse this would mean that the behaviour of the machine when first
started would differ from its behaviour when the system is
subsequently reset.  (It would also require the underlying state to
be migrated, which we don't do.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20220127154639.2090164-3-peter.maydell@linaro.org


  Commit: 817e2db8ce276d6d287de81d2526d390369140b6
      
https://github.com/qemu/qemu/commit/817e2db8ce276d6d287de81d2526d390369140b6
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/boot.c
    M include/hw/arm/boot.h

  Log Message:
  -----------
  hw/arm/boot: Support setting psci-conduit based on guest EL

Currently we expect board code to set the psci-conduit property on
CPUs and ensure that secondary CPUs are created with the
start-powered-off property set to false, if the board wishes to use
QEMU's builtin PSCI emulation.  This worked OK for the virt board
where we first wanted to use it, because the virt board directly
creates its CPUs and is in a reasonable position to set those
properties.  For other boards which model real hardware and use a
separate SoC object, however, it is more awkward.  Most PSCI-using
boards just set the psci-conduit board unconditionally.

This was never strictly speaking correct (because you would not be
able to run EL3 guest firmware that itself provided the PSCI
interface, as the QEMU implementation would overrule it), but mostly
worked in practice because for non-PSCI SMC calls QEMU would emulate
the SMC instruction as normal (by trapping to guest EL3).  However,
we would like to make our PSCI emulation follow the part of the SMCC
specification that mandates that SMC calls with unknown function
identifiers return a failure code, which means that all SMC calls
will be handled by the PSCI code and the "emulate as normal" path
will no longer be taken.

We tried to implement that in commit 9fcd15b9193e81
("arm: tcg: Adhere to SMCCC 1.3 section 5.2"), but this
regressed attempts to run EL3 guest code on the affected boards:
 * mcimx6ul-evk, mcimx7d-sabre, orangepi, xlnx-zcu102
 * for the case only of EL3 code loaded via -kernel (and
   not via -bios or -pflash), virt and xlnx-versal-virt
so for the 7.0 release we reverted it (in commit 4825eaae4fdd56f).

This commit provides a mechanism that boards can use to arrange that
psci-conduit is set if running guest code at a low enough EL but not
if it would be running at the same EL that the conduit implies that
the QEMU PSCI implementation is using.  (Later commits will convert
individual board models to use this mechanism.)

We do this by moving the setting of the psci-conduit and
start-powered-off properties to arm_load_kernel().  Boards which want
to potentially use emulated PSCI must set a psci_conduit field in the
arm_boot_info struct to the type of conduit they want to use (SMC or
HVC); arm_load_kernel() will then set the CPUs up accordingly if it
is not going to start the guest code at the same or higher EL as the
fake QEMU firmware would be at.

Board/SoC code which uses this mechanism should no longer set the CPU
psci-conduit property directly.  It should only set the
start-powered-off property for secondaries if EL3 guest firmware
running bare metal expects that rather than the alternative "all CPUs
start executing the firmware at once".

Note that when calculating whether we are going to run guest
code at EL3, we ignore the setting of arm_boot_info::secure_board_setup,
which might cause us to run a stub bit of guest code at EL3 which
does some board-specific setup before dropping to EL2 or EL1 to
run the guest kernel. This is OK because only one board that
enables PSCI sets secure_board_setup (the highbank board), and
the stub code it writes will behave the same way whether the
one SMC call it makes is handled by "emulate the SMC" or by
"PSCI default returns an error code". So we can leave that stub
code in place until after we've changed the PSCI default behaviour;
at that point we will remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20220127154639.2090164-4-peter.maydell@linaro.org


  Commit: ae2474f1189dcbe58b1927b0f955bd4a929df8ba
      
https://github.com/qemu/qemu/commit/ae2474f1189dcbe58b1927b0f955bd4a929df8ba
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/fsl-imx6ul.c
    M hw/arm/fsl-imx7.c
    M hw/arm/mcimx6ul-evk.c
    M hw/arm/mcimx7d-sabre.c

  Log Message:
  -----------
  hw/arm: imx: Don't enable PSCI conduit when booting guest in EL3

Change the iMX-SoC based boards to use the new boot.c functionality
to allow us to enable psci-conduit only if the guest is being booted
in EL1 or EL2, so that if the user runs guest EL3 firmware code our
PSCI emulation doesn't get in its way.

To do this we stop setting the psci-conduit property on the CPU
objects in the SoC code, and instead set the psci_conduit field in
the arm_boot_info struct to tell the common boot loader code that
we'd like PSCI if the guest is starting at an EL that it makes
sense with.

This affects the mcimx6ul-evk and mcimx7d-sabre boards.

Note that for the mcimx7d board, this means that when running guest
code at EL3 there is currently no way to power on the secondary CPUs,
because we do not currently have a model of the system reset
controller module which should be used to do that for the imx7 SoC,
only for the imx6 SoC.  (Previously EL3 code which knew it was
running on QEMU could use a PSCI call to do this.) This doesn't
affect the imx6ul-evk board because it is uniprocessor.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220127154639.2090164-5-peter.maydell@linaro.org


  Commit: 49865b901466d8f8ad4f16df4bcd076eee268e0f
      
https://github.com/qemu/qemu/commit/49865b901466d8f8ad4f16df4bcd076eee268e0f
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/allwinner-h3.c
    M hw/arm/orangepi.c

  Log Message:
  -----------
  hw/arm: allwinner: Don't enable PSCI conduit when booting guest in EL3

Change the allwinner-h3 based board to use the new boot.c
functionality to allow us to enable psci-conduit only if the guest is
being booted in EL1 or EL2, so that if the user runs guest EL3
firmware code our PSCI emulation doesn't get in its way.

To do this we stop setting the psci-conduit property on the CPU
objects in the SoC code, and instead set the psci_conduit field in
the arm_boot_info struct to tell the common boot loader code that
we'd like PSCI if the guest is starting at an EL that it makes sense
with.

This affects the orangepi-pc board.

This commit leaves the secondary CPUs in the powered-down state if
the guest is booting at EL3, which is the same behaviour as before
this commit.  The secondaries can no longer be started by that EL3
code making a PSCI call but can still be started via the CPU
Configuration Module registers (which we model in
hw/misc/allwinner-cpucfg.c).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-6-peter.maydell@linaro.org


  Commit: 50c785f2c70c1e12d01e76cbbd2facc3c8e8d637
      
https://github.com/qemu/qemu/commit/50c785f2c70c1e12d01e76cbbd2facc3c8e8d637
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/xlnx-zcu102.c
    M hw/arm/xlnx-zynqmp.c

  Log Message:
  -----------
  hw/arm/xlnx-zcu102: Don't enable PSCI conduit when booting guest in EL3

Change the Xilinx ZynqMP-based board xlnx-zcu102 to use the new
boot.c functionality to allow us to enable psci-conduit only if
the guest is being booted in EL1 or EL2, so that if the user runs
guest EL3 firmware code our PSCI emulation doesn't get in its
way.

To do this we stop setting the psci-conduit property on the CPU
objects in the SoC code, and instead set the psci_conduit field in
the arm_boot_info struct to tell the common boot loader code that
we'd like PSCI if the guest is starting at an EL that it makes
sense with.

Note that this means that EL3 guest code will have no way
to power on secondary cores, because we don't model any
kind of power controller that does that on this SoC.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220127154639.2090164-7-peter.maydell@linaro.org


  Commit: 9437a76e1002890fd23da841e1f5bac3f5fa0db7
      
https://github.com/qemu/qemu/commit/9437a76e1002890fd23da841e1f5bac3f5fa0db7
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/xlnx-versal-virt.c
    M hw/arm/xlnx-versal.c
    M include/hw/arm/xlnx-versal.h

  Log Message:
  -----------
  hw/arm/versal: Let boot.c handle PSCI enablement

Instead of setting the CPU psci-conduit and start-powered-off
properties in the xlnx-versal-virt board code, set the arm_boot_info
psci_conduit field so that the boot.c code can do it.

This will fix a corner case where we were incorrectly enabling PSCI
emulation when booting guest code into EL3 because it was an ELF file
passed to -kernel.  (EL3 guest code started via -bios, -pflash, or
the generic loader was already being run with PSCI emulation
disabled.)

Note that EL3 guest code has no way to turn on the secondary CPUs
because there's no emulated power controller, but this was already
true for EL3 guest code run via -bios, -pflash, or the generic
loader.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-8-peter.maydell@linaro.org


  Commit: 52c235ad7500771f790521d65fb1e19b126a6a32
      
https://github.com/qemu/qemu/commit/52c235ad7500771f790521d65fb1e19b126a6a32
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/virt.c

  Log Message:
  -----------
  hw/arm/virt: Let boot.c handle PSCI enablement

Instead of setting the CPU psci-conduit and start-powered-off
properties in the virt board code, set the arm_boot_info psci_conduit
field so that the boot.c code can do it.

This will fix a corner case where we were incorrectly enabling PSCI
emulation when booting guest code into EL3 because it was an ELF file
passed to -kernel or to the generic loader.  (EL3 guest code started
via -bios or -pflash was already being run with PSCI emulation
disabled.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-9-peter.maydell@linaro.org


  Commit: 33284d482c29973a30fee7dfa9728121689fd250
      
https://github.com/qemu/qemu/commit/33284d482c29973a30fee7dfa9728121689fd250
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/highbank.c

  Log Message:
  -----------
  hw/arm: highbank: For EL3 guests, don't enable PSCI, start all cores

Change the highbank/midway boards to use the new boot.c functionality
to allow us to enable psci-conduit only if the guest is being booted
in EL1 or EL2, so that if the user runs guest EL3 firmware code our
PSCI emulation doesn't get in its way.

To do this we stop setting the psci-conduit and start-powered-off
properties on the CPU objects in the board code, and instead set the
psci_conduit field in the arm_boot_info struct to tell the common
boot loader code that we'd like PSCI if the guest is starting at an
EL that it makes sense with (in which case it will set these
properties).

This means that when running guest code at EL3, all the cores
will start execution at once on poweron. This matches the
real hardware behaviour. (A brief description of the hardware
boot process is in the u-boot documentation for these boards:
https://u-boot.readthedocs.io/en/latest/board/highbank/highbank.html#boot-process
 -- in theory one might run the 'a9boot'/'a15boot' secure monitor
code in QEMU, though we probably don't emulate enough for that.)

This affects the highbank and midway boards.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-10-peter.maydell@linaro.org


  Commit: 3f37979bf5dae9de7fe23e2d48c53d2ba79afe79
      
https://github.com/qemu/qemu/commit/3f37979bf5dae9de7fe23e2d48c53d2ba79afe79
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M target/arm/psci.c

  Log Message:
  -----------
  arm: tcg: Adhere to SMCCC 1.3 section 5.2

The SMCCC 1.3 spec section 5.2 says

  The Unknown SMC Function Identifier is a sign-extended value of (-1)
  that is returned in the R0, W0 or X0 registers. An implementation must
  return this error code when it receives:

    * An SMC or HVC call with an unknown Function Identifier
    * An SMC or HVC call for a removed Function Identifier
    * An SMC64/HVC64 call from AArch32 state

To comply with these statements, let's always return -1 when we encounter
an unknown HVC or SMC call.

[PMM:
 This is a reinstatement of commit 9fcd15b9193e819b, previously
 reverted in commit 4825eaae4fdd56fba0f; we can do this now that we
 have arranged for all the affected board models to not enable the
 PSCI emulation if they are running guest code at EL3. This avoids
 the regressions that caused us to revert the change for 7.0.]

Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 61b82973e746ff750fbbafe10fa6e3c416b01321
      
https://github.com/qemu/qemu/commit/61b82973e746ff750fbbafe10fa6e3c416b01321
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/highbank.c

  Log Message:
  -----------
  hw/arm/highbank: Drop use of secure_board_setup

Guest code on highbank may make non-PSCI SMC calls in order to
enable/disable the L2x0 cache controller (see the Linux kernel's
arch/arm/mach-highbank/highbank.c highbank_l2c310_write_sec()
function).  The ABI for this is documented in kernel commit
8e56130dcb as being borrowed from the OMAP44xx ROM.  The OMAP44xx TRM
documents this function ID as having no return value and potentially
trashing all guest registers except SP and PC. For QEMU's purposes
(where our L2x0 model is a stub and enabling or disabling it doesn't
affect the guest behaviour) a simple "do nothing" SMC is fine.

We currently implement this NOP behaviour using a little bit of
Secure code we run before jumping to the guest kernel, which is
written by arm_write_secure_board_setup_dummy_smc().  The code sets
up a set of Secure vectors where the SMC entry point returns without
doing anything.

Now that the PSCI SMC emulation handles all SMC calls (setting r0 to
an error code if the input r0 function identifier is not recognized),
we can use that default behaviour as sufficient for the highbank
cache controller call.  (Because the guest code assumes r0 has no
interesting value on exit it doesn't matter that we set it to the
error code).  We can therefore delete the highbank board code that
sets secure_board_setup to true and writes the secure-code bootstub.

(Note that because the OMAP44xx ABI puts function-identifiers in
r12 and PSCI uses r0, we only avoid a clash because Linux's code
happens to put the function-identifier in both registers. But this
is true also when the kernel is running on real firmware that
implements both ABIs as far as I can see.)

This change fixes in passing booting on the 'midway' board model,
which has been completely broken since we added support for Hyp
mode to the Cortex-A15 CPU. When we did that boot.c was made to
start running the guest code in Hyp mode; this includes the
board_setup hook, which instantly UNDEFs because the NSACR is
not accessible from Hyp. (Put another way, we never made the
secure_board_setup hook support cope with Hyp mode.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-12-peter.maydell@linaro.org


  Commit: dc888dd43bea83b1ccc3d0554d5044179554a5f1
      
https://github.com/qemu/qemu/commit/dc888dd43bea83b1ccc3d0554d5044179554a5f1
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/boot.c

  Log Message:
  -----------
  hw/arm/boot: Prevent setting both psci_conduit and secure_board_setup

Now that we have dealt with the one special case (highbank) that needed
to set both psci_conduit and secure_board_setup, we don't need to
allow that combination any more. It doesn't make sense in general,
so use an assertion to ensure we don't add new boards that do it
by accident without thinking through the consequences.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-13-peter.maydell@linaro.org


  Commit: d4a29ed6db32ae2f21561e87e27936782e0b8a44
      
https://github.com/qemu/qemu/commit/d4a29ed6db32ae2f21561e87e27936782e0b8a44
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/boot.c
    M include/hw/arm/boot.h

  Log Message:
  -----------
  hw/arm/boot: Don't write secondary boot stub if using PSCI

If we're using PSCI emulation to start secondary CPUs, there is no
point in writing the "secondary boot" stub code, because it will
never be used -- secondary CPUs start powered-off, and when powered
on are set to begin execution at the address specified by the guest's
power-on PSCI call, not at the stub.

Move the call to the hook that writes the secondary boot stub code so
that we can do it only if we're starting a Linux kernel and not using
PSCI.

(None of the users of the hook care about the ordering of its call
relative to anything else: they only use it to write a rom blob to
guest memory.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-14-peter.maydell@linaro.org


  Commit: 45dd668f2382475c71528b00465aaaf791cc4369
      
https://github.com/qemu/qemu/commit/45dd668f2382475c71528b00465aaaf791cc4369
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/highbank.c

  Log Message:
  -----------
  hw/arm/highbank: Drop unused secondary boot stub code

The highbank and midway board code includes boot-stub code for
handling secondary CPU boot which keeps the secondaries in a pen
until the primary writes to a known location with the address they
should jump to.

This code is never used, because the boards enable QEMU's PSCI
emulation, so secondary CPUs are kept powered off until the PSCI call
which turns them on, and then start execution from the address given
by the guest in that PSCI call.  Delete the unreachable code.

(The code was wrong for midway in any case -- on the Cortex-A15 the
GIC CPU interface registers are at a different offset from PERIPHBASE
compared to the Cortex-A9, and the code baked-in the offsets for
highbank's A9.)

Note that this commit implicitly depends on the preceding "Don't
write secondary boot stub if using PSCI" commit -- the default
secondary-boot stub code overlaps with one of the highbank-specific
bootcode rom blobs, so we must suppress the secondary-boot
stub code entirely, not merely replace the highbank-specific
version with the default.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-15-peter.maydell@linaro.org


  Commit: d6dc926e6e81dbb7e28d0842f7e78f99b80ce650
      
https://github.com/qemu/qemu/commit/d6dc926e6e81dbb7e28d0842f7e78f99b80ce650
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/aspeed.c
    M hw/arm/boot.c
    M hw/arm/exynos4_boards.c
    M hw/arm/highbank.c
    M hw/arm/imx25_pdk.c
    M hw/arm/kzm.c
    M hw/arm/mcimx6ul-evk.c
    M hw/arm/mcimx7d-sabre.c
    M hw/arm/npcm7xx.c
    M hw/arm/orangepi.c
    M hw/arm/raspi.c
    M hw/arm/realview.c
    M hw/arm/sabrelite.c
    M hw/arm/sbsa-ref.c
    M hw/arm/vexpress.c
    M hw/arm/virt.c
    M hw/arm/xilinx_zynq.c
    M include/hw/arm/boot.h

  Log Message:
  -----------
  hw/arm/boot: Drop nb_cpus field from arm_boot_info

We use the arm_boot_info::nb_cpus field in only one place, and that
place can easily get the number of CPUs locally rather than relying
on the board code to have set the field correctly.  (At least one
board, xlnx-versal-virt, does not set the field despite having more
than one CPU.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-16-peter.maydell@linaro.org


  Commit: e4b0bb80713a8ae530fd868ca84543f1b8ecb290
      
https://github.com/qemu/qemu/commit/e4b0bb80713a8ae530fd868ca84543f1b8ecb290
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/boot.c

  Log Message:
  -----------
  hw/arm/boot: Drop existing dtb /psci node rather than retaining it

If we're using PSCI emulation, we add a /psci node to the device tree
we pass to the guest.  At the moment, if the dtb already has a /psci
node in it, we retain it, rather than replacing it. (This behaviour
was added in commit c39770cd637765 in 2018.)

This is a problem if the existing node doesn't match our PSCI
emulation.  In particular, it might specify the wrong method (HVC vs
SMC), or wrong function IDs for cpu_suspend/cpu_off/etc, in which
case the guest will not get the behaviour it wants when it makes PSCI
calls.

An example of this is trying to boot the highbank or midway board
models using the device tree supplied in the kernel sources: this
device tree includes a /psci node that specifies function IDs that
don't match the (PSCI 0.2 compliant) IDs that QEMU uses.  The dtb
cpu_suspend function ID happens to match the PSCI 0.2 cpu_off ID, so
the guest hangs after booting when the kernel tries to idle the CPU
and instead it gets turned off.

Instead of retaining an existing /psci node, delete it entirely
and replace it with a node whose properties match QEMU's PSCI
emulation behaviour. This matches the way we handle /memory nodes,
where we also delete any existing nodes and write in ones that
match the way QEMU is going to behave.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20220127154639.2090164-17-peter.maydell@linaro.org


  Commit: 40874a383dd9b4bca0f09b07641487919645d8c4
      
https://github.com/qemu/qemu/commit/40874a383dd9b4bca0f09b07641487919645d8c4
  Author: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/xlnx-versal-virt.c

  Log Message:
  -----------
  hw/arm: versal-virt: Always call arm_load_kernel()

Always call arm_load_kernel() regardless of kernel_filename being
set. This is needed because arm_load_kernel() sets up reset for
the CPUs.

Fixes: 6f16da53ff (hw/arm: versal: Add a virtual Xilinx Versal board)
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20220130110313.4045351-2-edgar.iglesias@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: c737d868047f6ae91325adcd3a40f509753a1d85
      
https://github.com/qemu/qemu/commit/c737d868047f6ae91325adcd3a40f509753a1d85
  Author: Alex Bennée <alex.bennee@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

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

  Log Message:
  -----------
  arm: force flag recalculation when messing with DAIF

The recently introduced debug tests in kvm-unit-tests exposed an error
in our handling of singlestep cause by stale hflags. This is caught by
--enable-debug-tcg when running the tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reported-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220202122353.457084-1-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 77cd997161cc853c758b68eebb52827d56bc020e
      
https://github.com/qemu/qemu/commit/77cd997161cc853c758b68eebb52827d56bc020e
  Author: Richard Petri <git@rpls.de>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/timer/armv7m_systick.c

  Log Message:
  -----------
  hw/timer/armv7m_systick: Update clock source before enabling timer

Starting the SysTick timer and changing the clock source a the same time
will result in an error, if the previous clock period was zero. For exmaple,
on the mps2-tz platforms, no refclk is present. Right after reset, the
configured ptimer period is zero, and trying to enabling it will turn it off
right away. E.g., code running on the platform setting

    SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;

should change the clock source and enable the timer on real hardware, but
resulted in an error in qemu.

Signed-off-by: Richard Petri <git@rpls.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220201192650.289584-1-git@rpls.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 43530095e18fd16dcd51a4b385ad2a22c36f5698
      
https://github.com/qemu/qemu/commit/43530095e18fd16dcd51a4b385ad2a22c36f5698
  Author: Eric Auger <eric.auger@redhat.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/arm/smmuv3.c

  Log Message:
  -----------
  hw/arm/smmuv3: Fix device reset

We currently miss a bunch of register resets in the device reset
function. This sometimes prevents the guest from rebooting after
a system_reset (with virtio-blk-pci). For instance, we may get
the following errors:

invalid STE
smmuv3-iommu-memory-region-0-0 translation failed for 
iova=0x13a9d2000(SMMU_EVT_C_BAD_STE)
Invalid read at addr 0x13A9D2000, size 2, region '(null)', reason: rejected
invalid STE
smmuv3-iommu-memory-region-0-0 translation failed for 
iova=0x13a9d2000(SMMU_EVT_C_BAD_STE)
Invalid write at addr 0x13A9D2000, size 2, region '(null)', reason: rejected
invalid STE

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20220202111602.627429-1-eric.auger@redhat.com
Fixes: 10a83cb988 ("hw/arm/smmuv3: Skeleton")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: b6f96009acc90a88db7f8913788f989b521eb938
      
https://github.com/qemu/qemu/commit/b6f96009acc90a88db7f8913788f989b521eb938
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c
    M hw/intc/gicv3_internal.h

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Use address_space_map() to access command queue packets

Currently the ITS accesses each 8-byte doubleword in a 4-doubleword
command packet with a separate address_space_ldq_le() call.  This is
awkward because the individual command processing functions have
ended up with code to handle "load more doublewords out of the
packet", which is both unwieldy and also a potential source of bugs
because it's not obvious when looking at a line that pulls a field
out of the 'value' variable which of the 4 doublewords that variable
currently holds.

Switch to using address_space_map() to map the whole command packet
at once and fish the four doublewords out of it.  Then each process_*
function can start with a few lines of code that extract the fields
it cares about.

This requires us to split out the guts of process_its_cmd() into a
new do_process_its_cmd(), because we were previously overloading the
value and offset arguments as a backdoor way to directly pass the
devid and eventid from a write to GITS_TRANSLATER.  The new
do_process_its_cmd() takes those arguments directly, and
process_its_cmd() is just a wrapper that does the "read fields from
command packet" part.

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


  Commit: 4acf93e193af22556c21ec2d94247dc09f28d75a
      
https://github.com/qemu/qemu/commit/4acf93e193af22556c21ec2d94247dc09f28d75a
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Keep DTEs as a struct, not a raw uint64_t

In the ITS, a DTE is an entry in the device table, which contains
multiple fields. Currently the function get_dte() which reads one
entry from the device table returns it as a raw 64-bit integer,
which we then pass around in that form, only extracting fields
from it as we need them.

Create a real C struct with the same fields as the DTE, and
populate it in get_dte(), so that that function and update_dte()
are the only ones that need to care about the in-guest-memory
format of the DTE.

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


  Commit: 22d62b08ba7a3909d42f4fdf097eb2ae8c9c00e3
      
https://github.com/qemu/qemu/commit/22d62b08ba7a3909d42f4fdf097eb2ae8c9c00e3
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Pass DTEntry to update_dte()

Make update_dte() take a DTEntry struct rather than all the fields of
the new DTE as separate arguments.

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


  Commit: d37cf49b11f3ef78c3265a941faf320ee4f96bdf
      
https://github.com/qemu/qemu/commit/d37cf49b11f3ef78c3265a941faf320ee4f96bdf
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Keep CTEs as a struct, not a raw uint64_t

In the ITS, a CTE is an entry in the collection table, which contains
multiple fields. Currently the function get_cte() which reads one
entry from the device table returns a success/failure boolean and
passes back the raw 64-bit integer CTE value via a pointer argument.
We then extract fields from the CTE as we need them.

Create a real C struct with the same fields as the CTE, and
populate it in get_cte(), so that that function and update_cte()
are the only ones which need to care about the in-guest-memory
format of the CTE.

This brings get_cte()'s API into line with get_dte().

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


  Commit: 06985cc3fe5a5a7577ddd43406758aa79099b4f7
      
https://github.com/qemu/qemu/commit/06985cc3fe5a5a7577ddd43406758aa79099b4f7
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Pass CTEntry to update_cte()

Make update_cte() take a CTEntry struct rather than all the fields
of the new CTE as separate arguments.

This brings it into line with the update_dte() API.

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


  Commit: a1ce993da6fc27b022075b02a2e1e1e5be329254
      
https://github.com/qemu/qemu/commit/a1ce993da6fc27b022075b02a2e1e1e5be329254
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c
    M hw/intc/gicv3_internal.h

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Fix address calculation in get_ite() and update_ite()

In get_ite() and update_ite() we work with a 12-byte in-guest-memory
table entry, which we intend to handle as an 8-byte value followed by
a 4-byte value.  Unfortunately the calculation of the address of the
4-byte value is wrong, because we write it as:

 table_base_address + (index * entrysize) + 4
(obfuscated by the way the expression has been written)

when it should be + 8.  This bug meant that we overwrote the top
bytes of the 8-byte value with the 4-byte value.  There are no
guest-visible effects because the top half of the 8-byte value
contains only the doorbell interrupt field, which is used only in
GICv4, and the two bugs in the "write ITE" and "read ITE" codepaths
cancel each other out.

We can't simply change the calculation, because this would break
migration of a (TCG) guest from the old version of QEMU which had
in-guest-memory interrupt tables written using the buggy version of
update_ite().  We must also at the same time change the layout of the
fields within the ITE_L and ITE_H values so that the in-memory
locations of the fields we care about (VALID, INTTYPE, INTID and
ICID) stay the same.

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


  Commit: 2954b93fe6e6173afbda124469af31c58e266ca1
      
https://github.com/qemu/qemu/commit/2954b93fe6e6173afbda124469af31c58e266ca1
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Avoid nested ifs in get_ite()

The get_ite() code has some awkward nested if statements; clean
them up by returning early if the memory accesses fail.

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


  Commit: 244194fe24dbaf1aa820a9ac5a9d7a8373288389
      
https://github.com/qemu/qemu/commit/244194fe24dbaf1aa820a9ac5a9d7a8373288389
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Pass ITE values back from get_ite() via a struct

In get_ite() we currently return the caller some of the fields of an
Interrupt Table Entry via a set of pointer arguments, and validate
some of them internally (interrupt type and valid bit) to return a
simple true/false 'valid' indication. Define a new ITEntry struct
which has all the fields that the in-memory ITE has, and bring the
get_ite() function in to line with get_dte() and get_cte().

This paves the way for handling virtual interrupts, which will want
a different subset of the fields in the ITE. Handling them under
the old "lots of pointer arguments" scheme would have meant a
confusingly large set of arguments for this function.

The new struct ITEntry is obviously confusably similar to the
existing IteEntry struct, whose fields are the raw 12 bytes
of the in-memory ITE. In the next commit we will make update_ite()
use ITEntry instead of IteEntry, which will allow us to delete
the IteEntry struct and remove the confusion.

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


  Commit: 7eb54267f243a336deaf3c806a5b5422365ee861
      
https://github.com/qemu/qemu/commit/7eb54267f243a336deaf3c806a5b5422365ee861
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Make update_ite() use ITEntry

Make the update_ite() struct use the new ITEntry struct, so that
callers don't need to assemble the in-memory ITE data themselves, and
only get_ite() and update_ite() need to care about that in-memory
layout.  We can then drop the no-longer-used IteEntry struct
definition.

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


  Commit: da4680ce3a03b0cc13fe7a2b98b815c039517f26
      
https://github.com/qemu/qemu/commit/da4680ce3a03b0cc13fe7a2b98b815c039517f26
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c
    M include/hw/intc/arm_gicv3_its_common.h

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Drop TableDesc and CmdQDesc valid fields

Currently we track in the TableDesc and CmdQDesc structs the state of
the GITS_BASER<n> and GITS_CBASER Valid bits.  However we aren't very
consistent abut checking the valid field: we test it in update_cte()
and update_dte(), but not anywhere else we look things up in tables.

The GIC specification says that it is UNPREDICTABLE if a guest fails
to set any of these Valid bits before enabling the ITS via
GITS_CTLR.Enabled.  So we can choose to handle Valid == 0 as
equivalent to a zero-length table.  This is in fact how we're already
catching this case in most of the table-access paths: when Valid is 0
we leave the num_entries fields in TableDesc or CmdQDesc set to zero,
and then the out-of-bounds check "index >= num_entries" that we have
to do anyway before doing any of these table lookups will always be
true, catching the no-valid-table case without any extra code.

So we can remove the checks on the valid field from update_cte()
and update_dte(): since these happen after the bounds check there
was never any case when the test could fail. That means the valid
fields would be entirely unused, so just remove them.

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


  Commit: 84d43d2e82dad29db43a96c2ef22606ce834b248
      
https://github.com/qemu/qemu/commit/84d43d2e82dad29db43a96c2ef22606ce834b248
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: In MAPC with V=0, don't check rdbase field

In the MAPC command, if V=0 this is a request to delete a collection
table entry and the rdbase field of the command packet will not be
used.  In particular, the specification says that the "UNPREDICTABLE
if rdbase is not valid" only applies for V=1.

We were doing a check-and-log-guest-error on rdbase regardless of
whether the V bit was set, and also (harmlessly but confusingly)
storing the contents of the rdbase field into the updated collection
table entry.  Update the code so that if V=0 we don't check or use
the rdbase field value.

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


  Commit: 333024140730c9294dafb4158e396faeb4b3f6fe
      
https://github.com/qemu/qemu/commit/333024140730c9294dafb4158e396faeb4b3f6fe
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Don't allow intid 1023 in MAPI/MAPTI

When handling MAPI/MAPTI, we allow the supplied interrupt ID to be
either 1023 or something in the valid LPI range.  This is a mistake:
only a real valid LPI is allowed.  (The general behaviour of the ITS
is that most interrupt ID fields require a value in the LPI range;
the exception is that fields specifying a doorbell value, which are
all in GICv4 commands, allow also 1023 to mean "no doorbell".)
Remove the condition that incorrectly allows 1023 here.

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


  Commit: d7d359c4ac1cafd1051c5f6f7ff8349aba579718
      
https://github.com/qemu/qemu/commit/d7d359c4ac1cafd1051c5f6f7ff8349aba579718
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/intc/arm_gicv3_its.c

  Log Message:
  -----------
  hw/intc/arm_gicv3_its: Split error checks

In most of the ITS command processing, we check different error
possibilities one at a time and log them appropriately. In
process_mapti() and process_mapd() we have code which checks
multiple error cases at once, which means the logging is less
specific than it could be. Split those cases up.

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


  Commit: 4fd1ebb10593087d45d2f56f7f3d13447d24802c
      
https://github.com/qemu/qemu/commit/4fd1ebb10593087d45d2f56f7f3d13447d24802c
  Author: Kevin Townsend <kevin.townsend@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M hw/sensor/Kconfig
    A hw/sensor/lsm303dlhc_mag.c
    M hw/sensor/meson.build
    A tests/qtest/lsm303dlhc-mag-test.c
    M tests/qtest/meson.build

  Log Message:
  -----------
  hw/sensor: Add lsm303dlhc magnetometer device

This commit adds emulation of the magnetometer on the LSM303DLHC.
It allows the magnetometer's X, Y and Z outputs to be set via the
mag-x, mag-y and mag-z properties, as well as the 12-bit
temperature output via the temperature property. Sensor can be
enabled with 'CONFIG_LSM303DLHC_MAG=y'.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Message-id: 20220130095032.35392-1-kevin.townsend@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


  Commit: 0a301624c2f4ced3331ffd5bce85b4274fe132af
      
https://github.com/qemu/qemu/commit/0a301624c2f4ced3331ffd5bce85b4274fe132af
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M cpu.c
    M hw/arm/allwinner-h3.c
    M hw/arm/aspeed.c
    M hw/arm/boot.c
    M hw/arm/exynos4_boards.c
    M hw/arm/fsl-imx6ul.c
    M hw/arm/fsl-imx7.c
    M hw/arm/highbank.c
    M hw/arm/imx25_pdk.c
    M hw/arm/kzm.c
    M hw/arm/mcimx6ul-evk.c
    M hw/arm/mcimx7d-sabre.c
    M hw/arm/npcm7xx.c
    M hw/arm/orangepi.c
    M hw/arm/raspi.c
    M hw/arm/realview.c
    M hw/arm/sabrelite.c
    M hw/arm/sbsa-ref.c
    M hw/arm/smmuv3.c
    M hw/arm/vexpress.c
    M hw/arm/virt.c
    M hw/arm/xilinx_zynq.c
    M hw/arm/xlnx-versal-virt.c
    M hw/arm/xlnx-versal.c
    M hw/arm/xlnx-zcu102.c
    M hw/arm/xlnx-zynqmp.c
    M hw/intc/arm_gicv3_its.c
    M hw/intc/gicv3_internal.h
    M hw/sensor/Kconfig
    A hw/sensor/lsm303dlhc_mag.c
    M hw/sensor/meson.build
    M hw/timer/armv7m_systick.c
    M include/hw/arm/boot.h
    M include/hw/arm/xlnx-versal.h
    M include/hw/arm/xlnx-zynqmp.h
    M include/hw/intc/arm_gicv3_its_common.h
    M target/arm/cpu.c
    M target/arm/helper-a64.c
    M target/arm/helper.c
    M target/arm/psci.c
    A tests/qtest/lsm303dlhc-mag-test.c
    M tests/qtest/meson.build

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20220208' 
into staging

target-arm queue:
 * Fix handling of SVE ZCR_LEN when using VHE
 * xlnx-zynqmp: 'Or' the QSPI / QSPI DMA IRQs
 * Don't ever enable PSCI when booting guest in EL3
 * Adhere to SMCCC 1.3 section 5.2
 * highbank: Fix issues with booting SMP
 * midway: Fix issues booting at all
 * boot: Drop existing dtb /psci node rather than retaining it
 * versal-virt: Always call arm_load_kernel()
 * force flag recalculation when messing with DAIF
 * hw/timer/armv7m_systick: Update clock source before enabling timer
 * hw/arm/smmuv3: Fix device reset
 * hw/intc/arm_gicv3_its: refactorings and minor bug fixes
 * hw/sensor: Add lsm303dlhc magnetometer device

# gpg: Signature made Tue 08 Feb 2022 11:39:15 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" 
[ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20220208: (39 commits)
  hw/sensor: Add lsm303dlhc magnetometer device
  hw/intc/arm_gicv3_its: Split error checks
  hw/intc/arm_gicv3_its: Don't allow intid 1023 in MAPI/MAPTI
  hw/intc/arm_gicv3_its: In MAPC with V=0, don't check rdbase field
  hw/intc/arm_gicv3_its: Drop TableDesc and CmdQDesc valid fields
  hw/intc/arm_gicv3_its: Make update_ite() use ITEntry
  hw/intc/arm_gicv3_its: Pass ITE values back from get_ite() via a struct
  hw/intc/arm_gicv3_its: Avoid nested ifs in get_ite()
  hw/intc/arm_gicv3_its: Fix address calculation in get_ite() and update_ite()
  hw/intc/arm_gicv3_its: Pass CTEntry to update_cte()
  hw/intc/arm_gicv3_its: Keep CTEs as a struct, not a raw uint64_t
  hw/intc/arm_gicv3_its: Pass DTEntry to update_dte()
  hw/intc/arm_gicv3_its: Keep DTEs as a struct, not a raw uint64_t
  hw/intc/arm_gicv3_its: Use address_space_map() to access command queue packets
  hw/arm/smmuv3: Fix device reset
  hw/timer/armv7m_systick: Update clock source before enabling timer
  arm: force flag recalculation when messing with DAIF
  hw/arm: versal-virt: Always call arm_load_kernel()
  hw/arm/boot: Drop existing dtb /psci node rather than retaining it
  hw/arm/boot: Drop nb_cpus field from arm_boot_info
  ...

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


Compare: https://github.com/qemu/qemu/compare/55ef0b702bc2...0a301624c2f4



reply via email to

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