1. 29 Mar, 2021 1 commit
    • Tiezhu Yang's avatar
      MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again · 66633abd
      Tiezhu Yang authored
      After commit 0ebeea8c ("bpf: Restrict bpf_probe_read{, str}() only to
      archs where they work"), bpf_probe_read{, str}() functions were no longer
      available on MIPS, so there exist some errors when running bpf program:
      
      root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
      bpf: Failed to load program: Invalid argument
      [...]
      11: (85) call bpf_probe_read#4
      unknown func bpf_probe_read#4
      [...]
      Exception: Failed to load BPF program count_sched: Invalid argument
      
      ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE should be restricted to archs
      with non-overlapping address ranges, but they can overlap in EVA mode
      on MIPS, so select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA in
      arch/mips/Kconfig, otherwise the bpf old helper bpf_probe_read() will
      not be available.
      
      This is similar with the commit d195b1d1 ("powerpc/bpf: Enable
      bpf_probe_read{, str}() on powerpc again").
      
      Fixes: 0ebeea8c ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      66633abd
  2. 25 Mar, 2021 9 commits
  3. 24 Mar, 2021 10 commits
  4. 14 Mar, 2021 2 commits
    • Wang Qing's avatar
      mips: kernel: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe() · 63d6c981
      Wang Qing authored
      debugfs_create_file_unsafe does not protect the fops handed to it
      against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
      the file lifetime and thus protects it against removal.
      Signed-off-by: default avatarWang Qing <wangqing@vivo.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      63d6c981
    • Huang Pei's avatar
      MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling · c6972fb9
      Huang Pei authored
      +. LOONGSON64 use 0x98xx_xxxx_xxxx_xxxx as xphys cached, instread of
      0xa8xx_xxxx_xxxx_xxxx
      
      +. let CONFIG_MIPS_PGD_C0_CONTEXT depend on 64bit
      
      +. cast CAC_BASE into u64 to silence warning on MIPS32
      
      CP0 Context has enough room for wraping pgd into its 41-bit PTEBase field.
      
      +. For XPHYS, the trick is that pgd is 4kB aligned, and the PABITS <= 53,
      only save 53 - 12 = 41 bits, aka :
      
         bit[63:59] | 0000 00 |  bit[53:12] | 0000 0000 0000
      
      +. for CKSEG0, only save 29 - 12 = 17 bits
      
      when switching pgd, only need to save bit[53:12] or bit[28:12] into
      CP0 Context's bit[63:23], see folling asm generated at run time
      
      tlbmiss_handler_setup_pgd:
      	.set	push
      	.set	noreorder
      
      	dsra	a2, a0, 29
      	move	a3, a0
      	dins	a0, zero, 29, 35
      	daddiu	a2, a2, 4	//for CKSEG0, a2 from 0xfffffffffffffffc
      				//into 0
      
      	movn	a0, a3, a2
      	dsll	a0, a0, 11
      	jr	ra
      	dmtc0	a0, CP0_CONTEXT
      
      	.set	pop
      
      when using it on page walking
      
      	dmfc0	k0, CP0_CONTEXT
      	dins	k0, zero, 0, 23	         // zero badv2
      	ori	k0, k0, (CAC_BASE >> 53) // *prefix* with bit[63:59]
      	drotr	k0, k0, 11		 // kick it in the right place
      Signed-off-by: default avatarHuang Pei <huangpei@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      c6972fb9
  5. 12 Mar, 2021 18 commits