Re: [PATCH v3] Make any 32-bit time based syscalls unavailable for TIMESIZE==64

2020-04-22 Thread Vineet Gupta
On 4/18/20 9:50 AM, Florian Weimer wrote:
> * Vineet Gupta via Libc-alpha:
> 
>>
>> If this is not suitable for common code, I'd still like to add this
>> as part of ARC port to safe guard against future snafus.
> 
> Have you tried to add the #undefs to fixup-asm-unistd.h?
> See sysdeps/unix/sysv/linux/arm/fixup-asm-unistd.h for an example.
> 
> I have not tried if #undefs work there, but they should.  If not, we
> can fix that.

undef works great in arc/fixup-asm-unistd.h
Thx for the hint !

-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 04/21] mm: free_area_init: use maximal zone PFNs rather than zone sizes

2020-04-22 Thread Baoquan He
On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport 
> 
> Currently, architectures that use free_area_init() to initialize memory map
> and node and zone structures need to calculate zone and hole sizes. We can
> use free_area_init_nodes() instead and let it detect the zone boundaries
> while the architectures will only have to supply the possible limits for
> the zones.
> 
> Signed-off-by: Mike Rapoport 
> ---
>  arch/alpha/mm/init.c| 16 ++--
>  arch/c6x/mm/init.c  |  8 +++-
>  arch/h8300/mm/init.c|  6 +++---
>  arch/hexagon/mm/init.c  |  6 +++---
>  arch/m68k/mm/init.c |  6 +++---
>  arch/m68k/mm/mcfmmu.c   |  9 +++--
>  arch/nds32/mm/init.c| 11 ---
>  arch/nios2/mm/init.c|  8 +++-
>  arch/openrisc/mm/init.c |  9 +++--
>  arch/um/kernel/mem.c| 12 
>  include/linux/mm.h  |  2 +-
>  mm/page_alloc.c |  5 ++---
>  12 files changed, 38 insertions(+), 60 deletions(-)
> 
> diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
> index 12e218d3792a..667cd21393b5 100644
> --- a/arch/alpha/mm/init.c
> +++ b/arch/alpha/mm/init.c
> @@ -243,21 +243,17 @@ callback_init(void * kernel_end)
>   */
>  void __init paging_init(void)
>  {
> - unsigned long zones_size[MAX_NR_ZONES] = {0, };
> - unsigned long dma_pfn, high_pfn;
> + unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
> + unsigned long dma_pfn;
>  
>   dma_pfn = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
> - high_pfn = max_pfn = max_low_pfn;
> + max_pfn = max_low_pfn;
>  
> - if (dma_pfn >= high_pfn)
> - zones_size[ZONE_DMA] = high_pfn;
> - else {
> - zones_size[ZONE_DMA] = dma_pfn;
> - zones_size[ZONE_NORMAL] = high_pfn - dma_pfn;
> - }
> + max_zone_pfn[ZONE_DMA] = dma_pfn;
> + max_zone_pfn[ZONE_NORMAL] = max_pfn;
>  
>   /* Initialize mem_map[].  */
> - free_area_init(zones_size);
> + free_area_init(max_zone_pfn);
>  
>   /* Initialize the kernel's ZERO_PGE. */
>   memset((void *)ZERO_PGE, 0, PAGE_SIZE);
> diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
> index 9b374393a8f4..a97e51a3e26d 100644
> --- a/arch/c6x/mm/init.c
> +++ b/arch/c6x/mm/init.c
> @@ -33,7 +33,7 @@ EXPORT_SYMBOL(empty_zero_page);
>  void __init paging_init(void)
>  {
>   struct pglist_data *pgdat = NODE_DATA(0);
> - unsigned long zones_size[MAX_NR_ZONES] = {0, };
> + unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
>  
>   empty_zero_page  = (unsigned long) memblock_alloc(PAGE_SIZE,
> PAGE_SIZE);
> @@ -49,11 +49,9 @@ void __init paging_init(void)
>   /*
>* Define zones
>*/
> - zones_size[ZONE_NORMAL] = (memory_end - PAGE_OFFSET) >> PAGE_SHIFT;
> - pgdat->node_zones[ZONE_NORMAL].zone_start_pfn =
> - __pa(PAGE_OFFSET) >> PAGE_SHIFT;
> + max_zone_pfn[ZONE_NORMAL] = memory_end >> PAGE_SHIFT;
>  
> - free_area_init(zones_size);
> + free_area_init(max_zone_pfn);
>  }
>  
>  void __init mem_init(void)
> diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
> index 1eab16b1a0bc..27a0020e3771 100644
> --- a/arch/h8300/mm/init.c
> +++ b/arch/h8300/mm/init.c
> @@ -83,10 +83,10 @@ void __init paging_init(void)
>start_mem, end_mem);
>  
>   {
> - unsigned long zones_size[MAX_NR_ZONES] = {0, };
> + unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
>  
> - zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
> - free_area_init(zones_size);
> + max_zone_pfn[ZONE_NORMAL] = end_mem >> PAGE_SHIFT;
> + free_area_init(max_zone_pfn);
>   }
>  }
>  
> diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c
> index c961773a6fff..f2e6c868e477 100644
> --- a/arch/hexagon/mm/init.c
> +++ b/arch/hexagon/mm/init.c
> @@ -91,7 +91,7 @@ void sync_icache_dcache(pte_t pte)
>   */
>  void __init paging_init(void)
>  {
> - unsigned long zones_sizes[MAX_NR_ZONES] = {0, };
> + unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, };
>  
>   /*
>*  This is not particularly well documented anywhere, but
> @@ -101,9 +101,9 @@ void __init paging_init(void)
>*  adjust accordingly.
>*/
>  
> - zones_sizes[ZONE_NORMAL] = max_low_pfn;
> + max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
>  
> - free_area_init(zones_sizes);  /*  sets up the zonelists and mem_map  */
> + free_area_init(max_zone_pfn);  /*  sets up the zonelists and mem_map  */
>  
>   /*
>* Start of high memory area.  Will probably need something more
> diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
> index b88d510d4fe3..6d3147662ff2 100644
> --- a/arch/m68k/mm/init.c
> +++ b/arch/m68k/mm/init.c
> @@ -84,7 +84,7 @@ void __init paging_init(void)
>* page_alloc get different views of the world.
>*/
>   unsigned long end_mem = memory_end &

Re: [PATCH 05/21] mm: use free_area_init() instead of free_area_init_nodes()

2020-04-22 Thread Baoquan He
On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport 
> 
> The free_area_init() has effectively became a wrapper for
> free_area_init_nodes() and there is no point of keeping it. Still
> free_area_init() name is shorter and more general as it does not imply
> necessity to initialize multiple nodes.
> 
> Rename free_area_init_nodes() to free_area_init(), update the callers and
> drop old version of free_area_init().
> 
> Signed-off-by: Mike Rapoport 
> ---
>  arch/arm64/mm/init.c |  2 +-
>  arch/ia64/mm/contig.c|  2 +-
>  arch/ia64/mm/discontig.c |  2 +-
>  arch/microblaze/mm/init.c|  2 +-
>  arch/mips/loongson64/numa.c  |  2 +-
>  arch/mips/mm/init.c  |  2 +-
>  arch/mips/sgi-ip27/ip27-memory.c |  2 +-
>  arch/powerpc/mm/mem.c|  2 +-
>  arch/riscv/mm/init.c |  2 +-
>  arch/s390/mm/init.c  |  2 +-
>  arch/sh/mm/init.c|  2 +-
>  arch/sparc/mm/init_64.c  |  2 +-
>  arch/x86/mm/init.c   |  2 +-
>  include/linux/mm.h   |  7 +++
>  mm/page_alloc.c  | 10 ++
>  15 files changed, 18 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index e42727e3568e..a650adb358ee 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -206,7 +206,7 @@ static void __init zone_sizes_init(unsigned long min, 
> unsigned long max)
>  #endif
>   max_zone_pfns[ZONE_NORMAL] = max;
>  
> - free_area_init_nodes(max_zone_pfns);
> + free_area_init(max_zone_pfns);
>  }
>  
>  #else
> diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
> index 5b00dc3898e1..8786fa5c7612 100644
> --- a/arch/ia64/mm/contig.c
> +++ b/arch/ia64/mm/contig.c
> @@ -210,6 +210,6 @@ paging_init (void)
>   printk("Virtual mem_map starts at 0x%p\n", mem_map);
>   }
>  #endif /* !CONFIG_VIRTUAL_MEM_MAP */
> - free_area_init_nodes(max_zone_pfns);
> + free_area_init(max_zone_pfns);
>   zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
>  }
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 4f33f6e7e206..dd8284bcbf16 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -627,7 +627,7 @@ void __init paging_init(void)
>   max_zone_pfns[ZONE_DMA32] = max_dma;
>  #endif
>   max_zone_pfns[ZONE_NORMAL] = max_pfn;
> - free_area_init_nodes(max_zone_pfns);
> + free_area_init(max_zone_pfns);
>  
>   zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
>  }
> diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
> index 1ffbfa96b9b8..dcaa53d11339 100644
> --- a/arch/microblaze/mm/init.c
> +++ b/arch/microblaze/mm/init.c
> @@ -112,7 +112,7 @@ static void __init paging_init(void)
>  #endif
>  
>   /* We don't have holes in memory map */
> - free_area_init_nodes(zones_size);
> + free_area_init(zones_size);
>  }
>  
>  void __init setup_memory(void)
> diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
> index 1ae072df4831..901f5be5ee76 100644
> --- a/arch/mips/loongson64/numa.c
> +++ b/arch/mips/loongson64/numa.c
> @@ -247,7 +247,7 @@ void __init paging_init(void)
>   zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
>  #endif
>   zones_size[ZONE_NORMAL] = max_low_pfn;
> - free_area_init_nodes(zones_size);
> + free_area_init(zones_size);
>  }
>  
>  void __init mem_init(void)
> diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
> index 79684000de0e..19719e8b41a5 100644
> --- a/arch/mips/mm/init.c
> +++ b/arch/mips/mm/init.c
> @@ -418,7 +418,7 @@ void __init paging_init(void)
>   }
>  #endif
>  
> - free_area_init_nodes(max_zone_pfns);
> + free_area_init(max_zone_pfns);
>  }
>  
>  #ifdef CONFIG_64BIT
> diff --git a/arch/mips/sgi-ip27/ip27-memory.c 
> b/arch/mips/sgi-ip27/ip27-memory.c
> index a45691e6ab90..1213215ea965 100644
> --- a/arch/mips/sgi-ip27/ip27-memory.c
> +++ b/arch/mips/sgi-ip27/ip27-memory.c
> @@ -419,7 +419,7 @@ void __init paging_init(void)
>  
>   pagetable_init();
>   zones_size[ZONE_NORMAL] = max_low_pfn;
> - free_area_init_nodes(zones_size);
> + free_area_init(zones_size);
>  }
>  
>  void __init mem_init(void)
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 041ed7cfd341..0fcea21f26b4 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -271,7 +271,7 @@ void __init paging_init(void)
>   max_zone_pfns[ZONE_HIGHMEM] = max_pfn;
>  #endif
>  
> - free_area_init_nodes(max_zone_pfns);
> + free_area_init(max_zone_pfns);
>  
>   mark_nonram_nosave();
>  }
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index b55be44ff9bd..f2ceab77b8e6 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -39,7 +39,7 @@ static void __init zone_sizes_init(void)
>  #endif
>   max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
>  
> - free_area_init_nodes(max

Re: [PATCH 16/21] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES

2020-04-22 Thread Baoquan He
On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport 
> 
> The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions

This commit id should be a temporary one, will be changed when merged
into maintainer's tree and linus's tree. Only saying last patch plus the
patch subject is OK?

> rather that check each PFN") made early_pfn_in_nid() obsolete and since
> CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> implementation of early_pfn_in_nid() it is also not needed anymore.
> 
> Remove both early_pfn_in_nid() and the CONFIG_NODES_SPAN_OTHER_NODES.
> 
> Co-developed-by: Hoan Tran 
> Signed-off-by: Hoan Tran 
> Signed-off-by: Mike Rapoport 
> ---
>  arch/powerpc/Kconfig |  9 -
>  arch/sparc/Kconfig   |  9 -
>  arch/x86/Kconfig |  9 -
>  mm/page_alloc.c  | 20 
>  4 files changed, 47 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 5f86b22b7d2c..74f316deeae1 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -685,15 +685,6 @@ config ARCH_MEMORY_PROBE
>   def_bool y
>   depends on MEMORY_HOTPLUG
>  
> -# Some NUMA nodes have memory ranges that span
> -# other nodes.  Even though a pfn is valid and
> -# between a node's start and end pfns, it may not
> -# reside on that node.  See memmap_init_zone()
> -# for details.
> -config NODES_SPAN_OTHER_NODES
> - def_bool y
> - depends on NEED_MULTIPLE_NODES
> -
>  config STDBINUTILS
>   bool "Using standard binutils settings"
>   depends on 44x
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 795206b7b552..0e4f3891b904 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -286,15 +286,6 @@ config NODES_SHIFT
> Specify the maximum number of NUMA Nodes available on the target
> system.  Increases memory reserved to accommodate various tables.
>  
> -# Some NUMA nodes have memory ranges that span
> -# other nodes.  Even though a pfn is valid and
> -# between a node's start and end pfns, it may not
> -# reside on that node.  See memmap_init_zone()
> -# for details.
> -config NODES_SPAN_OTHER_NODES
> - def_bool y
> - depends on NEED_MULTIPLE_NODES
> -
>  config ARCH_SPARSEMEM_ENABLE
>   def_bool y if SPARC64
>   select SPARSEMEM_VMEMMAP_ENABLE
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 9d3e95b4fb85..37dac095659e 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1581,15 +1581,6 @@ config X86_64_ACPI_NUMA
>   ---help---
> Enable ACPI SRAT based node topology detection.
>  
> -# Some NUMA nodes have memory ranges that span
> -# other nodes.  Even though a pfn is valid and
> -# between a node's start and end pfns, it may not
> -# reside on that node.  See memmap_init_zone()
> -# for details.
> -config NODES_SPAN_OTHER_NODES
> - def_bool y
> - depends on X86_64_ACPI_NUMA
> -
>  config NUMA_EMU
>   bool "NUMA emulation"
>   depends on NUMA
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index c43ce8709457..343d87b8697d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1541,26 +1541,6 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
>  }
>  #endif /* CONFIG_NEED_MULTIPLE_NODES */
>  
> -#ifdef CONFIG_NODES_SPAN_OTHER_NODES
> -/* Only safe to use early in boot when initialisation is single-threaded */
> -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> -{
> - int nid;
> -
> - nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
> - if (nid >= 0 && nid != node)
> - return false;
> - return true;
> -}
> -
> -#else
> -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> -{
> - return true;
> -}
> -#endif

