Message ID | 1464955880-10176-4-git-send-email-clg@kaod.org |
---|---|
State | New |
Headers | show |
On 03.06.2016 14:11, Cédric Le Goater wrote: > commit 74693da98894 ('ppc: tlbie, tlbia and tlbisync are HV only') > introduced some extra checks on the instruction privilege. slbia was > changed wrongly and hrfid, tlbia were forgotten. > > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > target-ppc/translate.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index ad262523abca..776343170a53 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -4108,7 +4108,7 @@ static void gen_hrfid(DisasContext *ctx) > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > #else > /* Restore CPU state */ > - if (unlikely(!ctx->hv)) { > + if (unlikely(ctx->pr || !ctx->hv)) { > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > return; > } > @@ -4845,7 +4845,7 @@ static void gen_tlbia(DisasContext *ctx) > #if defined(CONFIG_USER_ONLY) > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > #else > - if (unlikely(ctx->pr)) { > + if (unlikely(ctx->pr || !ctx->hv)) { > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > return; > } > @@ -4913,7 +4913,7 @@ static void gen_slbia(DisasContext *ctx) > #if defined(CONFIG_USER_ONLY) > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > #else > - if (unlikely(ctx->pr || !ctx->hv)) { > + if (unlikely(ctx->pr)) { > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > return; > } I just double-checked the PowerISA 2.07, and you're right, hrfid and tlbia are hypervisor-privileged, slbia is only "normal" privileged. Reviewed-by: Thomas Huth <thuth@redhat.com>
On Sat, Jun 04, 2016 at 10:24:28AM +0200, Thomas Huth wrote: > On 03.06.2016 14:11, Cédric Le Goater wrote: > > commit 74693da98894 ('ppc: tlbie, tlbia and tlbisync are HV only') > > introduced some extra checks on the instruction privilege. slbia was > > changed wrongly and hrfid, tlbia were forgotten. > > > > Signed-off-by: Cédric Le Goater <clg@kaod.org> > > --- > > target-ppc/translate.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > > index ad262523abca..776343170a53 100644 > > --- a/target-ppc/translate.c > > +++ b/target-ppc/translate.c > > @@ -4108,7 +4108,7 @@ static void gen_hrfid(DisasContext *ctx) > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > #else > > /* Restore CPU state */ > > - if (unlikely(!ctx->hv)) { > > + if (unlikely(ctx->pr || !ctx->hv)) { > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > return; > > } > > @@ -4845,7 +4845,7 @@ static void gen_tlbia(DisasContext *ctx) > > #if defined(CONFIG_USER_ONLY) > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > #else > > - if (unlikely(ctx->pr)) { > > + if (unlikely(ctx->pr || !ctx->hv)) { > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > return; > > } > > @@ -4913,7 +4913,7 @@ static void gen_slbia(DisasContext *ctx) > > #if defined(CONFIG_USER_ONLY) > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > #else > > - if (unlikely(ctx->pr || !ctx->hv)) { > > + if (unlikely(ctx->pr)) { > > gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); > > return; > > } > > I just double-checked the PowerISA 2.07, and you're right, hrfid and > tlbia are hypervisor-privileged, slbia is only "normal" privileged. > > Reviewed-by: Thomas Huth <thuth@redhat.com> Yes, the SLB is owned by the guest - otherwise it would need hypercalls on every context switch. Should have caught this the first time around, sorry.
diff --git a/target-ppc/translate.c b/target-ppc/translate.c index ad262523abca..776343170a53 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -4108,7 +4108,7 @@ static void gen_hrfid(DisasContext *ctx) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else /* Restore CPU state */ - if (unlikely(!ctx->hv)) { + if (unlikely(ctx->pr || !ctx->hv)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } @@ -4845,7 +4845,7 @@ static void gen_tlbia(DisasContext *ctx) #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else - if (unlikely(ctx->pr)) { + if (unlikely(ctx->pr || !ctx->hv)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } @@ -4913,7 +4913,7 @@ static void gen_slbia(DisasContext *ctx) #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else - if (unlikely(ctx->pr || !ctx->hv)) { + if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; }
commit 74693da98894 ('ppc: tlbie, tlbia and tlbisync are HV only') introduced some extra checks on the instruction privilege. slbia was changed wrongly and hrfid, tlbia were forgotten. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- target-ppc/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)