[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-ppc] [PATCH 10/77] ppc: Fix hreg_store_msr() so t
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [Qemu-ppc] [PATCH 10/77] ppc: Fix hreg_store_msr() so that non-HV mode cannot alter MSR:HV |
Date: |
Thu, 19 Nov 2015 17:20:27 +1100 |
User-agent: |
Mutt/1.5.23 (2015-06-09) |
On Wed, Nov 11, 2015 at 11:27:23AM +1100, Benjamin Herrenschmidt wrote:
> This helper is only used by the various instructions that can alter
> MSR and not interrupts. Add a comment to that effect to the interrupt
> code as well in case somebody wants to change this
>
> Signed-off-by: Benjamin Herrenschmidt <address@hidden>
Reviewed-by: David Gibson <address@hidden>
> ---
> target-ppc/excp_helper.c | 8 ++++++--
> target-ppc/helper_regs.h | 4 ++--
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
> index 00fae60..83e6c07 100644
> --- a/target-ppc/excp_helper.c
> +++ b/target-ppc/excp_helper.c
> @@ -662,8 +662,12 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int
> excp_model, int excp)
> }
> }
> #endif
> - /* XXX: we don't use hreg_store_msr here as already have treated
> - * any special case that could occur. Just store MSR and update
> hflags
> + /* We don't use hreg_store_msr here as already have treated
> + * any special case that could occur. Just store MSR and update hflags
> + *
> + * Note: We *MUST* not use hreg_store_msr() as-is anyway because it
> + * will prevent setting of the HV bit which some exceptions might need
> + * to do.
> */
> env->msr = new_msr & env->msr_mask;
> hreg_compute_hflags(env);
> diff --git a/target-ppc/helper_regs.h b/target-ppc/helper_regs.h
> index 57da931..12af61c 100644
> --- a/target-ppc/helper_regs.h
> +++ b/target-ppc/helper_regs.h
> @@ -114,8 +114,8 @@ static inline int hreg_store_msr(CPUPPCState *env,
> target_ulong value,
> excp = 0;
> value &= env->msr_mask;
> #if !defined(CONFIG_USER_ONLY)
> - if (!alter_hv) {
> - /* mtmsr cannot alter the hypervisor state */
> + /* Neither mtmsr nor guest state can alter HV */
> + if (!alter_hv || !(env->msr & MSR_HVB)) {
> value &= ~MSR_HVB;
> value |= env->msr & MSR_HVB;
> }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platform, (continued)
Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platform, Stewart Smith, 2015/11/10
[Qemu-devel] [PATCH 24/77] ppc: Move exception generation code out of line, Benjamin Herrenschmidt, 2015/11/10
[Qemu-devel] [PATCH 37/77] ppc/xics: Split ICS into base class and "simple" implementation, Benjamin Herrenschmidt, 2015/11/10
[Qemu-devel] [PATCH 10/77] ppc: Fix hreg_store_msr() so that non-HV mode cannot alter MSR:HV, Benjamin Herrenschmidt, 2015/11/10
- Re: [Qemu-devel] [Qemu-ppc] [PATCH 10/77] ppc: Fix hreg_store_msr() so that non-HV mode cannot alter MSR:HV,
David Gibson <=
[Qemu-devel] [PATCH 22/77] ppc: Add real mode CI load/store instructions for P7 and P8, Benjamin Herrenschmidt, 2015/11/10
[Qemu-devel] [PATCH 15/77] ppc: Fix sign extension issue in mtmsr(d) emulation, Benjamin Herrenschmidt, 2015/11/10
[Qemu-devel] [PATCH 16/77] ppc: Get out of emulation on SMT "OR" ops, Benjamin Herrenschmidt, 2015/11/10
[Qemu-devel] [PATCH 48/77] ppc/pnv: Add model for Power8 PHB3 PCIe Host bridge, Benjamin Herrenschmidt, 2015/11/10