mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 11:15:10 +07:00
3a6bfbc91d
The arch_mutex_cpu_relax() function, introduced by 34b133f
, is
hacky and ugly. It was added a few years ago to address the fact
that common cpu_relax() calls include yielding on s390, and thus
impact the optimistic spinning functionality of mutexes. Nowadays
we use this function well beyond mutexes: rwsem, qrwlock, mcs and
lockref. Since the macro that defines the call is in the mutex header,
any users must include mutex.h and the naming is misleading as well.
This patch (i) renames the call to cpu_relax_lowlatency ("relax, but
only if you can do it with very low latency") and (ii) defines it in
each arch's asm/processor.h local header, just like for regular cpu_relax
functions. On all archs, except s390, cpu_relax_lowlatency is simply cpu_relax,
and thus we can take it out of mutex.h. While this can seem redundant,
I believe it is a good choice as it allows us to move out arch specific
logic from generic locking primitives and enables future(?) archs to
transparently define it, similarly to System Z.
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Bharat Bhushan <r65777@freescale.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: David Howells <dhowells@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Joe Perches <joe@perches.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Joseph Myers <joseph@codesourcery.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: Qiaowei Ren <qiaowei.ren@intel.com>
Cc: Rafael Wysocki <rafael.j.wysocki@intel.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Steven Miao <realmz6@gmail.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Stratos Karafotis <stratosk@semaphore.gr>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vasily Kulikov <segoon@openwall.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: Waiman Long <Waiman.Long@hp.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: adi-buildroot-devel@lists.sourceforge.net
Cc: linux390@de.ibm.com
Cc: linux-alpha@vger.kernel.org
Cc: linux-am33-list@redhat.com
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-cris-kernel@axis.com
Cc: linux-hexagon@vger.kernel.org
Cc: linux-ia64@vger.kernel.org
Cc: linux@lists.openrisc.net
Cc: linux-m32r-ja@ml.linux-m32r.org
Cc: linux-m32r@ml.linux-m32r.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-metag@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: sparclinux@vger.kernel.org
Link: http://lkml.kernel.org/r/1404079773.2619.4.camel@buesod1.americas.hpqcorp.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
185 lines
4.4 KiB
C
185 lines
4.4 KiB
C
#ifndef __ASM_SH_PROCESSOR_H
|
|
#define __ASM_SH_PROCESSOR_H
|
|
|
|
#include <asm/cpu-features.h>
|
|
#include <asm/segment.h>
|
|
#include <asm/cache.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
/*
|
|
* CPU type and hardware bug flags. Kept separately for each CPU.
|
|
*
|
|
* Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry
|
|
* in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c
|
|
* for parsing the subtype in get_cpu_subtype().
|
|
*/
|
|
enum cpu_type {
|
|
/* SH-2 types */
|
|
CPU_SH7619,
|
|
|
|
/* SH-2A types */
|
|
CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_SH7264, CPU_SH7269,
|
|
CPU_MXG,
|
|
|
|
/* SH-3 types */
|
|
CPU_SH7705, CPU_SH7706, CPU_SH7707,
|
|
CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
|
|
CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
|
|
CPU_SH7720, CPU_SH7721, CPU_SH7729,
|
|
|
|
/* SH-4 types */
|
|
CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
|
|
CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
|
|
|
|
/* SH-4A types */
|
|
CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786,
|
|
CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SH7734, CPU_SHX3,
|
|
|
|
/* SH4AL-DSP types */
|
|
CPU_SH7343, CPU_SH7722, CPU_SH7366, CPU_SH7372,
|
|
|
|
/* SH-5 types */
|
|
CPU_SH5_101, CPU_SH5_103,
|
|
|
|
/* Unknown subtype */
|
|
CPU_SH_NONE
|
|
};
|
|
|
|
enum cpu_family {
|
|
CPU_FAMILY_SH2,
|
|
CPU_FAMILY_SH2A,
|
|
CPU_FAMILY_SH3,
|
|
CPU_FAMILY_SH4,
|
|
CPU_FAMILY_SH4A,
|
|
CPU_FAMILY_SH4AL_DSP,
|
|
CPU_FAMILY_SH5,
|
|
CPU_FAMILY_UNKNOWN,
|
|
};
|
|
|
|
/*
|
|
* TLB information structure
|
|
*
|
|
* Defined for both I and D tlb, per-processor.
|
|
*/
|
|
struct tlb_info {
|
|
unsigned long long next;
|
|
unsigned long long first;
|
|
unsigned long long last;
|
|
|
|
unsigned int entries;
|
|
unsigned int step;
|
|
|
|
unsigned long flags;
|
|
};
|
|
|
|
struct sh_cpuinfo {
|
|
unsigned int type, family;
|
|
int cut_major, cut_minor;
|
|
unsigned long loops_per_jiffy;
|
|
unsigned long asid_cache;
|
|
|
|
struct cache_info icache; /* Primary I-cache */
|
|
struct cache_info dcache; /* Primary D-cache */
|
|
struct cache_info scache; /* Secondary cache */
|
|
|
|
/* TLB info */
|
|
struct tlb_info itlb;
|
|
struct tlb_info dtlb;
|
|
|
|
unsigned int phys_bits;
|
|
unsigned long flags;
|
|
} __attribute__ ((aligned(L1_CACHE_BYTES)));
|
|
|
|
extern struct sh_cpuinfo cpu_data[];
|
|
#define boot_cpu_data cpu_data[0]
|
|
#define current_cpu_data cpu_data[smp_processor_id()]
|
|
#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
|
|
|
|
#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
|
|
#define cpu_relax() barrier()
|
|
#define cpu_relax_lowlatency() cpu_relax()
|
|
|
|
void default_idle(void);
|
|
void stop_this_cpu(void *);
|
|
|
|
/* Forward decl */
|
|
struct seq_operations;
|
|
struct task_struct;
|
|
|
|
extern struct pt_regs fake_swapper_regs;
|
|
|
|
extern void cpu_init(void);
|
|
extern void cpu_probe(void);
|
|
|
|
/* arch/sh/kernel/process.c */
|
|
extern unsigned int xstate_size;
|
|
extern void free_thread_xstate(struct task_struct *);
|
|
extern struct kmem_cache *task_xstate_cachep;
|
|
|
|
/* arch/sh/mm/alignment.c */
|
|
extern int get_unalign_ctl(struct task_struct *, unsigned long addr);
|
|
extern int set_unalign_ctl(struct task_struct *, unsigned int val);
|
|
|
|
#define GET_UNALIGN_CTL(tsk, addr) get_unalign_ctl((tsk), (addr))
|
|
#define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val))
|
|
|
|
/* arch/sh/mm/init.c */
|
|
extern unsigned int mem_init_done;
|
|
|
|
/* arch/sh/kernel/setup.c */
|
|
const char *get_cpu_subtype(struct sh_cpuinfo *c);
|
|
extern const struct seq_operations cpuinfo_op;
|
|
|
|
/* thread_struct flags */
|
|
#define SH_THREAD_UAC_NOPRINT (1 << 0)
|
|
#define SH_THREAD_UAC_SIGBUS (1 << 1)
|
|
#define SH_THREAD_UAC_MASK (SH_THREAD_UAC_NOPRINT | SH_THREAD_UAC_SIGBUS)
|
|
|
|
/* processor boot mode configuration */
|
|
#define MODE_PIN0 (1 << 0)
|
|
#define MODE_PIN1 (1 << 1)
|
|
#define MODE_PIN2 (1 << 2)
|
|
#define MODE_PIN3 (1 << 3)
|
|
#define MODE_PIN4 (1 << 4)
|
|
#define MODE_PIN5 (1 << 5)
|
|
#define MODE_PIN6 (1 << 6)
|
|
#define MODE_PIN7 (1 << 7)
|
|
#define MODE_PIN8 (1 << 8)
|
|
#define MODE_PIN9 (1 << 9)
|
|
#define MODE_PIN10 (1 << 10)
|
|
#define MODE_PIN11 (1 << 11)
|
|
#define MODE_PIN12 (1 << 12)
|
|
#define MODE_PIN13 (1 << 13)
|
|
#define MODE_PIN14 (1 << 14)
|
|
#define MODE_PIN15 (1 << 15)
|
|
|
|
int generic_mode_pins(void);
|
|
int test_mode_pin(int pin);
|
|
|
|
#ifdef CONFIG_VSYSCALL
|
|
int vsyscall_init(void);
|
|
#else
|
|
#define vsyscall_init() do { } while (0)
|
|
#endif
|
|
|
|
/*
|
|
* SH-2A has both 16 and 32-bit opcodes, do lame encoding checks.
|
|
*/
|
|
#ifdef CONFIG_CPU_SH2A
|
|
extern unsigned int instruction_size(unsigned int insn);
|
|
#elif defined(CONFIG_SUPERH32)
|
|
#define instruction_size(insn) (2)
|
|
#else
|
|
#define instruction_size(insn) (4)
|
|
#endif
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#ifdef CONFIG_SUPERH32
|
|
# include <asm/processor_32.h>
|
|
#else
|
|
# include <asm/processor_64.h>
|
|
#endif
|
|
|
|
#endif /* __ASM_SH_PROCESSOR_H */
|