diff mbox

[v3,04/10] ppc: Create cpu_ppc_set_papr() helper

Message ID 1458564760-31993-5-git-send-email-clg@fr.ibm.com
State New
Headers show

Commit Message

Cédric Le Goater March 21, 2016, 12:52 p.m. UTC
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

And move the code adjusting the MSR mask and calling kvmppc_set_papr()
to it. This allows us to add a few more things such as disabling setting
of MSR:HV and appropriate LPCR bits which will be used when fixing
the exception model.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[clg: removed LPCR setting ]
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---

 Changes since v2:

 - removed LPCR setting

 hw/ppc/spapr.c              |   11 ++---------
 target-ppc/cpu.h            |    1 +
 target-ppc/translate_init.c |   23 ++++++++++++++++++++++-
 3 files changed, 25 insertions(+), 10 deletions(-)

Comments

David Gibson March 21, 2016, 11:15 p.m. UTC | #1
On Mon, Mar 21, 2016 at 01:52:34PM +0100, Cédric Le Goater wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> And move the code adjusting the MSR mask and calling kvmppc_set_papr()
> to it. This allows us to add a few more things such as disabling setting
> of MSR:HV and appropriate LPCR bits which will be used when fixing
> the exception model.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> [clg: removed LPCR setting ]
> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>

Nothing wrong with the patch, but your mailer seems to have done
something really weird with the headers:

> Content-Type: text/plain; charset=a

Oddly enough, git am had some trouble with charset "a".
Cédric Le Goater March 22, 2016, 7:05 a.m. UTC | #2
On 03/22/2016 12:15 AM, David Gibson wrote:
> On Mon, Mar 21, 2016 at 01:52:34PM +0100, Cédric Le Goater wrote:
>> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>
>> And move the code adjusting the MSR mask and calling kvmppc_set_papr()
>> to it. This allows us to add a few more things such as disabling setting
>> of MSR:HV and appropriate LPCR bits which will be used when fixing
>> the exception model.
>>
>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
>> [clg: removed LPCR setting ]
>> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
> 
> Nothing wrong with the patch, but your mailer seems to have done
> something really weird with the headers:
> 
>> Content-Type: text/plain; charset=a
> 
> Oddly enough, git am had some trouble with charset "a".
> 

Ah. Interesting. 

When the patch was sent, git send-email requested a change on the 
Content-type (a switch to UTF8). Most probably because of the accent 
on my first name. It seems something went wrong. I will look into it.

Thanks,

C.
David Gibson March 22, 2016, 11:09 p.m. UTC | #3
On Tue, Mar 22, 2016 at 08:05:08AM +0100, Cédric Le Goater wrote:
> On 03/22/2016 12:15 AM, David Gibson wrote:
> > On Mon, Mar 21, 2016 at 01:52:34PM +0100, Cédric Le Goater wrote:
> >> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >>
> >> And move the code adjusting the MSR mask and calling kvmppc_set_papr()
> >> to it. This allows us to add a few more things such as disabling setting
> >> of MSR:HV and appropriate LPCR bits which will be used when fixing
> >> the exception model.
> >>
> >> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> >> [clg: removed LPCR setting ]
> >> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
> > 
> > Nothing wrong with the patch, but your mailer seems to have done
> > something really weird with the headers:
> > 
> >> Content-Type: text/plain; charset=a
> > 
> > Oddly enough, git am had some trouble with charset "a".
> > 
> 
> Ah. Interesting. 
> 
> When the patch was sent, git send-email requested a change on the 
> Content-type (a switch to UTF8). Most probably because of the accent 
> on my first name. It seems something went wrong. I will look into it.

Right, as far as I can tell the content was valid UTF-8, including the
accent, just the header was wrong - I was able to apply by hand
editing the mbox to say UTF-8 instead.

For some reason it only happened to this one mail.  The other ones in
the series showed up as UTF-8, although at least some had the same accent.
diff mbox

Patch

Index: qemu-dgibson-for-2.6.git/hw/ppc/spapr.c
===================================================================
--- qemu-dgibson-for-2.6.git.orig/hw/ppc/spapr.c
+++ qemu-dgibson-for-2.6.git/hw/ppc/spapr.c
@@ -1612,15 +1612,8 @@  static void spapr_cpu_init(sPAPRMachineS
     /* Set time-base frequency to 512 MHz */
     cpu_ppc_tb_init(env, TIMEBASE_FREQ);
 
-    /* PAPR always has exception vectors in RAM not ROM. To ensure this,
-     * MSR[IP] should never be set.
-     */
-    env->msr_mask &= ~(1 << 6);
-
-    /* Tell KVM that we're in PAPR mode */
-    if (kvm_enabled()) {
-        kvmppc_set_papr(cpu);
-    }
+    /* Enable PAPR mode in TCG or KVM */
+    cpu_ppc_set_papr(cpu);
 
     if (cpu->max_compat) {
         Error *local_err = NULL;
Index: qemu-dgibson-for-2.6.git/target-ppc/cpu.h
===================================================================
--- qemu-dgibson-for-2.6.git.orig/target-ppc/cpu.h
+++ qemu-dgibson-for-2.6.git/target-ppc/cpu.h
@@ -1268,6 +1268,7 @@  void store_booke_tcr (CPUPPCState *env,
 void store_booke_tsr (CPUPPCState *env, target_ulong val);
 void ppc_tlb_invalidate_all (CPUPPCState *env);
 void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr);
+void cpu_ppc_set_papr(PowerPCCPU *cpu);
 #endif
 #endif
 
Index: qemu-dgibson-for-2.6.git/target-ppc/translate_init.c
===================================================================
--- qemu-dgibson-for-2.6.git.orig/target-ppc/translate_init.c
+++ qemu-dgibson-for-2.6.git/target-ppc/translate_init.c
@@ -8380,8 +8380,29 @@  POWERPC_FAMILY(POWER8)(ObjectClass *oc,
     pcc->l1_icache_size = 0x8000;
     pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
 }
-#endif /* defined (TARGET_PPC64) */
 
+#if !defined(CONFIG_USER_ONLY)
+
+void cpu_ppc_set_papr(PowerPCCPU *cpu)
+{
+    CPUPPCState *env = &cpu->env;
+
+    /* PAPR always has exception vectors in RAM not ROM. To ensure this,
+     * MSR[IP] should never be set.
+     *
+     * We also disallow setting of MSR_HV
+     */
+    env->msr_mask &= ~((1ull << MSR_EP) | MSR_HVB);
+
+    /* Tell KVM that we're in PAPR mode */
+    if (kvm_enabled()) {
+        kvmppc_set_papr(cpu);
+    }
+}
+
+#endif /* !defined(CONFIG_USER_ONLY) */
+
+#endif /* defined (TARGET_PPC64) */
 
 /*****************************************************************************/
 /* Generic CPU instantiation routine                                         */