All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PULL 08/41] target/arm: Set CTR_EL0.{IDC,DIC} for the 'max' CPU
Date: Wed, 17 Jan 2024 18:24:16 -0300	[thread overview]
Message-ID: <877ck7d56n.fsf@suse.de> (raw)
In-Reply-To: <20240111110505.1563291-9-peter.maydell@linaro.org>

Peter Maydell <peter.maydell@linaro.org> writes:

> The CTR_EL0 register has some bits which allow the implementation to
> tell the guest that it does not need to do cache maintenance for
> data-to-instruction coherence and instruction-to-data coherence.
> QEMU doesn't emulate caches and so our cache maintenance insns are
> all NOPs.
>
> We already have some models of specific CPUs where we set these bits
> (e.g.  the Neoverse V1), but the 'max' CPU still uses the settings it
> inherits from Cortex-A57.  Set the bits for 'max' as well, so the
> guest doesn't need to do unnecessary work.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Tested-by: Miguel Luis <miguel.luis@oracle.com>
> ---
>  target/arm/tcg/cpu64.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
> index fcda99e1583..40e7a45166f 100644
> --- a/target/arm/tcg/cpu64.c
> +++ b/target/arm/tcg/cpu64.c
> @@ -1105,6 +1105,16 @@ void aarch64_max_tcg_initfn(Object *obj)
>      u = FIELD_DP32(u, CLIDR_EL1, LOUU, 0);
>      cpu->clidr = u;
>  
> +    /*
> +     * Set CTR_EL0.DIC and IDC to tell the guest it doesnt' need to
> +     * do any cache maintenance for data-to-instruction or
> +     * instruction-to-guest coherence. (Our cache ops are nops.)
> +     */
> +    t = cpu->ctr;
> +    t = FIELD_DP64(t, CTR_EL0, IDC, 1);
> +    t = FIELD_DP64(t, CTR_EL0, DIC, 1);
> +    cpu->ctr = t;
> +
>      t = cpu->isar.id_aa64isar0;
>      t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2);      /* FEAT_PMULL */
>      t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1);     /* FEAT_SHA1 */

Hi, we're introducing new regression tests to migration and this patch
shows up in the bisect of an issue. I need some help figuring out
whether this is an actual regression or something else.

The migration is TCG QEMU 8.2.0 -> TCG QEMU master.

On the destination side (contains this patch) we're hitting this
condition:

