1. 26 9月, 2011 13 次提交
    • P
      KVM: PPC: book3s_pr: Simplify transitions between virtual and real mode · 02143947
      Paul Mackerras 提交于
      This simplifies the way that the book3s_pr makes the transition to
      real mode when entering the guest.  We now call kvmppc_entry_trampoline
      (renamed from kvmppc_rmcall) in the base kernel using a normal function
      call instead of doing an indirect call through a pointer in the vcpu.
      If kvm is a module, the module loader takes care of generating a
      trampoline as it does for other calls to functions outside the module.
      
      kvmppc_entry_trampoline then disables interrupts and jumps to
      kvmppc_handler_trampoline_enter in real mode using an rfi[d].
      That then uses the link register as the address to return to
      (potentially in module space) when the guest exits.
      
      This also simplifies the way that we call the Linux interrupt handler
      when we exit the guest due to an external, decrementer or performance
      monitor interrupt.  Instead of turning on the MMU, then deciding that
      we need to call the Linux handler and turning the MMU back off again,
      we now go straight to the handler at the point where we would turn the
      MMU on.  The handler will then return to the virtual-mode code
      (potentially in the module).
      
      Along the way, this moves the setting and clearing of the HID5 DCBZ32
      bit into real-mode interrupts-off code, and also makes sure that
      we clear the MSR[RI] bit before loading values into SRR0/1.
      
      The net result is that we no longer need any code addresses to be
      stored in vcpu->arch.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      02143947
    • P
      KVM: PPC: Assemble book3s{,_hv}_rmhandlers.S separately · 177339d7
      Paul Mackerras 提交于
      This makes arch/powerpc/kvm/book3s_rmhandlers.S and
      arch/powerpc/kvm/book3s_hv_rmhandlers.S be assembled as
      separate compilation units rather than having them #included in
      arch/powerpc/kernel/exceptions-64s.S.  We no longer have any
      conditional branches between the exception prologs in
      exceptions-64s.S and the KVM handlers, so there is no need to
      keep their contents close together in the vmlinux image.
      
      In their current location, they are using up part of the limited
      space between the first-level interrupt handlers and the firmware
      NMI data area at offset 0x7000, and with some kernel configurations
      this area will overflow (e.g. allyesconfig), leading to an
      "attempt to .org backwards" error when compiling exceptions-64s.S.
      
      Moving them out requires that we add some #includes that the
      book3s_{,hv_}rmhandlers.S code was previously getting implicitly
      via exceptions-64s.S.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      177339d7
    • A
      KVM: PPC: Add sanity checking to vcpu_run · af8f38b3
      Alexander Graf 提交于
      There are multiple features in PowerPC KVM that can now be enabled
      depending on the user's wishes. Some of the combinations don't make
      sense or don't work though.
      
      So this patch adds a way to check if the executing environment would
      actually be able to run the guest properly. It also adds sanity
      checks if PVR is set (should always be true given the current code
      flow), if PAPR is only used with book3s_64 where it works and that
      HV KVM is only used in PAPR mode.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      af8f38b3
    • A
      KVM: PPC: Enable the PAPR CAP for Book3S · 930b412a
      Alexander Graf 提交于
      Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and
      enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR
      mode.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      930b412a
    • A
      KVM: PPC: Support SC1 hypercalls for PAPR in PR mode · a668f2bd
      Alexander Graf 提交于
      PAPR defines hypercalls as SC1 instructions. Using these, the guest modifies
      page tables and does other privileged operations that it wouldn't be allowed
      to do in supervisor mode.
      
      This patch adds support for PR KVM to trap these instructions and route them
      through the same PAPR hypercall interface that we already use for HV style
      KVM.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a668f2bd
    • A
      KVM: PPC: Stub emulate CFAR and PURR SPRs · aacf9aa3
      Alexander Graf 提交于
      Recent Linux versions use the CFAR and PURR SPRs, but don't really care about
      their contents (yet). So for now, we can simply return 0 when the guest wants
      to read them.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      aacf9aa3
    • A
      KVM: PPC: Add PAPR hypercall code for PR mode · 0254f074
      Alexander Graf 提交于
      When running a PAPR guest, we need to handle a few hypercalls in kernel space,
      most prominently the page table invalidation (to sync the shadows).
      
      So this patch adds handling for a few PAPR hypercalls to PR mode KVM. I tried
      to share the code with HV mode, but it ended up being a lot easier this way
      around, as the two differ too much in those details.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      
      ---
      
      v1 -> v2:
      
        - whitespace fix
      0254f074
    • A
      KVM: PPC: Add support for explicit HIOR setting · a15bd354
      Alexander Graf 提交于
      Until now, we always set HIOR based on the PVR, but this is just wrong.
      Instead, we should be setting HIOR explicitly, so user space can decide
      what the initial HIOR value is - just like on real hardware.
      
      We keep the old PVR based way around for backwards compatibility, but
      once user space uses the SREGS based method, we drop the PVR logic.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a15bd354
    • A
      KVM: PPC: Read out syscall instruction on trap · 77e675ad
      Alexander Graf 提交于
      We have a few traps where we cache the instruction that cause the trap
      for analysis later on. Since we now need to be able to distinguish
      between SC 0 and SC 1 system calls and the only way to find out which
      is which is by looking at the instruction, we also read out the instruction
      causing the system call.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      77e675ad
    • A
      KVM: PPC: Interpret SDR1 as HVA in PAPR mode · 04fcc11b
      Alexander Graf 提交于
      When running a PAPR guest, the guest is not allowed to set SDR1 - instead
      the HTAB information is held in internal hypervisor structures. But all of
      our current code relies on SDR1 and walking the HTAB like on real hardware.
      
      So in order to not be too intrusive, we simply set SDR1 to the HTAB we hold
      in host memory. That way we can keep the HTAB in user space, but use it from
      kernel space to map the guest.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      04fcc11b
    • A
      KVM: PPC: Check privilege level on SPRs · 317a8fa3
      Alexander Graf 提交于
      We have 3 privilege levels: problem state, supervisor state and hypervisor
      state. Each of them can access different SPRs, so we need to check on every
      SPR if it's accessible in the respective mode.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      317a8fa3
    • A
      KVM: PPC: Add papr_enabled flag · 9432ba60
      Alexander Graf 提交于
      When running a PAPR guest, some things change. The privilege level drops
      from hypervisor to supervisor, SDR1 gets treated differently and we interpret
      hypercalls. For bisectability sake, add the flag now, but only enable it when
      all the support code is there.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9432ba60
    • A
      KVM: PPC: move compute_tlbie_rb to book3s common header · db507c30
      Alexander Graf 提交于
      We need the compute_tlbie_rb in _pr and _hv implementations for papr
      soon, so let's move it over to a common header file that both
      implementations can leverage.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      db507c30
  2. 31 8月, 2011 3 次提交
  3. 30 8月, 2011 1 次提交
  4. 26 8月, 2011 1 次提交
  5. 10 8月, 2011 1 次提交
  6. 05 8月, 2011 17 次提交
  7. 03 8月, 2011 1 次提交
  8. 27 7月, 2011 3 次提交