Commit 7df9075e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'csky-for-linus-6.0-rc1' of https://github.com/c-sky/csky-linux

Pull csky updates from Guo Ren:

 - Add jump-label implementation

 - Add qspinlock support

 - Enable ARCH_INLINE_READ*/WRITE*/SPIN*

 - Some fixups and a coding convention

* tag 'csky-for-linus-6.0-rc1' of https://github.com/c-sky/csky-linux:
  csky: abiv1: Fixup compile error
  csky: cmpxchg: Coding convention for BUILD_BUG()
  csky: Enable ARCH_INLINE_READ*/WRITE*/SPIN*
  csky: Add qspinlock support
  csky: Add jump-label implementation
  csky: Move HEAD_TEXT_SECTION out of __init_begin-end
  csky: Correct position of _stext
  csky: Use the bitmap API to allocate bitmaps
  csky/kprobe: reclaim insn_slot on kprobe unregistration
parents 25e6bed5 45fef4c4
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -8,6 +8,33 @@ config CSKY
	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
	select ARCH_USE_BUILTIN_BSWAP
	select ARCH_USE_QUEUED_RWLOCKS
	select ARCH_USE_QUEUED_SPINLOCKS
	select ARCH_INLINE_READ_LOCK if !PREEMPTION
	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION
	select ARCH_INLINE_READ_UNLOCK if !PREEMPTION
	select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION
	select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION
	select ARCH_INLINE_WRITE_LOCK if !PREEMPTION
	select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION
	select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION
	select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION
	select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION
	select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION
	select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION
	select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION
	select ARCH_INLINE_SPIN_LOCK if !PREEMPTION
	select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION
	select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION
	select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION
	select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION
	select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION
	select ARCH_WANT_FRAME_POINTERS if !CPU_CK610 && $(cc-option,-mbacktrace)
	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
	select COMMON_CLK
@@ -40,6 +67,8 @@ config CSKY
	select GX6605S_TIMER if CPU_CK610
	select HAVE_ARCH_TRACEHOOK
	select HAVE_ARCH_AUDITSYSCALL
	select HAVE_ARCH_JUMP_LABEL if !CPU_CK610
	select HAVE_ARCH_JUMP_LABEL_RELATIVE
	select HAVE_ARCH_MMAP_RND_BITS
	select HAVE_ARCH_SECCOMP_FILTER
	select HAVE_CONTEXT_TRACKING_USER
+6 −0
Original line number Diff line number Diff line
@@ -6,4 +6,10 @@
#define __HAVE_ARCH_MEMCPY
extern void *memcpy(void *, const void *, __kernel_size_t);

#define __HAVE_ARCH_MEMMOVE
extern void *memmove(void *, const void *, __kernel_size_t);

#define __HAVE_ARCH_MEMSET
extern void *memset(void *, int,  __kernel_size_t);

#endif /* __ABI_CSKY_STRING_H */
+2 −2
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@ generic-y += asm-offsets.h
generic-y += extable.h
generic-y += gpio.h
generic-y += kvm_para.h
generic-y += spinlock.h
generic-y += spinlock_types.h
generic-y += mcs_spinlock.h
generic-y += qrwlock.h
generic-y += qrwlock_types.h
generic-y += qspinlock.h
generic-y += parport.h
generic-y += user.h
generic-y += vmlinux.lds.h
+25 −6
Original line number Diff line number Diff line
@@ -4,10 +4,9 @@
#define __ASM_CSKY_CMPXCHG_H

#ifdef CONFIG_SMP
#include <linux/bug.h>
#include <asm/barrier.h>

extern void __bad_xchg(void);

#define __xchg_relaxed(new, ptr, size)				\
({								\
	__typeof__(ptr) __ptr = (ptr);				\
@@ -15,6 +14,26 @@ extern void __bad_xchg(void);
	__typeof__(*(ptr)) __ret;				\
	unsigned long tmp;					\
	switch (size) {						\
	case 2: {						\
		u32 ret;					\
		u32 shif = ((ulong)__ptr & 2) ? 16 : 0;		\
		u32 mask = 0xffff << shif;			\
		__ptr = (__typeof__(ptr))((ulong)__ptr & ~2);	\
		__asm__ __volatile__ (				\
			"1:	ldex.w %0, (%4)\n"		\
			"	and    %1, %0, %2\n"		\
			"	or     %1, %1, %3\n"		\
			"	stex.w %1, (%4)\n"		\
			"	bez    %1, 1b\n"		\
			: "=&r" (ret), "=&r" (tmp)		\
			: "r" (~mask),				\
			  "r" ((u32)__new << shif),		\
			  "r" (__ptr)				\
			: "memory");				\
		__ret = (__typeof__(*(ptr)))			\
			((ret & mask) >> shif);			\
		break;						\
	}							\
	case 4:							\
		asm volatile (					\
		"1:	ldex.w		%0, (%3) \n"		\
@@ -26,7 +45,7 @@ extern void __bad_xchg(void);
			:);					\
		break;						\
	default:						\
		__bad_xchg();					\
		BUILD_BUG();					\
	}							\
	__ret;							\
})
@@ -56,7 +75,7 @@ extern void __bad_xchg(void);
			:);					\
		break;						\
	default:						\
		__bad_xchg();					\
		BUILD_BUG();					\
	}							\
	__ret;							\
})
@@ -87,7 +106,7 @@ extern void __bad_xchg(void);
			:);					\
		break;						\
	default:						\
		__bad_xchg();					\
		BUILD_BUG();					\
	}							\
	__ret;							\
})
@@ -119,7 +138,7 @@ extern void __bad_xchg(void);
			:);					\
		break;						\
	default:						\
		__bad_xchg();					\
		BUILD_BUG();					\
	}							\
	__ret;							\
})
+47 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef __ASM_CSKY_JUMP_LABEL_H
#define __ASM_CSKY_JUMP_LABEL_H

#ifndef __ASSEMBLY__

#include <linux/types.h>

#define JUMP_LABEL_NOP_SIZE 4

static __always_inline bool arch_static_branch(struct static_key *key,
					       bool branch)
{
	asm_volatile_goto(
		"1:	nop32					\n"
		"	.pushsection	__jump_table, \"aw\"	\n"
		"	.align		2			\n"
		"	.long		1b - ., %l[label] - .	\n"
		"	.long		%0 - .			\n"
		"	.popsection				\n"
		:  :  "i"(&((char *)key)[branch]) :  : label);

	return false;
label:
	return true;
}

static __always_inline bool arch_static_branch_jump(struct static_key *key,
						    bool branch)
{
	asm_volatile_goto(
		"1:	bsr32		%l[label]		\n"
		"	.pushsection	__jump_table, \"aw\"	\n"
		"	.align		2			\n"
		"	.long		1b - ., %l[label] - .	\n"
		"	.long		%0 - .			\n"
		"	.popsection				\n"
		:  :  "i"(&((char *)key)[branch]) :  : label);

	return false;
label:
	return true;
}

#endif  /* __ASSEMBLY__ */
#endif	/* __ASM_CSKY_JUMP_LABEL_H */
Loading