Documentation/features: Add csky kernel features
[email protected]
maintainerPATCH 1/5 Documentation/features: Add csky kernel features
From: Guo Ren <[email protected]>
core/ cBPF-JIT : TODO |
core/ eBPF-JIT : TODO |
core/ generic-idle-thread : ok |
core/ jump-labels : TODO |
core/ tracehook : ok |
debug/ KASAN : TODO |
debug/ gcov-profile-all : TODO |
debug/ kgdb : TODO |
debug/ kprobes-on-ftrace : TODO |
debug/ kprobes : TODO |
debug/ kretprobes : TODO |
debug/ optprobes : TODO |
debug/ stackprotector : TODO |
debug/ uprobes : TODO |
debug/ user-ret-profiler : TODO |
io/ dma-contiguous : ok |
locking/ cmpxchg-local : TODO |
locking/ lockdep : TODO |
locking/ queued-rwlocks : ok |
locking/ queued-spinlocks : TODO |
locking/ rwsem-optimized : TODO |
perf/ kprobes-event : TODO |
perf/ perf-regs : TODO |
perf/ perf-stackdump : TODO |
sched/ membarrier-sync-core : TODO |
sched/ numa-balancing : .. |
seccomp/ seccomp-filter : TODO |
time/ arch-tick-broadcast : TODO |
time/ clockevents : ok |
time/ context-tracking : TODO |
time/ irq-time-acct : TODO |
time/ modern-timekeeping : ok |
time/ virt-cpuacct : TODO |
vm/ ELF-ASLR : TODO |
vm/ PG_uncached : TODO |
vm/ THP : .. |
vm/ batch-unmap-tlb-flush: TODO |
vm/ huge-vmap : TODO |
vm/ ioremap_prot : TODO |
vm/ numa-memblock : .. |
vm/ pte_special : TODO |--- Documentation/features/core/cBPF-JIT/arch-support.txt | 1 + Documentation/features/core/eBPF-JIT/arch-support.txt | 1 + Documentation/features/core/generic-idle-thread/arch-support.txt | 1 + Documentation/features/core/jump-labels/arch-support.txt | 1 + Documentation/features/core/tracehook/arch-support.txt | 1 + Documentation/features/debug/KASAN/arch-support.txt | 1 + Documentation/features/debug/gcov-profile-all/arch-support.txt | 1 + Documentation/features/debug/kgdb/arch-support.txt | 1 + Documentation/features/debug/kprobes-on-ftrace/arch-support.txt | 1 + Documentation/features/debug/kprobes/arch-support.txt | 1 + Documentation/features/debug/kretprobes/arch-support.txt | 1 + Documentation/features/debug/optprobes/arch-support.txt | 1 + Documentation/features/debug/stackprotector/arch-support.txt | 1 + Documentation/features/debug/uprobes/arch-support.txt | 1 + Documentation/features/debug/user-ret-profiler/arch-support.txt | 1 + Documentation/features/io/dma-contiguous/arch-support.txt | 1 + Documentation/features/locking/cmpxchg-local/arch-support.txt | 1 + Documentation/features/locking/lockdep/arch-support.txt | 1 + Documentation/features/locking/queued-rwlocks/arch-support.txt | 1 + Documentation/features/locking/queued-spinlocks/arch-support.txt | 1 + Documentation/features/locking/rwsem-optimized/arch-support.txt | 1 + Documentation/features/perf/kprobes-event/arch-support.txt | 1 + Documentation/features/perf/perf-regs/arch-support.txt | 1 + Documentation/features/perf/perf-stackdump/arch-support.txt | 1 + Documentation/features/sched/membarrier-sync-core/arch-support.txt | 1 + Documentation/features/sched/numa-balancing/arch-support.txt | 1 + Documentation/features/seccomp/seccomp-filter/arch-support.txt | 1 + Documentation/features/time/arch-tick-broadcast/arch-support.txt | 1 + Documentation/features/time/clockevents/arch-support.txt | 1 + Documentation/features/time/context-tracking/arch-support.txt | 1 + Documentation/features/time/irq-time-acct/arch-support.txt | 1 + Documentation/features/time/modern-timekeeping/arch-support.txt | 1 + Documentation/features/time/virt-cpuacct/arch-support.txt | 1 + Documentation/features/vm/ELF-ASLR/arch-support.txt | 1 + Documentation/features/vm/PG_uncached/arch-support.txt | 1 + Documentation/features/vm/THP/arch-support.txt | 1 + Documentation/features/vm/TLB/arch-support.txt | 1 + Documentation/features/vm/huge-vmap/arch-support.txt | 1 + Documentation/features/vm/ioremap_prot/arch-support.txt | 1 + Documentation/features/vm/numa-memblock/arch-support.txt | 1 + Documentation/features/vm/pte_special/arch-support.txt | 1 + 41 files changed, 41 insertions(+)
Documentation/features/core/cBPF-JIT/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/core/eBPF-JIT/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/core/generic-idle-thread/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | ok | | h8300: | TODO | | hexagon: | ok | | ia64: | ok |
Documentation/features/core/jump-labels/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/core/tracehook/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | ok | + | csky: | ok | | h8300: | TODO | | hexagon: | ok | | ia64: | ok |
Documentation/features/debug/KASAN/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/debug/gcov-profile-all/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/debug/kgdb/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | ok | | hexagon: | ok | | ia64: | TODO |
Documentation/features/debug/kprobes-on-ftrace/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/debug/kprobes/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | ok |
Documentation/features/debug/kretprobes/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | ok |
Documentation/features/debug/optprobes/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/debug/stackprotector/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/debug/uprobes/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/debug/user-ret-profiler/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/io/dma-contiguous/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | ok | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/locking/cmpxchg-local/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/locking/lockdep/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | ok | | ia64: | TODO |
Documentation/features/locking/queued-rwlocks/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | ok | | c6x: | TODO | + | csky: | ok | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/locking/queued-spinlocks/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/locking/rwsem-optimized/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | ok |
Documentation/features/perf/kprobes-event/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | ok | | ia64: | TODO |
Documentation/features/perf/perf-regs/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/perf/perf-stackdump/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/sched/membarrier-sync-core/arch-support.txt +1 -0
@@ -34,6 +34,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/sched/numa-balancing/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | .. | | arm64: | ok | | c6x: | .. | + | csky: | .. | | h8300: | .. | | hexagon: | .. | | ia64: | TODO |
Documentation/features/seccomp/seccomp-filter/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/time/arch-tick-broadcast/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/time/clockevents/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | ok | + | csky: | ok | | h8300: | ok | | hexagon: | ok | | ia64: | TODO |
Documentation/features/time/context-tracking/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/time/irq-time-acct/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | .. |
Documentation/features/time/modern-timekeeping/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | ok | | c6x: | ok | + | csky: | ok | | h8300: | ok | | hexagon: | ok | | ia64: | ok |
Documentation/features/time/virt-cpuacct/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | ok |
Documentation/features/vm/ELF-ASLR/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/vm/PG_uncached/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | ok |
Documentation/features/vm/THP/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | .. | + | csky: | .. | | h8300: | .. | | hexagon: | .. | | ia64: | TODO |
Documentation/features/vm/TLB/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | .. | + | csky: | TODO | | h8300: | .. | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/vm/huge-vmap/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/vm/ioremap_prot/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | TODO | | arm64: | TODO | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Documentation/features/vm/numa-memblock/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | .. | | arm64: | ok | | c6x: | .. | + | csky: | .. | | h8300: | .. | | hexagon: | .. | | ia64: | ok |
Documentation/features/vm/pte_special/arch-support.txt +1 -0
@@ -11,6 +11,7 @@ | arm: | ok | | arm64: | ok | | c6x: | TODO | + | csky: | TODO | | h8300: | TODO | | hexagon: | TODO | | ia64: | TODO |
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH 2/5 csky: fixup relocation error with 807 & 860
From: Guo Ren <[email protected]>
810 doesn't support jsri instruction and csky-as will leave jsri + nop for relocation. Module-probe need replace them with lrw + jsr.
--- arch/csky/kernel/module.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
arch/csky/kernel/module.c +22 -16
@@ -12,7 +12,7 @@#include <linux/spinlock.h> #include <asm/pgtable.h> -#if defined(__CSKYABIV2__) +#ifdef CONFIG_CPU_CK810 #define IS_BSR32 (hi16, lo16) (((hi16) & 0xFC00) == 0xE000)#define IS_JSRI32 (hi16, lo16) ((hi16) == 0xEAE0)
@@ -25,6 +25,26 @@ *(uint16_t *)(addr) =0xE8Fa ; \ *((uint16_t *)(addr) +1 ) =0x0000 ; \ } while (0) + +static void jsri_2_lrw_jsr(uint32_t *location) +{ +uint16_t location_tmp = (uint16_t *)location; + +if (IS_BSR32 (*location_tmp, *(location_tmp +1 ))) +return ; + +if (IS_JSRI32 (*location_tmp, *(location_tmp +1 ))) { +/* jsri 0x... --> lrw r26, 0x... */ +CHANGE_JSRI_TO_LRW (location); +/* lsli r0, r0 --> jsr r26 */ +SET_JSR32_R26 (location +1 ); + } +} +#else +static void inline jsri_2_lrw_jsr (uint32_t *location) +{ +return ; +}#endif int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
@@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,Elf32_Sym *sym;uint32_t *location;short *temp; -#if defined(__CSKYABIV2__) -uint16_t *location_tmp; -#endif for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,case R_CSKY_PCRELJSR_IMM11BY2 :break ;case R_CSKY_PCRELJSR_IMM26BY2 : -#if defined(__CSKYABIV2__) - location_tmp = (uint16_t *)location; -if (IS_BSR32 (*location_tmp, *(location_tmp +1 ))) -break ; - -if (IS_JSRI32 (*location_tmp, *(location_tmp +1 ))) { -/* jsri 0x... --> lrw r26, 0x... */ -CHANGE_JSRI_TO_LRW (location); -/* lsli r0, r0 --> jsr r26 */ -SET_JSR32_R26 (location +1 ); - } -#endif +jsri_2_lrw_jsr (location);break ;case R_CSKY_ADDR_HI16 : temp = ((short *)location) +1 ;
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH 3/5 csky: fixup CACHEV1 store instruction fast retire
In reply to [email protected]From: Guo Ren <[email protected]>
For I/O access, 810/807 store instruction fast retire will cause wrong primitive. For example:
stw (clear interrupt source)
stw (unmask interrupt controller)
enable interrupt
stw is fast retire instruction. When PC is run at enable interrupt stage, the clear interrupt source hasn't finished. It will cause another wrong irq-enter.
So use mb() to prevent above.
--- arch/csky/include/asm/io.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/csky/include/asm/io.h +25 -0
@@ -15,6 +15,31 @@ extern void iounmap(void *addr);extern int remap_area_pages (unsigned long address,phys_addr_t phys_addr,size_t size,unsigned long flags); +/* +* I/O memory access primitives. Reads are ordered relative to any +* following Normal memory access. Writes are ordered relative to any prior +* Normal memory access. +* +* For CACHEV1 (807, 810), store instruction could fast retire, so we need +* another mb() to prevent st fast retire. +* +* For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't +* fast retire. +*/ +#define readb (c) ({ u8 __v = readb_relaxed(c); rmb(); __v; }) +#define readw (c) ({ u16 __v = readw_relaxed(c); rmb(); __v; }) +#define readl (c) ({ u32 __v = readl_relaxed(c); rmb(); __v; }) + +#ifdef CONFIG_CPU_HAS_CACHEV2 +#define writeb (v,c) ({ wmb(); writeb_relaxed((v),(c)); }) +#define writew (v,c) ({ wmb(); writew_relaxed((v),(c)); }) +#define writel (v,c) ({ wmb(); writel_relaxed((v),(c)); }) +#else +#define writeb (v,c) ({ wmb(); writeb_relaxed((v),(c)); mb(); }) +#define writew (v,c) ({ wmb(); writew_relaxed((v),(c)); mb(); }) +#define writel (v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); }) +#endif +#define ioremap_nocache (phy, sz) ioremap(phy, sz)#define ioremap_wc ioremap_nocache#define ioremap_wt ioremap_nocache
Signature · 1 line
2.7.4
[email protected]
maintainerPATCH 4/5 csky: fixup compile error with pte_alloc
In reply to [email protected]From: Guo Ren <[email protected]>
Commit: 4cf58924951e remove the address argument of pte_alloc without modify csky related code. linux-5.0-rc1 compile failed with csky.
Remove the unnecessary address testing in pte_alloc().
--- arch/csky/include/asm/pgalloc.h | 43 +++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 25 deletions(-)
arch/csky/include/asm/pgalloc.h +18 -25
@@ -24,41 +24,34 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,extern void pgd_init (unsigned long *p); -static inline pte_t *pte_alloc_one_kernel (struct mm_struct *mm, -unsigned long address) +static inline pte_t *pte_alloc_one_kernel (struct mm_struct *mm) {pte_t *pte; -unsigned long *kaddr, i; +unsigned long i; - pte = (pte_t *)__get_free_pages (GFP_KERNEL | __GFP_RETRY_MAYFAIL, -PTE_ORDER ); - kaddr = (unsigned long *)pte; -if (address &0x80000000 ) -for (i =0 ; i < (PAGE_SIZE /4 ); i++) - *(kaddr + i) =0x1 ; -else -clear_page (kaddr); + pte = (pte_t *)__get_free_page (GFP_KERNEL ); +if (!pte) +return NULL ; + +for (i =0 ; i <PAGE_SIZE /sizeof (pte_t); i++) + (pte + i)->pte_low = _PAGE_GLOBAL;return pte; } -static inline struct page *pte_alloc_one (struct mm_struct *mm, -unsigned long address) +static inline struct page *pte_alloc_one (struct mm_struct *mm) {struct page *pte; -unsigned long *kaddr, i; - - pte =alloc_pages (GFP_KERNEL | __GFP_RETRY_MAYFAIL,PTE_ORDER ); -if (pte) { - kaddr =kmap_atomic (pte); -if (address &0x80000000 ) { -for (i =0 ; i < (PAGE_SIZE /4 ); i++) - *(kaddr + i) =0x1 ; - }else -clear_page (kaddr); -kunmap_atomic (kaddr); -pgtable_page_ctor (pte); + + pte =alloc_pages (GFP_KERNEL | __GFP_ZERO,0 ); +if (!pte) +return NULL ; + +if (!pgtable_page_ctor (pte)) { +__free_page (pte); +return NULL ; } +return pte; }
Signature · 1 line
2.7.4
Re: [PATCH 4/5] csky: fixup compile error with pte_alloc
arch/csky/include/asm/pgalloc.h static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, · line 37
Quoted 3 lines · On Tue, Jan 8, 2019 at 8:27 AM <[email protected]> wrote:
arch/csky/include/asm/pgalloc.h +2
-0+for (i =0 ; i <PAGE_SIZE /sizeof (pte_t); i++) + (pte + i)->pte_low = _PAGE_GLOBAL;
When I first read this, I went "hmm. pte_high is not initialized".
But csky doesn't have a pte_high, and it seems that csky and SH both decided to call their (single-word) pte member 'pte_low'.
Which is a bit odd, but whatever.
Other than that oddity, it looks fine to me. I assume I'll get a pull request sooner or later,
Linus
[email protected]
maintainerPATCH 5/5 irqchip/csky: fixup handle_irq_perbit break irq
In reply to [email protected]From: Guo Ren <[email protected]>
The handle_irq_perbit function loop every bit in hwirq local variable.
handle_irq_perbit(hwirq) {
for_everyt_bit_in(hwirq) {
handle_domain_irq()
->irq_exit()
->invoke_softirq()
->__do_softirq()
->local_irq_enable() // Here will cause new interrupt. }
}
When new interrupt coming at local_irq_enable, it will finish another interrupt handler and pull down the interrupt source. But hwirq is the local variable for handle_irq_perbit(), it can't get new interrupt controller pending reg status. So we need update hwirq with pending reg in every loop.
Also change write_relax to writel could prevent stw from fast retire. When local_irq is enabled, intc regs is really set-in.
--- drivers/irqchip/irq-csky-apb-intc.c | 77 ++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 35 deletions(-)
drivers/irqchip/irq-csky-apb-intc.c +42 -35
@@ -95,7 +95,7 @@ static inline void setup_irq_channel(u32 magic, void __iomem *reg_addr)/* Setup 64 channel slots */ for (i =0 ; i <INTC_IRQS ; i +=4 ) -writel_relaxed (build_channel_val (i, magic), reg_addr + i); +writel (build_channel_val (i, magic), reg_addr + i); } static int __init
@@ -135,16 +135,10 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent)static inline bool handle_irq_perbit (struct pt_regs *regs,u32 hwirq,u32 irq_base) { -u32 irq; -if (hwirq ==0 )return 0 ; -while (hwirq) { - irq =__ffs (hwirq); - hwirq &= ~BIT (irq); -handle_domain_irq (root_domain, irq_base + irq, regs); - } +handle_domain_irq (root_domain, irq_base +__fls (hwirq), regs);return 1 ; }
@@ -154,12 +148,16 @@ static void gx_irq_handler(struct pt_regs *regs) {bool ret; -do { - ret =handle_irq_perbit (regs, -readl_relaxed (reg_base +GX_INTC_PEN31_00 ),0 ); - ret |=handle_irq_perbit (regs, -readl_relaxed (reg_base +GX_INTC_PEN63_32 ),32 ); - }while (ret); +retry: + ret =handle_irq_perbit (regs, +readl (reg_base +GX_INTC_PEN63_32 ),32 ); +if (ret) + goto retry; + + ret =handle_irq_perbit (regs, +readl (reg_base +GX_INTC_PEN31_00 ),0 ); +if (ret) + goto retry; } static int __init
@@ -174,14 +172,14 @@ gx_intc_init(struct device_node *node, struct device_node *parent)/* * Initial enable reg to disable all interrupts */ -writel_relaxed (0x0 , reg_base +GX_INTC_NEN31_00 ); -writel_relaxed (0x0 , reg_base +GX_INTC_NEN63_32 ); +writel (0x0 , reg_base +GX_INTC_NEN31_00 ); +writel (0x0 , reg_base +GX_INTC_NEN63_32 );/* * Initial mask reg with all unmasked, because we only use enalbe reg */ -writel_relaxed (0x0 , reg_base +GX_INTC_NMASK31_00 ); -writel_relaxed (0x0 , reg_base +GX_INTC_NMASK63_32 ); +writel (0x0 , reg_base +GX_INTC_NMASK31_00 ); +writel (0x0 , reg_base +GX_INTC_NMASK63_32 );setup_irq_channel (0x03020100 , reg_base +GX_INTC_SOURCE );
@@ -204,20 +202,29 @@ static void ck_irq_handler(struct pt_regs *regs)void __iomem *reg_pen_lo = reg_base +CK_INTC_PEN31_00 ;void __iomem *reg_pen_hi = reg_base +CK_INTC_PEN63_32 ; -do { -/* handle 0 - 31 irqs */ - ret =handle_irq_perbit (regs,readl_relaxed (reg_pen_lo),0 ); - ret |=handle_irq_perbit (regs,readl_relaxed (reg_pen_hi),32 ); +retry: +/* handle 0 - 63 irqs */ + ret =handle_irq_perbit (regs,readl (reg_pen_hi),32 ); +if (ret) + goto retry; -if (nr_irq ==INTC_IRQS ) -continue ; + ret =handle_irq_perbit (regs,readl (reg_pen_lo),0 ); +if (ret) + goto retry; + +if (nr_irq ==INTC_IRQS ) +return ; -/* handle 64 - 127 irqs */ - ret |=handle_irq_perbit (regs, -readl_relaxed (reg_pen_lo +CK_INTC_DUAL_BASE ),64 ); - ret |=handle_irq_perbit (regs, -readl_relaxed (reg_pen_hi +CK_INTC_DUAL_BASE ),96 ); - }while (ret); +/* handle 64 - 127 irqs */ + ret =handle_irq_perbit (regs, +readl (reg_pen_hi +CK_INTC_DUAL_BASE ),96 ); +if (ret) + goto retry; + + ret =handle_irq_perbit (regs, +readl (reg_pen_lo +CK_INTC_DUAL_BASE ),64 ); +if (ret) + goto retry; } static int __init
@@ -230,11 +237,11 @@ ck_intc_init(struct device_node *node, struct device_node *parent)return ret;/* Initial enable reg to disable all interrupts */ -writel_relaxed (0 , reg_base +CK_INTC_NEN31_00 ); -writel_relaxed (0 , reg_base +CK_INTC_NEN63_32 ); +writel (0 , reg_base +CK_INTC_NEN31_00 ); +writel (0 , reg_base +CK_INTC_NEN63_32 );/* Enable irq intc */ -writel_relaxed (BIT (31 ), reg_base +CK_INTC_ICR ); +writel (BIT (31 ), reg_base +CK_INTC_ICR );ck_set_gc (node, reg_base,CK_INTC_NEN31_00 ,0 );ck_set_gc (node, reg_base,CK_INTC_NEN63_32 ,32 );
@@ -260,8 +267,8 @@ ck_dual_intc_init(struct device_node *node, struct device_node *parent)return ret;/* Initial enable reg to disable all interrupts */ -writel_relaxed (0 , reg_base +CK_INTC_NEN31_00 +CK_INTC_DUAL_BASE ); -writel_relaxed (0 , reg_base +CK_INTC_NEN63_32 +CK_INTC_DUAL_BASE ); +writel (0 , reg_base +CK_INTC_NEN31_00 +CK_INTC_DUAL_BASE ); +writel (0 , reg_base +CK_INTC_NEN63_32 +CK_INTC_DUAL_BASE );ck_set_gc (node, reg_base +CK_INTC_DUAL_BASE ,CK_INTC_NEN31_00 ,64 );ck_set_gc (node, reg_base +CK_INTC_DUAL_BASE ,CK_INTC_NEN63_32 ,96 );
Signature · 1 line
2.7.4