And macro early_pfn_valid() is not needed either, we may need remove it
too. 

Otherwise, removing NODES_SPAN_OTHER_NODES in this patch looks good.

Reviewed-by: Baoquan He 

> -
> -
>  void __init memblock_free_pages(struct page *page, unsigned long pfn,
>   unsigned int order)
>  {
> -- 
> 2.25.1
> 


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v6 08/13] ARC: Linux ABI

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/nptl/pthreaddef.h | 32 +++
 sysdeps/unix/sysv/linux/arc/bits/procfs.h | 35 +++
 .../sysv/linux/arc/bits/types/__sigset_t.h| 12 +++
 sysdeps/unix/sysv/linux/arc/getcontext.S  | 63 +
 sysdeps/unix/sysv/linux/arc/makecontext.c | 73 +++
 sysdeps/unix/sysv/linux/arc/setcontext.S  | 92 +++
 sysdeps/unix/sysv/linux/arc/sigcontextinfo.h  | 28 ++
 sysdeps/unix/sysv/linux/arc/swapcontext.S | 92 +++
 sysdeps/unix/sysv/linux/arc/sys/cachectl.h| 36 
 sysdeps/unix/sysv/linux/arc/sys/ucontext.h| 61 
 sysdeps/unix/sysv/linux/arc/sys/user.h| 31 +++
 sysdeps/unix/sysv/linux/arc/ucontext-macros.h | 29 ++
 sysdeps/unix/sysv/linux/arc/ucontext_i.sym| 20 
 13 files changed, 604 insertions(+)
 create mode 100644 sysdeps/arc/nptl/pthreaddef.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/bits/procfs.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/bits/types/__sigset_t.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/getcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/makecontext.c
 create mode 100644 sysdeps/unix/sysv/linux/arc/setcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/sigcontextinfo.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/swapcontext.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/sys/cachectl.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/sys/ucontext.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/sys/user.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/ucontext-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/ucontext_i.sym

diff --git a/sysdeps/arc/nptl/pthreaddef.h b/sysdeps/arc/nptl/pthreaddef.h
new file mode 100644
index ..b265bf1a052c
--- /dev/null
+++ b/sysdeps/arc/nptl/pthreaddef.h
@@ -0,0 +1,32 @@
+/* pthread machine parameter definitions, ARC version.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+/* Default stack size.  */
+#define ARCH_STACK_DEFAULT_SIZE(2 * 1024 * 1024)
+
+/* Required stack pointer alignment at beginning.  */
+#define STACK_ALIGN4
+
+/* Minimal stack size after allocating thread descriptor and guard size.  */
+#define MINIMAL_REST_STACK 2048
+
+/* Alignment requirement for TCB.  */
+#define TCB_ALIGNMENT  4
+
+/* Location of current stack frame.  */
+#define CURRENT_STACK_FRAME__builtin_frame_address (0)
diff --git a/sysdeps/unix/sysv/linux/arc/bits/procfs.h 
b/sysdeps/unix/sysv/linux/arc/bits/procfs.h
new file mode 100644
index ..465c40c71bbd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/bits/procfs.h
@@ -0,0 +1,35 @@
+/* Types for registers for sys/procfs.h.  ARC version.
+   Copyright (C) 1996-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef _SYS_PROCFS_H
+# error "Never include  directly; use  instead."
+#endif
+
+#include 
+
+/* And the whole bunch of them.  We could have used `struct
+   user_regs' directly in the typedef, but tradition says that
+   the register set is an array, which does have some peculiar
+   semantics, so leave it that way.  */
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t))
+
+typedef unsigned long int elf_greg_t;
+typedef unsigned long int elf_gregset_t[ELF_NGREG];
+
+/* There's no seperate floating point reg file in ARCv2.  */
+typedef struct { } elf_fpregset_t;
diff --git a/sysdeps/unix/sysv/linux/arc/bits/types/__sigset_t.h 
b/sysdeps/uni

[PATCH v6 13/13] Documentation for ARC port

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 NEWS| 9 +
 README  | 1 +
 manual/install.texi | 4 
 3 files changed, 14 insertions(+)

diff --git a/NEWS b/NEWS
index 0e627b34057d..d59c1ffb96e1 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,15 @@ Major new features:
 
 * New locale added: ckb_IQ (Kurdish/Sorani spoken in Iraq)
 
+* Support for Synopsys ARC HS cores (ARCv2 ISA) running Linux.
+
+  Port requires at least
+- binutils-2.32 (binutils-2_31-branch: commit 6ce881c15fc4, 2018-10-04)
+- gcc 8.3 (gcc-8-stable: commit 0d5ba57508c5, 2019-01-29)
+- Linux kernel 5.1+ (64-bit time and offsets)
+
+  Both Little and Big-Endian supported
+
 * The GNU C Library now loads audit modules listed in the DT_AUDIT and
   DT_DEPAUDIT dynamic section entries of the main executable.
 
diff --git a/README b/README
index 31c5da0405bd..903f07e4840a 100644
--- a/README
+++ b/README
@@ -24,6 +24,7 @@ The GNU C Library supports these configurations for using 
Linux kernels:
 
aarch64*-*-linux-gnu
alpha*-*-linux-gnu
+   arc*-*-linux-gnu
arm-*-linux-gnueabi
csky-*-linux-gnuabiv2
hppa-*-linux-gnu
diff --git a/manual/install.texi b/manual/install.texi
index 71bf47cac659..e1f15656cdc0 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -507,6 +507,8 @@ the newest version of the compiler that is known to work 
for building
 release time, GCC 9.2.1 is the newest compiler verified to work to build
 @theglibc{}.
 
+For ARC architecture builds, GCC 8.3 or higher is needed.
+
 For multi-arch support it is recommended to use a GCC which has been built with
 support for GNU indirect functions.  This ensures that correct debugging
 information is generated for functions selected by IFUNC resolvers.  This
@@ -528,6 +530,8 @@ No other assembler or linker has the necessary 
functionality at the
 moment. As of release time, GNU @code{binutils} 2.32 is the newest
 verified to work to build @theglibc{}.
 
+ARC architecture needs @code{binutils} 2.32 or higher for TLS related fixes.
+
 @item
 GNU @code{texinfo} 4.7 or later
 
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v6 04/13] ARC: Atomics and Locking primitives

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/atomic-machine.h  | 69 +++
 sysdeps/arc/nptl/bits/semaphore.h | 32 ++
 2 files changed, 101 insertions(+)
 create mode 100644 sysdeps/arc/atomic-machine.h
 create mode 100644 sysdeps/arc/nptl/bits/semaphore.h

diff --git a/sysdeps/arc/atomic-machine.h b/sysdeps/arc/atomic-machine.h
new file mode 100644
index ..6cf128dc7fa8
--- /dev/null
+++ b/sysdeps/arc/atomic-machine.h
@@ -0,0 +1,69 @@
+/* Low-level functions for atomic operations. ARC version.
+   Copyright (C) 2012-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef _ARC_BITS_ATOMIC_H
+#define _ARC_BITS_ATOMIC_H 1
+
+#include 
+
+typedef int32_t atomic32_t;
+typedef uint32_t uatomic32_t;
+typedef int_fast32_t atomic_fast32_t;
+typedef uint_fast32_t uatomic_fast32_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 1
+
+/* ARC does have legacy atomic EX reg, [mem] instruction but the micro-arch
+   is not as optimal as LLOCK/SCOND specially for SMP.  */
+#define ATOMIC_EXCHANGE_USES_CAS 1
+
+#define __arch_compare_and_exchange_bool_8_acq(mem, newval, oldval)\
+  (abort (), 0)
+#define __arch_compare_and_exchange_bool_16_acq(mem, newval, oldval)   \
+  (abort (), 0)
+#define __arch_compare_and_exchange_bool_64_acq(mem, newval, oldval)   \
+  (abort (), 0)
+
+#define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model)  
\
+  (abort (), (__typeof (*mem)) 0)
+#define __arch_compare_and_exchange_val_16_int(mem, newval, oldval, model) 
\
+  (abort (), (__typeof (*mem)) 0)
+#define __arch_compare_and_exchange_val_64_int(mem, newval, oldval, model) 
\
+  (abort (), (__typeof (*mem)) 0)
+
+#define __arch_compare_and_exchange_val_32_int(mem, newval, oldval, model) 
\
+  ({   
\
+typeof (*mem) __oldval = (oldval); 
\
+__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0,   
\
+ model, __ATOMIC_RELAXED); 
\
+__oldval;  
\
+  })
+
+#define atomic_compare_and_exchange_val_acq(mem, new, old) \
+  __atomic_val_bysize (__arch_compare_and_exchange_val, int,   \
+  mem, new, old, __ATOMIC_ACQUIRE)
+
+#define atomic_full_barrier()  ({ asm volatile ("dmb 3":::"memory"); })
+
+#endif /* _ARC_BITS_ATOMIC_H */
diff --git a/sysdeps/arc/nptl/bits/semaphore.h 
b/sysdeps/arc/nptl/bits/semaphore.h
new file mode 100644
index ..772dc4cb9b01
--- /dev/null
+++ b/sysdeps/arc/nptl/bits/semaphore.h
@@ -0,0 +1,32 @@
+/* Machine-specific POSIX semaphore type layouts.  ARC version.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#ifndef _SEMAPHORE_H
+# error "Never use  directly; include  instead."
+#endif
+
+#define __SIZEOF_SEM_T 16
+
+/* Value returned if `sem_open' failed.  */
+#define SEM_FAILED  ((sem_t *) 0)
+
+typedef union
+{
+  char __size[__SIZEOF_SEM_T];
+  long int __align;
+} sem_t;
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v6 11/13] ARC: Build Infrastructure

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 config.h.in|   3 +
 sysdeps/arc/Implies|   3 +
 sysdeps/arc/Makefile   |  21 +++
 sysdeps/arc/Versions   |   8 +
 sysdeps/arc/configure  | 182 +
 sysdeps/arc/configure.ac   |  26 +++
 sysdeps/arc/nptl/Makefile  |  22 +++
 sysdeps/arc/preconfigure   |  14 ++
 sysdeps/unix/sysv/linux/arc/Implies|   3 +
 sysdeps/unix/sysv/linux/arc/Makefile   |  29 
 sysdeps/unix/sysv/linux/arc/Versions   |  16 ++
 sysdeps/unix/sysv/linux/arc/configure  |   4 +
 sysdeps/unix/sysv/linux/arc/configure.ac   |   4 +
 sysdeps/unix/sysv/linux/arc/ldconfig.h |  27 +++
 sysdeps/unix/sysv/linux/arc/shlib-versions |   7 +
 15 files changed, 369 insertions(+)
 create mode 100644 sysdeps/arc/Implies
 create mode 100644 sysdeps/arc/Makefile
 create mode 100644 sysdeps/arc/Versions
 create mode 100644 sysdeps/arc/configure
 create mode 100644 sysdeps/arc/configure.ac
 create mode 100644 sysdeps/arc/nptl/Makefile
 create mode 100644 sysdeps/arc/preconfigure
 create mode 100644 sysdeps/unix/sysv/linux/arc/Implies
 create mode 100644 sysdeps/unix/sysv/linux/arc/Makefile
 create mode 100644 sysdeps/unix/sysv/linux/arc/Versions
 create mode 100644 sysdeps/unix/sysv/linux/arc/configure
 create mode 100644 sysdeps/unix/sysv/linux/arc/configure.ac
 create mode 100644 sysdeps/unix/sysv/linux/arc/ldconfig.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/shlib-versions

