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

Re: [PATCH v10 09/13] xen/arm: smmu-v3: add suspend/resume handlers


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Wed, 3 Jun 2026 09:01:36 +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=jdWbkSpPql8cjcN0VxJhIlsFq6AEhavLmsMjNu27XlM=; fh=Y48x1ukbkIffKm3ALNxHiiKo9yxrWWvlvMeS1xgC45s=; b=VHgvEwsV/IfUJ92pFO7mFdvQapdR8RStk8aPTVpHY2xCRuq3QcMgm/x33K52rudhwu XSqjeXAzdFuaj63QsuOTvKgWWs88NviDfZ9KLDJXKVWXrQlf2QCbekHQE22/4ORKe+kc 5yr5CXlD8T3Br/kC28Me/H4KysbxKGrAri0qu0YArB8ZqwM5a2UrULYy3Rw2pb6hDYT6 9Th4ooO6CzzALkcmYoj0S6sOi6uP8Tt6Xb1N0DQNFxUss2ml7LsjsTmhs7iDorlVPVA/ r9Jc0Mb1+16Is5NzGpooxTUIpOpG2st2O+O7cZuC52dmKcFup0JjqUlBEnD49EW3lb7u 1z3Q==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1780466507; cv=none; d=google.com; s=arc-20240605; b=B/5G4dpGv1qv97hfC5ep1oABfA5f81xbYtDNkQPYGpg8iK62fXjfYaMyVOmHBxhFNL pn5YmCmYnX/D4KennPHL3sE7NVW/AKknxLtM1xe70b1McmMxjogfMMwhEtsr6iULK805 oWalXVslJUJiWbjzp9ljbuAm+cVwO+7d5ghiBoE8N+m0zSM6GIxaWXnyJrlgAGVVsX7D yoPnwjwNPM0vOVlRFkYF3uMlwIkBV1GUFWCz2u0mQ/D1EYprPS/jt2oCOnVzXIPMz2Qg l8WkoiyR6g9eS60e82rM2ZeMQH8m11w5KUEpHqfQJ4knPWMQ/6OjoRYYswFZi3CwpYUN N5dA==
  • 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>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Pranjal Shrivastava <praan@xxxxxxxxxx>
  • Delivery-date: Wed, 03 Jun 2026 06:01:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

Thank you for the feedback.

On Mon, Jun 1, 2026 at 8:12 PM Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>
> Hi Mykola,
>
> > On 21 May 2026, at 18:45, Mykola Kvach <xakep.amatop@xxxxxxxxx> wrote:
> >
> > From: Mykola Kvach <mykola_kvach@xxxxxxxx>
> >
> > Add system suspend/resume callbacks for the Arm SMMUv3 driver.
> >
> > During suspend, configure GBPA to abort incoming transactions, disable the
> > translation interface while keeping CMDQ enabled, issue CMD_SYNC to ensure
> > all previously issued commands have completed, then disable the SMMU IRQs
> > and SMMU.
> >
> > Resume uses arm_smmu_device_reset() to reprogram the SMMU and re-enable
> > translation and interrupt generation.
> >
> > The IRQ setup split follows the approach from Pranjal Shrivastava's Linux
> > arm-smmu-v3 runtime/system sleep series: IRQ handlers are requested once
> > during probe, while reset/resume only restores SMMU hardware state and
> > re-enables IRQ_CTRL.
> >
> > Only the pieces relevant to Xen's currently supported SMMUv3 path are
> > ported here. Xen documents SMMUv3 MSI and PCI ATS as unsupported and not
> > compiled/tested, so this patch does not restore SMMU MSI IRQ_CFGn registers
> > nor reinitialize ATS/PRI endpoints. If those paths become usable,
> > suspend/resume will need corresponding MSI restore and ATS/PRI
> > quiesce/reinit steps.
> >
> > Link: https://lore.kernel.org/r/20260414194702.1229094-1-praan@xxxxxxxxxx/
> > Based-on-patch-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
> > Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> > ---
> > Changes in V10:
> > - Disable SMMU interrupt generation during suspend before disabling the
> >  SMMU interface, matching the resume/reset path which re-enables IRQ_CTRL.
> >
> > Changes in V9:
> > - Use CMD_SYNC in suspend instead of polling CMDQ_CONS, so the suspend
> >  path waits for command completion rather than only command consumption.
> > - Document that arm_smmu_setup_irqs() is probe-only and that future Xen
> >  SMMUv3 MSI support will need to restore SMMU IRQ_CFGn registers on
> >  resume.
> > - Restore the reference to Pranjal's Linux runtime/system sleep series and
> >  clarify that MSI/ATS/PRI resume handling is outside the supported Xen
> >  path.
> > - Prefix the subject with xen/arm for consistency with the rest of the
> >  Arm suspend/resume series.
> >
> > Changes in V8:
> > - Honor ARM_SMMU_FEAT_SEV when draining the CMDQ during suspend, matching
> >  the existing runtime CMD_SYNC path.
> > - Fold the suspend rollback reset path into a helper and rename the error
> >  reporting to describe suspend rollback rather than resume.
> > - Treat SMMU reset failure during resume as fatal instead of logging and
> >  continuing with a potentially unusable IOMMU.
> > - cosmetic changes
> > ---
> > xen/drivers/passthrough/arm/smmu-v3.c | 186 +++++++++++++++++++++-----
> > 1 file changed, 150 insertions(+), 36 deletions(-)
> >
> > diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> > b/xen/drivers/passthrough/arm/smmu-v3.c
> > index bf153227db..be8028c036 100644
> > --- a/xen/drivers/passthrough/arm/smmu-v3.c
> > +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> > @@ -1814,8 +1814,7 @@ static int arm_smmu_write_reg_sync(struct 
> > arm_smmu_device *smmu, u32 val,
> > }
> >
> > /* GBPA is "special" */
> > -static int __init arm_smmu_update_gbpa(struct arm_smmu_device *smmu,
> > -                                       u32 set, u32 clr)
> > +static int arm_smmu_update_gbpa(struct arm_smmu_device *smmu, u32 set, u32 
> > clr)
>
> Now this one and arm_smmu_device_reset loose __init also for 
> !CONFIG_SYSTEM_SUSPEND,
> but I’m not sure if in the codebase we are dealing with these kind of cases 
> already or if it’s still ok
> to let it be without __init anyway.

Good point. I will avoid keeping these helpers in runtime text for
!CONFIG_SYSTEM_SUSPEND.

I think a small local annotation in the SMMUv3 driver would work well here,
something like:

#ifdef CONFIG_SYSTEM_SUSPEND
#define __init_or_smmu_suspend
#else
#define __init_or_smmu_suspend __init
#endif

and then use it for arm_smmu_update_gbpa() and arm_smmu_device_reset().

This keeps the suspend-enabled case unchanged while preserving the existing
init-only placement otherwise.

What do you think?

Best regards,
Mykola



 


Rackspace

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