1. 05 3月, 2012 6 次提交
  2. 26 12月, 2011 1 次提交
  3. 17 11月, 2011 1 次提交
  4. 01 11月, 2011 1 次提交
    • P
      powerpc: include export.h for files using EXPORT_SYMBOL/THIS_MODULE · 93087948
      Paul Gortmaker 提交于
      Fix failures in powerpc associated with the previously allowed
      implicit module.h presence that now lead to things like this:
      
      arch/powerpc/mm/mmu_context_hash32.c:76:1: error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
      arch/powerpc/mm/tlb_hash32.c:48:1: error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
      arch/powerpc/kernel/pci_32.c:51:1: error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
      arch/powerpc/kernel/iomap.c:36:1: error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
      arch/powerpc/platforms/44x/canyonlands.c:126:1: error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
      arch/powerpc/kvm/44x.c:168:59: error: 'THIS_MODULE' undeclared (first use in this function)
      
      [with several contibutions from Stephen Rothwell <sfr@canb.auug.org.au>]
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      93087948
  5. 26 9月, 2011 4 次提交
    • 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
    • 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: 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: 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
  6. 12 7月, 2011 6 次提交
    • P
      KVM: PPC: Move guest enter/exit down into subarch-specific code · df6909e5
      Paul Mackerras 提交于
      Instead of doing the kvm_guest_enter/exit() and local_irq_dis/enable()
      calls in powerpc.c, this moves them down into the subarch-specific
      book3s_pr.c and booke.c.  This eliminates an extra local_irq_enable()
      call in book3s_pr.c, and will be needed for when we do SMT4 guest
      support in the book3s hypervisor mode code.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      df6909e5
    • P
      KVM: PPC: Pass init/destroy vm and prepare/commit memory region ops down · f9e0554d
      Paul Mackerras 提交于
      This arranges for the top-level arch/powerpc/kvm/powerpc.c file to
      pass down some of the calls it gets to the lower-level subarchitecture
      specific code.  The lower-level implementations (in booke.c and book3s.c)
      are no-ops.  The coming book3s_hv.c will need this.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f9e0554d
    • P
      KVM: PPC: Split out code from book3s.c into book3s_pr.c · f05ed4d5
      Paul Mackerras 提交于
      In preparation for adding code to enable KVM to use hypervisor mode
      on 64-bit Book 3S processors, this splits book3s.c into two files,
      book3s.c and book3s_pr.c, where book3s_pr.c contains the code that is
      specific to running the guest in problem state (user mode) and book3s.c
      contains code which should apply to all Book 3S processors.
      
      In doing this, we abstract some details, namely the interrupt offset,
      updating the interrupt pending flag, and detecting if the guest is
      in a critical section.  These are all things that will be different
      when we use hypervisor mode.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f05ed4d5
    • P
      KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s · c4befc58
      Paul Mackerras 提交于
      This moves the slb field, which represents the state of the emulated
      SLB, from the kvmppc_vcpu_book3s struct to the kvm_vcpu_arch, and the
      hpte_hash_[v]pte[_long] fields from kvm_vcpu_arch to kvmppc_vcpu_book3s.
      This is in accord with the principle that the kvm_vcpu_arch struct
      represents the state of the emulated CPU, and the kvmppc_vcpu_book3s
      struct holds the auxiliary data structures used in the emulation.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      c4befc58
    • P
      KVM: PPC: Fix machine checks on 32-bit Book3S · 149dbdb1
      Paul Mackerras 提交于
      Commit 69acc0d3ba ("KVM: PPC: Resolve real-mode handlers through
      function exports") resulted in vcpu->arch.trampoline_lowmem and
      vcpu->arch.trampoline_enter ending up with kernel virtual addresses
      rather than physical addresses.  This is OK on 64-bit Book3S machines,
      which ignore the top 4 bits of the effective address in real mode,
      but on 32-bit Book3S machines, accessing these addresses in real mode
      causes machine check interrupts, as the hardware uses the whole
      effective address as the physical address in real mode.
      
      This fixes the problem by using __pa() to convert these addresses
      to physical addresses.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      149dbdb1
    • A
      KVM: PPC: Resolve real-mode handlers through function exports · a22a2dac
      Alexander Graf 提交于
      Up until now, Book3S KVM had variables stored in the kernel that a kernel module
      or the kvm code in the kernel could read from to figure out where some real mode
      helper functions are located.
      
      This is all unnecessary. The high bits of the EA get ignore in real mode, so we
      can just use the pointer as is. Also, it's a lot easier on relocations when we
      use the normal way of resolving the address to a function, instead of jumping
      through hoops.
      
      This patch fixes compilation with CONFIG_RELOCATABLE=y.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a22a2dac
  7. 20 5月, 2011 1 次提交
  8. 18 3月, 2011 1 次提交
  9. 12 1月, 2011 1 次提交
  10. 24 10月, 2010 18 次提交
    • A
      KVM: PPC: Implement Level interrupts on Book3S · 17bd1580
      Alexander Graf 提交于
      The current interrupt logic is just completely broken. We get a notification
      from user space, telling us that an interrupt is there. But then user space
      expects us that we just acknowledge an interrupt once we deliver it to the
      guest.
      
      This is not how real hardware works though. On real hardware, the interrupt
      controller pulls the external interrupt line until it gets notified that the
      interrupt was received.
      
      So in reality we have two events: pulling and letting go of the interrupt line.
      
      To maintain backwards compatibility, I added a new request for the pulling
      part. The letting go part was implemented earlier already.
      
      With this in place, we can now finally start guests that do not randomly stall
      and stop to work at random times.
      
      This patch implements above logic for Book3S.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      17bd1580
    • A
      KVM: PPC: Don't put MSR_POW in MSR · 296c19d0
      Alexander Graf 提交于
      On Book3S a mtmsr with the MSR_POW bit set indicates that the OS is in
      idle and only needs to be waked up on the next interrupt.
      
      Now, unfortunately we let that bit slip into the stored MSR value which
      is not what the real CPU does, so that we ended up executing code like
      this:
      
      	r = mfmsr();
      	/* r containts MSR_POW */
      	mtmsr(r | MSR_EE);
      
      This obviously breaks, as we're going into idle mode in code sections that
      don't expect to be idling.
      
      This patch masks MSR_POW out of the stored MSR value on wakeup, making
      guests happy again.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      296c19d0
    • A
      KVM: PPC: Update int_pending also on dequeue · 9ee18b1e
      Alexander Graf 提交于
      When having a decrementor interrupt pending, the dequeuing happens manually
      through an mtdec instruction. This instruction simply calls dequeue on that
      interrupt, so the int_pending hint doesn't get updated.
      
      This patch enables updating the int_pending hint also on dequeue, thus
      correctly enabling guests to stay in guest contexts more often.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9ee18b1e
    • A
      KVM: PPC: Put segment registers in shared page · df1bfa25
      Alexander Graf 提交于
      Now that the actual mtsr doesn't do anything anymore, we can move the sr
      contents over to the shared page, so a guest can directly read and write
      its sr contents from guest context.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      df1bfa25
    • A
      KVM: PPC: Interpret SR registers on demand · 8e865178
      Alexander Graf 提交于
      Right now we're examining the contents of Book3s_32's segment registers when
      the register is written and put the interpreted contents into a struct.
      
      There are two reasons this is bad. For starters, the struct has worse real-time
      performance, as it occupies more ram. But the more important part is that with
      segment registers being interpreted from their raw values, we can put them in
      the shared page, allowing guests to mess with them directly.
      
      This patch makes the internal representation of SRs be u32s.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      8e865178
    • A
      KVM: PPC: Don't flush PTEs on NX/RO hit · 2e602847
      Alexander Graf 提交于
      When hitting a no-execute or read-only data/inst storage interrupt we were
      flushing the respective PTE so we're sure it gets properly overwritten next.
      
      According to the spec, this is unnecessary though. The guest issues a tlbie
      anyways, so we're safe to just keep the PTE around and have it manually removed
      from the guest, saving us a flush.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      2e602847
    • A
      KVM: PPC: Preload magic page when in kernel mode · 4cb6b7ea
      Alexander Graf 提交于
      When the guest jumps into kernel mode and has the magic page mapped, theres a
      very high chance that it will also use it. So let's detect that scenario and
      map the segment accordingly.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      4cb6b7ea
    • A
      KVM: PPC: Move EXIT_DEBUG partially to tracepoints · bed1ed98
      Alexander Graf 提交于
      We have a debug printk on every exit that is usually #ifdef'ed out. Using
      tracepoints makes a lot more sense here though, as they can be dynamically
      enabled.
      
      This patch converts the most commonly used debug printks of EXIT_DEBUG to
      tracepoints.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      bed1ed98
    • W
      KVM: PPC: fix leakage of error page in kvmppc_patch_dcbz() · 646bab55
      Wei Yongjun 提交于
      Add kvm_release_page_clean() after is_error_page() to avoid
      leakage of error page.
      Signed-off-by: NWei Yongjun <yjwei@cn.fujitsu.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      646bab55
    • A
      KVM: PPC: Magic Page Book3s support · e8508940
      Alexander Graf 提交于
      We need to override EA as well as PA lookups for the magic page. When the guest
      tells us to project it, the magic page overrides any guest mappings.
      
      In order to reflect that, we need to hook into all the MMU layers of KVM to
      force map the magic page if necessary.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      e8508940
    • A
      KVM: PPC: Make PAM a define · 28e83b4f
      Alexander Graf 提交于
      On PowerPC it's very normal to not support all of the physical RAM in real mode.
      To check if we're matching on the shared page or not, we need to know the limits
      so we can restrain ourselves to that range.
      
      So let's make it a define instead of open-coding it. And while at it, let's also
      increase it.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      
      v2 -> v3:
      
        - RMO -> PAM (non-magic page)
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      28e83b4f
    • A
      KVM: PPC: Tell guest about pending interrupts · 90bba358
      Alexander Graf 提交于
      When the guest turns on interrupts again, it needs to know if we have an
      interrupt pending for it. Because if so, it should rather get out of guest
      context and get the interrupt.
      
      So we introduce a new field in the shared page that we use to tell the guest
      that there's a pending interrupt lying around.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      90bba358
    • A
      KVM: PPC: Add PV guest critical sections · 5c6cedf4
      Alexander Graf 提交于
      When running in hooked code we need a way to disable interrupts without
      clobbering any interrupts or exiting out to the hypervisor.
      
      To achieve this, we have an additional critical field in the shared page. If
      that field is equal to the r1 register of the guest, it tells the hypervisor
      that we're in such a critical section and thus may not receive any interrupts.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      5c6cedf4
    • A
      KVM: PPC: Implement hypervisor interface · 2a342ed5
      Alexander Graf 提交于
      To communicate with KVM directly we need to plumb some sort of interface
      between the guest and KVM. Usually those interfaces use hypercalls.
      
      This hypercall implementation is described in the last patch of the series
      in a special documentation file. Please read that for further information.
      
      This patch implements stubs to handle KVM PPC hypercalls on the host and
      guest side alike.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      2a342ed5
    • A
      KVM: PPC: Convert SPRG[0-4] to shared page · a73a9599
      Alexander Graf 提交于
      When in kernel mode there are 4 additional registers available that are
      simple data storage. Instead of exiting to the hypervisor to read and
      write those, we can just share them with the guest using the page.
      
      This patch converts all users of the current field to the shared page.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      a73a9599
    • A
      KVM: PPC: Convert SRR0 and SRR1 to shared page · de7906c3
      Alexander Graf 提交于
      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: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      de7906c3
    • A
      KVM: PPC: Convert DAR to shared page. · 5e030186
      Alexander Graf 提交于
      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: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      5e030186
    • A
      KVM: PPC: Convert DSISR to shared page · d562de48
      Alexander Graf 提交于
      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: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d562de48