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

Re: [PATCH v9 03/13] xen/arm: gic-v3: tolerate retained redistributor LPI state across CPU_OFF


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Thu, 14 May 2026 11:41:37 +0300
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cluKyGouWJtd1lIstxQNzBM7OpUssjSxRkEElOaVOGI=; fh=uAzoxIkY79cy0zES8IqO07ArU7DBG3jlr2bg4XRVkR0=; b=jFtxp2UmrAaxC5LcACWgqhEp9ZmQjiqQKM5YRZzxWQHqmiiysfIMJ0wa1zHWjoptFy 4wcodmDZFN+ELOn8MroFvKAKElm6Fs9Fhrb5cJP5OS4cFKRuaFSOYO6kKurHHjsRqzHE F4Ios+duLVzrwK6k4kTmDis4OqqDanYSBzc7X+2qChgyedHu/n9rnBghoXBRY4ksKYdN wt2vhCjn380txTJp5Ch6pwjK+O0bp5gOV4PSDc1HkVtBTz4R6hht+XQsXfx21DM2Y8pL RFNBlxXhw1tXuSUlij3W4ViTTSFNyyxDs69VIH4ydLgxHK2toKar41HK/C0xEnSIs+Zv nb3A==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1778748109; cv=none; d=google.com; s=arc-20240605; b=ILG3PhRC3dABd7Sv+UOaQzZb8on6W9GHbG1v2/Y/spCxNV7lK4qRswH+/9paTNkRlr MyazpK6x9xfsYWB9lH3IebFdtvaYIS4P2h98UgvDIG7RJdm8d9iSFHjHbVk9eI0sr0Sz ojZ9Xw8/iJZKLcBFMEbFwg3NXC+4deOPmU1RnZLgjodpkEkqi4k3Sv9Dtj+q6LT7Fbyo symyurKwsTWqlDzPdr8H9txvdgvvHQg+EAwqFoBdtz3EWfE/jW5mBGp7+KTol9M182PP MkJfsmqfZFsdB9FlS8o5GADLP/llW+84isVMT/8Fs+3XFTpSfL0qdGCnoaUelvjmFEw0 grBQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 14 May 2026 08:42:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

Thank you for the review.

On Wed, May 13, 2026 at 5:53 PM Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>
> Hi Mykola,
>
> > On 12 May 2026, at 18:07, Mykola Kvach <xakep.amatop@xxxxxxxxx> wrote:
> >
> > From: Mykola Kvach <mykola_kvach@xxxxxxxx>
> >
> > PSCI does not guarantee that a GICv3 redistributor is powered down across
> > CPU_OFF -> CPU_ON.
> >
> > DEN0022F.b says CPU_OFF powers down the calling core (5.5) and CPU_ON
> > brings the core back with a defined initial CPU state (5.6, 6.4).
> > However, PSCI leaves interrupt migration and GIC re-initialization to the
> > supervisory software/firmware stack: the caller must migrate interrupts
> > away before CPU_OFF (5.5.2), and the execution context that is lost in a
> > powerdown state must be saved and restored by software (6.8). PSCI also
> > calls out GIC management explicitly in 6.8, including retargeting SPIs,
> > preventing PPIs/SGIs from targeting a powered down CPU, and reinitializing
> > the CPU interface after CPU_ON.
> >
> > This matches the GIC architecture. IHI0069H.b Chapter 11.1 requires the PE
> > and CPU interface to share a power domain, but explicitly allows the
> > associated redistributor, distributor, and ITS to remain powered while the
> > PE and CPU interface are off. All other GIC power-management behavior is
> > IMPLEMENTATION DEFINED. DEN0050D Chapter 4.2, "Generic Interrupt
> > Controller (GIC)", says the GICv3 redistributor may live either in the AP
> > core power domain or in a relatively always-on parent domain. So after
> > CPU_OFF -> CPU_ON a secondary CPU can legitimately come back to a live
> > redistributor with GICR_CTLR.EnableLPIs still set.
> >
> > Handle that case in the LPI setup path instead of assuming a fully reset
> > redistributor.
> >
> > The LPI path needs special care because the GIC spec makes redistributor
> > LPI state sticky and partially implementation defined. IHI0069H.b 5.1.1
> > and 5.1.2 say that changing GICR_PROPBASER or GICR_PENDBASER while
> > GICR_CTLR.EnableLPIs == 1 is UNPREDICTABLE. After clearing EnableLPIs,
> > software must wait for GICR_CTLR.RWP == 0 before touching the pending
> > table. The architecture also permits implementations where, once
> > EnableLPIs has been set, clearing it again is not guaranteed to work.
> > Where an ITS is present, the spec strongly recommends moving LPIs to
> > another redistributor before clearing EnableLPIs.
> >
> > Because of that, treat a retained EnableLPIs state as valid when the
> > redistributor still points at Xen's expected PROPBASER/PENDBASER tables.
> > Only try to clear EnableLPIs when the retained configuration does not
> > match Xen's state, and wait for RWP before reprogramming the tables.
> >
> > This is also consistent with platform firmware reality: PSCI and the GIC
> > architecture allow platform-specific redistributor power handling, and not
> > all platform firmware implementations force a full redistributor power-off
> > through implementation-defined controls during CPU_OFF. Xen therefore needs
> > to tolerate retained redistributor state on secondary CPU bring-up.
> >
> > Keep gicv3_populate_rdist() resident as well, because gicv3_cpu_init()
> > reuses it on secondary CPU bring-up after init.
> >
> > Tested using Xen's non-boot CPU disable/enable path on Arm
> > FVP_Base_RevC-2xAEMvA, both with and without:
> > -C gic_distributor.allow-LPIEN-clear=1
> > -C gic_distributor.GICR-clear-enable-supported=1
> > and on Orange Pi 5.
> >
> > Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> > ---
>
> I understand you will send a separate patch to fix RWP.
>
> Looks ok to me, I see you’ve touched some printk in gicv3_populate_rdist() 
> which
> were wrongly having %d for smp_processor_id(), sometimes maintainers are not
> really ok with that when the changes are not related to the commit, but apart 
> from that:

That change was intentional.

In the previous version of this series, you pointed out the
wrong format specifier for smp_processor_id() in one of these
printk()s.

Although it was not directly related to the functional change in
this patch, I decided to fix the other similar occurrences in
gicv3_populate_rdist() as well, for consistency.

>
> Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
>
> Cheers,
> Luca
>
>

Best regards,
Mykola



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.