linux-mips
[Top] [All Lists]

RE: file corruption with highmem kernel

To: "linux-mips" <linux-mips@linux-mips.org>, "Ralf Baechle" <ralf@linux-mips.org>
Subject: RE: file corruption with highmem kernel
From: "Anoop P.A." <Anoop_P.A@pmc-sierra.com>
Date: Thu, 5 Aug 2010 06:43:50 -0700
In-reply-to: <A7DEA48C84FD0B48AAAE33F328C020140526FCF5@BBY1EXM11.pmc_nt.nt.pmc-sierra.bc.ca>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <A7DEA48C84FD0B48AAAE33F328C020140526FCF5@BBY1EXM11.pmc_nt.nt.pmc-sierra.bc.ca>
Sender: linux-mips-bounce@linux-mips.org
Thread-index: AcsyRsvJtdIm2QULSF2xEZbUAQ5rPACWmtew
Thread-topic: file corruption with highmem kernel
List,

With a slightly modified patched (copied below) I have reached a point
where I am no more seeing errors like segmentation fault, bus error
(which was due to memory corruption I believe).
How ever I am still seeing some kind of file corruption. 

I believe this file corruption happening because cache is not getting
invalidated before a highmem dma. I am not sure which routine to call to
invalidate cache for a highmem address. 

Hope to see response from linux-mips gurus

Thank you,
Anoop   

--- arch/mips/mm/dma-noncoherent.c.orig 2010-08-02 23:53:17.000000000
+0530
+++ arch/mips/mm/dma-noncoherent.c      2010-08-06 00:17:21.000000000
+0530
@@ -131,13 +131,14 @@
 
        for (i = 0; i < nents; i++, sg++) {
                unsigned long addr;
-
-               addr = (unsigned long) page_address(sg->page);
-               if (addr) {
-                       __dma_sync(addr + sg->offset, sg->length,
direction);
-                       sg->dma_address =
(dma_addr_t)page_to_phys(sg->page)
-                                         + sg->offset;
+               if (!PageHighMem(sg->page)){
+                       addr = (unsigned long)page_address(sg->page) +
sg->offset;
+                       __dma_sync(addr , sg->length, direction);
                }
+
+               sg->dma_address = (dma_addr_t)page_to_phys(sg->page)
+                                       + sg->offset;
+               
        }
 
        return nents;
@@ -187,9 +188,10 @@
                return;
 
        for (i = 0; i < nhwentries; i++, sg++) {
-               addr = (unsigned long) page_address(sg->page);
-               if (addr)
-                       __dma_sync(addr + sg->offset, sg->length,
direction);
+               if (!PageHighMem(sg->page)){
+                       addr = (unsigned long)page_address(sg->page) +
sg->offset;
+                       __dma_sync(addr , sg->length, direction);
+               }
        }
 }


<Prev in Thread] Current Thread [Next in Thread>