diff --git a/config.h.in b/config.h.in
index dea43df438f6..08962dfed075 100644
--- a/config.h.in
+++ b/config.h.in
@@ -109,6 +109,9 @@
 /* AArch64 big endian ABI */
 #undef HAVE_AARCH64_BE
 
+/* ARC big endian ABI */
+#undef HAVE_ARC_BE
+
 /* C-SKY ABI version.  */
 #undef CSKYABI
 
diff --git a/sysdeps/arc/Implies b/sysdeps/arc/Implies
new file mode 100644
index ..780c4e246769
--- /dev/null
+++ b/sysdeps/arc/Implies
@@ -0,0 +1,3 @@
+wordsize-32
+ieee754/flt-32
+ieee754/dbl-64
diff --git a/sysdeps/arc/Makefile b/sysdeps/arc/Makefile
new file mode 100644
index ..56ac503bfe43
--- /dev/null
+++ b/sysdeps/arc/Makefile
@@ -0,0 +1,21 @@
+# ARC Makefile
+# Copyright (C) 1993-2020 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library.  If not, see
+# .
+
+# We don't support long doubles as a distinct type.  We don't need to set
+# this variable; it's here mostly for documentational purposes.
+long-double-fcts = no
diff --git a/sysdeps/arc/Versions b/sysdeps/arc/Versions
new file mode 100644
index ..6ac7b8e49505
--- /dev/null
+++ b/sysdeps/arc/Versions
@@ -0,0 +1,8 @@
+libc {
+  GLIBC_2.32 {
+__mcount;
+  }
+  GLIBC_PRIVATE {
+__syscall_error;
+  }
+}
diff --git a/sysdeps/arc/configure b/sysdeps/arc/configure
new file mode 100644
index ..5820017d6505
--- /dev/null
+++ b/sysdeps/arc/configure
@@ -0,0 +1,182 @@
+# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/arc.
+
+$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
+
+libc_cv_have_sdata_section=no
+
+# For ARC, historically ; was used for comments and not newline
+# Later # also got added to comment list, but ; couldn't be switched to
+# canonical newline as there's lots of code out there which will break
+libc_cv_asm_line_sep='`'
+cat >>confdefs.h <<_ACEOF
+#define ASM_LINE_SEP $libc_cv_asm_line_sep
+_ACEOF
+
+
+# For big endian ABI, generate a symbol for selecting right dynamic linker
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long 
lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+for ac_prog in grep ggrep; do
+for ac_exec_ext in '' $ac_executable_extensions; do
+  ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+  as_fn_executable_p "$ac_path_GREP" || continue
+# Check for 

[PATCH v6 03/13] ARC: Thread Local Storage support

2020-04-22 Thread Vineet Gupta
This includes all 4 TLS addressing models

Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/dl-tls.h |  30 +++
 sysdeps/arc/libc-tls.c   |  27 ++
 sysdeps/arc/nptl/tcb-offsets.sym |  11 +++
 sysdeps/arc/nptl/tls.h   | 150 +++
 sysdeps/arc/stackinfo.h  |  33 +++
 5 files changed, 251 insertions(+)
 create mode 100644 sysdeps/arc/dl-tls.h
 create mode 100644 sysdeps/arc/libc-tls.c
 create mode 100644 sysdeps/arc/nptl/tcb-offsets.sym
 create mode 100644 sysdeps/arc/nptl/tls.h
 create mode 100644 sysdeps/arc/stackinfo.h

diff --git a/sysdeps/arc/dl-tls.h b/sysdeps/arc/dl-tls.h
new file mode 100644
index ..2269ac6c3daa
--- /dev/null
+++ b/sysdeps/arc/dl-tls.h
@@ -0,0 +1,30 @@
+/* Thread-local storage handling in the ELF dynamic linker.  ARC version.
+   Copyright (C) 2012-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+
+/* Type used for the representation of TLS information in the GOT.  */
+typedef struct
+{
+  unsigned long int ti_module;
+  unsigned long int ti_offset;
+} tls_index;
+
+extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed.  */
+#define TLS_DTV_UNALLOCATED((void *) -1l)
diff --git a/sysdeps/arc/libc-tls.c b/sysdeps/arc/libc-tls.c
new file mode 100644
index ..ec88282de60e
--- /dev/null
+++ b/sysdeps/arc/libc-tls.c
@@ -0,0 +1,27 @@
+/* Thread-local storage handling in the ELF dynamic linker.  ARC version.
+   Copyright (C) 2005-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#include 
+#include 
+
+void *
+__tls_get_addr (tls_index *ti)
+{
+  dtv_t *dtv = THREAD_DTV ();
+  return (char *) dtv[1].pointer.val + ti->ti_offset;
+}
diff --git a/sysdeps/arc/nptl/tcb-offsets.sym b/sysdeps/arc/nptl/tcb-offsets.sym
new file mode 100644
index ..64c432c22e76
--- /dev/null
+++ b/sysdeps/arc/nptl/tcb-offsets.sym
@@ -0,0 +1,11 @@
+#include 
+#include 
+
+-- Derive offsets relative to the thread register.
+#define thread_offsetof(mem)   (long)(offsetof (struct pthread, mem) - sizeof 
(struct pthread))
+
+MULTIPLE_THREADS_OFFSEToffsetof (struct pthread, 
header.multiple_threads)
+TLS_PRE_TCB_SIZE   sizeof (struct pthread)
+TLS_TCB_SIZE   sizeof (tcbhead_t)
+
+PTHREAD_TIDoffsetof (struct pthread, tid)
diff --git a/sysdeps/arc/nptl/tls.h b/sysdeps/arc/nptl/tls.h
new file mode 100644
index ..a836af121a85
--- /dev/null
+++ b/sysdeps/arc/nptl/tls.h
@@ -0,0 +1,150 @@
+/* Definition for thread-local data handling.  NPTL/ARC version.
+   Copyright (C) 2012-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef _ARC_NPTL_TLS_H
+#define _ARC_NPTL_TLS_H1
+
+#include 
+
+#ifndef __ASSEMBLER__
+# in

[PATCH v6 07/13] ARC: Linux Syscall Interface

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/unix/sysv/linux/arc/arch-syscall.h| 303 ++
 sysdeps/unix/sysv/linux/arc/bits/timesize.h   |  21 ++
 sysdeps/unix/sysv/linux/arc/clone.S   |  98 ++
 .../unix/sysv/linux/arc/fixup-asm-unistd.h|  41 +++
 sysdeps/unix/sysv/linux/arc/jmp_buf-macros.h  |   6 +
 sysdeps/unix/sysv/linux/arc/kernel-features.h |  28 ++
 sysdeps/unix/sysv/linux/arc/kernel_stat.h |  26 ++
 sysdeps/unix/sysv/linux/arc/mmap_internal.h   |  27 ++
 sysdeps/unix/sysv/linux/arc/pt-vfork.S|   1 +
 sysdeps/unix/sysv/linux/arc/sigaction.c   |  31 ++
 sysdeps/unix/sysv/linux/arc/sigrestorer.S |  29 ++
 sysdeps/unix/sysv/linux/arc/syscall.S |  33 ++
 sysdeps/unix/sysv/linux/arc/syscalls.list |   3 +
 sysdeps/unix/sysv/linux/arc/sysctl.mk |   1 +
 sysdeps/unix/sysv/linux/arc/sysdep.c  |  33 ++
 sysdeps/unix/sysv/linux/arc/sysdep.h  | 224 +
 sysdeps/unix/sysv/linux/arc/vfork.S   |  42 +++
 17 files changed, 947 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/arc/arch-syscall.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/bits/timesize.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/clone.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/fixup-asm-unistd.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/jmp_buf-macros.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/kernel-features.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/kernel_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/mmap_internal.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/pt-vfork.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/sigaction.c
 create mode 100644 sysdeps/unix/sysv/linux/arc/sigrestorer.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/syscall.S
 create mode 100644 sysdeps/unix/sysv/linux/arc/syscalls.list
 create mode 100644 sysdeps/unix/sysv/linux/arc/sysctl.mk
 create mode 100644 sysdeps/unix/sysv/linux/arc/sysdep.c
 create mode 100644 sysdeps/unix/sysv/linux/arc/sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/arc/vfork.S

diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h 
b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
new file mode 100644
index ..2b017eb5bbaa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
@@ -0,0 +1,303 @@
+/* AUTOGENERATED by update-syscall-lists.py.  */
+#define __NR_accept 202
+#define __NR_accept4 242
+#define __NR_acct 89
+#define __NR_add_key 217
+#define __NR_adjtimex 171
+#define __NR_arc_gettls 246
+#define __NR_arc_settls 245
+#define __NR_arc_usr_cmpxchg 248
+#define __NR_bind 200
+#define __NR_bpf 280
+#define __NR_brk 214
+#define __NR_cacheflush 244
+#define __NR_capget 90
+#define __NR_capset 91
+#define __NR_chdir 49
+#define __NR_chroot 51
+#define __NR_clock_adjtime64 405
+#define __NR_clock_getres_time64 406
+#define __NR_clock_gettime 113
+#define __NR_clock_gettime64 403
+#define __NR_clock_nanosleep 115
+#define __NR_clock_nanosleep_time64 407
+#define __NR_clock_settime 112
+#define __NR_clock_settime64 404
+#define __NR_clone 220
+#define __NR_clone3 435
+#define __NR_close 57
+#define __NR_connect 203
+#define __NR_copy_file_range 285
+#define __NR_delete_module 106
+#define __NR_dup 23
+#define __NR_dup3 24
+#define __NR_epoll_create1 20
+#define __NR_epoll_ctl 21
+#define __NR_epoll_pwait 22
+#define __NR_eventfd2 19
+#define __NR_execve 221
+#define __NR_execveat 281
+#define __NR_exit 93
+#define __NR_exit_group 94
+#define __NR_faccessat 48
+#define __NR_fadvise64_64 223
+#define __NR_fallocate 47
+#define __NR_fanotify_init 262
+#define __NR_fanotify_mark 263
+#define __NR_fchdir 50
+#define __NR_fchmod 52
+#define __NR_fchmodat 53
+#define __NR_fchown 55
+#define __NR_fchownat 54
+#define __NR_fcntl64 25
+#define __NR_fdatasync 83
+#define __NR_fgetxattr 10
+#define __NR_finit_module 273
+#define __NR_flistxattr 13
+#define __NR_flock 32
+#define __NR_fremovexattr 16
+#define __NR_fsconfig 431
+#define __NR_fsetxattr 7
+#define __NR_fsmount 432
+#define __NR_fsopen 430
+#define __NR_fspick 433
+#define __NR_fstatfs64 44
+#define __NR_fsync 82
+#define __NR_ftruncate64 46
+#define __NR_futex_time64 422
+#define __NR_get_mempolicy 236
+#define __NR_get_robust_list 100
+#define __NR_getcpu 168
+#define __NR_getcwd 17
+#define __NR_getdents64 61
+#define __NR_getegid 177
+#define __NR_geteuid 175
+#define __NR_getgid 176
+#define __NR_getgroups 158
+#define __NR_getitimer 102
+#define __NR_getpeername 205
+#define __NR_getpgid 155
+#define __NR_getpid 172
+#define __NR_getppid 173
+#define __NR_getpriority 141
+#define __NR_getrandom 278
+#define __NR_getresgid 150
+#define __NR_getresuid 148
+#define __NR_getrlimit 163
+#define __NR_getrusage 165
+#define __NR_getsid 156
+#define __NR_getsockname 204
+#define __NR_getsockopt 209
+#define __NR_gettid 178
+#define __NR_gettimeofday 169
+#define __NR_getuid 174
+#define __NR_getxattr 8
+#define __NR_init_module 105
+#define __NR_inotify_add_watch 27
+#d

