linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [Patch ] Kexec Kdump support for POWER6
@ 2007-05-30  5:20 Sachin P. Sant
  2007-05-30 11:43 ` Benjamin Herrenschmidt
  2007-05-30 14:33 ` Olof Johansson
  0 siblings, 2 replies; 3+ messages in thread
From: Sachin P. Sant @ 2007-05-30  5:20 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 103 bytes --]

Paul, here is the final version of the patch with all review
comments incorporated. 

Thanks
-Sachin



[-- Attachment #2: kexec-kdump-support-on-POWER6 --]
[-- Type: text/plain, Size: 3011 bytes --]

* On Power machines supporting VRMA, Kexec/Kdump does not work.
* Hypervisor stores VRMA mapping used by the OS, in the hpte hash tables.
* Make sure these hpte entries are left untouched.
*
* This patch also adds plpar_pte_read_raw() on the lines of
* plpar_pte_remove_raw().

Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
Signed-off-by : Mohan Kumar M <mohan@in.ibm.com>
---

diff -Naurp a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
--- a/arch/powerpc/platforms/pseries/lpar.c	2007-05-19 09:36:17.000000000 +0530
+++ b/arch/powerpc/platforms/pseries/lpar.c	2007-05-29 10:45:34.000000000 +0530
@@ -373,12 +373,23 @@ static void pSeries_lpar_hptab_clear(voi
 {
 	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 -Naurp a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h	2007-05-19 09:36:17.000000000 +0530
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h	2007-05-25 12:20:38.000000000 +0530
@@ -108,6 +108,21 @@ static inline long plpar_pte_read(unsign
 	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 -Naurp a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
--- a/include/asm-powerpc/mmu-hash64.h	2007-05-19 09:36:17.000000000 +0530
+++ b/include/asm-powerpc/mmu-hash64.h	2007-05-29 10:46:22.000000000 +0530
@@ -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 */

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

* Re: [Patch ] Kexec Kdump support for POWER6
  2007-05-30  5:20 [Patch ] Kexec Kdump support for POWER6 Sachin P. Sant
@ 2007-05-30 11:43 ` Benjamin Herrenschmidt
  2007-05-30 14:33 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2007-05-30 11:43 UTC (permalink / raw)
  To: sachinp; +Cc: linuxppc-dev, Paul Mackerras

On Wed, 2007-05-30 at 10:50 +0530, Sachin P. Sant wrote:
> Paul, here is the final version of the patch with all review
> comments incorporated. 
> 
> Thanks
> -Sachin
> 
> 
> plain text document attachment (kexec-kdump-support-on-POWER6)
> * On Power machines supporting VRMA, Kexec/Kdump does not work.
> * Hypervisor stores VRMA mapping used by the OS, in the hpte hash tables.
> * Make sure these hpte entries are left untouched.
> *
> * This patch also adds plpar_pte_read_raw() on the lines of
> * plpar_pte_remove_raw().
> 
> Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
> Signed-off-by : Mohan Kumar M <mohan@in.ibm.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---

> diff -Naurp a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> --- a/arch/powerpc/platforms/pseries/lpar.c	2007-05-19 09:36:17.000000000 +0530
> +++ b/arch/powerpc/platforms/pseries/lpar.c	2007-05-29 10:45:34.000000000 +0530
> @@ -373,12 +373,23 @@ static void pSeries_lpar_hptab_clear(voi
>  {
>  	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 -Naurp a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
> --- a/arch/powerpc/platforms/pseries/plpar_wrappers.h	2007-05-19 09:36:17.000000000 +0530
> +++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h	2007-05-25 12:20:38.000000000 +0530
> @@ -108,6 +108,21 @@ static inline long plpar_pte_read(unsign
>  	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 -Naurp a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
> --- a/include/asm-powerpc/mmu-hash64.h	2007-05-19 09:36:17.000000000 +0530
> +++ b/include/asm-powerpc/mmu-hash64.h	2007-05-29 10:46:22.000000000 +0530
> @@ -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 */
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

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

* Re: [Patch ] Kexec Kdump support for POWER6
  2007-05-30  5:20 [Patch ] Kexec Kdump support for POWER6 Sachin P. Sant
  2007-05-30 11:43 ` Benjamin Herrenschmidt
@ 2007-05-30 14:33 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2007-05-30 14:33 UTC (permalink / raw)
  To: Sachin P. Sant; +Cc: linuxppc-dev, Paul Mackerras

On Wed, May 30, 2007 at 10:50:27AM +0530, Sachin P. Sant wrote:
> Paul, here is the final version of the patch with all review
> comments incorporated. 
> 
> Thanks
> -Sachin
> 
> 

> * On Power machines supporting VRMA, Kexec/Kdump does not work.
> * Hypervisor stores VRMA mapping used by the OS, in the hpte hash tables.
> * Make sure these hpte entries are left untouched.
> *
> * This patch also adds plpar_pte_read_raw() on the lines of
> * plpar_pte_remove_raw().
> 
> Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
> Signed-off-by : Mohan Kumar M <mohan@in.ibm.com>

Acked-by: Olof Johansson <olof@lixom.net>


-Olof

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

end of thread, other threads:[~2007-05-30 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-30  5:20 [Patch ] Kexec Kdump support for POWER6 Sachin P. Sant
2007-05-30 11:43 ` Benjamin Herrenschmidt
2007-05-30 14:33 ` Olof Johansson

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