linux-mips-fnet
[Top] [All Lists]

Re: Question about mmap()

To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Subject: Re: Question about mmap()
From: Ralf Baechle <ralf@uni-koblenz.de>
Date: Thu, 6 Sep 2001 02:18:30 +0200
Cc: Sugi <Nobukazu.Sugiyama@am.sony.com>, "linux-mips@fnet.fr" <linux-mips@fnet.fr>
In-reply-to: <Pine.GSO.3.96.1010905134553.7702A-100000@delta.ds2.pg.gda.pl>; from macro@ds2.pg.gda.pl on Wed, Sep 05, 2001 at 01:50:11PM +0200
References: <3B95240B.5C273EC4@am.sony.com> <Pine.GSO.3.96.1010905134553.7702A-100000@delta.ds2.pg.gda.pl>
User-agent: Mutt/1.2.5i
On Wed, Sep 05, 2001 at 01:50:11PM +0200, Maciej W. Rozycki wrote:

>  See pgprot_noncached() in drivers/char/mem.c and how that's used for
> mmap()ping /dev/mem.  Note that pgprot_noncached() should probably moved
> to include/asm/pgtable.h as the comment suggests, so you'd better move the
> relevant (MIPS) part there instead of duplicating the code.  This is
> already done for ia64. 

Just did that.

  Ralf

Index: include/asm-mips64/pgtable.h
===================================================================
RCS file: /home/pub/cvs/linux/include/asm-mips64/pgtable.h,v
retrieving revision 1.44
diff -u -r1.44 pgtable.h
--- include/asm-mips64/pgtable.h 2001/08/28 19:17:14 1.44  
+++ include/asm-mips64/pgtable.h 2001/09/06 00:16:41   
@@ -461,6 +461,23 @@
 }
 
 /*
+ * Macro to make mark a page protection value as "uncacheable".  Note
+ * that "protection" is really a misnomer here as the protection value
+ * contains the memory attribute bits, dirty bits, and various other
+ * bits as well.
+ */
+#define pgprot_noncached pgprot_noncached
+
+static inline pgprot_t pgprot_noncached(pgprot_t _prot)
+{
+       unsigned long prot = pgprot_val(_prot);
+
+       prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
+
+       return __pgprot(prot);
+}
+
+/*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
  */
Index: include/asm-mips/pgtable.h
===================================================================
RCS file: /home/pub/cvs/linux/include/asm-mips/pgtable.h,v
retrieving revision 1.57
diff -u -r1.57 pgtable.h
--- include/asm-mips/pgtable.h 2001/08/15 02:11:39 1.57  
+++ include/asm-mips/pgtable.h 2001/09/06 00:16:41   
@@ -397,6 +397,23 @@
        return pte;
 }
 
+/*
+ * Macro to make mark a page protection value as "uncacheable".  Note
+ * that "protection" is really a misnomer here as the protection value
+ * contains the memory attribute bits, dirty bits, and various other
+ * bits as well.
+ */
+#define pgprot_noncached pgprot_noncached
+
+static inline pgprot_t pgprot_noncached(pgprot_t _prot)
+{
+       unsigned long prot = pgprot_val(_prot);
+
+       prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
+
+       return __pgprot(prot);
+}
+
 extern inline pte_t pte_mkyoung(pte_t pte)
 {
        pte_val(pte) |= _PAGE_ACCESSED;
Index: drivers/char/mem.c
===================================================================
RCS file: /home/pub/cvs/linux/drivers/char/mem.c,v
retrieving revision 1.48
diff -u -r1.48 mem.c
--- drivers/char/mem.c 2001/08/24 03:38:36 1.48  
+++ drivers/char/mem.c 2001/09/06 00:16:42   
@@ -153,8 +153,6 @@
        /* Use no-cache mode, serialized */
        else if (MMU_IS_040 || MMU_IS_060)
                prot = (prot & _CACHEMASK040) | _PAGE_NOCACHE_S;
-#elif defined(__mips__)
-       prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
 #endif
 
        return __pgprot(prot);

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