mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Chris Wright <chrisw@sous-sol.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Cc: Mike Habeck <habeck@sgi.com>, Dimitri Sivanich <sivanich@sgi.com>,
	Derek Fults <dfults@sgi.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	stable@kernel.org, iommu@lists.linux-foundation.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] Intel pci: Remove Host Bridge devices from identity mapping
Date: Sat, 28 May 2011 13:15:06 -0500	[thread overview]
Message-ID: <20110528181502.629531676@gulag1.americas.sgi.com> (raw)
In-Reply-To: <20110528181501.896092225@gulag1.americas.sgi.com>

[-- Attachment #1: remove-pci-host-bridge-devices.patch --]
[-- Type: text/plain, Size: 5850 bytes --]

    When using the 1:1 (identity) PCI DMA remapping, PCI Host Bridge
    devices that do not use the IOMMU causes a kernel panic.  Fix that
    by not inserting those devices into the si_domain.

Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Mike Habeck <habeck@sgi.com>
Cc: stable@kernel.org
---

Specific panic message:

 IOMMU 0 0xfd020000: using Queued invalidation
 IOMMU 1 0xfd040000: using Queued invalidation
 IOMMU 2 0xfd060000: using Queued invalidation
 IOMMU 3 0xfd080000: using Queued invalidation
 IOMMU 4 0xfd0a0000: using Queued invalidation
 IOMMU 5 0xfd0c0000: using Queued invalidation
 IOMMU: hardware identity mapping for device 1000:3e:00.0
 Failed to setup IOMMU pass-through
 BUG: unable to handle kernel NULL pointer dereference at 000000000000001c
 IP: [<ffffffff816378fd>] _raw_spin_lock_irqsave+0xc/0x23
 PGD 0
 Oops: 0002 [#1] SMP
 last sysfs file:
 CPU 512
 Modules linked in:

 Pid: 1, comm: swapper Not tainted 2.6.39-rc7+ #2 Intel Corp. Stoutland Platform
 RIP: 0010:[<ffffffff816378fd>]  [<ffffffff816378fd>] _raw_spin_lock_irqsave+0xc/0x23
 RSP: 0000:ffff88105fd99d00  EFLAGS: 00010046
 RAX: 0000000000000046 RBX: 0000000000000000 RCX: 0000000000000007
 RDX: 0000000000010000 RSI: 00000000000000b8 RDI: 000000000000001c
 RBP: ffff88105fd99d00 R08: 0000000000000000 R09: ffff88107d400470
 R10: 000000000000000a R11: 0000000000000086 R12: 000000000000001c
 R13: 00000000000000b8 R14: ffff88107d82947c R15: 0000000000000286
 FS:  0000000000000000(0000) GS:ffff88107fd00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 000000000000001c CR3: 0000000001c03000 CR4: 00000000000006e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process swapper (pid: 1, threadinfo ffff88105fd98000, task ffff88105fd90000)
 Stack:
  ffff88105fd99d20 ffffffff812ad179 ffff88107d829400 ffff8b6ffe820f00
  ffff88105fd99d40 ffffffff8108eb2f ffff88105fd99d40 ffff88107d829400
  ffff88105fd99d80 ffffffff8108e396 ffff8beffa854c00 ffff88107d829400
 Call Trace:
  [<ffffffff812ad179>] dmar_msi_mask+0x17/0x3b
  [<ffffffff8108eb2f>] irq_shutdown+0x43/0x4e
  [<ffffffff8108e396>] __free_irq+0xd1/0x15d
  [<ffffffff8108e47b>] free_irq+0x59/0x72
  [<ffffffff812b09b3>] free_dmar_iommu+0x10a/0x1cb
  [<ffffffff812acc7f>] free_iommu+0x16/0x30
  [<ffffffff81e85564>] intel_iommu_init+0x8c1/0x9de
  [<ffffffff81e608c7>] ? dma32_reserve_bootmem+0x6/0x6
  [<ffffffff81e608dd>] pci_iommu_init+0x16/0x41
  [<ffffffff81000218>] do_one_initcall+0x7c/0x130
  [<ffffffff81e5b8a2>] kernel_init+0xf9/0x17e
  [<ffffffff8163eab4>] kernel_thread_helper+0x4/0x10
  [<ffffffff81e5b7a9>] ? do_early_param+0x89/0x89
  [<ffffffff8163eab0>] ? gs_change+0xb/0xb
 Code: b8 00 00 01 00 48 89 e5 f0 0f c1 07 0f b7 d0 c1 e8 10 39 c2 74 07 f3 90 0f b7 17 eb f5 c9 c3 55 48 89 e5 9c 58 fa ba 00 00 01 00 <f0> 0f c1 17 0f b7 ca c1 ea 10 39 d1 74 07 f3 90 0f b7 0f eb f5
 RIP  [<ffffffff816378fd>] _raw_spin_lock_irqsave+0xc/0x23
  RSP <ffff88105fd99d00>
 CR2: 000000000000001c
 ---[ end trace 32b2ebdae113b4c3 ]---
 swapper used greatest stack depth: 3952 bytes left
 Kernel panic - not syncing: Attempted to kill init!
 Pid: 1, comm: swapper Tainted: G      D     2.6.39-rc7+ #2
 Call Trace:
  [<ffffffff81040993>] panic+0xb7/0x1be
  [<ffffffff810338f5>] ? task_rq_unlock+0xc/0xe
  [<ffffffff810340d4>] ? sched_move_task+0xb0/0xbb
  [<ffffffff8107c479>] ? __put_css_set+0x24/0x150
  [<ffffffff81043d0c>] do_exit+0xa9/0x775
  [<ffffffff81040ccb>] ? spin_unlock_irqrestore+0x9/0xb
  [<ffffffff81638931>] oops_end+0xb3/0xbb
  [<ffffffff81027a01>] no_context+0x1f5/0x204
  [<ffffffff81027b92>] __bad_area_nosemaphore+0x182/0x1a5
  [<ffffffff81290b55>] ? __delay+0xa/0xc
  [<ffffffff81290b90>] ? __const_udelay+0x39/0x3b
  [<ffffffff81027c2b>] bad_area_nosemaphore+0xe/0x10
  [<ffffffff8163a65c>] do_page_fault+0x170/0x320
  [<ffffffff81290b55>] ? __delay+0xa/0xc
  [<ffffffff8130f8ec>] ? wait_for_xmitr+0x24/0x89
  [<ffffffff81040b9a>] ? __call_console_drivers+0x78/0x8a
  [<ffffffff8163e36e>] ? apic_timer_interrupt+0xe/0x20
  [<ffffffff81637edf>] page_fault+0x1f/0x30
  [<ffffffff816378fd>] ? _raw_spin_lock_irqsave+0xc/0x23
  [<ffffffff812ad179>] dmar_msi_mask+0x17/0x3b
  [<ffffffff8108eb2f>] irq_shutdown+0x43/0x4e
  [<ffffffff8108e396>] __free_irq+0xd1/0x15d
  [<ffffffff8108e47b>] free_irq+0x59/0x72
  [<ffffffff812b09b3>] free_dmar_iommu+0x10a/0x1cb
  [<ffffffff812acc7f>] free_iommu+0x16/0x30
  [<ffffffff81e85564>] intel_iommu_init+0x8c1/0x9de
  [<ffffffff81e608c7>] ? dma32_reserve_bootmem+0x6/0x6
  [<ffffffff81e608dd>] pci_iommu_init+0x16/0x41
  [<ffffffff81000218>] do_one_initcall+0x7c/0x130
  [<ffffffff81e5b8a2>] kernel_init+0xf9/0x17e
  [<ffffffff8163eab4>] kernel_thread_helper+0x4/0x10
  [<ffffffff81e5b7a9>] ? do_early_param+0x89/0x89
  [<ffffffff8163eab0>] ? gs_change+0xb/0xb

---
 drivers/pci/intel-iommu.c |    5 +++++
 1 file changed, 5 insertions(+)

--- linux.orig/drivers/pci/intel-iommu.c
+++ linux/drivers/pci/intel-iommu.c
@@ -47,6 +47,8 @@
 #define ROOT_SIZE		VTD_PAGE_SIZE
 #define CONTEXT_SIZE		VTD_PAGE_SIZE
 
+#define IS_BRIDGE_HOST_DEVICE(pdev) \
+			    ((pdev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
 #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
 #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
 #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
@@ -2214,6 +2216,9 @@ static int __init iommu_prepare_static_i
 		return -EFAULT;
 
 	for_each_pci_dev(pdev) {
+		/* Skip Host/PCI Bridge devices */
+		if (IS_BRIDGE_HOST_DEVICE(pdev))
+			continue;
 		if (iommu_should_identity_map(pdev, 1)) {
 			printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n",
 			       hw ? "hardware" : "software", pci_name(pdev));

-- 

  parent reply	other threads:[~2011-05-28 18:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 18:15 [PATCH 0/7] Intel pci: Fix various problems with Intel IOMMU code Mike Travis
2011-05-28 18:15 ` [PATCH 1/7] Intel pci: Check for identity mapping candidate using system dma mask Mike Travis
2011-05-28 18:15 ` [PATCH 2/7] Intel pci: Speed up processing of the identity_mapping function Mike Travis
2011-05-28 18:15 ` [PATCH 3/7] Intel pci: Dont cache iova above 32bit Mike Travis
2011-05-28 18:15 ` [PATCH 4/7] Intel pci: Use coherent DMA mask when requested Mike Travis
2011-05-28 18:15 ` Mike Travis [this message]
2011-05-28 18:15 ` [PATCH 6/7] Intel pci: Add domain check in domain_remove_one_dev_info Mike Travis
2011-05-28 18:15 ` [PATCH 7/7] Intel pci: Provide option to enable 64-bit IOMMU pass through mode Mike Travis
2011-05-29  0:12 ` [PATCH 0/7] Intel pci: Fix various problems with Intel IOMMU code David Woodhouse
2011-05-30 20:57   ` Mike Travis
2011-06-03 14:03   ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2011-05-27  1:32 Mike Travis
2011-05-27  1:32 ` [PATCH 5/7] Intel pci: Remove Host Bridge devices from identity mapping Mike Travis

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=20110528181502.629531676@gulag1.americas.sgi.com \
    --to=travis@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=dfults@sgi.com \
    --cc=dwmw2@infradead.org \
    --cc=habeck@sgi.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sivanich@sgi.com \
    --cc=stable@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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®