1. 30 8月, 2017 4 次提交
    • P
      MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers · e83f7e02
      Paul Burton 提交于
      With Coherence Manager (CM) 3.5 information about the topology of the
      system, which has previously only been available through & accessed from
      the CM, is now also provided by the Cluster Power Controller (CPC). This
      includes a new CPC_CONFIG register mirroring GCR_CONFIG, and similarly a
      new CPC_Cx_CONFIG register mirroring GCR_Cx_CONFIG.
      
      In preparation for adjusting functions such as mips_cm_numcores(), which
      have previously only needed to access the CM, to also access the CPC
      this patch modifies the way we use the various CPS headers. Rather than
      having users include asm/mips-cm.h or asm/mips-cpc.h individually we
      instead have users include asm/mips-cps.h which in turn includes
      asm/mips-cm.h & asm/mips-cpc.h. This means that users will gain access
      to both CM & CPC registers by including one header, and most importantly
      it makes asm/mips-cps.h an ideal location for helper functions which
      need to access the various components of the CPS.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17015/
      Patchwork: https://patchwork.linux-mips.org/patch/17217/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e83f7e02
    • P
      MIPS: CM: Add cluster & block args to mips_cm_lock_other() · 68923cdc
      Paul Burton 提交于
      With CM >= 3.5 we have the notion of multiple clusters & can access
      their CM, CPC & GIC registers via the apporpriate redirect/other
      register blocks. In order to allow for this introduce cluster & block
      arguments to mips_cm_lock_other() which configures the redirect/other
      region to point at the appropriate cluster, core, VP & register block.
      
      Since we now have 4 arguments to mips_cm_lock_other() & a common use is
      likely to be to target the cluster, core & VP corresponding to a
      particular Linux CPU number we also add a new mips_cm_lock_other_cpu()
      helper function which handles that without the caller needing to
      manually pull out the cluster, core & VP numbers.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17013/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      68923cdc
    • P
      MIPS: Abstract CPU core & VP(E) ID access through accessor functions · f875a832
      Paul Burton 提交于
      We currently have fields in struct cpuinfo_mips for the core & VP(E) ID
      of a particular CPU, and various pieces of code directly access those
      fields. This patch abstracts such access by introducing accessor
      functions cpu_core(), cpu_set_core(), cpu_vpe_id() & cpu_set_vpe_id()
      and having code that needs to access these values call those functions
      rather than directly accessing the struct cpuinfo_mips fields. This
      prepares us for changes to the way in which those values are stored in
      later patches.
      
      The cpu_vpe_id() function is introduced even though we already had a
      cpu_vpe_id() macro for a couple of reasons:
      
        1) It's more consistent with the core, and future cluster, accessors.
      
        2) It ensures a sensible return type without explicit casts.
      
        3) It's generally preferable to use functions rather than macros.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17009/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f875a832
    • P
      MIPS: CPS: Use change_*, set_* & clear_* where appropriate · 846e1913
      Paul Burton 提交于
      Make use of the new change_*, set_* & clear_* accessor functions for CPS
      (CM, CPC & GIC) registers where doing so makes the code easier to read
      or shortens it without adversely affecting readability.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17005/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      846e1913
  2. 29 8月, 2017 3 次提交
    • P
      MIPS: CM: Use BIT/GENMASK for register fields, order & drop shifts · 93c5bba5
      Paul Burton 提交于
      There's no reason for us not to use BIT() & GENMASK() in asm/mips-cm.h
      when declaring macros corresponding to register fields. This patch
      modifies our definitions to do so.
      
      The *_SHF definitions are removed entirely - they duplicate information
      found in the masks, are infrequently used & can be replaced with use of
      __ffs() where needed.
      
      The *_MSK definitions then lose their _MSK suffix which is now somewhat
      redundant, and users are modified to match.
      
      The field definitions are moved to follow the appropriate register's
      accessor functions, which helps to keep the field definitions in order &
      to find the appropriate fields for a given register. Whilst here a
      comment is added describing each register & including its name, which is
      helpful both for linking the register back to hardware documentation &
      for grepping purposes.
      
      This also cleans up a couple of issues that became obvious as a result
      of making the changes described above:
      
        - We previously had definitions for GCR_Cx_RESET_EXT_BASE & a phony
          copy of that named GCR_RESET_EXT_BASE - a register which does not
          exist. The bad definitions were added by commit 497e803e ("MIPS:
          smp-cps: Ensure secondary cores start with EVA disabled") and made
          use of from boot_core(), which is now modified to use the
          GCR_Cx_RESET_EXT_BASE definitions.
      
        - We had a typo in CM_GCR_ERROR_CAUSE_ERRINGO_MSK - we now correctly
          define this as inFo rather than inGo.
      
      Now that we don't duplicate field information between _SHF & _MSK
      definitions, and keep the fields next to the register accessors, it will
      be much easier to spot & prevent any similar oddities being introduced
      in the future.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Acked-by: Thomas Gleixner <tglx@linutronix.de
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17001/
      Patchwork: https://patchwork.linux-mips.org/patch/17216/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      93c5bba5
    • P
      MIPS: CM: Specify register size when generating accessors · b025d518
      Paul Burton 提交于
      Some CM registers are always 32 bits, or at least only use bits in the
      lower 32 bits of the register. For these registers it is wasteful for us
      to generate accessors which bother to check mips_cm_is64 & perform 64
      bit accesses.
      
      This patch modifies the accessor generation to take into account the
      size of the register, and for 32 bit registers we generate accessors
      which only ever perform 32 bit accesses. For 64 bit registers we either
      perform a 64 bit access or two 32 bit accesses, depending upon the value
      of mips_cm_is64. Doing this saves us ~1.5KiB of code in a generic 64r6el
      kernel, and perhaps more importantly simplifies various code paths.
      
      This removes the read64_gcr_* accessors, so mips_cm_error_report() is
      modified to stop using them & instead use the regular read_gcr_*
      accessors which will return 64 bit values from the 64 bit registers.
      
      The new accessor macros are placed in asm/mips-cps.h such that they can
      be shared by CPC & GIC code in later patches.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17000/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b025d518
    • P
      MIPS: CM: Rename mips_cm_base to mips_gcr_base · abe852ea
      Paul Burton 提交于
      We currently have a mips_cm_base variable which holds the base address
      of the Coherence Manager (CM) Global Configuration Registers (GCRs), and
      accessor functions which use the GCR in their names. This works fine,
      but gets in the way of sharing the code to generate the accessor
      functions with other blocks (ie. CPC & GIC) because that code would then
      need to separately handle the name of the base address variable & the
      name used in the accessor functions.
      
      In order to prepare for sharing the accessor generation code between CM,
      CPC & GIC code this patch renames mips_cm_base to mips_gcr_base such
      that the "gcr" portion is common to both the base address variable & the
      accessor function names.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16999/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      abe852ea
  3. 29 6月, 2017 2 次提交
  4. 04 8月, 2016 1 次提交
    • M
      tree-wide: replace config_enabled() with IS_ENABLED() · 97f2645f
      Masahiro Yamada 提交于
      The use of config_enabled() against config options is ambiguous.  In
      practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the
      author might have used it for the meaning of IS_ENABLED().  Using
      IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc.  makes the intention
      clearer.
      
      This commit replaces config_enabled() with IS_ENABLED() where possible.
      This commit is only touching bool config options.
      
      I noticed two cases where config_enabled() is used against a tristate
      option:
      
       - config_enabled(CONFIG_HWMON)
        [ drivers/net/wireless/ath/ath10k/thermal.c ]
      
       - config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)
        [ drivers/gpu/drm/gma500/opregion.c ]
      
      I did not touch them because they should be converted to IS_BUILTIN()
      in order to keep the logic, but I was not sure it was the authors'
      intention.
      
      Link: http://lkml.kernel.org/r/1465215656-20569-1-git-send-email-yamada.masahiro@socionext.comSigned-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Stas Sergeev <stsp@list.ru>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: "Dmitry V. Levin" <ldv@altlinux.org>
      Cc: yu-cheng yu <yu-cheng.yu@intel.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Nikolay Martynov <mar.kolya@gmail.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Rafal Milecki <zajec5@gmail.com>
      Cc: James Cowgill <James.Cowgill@imgtec.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Alex Smith <alex.smith@imgtec.com>
      Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
      Cc: Qais Yousef <qais.yousef@imgtec.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Roland McGrath <roland@hack.frob.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Kalle Valo <kvalo@qca.qualcomm.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Tony Wu <tung7970@gmail.com>
      Cc: Huaitong Han <huaitong.han@intel.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrea Gelmini <andrea.gelmini@gelma.net>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: "Maciej W. Rozycki" <macro@imgtec.com>
      Cc: David Daney <david.daney@cavium.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      97f2645f
  5. 03 4月, 2016 1 次提交
  6. 11 11月, 2015 2 次提交
  7. 26 10月, 2015 3 次提交
  8. 26 8月, 2015 4 次提交
  9. 25 11月, 2014 1 次提交
  10. 07 3月, 2014 1 次提交
    • P
      MIPS: Add generic CM probe & access code · 9f98f3dd
      Paul Burton 提交于
      The kernel currently only probes for a MIPS Coherence Manager in the
      Malta interrupt code in order to detect & enable the GIC. However CM is
      not Malta-specific, so this should really be more generic. This patch
      introduces some non-Malta-specific code which probes for a CM and
      performs some basic initialisation.
      
      A new header, with temporarily duplicated register definitions, is
      introduced in order to:
      
        1) Allow the new definitions to be correct with regards to the
           CM documentation, as many of those in gcmpregs.h aren't.
      
        2) Allow switching away from the REG() macro used via a few layers of
           nested macros in order to access registers in gcmpregs.h. This
           patch instead introduced accessor functions akin to the
           {read,write}_c0_* functions used for cop0 registers.
      
        3) Allow users of the CM to be migrated one by one.
      
        4) Switch from the name 'GCMP' to 'CM' since the Coherence Manager is
           what this code is actually dealing with.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/6360/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      9f98f3dd