diff options
author | Vitaly Bordug <vitb@kernel.crashing.org> | 2008-03-06 05:53:30 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-03-07 09:42:28 -0500 |
commit | 76db5bd26f2d79712459bf80ce0e5c0c5c31b769 (patch) | |
tree | 0e5723534da93040f901ed94020aef845fff0dfb /arch/powerpc/kernel/head_8xx.S | |
parent | d7f46190ef1048e48f71c8a7a60c2881c437d08d (diff) |
[POWERPC] 8xx: fix swap
This makes swap routines operate correctly on the ppc_8xx based machines.
Code has been revalidated on mpc885ads (8M sdram) with recent kernel. Based
on patch from Yuri Tikhonov <yur@emcraft.com> to do the same on arch/ppc
instance.
Recent kernel's size makes swap feature very important on low-memory platforms,
those are actually non-operable without it.
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/head_8xx.S')
-rw-r--r-- | arch/powerpc/kernel/head_8xx.S | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index f7458396cd7c..3c9452d4308b 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S | |||
@@ -332,8 +332,18 @@ InstructionTLBMiss: | |||
332 | mfspr r11, SPRN_MD_TWC /* ....and get the pte address */ | 332 | mfspr r11, SPRN_MD_TWC /* ....and get the pte address */ |
333 | lwz r10, 0(r11) /* Get the pte */ | 333 | lwz r10, 0(r11) /* Get the pte */ |
334 | 334 | ||
335 | #ifdef CONFIG_SWAP | ||
336 | /* do not set the _PAGE_ACCESSED bit of a non-present page */ | ||
337 | andi. r11, r10, _PAGE_PRESENT | ||
338 | beq 4f | ||
339 | ori r10, r10, _PAGE_ACCESSED | ||
340 | mfspr r11, SPRN_MD_TWC /* get the pte address again */ | ||
341 | stw r10, 0(r11) | ||
342 | 4: | ||
343 | #else | ||
335 | ori r10, r10, _PAGE_ACCESSED | 344 | ori r10, r10, _PAGE_ACCESSED |
336 | stw r10, 0(r11) | 345 | stw r10, 0(r11) |
346 | #endif | ||
337 | 347 | ||
338 | /* The Linux PTE won't go exactly into the MMU TLB. | 348 | /* The Linux PTE won't go exactly into the MMU TLB. |
339 | * Software indicator bits 21, 22 and 28 must be clear. | 349 | * Software indicator bits 21, 22 and 28 must be clear. |
@@ -398,8 +408,17 @@ DataStoreTLBMiss: | |||
398 | DO_8xx_CPU6(0x3b80, r3) | 408 | DO_8xx_CPU6(0x3b80, r3) |
399 | mtspr SPRN_MD_TWC, r11 | 409 | mtspr SPRN_MD_TWC, r11 |
400 | 410 | ||
401 | mfspr r11, SPRN_MD_TWC /* get the pte address again */ | 411 | #ifdef CONFIG_SWAP |
412 | /* do not set the _PAGE_ACCESSED bit of a non-present page */ | ||
413 | andi. r11, r10, _PAGE_PRESENT | ||
414 | beq 4f | ||
402 | ori r10, r10, _PAGE_ACCESSED | 415 | ori r10, r10, _PAGE_ACCESSED |
416 | 4: | ||
417 | /* and update pte in table */ | ||
418 | #else | ||
419 | ori r10, r10, _PAGE_ACCESSED | ||
420 | #endif | ||
421 | mfspr r11, SPRN_MD_TWC /* get the pte address again */ | ||
403 | stw r10, 0(r11) | 422 | stw r10, 0(r11) |
404 | 423 | ||
405 | /* The Linux PTE won't go exactly into the MMU TLB. | 424 | /* The Linux PTE won't go exactly into the MMU TLB. |
@@ -507,7 +526,16 @@ DataTLBError: | |||
507 | 526 | ||
508 | /* Update 'changed', among others. | 527 | /* Update 'changed', among others. |
509 | */ | 528 | */ |
529 | #ifdef CONFIG_SWAP | ||
530 | ori r10, r10, _PAGE_DIRTY|_PAGE_HWWRITE | ||
531 | /* do not set the _PAGE_ACCESSED bit of a non-present page */ | ||
532 | andi. r11, r10, _PAGE_PRESENT | ||
533 | beq 4f | ||
534 | ori r10, r10, _PAGE_ACCESSED | ||
535 | 4: | ||
536 | #else | ||
510 | ori r10, r10, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE | 537 | ori r10, r10, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE |
538 | #endif | ||
511 | mfspr r11, SPRN_MD_TWC /* Get pte address again */ | 539 | mfspr r11, SPRN_MD_TWC /* Get pte address again */ |
512 | stw r10, 0(r11) /* and update pte in table */ | 540 | stw r10, 0(r11) /* and update pte in table */ |
513 | 541 | ||