linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.6.11.7 MPC8xx Swap Band-Aid
@ 2005-05-05 12:45 Jason McMullan
  2005-05-05 13:31 ` Dan Malek
  0 siblings, 1 reply; 2+ messages in thread
From: Jason McMullan @ 2005-05-05 12:45 UTC (permalink / raw)
  To: PPC_LINUX


[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] 2.6.11.7 MPC8xx Swap Band-Aid
  2005-05-05 12:45 [PATCH] 2.6.11.7 MPC8xx Swap Band-Aid Jason McMullan
@ 2005-05-05 13:31 ` Dan Malek
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Malek @ 2005-05-05 13:31 UTC (permalink / raw)
  To: Jason McMullan; +Cc: PPC_LINUX


On May 5, 2005, at 8:45 AM, Jason McMullan wrote:

> First off, this patch works.

Well ..... if you invalidate TLBs and flush cache often enough,
you can mask lots of problems :-)


> 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.

We shouldn't have the 8xx as a special case for the swap flags and
information.  We need to take a closer look at this.  I guess I'll do 
that
as part of fixing up the PTEs for the BDI2000 as well.

> 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.

IIRC, ATA over Ethernet isn't the same as disk doing DMA due to the
data copies involved.

Thanks.

	-- Dan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-05 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-05 12:45 [PATCH] 2.6.11.7 MPC8xx Swap Band-Aid Jason McMullan
2005-05-05 13:31 ` Dan Malek

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).