Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b7abc5c53e3c65b8e931bd96db2d08ba670e111a
Commit:     b7abc5c53e3c65b8e931bd96db2d08ba670e111a
Parent:     7ccb4a662462616f6be5053e26b79580e02f1529
Author:     Sachin P. Sant <[EMAIL PROTECTED]>
AuthorDate: Thu Jun 14 15:31:34 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Mon Jun 25 17:03:33 2007 +1000

    [POWERPC] Fix Kexec/Kdump for power6
    
    On Power machines supporting VRMA, Kexec/Kdump does not work.
    VRMA (virtual real-mode area) means that accesses with IR/DR = 0
    (i.e. the MMU "off") actually still go through the hash table,
    using entries put there by the hypervisor.
    
    This means that when we clear out the hash table on kexec, we need to
    make sure these entries are left untouched.
    
    This also adds plpar_pte_read_raw() on the lines of
    plpar_pte_remove_raw().
    
    Signed-off-by : Sachin Sant <[EMAIL PROTECTED]>
    Signed-off-by : Mohan Kumar M <[EMAIL PROTECTED]>
    Acked-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
    Acked-by: Olof Johansson <[EMAIL PROTECTED]>
    
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/lpar.c           |   17 ++++++++++++++---
 arch/powerpc/platforms/pseries/plpar_wrappers.h |   15 +++++++++++++++
 include/asm-powerpc/mmu-hash64.h                |    3 +++
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c 
b/arch/powerpc/platforms/pseries/lpar.c
index 362dfbc..8cc6eee 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -373,12 +373,23 @@ static void pSeries_lpar_hptab_clear(void)
 {
        unsigned long size_bytes = 1UL << ppc64_pft_size;
        unsigned long hpte_count = size_bytes >> 4;
-       unsigned long dummy1, dummy2;
+       unsigned long dummy1, dummy2, dword0;
+       long lpar_rc;
        int i;
 
        /* TODO: Use bulk call */
-       for (i = 0; i < hpte_count; i++)
-               plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2);
+       for (i = 0; i < hpte_count; i++) {
+               /* dont remove HPTEs with VRMA mappings */
+               lpar_rc = plpar_pte_remove_raw(H_ANDCOND, i, HPTE_V_1TB_SEG,
+                                               &dummy1, &dummy2);
+               if (lpar_rc == H_NOT_FOUND) {
+                       lpar_rc = plpar_pte_read_raw(0, i, &dword0, &dummy1);
+                       if (!lpar_rc && ((dword0 & HPTE_V_VRMA_MASK)
+                               != HPTE_V_VRMA_MASK))
+                               /* Can be hpte for 1TB Seg. So remove it */
+                               plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2);
+               }
+       }
 }
 
 /*
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h 
b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 2e4d10c..d003c80 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -108,6 +108,21 @@ static inline long plpar_pte_read(unsigned long flags, 
unsigned long ptex,
        return rc;
 }
 
+/* plpar_pte_read_raw can be called in real mode. It calls plpar_hcall_raw */
+static inline long plpar_pte_read_raw(unsigned long flags, unsigned long ptex,
+               unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
+{
+       long rc;
+       unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
+
+       rc = plpar_hcall_raw(H_READ, retbuf, flags, ptex);
+
+       *old_pteh_ret = retbuf[0];
+       *old_ptel_ret = retbuf[1];
+
+       return rc;
+}
+
 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
                unsigned long avpn)
 {
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index ba32019..695962f 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -94,6 +94,9 @@ extern char initial_stab[];
 #define HPTE_R_C               ASM_CONST(0x0000000000000080)
 #define HPTE_R_R               ASM_CONST(0x0000000000000100)
 
+#define HPTE_V_1TB_SEG         ASM_CONST(0x4000000000000000)
+#define HPTE_V_VRMA_MASK       ASM_CONST(0x4001ffffff000000)
+
 /* Values for PP (assumes Ks=0, Kp=1) */
 /* pp0 will always be 0 for linux     */
 #define PP_RWXX        0       /* Supervisor read/write, User none */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to