All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] x86/IOMMU: abstract Intel-specific adjust_vtd_irq_affinities()
Date: Mon, 08 Apr 2019 05:16:58 -0600	[thread overview]
Message-ID: <5CAB2DAA02000078002254F3@prv1-mh.provo.novell.com> (raw)

This can't be folded into the resume hook, as that runs before bringin
back up APs, but the affinity adjustment wants to happen with all CPUs
back online. Hence a separate hook is needed such that AMD can then
leverage it as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -275,7 +275,7 @@ static int enter_state(u32 state)
     mtrr_aps_sync_begin();
     enable_nonboot_cpus();
     mtrr_aps_sync_end();
-    adjust_vtd_irq_affinities();
+    iommu_adjust_irq_affinities();
     acpi_dmar_zap();
     thaw_domains();
     system_state = SYS_STATE_active;
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2141,7 +2141,7 @@ static void adjust_irq_affinity(struct a
     dma_msi_set_affinity(irq_to_desc(drhd->iommu->msi.irq), cpumask);
 }
 
-int adjust_vtd_irq_affinities(void)
+static int adjust_vtd_irq_affinities(void)
 {
     struct acpi_drhd_unit *drhd;
 
@@ -2725,6 +2725,7 @@ const struct iommu_ops __initconstrel in
     .read_apic_from_ire = io_apic_read_remap_rte,
     .read_msi_from_ire = msi_msg_read_remap_rte,
     .setup_hpet_msi = intel_setup_hpet_msi,
+    .adjust_irq_affinities = adjust_vtd_irq_affinities,
     .suspend = vtd_suspend,
     .resume = vtd_resume,
     .share_p2m = iommu_set_pgd,
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -81,8 +81,14 @@ void iommu_update_ire_from_apic(unsigned
 unsigned int iommu_read_apic_from_ire(unsigned int apic, unsigned int reg);
 int iommu_setup_hpet_msi(struct msi_desc *);
 
+static inline int iommu_adjust_irq_affinities(void)
+{
+    return iommu_ops.adjust_irq_affinities
+           ? iommu_ops.adjust_irq_affinities()
+           : 0;
+}
+
 /* While VT-d specific, this must get declared in a generic header. */
-int adjust_vtd_irq_affinities(void);
 int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
                                  int order, int present);
 
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -224,7 +224,10 @@ struct iommu_ops {
 
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
+
     int (*setup_hpet_msi)(struct msi_desc *);
+
+    int (*adjust_irq_affinities)(void);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Jan Beulich" <JBeulich@suse.com>
To: "xen-devel" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] x86/IOMMU: abstract Intel-specific adjust_vtd_irq_affinities()
Date: Mon, 08 Apr 2019 05:16:58 -0600	[thread overview]
Message-ID: <5CAB2DAA02000078002254F3@prv1-mh.provo.novell.com> (raw)
Message-ID: <20190408111658.xvs_gc0GxLUZSAlHgm3ahC8xA8izi-VTkltsVDi2N8g@z> (raw)

This can't be folded into the resume hook, as that runs before bringin
back up APs, but the affinity adjustment wants to happen with all CPUs
back online. Hence a separate hook is needed such that AMD can then
leverage it as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -275,7 +275,7 @@ static int enter_state(u32 state)
     mtrr_aps_sync_begin();
     enable_nonboot_cpus();
     mtrr_aps_sync_end();
-    adjust_vtd_irq_affinities();
+    iommu_adjust_irq_affinities();
     acpi_dmar_zap();
     thaw_domains();
     system_state = SYS_STATE_active;
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2141,7 +2141,7 @@ static void adjust_irq_affinity(struct a
     dma_msi_set_affinity(irq_to_desc(drhd->iommu->msi.irq), cpumask);
 }
 
-int adjust_vtd_irq_affinities(void)
+static int adjust_vtd_irq_affinities(void)
 {
     struct acpi_drhd_unit *drhd;
 
@@ -2725,6 +2725,7 @@ const struct iommu_ops __initconstrel in
     .read_apic_from_ire = io_apic_read_remap_rte,
     .read_msi_from_ire = msi_msg_read_remap_rte,
     .setup_hpet_msi = intel_setup_hpet_msi,
+    .adjust_irq_affinities = adjust_vtd_irq_affinities,
     .suspend = vtd_suspend,
     .resume = vtd_resume,
     .share_p2m = iommu_set_pgd,
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -81,8 +81,14 @@ void iommu_update_ire_from_apic(unsigned
 unsigned int iommu_read_apic_from_ire(unsigned int apic, unsigned int reg);
 int iommu_setup_hpet_msi(struct msi_desc *);
 
+static inline int iommu_adjust_irq_affinities(void)
+{
+    return iommu_ops.adjust_irq_affinities
+           ? iommu_ops.adjust_irq_affinities()
+           : 0;
+}
+
 /* While VT-d specific, this must get declared in a generic header. */
-int adjust_vtd_irq_affinities(void);
 int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
                                  int order, int present);
 
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -224,7 +224,10 @@ struct iommu_ops {
 
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
+
     int (*setup_hpet_msi)(struct msi_desc *);
+
+    int (*adjust_irq_affinities)(void);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2019-04-08 11:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 11:16 Jan Beulich [this message]
2019-04-08 11:16 ` [Xen-devel] [PATCH] x86/IOMMU: abstract Intel-specific adjust_vtd_irq_affinities() Jan Beulich
2019-04-09  3:13 ` Tian, Kevin
2019-04-09  3:13   ` [Xen-devel] " Tian, Kevin
2019-04-09  9:11 ` Andrew Cooper
2019-04-09  9:11   ` [Xen-devel] " Andrew Cooper

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=5CAB2DAA02000078002254F3@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=kevin.tian@intel.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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: link
Be 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.