1. 17 2月, 2016 1 次提交
    • K
      ARM: 8411/1: Add default SPARSEMEM settings · db57f88e
      Kevin Cernekee 提交于
      We can still override these settings via mach/memory.h, but let's provide
      sensible defaults so that SPARSEMEM is available in the multiplatform
      kernels.
      
      Two platforms currently use SECTION_SIZE_BITS < 28, but are expected to
      work with 28 (albeit slightly less efficiently if not all banks are
      populated):
      
       - mach-rpc: uses 26 bits.  Based on mach/hardware.h it looks like this
         platform puts RAM at 0x1000_0000 - 0x1fff_ffff, and I/O below
         0x1000_0000.
      
       - mach-sa1100: uses 27 bits.  mach/memory.h indicates that RAM occupies
         the entire range of 0xc000_0000 - 0xdfff_ffff.
      
      But Arnd says in that rpc and sa1100 will never have to use the
      default since they cannot be part of a multiplatform kernel, and that
      is unlikely to change.
      
      Several platforms need MAX_PHYSMEM_BITS >= 36 so we'll pick that as the
      minimum.  Anything higher and we'll fail the SECTIONS_WIDTH + NODES_WIDTH +
      ZONES_WIDTH test in <linux/mm.h>.
      
      Some analysis from Russell King at
      http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/298957.html:
      
        I think this is fine in as far as it goes - this means we end up with
        256 entries in the mem_section array which means it occupies one page,
        which I think is acceptable overhead.
      
        The other thing to be aware of here is the obvious:
      
        #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS
        #error Allocator MAX_ORDER exceeds SECTION_SIZE
        #endif
      
        Which means that with 28 bits of section, that's a maximum allocator
        order of 16.  We appear to allow FORCE_MAX_ZONEORDER to be set up to
        64 in the case of shmobile, which doesn't seem like a sensible upper
        limit - and certainly isn't when sparsemem is enabled.
      
        Given this, I think that FORCE_MAX_ZONEORDER's help, and the
        dependencies probably could do with some improvement to make the
        issues more transparent.
      
      [gregory.0xf0: added notes from Arnd and Russell]
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Tested-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NGregory Fong <gregory.0xf0@gmail.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      db57f88e
  2. 11 2月, 2016 2 次提交
    • C
      ARM: 8518/1: Use correct symbols for XIP_KERNEL · 02afa9a8
      Chris Brandt 提交于
      For an XIP build, _etext does not represent the end of the
      binary image that needs to stay mapped into the MODULES_VADDR area.
      Years ago, data came before text in the memory map. However,
      now that the order is text/init/data, an XIP_KERNEL needs to map
      up to the data location in order to keep from cutting off
      parts of the kernel that are needed.
      We only map up to the beginning of data because data has already been
      copied, so there's no reason to keep it around anymore.
      A new symbol is created to make it clear what it is we are referring
      to.
      
      This fixes the bug where you might lose the end of your kernel area
      after page table setup is complete.
      Signed-off-by: NChris Brandt <chris.brandt@renesas.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      02afa9a8
    • N
      ARM: 8504/1: __arch_xprod_64(): small optimization · 73e592f3
      Nicolas Pitre 提交于
      The tmp variable is used twice: first to pose as a register containing
      a value of zero, and then to provide a temporary register that initially
      is zero and get added some value. But somehow gcc decides to split those
      two usages in different registers.
      
      Example code:
      
      u64 div64const1000(u64 x)
      {
      	u32 y = 1000;
      	do_div(x, y);
      	return x;
      }
      
      Result:
      
      div64const1000:
      	push	{r4, r5, r6, r7, lr}
      	mov	lr, #0
      	mov	r6, r0
      	mov	r7, r1
      	adr	r5, .L8
      	ldrd	r4, [r5]
      	mov	r1, lr
      	umull	r2, r3, r4, r6
      	cmn	r2, r4
      	adcs	r3, r3, r5
      	adc	r2, lr, #0
      	umlal	r3, r2, r5, r6
      	umlal	r3, r1, r4, r7
      	mov	r3, #0
      	adds	r2, r1, r2
      	adc	r3, r3, #0
      	umlal	r2, r3, r5, r7
      	lsr	r0, r2, #9
      	lsr	r1, r3, #9
      	orr	r0, r0, r3, lsl #23
      	pop	{r4, r5, r6, r7, pc}
      	.align	3
      .L8:
      	.word	-1924145349
      	.word	-2095944041
      
      Full kernel build size:
      
         text	   data	    bss	    dec	    hex	filename
      13663814	1553940	 351368	15569122	 ed90e2	vmlinux
      
      Here the two instances of 'tmp' are assigned to r1 and lr.
      
      To avoid that, let's mark the first 'tmp' usage in __arch_xprod_64()
      with a "+r" constraint even if the register is not written to, so to
      create a dependency for the second usage with the effect of enforcing
      a single temporary register throughout.
      
      Result:
      
      div64const1000:
      	push	{r4, r5, r6, r7}
      	movs	r3, #0
      	adr	r5, .L8
      	ldrd	r4, [r5]
      	umull	r6, r7, r4, r0
      	cmn	r6, r4
      	adcs	r7, r7, r5
      	adc	r6, r3, #0
      	umlal	r7, r6, r5, r0
      	umlal	r7, r3, r4, r1
      	mov	r7, #0
      	adds	r6, r3, r6
      	adc	r7, r7, #0
      	umlal	r6, r7, r5, r1
      	lsr	r0, r6, #9
      	lsr	r1, r7, #9
      	orr	r0, r0, r7, lsl #23
      	pop	{r4, r5, r6, r7}
      	bx	lr
      	.align	3
      .L8:
      	.word	-1924145349
      	.word	-2095944041
      
         text	   data	    bss	    dec	    hex	filename
      13663438	1553940	 351368	15568746	 ed8f6a	vmlinux
      
      This time 'tmp' is assigned to r3 and used throughout. However, by being
      assigned to r3, that blocks usage of the r2-r3 double register slot for
      64-bit values, forcing more registers to be spilled on the stack. Let's
      try to help it by forcing 'tmp' to the caller-saved ip register.
      
      Result:
      
      div64const1000:
      	stmfd	sp!, {r4, r5}
      	mov	ip, #0
      	adr	r5, .L8
      	ldrd	r4, [r5]
      	umull	r2, r3, r4, r0
      	cmn	r2, r4
      	adcs	r3, r3, r5
      	adc	r2, ip, #0
      	umlal	r3, r2, r5, r0
      	umlal	r3, ip, r4, r1
      	mov	r3, #0
      	adds	r2, ip, r2
      	adc	r3, r3, #0
      	umlal	r2, r3, r5, r1
      	mov	r0, r2, lsr #9
      	mov	r1, r3, lsr #9
      	orr	r0, r0, r3, asl #23
      	ldmfd	sp!, {r4, r5}
      	bx	lr
      	.align	3
      .L8:
      	.word	-1924145349
      	.word	-2095944041
      
         text	   data	    bss	    dec	    hex	filename
      13662838	1553940	 351368	15568146	 ed8d12	vmlinux
      
      We could make the code marginally smaller yet by forcing 'tmp' to lr
      instead, but that would have a negative inpact on branch prediction for
      which "bx lr" is optimal.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      73e592f3
  3. 08 2月, 2016 1 次提交
  4. 21 1月, 2016 1 次提交
    • C
      dma-mapping: always provide the dma_map_ops based implementation · e1c7e324
      Christoph Hellwig 提交于
      Move the generic implementation to <linux/dma-mapping.h> now that all
      architectures support it and remove the HAVE_DMA_ATTR Kconfig symbol now
      that everyone supports them.
      
      [valentinrothberg@gmail.com: remove leftovers in Kconfig]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Helge Deller <deller@gmx.de>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Steven Miao <realmz6@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Joerg Roedel <jroedel@suse.de>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Signed-off-by: NValentin Rothberg <valentinrothberg@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e1c7e324
  5. 16 1月, 2016 3 次提交
    • D
      kvm: rename pfn_t to kvm_pfn_t · ba049e93
      Dan Williams 提交于
      To date, we have implemented two I/O usage models for persistent memory,
      PMEM (a persistent "ram disk") and DAX (mmap persistent memory into
      userspace).  This series adds a third, DAX-GUP, that allows DAX mappings
      to be the target of direct-i/o.  It allows userspace to coordinate
      DMA/RDMA from/to persistent memory.
      
      The implementation leverages the ZONE_DEVICE mm-zone that went into
      4.3-rc1 (also discussed at kernel summit) to flag pages that are owned
      and dynamically mapped by a device driver.  The pmem driver, after
      mapping a persistent memory range into the system memmap via
      devm_memremap_pages(), arranges for DAX to distinguish pfn-only versus
      page-backed pmem-pfns via flags in the new pfn_t type.
      
      The DAX code, upon seeing a PFN_DEV+PFN_MAP flagged pfn, flags the
      resulting pte(s) inserted into the process page tables with a new
      _PAGE_DEVMAP flag.  Later, when get_user_pages() is walking ptes it keys
      off _PAGE_DEVMAP to pin the device hosting the page range active.
      Finally, get_page() and put_page() are modified to take references
      against the device driver established page mapping.
      
      Finally, this need for "struct page" for persistent memory requires
      memory capacity to store the memmap array.  Given the memmap array for a
      large pool of persistent may exhaust available DRAM introduce a
      mechanism to allocate the memmap from persistent memory.  The new
      "struct vmem_altmap *" parameter to devm_memremap_pages() enables
      arch_add_memory() to use reserved pmem capacity rather than the page
      allocator.
      
      This patch (of 18):
      
      The core has developed a need for a "pfn_t" type [1].  Move the existing
      pfn_t in KVM to kvm_pfn_t [2].
      
      [1]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002199.html
      [2]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002218.htmlSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NChristoffer Dall <christoffer.dall@linaro.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ba049e93
    • M
      arch/arm/include/asm/pgtable-3level.h: add pmd_mkclean for THP · 44842045
      Minchan Kim 提交于
      MADV_FREE needs pmd_dirty and pmd_mkclean for detecting recent overwrite
      of the contents since MADV_FREE syscall is called for THP page.
      
      This patch adds pmd_mkclean for THP page MADV_FREE support.
      Signed-off-by: NMinchan Kim <minchan@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Shaohua Li <shli@kernel.org>
      Cc: <yalin.wang2010@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Chen Gang <gang.chen.5i5j@gmail.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Daniel Micay <danielmicay@gmail.com>
      Cc: Darrick J. Wong <darrick.wong@oracle.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jason Evans <je@fb.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttil <mika.penttila@nextfour.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Shaohua Li <shli@kernel.org>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      44842045
    • K
      arm, thp: remove infrastructure for handling splitting PMDs · 0ebd7446
      Kirill A. Shutemov 提交于
      With new refcounting we don't need to mark PMDs splitting.  Let's drop
      code to handle this.
      
      pmdp_splitting_flush() is not needed too: on splitting PMD we will do
      pmdp_clear_flush() + set_pte_at().  pmdp_clear_flush() will do IPI as
      needed for fast_gup.
      
      [arnd@arndb.de: fix unterminated ifdef in header file]
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0ebd7446
  6. 13 1月, 2016 2 次提交
  7. 04 1月, 2016 1 次提交
  8. 22 12月, 2015 2 次提交
  9. 21 12月, 2015 3 次提交
  10. 18 12月, 2015 3 次提交
  11. 16 12月, 2015 1 次提交
    • A
      ARM: debug-ll: rework footbridge handling · 0045c0dd
      Arnd Bergmann 提交于
      Footbridge has two debug ports that are handled a bit differently:
      
      The 8250 port uses the normal debug/8250.S implementation that is shared
      with a lot of other platforms, but it relies on the DEBUG_UART_8250
      option to be turned on automatically instead of being selected by
      DEBUG_FOOTBRIDGE_COM1 as we do for most other platforms. I'm changing
      this to use a 'select' and change the dependency to the debug symbol
      rather than the platform symbol for consistency.
      
      The DC21285 UART has a separate top-level option, and relies on
      the traditional include/mach/debug-macro.S method. With the s3c64xx
      multiplatform series queued up for 4.5, it is now the last one that does
      this, so by moving this file to include/debug/dc21285.S, we can get
      all platforms to do things the same way.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      0045c0dd
  12. 15 12月, 2015 1 次提交
  13. 14 12月, 2015 5 次提交
  14. 11 12月, 2015 1 次提交
  15. 05 12月, 2015 1 次提交
    • P
      arm64: KVM: Correctly handle zero register during MMIO · bc45a516
      Pavel Fedin 提交于
      On ARM64 register index of 31 corresponds to both zero register and SP.
      However, all memory access instructions, use ZR as transfer register. SP
      is used only as a base register in indirect memory addressing, or by
      register-register arithmetics, which cannot be trapped here.
      
      Correct emulation is achieved by introducing new register accessor
      functions, which can do special handling for reg_num == 31. These new
      accessors intentionally do not rely on old vcpu_reg() on ARM64, because
      it is to be removed. Since the affected code is shared by both ARM
      flavours, implementations of these accessors are also added to ARM32 code.
      
      This patch fixes setting MMIO register to a random value (actually SP)
      instead of zero by something like:
      
       *((volatile int *)reg) = 0;
      
      compilers tend to generate "str wzr, [xx]" here
      
      [Marc: Fixed 32bit splat]
      Signed-off-by: NPavel Fedin <p.fedin@samsung.com>
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      bc45a516
  16. 03 12月, 2015 2 次提交
    • A
      ARM: 8457/1: psci-smp is built only for SMP · be95485a
      Arnd Bergmann 提交于
      The PSCI SMP implementation is built only when both CONFIG_SMP and
      CONFIG_ARM_PSCI are set, so a configuration that has the latter
      but not the former can get a link error when it tries to call
      psci_smp_available().
      
      arch/arm/mach-tegra/built-in.o: In function `tegra114_cpuidle_init':
      cpuidle-tegra114.c:(.init.text+0x52a): undefined reference to `psci_smp_available'
      
      This corrects the #ifdef in the psci.h header file to match the
      Makefile conditional we have for building that function.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      be95485a
    • A
      ARM: 8455/1: define __BUG as asm(BUG_INSTR) without CONFIG_BUG · e9c38ceb
      Arnd Bergmann 提交于
      Following (a long time after) a4b5d580 ("bug: Make BUG() always stop
      the machine"), this adapts the ARM architecture to no longer rely
      on the sub-optimal BUG() definition that has a silent endless loop
      but instead use the same trapping instruction that we have for
      the full BUG() support.
      
      This avoids hundreds of warnings like
      
      arch/arm/include/asm/xen/page.h: In function 'arbitrary_virt_to_machine':
      arch/arm/include/asm/xen/page.h:85:1: warning: no return statement in function returning non-void [-Wreturn-type]
      
      and also makes the code size slightly smaller. The behavior changes
      from silently stopping the kernel to an oops, and follows what x86
      does these days.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      e9c38ceb
  17. 02 12月, 2015 2 次提交
  18. 27 11月, 2015 1 次提交
  19. 20 11月, 2015 1 次提交
  20. 18 11月, 2015 1 次提交
  21. 10 11月, 2015 1 次提交
  22. 03 11月, 2015 1 次提交
    • G
      ARM/PCI: Replace pci_sys_data->align_resource with global function pointer · b3a72384
      Gabriele Paoloni 提交于
      dw_pcie_host_init() creates the PCI host bridge with pci_common_init_dev(),
      an ARM-specific function that supplies the ARM-specific pci_sys_data
      structure as the PCI "sysdata".  To use dw_pcie_host_init() on other
      architectures, we will copy the internals of pci_common_init_dev() into
      pcie-designware.c instead of calling it, and dw_pcie_host_init() will
      supply the DesignWare pcie_port structure as "sysdata".
      
      Most ARM "sysdata" users are specific to non-DesignWare host bridges;
      they'll be unaffected because those bridges will continue to have the ARM
      pci_sys_data.  Most of the rest are ARM-generic functions called by
      pci_common_init_dev(); these will be unaffected because dw_pcie_host_init()
      will no longer call pci_common_init().
      
      But the ARM pcibios_align_resource() can be called by the PCI core for any
      bridge, so it can't depend on sysdata since it may be either pci_sys_data
      or pcie_port.
      
      Remove the pcibios_align_resource() dependency on sysdata by replacing the
      pci_sys_data->align_resource pointer with a global function pointer.
      
      This is less general (we can no longer have per-host bridge
      align_resource() methods), but the pci_sys_data->align_resource pointer was
      used only by Marvell (see mvebu_pcie_enable()), so this would only be a
      problem if we had a system with a combination of Marvell and other host
      bridges
      
      [bhelgaas: changelog]
      Signed-off-by: NGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: NZhou Wang <wangzhou1@hisilicon.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NPratyush Anand <pratyush.anand@gmail.com>
      b3a72384
  23. 27 10月, 2015 1 次提交
  24. 24 10月, 2015 1 次提交
  25. 23 10月, 2015 1 次提交