powerpc/pseries: Add extended_cede_processor() helper function.
authorGautham R Shenoy <ego@in.ibm.com>
Thu, 29 Oct 2009 19:22:48 +0000 (19:22 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 24 Nov 2009 03:33:03 +0000 (14:33 +1100)
This patch provides an extended_cede_processor() helper function
which takes the cede latency hint as an argument. This hint is to be passed
on to the hypervisor to cede to the corresponding state on platforms
which support it.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/lppaca.h
arch/powerpc/platforms/pseries/plpar_wrappers.h
arch/powerpc/xmon/xmon.c

index f78f65c38f054d8d7f56fafee268c33d793a62c4..14b592dfb4e824f691a71c248e2f60c6827dcf0e 100644 (file)
@@ -100,7 +100,14 @@ struct lppaca {
        // Used to pass parms from the OS to PLIC for SetAsrAndRfid
        u64     saved_gpr3;             // Saved GPR3                   x20-x27
        u64     saved_gpr4;             // Saved GPR4                   x28-x2F
-       u64     saved_gpr5;             // Saved GPR5                   x30-x37
+       union {
+               u64     saved_gpr5;     /* Saved GPR5               x30-x37 */
+               struct {
+                       u8      cede_latency_hint;  /*                  x30 */
+                       u8      reserved[7];        /*              x31-x36 */
+               } fields;
+       } gpr5_dword;
+
 
        u8      dtl_enable_mask;        // Dispatch Trace Log mask      x38-x38
        u8      donate_dedicated_cpu;   // Donate dedicated CPU cycles  x39-x39
index a24a6b2333b2388521989ac5ac2b38365a61e6ab..0603c91538ae1aeed09d42c4902625199ed98e7a 100644 (file)
@@ -9,11 +9,33 @@ static inline long poll_pending(void)
        return plpar_hcall_norets(H_POLL_PENDING);
 }
 
+static inline u8 get_cede_latency_hint(void)
+{
+       return get_lppaca()->gpr5_dword.fields.cede_latency_hint;
+}
+
+static inline void set_cede_latency_hint(u8 latency_hint)
+{
+       get_lppaca()->gpr5_dword.fields.cede_latency_hint = latency_hint;
+}
+
 static inline long cede_processor(void)
 {
        return plpar_hcall_norets(H_CEDE);
 }
 
+static inline long extended_cede_processor(unsigned long latency_hint)
+{
+       long rc;
+       u8 old_latency_hint = get_cede_latency_hint();
+
+       set_cede_latency_hint(latency_hint);
+       rc = cede_processor();
+       set_cede_latency_hint(old_latency_hint);
+
+       return rc;
+}
+
 static inline long vpa_call(unsigned long flags, unsigned long cpu,
                unsigned long vpa)
 {
index bdbe96c8a7e4574c7304e12688e3c3e68ad71a9c..4e6152c13764e173aa7811c249c8a359b5a60a5c 100644 (file)
@@ -1641,7 +1641,8 @@ static void super_regs(void)
                               ptrLpPaca->saved_srr0, ptrLpPaca->saved_srr1);
                        printf("    Saved Gpr3=%.16lx  Saved Gpr4=%.16lx \n",
                               ptrLpPaca->saved_gpr3, ptrLpPaca->saved_gpr4);
-                       printf("    Saved Gpr5=%.16lx \n", ptrLpPaca->saved_gpr5);
+                       printf("    Saved Gpr5=%.16lx \n",
+                               ptrLpPaca->gpr5_dword.saved_gpr5);
                }
 #endif