1. 16 9月, 2019 1 次提交
  2. 18 7月, 2018 1 次提交
    • S
      KVM: PPC: Remove mmio_vsx_tx_sx_enabled in KVM MMIO emulation · 4eeb8556
      Simon Guo 提交于
      Originally PPC KVM MMIO emulation uses only 0~31#(5 bits) for VSR
      reg number, and use mmio_vsx_tx_sx_enabled field together for
      0~63# VSR regs.
      
      Currently PPC KVM MMIO emulation is reimplemented with analyse_instr()
      assistance.  analyse_instr() returns 0~63 for VSR register number, so
      it is not necessary to use additional mmio_vsx_tx_sx_enabled field
      any more.
      
      This patch extends related reg bits (expand io_gpr to u16 from u8
      and use 6 bits for VSR reg#), so that mmio_vsx_tx_sx_enabled can
      be removed.
      Signed-off-by: NSimon Guo <wei.guo.simon@gmail.com>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      4eeb8556
  3. 22 5月, 2018 5 次提交
  4. 18 5月, 2018 1 次提交
    • S
      KVM: PPC: Fix a mmio_host_swabbed uninitialized usage issue · f19d1f36
      Simon Guo 提交于
      When KVM emulates VMX store, it will invoke kvmppc_get_vmx_data() to
      retrieve VMX reg val. kvmppc_get_vmx_data() will check mmio_host_swabbed
      to decide which double word of vr[] to be used. But the
      mmio_host_swabbed can be uninitialized during VMX store procedure:
      
      kvmppc_emulate_loadstore
      	\- kvmppc_handle_store128_by2x64
      		\- kvmppc_get_vmx_data
      
      So vcpu->arch.mmio_host_swabbed is not meant to be used at all for
      emulation of store instructions, and this patch makes that true for
      VMX stores. This patch also initializes mmio_host_swabbed to avoid
      possible future problems.
      Signed-off-by: NSimon Guo <wei.guo.simon@gmail.com>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      f19d1f36
  5. 09 2月, 2018 1 次提交
  6. 20 4月, 2017 4 次提交
    • P
      KVM: PPC: Add MMIO emulation for remaining floating-point instructions · 9b5ab005
      Paul Mackerras 提交于
      For completeness, this adds emulation of the lfiwax and lfiwzx
      instructions.  With this, all floating-point load and store instructions
      as of Power ISA V2.07 are emulated.
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      9b5ab005
    • P
      KVM: PPC: Emulation for more integer loads and stores · ceba57df
      Paul Mackerras 提交于
      This adds emulation for the following integer loads and stores,
      thus enabling them to be used in a guest for accessing emulated
      MMIO locations.
      
      - lhaux
      - lwaux
      - lwzux
      - ldu
      - lwa
      - stdux
      - stwux
      - stdu
      - ldbrx
      - stdbrx
      
      Previously, most of these would cause an emulation failure exit to
      userspace, though ldu and lwa got treated incorrectly as ld, and
      stdu got treated incorrectly as std.
      
      This also tidies up some of the formatting and updates the comment
      listing instructions that still need to be implemented.
      
      With this, all integer loads and stores that are defined in the Power
      ISA v2.07 are emulated, except for those that are permitted to trap
      when used on cache-inhibited or write-through mappings (and which do
      in fact trap on POWER8), that is, lmw/stmw, lswi/stswi, lswx/stswx,
      lq/stq, and l[bhwdq]arx/st[bhwdq]cx.
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      ceba57df
    • A
      KVM: PPC: Add MMIO emulation for stdx (store doubleword indexed) · 91242fd1
      Alexey Kardashevskiy 提交于
      This adds missing stdx emulation for emulated MMIO accesses by KVM
      guests.  This allows the Mellanox mlx5_core driver from recent kernels
      to work when MMIO emulation is enforced by userspace.
      Signed-off-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      91242fd1
    • B
      KVM: PPC: Book3S: Add MMIO emulation for FP and VSX instructions · 6f63e81b
      Bin Lu 提交于
      This patch provides the MMIO load/store emulation for instructions
      of 'double & vector unsigned char & vector signed char & vector
      unsigned short & vector signed short & vector unsigned int & vector
      signed int & vector double '.
      
      The instructions that this adds emulation for are:
      
      - ldx, ldux, lwax,
      - lfs, lfsx, lfsu, lfsux, lfd, lfdx, lfdu, lfdux,
      - stfs, stfsx, stfsu, stfsux, stfd, stfdx, stfdu, stfdux, stfiwx,
      - lxsdx, lxsspx, lxsiwax, lxsiwzx, lxvd2x, lxvw4x, lxvdsx,
      - stxsdx, stxsspx, stxsiwx, stxvd2x, stxvw4x
      
      [paulus@ozlabs.org - some cleanups, fixes and rework, make it
       compile for Book E, fix build when PR KVM is built in]
      Signed-off-by: NBin Lu <lblulb@linux.vnet.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      6f63e81b
  7. 22 9月, 2014 1 次提交
    • A
      KVM: PPC: Pass enum to kvmppc_get_last_inst · 8d0eff63
      Alexander Graf 提交于
      The kvmppc_get_last_inst function recently received a facelift that allowed
      us to pass an enum of the type of instruction we want to read into it rather
      than an unreadable boolean.
      
      Unfortunately, not all callers ended up passing the enum. This wasn't really
      an issue as "true" and "false" happen to match the two enum values we have,
      but it's still hard to read.
      
      Update all callers of kvmppc_get_last_inst() to follow the new calling
      convention.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      8d0eff63
  8. 29 7月, 2014 1 次提交
    • A
      KVM: PPC: Separate loadstore emulation from priv emulation · d69614a2
      Alexander Graf 提交于
      Today the instruction emulator can get called via 2 separate code paths. It
      can either be called by MMIO emulation detection code or by privileged
      instruction traps.
      
      This is bad, as both code paths prepare the environment differently. For MMIO
      emulation we already know the virtual address we faulted on, so instructions
      there don't have to actually fetch that information.
      
      Split out the two separate use cases into separate files.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      d69614a2
  9. 28 7月, 2014 1 次提交
    • M
      KVM: PPC: Allow kvmppc_get_last_inst() to fail · 51f04726
      Mihai Caraman 提交于
      On book3e, guest last instruction is read on the exit path using load
      external pid (lwepx) dedicated instruction. This load operation may fail
      due to TLB eviction and execute-but-not-read entries.
      
      This patch lay down the path for an alternative solution to read the guest
      last instruction, by allowing kvmppc_get_lat_inst() function to fail.
      Architecture specific implmentations of kvmppc_load_last_inst() may read
      last guest instruction and instruct the emulation layer to re-execute the
      guest in case of failure.
      
      Make kvmppc_get_last_inst() definition common between architectures.
      Signed-off-by: NMihai Caraman <mihai.caraman@freescale.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      51f04726
  10. 30 5月, 2014 1 次提交
    • A
      KVM: PPC: Make shared struct aka magic page guest endian · 5deb8e7a
      Alexander Graf 提交于
      The shared (magic) page is a data structure that contains often used
      supervisor privileged SPRs accessible via memory to the user to reduce
      the number of exits we have to take to read/write them.
      
      When we actually share this structure with the guest we have to maintain
      it in guest endianness, because some of the patch tricks only work with
      native endian load/store operations.
      
      Since we only share the structure with either host or guest in little
      endian on book3s_64 pr mode, we don't have to worry about booke or book3s hv.
      
      For booke, the shared struct stays big endian. For book3s_64 hv we maintain
      the struct in host native endian, since it never gets shared with the guest.
      
      For book3s_64 pr we introduce a variable that tells us which endianness the
      shared struct is in and route every access to it through helper inline
      functions that evaluate this variable.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      5deb8e7a
  11. 27 1月, 2014 1 次提交
    • C
      KVM: PPC: Book3S: MMIO emulation support for little endian guests · 73601775
      Cédric Le Goater 提交于
      MMIO emulation reads the last instruction executed by the guest
      and then emulates. If the guest is running in Little Endian order,
      or more generally in a different endian order of the host, the
      instruction needs to be byte-swapped before being emulated.
      
      This patch adds a helper routine which tests the endian order of
      the host and the guest in order to decide whether a byteswap is
      needed or not. It is then used to byteswap the last instruction
      of the guest in the endian order of the host before MMIO emulation
      is performed.
      
      Finally, kvmppc_handle_load() of kvmppc_handle_store() are modified
      to reverse the endianness of the MMIO if required.
      Signed-off-by: NCédric Le Goater <clg@fr.ibm.com>
      [agraf: add booke handling]
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      73601775
  12. 18 10月, 2013 1 次提交
  13. 17 10月, 2013 2 次提交
  14. 31 7月, 2013 1 次提交
  15. 30 6月, 2013 1 次提交
    • A
      KVM: PPC: Ignore PIR writes · a3ff5fbc
      Alexander Graf 提交于
      While technically it's legal to write to PIR and have the identifier changed,
      we don't implement logic to do so because we simply expose vcpu_id to the guest.
      
      So instead, let's ignore writes to PIR. This ensures that we don't inject faults
      into the guest for something the guest is allowed to do. While at it, we cross
      our fingers hoping that it also doesn't mind that we broke its PIR read values.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a3ff5fbc
  16. 17 4月, 2013 1 次提交
  17. 18 1月, 2013 1 次提交
  18. 10 1月, 2013 1 次提交
  19. 30 10月, 2012 1 次提交
  20. 11 7月, 2012 1 次提交
  21. 06 5月, 2012 4 次提交
    • A
      KVM: PPC: Emulator: clean up SPR reads and writes · 54771e62
      Alexander Graf 提交于
      When reading and writing SPRs, every SPR emulation piece had to read
      or write the respective GPR the value was read from or stored in itself.
      
      This approach is pretty prone to failure. What if we accidentally
      implement mfspr emulation where we just do "break" and nothing else?
      Suddenly we would get a random value in the return register - which is
      always a bad idea.
      
      So let's consolidate the generic code paths and only give the core
      specific SPR handling code readily made variables to read/write from/to.
      
      Functionally, this patch doesn't change anything, but it increases the
      readability of the code and makes is less prone to bugs.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      54771e62
    • A
      KVM: PPC: Emulator: clean up instruction parsing · c46dc9a8
      Alexander Graf 提交于
      Instructions on PPC are pretty similarly encoded. So instead of
      every instruction emulation code decoding the instruction fields
      itself, we can move that code to more generic places and rely on
      the compiler to optimize the unused bits away.
      
      This has 2 advantages. It makes the code smaller and it makes the
      code less error prone, as the instruction fields are always
      available, so accidental misusage is reduced.
      
      Functionally, this patch doesn't change anything.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c46dc9a8
    • A
      KVM: PPC: Fix stbux emulation · 978b4fae
      Alexander Graf 提交于
      Stbux writes the address it's operating on to the register specified in ra,
      not into the data source register.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      978b4fae
    • B
      KVM: PPC: Use clockevent multiplier and shifter for decrementer · 6e35994d
      Bharat Bhushan 提交于
      Time for which the hrtimer is started for decrementer emulation is calculated
      using tb_ticks_per_usec. While hrtimer uses the clockevent for DEC
      reprogramming (if needed) and which calculate timebase ticks using the
      multiplier and shifter mechanism implemented within clockevent layer.
      
      It was observed that this conversion (timebase->time->timebase) are not
      correct because the mechanism are not consistent.
      In our setup it adds 2% jitter.
      
      With this patch clockevent multiplier and shifter mechanism are used when
      starting hrtimer for decrementer emulation. Now the jitter is < 0.5%.
      Signed-off-by: NBharat Bhushan <bharat.bhushan@freescale.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      6e35994d
  22. 08 4月, 2012 2 次提交
  23. 05 3月, 2012 4 次提交
  24. 22 5月, 2011 2 次提交