bool write_list_to_cpustate(ARMCPU *cpu)
{
...
        /*
         * Write value and confirm it reads back as written
         * (to catch read-only registers and partially read-only
         * registers where the incoming migration value doesn't match)
         */
        write_raw_cp_reg(&cpu->env, ri, v);
        if (read_raw_cp_reg(&cpu->env, ri) != v) {
--->        ok = false;
        }

Thread 1 "qemu-system-aar" hit Breakpoint 3, write_list_to_cpustate (cpu=0x555557a2f8f0) at ../target/arm/helper.c:190
190                 ok = false;
(gdb) p ri->name
$7 = 0x555557ab9ae0 "CTR"
(gdb) p/x v
$3 = 0x8444c004
(gdb) p/x read_raw_cp_reg(&cpu->env, ri)
$4 = 0xb444c004

Is there any particularity in reading/writing to that register? This is
during post_load and 'v' is what came in the migration stream.


  reply	other threads:[~2024-01-17 21:25 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 11:04 [PULL 00/41] target-arm queue Peter Maydell
2024-01-11 11:04 ` [PULL 01/41] hw/arm: add cache controller for Freescale i.MX6 Peter Maydell
2024-01-11 11:04 ` [PULL 02/41] hw/arm: Add minimal support for the STM32L4x5 SoC Peter Maydell
2024-01-11 11:04 ` [PULL 03/41] hw/arm: Add minimal support for the B-L475E-IOT01A board Peter Maydell
2024-01-11 11:04 ` [PULL 04/41] hw/intc/armv7m_nvic: add "num-prio-bits" property Peter Maydell
2024-01-11 11:04 ` [PULL 05/41] hw/arm/armv7m: alias the NVIC " Peter Maydell
2024-01-11 11:04 ` [PULL 06/41] hw/arm/socs: configure priority bits for existing SOCs Peter Maydell
2024-01-11 11:04 ` [PULL 07/41] hw/arm: Add missing QOM parent for v7-M SoCs Peter Maydell
2024-01-11 11:04 ` [PULL 08/41] target/arm: Set CTR_EL0.{IDC,DIC} for the 'max' CPU Peter Maydell
2024-01-17 21:24   ` Fabiano Rosas [this message]
2024-01-18  9:44     ` Peter Maydell
2024-01-18 12:57       ` Fabiano Rosas
2024-01-18 13:00         ` Peter Maydell
2024-01-11 11:04 ` [PULL 09/41] hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers Peter Maydell
2024-01-11 11:04 ` [PULL 10/41] target/arm: Handle HCR_EL2 accesses for bits introduced with FEAT_NV Peter Maydell
2024-01-11 11:04 ` [PULL 11/41] target/arm: Implement HCR_EL2.AT handling Peter Maydell
2024-01-11 11:04 ` [PULL 12/41] target/arm: Enable trapping of ERET for FEAT_NV Peter Maydell
2024-01-11 11:04 ` [PULL 13/41] target/arm: Always honour HCR_EL2.TSC when HCR_EL2.NV is set Peter Maydell
2024-01-11 11:04 ` [PULL 14/41] target/arm: Allow use of upper 32 bits of TBFLAG_A64 Peter Maydell
2024-01-11 11:04 ` [PULL 15/41] target/arm: Record correct opcode fields in cpreg for E2H aliases Peter Maydell
2024-01-11 11:04 ` [PULL 16/41] target/arm: *_EL12 registers should UNDEF when HCR_EL2.E2H is 0 Peter Maydell
2024-01-11 11:04 ` [PULL 17/41] target/arm: Make EL2 cpreg accessfns safe for FEAT_NV EL1 accesses Peter Maydell
2024-01-11 11:04 ` [PULL 18/41] target/arm: Move FPU/SVE/SME access checks up above ARM_CP_SPECIAL_MASK check Peter Maydell
2024-01-11 11:04 ` [PULL 19/41] target/arm: Trap sysreg accesses for FEAT_NV Peter Maydell
2024-01-11 11:04 ` [PULL 20/41] target/arm: Make NV reads of CurrentEL return EL2 Peter Maydell
2024-01-11 11:04 ` [PULL 21/41] target/arm: Set SPSR_EL1.M correctly when nested virt is enabled Peter Maydell
2024-01-11 11:04 ` [PULL 22/41] target/arm: Trap registers when HCR_EL2.{NV, NV1} == {1, 1} Peter Maydell
2024-01-11 11:04 ` [PULL 23/41] target/arm: Always use arm_pan_enabled() when checking if PAN is enabled Peter Maydell
2024-01-11 11:04 ` [PULL 24/41] target/arm: Don't honour PSTATE.PAN when HCR_EL2.{NV, NV1} == {1, 1} Peter Maydell
2024-01-11 11:04 ` [PULL 25/41] target/arm: Treat LDTR* and STTR* as LDR/STR when NV, NV1 is 1, 1 Peter Maydell
2024-01-11 11:04 ` [PULL 26/41] target/arm: Handle FEAT_NV page table attribute changes Peter Maydell
2024-01-11 11:04 ` [PULL 27/41] target/arm: Add FEAT_NV to max, neoverse-n2, neoverse-v1 CPUs Peter Maydell
2024-01-11 11:04 ` [PULL 28/41] target/arm: Handle HCR_EL2 accesses for FEAT_NV2 bits Peter Maydell
2024-01-11 11:04 ` [PULL 29/41] target/arm: Implement VNCR_EL2 register Peter Maydell
2024-01-11 11:04 ` [PULL 30/41] target/arm: Handle FEAT_NV2 changes to when SPSR_EL1.M reports EL2 Peter Maydell
2024-01-11 11:04 ` [PULL 31/41] target/arm: Handle FEAT_NV2 redirection of SPSR_EL2, ELR_EL2, ESR_EL2, FAR_EL2 Peter Maydell
2024-01-11 11:04 ` [PULL 32/41] target/arm: Implement FEAT_NV2 redirection of sysregs to RAM Peter Maydell
2024-01-11 11:04 ` [PULL 33/41] target/arm: Report VNCR_EL2 based faults correctly Peter Maydell
2024-01-11 11:04 ` [PULL 34/41] target/arm: Mark up VNCR offsets (offsets 0x0..0xff) Peter Maydell
2024-01-11 11:04 ` [PULL 35/41] target/arm: Mark up VNCR offsets (offsets 0x100..0x160) Peter Maydell
2024-01-11 11:05 ` [PULL 36/41] target/arm: Mark up VNCR offsets (offsets 0x168..0x1f8) Peter Maydell
2024-01-11 11:05 ` [PULL 37/41] target/arm: Mark up VNCR offsets (offsets >= 0x200, except GIC) Peter Maydell
2024-01-11 11:05 ` [PULL 38/41] hw/intc/arm_gicv3_cpuif: Mark up VNCR offsets for GIC CPU registers Peter Maydell
2024-01-11 11:05 ` [PULL 39/41] target/arm: Report HCR_EL2.{NV,NV1,NV2} in cpu dumps Peter Maydell
2024-01-11 11:05 ` [PULL 40/41] target/arm: Enhance CPU_LOG_INT to show SPSR on AArch64 exception-entry Peter Maydell
2024-01-11 11:05 ` [PULL 41/41] target/arm: Add FEAT_NV2 to max, neoverse-n2, neoverse-v1 CPUs Peter Maydell
2024-01-11 15:16 ` [PULL 00/41] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877ck7d56n.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.