[PATCH v6 10/13] ARC: ABI lists

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/fpu/libm-test-ulps| 1140 +
 sysdeps/arc/fpu/libm-test-ulps-name   |1 +
 sysdeps/arc/nofpu/libm-test-ulps  |  270 +++
 sysdeps/arc/nofpu/libm-test-ulps-name |1 +
 sysdeps/unix/sysv/linux/arc/c++-types.data|   67 +
 sysdeps/unix/sysv/linux/arc/ld.abilist|5 +
 .../sysv/linux/arc/libBrokenLocale.abilist|1 +
 sysdeps/unix/sysv/linux/arc/libanl.abilist|4 +
 sysdeps/unix/sysv/linux/arc/libc.abilist  | 2082 +
 sysdeps/unix/sysv/linux/arc/libcrypt.abilist  |2 +
 sysdeps/unix/sysv/linux/arc/libdl.abilist |9 +
 sysdeps/unix/sysv/linux/arc/libm.abilist  |  699 ++
 .../unix/sysv/linux/arc/libpthread.abilist|  216 ++
 sysdeps/unix/sysv/linux/arc/libresolv.abilist |   79 +
 sysdeps/unix/sysv/linux/arc/librt.abilist |   35 +
 .../unix/sysv/linux/arc/libthread_db.abilist  |   40 +
 sysdeps/unix/sysv/linux/arc/libutil.abilist   |6 +
 sysdeps/unix/sysv/linux/arc/localplt.data |   12 +
 18 files changed, 4669 insertions(+)
 create mode 100644 sysdeps/arc/fpu/libm-test-ulps
 create mode 100644 sysdeps/arc/fpu/libm-test-ulps-name
 create mode 100644 sysdeps/arc/nofpu/libm-test-ulps
 create mode 100644 sysdeps/arc/nofpu/libm-test-ulps-name
 create mode 100644 sysdeps/unix/sysv/linux/arc/c++-types.data
 create mode 100644 sysdeps/unix/sysv/linux/arc/ld.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libBrokenLocale.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libanl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libc.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libcrypt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libdl.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libm.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libpthread.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libresolv.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/librt.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libthread_db.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/libutil.abilist
 create mode 100644 sysdeps/unix/sysv/linux/arc/localplt.data

diff --git a/sysdeps/arc/fpu/libm-test-ulps b/sysdeps/arc/fpu/libm-test-ulps
new file mode 100644
index ..00262925b75b
--- /dev/null
+++ b/sysdeps/arc/fpu/libm-test-ulps
@@ -0,0 +1,1140 @@
+# Begin of automatic generation
+
+# Maximal error of functions:
+Function: "acos":
+double: 1
+float: 1
+
+Function: "acos_downward":
+double: 1
+float: 1
+
+Function: "acos_towardzero":
+double: 1
+float: 1
+
+Function: "acos_upward":
+double: 1
+float: 1
+
+Function: "acosh":
+double: 3
+float: 2
+
+Function: "acosh_downward":
+double: 2
+float: 2
+
+Function: "acosh_towardzero":
+double: 2
+float: 2
+
+Function: "acosh_upward":
+double: 3
+float: 3
+
+Function: "asin":
+double: 1
+float: 1
+
+Function: "asin_downward":
+double: 1
+float: 1
+
+Function: "asin_towardzero":
+double: 1
+float: 1
+
+Function: "asin_upward":
+double: 1
+float: 1
+
+Function: "asinh":
+double: 3
+float: 2
+
+Function: "asinh_downward":
+double: 3
+float: 3
+
+Function: "asinh_towardzero":
+double: 2
+float: 2
+
+Function: "asinh_upward":
+double: 3
+float: 3
+
+Function: "atan":
+double: 1
+float: 1
+
+Function: "atan2":
+double: 7
+float: 2
+
+Function: "atan2_downward":
+double: 5
+float: 2
+
+Function: "atan2_towardzero":
+double: 5
+float: 2
+
+Function: "atan2_upward":
+double: 8
+float: 2
+
+Function: "atan_downward":
+double: 1
+float: 2
+
+Function: "atan_towardzero":
+double: 1
+float: 1
+
+Function: "atan_upward":
+double: 2
+float: 2
+
+Function: "atanh":
+double: 2
+float: 2
+
+Function: "atanh_downward":
+double: 3
+float: 3
+
+Function: "atanh_towardzero":
+double: 2
+float: 2
+
+Function: "atanh_upward":
+double: 3
+float: 3
+
+Function: "cabs":
+double: 1
+float: 1
+
+Function: "cabs_downward":
+double: 1
+
+Function: "cabs_towardzero":
+double: 1
+
+Function: "cabs_upward":
+double: 2
+float: 1
+
+Function: Real part of "cacos":
+double: 2
+float: 2
+
+Function: Imaginary part of "cacos":
+double: 5
+float: 3
+
+Function: Real part of "cacos_downward":
+double: 3
+float: 2
+
+Function: Imaginary part of "cacos_downward":
+double: 5
+float: 3
+
+Function: Real part of "cacos_towardzero":
+double: 3
+float: 2
+
+Function: Imaginary part of "cacos_towardzero":
+double: 4
+float: 2
+
+Function: Real part of "cacos_upward":
+double: 2
+float: 3
+
+Function: Imaginary part of "cacos_upward":
+double: 5
+float: 5
+
+Function: Real part of "cacosh":
+double: 5
+float: 4
+
+Function: Imaginary part of "cacosh":
+double: 2
+float: 2
+
+Function: Real part of "cacosh_downward":
+double: 4
+float: 2
+
+Function: Imaginary part of "cacosh_downward":
+double: 3
+float: 3
+
+Function: Real part of "cacosh_towardzero":
+double: 4
+float: 2
+
+Function: Imaginary part of "cacosh_towardzero":
+double: 3
+float: 2
+
+Function: Real part of "cacosh

[PATCH v6 02/13] ARC: startup and dynamic linking code

2020-04-22 Thread Vineet Gupta
Code for C runtime startup and dynamic loading including PLT layout.

Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/bits/link.h   |  52 ++
 sysdeps/arc/dl-machine.h  | 340 ++
 sysdeps/arc/entry.h   |   5 +
 sysdeps/arc/ldsodefs.h|  43 +
 sysdeps/arc/sotruss-lib.c |  51 ++
 sysdeps/arc/start.S   |  74 +
 sysdeps/arc/tst-audit.h   |  23 +++
 7 files changed, 588 insertions(+)
 create mode 100644 sysdeps/arc/bits/link.h
 create mode 100644 sysdeps/arc/dl-machine.h
 create mode 100644 sysdeps/arc/entry.h
 create mode 100644 sysdeps/arc/ldsodefs.h
 create mode 100644 sysdeps/arc/sotruss-lib.c
 create mode 100644 sysdeps/arc/start.S
 create mode 100644 sysdeps/arc/tst-audit.h

