public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@keyaccess.nl>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Takashi Iwai <tiwai@suse.de>,
	Glauber Costa <gcosta@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Pete Clements <clem@clem.clem-digital.net>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	ALSA devel <alsa-devel@alsa-project.org>
Subject: Re: 2.6.26-rc1 regression: ISA DMA broken (bisected)
Date: Wed, 14 May 2008 14:46:44 +0200	[thread overview]
Message-ID: <482ADF34.2010004@keyaccess.nl> (raw)
In-Reply-To: <200805131718.40138.bjorn.helgaas@hp.com>

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

On 14-05-08 01:18, Bjorn Helgaas wrote:

> On Tuesday 13 May 2008 11:33:25 am Rene Herman wrote:

>> No, isa_device is its own thing, on its own isa_bus (*). It has a struct 
>> device * readily available though...
>>
>> (*) drivers/base/isa.c, and explanatory changelog at:
>>
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a5117ba7da37deb09df5eb802dace229b3fb1e9f
> 
> Thanks for the nice changelog.
> 
> isa_register_driver() currently doesn't set a DMA mask.  Should it?

If it's going to be useful, definitely. The attached does not just set

   dev->dma_mask = &dev->coherent_dma_mask

as in the fallback_dev when dma_alloc_coherent() is passed a NULL device 
only due to the mask juggling in snd_dma_hack_alloc_coherent() (which 
wouldn't break, but...) but introduces its own copy in struct isa_dev 
same as struct pnp_dev. As far as I'm aware, there's no actual reason 
for keeping it other than that and if the hack could go I'd rather lose 
the private mask copy again also.

(the device model still uses a plain u64 by the way but I guess the 
clean type would be a dma64_addr_t)

Inlining is whitespace-failing here. Patch itself is trivial...

> I only see about 35 dma_alloc_coherent() calls that pass NULL.  I 
> guess even those would be a fair amount of work to change, and I 
> suppose there would be more that I missed.

At least the ALSA one isn't passing a literal NULL it seems. But yes, 
current NULL-hack reinstatement (it's been merged by Linus already) is 
definitely the correct fix for now.

Would like a comment on the snd_dma_hack_alloc_coherent thing first (no 
signoff...) but other than that I'll submit this in preparation for it 
being useful, I guess?

Rene.

[-- Attachment #2: isa_dev_dma_mask.diff --]
[-- Type: text/plain, Size: 1461 bytes --]

From: Rene Herman <rene.herman@gmail.com>

ISA: set 24-bit dma_mask for ISA devices

Set the ISA device dma_mask in preparation for using the actual device
with the DMA API.
---
 drivers/base/isa.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index d222239..842ca08 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -7,6 +7,8 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/types.h>
+#include <linux/dma-mapping.h>
 #include <linux/isa.h>
 
 static struct device isa_bus = {
@@ -17,6 +19,7 @@ struct isa_dev {
 	struct device dev;
 	struct device *next;
 	unsigned int id;
+	u64 dma_mask;
 };
 
 #define to_isa_dev(x) container_of((x), struct isa_dev, dev)
@@ -131,6 +134,9 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev)
 			break;
 		}
 
+		isa_dev->id		= id;
+		isa_dev->dma_mask	= DMA_24BIT_MASK;
+
 		isa_dev->dev.parent	= &isa_bus;
 		isa_dev->dev.bus	= &isa_bus_type;
 
@@ -138,8 +144,9 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev)
 				isa_driver->driver.name, id);
 
 		isa_dev->dev.platform_data	= isa_driver;
+		isa_dev->dev.dma_mask		= &isa_dev->dma_mask;
+		isa_dev->dev.coherent_dma_mask  = isa_dev->dma_mask;
 		isa_dev->dev.release		= isa_dev_release;
-		isa_dev->id			= id;
 
 		error = device_register(&isa_dev->dev);
 		if (error) {
-- 
1.5.2.2


  parent reply	other threads:[~2008-05-14 12:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09  1:37 2.6.26-rc1 regression: ISA DMA broken (bisected) Rene Herman
2008-05-09  6:06 ` Takashi Iwai
2008-05-09  8:55   ` Ingo Molnar
2008-05-09  8:58     ` Ingo Molnar
2008-05-09 17:20       ` Jesse Barnes
2008-05-09 12:03   ` Rene Herman
2008-05-09 12:28     ` Ingo Molnar
2008-05-09 23:00       ` Rene Herman
2008-05-13 14:36         ` Ingo Molnar
2008-05-13 15:26           ` Rene Herman
2008-05-09 12:29     ` Pete Clements
2008-05-09 12:48   ` Glauber Costa
2008-05-13 16:59   ` Bjorn Helgaas
2008-05-13 17:01     ` Alan Cox
2008-05-13 17:33       ` Rene Herman
2008-05-13 23:18         ` Bjorn Helgaas
2008-05-14  9:25           ` Takashi Iwai
2008-05-14 12:46           ` Rene Herman [this message]
2008-05-14 13:01             ` Takashi Iwai
2008-05-14 15:40               ` Rene Herman
2008-05-14 15:53                 ` Takashi Iwai
2008-05-14 18:41                 ` Rene Herman
2008-05-14 18:50                   ` Bjorn Helgaas
2008-05-14 19:09                     ` Rene Herman
2008-05-30 21:15                       ` [PATCH] " Rene Herman
2008-05-30 21:28                         ` [DEVICE MODEL] dev->dma_mask Rene Herman
2008-05-30 21:43                         ` [PATCH] Re: 2.6.26-rc1 regression: ISA DMA broken (bisected) Bjorn Helgaas
2008-05-30 22:11                           ` Rene Herman
2008-05-30 22:37                             ` [PATCH] ISA: set 24-bit dma_mask for ISA devices Rene Herman
2008-05-30 22:55                               ` Andrew Morton
2008-05-30 23:50                                 ` Rene Herman
2008-05-30 23:54                             ` [PATCH] PNP: set the pnp_card dma_mask for use by ISAPnP cards Rene Herman
2008-05-31  8:55                               ` Takashi Iwai
2008-05-30 23:55                             ` [PATCH] ISA: set 24-bit dma_mask for ISA devices Rene Herman
2008-05-31  8:56                               ` Takashi Iwai
2008-05-14 15:26             ` 2.6.26-rc1 regression: ISA DMA broken (bisected) Bjorn Helgaas

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=482ADF34.2010004@keyaccess.nl \
    --to=rene.herman@keyaccess.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=bjorn.helgaas@hp.com \
    --cc=clem@clem.clem-digital.net \
    --cc=gcosta@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.de \
    /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