1. 24 10月, 2010 13 次提交
    • A
      KVM: PPC: PV wrteei · 644bfa01
      Alexander Graf 提交于
      On BookE the preferred way to write the EE bit is the wrteei instruction. It
      already encodes the EE bit in the instruction.
      
      So in order to get BookE some speedups as well, let's also PV'nize thati
      instruction.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      644bfa01
    • A
      KVM: PPC: PV mtmsrd L=0 and mtmsr · 78109277
      Alexander Graf 提交于
      There is also a form of mtmsr where all bits need to be addressed. While the
      PPC64 Linux kernel behaves resonably well here, on PPC32 we do not have an
      L=1 form. It does mtmsr even for simple things like only changing EE.
      
      So we need to hook into that one as well and check for a mask of bits that we
      deem safe to change from within guest context.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      78109277
    • A
      KVM: PPC: PV mtmsrd L=1 · 819a63dc
      Alexander Graf 提交于
      The PowerPC ISA has a special instruction for mtmsr that only changes the EE
      and RI bits, namely the L=1 form.
      
      Since that one is reasonably often occuring and simple to implement, let's
      go with this first. Writing EE=0 is always just a store. Doing EE=1 also
      requires us to check for pending interrupts and if necessary exit back to the
      hypervisor.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      819a63dc
    • A
      KVM: PPC: PV assembler helpers · 92234722
      Alexander Graf 提交于
      When we hook an instruction we need to make sure we don't clobber any of
      the registers at that point. So we write them out to scratch space in the
      magic page. To make sure we don't fall into a race with another piece of
      hooked code, we need to disable interrupts.
      
      To make the later patches and code in general easier readable, let's introduce
      a set of defines that save and restore r30, r31 and cr. Let's also define some
      helpers to read the lower 32 bits of a 64 bit field on 32 bit systems.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      92234722
    • A
      KVM: PPC: Introduce branch patching helper · 71ee8e34
      Alexander Graf 提交于
      We will need to patch several instruction streams over to a different
      code path, so we need a way to patch a single instruction with a branch
      somewhere else.
      
      This patch adds a helper to facilitate this patching.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      71ee8e34
    • A
      KVM: PPC: Introduce kvm_tmp framework · 2d4f5671
      Alexander Graf 提交于
      We will soon require more sophisticated methods to replace single instructions
      with multiple instructions. We do that by branching to a memory region where we
      write replacement code for the instruction to.
      
      This region needs to be within 32 MB of the patched instruction though, because
      that's the furthest we can jump with immediate branches.
      
      So we keep 1MB of free space around in bss. After we're done initing we can just
      tell the mm system that the unused pages are free, but until then we have enough
      space to fit all our code in.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      2d4f5671
    • A
      KVM: PPC: PV tlbsync to nop · d1290b15
      Alexander Graf 提交于
      With our current MMU scheme we don't need to know about the tlbsync instruction.
      So we can just nop it out.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d1290b15
    • A
      KVM: PPC: PV instructions to loads and stores · d1293c92
      Alexander Graf 提交于
      Some instructions can simply be replaced by load and store instructions to
      or from the magic page.
      
      This patch replaces often called instructions that fall into the above category.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d1293c92
    • A
      KVM: PPC: KVM PV guest stubs · 73a18109
      Alexander Graf 提交于
      We will soon start and replace instructions from the text section with
      other, paravirtualized versions. To ease the readability of those patches
      I split out the generic looping and magic page mapping code out.
      
      This patch still only contains stubs. But at least it loops through the
      text section :).
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      73a18109
    • A
      KVM: PPC: Generic KVM PV guest support · d17051cb
      Alexander Graf 提交于
      We have all the hypervisor pieces in place now, but the guest parts are still
      missing.
      
      This patch implements basic awareness of KVM when running Linux as guest. It
      doesn't do anything with it yet though.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d17051cb
    • 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 MSR to shared page · 666e7252
      Alexander Graf 提交于
      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: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      666e7252
    • A
      KVM: PPC: Introduce shared page · 96bc451a
      Alexander Graf 提交于
      For transparent variable sharing between the hypervisor and guest, I introduce
      a shared page. This shared page will contain all the registers the guest can
      read and write safely without exiting guest context.
      
      This patch only implements the stubs required for the basic structure of the
      shared page. The actual register moving follows.
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      96bc451a
  2. 06 10月, 2010 2 次提交
    • S
      powerpc: remove unused variable · 7c6d45e6
      Stephen Rothwell 提交于
      Since powerpc uses -Werror on arch powerpc, the build was broken like
      this:
      
        cc1: warnings being treated as errors
        arch/powerpc/kernel/module.c: In function 'module_finalize':
        arch/powerpc/kernel/module.c:66: error: unused variable 'err'
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7c6d45e6
    • L
      modules: Fix module_bug_list list corruption race · 5336377d
      Linus Torvalds 提交于
      With all the recent module loading cleanups, we've minimized the code
      that sits under module_mutex, fixing various deadlocks and making it
      possible to do most of the module loading in parallel.
      
      However, that whole conversion totally missed the rather obscure code
      that adds a new module to the list for BUG() handling.  That code was
      doubly obscure because (a) the code itself lives in lib/bugs.c (for
      dubious reasons) and (b) it gets called from the architecture-specific
      "module_finalize()" rather than from generic code.
      
      Calling it from arch-specific code makes no sense what-so-ever to begin
      with, and is now actively wrong since that code isn't protected by the
      module loading lock any more.
      
      So this commit moves the "module_bug_{finalize,cleanup}()" calls away
      from the arch-specific code, and into the generic code - and in the
      process protects it with the module_mutex so that the list operations
      are now safe.
      
      Future fixups:
       - move the module list handling code into kernel/module.c where it
         belongs.
       - get rid of 'module_bug_list' and just use the regular list of modules
         (called 'modules' - imagine that) that we already create and maintain
         for other reasons.
      Reported-and-tested-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Adrian Bunk <bunk@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5336377d
  3. 23 9月, 2010 1 次提交
  4. 31 8月, 2010 3 次提交
    • M
      powerpc: Don't use kernel stack with translation off · 54a83404
      Michael Neuling 提交于
      In f761622e we changed
      early_setup_secondary so it's called using the proper kernel stack
      rather than the emergency one.
      
      Unfortunately, this stack pointer can't be used when translation is off
      on PHYP as this stack pointer might be outside the RMO.  This results in
      the following on all non zero cpus:
        cpu 0x1: Vector: 300 (Data Access) at [c00000001639fd10]
            pc: 000000000001c50c
            lr: 000000000000821c
            sp: c00000001639ff90
           msr: 8000000000001000
           dar: c00000001639ffa0
         dsisr: 42000000
          current = 0xc000000016393540
          paca    = 0xc000000006e00200
            pid   = 0, comm = swapper
      
      The original patch was only tested on bare metal system, so it never
      caught this problem.
      
      This changes __secondary_start so that we calculate the new stack
      pointer but only start using it after we've called early_setup_secondary.
      
      With this patch, the above problem goes away.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      54a83404
    • P
      powerpc/perf_event: Reduce latency of calling perf_event_do_pending · b0d278b7
      Paul Mackerras 提交于
      Commit 0fe1ac48 ("powerpc/perf_event: Fix oops due to
      perf_event_do_pending call") moved the call to perf_event_do_pending
      in timer_interrupt() down so that it was after the irq_enter() call.
      Unfortunately this moved it after the code that checks whether it
      is time for the next decrementer clock event.  The result is that
      the call to perf_event_do_pending() won't happen until the next
      decrementer clock event is due.  This was pointed out by Milton
      Miller.
      
      This fixes it by moving the check for whether it's time for the
      next decrementer clock event down to the point where we're about
      to call the event handler, after we've called perf_event_do_pending.
      
      This has the side effect that on old pre-Core99 Powermacs where we
      use the ppc_n_lost_interrupts mechanism to replay interrupts, a
      replayed interrupt will incur a little more latency since it will
      now do the code from the irq_enter down to the irq_exit, that it
      used to skip.  However, these machines are now old and rare enough
      that this doesn't matter.  To make it clear that ppc_n_lost_interrupts
      is only used on Powermacs, and to speed up the code slightly on
      non-Powermac ppc32 machines, the code that tests ppc_n_lost_interrupts
      is now conditional on CONFIG_PMAC as well as CONFIG_PPC32.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: stable@kernel.org
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      b0d278b7
    • M
      powerpc/kexec: Adds correct calling convention for kexec purgatory · 4562c986
      Matthew McClintock 提交于
      Call kexec purgatory code correctly. We were getting lucky before.
      If you examine the powerpc 32bit kexec "purgatory" code you will
      see it expects the following:
      
      >From kexec-tools: purgatory/arch/ppc/v2wrap_32.S
      -> calling convention:
      ->   r3 = physical number of this cpu (all cpus)
      ->   r4 = address of this chunk (master only)
      
      As such, we need to set r3 to the current core, r4 happens to be
      unused by purgatory at the moment but we go ahead and set it
      here as well
      Signed-off-by: NMatthew McClintock <msm@freescale.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      4562c986
  5. 24 8月, 2010 11 次提交
  6. 23 8月, 2010 3 次提交
  7. 18 8月, 2010 1 次提交
    • D
      Make do_execve() take a const filename pointer · d7627467
      David Howells 提交于
      Make do_execve() take a const filename pointer so that kernel_execve() compiles
      correctly on ARM:
      
      arch/arm/kernel/sys_arm.c:88: warning: passing argument 1 of 'do_execve' discards qualifiers from pointer target type
      
      This also requires the argv and envp arguments to be consted twice, once for
      the pointer array and once for the strings the array points to.  This is
      because do_execve() passes a pointer to the filename (now const) to
      copy_strings_kernel().  A simpler alternative would be to cast the filename
      pointer in do_execve() when it's passed to copy_strings_kernel().
      
      do_execve() may not change any of the strings it is passed as part of the argv
      or envp lists as they are some of them in .rodata, so marking these strings as
      const should be fine.
      
      Further kernel_execve() and sys_execve() need to be changed to match.
      
      This has been test built on x86_64, frv, arm and mips.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NRalf Baechle <ralf@linux-mips.org>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d7627467
  8. 14 8月, 2010 1 次提交
  9. 07 8月, 2010 1 次提交
  10. 05 8月, 2010 1 次提交
  11. 03 8月, 2010 2 次提交
  12. 01 8月, 2010 1 次提交
    • G
      of/address: Clean up function declarations · 22ae782f
      Grant Likely 提交于
      This patch moves the declaration of of_get_address(), of_get_pci_address(),
      and of_pci_address_to_resource() out of arch code and into the common
      linux/of_address header file.
      
      This patch also fixes some of the asm/prom.h ordering issues.  It still
      includes some header files that it ideally shouldn't be, but at least the
      ordering is consistent now so that of_* overrides work.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      22ae782f