linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jason McMullan <jason.mcmullan@timesys.com>
To: PPC_LINUX <linuxppc-embedded@ozlabs.org>
Subject: [PATCH] 2.6.11.7 MPC8xx Swap Band-Aid
Date: Thu, 05 May 2005 08:45:23 -0400	[thread overview]
Message-ID: <1115297124.9050.12.camel@jmcmullan.timesys> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 406 bytes --]

First off, this patch works.

Secondly, I don't know exactly why. I just found all the band-aids I 
could for MPC8xx swap functionality, applied them, and fixed the places
where it still bled.

It's more of a dancing bear, than a real fix, but I now have working 
swap (using ATA over Ethernet) on my MPC885 ADS.

Enjoy!

-- 
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation


[-- Attachment #1.2: cpu-ppc-mpc8xx-swap.patch --]
[-- Type: text/x-patch, Size: 3623 bytes --]

Date:		Thu, 05 May 2005 08:31:24 -0400
Summary:	MPC8xx swap support
Relative-to:	linux-2.6.11.7
Description: MPC8xx swap support, band-aided together from patches by:
	Satoshi Adachi <adachi@aa.ap.titech.ac.jp>
	Marcelo Tosatti <marcelo.tosatti@cyclades.com>
	Jason McMullan <jason.mcmullan@timesys.com>
Signed-Off-By:  Jason McMullan <jason.mcmullan@timesys.com>

--- linux-orig/arch/ppc/kernel/head_8xx.S
+++ linux/arch/ppc/kernel/head_8xx.S
@@ -359,9 +359,7 @@
 
 	. = 0x1200
 DataStoreTLBMiss:
-#ifdef CONFIG_8xx_CPU6
 	stw	r3, 8(r0)
-#endif
 	DO_8xx_CPU6(0x3f80, r3)
 	mtspr	M_TW, r10	/* Save a couple of working registers */
 	mfcr	r10
@@ -390,6 +388,16 @@
 	mfspr	r10, MD_TWC	/* ....and get the pte address */
 	lwz	r10, 0(r10)	/* Get the pte */
 
+	li	r3, 0
+	cmpw	r10, r3            /* does the pte contain a valid address? */
+	bne	4f
+	mfspr   r10, M_TW       /* Restore registers */
+	lwz     r11, 0(r0)
+	mtcr    r11
+	lwz     r11, 4(r0)
+	lwz	r3, 8(r0)
+	b DataAccess
+4:
 	/* Insert the Guarded flag into the TWC from the Linux PTE.
 	 * It is bit 27 of both the Linux PTE and the TWC (at least
 	 * I got that right :-).  It will be better when we can put
@@ -419,9 +427,7 @@
 	lwz	r11, 0(r0)
 	mtcr	r11
 	lwz	r11, 4(r0)
-#ifdef CONFIG_8xx_CPU6
 	lwz	r3, 8(r0)
-#endif
 	rfi
 
 /* This is an instruction TLB error on the MPC8xx.  This could be due
--- linux-orig/arch/ppc/mm/init.c
+++ linux/arch/ppc/mm/init.c
@@ -585,7 +585,7 @@
 
 void flush_dcache_icache_page(struct page *page)
 {
-#ifdef CONFIG_BOOKE
+#if defined(CONFIG_BOOKE) || defined(CONFIG_8xx)
 	__flush_dcache_icache(kmap(page));
 	kunmap(page);
 #else
@@ -632,9 +632,15 @@
 		struct page *page = pfn_to_page(pfn);
 		if (!PageReserved(page)
 		    && !test_bit(PG_arch_1, &page->flags)) {
-			if (vma->vm_mm == current->active_mm)
+			if (vma->vm_mm == current->active_mm) {
+#ifdef CONFIG_8xx		/* Evil masking of larger problems.
+				 * We shouldn't have to do this if
+				 * we have properly invalidated!
+				 */
+				flush_tlb_page(vma,address);
+#endif
 				__flush_dcache_icache((void *) address);
-			else
+			} else
 				flush_dcache_icache_page(page);
 			set_bit(PG_arch_1, &page->flags);
 		}
--- linux-orig/include/asm-ppc/pgtable.h
+++ linux/include/asm-ppc/pgtable.h
@@ -678,7 +678,11 @@
 #define __swp_type(entry)		((entry).val & 0x1f)
 #define __swp_offset(entry)		((entry).val >> 5)
 #define __swp_entry(type, offset)	((swp_entry_t) { (type) | ((offset) << 5) })
+#ifdef CONFIG_8xx
+#define __pte_to_swp_entry(pte)		((swp_entry_t) { (pte_val(pte) & ~_PAGE_ACCESSED) >> 3 })
+#else
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val(pte) >> 3 })
+#endif
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val << 3 })
 
 /* Encode and decode a nonlinear file mapping entry */
--- linux-orig/include/asm-ppc/tlbflush.h
+++ linux/include/asm-ppc/tlbflush.h
@@ -72,7 +72,7 @@
 static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
 					 unsigned long vmaddr)
 	{ _tlbie(vmaddr); }
-static inline void flush_tlb_range(struct mm_struct *mm,
+static inline void flush_tlb_range(struct vm_area_struct *vma,
 				unsigned long start, unsigned long end)
 	{ __tlbia(); }
 static inline void flush_tlb_kernel_range(unsigned long start,
--- linux-orig/mm/swapfile.c
+++ linux/mm/swapfile.c
@@ -80,7 +80,7 @@
 		WARN_ON(page_count(page) <= 1);
 
 		bdi = bdev->bd_inode->i_mapping->backing_dev_info;
-		bdi->unplug_io_fn(bdi, page);
+		blk_run_backing_dev(bdi, page);
 	}
 	up_read(&swap_unplug_sem);
 }

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2005-05-05 12:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-05 12:45 Jason McMullan [this message]
2005-05-05 13:31 ` [PATCH] 2.6.11.7 MPC8xx Swap Band-Aid Dan Malek

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=1115297124.9050.12.camel@jmcmullan.timesys \
    --to=jason.mcmullan@timesys.com \
    --cc=linuxppc-embedded@ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).