1. 20 Apr, 2023 19 commits
  2. 12 Apr, 2023 1 commit
  3. 11 Apr, 2023 10 commits
  4. 04 Apr, 2023 8 commits
  5. 03 Apr, 2023 2 commits
    • Paul Mackerras's avatar
      KVM: PPC: Enable prefixed instructions for HV KVM and disable for PR KVM · a3800ef9
      Paul Mackerras authored
      Now that we can read prefixed instructions from a HV KVM guest and
      emulate prefixed load/store instructions to emulated MMIO locations,
      we can add HFSCR_PREFIXED into the set of bits that are set in the
      HFSCR for a HV KVM guest on POWER10, allowing the guest to use
      prefixed instructions.
      
      PR KVM has not yet been extended to handle prefixed instructions in
      all situations where we might need to emulate them, so prevent the
      guest from enabling prefixed instructions in the FSCR for now.
      Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Tested-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      Tested-by: default avatarSachin Sant <sachinp@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/ZAgs25dCmLrVkBdU@cleo
      a3800ef9
    • Paul Mackerras's avatar
      KVM: PPC: Fetch prefixed instructions from the guest · 953e3739
      Paul Mackerras authored
      In order to handle emulation of prefixed instructions in the guest,
      this first makes vcpu->arch.last_inst be an unsigned long, i.e. 64
      bits on 64-bit platforms.  For prefixed instructions, the upper 32
      bits are used for the prefix and the lower 32 bits for the suffix, and
      both halves are byte-swapped if the guest endianness differs from the
      host.
      
      Next, vcpu->arch.emul_inst is now 64 bits wide, to match the HEIR
      register on POWER10.  Like HEIR, for a prefixed instruction it is
      defined to have the prefix is in the top 32 bits and the suffix in the
      bottom 32 bits, with both halves in the correct byte order.
      
      kvmppc_get_last_inst is extended on 64-bit machines to put the prefix
      and suffix in the right places in the ppc_inst_t being returned.
      
      kvmppc_load_last_inst now returns the instruction in an unsigned long
      in the same format as vcpu->arch.last_inst.  It makes the decision
      about whether to fetch a suffix based on the SRR1_PREFIXED bit in the
      MSR image stored in the vcpu struct, which generally comes from SRR1
      or HSRR1 on an interrupt.  This bit is defined in Power ISA v3.1B to
      be set if the interrupt occurred due to a prefixed instruction and
      cleared otherwise for all interrupts except for instruction storage
      interrupt, which does not come to the hypervisor.  It is set to zero
      for asynchronous interrupts such as external interrupts.  In previous
      ISA versions it was always set to 0 for all interrupts except
      instruction storage interrupt.
      
      The code in book3s_hv_rmhandlers.S that loads the faulting instruction
      on a HDSI is only used on POWER8 and therefore doesn't ever need to
      load a suffix.
      
      [npiggin@gmail.com - check that the is-prefixed bit in SRR1 matches the
      type of instruction that was fetched.]
      Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Tested-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/ZAgsq9h1CCzouQuV@cleo
      953e3739