All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v2 1/4] x86/ioapic: only use dest32 with x2apic and interrupt remapping enabled
Date: Fri, 29 Nov 2019 12:28:48 +0100	[thread overview]
Message-ID: <20191129112851.19273-2-roger.pau@citrix.com> (raw)
In-Reply-To: <20191129112851.19273-1-roger.pau@citrix.com>

The IO-APIC code assumes that x2apic being enabled also implies
interrupt remapping being enabled, and hence will use the 32bit
destination field in the IO-APIC entry.

This is safe now, but there's no reason to not enable x2APIC even
without interrupt remapping, and hence the IO-APIC code needs to use
the 32 bit destination field only when both interrupt remapping and
x2APIC are enabled.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v1:
 - Fix set_ioapic_affinity_irq.
---
 xen/arch/x86/io_apic.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 97cb2d154a..be0b085513 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -562,7 +562,7 @@ set_ioapic_affinity_irq(struct irq_desc *desc, const cpumask_t *mask)
 
     dest = set_desc_affinity(desc, mask);
     if (dest != BAD_APICID) {
-        if ( !x2apic_enabled )
+        if ( !iommu_intremap )
             dest = SET_APIC_LOGICAL_ID(dest);
         entry = irq_2_pin + irq;
         for (;;) {
@@ -964,7 +964,7 @@ static hw_irq_controller ioapic_edge_type;
 #define IOAPIC_LEVEL	1
 
 #define SET_DEST(ent, mode, val) do { \
-    if (x2apic_enabled) \
+    if (x2apic_enabled && iommu_intremap) \
         (ent).dest.dest32 = (val); \
     else \
         (ent).dest.mode.mode##_dest = (val); \
@@ -1194,14 +1194,14 @@ static void /*__init*/ __print_IO_APIC(bool boot)
 	printk(KERN_DEBUG ".... IRQ redirection table:\n");
 
 	printk(KERN_DEBUG " NR %s Msk Trg IRR Pol Stat DstM DelM Vec\n",
-               x2apic_enabled ? " DestID" : "Dst");
+               (x2apic_enabled && iommu_intremap) ? " DestID" : "Dst");
 
 	for (i = 0; i <= reg_01.bits.entries; i++) {
             struct IO_APIC_route_entry entry;
 
             entry = ioapic_read_entry(apic, i, 0);
 
-            if ( x2apic_enabled )
+            if ( x2apic_enabled && iommu_intremap )
                 printk(KERN_DEBUG " %02x %08x", i, entry.dest.dest32);
             else
                 printk(KERN_DEBUG " %02x  %02x ", i,
@@ -2504,9 +2504,9 @@ void dump_ioapic_irq_info(void)
                    rte.dest_mode ? 'L' : 'P',
                    rte.delivery_status, rte.polarity, rte.irr,
                    rte.trigger ? 'L' : 'E', rte.mask,
-                   x2apic_enabled ? 8 : 2,
-                   x2apic_enabled ? rte.dest.dest32
-                                  : rte.dest.logical.logical_dest);
+                   (x2apic_enabled && iommu_intremap) ? 8 : 2,
+                   (x2apic_enabled && iommu_intremap) ?
+                       rte.dest.dest32 : rte.dest.logical.logical_dest);
 
             if ( entry->next == 0 )
                 break;
-- 
2.24.0


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

  reply	other threads:[~2019-11-29 11:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29 11:28 [Xen-devel] [PATCH v2 0/4] x86: enable x2APIC mode regardless of interrupt remapping support Roger Pau Monne
2019-11-29 11:28 ` Roger Pau Monne [this message]
2019-12-03 15:11   ` [Xen-devel] [PATCH v2 1/4] x86/ioapic: only use dest32 with x2apic and interrupt remapping enabled Jan Beulich
2019-12-04 10:47     ` Roger Pau Monné
2019-11-29 11:28 ` [Xen-devel] [PATCH v2 2/4] x86/apic: force phys mode if interrupt remapping is disabled Roger Pau Monne
2019-11-29 11:38   ` Roger Pau Monné
2019-12-03 15:14     ` Jan Beulich
2019-12-04  9:17       ` Roger Pau Monné
2019-12-04  9:34         ` Jan Beulich
2019-12-04 10:50           ` Roger Pau Monné
2019-11-29 11:28 ` [Xen-devel] [PATCH v2 3/4] x86/smp: check APIC ID on AP bringup Roger Pau Monne
2019-12-03 15:23   ` Jan Beulich
2019-11-29 11:28 ` [Xen-devel] [PATCH v2 4/4] x86/apic: allow enabling x2APIC mode regardless of interrupt remapping Roger Pau Monne
2019-12-03 15:33   ` Jan Beulich
2019-12-04 13:51     ` Roger Pau Monné
2019-12-04 14:28       ` Jan Beulich

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=20191129112851.19273-2-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=wl@xen.org \
    --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.