All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Fancellu <Luca.Fancellu@arm.com>
To: Mykola Kvach <xakep.amatop@gmail.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Mykola Kvach <mykola_kvach@epam.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <Bertrand.Marquis@arm.com>,
	Michal Orzel <michal.orzel@amd.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v9 10/13] xen/arm64: Save/restore CPU context across SYSTEM_SUSPEND
Date: Thu, 14 May 2026 17:20:53 +0000	[thread overview]
Message-ID: <7254EEC1-315F-41EB-B623-5CACAD7255E9@arm.com> (raw)
In-Reply-To: <46bbc9e008a65dd86fb2b368e4751eb7d2014afa.1778605274.git.mykola_kvach@epam.com>

Hi Mykola,

> 
> +#ifdef CONFIG_SYSTEM_SUSPEND
> +/*
> + * int prepare_resume_ctx(void)
> + *
> + * CPU context saved here will be restored on resume in hyp_resume function.
> + * prepare_resume_ctx shall return a non-zero value. Upon restoring context
> + * hyp_resume shall return value zero instead. From C code that invokes
> + * prepare_resume_ctx, the return value is interpreted to determine whether
> + * the context is saved (prepare_resume_ctx) or restored (hyp_resume).
> + */
> +FUNC(prepare_resume_ctx)
> +        ldr   x0, =resume_cpu_context
> +
> +        /* Store callee-saved registers */
> +        stp   x19, x20, [x0, #RESUME_CTX_X19]
> +        stp   x21, x22, [x0, #RESUME_CTX_X21]
> +        stp   x23, x24, [x0, #RESUME_CTX_X23]
> +        stp   x25, x26, [x0, #RESUME_CTX_X25]
> +        stp   x27, x28, [x0, #RESUME_CTX_X27]
> +        stp   x29, lr, [x0, #RESUME_CTX_X29]
> +
> +        /* Store stack-pointer */
> +        mov   x2, sp
> +        str   x2, [x0, #RESUME_CTX_SP]
> +
> +        /* Store system control registers */
> +        mrs   x2, VBAR_EL2
> +        str   x2, [x0, #RESUME_CTX_VBAR_EL2]
> +        mrs   x2, VTCR_EL2
> +        str   x2, [x0, #RESUME_CTX_VTCR_EL2]
> +        mrs   x2, VTTBR_EL2
> +        str   x2, [x0, #RESUME_CTX_VTTBR_EL2]
> +        mrs   x2, TPIDR_EL2
> +        str   x2, [x0, #RESUME_CTX_TPIDR_EL2]
> +        mrs   x2, MDCR_EL2
> +        str   x2, [x0, #RESUME_CTX_MDCR_EL2]
> +        mrs   x2, HSTR_EL2
> +        str   x2, [x0, #RESUME_CTX_HSTR_EL2]
> +        mrs   x2, CPTR_EL2
> +        str   x2, [x0, #RESUME_CTX_CPTR_EL2]
> +        mrs   x2, HCR_EL2
> +        str   x2, [x0, #RESUME_CTX_HCR_EL2]

Do you think we should save also CNTHCTL_EL2? Apologies it escaped my first review,
but I see we program it in the boot cpu path + secondary cpu path: init_timer_interrupt().

The rest looks ok.

Cheers,
Luca



  reply	other threads:[~2026-05-14 17:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 17:07 [PATCH v9 00/13] Add initial Xen Suspend-to-RAM support on ARM64 Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 01/13] xen/arm: Add suspend and resume timer helpers Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 02/13] xen/arm: gic-v2: Implement GIC suspend/resume functions Mykola Kvach
2026-05-13 14:08   ` Luca Fancellu
2026-05-15  7:59     ` Mykola Kvach
2026-05-15  9:52       ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 03/13] xen/arm: gic-v3: tolerate retained redistributor LPI state across CPU_OFF Mykola Kvach
2026-05-13 14:51   ` Luca Fancellu
2026-05-14  8:41     ` Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 04/13] xen/arm: gic-v3: Implement GICv3 suspend/resume functions Mykola Kvach
2026-05-13 16:11   ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 05/13] xen/arm: gic-v3: add ITS suspend/resume support Mykola Kvach
2026-05-14 14:45   ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 06/13] xen/arm: tee: keep init_tee_secondary() for hotplug and resume Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 07/13] xen/arm: ffa: fix notification SRI across CPU hotplug/suspend Mykola Kvach
2026-05-12 17:07 ` [PATCH v9 08/13] iommu/ipmmu-vmsa: Implement suspend/resume callbacks Mykola Kvach
2026-05-14 15:57   ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 09/13] xen/arm: smmu-v3: add suspend/resume handlers Mykola Kvach
2026-05-14 16:41   ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 10/13] xen/arm64: Save/restore CPU context across SYSTEM_SUSPEND Mykola Kvach
2026-05-14 17:20   ` Luca Fancellu [this message]
2026-05-12 17:07 ` [PATCH v9 11/13] xen/arm: Implement PSCI SYSTEM_SUSPEND call (host interface) Mykola Kvach
2026-05-15  7:04   ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 12/13] xen/arm: Add vPSCI SYSTEM_SUSPEND policy Mykola Kvach
2026-05-13  6:53   ` Jan Beulich
2026-05-14 14:51     ` Mykola Kvach
2026-05-15  8:17   ` Luca Fancellu
2026-05-12 17:07 ` [PATCH v9 13/13] xen/arm: Add host system suspend backend Mykola Kvach
2026-05-15  8:44   ` Luca Fancellu

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=7254EEC1-315F-41EB-B623-5CACAD7255E9@arm.com \
    --to=luca.fancellu@arm.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=mykola_kvach@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=xakep.amatop@gmail.com \
    --cc=xen-devel@lists.xenproject.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.