lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20110307115046.GF8194@linux.vnet.ibm.com>
Date:	Mon, 7 Mar 2011 17:20:46 +0530
From:	Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>
To:	stable@...nel.org
Cc:	linux-kernel@...r.kernel.org, greg@...ah.com, anton@...ba.org,
	benh@...nel.crashing.org
Subject: [PATCH 4/7] powerpc/pseries: Add hcall to read 4 ptes at a time in
	real mode

    powerpc/pseries: Add hcall to read 4 ptes at a time in real mode

    Commit: f90ece28c1f5b3ec13fe481406857fe92f4bc7d1 upstream

    This adds plpar_pte_read_4_raw() which can be used read 4 PTEs from
    PHYP at a time, while in real mode.

    It also creates a new hcall9 which can be used in real mode.  It's the
    same as plpar_hcall9 but minus the tracing hcall statistics which may
    require variables outside the RMO.

    Signed-off-by: Michael Neuling <mikey@...ling.org>
    Signed-off-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>
    Signed-off-by: Kamalesh babulal <kamalesh@...ux.vnet.ibm.com>
    cc: Anton Blanchard <anton@...ba.org>
---
 arch/powerpc/include/asm/hvcall.h               |    1
 arch/powerpc/platforms/pseries/hvCall.S         |   38 ++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/plpar_wrappers.h |   18 +++++++++++
 3 files changed, 57 insertions(+)

Index: b/arch/powerpc/include/asm/hvcall.h
===================================================================
--- a/arch/powerpc/include/asm/hvcall.h	2011-03-07 00:39:02.479557984 -0800
+++ b/arch/powerpc/include/asm/hvcall.h	2011-03-07 00:39:54.627591230 -0800
@@ -268,6 +268,7 @@
  */
 #define PLPAR_HCALL9_BUFSIZE 9
 long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
+long plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...);

 /* For hcall instrumentation.  One structure per-hcall, per-CPU */
 struct hcall_stats {
Index: b/arch/powerpc/platforms/pseries/hvCall.S
===================================================================
--- a/arch/powerpc/platforms/pseries/hvCall.S	2011-03-07 00:39:57.707593225 -0800
+++ b/arch/powerpc/platforms/pseries/hvCall.S	2011-03-07 00:45:13.523789676 -0800
@@ -202,3 +202,41 @@
	mtcrf	0xff,r0

	blr				/* return r3 = status */
+
+/* See plpar_hcall_raw to see why this is needed */
+_GLOBAL(plpar_hcall9_raw)
+        HMT_MEDIUM
+
+        mfcr    r0
+        stw     r0,8(r1)
+
+        std     r4,STK_PARM(r4)(r1)     /* Save ret buffer */
+
+        mr      r4,r5
+        mr      r5,r6
+        mr      r6,r7
+        mr      r7,r8
+        mr      r8,r9
+        mr      r9,r10
+        ld      r10,STK_PARM(r11)(r1)    /* put arg7 in R10 */
+        ld      r11,STK_PARM(r12)(r1)    /* put arg8 in R11 */
+        ld      r12,STK_PARM(r13)(r1)    /* put arg9 in R12 */
+
+        HVSC                            /* invoke the hypervisor */
+
+        mr      r0,r12
+        ld      r12,STK_PARM(r4)(r1)
+        std     r4,  0(r12)
+        std     r5,  8(r12)
+        std     r6, 16(r12)
+        std     r7, 24(r12)
+        std     r8, 32(r12)
+        std     r9, 40(r12)
+        std     r10,48(r12)
+        std     r11,56(r12)
+        std     r0, 64(r12)
+
+        lwz     r0,8(r1)
+        mtcrf   0xff,r0
+
+	blr                             /* return r3 = status */
Index: b/arch/powerpc/platforms/pseries/plpar_wrappers.h
===================================================================
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h	2011-03-07 00:45:28.363798700 -0800
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h	2011-03-07 02:10:59.321850879 -0800
@@ -169,6 +169,24 @@
	return rc;
 }

+/*
+ * plpar_pte_read_4_raw can be called in real mode.
+ * ptes must be 8*sizeof(unsigned long)
+ */
+static inline long plpar_pte_read_4_raw(unsigned long flags, unsigned long ptex,
+					unsigned long *ptes)
+
+{
+       long rc;
+       unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
+
+       rc = plpar_hcall9_raw(H_READ, retbuf, flags | H_READ_4, ptex);
+
+       memcpy(ptes, retbuf, 8*sizeof(unsigned long));
+
+       return rc;
+}
+
 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
		unsigned long avpn)
 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