All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: linux-mips@linux-mips.org
Cc: Bob Breuer <bbreuer@righthandtech.com>,
	Jordan Crouse <jordan.crouse@amd.com>,
	Konstantin Baidarov <kbaidarov@ru.mvista.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Pete Popov <ppopov@embeddedalley.com>,
	Manish Lachwani <mlachwani@mvista.com>
Subject: [PATCH] Fix swap entry for MIPS32 with 36-bit physical address
Date: Sat, 08 Apr 2006 13:51:08 +0400	[thread overview]
Message-ID: <4437878C.3000603@ru.mvista.com> (raw)
In-Reply-To: <4436E201.4090409@ru.mvista.com>

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


     With 64-bit physical address enabled, 'swapon' was causing kernel oops on
Alchemy CPUs (MIPS32) because of the swap entry type field corrupting the
_PAGE_FILE bit in 'pte_low' field. So, switch to storing the swap entry in
'pte_high' field using all its bits except _PAGE_GLOBAL and _PAGE_VALID which
gives 25 bits for the swap entry offset.

WBR, Sergei

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>


[-- Attachment #2: MIPS32-36bit-phys-addr-swap-entry-fix.patch --]
[-- Type: text/plain, Size: 1433 bytes --]

diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 4d6bc45..a5ce3f1 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -191,10 +191,17 @@ pfn_pte(unsigned long pfn, pgprot_t prot
 #else
 
 /* Swap entries must have VALID and GLOBAL bits cleared. */
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
+#define __swp_type(x)		(((x).val >> 2) & 0x1f)
+#define __swp_offset(x) 	 ((x).val >> 7)
+#define __swp_entry(type,offset)	\
+		((swp_entry_t)  { ((type) << 2) | ((offset) << 7) })
+#else
 #define __swp_type(x)		(((x).val >> 8) & 0x1f)
-#define __swp_offset(x)		((x).val >> 13)
+#define __swp_offset(x) 	 ((x).val >> 13)
 #define __swp_entry(type,offset)	\
-		((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
+		((swp_entry_t)  { ((type) << 8) | ((offset) << 13) })
+#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
 
 /*
  * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset
@@ -218,7 +225,12 @@ pfn_pte(unsigned long pfn, pgprot_t prot
 
 #endif
 
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
+#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
+#define __swp_entry_to_pte(x)	((pte_t) { 0, (x).val })
+#else
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val })
+#endif
 
 #endif /* _ASM_PGTABLE_32_H */



  reply	other threads:[~2006-04-08  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-22 22:20 swapon failure with au1550 Bob Breuer
2005-02-22 22:20 ` Bob Breuer
2006-04-05 13:45 ` [PATCH] Fix swap entry for MIPS32 36-bit physical address Sergei Shtylyov
2006-04-07 19:52   ` Sergei Shtylyov
2006-04-07 21:19     ` Sergei Shtylyov
2006-04-07 21:19       ` Sergei Shtylyov
2006-04-07 21:20     ` Sergei Shtylyov
2006-04-07 22:04       ` Sergei Shtylyov
2006-04-08  9:51         ` Sergei Shtylyov [this message]
2006-04-08  3:56     ` [PATCH] Enable 36-bit physical address on MIPS32R2 also Sergei Shtylyov

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=4437878C.3000603@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=bbreuer@righthandtech.com \
    --cc=jordan.crouse@amd.com \
    --cc=kbaidarov@ru.mvista.com \
    --cc=linux-mips@linux-mips.org \
    --cc=mlachwani@mvista.com \
    --cc=ppopov@embeddedalley.com \
    --cc=ralf@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.