1. 29 6月, 2015 2 次提交
  2. 14 5月, 2015 1 次提交
    • M
      ARM: 8356/1: mm: handle non-pmd-aligned end of RAM · 965278dc
      Mark Rutland 提交于
      At boot time we round the memblock limit down to section size in an
      attempt to ensure that we will have mapped this RAM with section
      mappings prior to allocating from it. When mapping RAM we iterate over
      PMD-sized chunks, creating these section mappings.
      
      Section mappings are only created when the end of a chunk is aligned to
      section size. Unfortunately, with classic page tables (where PMD_SIZE is
      2 * SECTION_SIZE) this means that if a chunk is between 1M and 2M in
      size the first 1M will not be mapped despite having been accounted for
      in the memblock limit. This has been observed to result in page tables
      being allocated from unmapped memory, causing boot-time hangs.
      
      This patch modifies the memblock limit rounding to always round down to
      PMD_SIZE instead of SECTION_SIZE. For classic MMU this means that we
      will round the memblock limit down to a 2M boundary, matching the limits
      on section mappings, and preventing allocations from unmapped memory.
      For LPAE there should be no change as PMD_SIZE == SECTION_SIZE.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reported-by: NStefan Agner <stefan@agner.ch>
      Tested-by: NStefan Agner <stefan@agner.ch>
      Acked-by: NLaura Abbott <labbott@redhat.com>
      Tested-by: NHans de Goede <hdegoede@redhat.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      965278dc
  3. 08 1月, 2015 1 次提交
    • G
      ARM: 8253/1: mm: use phys_addr_t type in map_lowmem() for kernel mem region · ac084688
      Grygorii Strashko 提交于
      Now local variables kernel_x_start and kernel_x_end defined using
      'unsigned long' type which is wrong because they represent physical
      memory range and will be calculated wrongly if LPAE is enabled.
      As result, all following code in map_lowmem() will not work correctly.
      
      For example, Keystone 2 boot is broken because
       kernel_x_start == 0x0000 0000
       kernel_x_end   == 0x0080 0000
      
      instead of
       kernel_x_start == 0x0000 0008 0000 0000
       kernel_x_end   == 0x0000 0008 0080 0000
      and as result whole low memory will be mapped with MT_MEMORY_RW
      permissions by code (start > kernel_x_end):
      		} else if (start >= kernel_x_end) {
      			map.pfn = __phys_to_pfn(start);
      			map.virtual = __phys_to_virt(start);
      			map.length = end - start;
      			map.type = MT_MEMORY_RW;
      
      			create_mapping(&map);
      		}
      
      Hence, fix it by using phys_addr_t type for variables kernel_x_start
      and kernel_x_end.
      Tested-by: NMurali Karicheri <m-karicheri2@ti.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ac084688
  4. 04 12月, 2014 1 次提交
  5. 03 12月, 2014 1 次提交
  6. 21 11月, 2014 1 次提交
  7. 17 10月, 2014 3 次提交
  8. 26 9月, 2014 1 次提交
  9. 02 8月, 2014 1 次提交
  10. 29 7月, 2014 1 次提交
  11. 02 6月, 2014 5 次提交
  12. 01 6月, 2014 1 次提交
  13. 26 5月, 2014 1 次提交
  14. 23 4月, 2014 1 次提交
  15. 10 2月, 2014 2 次提交
    • W
      ARM: 7954/1: mm: remove remaining domain support from ARMv6 · b6ccb980
      Will Deacon 提交于
      CPU_32v6 currently selects CPU_USE_DOMAINS if CPU_V6 and MMU. This is
      because ARM 1136 r0pX CPUs lack the v6k extensions, and therefore do
      not have hardware thread registers. The lack of these registers requires
      the kernel to update the vectors page at each context switch in order to
      write a new TLS pointer. This write must be done via the userspace
      mapping, since aliasing caches can lead to expensive flushing when using
      kmap. Finally, this requires the vectors page to be mapped r/w for
      kernel and r/o for user, which has implications for things like put_user
      which must trigger CoW appropriately when targetting user pages.
      
      The upshot of all this is that a v6/v7 kernel makes use of domains to
      segregate kernel and user memory accesses. This has the nasty
      side-effect of making device mappings executable, which has been
      observed to cause subtle bugs on recent cores (e.g. Cortex-A15
      performing a speculative instruction fetch from the GIC and acking an
      interrupt in the process).
      
      This patch solves this problem by removing the remaining domain support
      from ARMv6. A new memory type is added specifically for the vectors page
      which allows that page (and only that page) to be mapped as user r/o,
      kernel r/w. All other user r/o pages are mapped also as kernel r/o.
      Patch co-developed with Russell King.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      b6ccb980
    • C
      ARM: 7950/1: mm: Fix stage-2 device memory attributes · 4d9c5b89
      Christoffer Dall 提交于
      The stage-2 memory attributes are distinct from the Hyp memory
      attributes and the Stage-1 memory attributes.  We were using the stage-1
      memory attributes for stage-2 mappings causing device mappings to be
      mapped as normal memory.  Add the S2 equivalent defines for memory
      attributes and fix the comments explaining the defines while at it.
      
      Add a prot_pte_s2 field to the mem_type struct and fill out the field
      for device mappings accordingly.
      
      Cc: <stable@vger.kernel.org>	[3.9+]
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      4d9c5b89
  16. 11 12月, 2013 4 次提交
  17. 14 11月, 2013 1 次提交
  18. 11 10月, 2013 1 次提交
  19. 01 8月, 2013 2 次提交
  20. 26 7月, 2013 1 次提交
    • R
      ARM: constify machine_desc structure uses · ff69a4c8
      Russell King 提交于
      struct machine_desc records are defined everywhere as a 'const'
      structure, but unfortuantely it loses its const-ness through the use of
      linker magic - the symbols which surround the section are not declared
      const so it becomes possible not to use 'const' for pointers to these
      const structures.
      
      Let's fix this oversight - all pointers to these structures should be
      marked const too.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ff69a4c8
  21. 22 7月, 2013 1 次提交
    • R
      ARM: 7785/1: mm: restrict early_alloc to section-aligned memory · c65b7e98
      Russell King 提交于
      When map_lowmem() runs, and processes a memory bank whose start or end
      is not section-aligned, memory must be allocated to store the 2nd-level
      page tables. Those allocations are made by calling memblock_alloc().
      
      At this point, the only memory that is free *and* mapped is memory which
      has already been mapped by map_lowmem() itself. For this reason, we must
      calculate the first point at which map_lowmem() will need to allocate
      memory, and set the memblock allocation limit to a lower address, so that
      memblock_alloc() is guaranteed to return memory that is already mapped.
      
      This patch enhances sanity_check_meminfo() to calculate that memory
      address, and pass it to memblock_set_current_limit(), rather than just
      assuming the limit is arm_lowmem_limit.
      
      The algorithm applied is:
      
      * Default memblock_limit to arm_lowmem_limit in the absence of any other
        limit; arm_lowmem_limit is the highest memory that is mapped by
        map_lowmem().
      
      * While walking the list of memblocks, if the start of a block is not
        aligned, 2nd-level page tables will need to be allocated to map the
        first few pages of the block. Hence, the memblock_limit must be before
        the start of the block.
      
      * Similarly, if the end of any block is not aligned, 2nd-level page
        tables will need to be allocated to map the last few pages of the
        block. Hence, the memblock_limit must point at the end of the block,
        rounded down to section-alignment.
      
      * The memory blocks are assumed to be sorted in address order, so the
        first unaligned block start or end is used to set the limit.
      
      With this algorithm, the start or end of almost any bank can be non-
      section-aligned. The only exception is that the start of bank 0 must
      be section-aligned, since otherwise memory would need to be allocated
      when mapping the start of bank 0, which occurs before any free memory
      is mapped.
      
      [swarren, wrote commit description, rewrote calculation of memblock_limit]
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      c65b7e98
  22. 09 7月, 2013 1 次提交
    • S
      ARM: 7781/1: mmu: Add debug_ll_io_init() mappings to early mappings · ee4de5d9
      Stephen Boyd 提交于
      Failure to add the mapping created in debug_ll_io_init() can lead
      to the BUG_ON() triggering in lib/ioremap.c:27 if the static
      virtual address decided for the debug_ll mapping overlaps with
      another mapping that is created later. This happens because the
      generic ioremap code has no idea there is a mapping there and it
      tries to place a mapping in the same location and blows up when
      it sees that there is a pte already present.
      
      kernel BUG at lib/ioremap.c:27!
      Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc2-00042-g2af0c67-dirty #316
      task: ef088000 ti: ef082000 task.ti: ef082000
      PC is at ioremap_page_range+0x16c/0x198
      LR is at ioremap_page_range+0xf0/0x198
      pc : [<c04cb874>]    lr : [<c04cb7f8>]    psr: 20000113
      sp : ef083e78  ip : af140000  fp : ef083ebc
      r10: ef7fc100  r9 : ef7fc104  r8 : 000af174
      r7 : 00000647  r6 : beffffff  r5 : f004c000  r4 : f0040000
      r3 : af173417  r2 : 16440653  r1 : af173e07  r0 : ef7fc8fc
      Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      Control: 10c5787d  Table: 8020406a  DAC: 00000015
      Process swapper/0 (pid: 1, stack limit = 0xef082238)
      Stack: (0xef083e78 to 0xef084000)
      3e60:                                                       00040000 ef083eec
      3e80: bf134000 f004bfff c0207c00 f004c000 c02fc120 f000c000 c15e7800 00040000
      3ea0: ef083eec 00000647 c098ba9c c0953544 ef083edc ef083ec0 c021b82c c04cb714
      3ec0: c09cdc50 00000040 ef0f1e00 ef1003c0 ef083f14 ef083ee0 c09535bc c021b7bc
      3ee0: c0953544 c04d0c6c c094e2cc c1600be4 c07440c4 c09a6888 00000002 c0a15f00
      3f00: ef082000 00000000 ef083f54 ef083f18 c0208728 c0953550 00000002 c1600bfc
      3f20: c08e3fac c0839918 ef083f54 c1600b80 c09a6888 c0a15f00 0000008b c094e2cc
      3f40: c098ba9c c098bab8 ef083f94 ef083f58 c094ea0c c020865c 00000002 00000002
      3f60: c094e2cc 00000000 c025b674 00000000 c06ff860 00000000 00000000 00000000
      3f80: 00000000 00000000 ef083fac ef083f98 c06ff878 c094e910 00000000 00000000
      3fa0: 00000000 ef083fb0 c020efe8 c06ff86c 00000000 00000000 00000000 00000000
      3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 c0595108
      [<c04cb874>] (ioremap_page_range+0x16c/0x198) from [<c021b82c>] (__alloc_remap_buffer.isra.18+0x7c/0xc4)
      [<c021b82c>] (__alloc_remap_buffer.isra.18+0x7c/0xc4) from [<c09535bc>] (atomic_pool_init+0x78/0x128)
      [<c09535bc>] (atomic_pool_init+0x78/0x128) from [<c0208728>] (do_one_initcall+0xd8/0x198)
      [<c0208728>] (do_one_initcall+0xd8/0x198) from [<c094ea0c>] (kernel_init_freeable+0x108/0x1d0)
      [<c094ea0c>] (kernel_init_freeable+0x108/0x1d0) from [<c06ff878>] (kernel_init+0x18/0xf4)
      [<c06ff878>] (kernel_init+0x18/0xf4) from [<c020efe8>] (ret_from_fork+0x14/0x20)
      Code: e50b0040 ebf54b2f e51b0040 eaffffee (e7f001f2)
      
      Fix it by telling generic layers about the static mapping via
      iotable_init().  This also has the nice side effect of letting
      you see the mapping in procfs' vmallocinfo file.
      
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Stephen Warren <swarren@nvidia.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ee4de5d9
  23. 17 6月, 2013 1 次提交
  24. 30 5月, 2013 4 次提交
  25. 24 5月, 2013 1 次提交