linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Vivek Kumar <quic_vivekuma@quicinc.com>
Cc: <corbet@lwn.net>, <catalin.marinas@arm.com>, <will@kernel.org>,
	<tglx@linutronix.de>, <axboe@kernel.dk>, <rafael@kernel.org>,
	<akpm@linux-foundation.org>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-block@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<linux-mm@kvack.org>, <len.brown@intel.com>, <pavel@ucw.cz>,
	<paulmck@kernel.org>, <bp@suse.de>, <keescook@chromium.org>,
	<songmuchun@bytedance.com>, <rdunlap@infradead.org>,
	<damien.lemoal@opensource.wdc.com>, <pasha.tatashin@soleen.com>,
	<tabba@google.com>, <ardb@kernel.org>, <tsoni@quicinc.com>,
	<quic_psodagud@quicinc.com>, <quic_svaddagi@quicinc.com>,
	Prasanna Kumar <quic_kprasan@quicinc.com>
Subject: Re: [RFC 6/6] irqchip/gic-v3: Re-init GIC hardware upon hibernation restore
Date: Thu, 19 May 2022 08:59:57 +0100	[thread overview]
Message-ID: <87ee0q54w2.wl-maz@kernel.org> (raw)
In-Reply-To: <1652860121-24092-7-git-send-email-quic_vivekuma@quicinc.com>

Hi Vivek,

On Wed, 18 May 2022 08:48:41 +0100,
Vivek Kumar <quic_vivekuma@quicinc.com> wrote:
> 
> Code added in this patch takes backup of different set of
> registers during hibernation suspend. On receiving hibernation
> restore callback, it restores register values from backup. This
> ensures state of hardware to be same just before hibernation and
> after restore.
> 
> Signed-off-by: Vivek Kumar <quic_vivekuma@quicinc.com>
> Signed-off-by: Prasanna Kumar <quic_kprasan@quicinc.com>
> ---
>  drivers/irqchip/irq-gic-v3.c | 138 ++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 136 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index 2be8dea..442d32f 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -29,6 +29,10 @@
>  #include <asm/smp_plat.h>
>  #include <asm/virt.h>
>  
> +#include <linux/syscore_ops.h>
> +#include <linux/suspend.h>
> +#include <linux/notifier.h>
> +
>  #include "irq-gic-common.h"
>  
>  #define GICD_INT_NMI_PRI	(GICD_INT_DEF_PRI & ~0x80)
> @@ -56,6 +60,14 @@ struct gic_chip_data {
>  	bool			has_rss;
>  	unsigned int		ppi_nr;
>  	struct partition_desc	**ppi_descs;
> +#ifdef CONFIG_HIBERNATION
> +	unsigned int enabled_irqs[32];
> +	unsigned int active_irqs[32];
> +	unsigned int irq_edg_lvl[64];
> +	unsigned int ppi_edg_lvl;
> +	unsigned int enabled_sgis;
> +	unsigned int pending_sgis;
> +#endif

This is either way too much, or way too little. Just restoring these
registers is nowhere near enough, as you are completely ignoring the
ITS, so this will leave the machine broken for anything that requires
LPIs.

But If the bootloader is supposed to replace the kernel to put the HW
in a state where the GIC is usable again, why do we need any of this?

Hibernation relies on a basic promise: the secondary kernel is entered
with the HW in a reasonable state, and the basic infrastructure
(specially for stuff that can be only programmed once per boot such as
the RD tables) is already available. If the bootloader is going to do
the work of the initial kernel, then it must do it fully, and not
require this sort of random sprinkling all over the shop.

Effectively, there is an ABI between the primary kernel and the
secondary, and I don't see why this interface should change to paper
over what I see as the deficiencies of the bootloader.

Am I missing anything?

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-19  8:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  7:48 [RFC 0/6] Bootloader based hibernation Vivek Kumar
2022-05-18  7:48 ` [RFC 1/6] arm64: hibernate: Introduce new entry point to kernel Vivek Kumar
2022-05-19 15:27   ` Marc Zyngier
2022-05-18  7:48 ` [RFC 2/6] PM: Hibernate: Add option to disable disk offset randomization Vivek Kumar
2022-05-18 12:19   ` Andrew Lunn
2022-05-18 13:00   ` Christoph Hellwig
2022-05-23 20:49   ` Randy Dunlap
2022-05-18  7:48 ` [RFC 3/6] block: gendisk: Add a new genhd capability flag Vivek Kumar
2022-05-18  8:08   ` Christoph Hellwig
2022-05-18  7:48 ` [RFC 4/6] mm: swap: Add randomization check for swapon/off calls Vivek Kumar
2022-05-18 12:27   ` Andrew Lunn
2022-05-18  7:48 ` [RFC 5/6] Hibernate: Add check for pte_valid in saveable page Vivek Kumar
2022-05-18 13:09   ` Christoph Hellwig
2022-05-18  7:48 ` [RFC 6/6] irqchip/gic-v3: Re-init GIC hardware upon hibernation restore Vivek Kumar
2022-05-19  7:59   ` Marc Zyngier [this message]
2022-05-18 16:55 ` [RFC 0/6] Bootloader based hibernation Pasha Tatashin
2022-05-20 16:43 ` Mark Rutland

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=87ee0q54w2.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bp@suse.de \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=keescook@chromium.org \
    --cc=len.brown@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=paulmck@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=quic_kprasan@quicinc.com \
    --cc=quic_psodagud@quicinc.com \
    --cc=quic_svaddagi@quicinc.com \
    --cc=quic_vivekuma@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=songmuchun@bytedance.com \
    --cc=tabba@google.com \
    --cc=tglx@linutronix.de \
    --cc=tsoni@quicinc.com \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).