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

Re: [PATCH v8 02/13] xen/arm: gic-v2: Implement GIC suspend/resume functions


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 8 May 2026 10:56:19 +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=CP/6vag/2app4BulpkySxH1/PFZBR4XPDOK7xYt4KPw=; b=Ju2VsYqmH5MzRG8FKUnrRTxAjHsbnFYG2PokrDIQrjanfFk5twQqz6RPAtX6Kr647JzKCIYXl8c2LwI3n8PHWudhutPPAIFvk94+gmFsX6k4I38Rx1jRnd21Vo1IIBjNkSlPXPktAv/WbMzMQVLij6rbeL4AkJn9YDjZ4Q1MEyGHjY8Io0I8bHnHLnYYP193548nPOg5BM7p5h+nEPN6vvjD2MA18VIVV16/FZbnA1XQdOnVQio9xv12kU4yjQynRPhw8oaI2BQMLmfDK83s6UdSjaFAPwOO4VbVs3HiSIxn1+yQFuRA+EHBNN/cEKzBk36OcJNz4RKr0c2MK0OY6g==
  • 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=CP/6vag/2app4BulpkySxH1/PFZBR4XPDOK7xYt4KPw=; b=CPLgi7B+dVn1jvU6BqOgeMU9IsdAVfzdL1v3W9t4fgLT8T9lLbk50Q7lI4QQs7CwmsPslh7K+GKz6DJ9ZdeQ3EFxpP/O47skuAajqRwg7s771Ew77ki2Ov25CJqCpxLbGx71x/tHXqjMIXrAhNOFsfQz2DwEhZCzxPht+D5gMgsk4h5OX72z6j79mQwK94eXsP4J8LMEzxbvfthBwbAbESeQAijUPXj+eZwVVh4LRwJ9zMSuWotaPRR6bn+qzSQXW7/QivmGC0Ir1UQsFD+pE7NvCTiVKML1duXMCWPe91RXrhd0KgvKGFn5VDvg/F/RFC7raIsXxzR5CHtg9JoAtA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Y3nXOsBL/6yqUARtEf0nN8UhnxSRVb8TMKkqQZtllv+2jin0q2cRILfnzZ5LiNnbxDxK441p8+t5SNKxwxsCUUMpmdKgTyqKEQezDSMPsbv3MnmADs0UNWRExquYXCK85CWxhgmRmxrpG4vn9wTK/4P7EafquQhOVx6YEzMyt5E7frUoxaMgNkq0IlPMtSU3DvRtio7UU+ZwsHDCPEk06jfA3WDabtAi1Q6E0AiAFnYNI7KCeL8rCSNkMvdd4ZkuVCXoWJFEpRUEBKVp3TuIe601qoZTHHet6B7Wp4Ycd7XcoFJv7sr3Uf8uvmnH8OfG93TfWVFn1RtSZOn9PO4JnA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JceA6Issf6lfyo+veaT8MkTt/8o8Bh0t5xn0r+5xLCczd8llGI8Aoe5p6cEyx8jnsXvnx2vaJ67bMr7IrT4XLk6Y8NGkqtkOFflZUBxNIELhfbQFGMoipJBBiERgg4sAqW1+WFRHJo4fvADBUI+C4A6IbIEs78geBPKb4Co8FgwxJVRKSCbJjiX3KqNeQkhgTu4D3Bxptbanp7aNUUARQSqBUKUpjJqDqrujoCfSlA5qT47eL2zykAk+QL7P2JfHOIJO9bZS+c8tLGUP0hk338wM0CaSoekFPQ1JbQRAI4XMBL2p83Vv7JYmw1/ovbp4pqv6I7dvgz6dMnc/LrAK1g==
  • 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: Fri, 08 May 2026 10:57:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHc0ZIp4iA20ItBV0OKtUp08vt6QrYCSMAAgAHGpwA=
  • Thread-topic: [PATCH v8 02/13] xen/arm: gic-v2: Implement GIC suspend/resume functions

Hi Mykola,

> 
>> 
>>> +        }
>>> +
>>> +        off = i * sizeof(irqs->icfgr);
>>> +        for ( j = 0; j < ARRAY_SIZE(irqs->icfgr); j++ )
>>> +            writel_gicd(irqs->icfgr[j], GICD_ICFGR + off + j * 4);
>>> +    }
>>> +
>>> +    /* Make sure all registers are restored and enable distributor */
>>> +    writel_gicd(gic_ctx.dist.ctlr, GICD_CTLR);
>>> +
>>> +    /* Restore GIC CPU interface configuration */
>>> +    writel_gicc(gic_ctx.cpu.pmr, GICC_PMR);
>>> +    writel_gicc(gic_ctx.cpu.bpr, GICC_BPR);
>>> +
>>> +    /* Enable GIC CPU interface */
>>> +    writel_gicc(gic_ctx.cpu.ctlr, GICC_CTLR);
>>> +}
>>> +
>> 
>> I also see that we don’t save pending SGIs state (by 
>> GICD_CPENDSGIRn/GICD_SPENDSGIRn) or Active Priorities registers
>> state (GICC_APRn/GICC_NSAPRn [latter if security extension are there]) as 
>> written in [1] “4.5 Preserving and restoring GIC state”,
>> was it intentional?
> 
> Yes, this was intentional.
> 
> The GICv2 suspend callback is called at a quiescent point in the
> SYSTEM_SUSPEND path: all domains are already shut down for suspend, guest
> execution is quiesced, the scheduler is disabled, non-boot CPUs have been
> offlined, and CPU0 enters gic_suspend() with local interrupts disabled.
> 
> For SGIs, I don't consider GICD_CPENDSGIRn/GICD_SPENDSGIRn part of the saved
> host GIC context. Xen uses physical SGIs as IPIs, and IPI delivery is an
> internal synchronization mechanism, not architectural state that should be
> replayed after SYSTEM_SUSPEND. Guest SGI state is virtual GIC state and is not
> represented by these physical GICD SGI pending registers.

ack, I would maybe mention in the commit message that we exclude transient 
IPI/active-priority
state at the suspend quiescent point.

> 
> For GICC_APRn/GICC_NSAPRn, those registers describe active priority state for
> interrupts already acknowledged by the CPU interface. The final suspend path 
> is
> not expected to run with an active physical interrupt context. If those
> registers were non-zero there, restoring only APR/NSAPR would not make the
> corresponding interrupt handling context valid after resume, and could instead
> leave the CPU interface with stale active priority state.

Ok I understand now, but if we are expecting here GICD_ISACTIVERn zeroed, why 
are
we saving/restoring it? Shouldn’t we instead have a runtime check that it’s 
zero and in case
it’s not bail out? And in the resume path we would only zero it.

Am I missing something?

> 
> So I did not add save/restore for GICD_CPENDSGIRn/GICD_SPENDSGIRn or
> GICC_APRn/GICC_NSAPRn in this patch. I can add a short comment in v9 to make
> this scope explicit.
> 
> Please let me know if you think there is a suspend/resume path where this
> state still needs to be preserved.
> 
> Best regards,
> Mykola

Cheers,
Luca


 


Rackspace

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