From: Maxim Levitsky <mlevitsk@redhat.com> To: linux-kernel@vger.kernel.org Cc: David Woodhouse <dwmw@amazon.co.uk>, Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Joerg Roedel <joro@8bytes.org>, Thomas Gleixner <tglx@linutronix.de>, iommu@lists.linux-foundation.org (open list:AMD IOMMU (AMD-VI)), Will Deacon <will@kernel.org>, Maxim Levitsky <mlevitsk@redhat.com> Subject: [PATCH 4/5] iommu/amd: x2apic mode: mask/unmask interrupts on suspend/resume Date: Tue, 23 Nov 2021 18:10:37 +0200 [thread overview] Message-ID: <20211123161038.48009-5-mlevitsk@redhat.com> (raw) In-Reply-To: <20211123161038.48009-1-mlevitsk@redhat.com> Use IRQCHIP_MASK_ON_SUSPEND to make the core irq code to mask the iommu interrupt on suspend and unmask it on the resume. Since now the unmask function updates the INTX settings, that will restore them on resume from s3/s4. Since IRQCHIP_MASK_ON_SUSPEND is only effective for interrupts which are not wakeup sources, remove IRQCHIP_SKIP_SET_WAKE flag and instead implement a dummy .irq_set_wake which doesn't allow the interrupt to become a wakeup source. Fixes: 66929812955bb ("iommu/amd: Add support for X2APIC IOMMU interrupts") Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> --- drivers/iommu/amd/init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 9e895bb8086a6..b94822fc2c9f7 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2104,6 +2104,11 @@ static int intcapxt_set_affinity(struct irq_data *irqd, return 0; } +static int intcapxt_set_wake(struct irq_data *irqd, unsigned int on) +{ + return on ? -EOPNOTSUPP : 0; +} + static struct irq_chip intcapxt_controller = { .name = "IOMMU-MSI", .irq_unmask = intcapxt_unmask_irq, @@ -2111,7 +2116,8 @@ static struct irq_chip intcapxt_controller = { .irq_ack = irq_chip_ack_parent, .irq_retrigger = irq_chip_retrigger_hierarchy, .irq_set_affinity = intcapxt_set_affinity, - .flags = IRQCHIP_SKIP_SET_WAKE, + .irq_set_wake = intcapxt_set_wake, + .flags = IRQCHIP_MASK_ON_SUSPEND, }; static const struct irq_domain_ops intcapxt_domain_ops = { -- 2.26.3
WARNING: multiple messages have this Message-ID (diff)
From: Maxim Levitsky <mlevitsk@redhat.com> To: linux-kernel@vger.kernel.org Cc: Maxim Levitsky <mlevitsk@redhat.com>, "open list:AMD IOMMU AMD-VI" <iommu@lists.linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>, Will Deacon <will@kernel.org>, David Woodhouse <dwmw@amazon.co.uk> Subject: [PATCH 4/5] iommu/amd: x2apic mode: mask/unmask interrupts on suspend/resume Date: Tue, 23 Nov 2021 18:10:37 +0200 [thread overview] Message-ID: <20211123161038.48009-5-mlevitsk@redhat.com> (raw) In-Reply-To: <20211123161038.48009-1-mlevitsk@redhat.com> Use IRQCHIP_MASK_ON_SUSPEND to make the core irq code to mask the iommu interrupt on suspend and unmask it on the resume. Since now the unmask function updates the INTX settings, that will restore them on resume from s3/s4. Since IRQCHIP_MASK_ON_SUSPEND is only effective for interrupts which are not wakeup sources, remove IRQCHIP_SKIP_SET_WAKE flag and instead implement a dummy .irq_set_wake which doesn't allow the interrupt to become a wakeup source. Fixes: 66929812955bb ("iommu/amd: Add support for X2APIC IOMMU interrupts") Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> --- drivers/iommu/amd/init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 9e895bb8086a6..b94822fc2c9f7 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2104,6 +2104,11 @@ static int intcapxt_set_affinity(struct irq_data *irqd, return 0; } +static int intcapxt_set_wake(struct irq_data *irqd, unsigned int on) +{ + return on ? -EOPNOTSUPP : 0; +} + static struct irq_chip intcapxt_controller = { .name = "IOMMU-MSI", .irq_unmask = intcapxt_unmask_irq, @@ -2111,7 +2116,8 @@ static struct irq_chip intcapxt_controller = { .irq_ack = irq_chip_ack_parent, .irq_retrigger = irq_chip_retrigger_hierarchy, .irq_set_affinity = intcapxt_set_affinity, - .flags = IRQCHIP_SKIP_SET_WAKE, + .irq_set_wake = intcapxt_set_wake, + .flags = IRQCHIP_MASK_ON_SUSPEND, }; static const struct irq_domain_ops intcapxt_domain_ops = { -- 2.26.3 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2021-11-23 16:11 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-23 16:10 [PATCH 0/5] iommu/amd: fixes for suspend/resume Maxim Levitsky 2021-11-23 16:10 ` Maxim Levitsky 2021-11-23 16:10 ` [PATCH 1/5] iommu/amd: restore GA log/tail pointer on host resume Maxim Levitsky 2021-11-23 16:10 ` Maxim Levitsky 2021-11-23 16:10 ` [PATCH 2/5] iommu/amd: x2apic mode: re-enable after resume Maxim Levitsky 2021-11-23 16:10 ` Maxim Levitsky 2021-11-23 16:10 ` [PATCH 3/5] iommu/amd: x2apic mode: setup the INTX registers on mask/unmask Maxim Levitsky 2021-11-23 16:10 ` Maxim Levitsky 2021-11-23 16:10 ` Maxim Levitsky [this message] 2021-11-23 16:10 ` [PATCH 4/5] iommu/amd: x2apic mode: mask/unmask interrupts on suspend/resume Maxim Levitsky 2021-11-23 16:10 ` [PATCH 5/5] iommu/amd: remove useless irq affinity notifier Maxim Levitsky 2021-11-23 16:10 ` Maxim Levitsky 2021-12-01 23:08 ` [PATCH 0/5] iommu/amd: fixes for suspend/resume Maxim Levitsky 2021-12-01 23:08 ` Maxim Levitsky 2021-12-10 8:00 ` Maxim Levitsky 2021-12-10 8:00 ` Maxim Levitsky 2021-12-06 14:01 ` Joerg Roedel 2021-12-06 14:01 ` Joerg Roedel 2021-12-17 8:31 ` Joerg Roedel 2021-12-17 8:31 ` Joerg Roedel 2022-01-25 15:08 ` Mike Lothian 2022-01-25 15:08 ` Mike Lothian 2022-01-25 19:26 ` Maxim Levitsky 2022-01-25 19:26 ` Maxim Levitsky 2022-01-25 23:25 ` Mike Lothian 2022-01-25 23:25 ` Mike Lothian 2022-01-26 7:34 ` Maxim Levitsky 2022-01-26 7:34 ` Maxim Levitsky 2022-01-26 9:54 ` Mike Lothian 2022-01-26 9:54 ` Mike Lothian 2022-01-26 10:12 ` Maxim Levitsky 2022-01-26 10:12 ` Maxim Levitsky 2022-01-27 0:39 ` Mike Lothian 2022-01-27 0:39 ` Mike Lothian 2022-01-27 10:22 ` Maxim Levitsky 2022-01-27 10:22 ` Maxim Levitsky 2022-01-27 10:50 ` Mike Lothian 2022-01-27 10:50 ` Mike Lothian
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=20211123161038.48009-5-mlevitsk@redhat.com \ --to=mlevitsk@redhat.com \ --cc=dwmw@amazon.co.uk \ --cc=iommu@lists.linux-foundation.org \ --cc=joro@8bytes.org \ --cc=linux-kernel@vger.kernel.org \ --cc=suravee.suthikulpanit@amd.com \ --cc=tglx@linutronix.de \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.