2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!

2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!

Post by Benjamin H » Sun, 31 Dec 2006 07:00:11



The patch looks totally bogus to me. It's passing a random struct device
from the hbsp host data structure to the dma_map_* routines. which they
can't do anything about.

The dma_map_* routines only know about some bus types. That's always
been the case (that's why you also can't pass a usb device's struct
device to them for example). Mostly, PCI, possibly others depending on
the platform.

So if you are to pass a struct device pointer to dma_map_*, use the one
inside the pci_dev of the host. Or have the host driver provide you with
the struct device pointer (which is the one from the pci_dev * for PCI
implementations, and others give you what they are on, assuming the
platform can do dma-* on that device).

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/
 
 
 

2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!

Post by Stefan Ric » Sun, 31 Dec 2006 07:50:06

enjamin Herrenschmidt wrote:
[...]
[...]

The parent device of my bogus fw-host device should do the trick. Alas I
can't test on ppc64 or with anything else than ohci1394 driven
controllers...


From: Stefan Richter < XXXX@XXXXX.COM >
Subject: ieee1394: sbp2: fix bogus dma mapping

Need to use a PCI device, not a FireWire host device. Problem found by
Andreas Schwab, mistake pointed out by Benjamin Herrenschmidt.
http://ozlabs.org/pipermail/linuxppc-dev/2006-December/029595.html

Signed-off-by: Stefan Richter < XXXX@XXXXX.COM >
---
drivers/ieee1394/sbp2.c | 73 +++++++++++++++++++++-------------------
1 file changed, 40 insertions(+), 33 deletions(-)

Index: linux-2.6.20-rc2/drivers/ieee1394/sbp2.c
===================================================================
--- linux-2.6.20-rc2.orig/drivers/ieee1394/sbp2.c
+++ linux-2.6.20-rc2/drivers/ieee1394/sbp2.c
@@ -490,11 +490,11 @@ static int sbp2util_create_command_orb_p
spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
return -ENOMEM;
}
- cmd->command_orb_dma = dma_map_single(&hi->host->device,
+ cmd->command_orb_dma = dma_map_single(hi->host->device.parent,
&cmd->command_orb,
sizeof(struct sbp2_command_orb),
DMA_TO_DEVICE);
- cmd->sge_dma = dma_map_single(&hi->host->device,
+ cmd->sge_dma = dma_map_single(hi->host->device.parent,
&cmd->scatter_gather_element,
sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL);
@@ -516,10 +516,11 @@ static void sbp2util_remove_command_orb_
if (!list_empty(&lu->cmd_orb_completed))
list_for_each_safe(lh, next, &lu->cmd_orb_completed) {
cmd = list_entry(lh, struct sbp2_command_info, list);
- dma_unmap_single(&host->device, cmd->command_orb_dma,
+ dma_unmap_single(host->device.parent,
+ cmd->command_orb_dma,
sizeof(struct sbp2_command_orb),
DMA_TO_DEVICE);
- dma_unmap_single(&host->device, cmd->sge_dma,
+ dma_unmap_single(host->device.parent, cmd->sge_dma,
sizeof(cmd->scatter_gather_element),
DMA_BIDIRECTIONAL);
kfree(cmd);
@@ -601,17 +602,17 @@ static void sbp2util_mark_command_comple

if (cmd->cmd_dma) {
if (cmd->dma_type == CMD_DMA_SINGLE)
- dma_unmap_single(&host->device, cmd->cmd_dma,
+ dma_unmap_single(host->device.parent, cmd->cmd_dma,
cmd->dma_size, cmd->dma_dir);
else if (cmd->dma_type == CMD_DMA_PAGE)
- dma_unmap_page(&host->device, cmd->cmd_dma,
+ dma_unmap_page(host->device.parent, cmd->cmd_dma,
cmd->dma_size, cmd->dma_dir);
/* XXX: Check for CMD_DMA_NONE bug */
cmd->dma_type = CMD_DMA_NONE;
cmd->cmd_dma = 0;
}
if (cmd->sge_buffer) {
- dma_unmap_sg(&host->device, cmd->sge_buffer,
+ dma_unmap_sg(host->device.parent, cmd->sge_buffer,
cmd->dma_size, cmd->dma_dir);
cmd->sge_buffer = NULL;
}
@@ -836,37 +837,37 @@ static int sbp2_start_device(struct sbp2
struct sbp2_fwhost_info *hi = lu->hi;
int error;

- lu->login_response = dma_alloc_coherent(&hi->host->device,
+ lu->login_response = dma_alloc_coherent(hi->host->device.parent,
sizeof(struct sbp2_login_response),
&lu->login_response_dma, GFP_KERNEL);
if (!lu->login_response)
goto alloc_fail;

- lu->query_logins_or
 
 
 

2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!

Post by Andreas Sc » Sun, 31 Dec 2006 21:50:22

Stefan Richter < XXXX@XXXXX.COM > writes:


Successfully tested on ppc64.

Thanks, Andreas.

--
Andreas Schwab, SuSE Labs, XXXX@XXXXX.COM
SuSE Linux Products GmbH, Maxfeldstra 5, 90409 Nnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/
 
 
 

2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!

Post by Stefan Ric » Thu, 04 Jan 2007 01:40:29

list address corrected, and a question added...)

On 1/2/2007 4:53 PM, I wrote:

Or are there some restrictions implicit in mappings via pci_dma_ API
which are lifted when using mappings via dma_ API?
--
Stefan Richter
-=====-=-=== ---= ---=-
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
 
 
 

2.6.20-rc2: kernel BUG at include/asm/dma-mapping.h:110!

Post by Stefan Ric » Sat, 20 Jan 2007 05:30:19

I wrote on 2007-01-02:

[...]

So, how about it? Is there an actual regression? If so, we should find
the cause and fix before 2.6.20 is released.

Note, sbp2's optional parameter serialize_io=0 does not work correctly
yet with some devices (it never did), therefore use sbp2 with anything
than default parameters if there are problems.
--
Stefan Richter
-=====-=-=== ---= =--=-
http://www.yqcomputer.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/