1. 24 3月, 2021 2 次提交
  2. 14 3月, 2021 2 次提交
    • W
      mips: kernel: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe() · 63d6c981
      Wang Qing 提交于
      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: NWang Qing <wangqing@vivo.com>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      63d6c981
    • H
      MIPS: clean up CONFIG_MIPS_PGD_C0_CONTEXT handling · c6972fb9
      Huang Pei 提交于
      +. 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: NHuang Pei <huangpei@loongson.cn>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      c6972fb9
  3. 12 3月, 2021 18 次提交
  4. 10 3月, 2021 7 次提交
  5. 09 3月, 2021 2 次提交
    • T
      MIPS: kernel: Reserve exception base early to prevent corruption · bd67b711
      Thomas Bogendoerfer 提交于
      BMIPS is one of the few platforms that do change the exception base.
      After commit 2dcb3964 ("memblock: do not start bottom-up allocations
      with kernel_end") we started seeing BMIPS boards fail to boot with the
      built-in FDT being corrupted.
      
      Before the cited commit, early allocations would be in the [kernel_end,
      RAM_END] range, but after commit they would be within [RAM_START +
      PAGE_SIZE, RAM_END].
      
      The custom exception base handler that is installed by
      bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the
      memory region allocated by unflatten_and_copy_device_tree() thus
      corrupting the FDT used by the kernel.
      
      To fix this, we need to perform an early reservation of the custom
      exception space. Additional we reserve the first 4k (1k for R3k) for
      either normal exception vector space (legacy CPUs) or special vectors
      like cache exceptions.
      
      Huge thanks to Serge for analysing and proposing a solution to this
      issue.
      
      Fixes: 2dcb3964 ("memblock: do not start bottom-up allocations with kernel_end")
      Reported-by: NKamal Dasu <kdasu.kdev@gmail.com>
      Debugged-by: NSerge Semin <Sergey.Semin@baikalelectronics.ru>
      Acked-by: NMike Rapoport <rppt@linux.ibm.com>
      Tested-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      bd67b711
    • B
      MIPS: vmlinux.lds.S: align raw appended dtb to 8 bytes · 6654111c
      Bjørn Mork 提交于
      The devicetree specification requires 8-byte alignment in
      memory. This is now enforced by libfdt since commit 79edff12
      ("scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9")
      which included the upstream commit 5e735860c478 ("libfdt: Check for
      8-byte address alignment in fdt_ro_probe_()").
      
      This broke the MIPS raw appended DTBs which would be appended to
      the image immediately following the initramfs section.  This ends
      with a 32bit size, resulting in a 4-byte alignment of the DTB.
      
      Fix by padding with zeroes to 8-bytes when MIPS_RAW_APPENDED_DTB
      is defined.
      
      Fixes: 79edff12 ("scripts/dtc: Update to upstream version v1.6.0-51-g183df9e9c2b9")
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      6654111c
  6. 08 3月, 2021 2 次提交
  7. 06 3月, 2021 7 次提交