diff mbox

[2/4] powerpc/32: Make clear_fixmap actually work

Message ID 20081229164035.GB8215@oksana.dev.rtsoft.ru (mailing list archive)
State Accepted, archived
Commit 7021d86afa6f3a8bf76218ac97f5847a6d985730
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Anton Vorontsov Dec. 29, 2008, 4:40 p.m. UTC
The clear_fixmap() routine issues map_page() with flags set to 0.
Currently this causes a BUG_ON() inside the map_page(), as it assumes
that a PTE should be clear before mapping.

This patch makes the map_page() to trigger the BUG_ON() only if the
flags were set.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 arch/powerpc/mm/pgtable_32.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Kumar Gala Jan. 7, 2009, 5:25 a.m. UTC | #1
On Dec 29, 2008, at 10:40 AM, Anton Vorontsov wrote:

> The clear_fixmap() routine issues map_page() with flags set to 0.
> Currently this causes a BUG_ON() inside the map_page(), as it assumes
> that a PTE should be clear before mapping.
>
> This patch makes the map_page() to trigger the BUG_ON() only if the
> flags were set.
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> arch/powerpc/mm/pgtable_32.c |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/ 
> pgtable_32.c
> index 3414724..23553a7 100644
> --- a/arch/powerpc/mm/pgtable_32.c
> +++ b/arch/powerpc/mm/pgtable_32.c
> @@ -259,7 +259,8 @@ int map_page(unsigned long va, phys_addr_t pa,  
> int flags)
> 		/* The PTE should never be already set nor present in the
> 		 * hash table
> 		 */
> -		BUG_ON(pte_val(*pg) & (_PAGE_PRESENT | _PAGE_HASHPTE));
> +		BUG_ON((pte_val(*pg) & (_PAGE_PRESENT | _PAGE_HASHPTE)) &&
> +		       flags);
> 		set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,
> 						     __pgprot(flags)));
> 	}

Acked-by: Kumar Gala <galak@kernel.crashing.org>

- k
diff mbox

Patch

diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 3414724..23553a7 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -259,7 +259,8 @@  int map_page(unsigned long va, phys_addr_t pa, int flags)
 		/* The PTE should never be already set nor present in the
 		 * hash table
 		 */
-		BUG_ON(pte_val(*pg) & (_PAGE_PRESENT | _PAGE_HASHPTE));
+		BUG_ON((pte_val(*pg) & (_PAGE_PRESENT | _PAGE_HASHPTE)) &&
+		       flags);
 		set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,
 						     __pgprot(flags)));
 	}