Re: [patch 00/21] 2.6.19-stable review

From: Stefan Richter
Date: Wed Feb 21 2007 - 08:38:09 EST

I wrote:
> I hope you can extract the patch from this MIME attachment.

Probably not unless I attach it for real.
Stefan Richter
-=====-=-=== --=- =-=-=
Subject: [PATCH] Missing critical phys_to_virt in lib/swiotlb.c
From: David Moore <dcm@xxxxxxx>
Date: Sun, 04 Feb 2007 13:39:40 -0500

From: David Moore <dcm@xxxxxxx>

Adds missing call to phys_to_virt() in the
lib/swiotlb.c:swiotlb_sync_sg() function. Without this change, a kernel
panic will always occur whenever a SWIOTLB bounce buffer from a
scatter-gather list gets synced.

Signed-off-by: David Moore <dcm@xxxxxxx>
Signed-off-by: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>

This is a fraction of patch "[IA64] swiotlb bug fixes" in 2.6.20-git#,
commit cde14bbfb3aa79b479db35bd29e6c083513d8614. Unlike its heading
suggests, it is also important for EM64T.

Example crashes caused by swiotlb_sync_sg:

--- linux-2.6.19.x86_64/lib/swiotlb.c.orig 2007-02-04 13:18:41.000000000 -0500
+++ linux-2.6.19.x86_64/lib/swiotlb.c 2007-02-04 13:19:43.000000000 -0500
@@ -750,7 +750,7 @@ swiotlb_sync_sg(struct device *hwdev, st

for (i = 0; i < nelems; i++, sg++)
if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
- sync_single(hwdev, (void *) sg->dma_address,
+ sync_single(hwdev, phys_to_virt(sg->dma_address),
sg->dma_length, dir, target);