diff --git a/sysdeps/arc/bits/link.h b/sysdeps/arc/bits/link.h
new file mode 100644
index ..0acbc1349e08
--- /dev/null
+++ b/sysdeps/arc/bits/link.h
@@ -0,0 +1,52 @@
+/* Machine-specific declarations for dynamic linker interface, ARC version.
+   Copyright (C) 2009-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef_LINK_H
+# error "Never include  directly; use  instead."
+#endif
+
+/* Registers for entry into PLT on ARC.  */
+typedef struct La_arc_regs
+{
+  uint32_t lr_reg[8]; /* r0 through r7 (upto 8 args).  */
+} La_arc_regs;
+
+/* Return values for calls from PLT on ARC.  */
+typedef struct La_arc_retval
+{
+  /* For ARCv2, a 64-bit integer return value can use 2 regs.  */
+  uint32_t lrv_reg[2];
+} La_arc_retval;
+
+__BEGIN_DECLS
+
+extern ElfW(Addr) la_arc_gnu_pltenter (ElfW(Sym) *__sym, unsigned int __ndx,
+uintptr_t *__refcook,
+uintptr_t *__defcook,
+La_arc_regs *__regs,
+unsigned int *__flags,
+const char *__symname,
+long int *__framesizep);
+extern unsigned int la_arc_gnu_pltexit (ElfW(Sym) *__sym, unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ const La_arc_regs *__inregs,
+ La_arc_retval *__outregs,
+ const char *symname);
+
+__END_DECLS
diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h
new file mode 100644
index ..ebda3e21b511
--- /dev/null
+++ b/sysdeps/arc/dl-machine.h
@@ -0,0 +1,340 @@
+/* Machine-dependent ELF dynamic relocation inline functions.  ARC version.
+   Copyright (C) 1995-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef dl_machine_h
+#define dl_machine_h
+
+#define ELF_MACHINE_NAME "arc"
+
+#include 
+
+#ifndef ENTRY_POINT
+# error ENTRY_POINT needs to be defined for ARC
+#endif
+
+#include 
+#include 
+#include 
+
+/* Dynamic Linking ABI for ARCv2 ISA.
+
+PLT
+   < DT_PLTGOT
+  |  ld r11, [pcl, off-to-GOT[1] |  0
+  |  |  4
+   plt0   |  ld r10, [pcl, off-to-GOT[2] |  8
+  |  | 12
+  |  j [r10] | 16
+  
+  |Base address of GOT   | 20
+  
+  |  ld r12, [pcl, off-to-GOT[3] | 24
+   plt1   |  

[PATCH v6 05/13] ARC: math soft float support

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/bits/fenv.h   | 77 +++
 sysdeps/arc/nofpu/Implies |  1 +
 sysdeps/arc/nofpu/math-tests-exceptions.h | 27 
 sysdeps/arc/nofpu/math-tests-rounding.h   | 27 
 sysdeps/arc/sfp-machine.h | 73 +
 5 files changed, 205 insertions(+)
 create mode 100644 sysdeps/arc/bits/fenv.h
 create mode 100644 sysdeps/arc/nofpu/Implies
 create mode 100644 sysdeps/arc/nofpu/math-tests-exceptions.h
 create mode 100644 sysdeps/arc/nofpu/math-tests-rounding.h
 create mode 100644 sysdeps/arc/sfp-machine.h

diff --git a/sysdeps/arc/bits/fenv.h b/sysdeps/arc/bits/fenv.h
new file mode 100644
index ..80afa50db9c6
--- /dev/null
+++ b/sysdeps/arc/bits/fenv.h
@@ -0,0 +1,77 @@
+/* Copyright (C) 2012-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#ifndef _FENV_H
+# error "Never use  directly; include  instead."
+#endif
+
+enum
+  {
+FE_INVALID   =
+# define FE_INVALID(0x01)
+  FE_INVALID,
+FE_DIVBYZERO =
+# define FE_DIVBYZERO  (0x02)
+  FE_DIVBYZERO,
+FE_OVERFLOW  =
+# define FE_OVERFLOW   (0x04)
+  FE_OVERFLOW,
+FE_UNDERFLOW =
+# define FE_UNDERFLOW  (0x08)
+  FE_UNDERFLOW,
+FE_INEXACT   =
+# define FE_INEXACT(0x10)
+  FE_INEXACT
+  };
+
+# define FE_ALL_EXCEPT \
+   (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
+
+enum
+  {
+FE_TOWARDZERO =
+# define FE_TOWARDZERO (0x0)
+  FE_TOWARDZERO,
+FE_TONEAREST  =
+# define FE_TONEAREST  (0x1)   /* default */
+  FE_TONEAREST,
+FE_UPWARD =
+# define FE_UPWARD (0x2)
+  FE_UPWARD,
+FE_DOWNWARD   =
+# define FE_DOWNWARD   (0x3)
+  FE_DOWNWARD
+  };
+
+typedef unsigned int fexcept_t;
+
+typedef struct
+{
+  unsigned int __fpcr;
+  unsigned int __fpsr;
+} fenv_t;
+
+/* If the default argument is used we use this value.  */
+#define FE_DFL_ENV ((const fenv_t *) -1)
+
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+/* Type representing floating-point control modes.  */
+typedef unsigned int femode_t;
+
+/* Default floating-point control modes.  */
+# define FE_DFL_MODE   ((const femode_t *) -1L)
+#endif
diff --git a/sysdeps/arc/nofpu/Implies b/sysdeps/arc/nofpu/Implies
new file mode 100644
index ..abcbadb25f22
--- /dev/null
+++ b/sysdeps/arc/nofpu/Implies
@@ -0,0 +1 @@
+ieee754/soft-fp
diff --git a/sysdeps/arc/nofpu/math-tests-exceptions.h 
b/sysdeps/arc/nofpu/math-tests-exceptions.h
new file mode 100644
index ..2ec58e088ebf
--- /dev/null
+++ b/sysdeps/arc/nofpu/math-tests-exceptions.h
@@ -0,0 +1,27 @@
+/* Configuration for math tests. exceptions support ARC version.
+   Copyright (C) 2017-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#ifndef ARC_NOFPU_MATH_TESTS_EXCEPTIONS_H
+#define ARC_NOFPU_MATH_TESTS_EXCEPTIONS_H 1
+
+/* Soft-float does not support exceptions.  */
+#define EXCEPTION_TESTS_float  0
+#define EXCEPTION_TESTS_double 0
+#define EXCEPTION_TESTS_long_double0
+
+#endif
diff --git a/sysdeps/arc/nofpu/math-tests-rounding.h 
b/sysdeps/arc/nofpu/math-tests-rounding.h
new file mode 100644
index ..6e5376cb35b5
--- /dev/null
+++ b/sysdeps/arc/nofpu/math-tests-rounding.h
@@ -0,0 +1,27 @@
+/* Configuration for math tests: rounding mode support.  ARC version.
+   Copyright (C) 2017-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or

[PATCH v6 00/13] glibc port to ARC processors

2020-04-22 Thread Vineet Gupta
Hi,

This patchset implements glibc port to ARC HS48x processor from Synopsys.

This still needs a couple of inflight 64-time, offset patches.

g...@github.com:foss-for-synopsys-dwc-arc-processors/glibc.git  upstream-v6

v6:
   * Dropped 11/14: merged upstream
   * _FPU_SETS() inline asm reworked
   * Introduce fixup-asm-unistd.h to elide 32-bit time, offset syscalls and
 regenerate arch-syscall.h
   * Fix snafu in updating build-many-glibcs for ARC
   * More code sytle fixes flagged by Joseph
v5:
   * Big Endian formally supported as multi-ABI
   * Removed code for ARC700 processors
   * Hard-float code updates: fegetmode, fesetround, feupdateenv
   * socket-constant.h update for 64-bit ABI spun off as standalone patch
   * __syscall_error made glibc_private
   * math ulps regen
   * gmp-mparam.h removed
   * lint fixes as flagged by Joseph
v4:
   * Dropped 1/17: Merged upstream
   * Dropped 17/17:
   - 64-bit time/offset code chunked up into respective patches
   * sysctl removed
   * Updated README for arc gnu triplet
   * Updated install files for ARC gcc/binutils requirements
   * Updated NEWS with brief ISA/ABI info

v3:
   * Support for Hardware Floating Point
   * 64-bit time and offsets ABI (although all such changes are confined
 to a single patch)

v5: https://sourceware.org/pipermail/libc-alpha/2020-April/112657.html
v4: https://sourceware.org/pipermail/libc-alpha/2020-March/111855.html
v3: https://sourceware.org/legacy-ml/libc-alpha/2020-03/msg00167.html
v2: https://sourceware.org/legacy-ml/libc-alpha/2019-01/msg00681.html
v1: https://sourceware.org/legacy-ml/libc-alpha/2018-12/msg00678.html

Documentation:
--

(a) ABI doc:
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/wiki/files/ARCv2_ABI.pdf

(b) Programmer's Reference Manual (PRM) : needs a download request to be filled
https://www.synopsys.com/dw/ipdir.php?ds=arc-hs44-hs46-hs48
https://www.synopsys.com/dw/doc.php/ds/cc/programmers-reference-manual-ARC-HS.pdf

Test Results:
--
(a) build-many-glibcs.py

| Summary of test results:
|   1251 PASS
| 15 XFAIL


(b) Full testsuite ran in a cross compile setup using buildroot on HSDK 
development
platform. Bulk of failures come from cross testing setup and I
intend to improve things with native testing going forward.

| Summary of test results:
| 30 FAIL   (-3)
|
| FAIL: csu/test-as-const-tcb-offsets
+ FAIL: elf/tst-audit14
+ FAIL: elf/tst-audit15
+ FAIL: elf/tst-audit16
| FAIL: elf/tst-ldconfig-ld_so_conf-update # not true: dlopen
| FAIL: iconv/test-iconvconfig  # Needs gconv installed
- FAIL: iconv/tst-gconv-init-failure
| FAIL: io/ftwtest  # Requires execution by non-root
- FAIL: io/tst-futimesat
| FAIL: io/tst-lockf
| FAIL: libio/tst-wfile-sync
| FAIL: locale/tst-C-locale
| FAIL: locale/tst-duplocale
| FAIL: locale/tst-locale-locpath
| FAIL: locale/tst-locname
| FAIL: localedata/sort-test
| FAIL: nptl/test-cond-printers # needs Python3 and target GDB on target
| FAIL: nptl/test-condattr-printers #ditto
| FAIL: nptl/test-mutex-printers#ditto
| FAIL: nptl/test-mutexattr-printers#ditto
| FAIL: nptl/test-rwlock-printers   #ditto
| FAIL: nptl/test-rwlockattr-printers   #ditto
| FAIL: nptl/tst-umask1 # passes if run natively on target (NFS 
ACLv3 support needed)
| FAIL: nss/bug-erange
| FAIL: nss/tst-nss-files-hosts-getent  # Timed out
| FAIL: nss/tst-nss-files-hosts-multi   # Timed out
| FAIL: posix/bug-ga2   # DNS issue: google DNS vs. SNPS
| FAIL: posix/globtest  # require same user on target and host
| FAIL: posix/tst-getaddrinfo5  # passes outside corporate network
- FAIL: resolv/tst-resolv-basic
- FAIL: resolv/tst-resolv-edns
- FAIL: resolv/tst-resolv-rotate
- FAIL: resolv/tst-resolv-search
| FAIL: stdio-common/bug22  # Needs more RAM: 2 GB memory
| FAIL: sunrpc/bug20790 # missing cpp on target
| FAIL: timezone/tst-tzset  # passes outside corporate network


kindly review.

Thx,
-Vineet

Vineet Gupta (13):
  ARC: ABI Implementation
  ARC: startup and dynamic linking code
  ARC: Thread Local Storage support
  ARC: Atomics and Locking primitives
  ARC: math soft float support
  ARC: hardware floating point support
  ARC: Linux Syscall Interface
  ARC: Linux ABI
  ARC: Linux Startup and Dynamic Loading
  ARC: ABI lists
  ARC: Build Infrastructure
  build-many-glibcs.py: Enable ARC builds
  Documentation for ARC port

 NEWS  |9 +
 README|1 +
 config.h.in   |3 +
 manual/install.texi   |4 +
 scripts/build-many-glibcs.py  |   10 +
 sysdeps/arc/Implies   |3 +
 sysdeps/arc/Makefile  |   21 +
 sysdeps/arc/Versions  |8 +
 

[PATCH v6 09/13] ARC: Linux Startup and Dynamic Loading

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/unix/sysv/linux/arc/dl-static.c | 84 +
 sysdeps/unix/sysv/linux/arc/ldsodefs.h  | 32 ++
 2 files changed, 116 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/arc/dl-static.c
 create mode 100644 sysdeps/unix/sysv/linux/arc/ldsodefs.h

diff --git a/sysdeps/unix/sysv/linux/arc/dl-static.c 
b/sysdeps/unix/sysv/linux/arc/dl-static.c
new file mode 100644
index ..24c31b27fc11
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/dl-static.c
@@ -0,0 +1,84 @@
+/* Variable initialization.  ARC version.
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#include 
+
+#ifdef SHARED
+
+void
+_dl_var_init (void *array[])
+{
+  /* It has to match "variables" below. */
+  enum
+{
+  DL_PAGESIZE = 0
+};
+
+  GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]);
+}
+
+#else
+
+static void *variables[] =
+{
+  &GLRO(dl_pagesize)
+};
+
+static void
+_dl_unprotect_relro (struct link_map *l)
+{
+  ElfW(Addr) start = ((l->l_addr + l->l_relro_addr)
+ & ~(GLRO(dl_pagesize) - 1));
+  ElfW(Addr) end = ((l->l_addr + l->l_relro_addr + l->l_relro_size)
+   & ~(GLRO(dl_pagesize) - 1));
+
+  if (start != end)
+__mprotect ((void *) start, end - start, PROT_READ | PROT_WRITE);
+}
+
+void
+_dl_static_init (struct link_map *l)
+{
+  struct link_map *rtld_map = l;
+  struct r_scope_elem **scope;
+  const ElfW(Sym) *ref = NULL;
+  lookup_t loadbase;
+  void (*f) (void *[]);
+  size_t i;
+
+  loadbase = _dl_lookup_symbol_x ("_dl_var_init", l, &ref, l->l_local_scope,
+ NULL, 0, 1, NULL);
+
+  for (scope = l->l_local_scope; *scope != NULL; scope++)
+for (i = 0; i < (*scope)->r_nlist; i++)
+  if ((*scope)->r_list[i] == loadbase)
+   {
+ rtld_map = (*scope)->r_list[i];
+ break;
+   }
+
+  if (ref != NULL)
+{
+  f = (void (*) (void *[])) DL_SYMBOL_ADDRESS (loadbase, ref);
+  _dl_unprotect_relro (rtld_map);
+  f (variables);
+  _dl_protect_relro (rtld_map);
+}
+}
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/arc/ldsodefs.h 
b/sysdeps/unix/sysv/linux/arc/ldsodefs.h
new file mode 100644
index ..9eef836168be
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/ldsodefs.h
@@ -0,0 +1,32 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects. ARC
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#ifndef_LDSODEFS_H
+
+/* Get the real definitions.  */
+#include_next 
+
+/* Now define our stuff.  */
+
+/* We need special support to initialize DSO loaded for statically linked
+   binaries.  */
+extern void _dl_static_init (struct link_map *map);
+#undef DL_STATIC_INIT
+#define DL_STATIC_INIT(map) _dl_static_init (map)
+
+#endif /* ldsodefs.h */
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v6 06/13] ARC: hardware floating point support

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/fpu/e_sqrt.c|  27 
 sysdeps/arc/fpu/e_sqrtf.c   |  27 
 sysdeps/arc/fpu/fclrexcpt.c |  36 +++
 sysdeps/arc/fpu/fegetenv.c  |  37 +++
 sysdeps/arc/fpu/fegetmode.c |  31 ++
 sysdeps/arc/fpu/fegetround.c|  32 ++
 sysdeps/arc/fpu/feholdexcpt.c   |  43 +
 sysdeps/arc/fpu/fesetenv.c  |  48 +++
 sysdeps/arc/fpu/fesetexcept.c   |  32 ++
 sysdeps/arc/fpu/fesetmode.c |  40 
 sysdeps/arc/fpu/fesetround.c|  40 
 sysdeps/arc/fpu/feupdateenv.c   |  51 +++
 sysdeps/arc/fpu/fgetexcptflg.c  |  31 ++
 sysdeps/arc/fpu/fraiseexcpt.c   |  39 
 sysdeps/arc/fpu/fsetexcptflg.c  |  38 
 sysdeps/arc/fpu/ftestexcept.c   |  33 ++
 sysdeps/arc/fpu/s_fma.c |  28 +
 sysdeps/arc/fpu/s_fmaf.c|  28 +
 sysdeps/arc/fpu_control.h   | 106 
 sysdeps/arc/get-rounding-mode.h |  38 
 sysdeps/arc/math-tests-trap.h   |  27 
 sysdeps/arc/tininess.h  |   1 +
 22 files changed, 813 insertions(+)
 create mode 100644 sysdeps/arc/fpu/e_sqrt.c
 create mode 100644 sysdeps/arc/fpu/e_sqrtf.c
 create mode 100644 sysdeps/arc/fpu/fclrexcpt.c
 create mode 100644 sysdeps/arc/fpu/fegetenv.c
 create mode 100644 sysdeps/arc/fpu/fegetmode.c
 create mode 100644 sysdeps/arc/fpu/fegetround.c
 create mode 100644 sysdeps/arc/fpu/feholdexcpt.c
 create mode 100644 sysdeps/arc/fpu/fesetenv.c
 create mode 100644 sysdeps/arc/fpu/fesetexcept.c
 create mode 100644 sysdeps/arc/fpu/fesetmode.c
 create mode 100644 sysdeps/arc/fpu/fesetround.c
 create mode 100644 sysdeps/arc/fpu/feupdateenv.c
 create mode 100644 sysdeps/arc/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/arc/fpu/fraiseexcpt.c
 create mode 100644 sysdeps/arc/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/arc/fpu/ftestexcept.c
 create mode 100644 sysdeps/arc/fpu/s_fma.c
 create mode 100644 sysdeps/arc/fpu/s_fmaf.c
 create mode 100644 sysdeps/arc/fpu_control.h
 create mode 100644 sysdeps/arc/get-rounding-mode.h
 create mode 100644 sysdeps/arc/math-tests-trap.h
 create mode 100644 sysdeps/arc/tininess.h

