1. 26 Apr, 2013 2 commits
  2. 10 Jan, 2013 2 commits
  3. 06 Dec, 2012 1 commit
    • Paul Mackerras's avatar
      KVM: PPC: Book3S PR: Emulate PURR, SPURR and DSCR registers · b0a94d4e
      Paul Mackerras authored
      
      
      This adds basic emulation of the PURR and SPURR registers.  We assume
      we are emulating a single-threaded core, so these advance at the same
      rate as the timebase.  A Linux kernel running on a POWER7 expects to
      be able to access these registers and is not prepared to handle a
      program interrupt on accessing them.
      
      This also adds a very minimal emulation of the DSCR (data stream
      control register).  Writes are ignored and reads return zero.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      b0a94d4e
  4. 06 May, 2012 2 commits
    • Alexander Graf's avatar
      KVM: PPC: Emulator: clean up SPR reads and writes · 54771e62
      Alexander Graf authored
      
      
      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: default avatarAlexander Graf <agraf@suse.de>
      54771e62
    • Alexander Graf's avatar
      KVM: PPC: Emulator: clean up instruction parsing · c46dc9a8
      Alexander Graf authored
      
      
      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: default avatarAlexander Graf <agraf@suse.de>
      c46dc9a8
  5. 02 Apr, 2012 1 commit
  6. 05 Mar, 2012 1 commit
  7. 25 Sep, 2011 2 commits
  8. 24 Oct, 2010 5 commits
    • Alexander Graf's avatar
      KVM: PPC: Move BAT handling code into spr handler · c1c88e2f
      Alexander Graf authored
      
      
      The current approach duplicates the spr->bat finding logic and makes it harder
      to reuse the actually used variables. So let's move everything down to the spr
      handler.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      c1c88e2f
    • Alexander Graf's avatar
      KVM: PPC: Convert SRR0 and SRR1 to shared page · de7906c3
      Alexander Graf authored
      
      
      The SRR0 and SRR1 registers contain cached values of the PC and MSR
      respectively. They get written to by the hypervisor when an interrupt
      occurs or directly by the kernel. They are also used to tell the rfi(d)
      instruction where to jump to.
      
      Because it only gets touched on defined events that, it's very simple to
      share with the guest. Hypervisor and guest both have full r/w access.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      de7906c3
    • Alexander Graf's avatar
      KVM: PPC: Convert DAR to shared page. · 5e030186
      Alexander Graf authored
      
      
      The DAR register contains the address a data page fault occured at. This
      register behaves pretty much like a simple data storage register that gets
      written to on data faults. There is no hypervisor interaction required on
      read or write.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      5e030186
    • Alexander Graf's avatar
      KVM: PPC: Convert DSISR to shared page · d562de48
      Alexander Graf authored
      
      
      The DSISR register contains information about a data page fault. It is fully
      read/write from inside the guest context and we don't need to worry about
      interacting based on writes of this register.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      d562de48
    • Alexander Graf's avatar
      KVM: PPC: Convert MSR to shared page · 666e7252
      Alexander Graf authored
      
      
      One of the most obvious registers to share with the guest directly is the
      MSR. The MSR contains the "interrupts enabled" flag which the guest has to
      toggle in critical sections.
      
      So in order to bring the overhead of interrupt en- and disabling down, let's
      put msr into the shared page. Keep in mind that even though you can fully read
      its contents, writing to it doesn't always update all state. There are a few
      safe fields that don't require hypervisor interaction. See the documentation
      for a list of MSR bits that are safe to be set from inside the guest.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      666e7252
  9. 17 May, 2010 9 commits
  10. 25 Apr, 2010 5 commits
    • Alexander Graf's avatar
      KVM: PPC: Implement Paired Single emulation · 831317b6
      Alexander Graf authored
      
      
      The one big thing about the Gekko is paired singles.
      
      Paired singles are an extension to the instruction set, that adds 32 single
      precision floating point registers (qprs), some SPRs to modify the behavior
      of paired singled operations and instructions to deal with qprs to the
      instruction set.
      
      Unfortunately, it also changes semantics of existing operations that affect
      single values in FPRs. In most cases they get mirrored to the coresponding
      QPR.
      
      Thanks to that we need to emulate all FPU operations and all the new paired
      single operations too.
      
      In order to achieve that, we use the just introduced FPU call helpers to
      call the real FPU whenever the guest wants to modify an FPR. Additionally
      we also fix up the QPR values along the way.
      
      That way we can execute paired single FPU operations without implementing a
      soft fpu.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      831317b6
    • Alexander Graf's avatar
      KVM: PPC: Fix error in BAT assignment · dba2e123
      Alexander Graf authored
      
      
      BATs didn't work. Well, they did, but only up to BAT3. As soon as we
      came to BAT4 the offset calculation was screwed up and we ended up
      overwriting BAT0-3.
      
      Fortunately, Linux hasn't been using BAT4+. It's still a good
      idea to write correct code though.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      dba2e123
    • Alexander Graf's avatar
      KVM: PPC: Make software load/store return eaddr · 5467a97d
      Alexander Graf authored
      
      
      The Book3S KVM implementation contains some helper functions to load and store
      data from and to virtual addresses.
      
      Unfortunately, this helper used to keep the physical address it so nicely
      found out for us to itself. So let's change that and make it return the
      physical address it resolved.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      5467a97d
    • Alexander Graf's avatar
      KVM: PPC: Implement mtsr instruction emulation · 71db4089
      Alexander Graf authored
      
      
      The Book3S_32 specifications allows for two instructions to modify segment
      registers: mtsrin and mtsr.
      
      Most normal operating systems use mtsrin, because it allows to define which
      segment it wants to change using a register. But since I was trying to run
      an embedded guest, it turned out to be using mtsr with hardcoded values.
      
      So let's also emulate mtsr. It's a valid instruction after all.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      71db4089
    • Alexander Graf's avatar
      KVM: PPC: Add Gekko SPRs · d6d549b2
      Alexander Graf authored
      
      
      The Gekko has some SPR values that differ from other PPC core values and
      also some additional ones.
      
      Let's add support for them in our mfspr/mtspr emulator.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      d6d549b2
  11. 01 Mar, 2010 1 commit
    • Alexander Graf's avatar
      KVM: PPC: Use accessor functions for GPR access · 8e5b26b5
      Alexander Graf authored
      
      
      All code in PPC KVM currently accesses gprs in the vcpu struct directly.
      
      While there's nothing wrong with that wrt the current way gprs are stored
      and loaded, it doesn't suffice for the PACA acceleration that will follow
      in this patchset.
      
      So let's just create little wrapper inline functions that we call whenever
      a GPR needs to be read from or written to. The compiled code shouldn't really
      change at all for now.
      Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      8e5b26b5
  12. 08 Dec, 2009 1 commit
  13. 05 Nov, 2009 1 commit