1. 19 Jul, 2019 14 commits
    • Guo Ren's avatar
      csky: Fixup abiv1 memset error · bdfeb0cc
      Guo Ren authored
      Current memset implementation in abiv1 is wrong and it'll cause unalign
      access. Just remove it and use the generic one. This patch will cause
      performance degradation and we will improve it with a new design in next
      patchset.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      bdfeb0cc
    • Guo Ren's avatar
      csky: Improve tlb operation with help of asid · 4e562c11
      Guo Ren authored
      There are two generations of tlb operation instruction for C-SKY.
      First generation is use mcr register and it need software do more
      things, second generation is use specific instructions, eg:
       tlbi.va, tlbi.vas, tlbi.alls
      
      We implemented the following functions:
      
       - flush_tlb_range (a range of entries)
       - flush_tlb_page (one entry)
      
       Above functions use asid from vma->mm to invalid tlb entries and
       we could use tlbi.vas instruction for newest generation csky cpu.
      
       - flush_tlb_kernel_range
       - flush_tlb_one
      
       Above functions don't care asid and it invalid the tlb entries only
       with vpn and we could use tlbi.vaas instruction for newest generat-
       ion csky cpu.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      4e562c11
    • Guo Ren's avatar
      csky: Use generic asid algorithm to implement switch_mm · 22d55f02
      Guo Ren authored
      Use linux generic asid/vmid algorithm to implement csky
      switch_mm function. The algorithm is from arm and it could
      work with SMP system. It'll help reduce tlb flush for
      switch_mm in task/vm switch.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      22d55f02
    • Guo Ren's avatar
      csky: Add new asid lib code from arm · a231b883
      Guo Ren authored
      This patch only contains asid help code from arm for next patch to
      use.
      
      The asid allocator use five level check to reduce the cost of
      switch_mm.
      
       1. Check if the asid version is the same (it's general)
       2. Check reserved_asid which is set in rollover flush_context()
          and key point is to keep the same bit position with the current
          asid version instead of input version.
       3. Check if the position of bitmap is free then it could be set &
          used directly.
       4. find_next_zero_bit() (a little performance cost)
       5. flush_context  (this is the worst cost with increase current asid
          version)
      
      Check is level by level and cost is also higher with the next level.
      The reserved_asid and bitmap mechanism prevent unnecessary
      find_next_zero_bit().
      
      The atomic 64 bit asid is also suitable for 32-bit system and it
      won't cost a lot in 1th 2th 3th level check.
      
      The operation of set/clear mm_cpumask was removed in arm64 compared to
      arm32. It seems no side effect on current arm64 system, but from
      software meaning it's wrong. Although csky also needn't it, we add it
      back for csky.
      
      The asid_per_ctxt is no use for csky and it reserves the lowest bits for
      other use, maybe: trust zone ? Ok, just keep it in csky copy.
      
      Seems it also could be used by other archs and it's worth to move asid
      code to generic in future.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Julien Grall <julien.grall@arm.com>
      a231b883
    • Guo Ren's avatar
      csky: Revert mmu ASID mechanism · 9d35dc30
      Guo Ren authored
      Current C-SKY ASID mechanism is from mips and it doesn't work well
      with multi-cores. ASID per core mechanism is not suitable for C-SKY
      SMP tlb maintain operations, eg: tlbi.vas need share the same asid
      in all processors and it'll invalid the tlb entry in all cores with
      the same asid.
      
      This patch is prepare for new ASID mechanism.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      9d35dc30
    • Mao Han's avatar
      dt-bindings: csky: Add csky PMU bindings · 4d581034
      Mao Han authored
      This patch adds the documentation to describe that how to add pmu node in
      dts.
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      4d581034
    • Guo Ren's avatar
      dt-bindings: interrupt-controller: Update csky mpintc · 69d812f5
      Guo Ren authored
      Add trigger type setting for csky,mpintc. The driver also could
      support #interrupt-cells <1> and it wouldn't invalidate existing
      DTs. Here we only show the complete format.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Reviewed-by: default avatarRob Herring <robh+dt@kernel.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      69d812f5
    • Guo Ren's avatar
      csky: Fixup some error count in 810 & 860. · e7534198
      Guo Ren authored
      CK810 pmu only support event with index 0-8 and 0xd; CK860 only
      support event 1~4, 0xa~0x1b. So do not register unsupport event
      to hardware cache event, which may leader to unknown behavior.
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      e7534198
    • Mao Han's avatar
      csky: Fix perf record in kernel/user space · d41435d9
      Mao Han authored
      csky_pmu_event_init is called several times during the perf record
      initialzation. After configure the event counter in either kernel
      space or user space, csky_pmu_event_init is called twice with no
      attr specified. Configuration will be overwritten with sampling in
      both kernel space and user space. --all-kernel/--all-user is
      useless without this patch applied.
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      d41435d9
    • Mao Han's avatar
      csky: Add pmu interrupt support · f622fbf2
      Mao Han authored
      This patch add interrupt request and handler for csky pmu.
      perf can record on hardware event with this patch applied.
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      f622fbf2
    • Mao Han's avatar
      csky: Add count-width property for csky pmu · ccffa1ad
      Mao Han authored
      The csky pmu counter may have different io width. When the counter is
      smaller then 64 bits and counter value is smaller than the old value, it
      will result to a extremely large delta value. So the sampled value should
      be extend to 64 bits to avoid this, the extension bits base on the
      count-width property from dts.
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      ccffa1ad
    • Mao Han's avatar
      csky: Init pmu as a device · f132076c
      Mao Han authored
      This patch change the csky pmu initialization from arch init to
      device init. The pmu can be configued with information from
      device tree(pmu device name, irq number and etc.).
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      f132076c
    • Guo Ren's avatar
      csky: Fixup no panic in kernel for some traps · 3158d289
      Guo Ren authored
      These traps couldn't be hanppen in kernel and we must panic there not
      send a signal to userspace.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      3158d289
    • Guo Ren's avatar
      csky: Select intc & timer drivers · 1994cc49
      Guo Ren authored
      Let arch help to select interrupt controller's and timer's drivers
      instead of people using menuconfig to select. This help the mini system
      boot up.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      1994cc49
  2. 30 Jun, 2019 3 commits
  3. 29 Jun, 2019 23 commits