[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: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 13 May 2026 14:51:56 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=gmail.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dO7ShRY36w57wbiMsIK3Rl4eb8jS6Nq9Afir6qTjEhA=; b=D6oYLP7ARTd9+uq0/9WTDheV1mmeQWBCZMZRPAWhHE7VGvvv+nCMYIFRxPgpx0z7qSanczWDwsN7sDsPA0OcOEy2o3ZmAuMYThW9onXzCgF+02gpNT7KHEKkuZ3S3zN0GEnUCWzQWGMa7AQIFL0LtglYP0GgRH875r7lmQQQSmU1vrSY7ZnnGXO9CO0ouok18rGjby89YVFgP8cvHPFbEiEvBX4Yk24KxbOfBbxkfIbk3NNXJYKpergve89iSDAVyr8QI99xYs8kz3ACXm6E8VbWjm7MW/vo9faIz0fvd+wTX6hAdrp3NDX9BOvfvt97UMOT1qcrVnDxZZIVB37cJQ==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dO7ShRY36w57wbiMsIK3Rl4eb8jS6Nq9Afir6qTjEhA=; b=IfotcW2fRv0AjjKXQsm0MLTDSAruvZG5ExgE9aElHhHXe7U5o1GiCWM7Xz2vy0Hvdq/vD85mQd67RY8eJIWEQkt9FubJKrME7HnYepUI79VcFa+5uQ8wZMsjDYVcgFC9ONRcUAGlJfVSnQLgQRWxU+lcAucCl1mtN1AI2kwZ3zcOtl5ZU6t0bzVXjBGennJ4eQNM8eufcuzWj7az8oGuusDuBBz65l9NVKMhtW5eG73BCBQRP7FvVt3LzCw4bidAieOCwGtIOnx3+Y7b1vLZ1RQo3G5IH6/7apPZzXy0a5ulQW22lucKtKTHQsItQu/AUXhLb75Rzr4kBDugJCiMgA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=nOyicki5ijhmJu731vwbmVxA+IT25uDHRjapAbrx3gdxpw97JyUs6F4htcSsvWP3jn0/1sB2gbYAFS3xsQyau3XQt3yxdP3sPxKocPmQmGWSSzesH/NXK4+c5eNpxuOjyMw9iJbToZ6121Bh4ByTWtlcfK1fAaAfBOoZgPNafgUxL9+ToH7nDRtQA+DzgSiEtjsod1sJsuirVRctFnmjHDpSCN1qIxTXdzS8Dw+oennY+4amcILnOmkieTaZY3LwvSSLj/HgV/ub8w47R5kKA1jsm6KTRnbczaDBSg2YCvpkZXy5pxb9lwS60GoNdt2FEZc/4X78EgqT+GF3a3F0qg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Uz90EdWJmdEnQpVutLPuuo6+TTnees29v0I+QovIASUO61WogDKERl3Ooknru4RSGkg+b2QG6NnOdexXblVn0h3qvf9tNsKqDRb0xRZH5Ru5z59Mhb00Sk1oGeVjGKsmNOaQmQGSi3fdAnJT5TdVvmT1Uo6BcoMRckUrR+iSTceS6R7iYmXQyCN2rEfNAPBzKqqsJxGS501L6TIQlEVBZFEKpTrQBJU8CLjsKg3HvcWwpd5HQJV18H1Q7XRIU+CVpPG2vVmsGP9gtFXUp9fzBdSzL0L2+6cUtMQAtI/i2jqYXS6fH29AD5LqkDFr2jqlDfLGQZITrvK++j/bpqhX7w==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • 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: Wed, 13 May 2026 14:53:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHc4jIy41V2wcxbLEmxgJuFq+19qLYMC40A
  • Thread-topic: [PATCH v9 03/13] xen/arm: gic-v3: tolerate retained redistributor LPI state across CPU_OFF

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:

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

Cheers,
Luca



 


Rackspace

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