1. 08 8月, 2013 1 次提交
  2. 07 8月, 2013 1 次提交
    • C
      ARM: KVM: Fix 64-bit coprocessor handling · 240e99cb
      Christoffer Dall 提交于
      The PAR was exported as CRn == 7 and CRm == 0, but in fact the primary
      coprocessor register number was determined by CRm for 64-bit coprocessor
      registers as the user space API was modeled after the coprocessor
      access instructions (see the ARM ARM rev. C - B3-1445).
      
      However, just changing the CRn to CRm breaks the sorting check when
      booting the kernel, because the internal kernel logic always treats CRn
      as the primary register number, and it makes the table sorting
      impossible to understand for humans.
      
      Alternatively we could change the logic to always have CRn == CRm, but
      that becomes unclear in the number of ways we do look up of a coprocessor
      register.  We could also have a separate 64-bit table but that feels
      somewhat over-engineered.  Instead, keep CRn the primary representation
      of the primary coproc. register number in-kernel and always export the
      primary number as CRm as per the existing user space ABI.
      
      Note: The TTBR registers just magically worked because they happened to
      follow the CRn(0) regs and were considered CRn(0) in the in-kernel
      representation.
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      240e99cb
  3. 27 6月, 2013 10 次提交
  4. 12 6月, 2013 1 次提交
  5. 07 6月, 2013 1 次提交
  6. 03 6月, 2013 2 次提交
  7. 19 5月, 2013 2 次提交
    • M
      KVM: get rid of $(addprefix ../../../virt/kvm/, ...) in Makefiles · 535cf7b3
      Marc Zyngier 提交于
      As requested by the KVM maintainers, remove the addprefix used to
      refer to the main KVM code from the arch code, and replace it with
      a KVM variable that does the same thing.
      Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Cc: Christoffer Dall <cdall@cs.columbia.edu>
      Acked-by: NXiantao Zhang <xiantao.zhang@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      535cf7b3
    • M
      ARM: KVM: move GIC/timer code to a common location · 7275acdf
      Marc Zyngier 提交于
      As KVM/arm64 is looming on the horizon, it makes sense to move some
      of the common code to a single location in order to reduce duplication.
      
      The code could live anywhere. Actually, most of KVM is already built
      with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
      not exactly talking about style here. But maybe it is time to start
      moving into a less ugly direction.
      
      The include files must be in a "public" location, as they are accessed
      from non-KVM files (arch/arm/kernel/asm-offsets.c).
      
      For this purpose, introduce two new locations:
      - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
        virt/kvm, so this could be seen as a (very ugly) precedent.
      - include/kvm/  : there is already an include/xen, and while the
        intent is slightly different, this seems as good a location as
        any
      
      Eventually, we should probably have independant Makefiles at every
      levels (just like everywhere else in the kernel), but this is just
      the first step.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      7275acdf
  8. 29 4月, 2013 13 次提交
    • A
      ARM: KVM: iterate over all CPUs for CPU compatibility check · d4e071ce
      Andre Przywara 提交于
      kvm_target_cpus() checks the compatibility of the used CPU with
      KVM, which is currently limited to ARM Cortex-A15 cores.
      However by calling it only once on any random CPU it assumes that
      all cores are the same, which is not necessarily the case (for example
      in Big.Little).
      
      [ I cut some of the commit message and changed the formatting of the
        code slightly to pass checkpatch and look more like the rest of the
        kvm/arm init code - Christoffer ]
      Signed-off-by: NAndre Przywara <andre.przywara@linaro.org>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      d4e071ce
    • C
      KVM: ARM: Fix spelling in error message · df759217
      Christoffer Dall 提交于
      s/unkown/unknown/
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      df759217
    • A
      ARM: KVM: define KVM_ARM_MAX_VCPUS unconditionally · d21a1c83
      Arnd Bergmann 提交于
      The CONFIG_KVM_ARM_MAX_VCPUS symbol is needed in order to build the
      kernel/context_tracking.c code, which includes the vgic data structures
      implictly through the kvm headers. Definining the symbol to zero
      on builds without KVM resolves this build error:
      
      In file included from include/linux/kvm_host.h:33:0,
                       from kernel/context_tracking.c:18:
      arch/arm/include/asm/kvm_host.h:28:23: warning: "CONFIG_KVM_ARM_MAX_VCPUS" is not defined [-Wundef]
       #define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
                             ^
      arch/arm/include/asm/kvm_vgic.h:34:24: note: in expansion of macro 'KVM_MAX_VCPUS'
       #define VGIC_MAX_CPUS  KVM_MAX_VCPUS
                              ^
      arch/arm/include/asm/kvm_vgic.h:38:6: note: in expansion of macro 'VGIC_MAX_CPUS'
       #if (VGIC_MAX_CPUS > 8)
            ^
      In file included from arch/arm/include/asm/kvm_host.h:41:0,
                       from include/linux/kvm_host.h:33,
                       from kernel/context_tracking.c:18:
      arch/arm/include/asm/kvm_vgic.h:59:11: error: 'CONFIG_KVM_ARM_MAX_VCPUS' undeclared here (not in a function)
        } percpu[VGIC_MAX_CPUS];
                 ^
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Christoffer Dall <cdall@cs.columbia.edu>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      d21a1c83
    • M
      ARM: KVM: promote vfp_host pointer to generic host cpu context · 3de50da6
      Marc Zyngier 提交于
      We use the vfp_host pointer to store the host VFP context, should
      the guest start using VFP itself.
      
      Actually, we can use this pointer in a more generic way to store
      CPU speficic data, and arm64 is using it to dump the whole host
      state before switching to the guest.
      
      Simply rename the vfp_host field to host_cpu_context, and the
      corresponding type to kvm_cpu_context_t. No change in functionnality.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      3de50da6
    • M
      ARM: KVM: add architecture specific hook for capabilities · 17b1e31f
      Marc Zyngier 提交于
      Most of the capabilities are common to both arm and arm64, but
      we still need to handle the exceptions.
      
      Introduce kvm_arch_dev_ioctl_check_extension, which both architectures
      implement (in the 32bit case, it just returns 0).
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      17b1e31f
    • M
      ARM: KVM: perform HYP initilization for hotplugged CPUs · d157f4a5
      Marc Zyngier 提交于
      Now that we have the necessary infrastructure to boot a hotplugged CPU
      at any point in time, wire a CPU notifier that will perform the HYP
      init for the incoming CPU.
      
      Note that this depends on the platform code and/or firmware to boot the
      incoming CPU with HYP mode enabled and return to the kernel by following
      the normal boot path (HYP stub installed).
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      d157f4a5
    • M
      ARM: KVM: switch to a dual-step HYP init code · 5a677ce0
      Marc Zyngier 提交于
      Our HYP init code suffers from two major design issues:
      - it cannot support CPU hotplug, as we tear down the idmap very early
      - it cannot perform a TLB invalidation when switching from init to
        runtime mappings, as pages are manipulated from PL1 exclusively
      
      The hotplug problem mandates that we keep two sets of page tables
      (boot and runtime). The TLB problem mandates that we're able to
      transition from one PGD to another while in HYP, invalidating the TLBs
      in the process.
      
      To be able to do this, we need to share a page between the two page
      tables. A page that will have the same VA in both configurations. All we
      need is a VA that has the following properties:
      - This VA can't be used to represent a kernel mapping.
      - This VA will not conflict with the physical address of the kernel text
      
      The vectors page seems to satisfy this requirement:
      - The kernel never maps anything else there
      - The kernel text being copied at the beginning of the physical memory,
        it is unlikely to use the last 64kB (I doubt we'll ever support KVM
        on a system with something like 4MB of RAM, but patches are very
        welcome).
      
      Let's call this VA the trampoline VA.
      
      Now, we map our init page at 3 locations:
      - idmap in the boot pgd
      - trampoline VA in the boot pgd
      - trampoline VA in the runtime pgd
      
      The init scenario is now the following:
      - We jump in HYP with four parameters: boot HYP pgd, runtime HYP pgd,
        runtime stack, runtime vectors
      - Enable the MMU with the boot pgd
      - Jump to a target into the trampoline page (remember, this is the same
        physical page!)
      - Now switch to the runtime pgd (same VA, and still the same physical
        page!)
      - Invalidate TLBs
      - Set stack and vectors
      - Profit! (or eret, if you only care about the code).
      
      Note that we keep the boot mapping permanently (it is not strictly an
      idmap anymore) to allow for CPU hotplug in later patches.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      5a677ce0
    • M
      ARM: KVM: rework HYP page table freeing · 4f728276
      Marc Zyngier 提交于
      There is no point in freeing HYP page tables differently from Stage-2.
      They now have the same requirements, and should be dealt with the same way.
      
      Promote unmap_stage2_range to be The One True Way, and get rid of a number
      of nasty bugs in the process (good thing we never actually called free_hyp_pmds
      before...).
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      4f728276
    • M
      ARM: KVM: move to a KVM provided HYP idmap · 2fb41059
      Marc Zyngier 提交于
      After the HYP page table rework, it is pretty easy to let the KVM
      code provide its own idmap, rather than expecting the kernel to
      provide it. It takes actually less code to do so.
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      2fb41059
    • M
      ARM: KVM: fix HYP mapping limitations around zero · 3562c76d
      Marc Zyngier 提交于
      The current code for creating HYP mapping doesn't like to wrap
      around zero, which prevents from mapping anything into the last
      page of the virtual address space.
      
      It doesn't take much effort to remove this limitation, making
      the code more consistent with the rest of the kernel in the process.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      3562c76d
    • M
      ARM: KVM: simplify HYP mapping population · 6060df84
      Marc Zyngier 提交于
      The way we populate HYP mappings is a bit convoluted, to say the least.
      Passing a pointer around to keep track of the current PFN is quite
      odd, and we end-up having two different PTE accessors for no good
      reason.
      
      Simplify the whole thing by unifying the two PTE accessors, passing
      a pgprot_t around, and moving the various validity checks to the
      upper layers.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      6060df84
    • M
      ARM: KVM: arch_timer: use symbolic constants · 372b7c1b
      Mark Rutland 提交于
      In clocksource/arm_arch_timer.h we define useful symbolic constants.
      Let's use them to make the KVM arch_timer code clearer.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Cc: Christoffer Dall <cdall@cs.columbia.edu>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      372b7c1b
    • M
      ARM: KVM: add support for minimal host vs guest profiling · 210552c1
      Marc Zyngier 提交于
      In order to be able to correctly profile what is happening on the
      host, we need to be able to identify when we're running on the guest,
      and log these events differently.
      
      Perf offers a simple way to register callbacks into KVM. Mimic what
      x86 does and enjoy being able to profile your KVM host.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <cdall@cs.columbia.edu>
      210552c1
  9. 24 4月, 2013 1 次提交
  10. 18 4月, 2013 1 次提交
  11. 17 4月, 2013 2 次提交
  12. 07 3月, 2013 5 次提交