1. 24 1月, 2013 6 次提交
    • C
      KVM: ARM: Inject IRQs and FIQs from userspace · 86ce8535
      Christoffer Dall 提交于
      All interrupt injection is now based on the VM ioctl KVM_IRQ_LINE.  This
      works semantically well for the GIC as we in fact raise/lower a line on
      a machine component (the gic).  The IOCTL uses the follwing struct.
      
      struct kvm_irq_level {
      	union {
      		__u32 irq;     /* GSI */
      		__s32 status;  /* not used for KVM_IRQ_LEVEL */
      	};
      	__u32 level;           /* 0 or 1 */
      };
      
      ARM can signal an interrupt either at the CPU level, or at the in-kernel irqchip
      (GIC), and for in-kernel irqchip can tell the GIC to use PPIs designated for
      specific cpus.  The irq field is interpreted like this:
      
        bits:  | 31 ... 24 | 23  ... 16 | 15    ...    0 |
        field: | irq_type  | vcpu_index |   irq_number   |
      
      The irq_type field has the following values:
      - irq_type[0]: out-of-kernel GIC: irq_number 0 is IRQ, irq_number 1 is FIQ
      - irq_type[1]: in-kernel GIC: SPI, irq_number between 32 and 1019 (incl.)
                     (the vcpu_index field is ignored)
      - irq_type[2]: in-kernel GIC: PPI, irq_number between 16 and 31 (incl.)
      
      The irq_number thus corresponds to the irq ID in as in the GICv2 specs.
      
      This is documented in Documentation/kvm/api.txt.
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NChristoffer Dall <c.dall@virtualopensystems.com>
      86ce8535
    • C
      KVM: ARM: Memory virtualization setup · d5d8184d
      Christoffer Dall 提交于
      This commit introduces the framework for guest memory management
      through the use of 2nd stage translation. Each VM has a pointer
      to a level-1 table (the pgd field in struct kvm_arch) which is
      used for the 2nd stage translations. Entries are added when handling
      guest faults (later patch) and the table itself can be allocated and
      freed through the following functions implemented in
      arch/arm/kvm/arm_mmu.c:
       - kvm_alloc_stage2_pgd(struct kvm *kvm);
       - kvm_free_stage2_pgd(struct kvm *kvm);
      
      Each entry in TLBs and caches are tagged with a VMID identifier in
      addition to ASIDs. The VMIDs are assigned consecutively to VMs in the
      order that VMs are executed, and caches and tlbs are invalidated when
      the VMID space has been used to allow for more than 255 simultaenously
      running guests.
      
      The 2nd stage pgd is allocated in kvm_arch_init_vm(). The table is
      freed in kvm_arch_destroy_vm(). Both functions are called from the main
      KVM code.
      
      We pre-allocate page table memory to be able to synchronize using a
      spinlock and be called under rcu_read_lock from the MMU notifiers.  We
      steal the mmu_memory_cache implementation from x86 and adapt for our
      specific usage.
      
      We support MMU notifiers (thanks to Marc Zyngier) through
      kvm_unmap_hva and kvm_set_spte_hva.
      
      Finally, define kvm_phys_addr_ioremap() to map a device at a guest IPA,
      which is used by VGIC support to map the virtual CPU interface registers
      to the guest. This support is added by Marc Zyngier.
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <c.dall@virtualopensystems.com>
      d5d8184d
    • C
      KVM: ARM: Hypervisor initialization · 342cd0ab
      Christoffer Dall 提交于
      Sets up KVM code to handle all exceptions taken to Hyp mode.
      
      When the kernel is booted in Hyp mode, calling an hvc instruction with r0
      pointing to the new vectors, the HVBAR is changed to the the vector pointers.
      This allows subsystems (like KVM here) to execute code in Hyp-mode with the
      MMU disabled.
      
      We initialize other Hyp-mode registers and enables the MMU for Hyp-mode from
      the id-mapped hyp initialization code. Afterwards, the HVBAR is changed to
      point to KVM Hyp vectors used to catch guest faults and to switch to Hyp mode
      to perform a world-switch into a KVM guest.
      
      Also provides memory mapping code to map required code pages, data structures,
      and I/O regions  accessed in Hyp mode at the same virtual address as the host
      kernel virtual addresses, but which conforms to the architectural requirements
      for translations in Hyp mode. This interface is added in arch/arm/kvm/arm_mmu.c
      and comprises:
       - create_hyp_mappings(from, to);
       - create_hyp_io_mappings(from, to, phys_addr);
       - free_hyp_pmds();
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <c.dall@virtualopensystems.com>
      342cd0ab
    • C
      KVM: ARM: Initial skeleton to compile KVM support · 749cf76c
      Christoffer Dall 提交于
      Targets KVM support for Cortex A-15 processors.
      
      Contains all the framework components, make files, header files, some
      tracing functionality, and basic user space API.
      
      Only supported core is Cortex-A15 for now.
      
      Most functionality is in arch/arm/kvm/* or arch/arm/include/asm/kvm_*.h.
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <c.dall@virtualopensystems.com>
      749cf76c
    • C
      ARM: Section based HYP idmap · 9e9a367c
      Christoffer Dall 提交于
      Add a method (hyp_idmap_setup) to populate a hyp pgd with an
      identity mapping of the code contained in the .hyp.idmap.text
      section.
      
      Offer a method to drop this identity mapping through
      hyp_idmap_teardown.
      
      Make all the above depend on CONFIG_ARM_VIRT_EXT and CONFIG_ARM_LPAE.
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <c.dall@virtualopensystems.com>
      9e9a367c
    • C
      ARM: Add page table and page defines needed by KVM · cc577c26
      Christoffer Dall 提交于
      KVM uses the stage-2 page tables and the Hyp page table format,
      so we define the fields and page protection flags needed by KVM.
      
      The nomenclature is this:
       - page_hyp:        PL2 code/data mappings
       - page_hyp_device: PL2 device mappings (vgic access)
       - page_s2:         Stage-2 code/data page mappings
       - page_s2_device:  Stage-2 device mappings (vgic access)
      Reviewed-by: NWill Deacon <will.deacon@arm.com>
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Christoffer Dall <c.dall@virtualopensystems.com>
      cc577c26
  2. 19 1月, 2013 1 次提交
  3. 18 1月, 2013 2 次提交
    • M
      ARM: perf: remove unnecessary checks for idx < 0 · 8f3b90b5
      Mark Rutland 提交于
      We currently check for hwx->idx < 0 in armpmu_read and armpmu_del
      unnecessarily. The only case where hwc->idx < 0 is when armpmu_add
      fails, in which case the event's state is set to
      PERF_EVENT_STATE_INACTIVE.
      
      The perf core will not attempt to read from an event in
      PERF_EVENT_STATE_INACTIVE, and so the check in armpmu_read is
      unnecessary. Similarly, if perf core cannot add an event it will not
      attempt to delete it, so the WARN_ON in armpmu_del is unnecessary.
      
      This patch removes these two redundant checks.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      8f3b90b5
    • M
      ARM: perf: handle armpmu_register failing · 76b8a0e4
      Mark Rutland 提交于
      Currently perf_pmu_register may fail for several reasons (e.g. being
      unable to allocate memory for the struct device it associates with each
      PMU), and while any error is propagated by armpmu_register, it is
      ignored by cpu_pmu_device_probe and not propagated to the caller.  This
      also results in a leak of a struct arm_pmu.
      
      This patch adds cleanup if armpmu_register fails, and updates the info
      messages to better differentiate this type of failure from a failure to
      probe the PMU type from the hardware or dt.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      76b8a0e4
  4. 16 1月, 2013 1 次提交
  5. 15 1月, 2013 1 次提交
  6. 11 1月, 2013 2 次提交
  7. 08 1月, 2013 10 次提交
  8. 07 1月, 2013 12 次提交
  9. 06 1月, 2013 1 次提交
  10. 04 1月, 2013 4 次提交