1. 28 3月, 2017 24 次提交
    • J
      KVM: MIPS/VZ: Handle Octeon III guest.PRid register · 1f48f9be
      James Hogan 提交于
      Octeon III implements a read-only guest CP0_PRid register, so add cases
      to the KVM register access API for Octeon to ensure the correct value is
      read and writes are ignored.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      1f48f9be
    • J
      MIPS: Add Octeon III register accessors & definitions · 7d8a528d
      James Hogan 提交于
      Add accessors for some VZ related Cavium Octeon III specific COP0
      registers, along with field definitions. These will mostly be used by
      KVM to set up interrupt routing and partition the TLB between root and
      guest.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      7d8a528d
    • J
      KVM: MIPS/VZ: Support hardware guest timer · f4474d50
      James Hogan 提交于
      Transfer timer state to the VZ guest context (CP0_GTOffset & guest
      CP0_Count) when entering guest mode, enabling direct guest access to it,
      and transfer back to soft timer when saving guest register state.
      
      This usually allows guest code to directly read CP0_Count (via MFC0 and
      RDHWR) and read/write CP0_Compare, without trapping to the hypervisor
      for it to emulate the guest timer. Writing to CP0_Count or CP0_Cause.DC
      is much less common and still triggers a hypervisor GPSI exception, in
      which case the timer state is transferred back to an hrtimer before
      emulating the write.
      
      We are careful to prevent small amounts of drift from building up due to
      undeterministic time intervals between reading of the ktime and reading
      of CP0_Count. Some drift is expected however, since the system
      clocksource may use a different timer to the local CP0_Count timer used
      by VZ. This is permitted to prevent guest CP0_Count from appearing to go
      backwards.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      f4474d50
    • J
      KVM: MIPS/VZ: Emulate MAARs when necessary · d42a008f
      James Hogan 提交于
      Add emulation of Memory Accessibility Attribute Registers (MAARs) when
      necessary. We can't actually do anything with whatever the guest
      provides, but it may not be possible to clear Guest.Config5.MRP so we
      have to emulate at least a pair of MAARs.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      d42a008f
    • J
      KVM: MIPS/VZ: Support guest hardware page table walker · 5a2f352f
      James Hogan 提交于
      Add support for VZ guest CP0_PWBase, CP0_PWField, CP0_PWSize, and
      CP0_PWCtl registers for controlling the guest hardware page table walker
      (HTW) present on P5600 and P6600 cores. These guest registers need
      initialising on R6, context switching, and exposing via the KVM ioctl
      API when they are present.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      5a2f352f
    • J
      KVM: MIPS/VZ: Support guest segmentation control · 4b7de028
      James Hogan 提交于
      Add support for VZ guest CP0_SegCtl0, CP0_SegCtl1, and CP0_SegCtl2
      registers, as found on P5600 and P6600 cores. These guest registers need
      initialising, context switching, and exposing via the KVM ioctl API when
      they are present.
      
      They also require the GVA -> GPA translation code for handling a GVA
      root exception to be updated to interpret the segmentation registers and
      decode the faulting instruction enough to detect EVA memory access
      instructions.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      4b7de028
    • J
      KVM: MIPS/VZ: Support guest CP0_[X]ContextConfig · dffe042f
      James Hogan 提交于
      Add support for VZ guest CP0_ContextConfig and CP0_XContextConfig
      (MIPS64 only) registers, as found on P5600 and P6600 cores. These guest
      registers need initialising, context switching, and exposing via the KVM
      ioctl API when they are present.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      dffe042f
    • J
      KVM: MIPS/VZ: Support guest CP0_BadInstr[P] · edc89260
      James Hogan 提交于
      Add support for VZ guest CP0_BadInstr and CP0_BadInstrP registers, as
      found on most VZ capable cores. These guest registers need context
      switching, and exposing via the KVM ioctl API when they are present.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      edc89260
    • J
      KVM: MIPS: Implement VZ support · c992a4f6
      James Hogan 提交于
      Add the main support for the MIPS Virtualization ASE (A.K.A. VZ) to MIPS
      KVM. The bulk of this work is in vz.c, with various new state and
      definitions elsewhere.
      
      Enough is implemented to be able to run on a minimal VZ core. Further
      patches will fill out support for guest features which are optional or
      can be disabled.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      c992a4f6
    • J
      KVM: MIPS/TLB: Add VZ TLB management · 372582a6
      James Hogan 提交于
      Add functions for MIPS VZ TLB management to tlb.c.
      
      kvm_vz_host_tlb_inv() will be used for invalidating root TLB entries
      after GPA page tables have been modified due to a KVM page fault. It
      arranges for a root GPA mapping to be flushed from the TLB, using the
      gpa_mm ASID or the current GuestID to do the probe.
      
      kvm_vz_local_flush_roottlb_all_guests() and
      kvm_vz_local_flush_guesttlb_all() flush all TLB entries in the
      corresponding TLB for guest mappings (GPA->RPA for root TLB with
      GuestID, and all entries for guest TLB). They will be used when starting
      a new GuestID cycle, when VZ hardware is enabled/disabled, and also when
      switching to a guest when the guest TLB contents may be stale or belong
      to a different VM.
      
      kvm_vz_guest_tlb_lookup() converts a guest virtual address to a guest
      physical address using the guest TLB. This will be used to decode guest
      virtual addresses which are sometimes provided by VZ hardware in
      CP0_BadVAddr for certain exceptions when the guest physical address is
      unavailable.
      
      kvm_vz_save_guesttlb() and kvm_vz_load_guesttlb() will be used to
      preserve wired guest VTLB entries while a guest isn't running.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      372582a6
    • J
      KVM: MIPS/Entry: Update entry code to support VZ · 1934a3ad
      James Hogan 提交于
      Update MIPS KVM entry code to support VZ:
      
       - We need to set GuestCtl0.GM while in guest mode.
      
       - For cores supporting GuestID, we need to set the root GuestID to
         match the main GuestID while in guest mode so that the root TLB
         refill handler writes the correct GuestID into the TLB.
      
       - For cores without GuestID where the root ASID dealiases RVA/GPA
         mappings, we need to load that ASID from the gpa_mm rather than the
         per-VCPU guest_kernel_mm or guest_user_mm, since the root TLB maps
         guest physical addresses. We also need to restore the normal process
         ASID on exit.
      
       - The normal linux process pgd needs restoring on exit, as we can't
         leave the GPA mappings active for kernel code.
      
       - GuestCtl0 needs saving on exit for the GExcCode field, as it may be
         clobbered if a preemption occurs.
      
      We also need to move the TLB refill handler to the XTLB vector at offset
      0x80 on 64-bit VZ kernels, as hardware will use Root.Status.KX to
      determine whether a TLB refill or XTLB Refill exception is to be taken
      on a root TLB miss from guest mode, and KX needs to be set for kernel
      code to be able to access the 64-bit segments.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      1934a3ad
    • J
      KVM: MIPS: Abstract guest CP0 register access for VZ · a27660f3
      James Hogan 提交于
      Abstract the MIPS KVM guest CP0 register access macros into inline
      functions which are generated by macros. This allows them to be
      generated differently for VZ, where they will usually need to access the
      hardware guest CP0 context rather than the saved values in RAM.
      
      Accessors for each individual register are generated using these macros:
      
       - __BUILD_KVM_*_SW() for registers which are not present in the VZ
         hardware guest context, so kvm_{read,write}_c0_guest_##name() will
         access the saved value in RAM regardless of whether VZ is enabled.
      
       - __BUILD_KVM_*_HW() for registers which are present in the VZ hardware
         guest context, so kvm_{read,write}_c0_guest_##name() will access the
         hardware register when VZ is enabled.
      
      These build the underlying accessors using further macros:
      
       - __BUILD_KVM_*_SAVED() builds e.g. kvm_{read,write}_sw_gc0_##name()
         functions for accessing the saved versions of the registers in RAM.
         This is used for implementing the common
         kvm_{read,write}_c0_guest_##name() accessors with T&E where registers
         are always stored in RAM, but are also available with VZ HW registers
         to allow them to be accessed while saved.
      
       - __BUILD_KVM_*_VZ() builds e.g. kvm_{read,write}_vz_gc0_##name()
         functions for accessing the VZ hardware guest context registers
         directly. This is used for implementing the common
         kvm_{read,write}_c0_guest_##name() accessors with VZ.
      
       - __BUILD_KVM_*_WRAP() builds wrappers with different names, which
         allows the common kvm_{read,write}_c0_guest_##name() functions to be
         implemented using the VZ accessors while still having the SAVED
         accessors available too.
      
       - __BUILD_KVM_SAVE_VZ() builds functions for saving and restoring VZ
         hardware guest context register state to RAM, improving conciseness
         of VZ context saving and restoring.
      
      Similar macros exist for generating modifiers (set, clear, change),
      either with a normal unlocked read/modify/write, or using atomic LL/SC
      sequences.
      
      These changes change the types of 32-bit registers to u32 instead of
      unsigned long, which requires some changes to printk() functions in MIPS
      KVM.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      a27660f3
    • J
      KVM: MIPS: Add guest exit exception callback · 28c1e762
      James Hogan 提交于
      Add a callback for MIPS KVM implementations to handle the VZ guest
      exit exception. Currently the trap & emulate implementation contains a
      stub which reports an internal error, but the callback will be used
      properly by the VZ implementation.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      28c1e762
    • J
      KVM: MIPS: Add hardware_{enable,disable} callback · edab4fe1
      James Hogan 提交于
      Add an implementation callback for the kvm_arch_hardware_enable() and
      kvm_arch_hardware_disable() architecture functions, with simple stubs
      for trap & emulate. This is in preparation for VZ which will make use of
      them.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      edab4fe1
    • J
      KVM: MIPS: Add callback to check extension · 607ef2fd
      James Hogan 提交于
      Add an implementation callback for checking presence of KVM extensions.
      This allows implementation specific extensions to be provided without
      ifdefs in mips.c.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      607ef2fd
    • J
      KVM: MIPS: Init timer frequency from callback · a517c1ad
      James Hogan 提交于
      Currently the software emulated timer is initialised to a frequency of
      100MHz by kvm_mips_init_count(), but this isn't suitable for VZ where
      the frequency of the guest timer matches that of the host.
      
      Add a count_hz argument so the caller can specify the default frequency,
      and move the call from kvm_arch_vcpu_create() to the implementation
      specific vcpu_setup() callback, so that VZ can specify a different
      frequency.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      a517c1ad
    • J
      KVM: MIPS: Extend counters & events for VZ GExcCodes · a7244920
      James Hogan 提交于
      Extend MIPS KVM stats counters and kvm_transition trace event codes to
      cover hypervisor exceptions, which have their own GExcCode field in
      CP0_GuestCtl0 with up to 32 hypervisor exception cause codes.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      a7244920
    • J
      KVM: MIPS: Implement HYPCALL emulation · 955d8dc3
      James Hogan 提交于
      Emulate the HYPCALL instruction added in the VZ ASE and used by the MIPS
      paravirtualised guest support that is already merged. The new hypcall.c
      handles arguments and the return value. No actual hypercalls are yet
      supported, but this still allows us to safely step over hypercalls and
      set an error code in the return value for forward compatibility.
      
      Non-zero HYPCALL codes are not handled.
      
      We also document the hypercall ABI which asm/kvm_para.h uses.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      955d8dc3
    • J
      MIPS: asm/tlb.h: Add UNIQUE_GUEST_ENTRYHI() macro · a6c09b9f
      James Hogan 提交于
      Add a distinct UNIQUE_GUEST_ENTRYHI() macro for invalidation of guest
      TLB entries by KVM, using addresses in KSeg1 rather than KSeg0. This
      avoids conflicts with guest invalidation routines when there is no EHINV
      bit to mark the whole entry as invalid, avoiding guest machine check
      exceptions on Cavium Octeon III.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      a6c09b9f
    • J
      MIPS: Add some missing guest CP0 accessors & defs · eb0bab38
      James Hogan 提交于
      Add some missing guest accessors and register field definitions for KVM
      for MIPS VZ to make use of.
      
      Guest CP0_LLAddr register accessors and definitions for the LLB field
      allow KVM to clear the guest LLB to cancel in-progress LL/SC atomics on
      restore, and to emulate accesses by the guest to the CP0_LLAddr
      register.
      
      Bitwise modifiers and definitions for the guest CP0_Wired and
      CP0_Config1 registers allow KVM to modify fields within the CP0_Wired
      and CP0_Config1 registers.
      
      Finally a definition for the CP0_Config5.SBRI bit allows KVM to
      initialise and allow modification of the guest version of the SBRI bit.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      eb0bab38
    • J
      MIPS: Probe guest MVH · a929bdc5
      James Hogan 提交于
      Probe for availablility of M{T,F}HC0 instructions used with e.g. XPA in
      the VZ guest context, and make it available via cpu_guest_has_mvh. This
      will be helpful in properly emulating the MAAR registers in KVM for MIPS
      VZ.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      a929bdc5
    • J
      MIPS: Probe guest CP0_UserLocal · a7c7ad6c
      James Hogan 提交于
      Probe for presence of guest CP0_UserLocal register and expose via
      cpu_guest_has_userlocal. This register is optional pre-r6, so this will
      allow KVM to only save/restore/expose the guest CP0_UserLocal register
      if it exists.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      a7c7ad6c
    • J
      MIPS: Separate MAAR V bit into VL and VH for XPA · f359a111
      James Hogan 提交于
      The MAAR V bit has been renamed VL since another bit called VH is added
      at the top of the register when it is extended to 64-bits on a 32-bit
      processor with XPA. Rename the V definition, fix the various users, and
      add definitions for the VH bit. Also add a definition for the MAARI
      Index field.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      f359a111
    • J
      MIPS: Add defs & probing of UFR · 4e87580e
      James Hogan 提交于
      Add definitions and probing of the UFR bit in Config5. This bit allows
      user mode control of the FR bit (floating point register mode). It is
      present if the UFRP bit is set in the floating point implementation
      register.
      
      This is a capability KVM may want to expose to guest kernels, even
      though Linux is unlikely to ever use it due to the implications for
      multi-threaded programs.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NRalf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      4e87580e
  2. 10 3月, 2017 1 次提交
  3. 08 3月, 2017 1 次提交
  4. 02 3月, 2017 3 次提交
  5. 28 2月, 2017 1 次提交
    • L
      kprobes: move kprobe declarations to asm-generic/kprobes.h · 7d134b2c
      Luis R. Rodriguez 提交于
      Often all is needed is these small helpers, instead of compiler.h or a
      full kprobes.h.  This is important for asm helpers, in fact even some
      asm/kprobes.h make use of these helpers...  instead just keep a generic
      asm file with helpers useful for asm code with the least amount of
      clutter as possible.
      
      Likewise we need now to also address what to do about this file for both
      when architectures have CONFIG_HAVE_KPROBES, and when they do not.  Then
      for when architectures have CONFIG_HAVE_KPROBES but have disabled
      CONFIG_KPROBES.
      
      Right now most asm/kprobes.h do not have guards against CONFIG_KPROBES,
      this means most architecture code cannot include asm/kprobes.h safely.
      Correct this and add guards for architectures missing them.
      Additionally provide architectures that not have kprobes support with
      the default asm-generic solution.  This lets us force asm/kprobes.h on
      the header include/linux/kprobes.h always, but most importantly we can
      now safely include just asm/kprobes.h on architecture code without
      bringing the full kitchen sink of header files.
      
      Two architectures already provided a guard against CONFIG_KPROBES on its
      kprobes.h: sh, arch.  The rest of the architectures needed gaurds added.
      We avoid including any not-needed headers on asm/kprobes.h unless
      kprobes have been enabled.
      
      In a subsequent atomic change we can try now to remove compiler.h from
      include/linux/kprobes.h.
      
      During this sweep I've also identified a few architectures defining a
      common macro needed for both kprobes and ftrace, that of the definition
      of the breakput instruction up.  Some refer to this as
      BREAKPOINT_INSTRUCTION.  This must be kept outside of the #ifdef
      CONFIG_KPROBES guard.
      
      [mcgrof@kernel.org: fix arm64 build]
        Link: http://lkml.kernel.org/r/CAB=NE6X1WMByuARS4mZ1g9+W=LuVBnMDnh_5zyN0CLADaVh=Jw@mail.gmail.com
      [sfr@canb.auug.org.au: fixup for kprobes declarations moving]
        Link: http://lkml.kernel.org/r/20170214165933.13ebd4f4@canb.auug.org.au
      Link: http://lkml.kernel.org/r/20170203233139.32682-1-mcgrof@kernel.orgSigned-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7d134b2c
  6. 17 2月, 2017 1 次提交
  7. 14 2月, 2017 3 次提交
  8. 03 2月, 2017 6 次提交
    • J
      KVM: MIPS: Allow multiple VCPUs to be created · 12ed1fae
      James Hogan 提交于
      Increase the maximum number of MIPS KVM VCPUs to 8, and implement the
      KVM_CAP_NR_VCPUS and KVM_CAP_MAX_CPUS capabilities which expose the
      recommended and maximum number of VCPUs to userland. The previous
      maximum of 1 didn't allow for any form of SMP guests.
      
      We calculate the values similarly to ARM, recommending as many VCPUs as
      there are CPUs online in the system. This will allow userland to know
      how many VCPUs it is possible to create.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      12ed1fae
    • J
      KVM: MIPS/T&E: Expose read-only CP0_IntCtl register · ad58d4d4
      James Hogan 提交于
      Expose the CP0_IntCtl register through the KVM register access API,
      which is a required register since MIPS32r2. It is currently read-only
      since the VS field isn't implemented due to lack of Config3.VInt or
      Config3.VEIC.
      
      It is implemented in trap_emul.c so that a VZ implementation can allow
      writes.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      ad58d4d4
    • J
      KVM: MIPS/T&E: Expose CP0_EntryLo0/1 registers · 013044cc
      James Hogan 提交于
      Expose the CP0_EntryLo0 and CP0_EntryLo1 registers through the KVM
      register access API. This is fairly straightforward for trap & emulate
      since we don't support the RI and XI bits. For the sake of future
      proofing (particularly for VZ) it is explicitly specified that the API
      always exposes the 64-bit version of these registers (i.e. with the RI
      and XI bits in bit positions 63 and 62 respectively), and they are
      implemented in trap_emul.c rather than mips.c to allow them to be
      implemented differently for VZ.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      013044cc
    • J
      KVM: MIPS/T&E: Implement CP0_EBase register · 7801bbe1
      James Hogan 提交于
      The CP0_EBase register is a standard feature of MIPS32r2, so we should
      always have been implementing it properly. However the register value
      was ignored and wasn't exposed to userland.
      
      Fix the emulation of exceptions and interrupts to use the value stored
      in guest CP0_EBase, and fix the masks so that the top 3 bits (rather
      than the standard 2) are fixed, so that it is always in the guest KSeg0
      segment.
      
      Also add CP0_EBASE to the KVM one_reg interface so it can be accessed by
      userland, also allowing the CPU number field to be written (which isn't
      permitted by the guest).
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      7801bbe1
    • J
      KVM: MIPS/T&E: Move CP0 register access into T&E · 654229a0
      James Hogan 提交于
      Access to various CP0 registers via the KVM register access API needs to
      be implementation specific to allow restrictions to be made on changes,
      for example when VZ guest registers aren't present, so move them all
      into trap_emul.c in preparation for VZ.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      654229a0
    • J
      KVM: MIPS: Claim KVM_CAP_READONLY_MEM support · 230c5724
      James Hogan 提交于
      Now that load/store faults due to read only memory regions are treated
      as MMIO accesses it is safe to claim support for read only memory
      regions (KVM_CAP_READONLY_MEM).
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Radim Krčmář" <rkrcmar@redhat.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: kvm@vger.kernel.org
      230c5724