diff --git a/sysdeps/arc/fpu/e_sqrt.c b/sysdeps/arc/fpu/e_sqrt.c
new file mode 100644
index ..abb67ef7b061
--- /dev/null
+++ b/sysdeps/arc/fpu/e_sqrt.c
@@ -0,0 +1,27 @@
+/* Square root of floating point number.
+   Copyright (C) 2015-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#include 
+#include 
+
+double
+__ieee754_sqrt (double d)
+{
+  return __builtin_sqrt (d);
+}
+libm_alias_finite (__ieee754_sqrt, __sqrt)
diff --git a/sysdeps/arc/fpu/e_sqrtf.c b/sysdeps/arc/fpu/e_sqrtf.c
new file mode 100644
index ..13008a4f45d6
--- /dev/null
+++ b/sysdeps/arc/fpu/e_sqrtf.c
@@ -0,0 +1,27 @@
+/* Single-precision floating point square root.
+   Copyright (C) 2015-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#include 
+#include 
+
+float
+__ieee754_sqrtf (float s)
+{
+  return __builtin_sqrtf (s);
+}
+libm_alias_finite (__ieee754_sqrtf, __sqrtf)
diff --git a/sysdeps/arc/fpu/fclrexcpt.c b/sysdeps/arc/fpu/fclrexcpt.c
new file mode 100644
index ..549968dcd465
--- /dev/null
+++ b/sysdeps/arc/fpu/fclrexcpt.c
@@ -0,0 +1,36 @@
+/* Clear given exceptions in current floating-point environment.
+   Copyright (C) 2018-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is fre

[PATCH v6 01/13] ARC: ABI Implementation

2020-04-22 Thread Vineet Gupta
This code deals with the ARC ABI.

Signed-off-by: Vineet Gupta 
---
 sysdeps/arc/__longjmp.S   | 50 ++
 sysdeps/arc/abort-instr.h |  2 +
 sysdeps/arc/bits/endianness.h | 15 +++
 sysdeps/arc/bits/setjmp.h | 26 
 sysdeps/arc/bsd-_setjmp.S |  1 +
 sysdeps/arc/bsd-setjmp.S  |  1 +
 sysdeps/arc/dl-runtime.c  | 33 +++
 sysdeps/arc/dl-sysdep.h   | 25 +++
 sysdeps/arc/dl-trampoline.S   | 80 +++
 sysdeps/arc/gccframe.h| 21 +
 sysdeps/arc/jmpbuf-offsets.h  | 47 
 sysdeps/arc/jmpbuf-unwind.h   | 47 
 sysdeps/arc/machine-gmon.h| 35 +++
 sysdeps/arc/memusage.h| 23 ++
 sysdeps/arc/setjmp.S  | 66 +
 sysdeps/arc/sysdep.h  | 48 +
 sysdeps/arc/tls-macros.h  | 47 
 17 files changed, 567 insertions(+)
 create mode 100644 sysdeps/arc/__longjmp.S
 create mode 100644 sysdeps/arc/abort-instr.h
 create mode 100644 sysdeps/arc/bits/endianness.h
 create mode 100644 sysdeps/arc/bits/setjmp.h
 create mode 100644 sysdeps/arc/bsd-_setjmp.S
 create mode 100644 sysdeps/arc/bsd-setjmp.S
 create mode 100644 sysdeps/arc/dl-runtime.c
 create mode 100644 sysdeps/arc/dl-sysdep.h
 create mode 100644 sysdeps/arc/dl-trampoline.S
 create mode 100644 sysdeps/arc/gccframe.h
 create mode 100644 sysdeps/arc/jmpbuf-offsets.h
 create mode 100644 sysdeps/arc/jmpbuf-unwind.h
 create mode 100644 sysdeps/arc/machine-gmon.h
 create mode 100644 sysdeps/arc/memusage.h
 create mode 100644 sysdeps/arc/setjmp.S
 create mode 100644 sysdeps/arc/sysdep.h
 create mode 100644 sysdeps/arc/tls-macros.h

diff --git a/sysdeps/arc/__longjmp.S b/sysdeps/arc/__longjmp.S
new file mode 100644
index ..ffc3daa7de72
--- /dev/null
+++ b/sysdeps/arc/__longjmp.S
@@ -0,0 +1,50 @@
+/* longjmp for ARC.
+   Copyright (C) 2017-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   .  */
+
+#include 
+#include 
+
+;@ r0 = jump buffer from which regs will be restored
+;@ r1 = value that setjmp( ) will return due to this longjmp
+
+ENTRY (__longjmp)
+
+   ld_s r13,   [r0]
+   ld_s r14,   [r0,4]
+   ld   r15,   [r0,8]
+   ld   r16,   [r0,12]
+   ld   r17,   [r0,16]
+   ld   r18,   [r0,20]
+   ld   r19,   [r0,24]
+   ld   r20,   [r0,28]
+   ld   r21,   [r0,32]
+   ld   r22,   [r0,36]
+   ld   r23,   [r0,40]
+   ld   r24,   [r0,44]
+   ld   r25,   [r0,48]
+
+   ld   blink, [r0,60]
+   ld   fp,[r0,52]
+   ld   sp,[r0,56]
+
+   mov.f  r0, r1   ; get the setjmp return value(due to longjmp) in place
+
+   j.d[blink]  ; to caller of setjmp location, right after the call
+   mov.z  r0, 1; can't let setjmp return 0 when it is due to longjmp
+
+END (__longjmp)
diff --git a/sysdeps/arc/abort-instr.h b/sysdeps/arc/abort-instr.h
new file mode 100644
index ..49f33613c404
--- /dev/null
+++ b/sysdeps/arc/abort-instr.h
@@ -0,0 +1,2 @@
+/* FLAG 1 is privilege mode only instruction, hence will crash any program.  */
+#define ABORT_INSTRUCTION asm ("flag 1")
diff --git a/sysdeps/arc/bits/endianness.h b/sysdeps/arc/bits/endianness.h
new file mode 100644
index ..8f17ca84b485
--- /dev/null
+++ b/sysdeps/arc/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use  directly; include  instead."
+#endif
+
+/* ARC has selectable endianness.  */
+#ifdef __BIG_ENDIAN__
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
diff --git a/sysdeps/arc/bits/setjmp.h b/sysdeps/arc/bits/setjmp.h
new file mode 100644
index ..333e5cce3bea
--- /dev/null
+++ b/sysdeps/arc/bits/setjmp.h
@@ -0,0 +1,26 @@
+/* Define the machine-dependent type `jmp_buf'.  ARC version.
+   Copyright (C) 1992-2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundati

[PATCH v6 12/13] build-many-glibcs.py: Enable ARC builds

2020-04-22 Thread Vineet Gupta
Signed-off-by: Vineet Gupta 
---
 scripts/build-many-glibcs.py | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 4832912b28b9..752da3657a01 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -162,6 +162,15 @@ class Context(object):
'cfg': ['--disable-multi-arch']}])
 self.add_config(arch='aarch64_be',
 os_name='linux-gnu')
+self.add_config(arch='arc',
+os_name='linux-gnu',
+gcc_cfg=['--disable-multilib', '--with-cpu=hs38'])
+self.add_config(arch='arc',
+os_name='linux-gnuhf',
+gcc_cfg=['--disable-multilib', 
'--with-cpu=hs38_linux'])
+self.add_config(arch='arceb',
+os_name='linux-gnu',
+gcc_cfg=['--disable-multilib', '--with-cpu=hs38'])
 self.add_config(arch='alpha',
 os_name='linux-gnu')
 self.add_config(arch='arm',
@@ -1224,6 +1233,7 @@ def install_linux_headers(policy, cmdlist):
 """Install Linux kernel headers."""
 arch_map = {'aarch64': 'arm64',
 'alpha': 'alpha',
+'arc': 'arc',
 'arm': 'arm',
 'csky': 'csky',
 'hppa': 'parisc',
-- 
2.20.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 17/21] mm: free_area_init: allow defining max_zone_pfn in descending order

2020-04-22 Thread Baoquan He
On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport 
> 
> Some architectures (e.g. ARC) have the ZONE_HIGHMEM zone below the
> ZONE_NORMAL. Allowing free_area_init() parse max_zone_pfn array even it is
> sorted in descending order allows using free_area_init() on such
> architectures.
> 
> Add top -> down traversal of max_zone_pfn array in free_area_init() and use
> the latter in ARC node/zone initialization.

Or maybe leave ARC as is. The change in this patchset doesn't impact
ARC's handling about zone initialization, leaving it as is can reduce
the complication in implementation of free_area_init(), which is a
common function. So I personally don't see a strong motivation to have
this patch.

> 
> Signed-off-by: Mike Rapoport 
> ---
>  arch/arc/mm/init.c | 36 +++-
>  mm/page_alloc.c| 24 +++-
>  2 files changed, 26 insertions(+), 34 deletions(-)
> 
> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> index 0920c969c466..41eb9be1653c 100644
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -63,11 +63,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> size)
>  
>   low_mem_sz = size;
>   in_use = 1;
> + memblock_add_node(base, size, 0);
>   } else {
>  #ifdef CONFIG_HIGHMEM
>   high_mem_start = base;
>   high_mem_sz = size;
>   in_use = 1;
> + memblock_add_node(base, size, 1);
>  #endif
>   }
>  
> @@ -83,8 +85,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> size)
>   */
>  void __init setup_arch_memory(void)
>  {
> - unsigned long zones_size[MAX_NR_ZONES];
> - unsigned long zones_holes[MAX_NR_ZONES];
> + unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
>  
>   init_mm.start_code = (unsigned long)_text;
>   init_mm.end_code = (unsigned long)_etext;
> @@ -115,7 +116,6 @@ void __init setup_arch_memory(void)
>* the crash
>*/
>  
> - memblock_add_node(low_mem_start, low_mem_sz, 0);
>   memblock_reserve(CONFIG_LINUX_LINK_BASE,
>__pa(_end) - CONFIG_LINUX_LINK_BASE);
>  
> @@ -133,22 +133,7 @@ void __init setup_arch_memory(void)
>   memblock_dump_all();
>  
>   /*- node/zones setup --*/
> - memset(zones_size, 0, sizeof(zones_size));
> - memset(zones_holes, 0, sizeof(zones_holes));
> -
> - zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
> - zones_holes[ZONE_NORMAL] = 0;
> -
> - /*
> -  * We can't use the helper free_area_init(zones[]) because it uses
> -  * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
> -  * when our kernel doesn't start at PAGE_OFFSET, i.e.
> -  * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
> -  */
> - free_area_init_node(0,  /* node-id */
> - zones_size, /* num pages per zone */
> - min_low_pfn,/* first pfn of node */
> - zones_holes);   /* holes */
> + max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
>  
>  #ifdef CONFIG_HIGHMEM
>   /*
> @@ -168,20 +153,13 @@ void __init setup_arch_memory(void)
>   min_high_pfn = PFN_DOWN(high_mem_start);
>   max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
>  
> - zones_size[ZONE_NORMAL] = 0;
> - zones_holes[ZONE_NORMAL] = 0;
> -
> - zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
> - zones_holes[ZONE_HIGHMEM] = 0;
> -
> - free_area_init_node(1,  /* node-id */
> - zones_size, /* num pages per zone */
> - min_high_pfn,   /* first pfn of node */
> - zones_holes);   /* holes */
> + max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
>  
>   high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
>   kmap_init();
>  #endif
> +
> + free_area_init(max_zone_pfn);
>  }
>  
>  /*
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 343d87b8697d..376434c7a78b 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7429,7 +7429,8 @@ static void check_for_memory(pg_data_t *pgdat, int nid)
>  void __init free_area_init(unsigned long *max_zone_pfn)
>  {
>   unsigned long start_pfn, end_pfn;
> - int i, nid;
> + int i, nid, zone;
> + bool descending = false;
>  
>   /* Record where the zone boundaries are */
>   memset(arch_zone_lowest_possible_pfn, 0,
> @@ -7439,13 +7440,26 @@ void __init free_area_init(unsigned long 
> *max_zone_pfn)
>  
>   start_pfn = find_min_pfn_with_active_regions();
>  
> + /*
> +  * Some architecturs, e.g. ARC may have ZONE_HIGHMEM below
> +  * ZONE_NORMAL. For such cases we allow max_zone_pfn sorted in the
> +  * descending order
> +  */
> + if (MAX_NR_ZONES > 1 && max_zone_pfn[0] > max_zone_pfn[1])
> + descending = true;
> +
>   for (i = 0; i < MAX

Re: [PATCH 17/21] mm: free_area_init: allow defining max_zone_pfn in descending order

2020-04-22 Thread Baoquan He
On 04/23/20 at 10:53am, Baoquan He wrote:
> On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> > From: Mike Rapoport 
> > 
> > Some architectures (e.g. ARC) have the ZONE_HIGHMEM zone below the
> > ZONE_NORMAL. Allowing free_area_init() parse max_zone_pfn array even it is
> > sorted in descending order allows using free_area_init() on such
> > architectures.
> > 
> > Add top -> down traversal of max_zone_pfn array in free_area_init() and use
> > the latter in ARC node/zone initialization.
> 
> Or maybe leave ARC as is. The change in this patchset doesn't impact
> ARC's handling about zone initialization, leaving it as is can reduce
> the complication in implementation of free_area_init(), which is a
> common function. So I personally don't see a strong motivation to have
> this patch.

OK, seems this patch is prepared to simplify free_area_init_node(), so
take back what I said at above.

Then this looks necessary, even though it introduces special case into
common function free_area_init().

Reviewed-by: Baoquan He 

> 
> > 
> > Signed-off-by: Mike Rapoport 
> > ---
> >  arch/arc/mm/init.c | 36 +++-
> >  mm/page_alloc.c| 24 +++-
> >  2 files changed, 26 insertions(+), 34 deletions(-)
> > 
> > diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> > index 0920c969c466..41eb9be1653c 100644
> > --- a/arch/arc/mm/init.c
> > +++ b/arch/arc/mm/init.c
> > @@ -63,11 +63,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> > size)
> >  
> > low_mem_sz = size;
> > in_use = 1;
> > +   memblock_add_node(base, size, 0);
> > } else {
> >  #ifdef CONFIG_HIGHMEM
> > high_mem_start = base;
> > high_mem_sz = size;
> > in_use = 1;
> > +   memblock_add_node(base, size, 1);
> >  #endif
> > }
> >  
> > @@ -83,8 +85,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> > size)
> >   */
> >  void __init setup_arch_memory(void)
> >  {
> > -   unsigned long zones_size[MAX_NR_ZONES];
> > -   unsigned long zones_holes[MAX_NR_ZONES];
> > +   unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
> >  
> > init_mm.start_code = (unsigned long)_text;
> > init_mm.end_code = (unsigned long)_etext;
> > @@ -115,7 +116,6 @@ void __init setup_arch_memory(void)
> >  * the crash
> >  */
> >  
> > -   memblock_add_node(low_mem_start, low_mem_sz, 0);
> > memblock_reserve(CONFIG_LINUX_LINK_BASE,
> >  __pa(_end) - CONFIG_LINUX_LINK_BASE);
> >  
> > @@ -133,22 +133,7 @@ void __init setup_arch_memory(void)
> > memblock_dump_all();
> >  
> > /*- node/zones setup --*/
> > -   memset(zones_size, 0, sizeof(zones_size));
> > -   memset(zones_holes, 0, sizeof(zones_holes));
> > -
> > -   zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
> > -   zones_holes[ZONE_NORMAL] = 0;
> > -
> > -   /*
> > -* We can't use the helper free_area_init(zones[]) because it uses
> > -* PAGE_OFFSET to compute the @min_low_pfn which would be wrong
> > -* when our kernel doesn't start at PAGE_OFFSET, i.e.
> > -* PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
> > -*/
> > -   free_area_init_node(0,  /* node-id */
> > -   zones_size, /* num pages per zone */
> > -   min_low_pfn,/* first pfn of node */
> > -   zones_holes);   /* holes */
> > +   max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
> >  
> >  #ifdef CONFIG_HIGHMEM
> > /*
> > @@ -168,20 +153,13 @@ void __init setup_arch_memory(void)
> > min_high_pfn = PFN_DOWN(high_mem_start);
> > max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
> >  
> > -   zones_size[ZONE_NORMAL] = 0;
> > -   zones_holes[ZONE_NORMAL] = 0;
> > -
> > -   zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
> > -   zones_holes[ZONE_HIGHMEM] = 0;
> > -
> > -   free_area_init_node(1,  /* node-id */
> > -   zones_size, /* num pages per zone */
> > -   min_high_pfn,   /* first pfn of node */
> > -   zones_holes);   /* holes */
> > +   max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
> >  
> > high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
> > kmap_init();
> >  #endif
> > +
> > +   free_area_init(max_zone_pfn);
> >  }
> >  
> >  /*
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 343d87b8697d..376434c7a78b 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -7429,7 +7429,8 @@ static void check_for_memory(pg_data_t *pgdat, int 
> > nid)
> >  void __init free_area_init(unsigned long *max_zone_pfn)
> >  {
> > unsigned long start_pfn, end_pfn;
> > -   int i, nid;
> > +   int i, nid, zone;
> > +   bool descending = false;
> >  
> > /* Record where the zone boundaries are */
> > memset(arch_zone_lowest_possible_pfn, 0,
> > @@ -7439,13 +7440,26 @@ void __init free_area_init(un

Re: [PATCH 18/21] mm: rename free_area_init_node() to free_area_init_memoryless_node()

2020-04-22 Thread Baoquan He
On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> From: Mike Rapoport 
> 
> The free_area_init_node() is only used by x86 to initialize a memory-less
> nodes.
> Make its name reflect this and drop all the function parameters except node
> ID as they are anyway zero.
> 
> Signed-off-by: Mike Rapoport 
> ---
>  arch/x86/mm/numa.c | 5 +
>  include/linux/mm.h | 9 +++--
>  mm/page_alloc.c| 7 ++-
>  3 files changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index fe024b2ac796..8ee952038c80 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -737,12 +737,9 @@ void __init x86_numa_init(void)
>  
>  static void __init init_memory_less_node(int nid)
>  {
> - unsigned long zones_size[MAX_NR_ZONES] = {0};
> - unsigned long zholes_size[MAX_NR_ZONES] = {0};
> -
>   /* Allocate and initialize node data. Memory-less node is now online.*/
>   alloc_node_data(nid);
> - free_area_init_node(nid, zones_size, 0, zholes_size);
> + free_area_init_memoryless_node(nid);
>  
>   /*
>* All zonelists will be built later in start_kernel() after per cpu
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 1c2ecb42e043..27660f6cf26e 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2272,8 +2272,7 @@ static inline spinlock_t *pud_lock(struct mm_struct 
> *mm, pud_t *pud)
>  }
>  
>  extern void __init pagecache_init(void);
> -extern void __init free_area_init_node(int nid, unsigned long * zones_size,
> - unsigned long zone_start_pfn, unsigned long *zholes_size);
> +extern void __init free_area_init_memoryless_node(int nid);
>  extern void free_initmem(void);
>  
>  /*
> @@ -2345,10 +2344,8 @@ static inline unsigned long get_num_physpages(void)
>  
>  /*
>   * Using memblock node mappings, an architecture may initialise its
> - * zones, allocate the backing mem_map and account for memory holes in a more
> - * architecture independent manner. This is a substitute for creating the
> - * zone_sizes[] and zholes_size[] arrays and passing them to
> - * free_area_init_node()
> + * zones, allocate the backing mem_map and account for memory holes in an
> + * architecture independent manner.
>   *
>   * An architecture is expected to register range of page frames backed by
>   * physical memory with memblock_add[_node]() before calling
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 376434c7a78b..e46232ec4849 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6979,12 +6979,9 @@ static void __init __free_area_init_node(int nid, 
> unsigned long *zones_size,
>   free_area_init_core(pgdat);
>  }
>  
> -void __init free_area_init_node(int nid, unsigned long *zones_size,
> - unsigned long node_start_pfn,
> - unsigned long *zholes_size)
> +void __init free_area_init_memoryless_node(int nid)
>  {
> - __free_area_init_node(nid, zones_size, node_start_pfn, zholes_size,
> -   true);
> + __free_area_init_node(nid, NULL, 0, NULL, false);

Can we move free_area_init_memoryless_node() definition into 
arch/x86/mm/numa.c since there's only one caller there?

And I am also wondering if adding a wrapper
free_area_init_memoryless_node() is necessary if it's only called the
function free_area_init_node().

>  }
>  
>  #if !defined(CONFIG_FLAT_NODE_MEM_MAP)
> -- 
> 2.25.1
> 


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 16/21] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES

2020-04-22 Thread Mike Rapoport
On Thu, Apr 23, 2020 at 09:13:12AM +0800, Baoquan He wrote:
> On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> > From: Mike Rapoport 
> > 
> > The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions
> 
> This commit id should be a temporary one, will be changed when merged
> into maintainer's tree and linus's tree. Only saying last patch plus the
> patch subject is OK?

Right, the commit id here is not stable. I'll update the changelog.
 
> > rather that check each PFN") made early_pfn_in_nid() obsolete and since
> > CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> > implementation of early_pfn_in_nid() it is also not needed anymore.
> > 
> > Remove both early_pfn_in_nid() and the CONFIG_NODES_SPAN_OTHER_NODES.
> > 
> > Co-developed-by: Hoan Tran 
> > Signed-off-by: Hoan Tran 
> > Signed-off-by: Mike Rapoport 
> > ---
> >  arch/powerpc/Kconfig |  9 -
> >  arch/sparc/Kconfig   |  9 -
> >  arch/x86/Kconfig |  9 -
> >  mm/page_alloc.c  | 20 
> >  4 files changed, 47 deletions(-)
> > 
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 5f86b22b7d2c..74f316deeae1 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -685,15 +685,6 @@ config ARCH_MEMORY_PROBE
> > def_bool y
> > depends on MEMORY_HOTPLUG
> >  
> > -# Some NUMA nodes have memory ranges that span
> > -# other nodes.  Even though a pfn is valid and
> > -# between a node's start and end pfns, it may not
> > -# reside on that node.  See memmap_init_zone()
> > -# for details.
> > -config NODES_SPAN_OTHER_NODES
> > -   def_bool y
> > -   depends on NEED_MULTIPLE_NODES
> > -
> >  config STDBINUTILS
> > bool "Using standard binutils settings"
> > depends on 44x
> > diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> > index 795206b7b552..0e4f3891b904 100644
> > --- a/arch/sparc/Kconfig
> > +++ b/arch/sparc/Kconfig
> > @@ -286,15 +286,6 @@ config NODES_SHIFT
> >   Specify the maximum number of NUMA Nodes available on the target
> >   system.  Increases memory reserved to accommodate various tables.
> >  
> > -# Some NUMA nodes have memory ranges that span
> > -# other nodes.  Even though a pfn is valid and
> > -# between a node's start and end pfns, it may not
> > -# reside on that node.  See memmap_init_zone()
> > -# for details.
> > -config NODES_SPAN_OTHER_NODES
> > -   def_bool y
> > -   depends on NEED_MULTIPLE_NODES
> > -
> >  config ARCH_SPARSEMEM_ENABLE
> > def_bool y if SPARC64
> > select SPARSEMEM_VMEMMAP_ENABLE
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index 9d3e95b4fb85..37dac095659e 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -1581,15 +1581,6 @@ config X86_64_ACPI_NUMA
> > ---help---
> >   Enable ACPI SRAT based node topology detection.
> >  
> > -# Some NUMA nodes have memory ranges that span
> > -# other nodes.  Even though a pfn is valid and
> > -# between a node's start and end pfns, it may not
> > -# reside on that node.  See memmap_init_zone()
> > -# for details.
> > -config NODES_SPAN_OTHER_NODES
> > -   def_bool y
> > -   depends on X86_64_ACPI_NUMA
> > -
> >  config NUMA_EMU
> > bool "NUMA emulation"
> > depends on NUMA
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index c43ce8709457..343d87b8697d 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1541,26 +1541,6 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
> >  }
> >  #endif /* CONFIG_NEED_MULTIPLE_NODES */
> >  
> > -#ifdef CONFIG_NODES_SPAN_OTHER_NODES
> > -/* Only safe to use early in boot when initialisation is single-threaded */
> > -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> > -{
> > -   int nid;
> > -
> > -   nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
> > -   if (nid >= 0 && nid != node)
> > -   return false;
> > -   return true;
> > -}
> > -
> > -#else
> > -static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
> > -{
> > -   return true;
> > -}
> > -#endif
> 
> And macro early_pfn_valid() is not needed either, we may need remove it
> too. 

Ok.

> Otherwise, removing NODES_SPAN_OTHER_NODES in this patch looks good.
> 
> Reviewed-by: Baoquan He 
> 
> > -
> > -
> >  void __init memblock_free_pages(struct page *page, unsigned long pfn,
> > unsigned int order)
> >  {
> > -- 
> > 2.25.1
> > 
> 

-- 
Sincerely yours,
Mike.

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 17/21] mm: free_area_init: allow defining max_zone_pfn in descending order

2020-04-22 Thread Mike Rapoport
On Thu, Apr 23, 2020 at 10:57:20AM +0800, Baoquan He wrote:
> On 04/23/20 at 10:53am, Baoquan He wrote:
> > On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> > > From: Mike Rapoport 
> > > 
> > > Some architectures (e.g. ARC) have the ZONE_HIGHMEM zone below the
> > > ZONE_NORMAL. Allowing free_area_init() parse max_zone_pfn array even it is
> > > sorted in descending order allows using free_area_init() on such
> > > architectures.
> > > 
> > > Add top -> down traversal of max_zone_pfn array in free_area_init() and 
> > > use
> > > the latter in ARC node/zone initialization.
> > 
> > Or maybe leave ARC as is. The change in this patchset doesn't impact
> > ARC's handling about zone initialization, leaving it as is can reduce
> > the complication in implementation of free_area_init(), which is a
> > common function. So I personally don't see a strong motivation to have
> > this patch.
> 
> OK, seems this patch is prepared to simplify free_area_init_node(), so
> take back what I said at above.
> 
> Then this looks necessary, even though it introduces special case into
> common function free_area_init().

The idea is to have a single free_area_init() for all architectures
without keeping two completely different ways of calculating the zone
extents.
Another thing, is that with this we could eventually switch ARC from
DISCONTIGMEM.

> Reviewed-by: Baoquan He 
> 
> > 
> > > 
> > > Signed-off-by: Mike Rapoport 
> > > ---
> > >  arch/arc/mm/init.c | 36 +++-
> > >  mm/page_alloc.c| 24 +++-
> > >  2 files changed, 26 insertions(+), 34 deletions(-)
> > > 
> > > diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> > > index 0920c969c466..41eb9be1653c 100644
> > > --- a/arch/arc/mm/init.c
> > > +++ b/arch/arc/mm/init.c
> > > @@ -63,11 +63,13 @@ void __init early_init_dt_add_memory_arch(u64 base, 
> > > u64 size)
> > >  
> > >   low_mem_sz = size;
> > >   in_use = 1;
> > > + memblock_add_node(base, size, 0);
> > >   } else {
> > >  #ifdef CONFIG_HIGHMEM
> > >   high_mem_start = base;
> > >   high_mem_sz = size;
> > >   in_use = 1;
> > > + memblock_add_node(base, size, 1);
> > >  #endif
> > >   }
> > >  
> > > @@ -83,8 +85,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 
> > > size)
> > >   */
> > >  void __init setup_arch_memory(void)
> > >  {
> > > - unsigned long zones_size[MAX_NR_ZONES];
> > > - unsigned long zones_holes[MAX_NR_ZONES];
> > > + unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
> > >  
> > >   init_mm.start_code = (unsigned long)_text;
> > >   init_mm.end_code = (unsigned long)_etext;
> > > @@ -115,7 +116,6 @@ void __init setup_arch_memory(void)
> > >* the crash
> > >*/
> > >  
> > > - memblock_add_node(low_mem_start, low_mem_sz, 0);
> > >   memblock_reserve(CONFIG_LINUX_LINK_BASE,
> > >__pa(_end) - CONFIG_LINUX_LINK_BASE);
> > >  
> > > @@ -133,22 +133,7 @@ void __init setup_arch_memory(void)
> > >   memblock_dump_all();
> > >  
> > >   /*- node/zones setup --*/
> > > - memset(zones_size, 0, sizeof(zones_size));
> > > - memset(zones_holes, 0, sizeof(zones_holes));
> > > -
> > > - zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
> > > - zones_holes[ZONE_NORMAL] = 0;
> > > -
> > > - /*
> > > -  * We can't use the helper free_area_init(zones[]) because it uses
> > > -  * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
> > > -  * when our kernel doesn't start at PAGE_OFFSET, i.e.
> > > -  * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE
> > > -  */
> > > - free_area_init_node(0,  /* node-id */
> > > - zones_size, /* num pages per zone */
> > > - min_low_pfn,/* first pfn of node */
> > > - zones_holes);   /* holes */
> > > + max_zone_pfn[ZONE_NORMAL] = max_low_pfn;
> > >  
> > >  #ifdef CONFIG_HIGHMEM
> > >   /*
> > > @@ -168,20 +153,13 @@ void __init setup_arch_memory(void)
> > >   min_high_pfn = PFN_DOWN(high_mem_start);
> > >   max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
> > >  
> > > - zones_size[ZONE_NORMAL] = 0;
> > > - zones_holes[ZONE_NORMAL] = 0;
> > > -
> > > - zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
> > > - zones_holes[ZONE_HIGHMEM] = 0;
> > > -
> > > - free_area_init_node(1,  /* node-id */
> > > - zones_size, /* num pages per zone */
> > > - min_high_pfn,   /* first pfn of node */
> > > - zones_holes);   /* holes */
> > > + max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
> > >  
> > >   high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
> > >   kmap_init();
> > >  #endif
> > > +
> > > + free_area_init(max_zone_pfn);
> > >  }
> > >  
> > >  /*
> > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > index 343d87b8697d..376434c7a78b 100644
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc

Re: [PATCH 18/21] mm: rename free_area_init_node() to free_area_init_memoryless_node()

2020-04-22 Thread Mike Rapoport
On Thu, Apr 23, 2020 at 11:14:54AM +0800, Baoquan He wrote:
> On 04/12/20 at 10:48pm, Mike Rapoport wrote:
> > From: Mike Rapoport 
> > 
> > The free_area_init_node() is only used by x86 to initialize a memory-less
> > nodes.
> > Make its name reflect this and drop all the function parameters except node
> > ID as they are anyway zero.
> > 
> > Signed-off-by: Mike Rapoport 
> > ---
> >  arch/x86/mm/numa.c | 5 +
> >  include/linux/mm.h | 9 +++--
> >  mm/page_alloc.c| 7 ++-
> >  3 files changed, 6 insertions(+), 15 deletions(-)
> > 
> > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> > index fe024b2ac796..8ee952038c80 100644
> > --- a/arch/x86/mm/numa.c
> > +++ b/arch/x86/mm/numa.c
> > @@ -737,12 +737,9 @@ void __init x86_numa_init(void)
> >  
> >  static void __init init_memory_less_node(int nid)
> >  {
> > -   unsigned long zones_size[MAX_NR_ZONES] = {0};
> > -   unsigned long zholes_size[MAX_NR_ZONES] = {0};
> > -
> > /* Allocate and initialize node data. Memory-less node is now online.*/
> > alloc_node_data(nid);
> > -   free_area_init_node(nid, zones_size, 0, zholes_size);
> > +   free_area_init_memoryless_node(nid);
> >  
> > /*
> >  * All zonelists will be built later in start_kernel() after per cpu
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index 1c2ecb42e043..27660f6cf26e 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -2272,8 +2272,7 @@ static inline spinlock_t *pud_lock(struct mm_struct 
> > *mm, pud_t *pud)
> >  }
> >  
> >  extern void __init pagecache_init(void);
> > -extern void __init free_area_init_node(int nid, unsigned long * zones_size,
> > -   unsigned long zone_start_pfn, unsigned long *zholes_size);
> > +extern void __init free_area_init_memoryless_node(int nid);
> >  extern void free_initmem(void);
> >  
> >  /*
> > @@ -2345,10 +2344,8 @@ static inline unsigned long get_num_physpages(void)
> >  
> >  /*
> >   * Using memblock node mappings, an architecture may initialise its
> > - * zones, allocate the backing mem_map and account for memory holes in a 
> > more
> > - * architecture independent manner. This is a substitute for creating the
> > - * zone_sizes[] and zholes_size[] arrays and passing them to
> > - * free_area_init_node()
> > + * zones, allocate the backing mem_map and account for memory holes in an
> > + * architecture independent manner.
> >   *
> >   * An architecture is expected to register range of page frames backed by
> >   * physical memory with memblock_add[_node]() before calling
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 376434c7a78b..e46232ec4849 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -6979,12 +6979,9 @@ static void __init __free_area_init_node(int nid, 
> > unsigned long *zones_size,
> > free_area_init_core(pgdat);
> >  }
> >  
> > -void __init free_area_init_node(int nid, unsigned long *zones_size,
> > -   unsigned long node_start_pfn,
> > -   unsigned long *zholes_size)
> > +void __init free_area_init_memoryless_node(int nid)
> >  {
> > -   __free_area_init_node(nid, zones_size, node_start_pfn, zholes_size,
> > - true);
> > +   __free_area_init_node(nid, NULL, 0, NULL, false);
> 
> Can we move free_area_init_memoryless_node() definition into 
> arch/x86/mm/numa.c since there's only one caller there?
> 
> And I am also wondering if adding a wrapper
> free_area_init_memoryless_node() is necessary if it's only called the
> function free_area_init_node().

Yeah, I think this patch can be entirely dropped and the next one could
be slightly updated :)
Thanks!

> >  }
> >  
> >  #if !defined(CONFIG_FLAT_NODE_MEM_MAP) -- 
> > 2.25.1
> > 
> 

-- 
Sincerely yours,
Mike.

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc