iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: Andreas Degert <andreas.degert-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: soundcard (dma) stopped working with commit 27c2127 (x86/amd-iommu: Use only per-device dma_ops)
Date: Tue, 26 Mar 2013 21:30:55 +0100	[thread overview]
Message-ID: <20130326203054.GA30540@8bytes.org> (raw)
In-Reply-To: <CAHccUrKpMiY4DURL_V2fPD8anz3T8WQT2_0PABu87mCzokpaWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

On Tue, Mar 26, 2013 at 08:40:18PM +0100, Andreas Degert wrote:
> dmesg output appended. I was wrong, there are io page faults
> when I trigger dma transfer with the soundcard, like you expected.
> At the end of the dmesg output are the IO_PAGE_FAULT's from
> trying to do a playback.

Okay, thanks for trying this out. I think I know where the problem is,
can you try the attached patch (without my debug-patch) and report me
whether it fixes the issue?

Thanks,

	Joerg

[-- Attachment #2: iommu-fix.patch --]
[-- Type: text/x-diff, Size: 1045 bytes --]

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index c1c74e0..4647b50 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2466,18 +2466,16 @@ static int device_change_notifier(struct notifier_block *nb,
 
 		/* allocate a protection domain if a device is added */
 		dma_domain = find_protection_domain(devid);
-		if (dma_domain)
-			goto out;
-		dma_domain = dma_ops_domain_alloc();
-		if (!dma_domain)
-			goto out;
-		dma_domain->target_dev = devid;
-
-		spin_lock_irqsave(&iommu_pd_list_lock, flags);
-		list_add_tail(&dma_domain->list, &iommu_pd_list);
-		spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
-
-		dev_data = get_dev_data(dev);
+		if (!dma_domain) {
+			dma_domain = dma_ops_domain_alloc();
+			if (!dma_domain)
+				goto out;
+			dma_domain->target_dev = devid;
+
+			spin_lock_irqsave(&iommu_pd_list_lock, flags);
+			list_add_tail(&dma_domain->list, &iommu_pd_list);
+			spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
+		}
 
 		dev->archdata.dma_ops = &amd_iommu_dma_ops;
 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2013-03-26 20:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26  7:37 soundcard (dma) stopped working with commit 27c2127 (x86/amd-iommu: Use only per-device dma_ops) Andreas Degert
     [not found] ` <CAHccUrL2_JLMyYzzBYUdUGy0VVRRk90u9_MyknPKcRJpr_ZDfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-26  9:49   ` Joerg Roedel
     [not found]     ` <20130326094930.GD13035-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-03-26 12:48       ` Andreas Degert
     [not found]         ` <CAHccUr+w1_65uBXLcmZLrPOgbC8Ldk8+PKxaRLv03rBYxBRDkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-26 14:23           ` Joerg Roedel
     [not found]             ` <20130326142336.GE13035-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-03-26 15:20               ` Andreas Degert
     [not found]                 ` <CAHccUrKmtjqBZVb1+1O5c4j6_9Er5Ow4tPRhExCW-g_kaV1-3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-26 16:11                   ` Joerg Roedel
     [not found]                     ` <20130326161132.GF2727-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-03-26 19:40                       ` Andreas Degert
     [not found]                         ` <CAHccUrKpMiY4DURL_V2fPD8anz3T8WQT2_0PABu87mCzokpaWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-26 20:30                           ` Joerg Roedel [this message]
     [not found]                             ` <20130326203054.GA30540-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-03-27  7:14                               ` Andreas Degert
     [not found]                                 ` <CAHccUr+MkODo0_Tci9sDEyXNBHu7CyqnVCamauvDESC_QL22HQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-27  8:28                                   ` Joerg Roedel

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=20130326203054.GA30540@8bytes.org \
    --to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
    --cc=andreas.degert-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).