Re: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS

2021-06-11 Thread Bruce Ashfield
On Fri, Jun 11, 2021 at 12:15 PM Alexey Brodkin via
lists.yoctoproject.org 
wrote:
>
> Hi Bruce,
>
> Looks like you were trying to fix-up an author of 
> https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/commit/?h=yocto-5.10&id=b12e322c9f3144e3b18c8723790dc027476b3c70
>  but mistakenly did it for the next one 
> https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/commit/?h=yocto-5.10&id=422f8a09a856800f027bbae98dbab24cf3ae0f25.
>

The author as it comes in on your patches is rejected by the yocto git
servers, so yes, it had to be fixed up. I used your email address, and
yes, it looks like I got the wrong commit on one of them. Congrats on
the free commit! :D

Bruce

> I'm fine with current state of things, but just to let you know ;)
>
> -Alexey
> 
> From: Alexey Brodkin 
> Sent: Thursday, June 3, 2021 12:12 AM
> To: Bruce Ashfield 
> Cc: linux-yo...@lists.yoctoproject.org ; 
> linux-snps-arc@lists.infradead.org 
> Subject: Re: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS
>
> Hi Bruce,
>
> Please pardon my lack of good knowledge here as I don't deal with OE/Yocto 
> very often.
> So what are the options we have here?
>
> Given dependency on the Linux kernel v5.5 where that change 
> ("nsim_hs_defconfig" -> "haps_hs_defconfig") was done I'd say whatever active 
> branches of version above 5.5 exist would be good to get it.
>
> Looking at https://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-cache/ I'd 
> think these are: 5.10, 5.13 & "master" branches.
>
> -Alexey
> 
> From: Bruce Ashfield 
> Sent: Thursday, June 3, 2021 12:01 AM
> To: Alexey Brodkin 
> Cc: linux-yo...@lists.yoctoproject.org ; 
> linux-snps-arc@lists.infradead.org ; 
> Alexey Brodkin 
> Subject: Re: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS
>
> Looks good to me.
>
> What branches were you targetting for the change ?
>
> Bruce
>
> In message: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS
> on 31/05/2021 Alexey Brodkin via lists.yoctoproject.org wrote:
>
> > In v5.5 kernel we merged "nsim_hs" config into "haps_hs", see [1],
> > and from then on we use the same one "haps_hs" for everything simulated:
> > nSIM/QEMU/FPGA.
> >
> > Of important notes:
> >  * We switched from legacy ARC UART to a standard DW UART
> >
> >  * QEMU port for ARC is under review upstream, see [2].
> >But even today with WIP version from our GitHub fork [3] its possible
> >to run this image for "hapshs" machine as simple as:
> >->8--
> >$ qemu-system-arc -cpu archs -M virt -nographic -no-reboot -monitor none 
> > \
> >  -kernel 
> > build/tmp-glibc/deploy/images/hapshs/vmlinux-initramfs-hapshs.bin
> >->8--
> >
> > [1] 
> > https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1681baa713aa138d3f0f77f05c3de1cd6416c7d6__;!!A4F2R9G_pg!Kky99r2sqXZzDoCmjJ78MNNtcrXGIN8a8ILbgukM-lZ6eweRt8pm63oo9HR2lohj$
> > [2] 
> > https://urldefense.com/v3/__https://lists.gnu.org/archive/html/qemu-devel/2021-04/msg00458.html__;!!A4F2R9G_pg!Kky99r2sqXZzDoCmjJ78MNNtcrXGIN8a8ILbgukM-lZ6eweRt8pm63oo9GmSrEmD$
> > [3] 
> > https://urldefense.com/v3/__https://github.com/foss-for-synopsys-dwc-arc-processors/qemu__;!!A4F2R9G_pg!Kky99r2sqXZzDoCmjJ78MNNtcrXGIN8a8ILbgukM-lZ6eweRt8pm63oo9N20qLr4$
> >
> > Signed-off-by: Alexey Brodkin 
> > ---
> >  .../nsimhs-standard.scc => hapshs/hapshs-standard.scc}   |  4 ++--
> >  bsp/hapshs/hapshs.cfg| 12 
> > 
> >  bsp/{nsimhs/nsimhs.scc => hapshs/hapshs.scc} |  2 +-
> >  bsp/nsimhs/nsimhs.cfg| 10 
> > --
> >  4 files changed, 15 insertions(+), 13 deletions(-)
> >  rename bsp/{nsimhs/nsimhs-standard.scc => hapshs/hapshs-standard.scc} (72%)
> >  create mode 100644 bsp/hapshs/hapshs.cfg
> >  rename bsp/{nsimhs/nsimhs.scc => hapshs/hapshs.scc} (54%)
> >  delete mode 100644 bsp/nsimhs/nsimhs.cfg
> >
> > diff --git a/bsp/nsimhs/nsimhs-standard.scc b/bsp/hapshs/hapshs-standard.scc
> > similarity index 72%
> > rename from bsp/nsimhs/nsimhs-standard.scc
> > rename to bsp/hapshs/hapshs-standard.scc
> > index 3201ca52..1842b00c 100644
> > --- a/bsp/nsimhs/nsimhs-standard.scc
> > +++ b/bsp/hapshs/hapshs-standard.scc
> > @@ -1,8 +1,8 @@
> >  # SPDX-License-Identifier: MIT
> > -define KMACHINE nsimhs
> > +define KMACHINE hapshs
> >  define KTYPE standard
> >  define KARCH arc
> >
> >  include ktypes/standard/standard.scc
> >
> > -include nsimhs.scc
> > +include hapshs.scc
> > diff --git a/bsp/hapshs/hapshs.cfg b/bsp/hapshs/hapshs.cfg
> > new file mode 100644
> > index ..adcc0531
> > --- /dev/null
> > +++ b/bsp/hapshs/hapshs.cfg
> > @@ -0,0 +1,12 @@
> > +# SPDX-License-Identifier: MIT
> > +# ARCv2 ISA
> > +CONFIG_ISA_ARCV2=y
> > +
> > +# Serial port
> > +CONF

Re: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS

2021-06-11 Thread Bruce Ashfield
On Fri, Jun 11, 2021 at 1:00 PM Alexey Brodkin
 wrote:
>
> Hi Bruce,
>
> > The author as it comes in on your patches is rejected by the yocto git
> > servers, so yes, it had to be fixed up.
>
> Do you know what needs to be done to get that fixed?
> I hope to keep sending patches from time to time
> (and was about to send yet another one just now),
> so would be good to make things simpler and exclude
> that manual fix-up step.

Did you send the patch via git-send email ? And what smtp relay did
you use (if that's the case).

The patch had a "via lists.yoctoproject.org" in the author, and that
is what caused the server's pre-commit hook to reject it.

Bruce

>
> -Alexey



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

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


Re: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS

2021-06-11 Thread Alexey Brodkin
Hi Bruce,

> The author as it comes in on your patches is rejected by the yocto git
> servers, so yes, it had to be fixed up.

Do you know what needs to be done to get that fixed?
I hope to keep sending patches from time to time
(and was about to send yet another one just now),
so would be good to make things simpler and exclude
that manual fix-up step.

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


Re: [PATCH v3 5/9] mm: remove CONFIG_DISCONTIGMEM

2021-06-11 Thread Stephen Brennan
Mike Rapoport  writes:
> From: Mike Rapoport 
>
> There are no architectures that support DISCONTIGMEM left.
>
> Remove the configuration option and the dead code it was guarding in the
> generic memory management code.
>
> Signed-off-by: Mike Rapoport 
> ---
>  include/asm-generic/memory_model.h | 37 --
>  include/linux/mmzone.h |  8 ---
>  mm/Kconfig | 25 +++-
>  mm/page_alloc.c| 13 ---
>  4 files changed, 12 insertions(+), 71 deletions(-)
>
> diff --git a/include/asm-generic/memory_model.h 
> b/include/asm-generic/memory_model.h
> index 7637fb46ba4f..a2c8ed60233a 100644
> --- a/include/asm-generic/memory_model.h
> +++ b/include/asm-generic/memory_model.h
> @@ -6,47 +6,18 @@
>  
>  #ifndef __ASSEMBLY__
>  
> +/*
> + * supports 3 memory models.
> + */

This comment could either be updated to reflect 2 memory models, or
removed entirely.

Thanks,
Stephen

>  #if defined(CONFIG_FLATMEM)
>  
>  #ifndef ARCH_PFN_OFFSET
>  #define ARCH_PFN_OFFSET  (0UL)
>  #endif
>  
> -#elif defined(CONFIG_DISCONTIGMEM)
> -
> -#ifndef arch_pfn_to_nid
> -#define arch_pfn_to_nid(pfn) pfn_to_nid(pfn)
> -#endif
> -
> -#ifndef arch_local_page_offset
> -#define arch_local_page_offset(pfn, nid) \
> - ((pfn) - NODE_DATA(nid)->node_start_pfn)
> -#endif
> -
> -#endif /* CONFIG_DISCONTIGMEM */
> -
> -/*
> - * supports 3 memory models.
> - */
> -#if defined(CONFIG_FLATMEM)
> -
>  #define __pfn_to_page(pfn)   (mem_map + ((pfn) - ARCH_PFN_OFFSET))
>  #define __page_to_pfn(page)  ((unsigned long)((page) - mem_map) + \
>ARCH_PFN_OFFSET)
> -#elif defined(CONFIG_DISCONTIGMEM)
> -
> -#define __pfn_to_page(pfn)   \
> -({   unsigned long __pfn = (pfn);\
> - unsigned long __nid = arch_pfn_to_nid(__pfn);  \
> - NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
> -})
> -
> -#define __page_to_pfn(pg)\
> -({   const struct page *__pg = (pg); \
> - struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
> - (unsigned long)(__pg - __pgdat->node_mem_map) + \
> -  __pgdat->node_start_pfn;   \
> -})
>  
>  #elif defined(CONFIG_SPARSEMEM_VMEMMAP)
>  
> @@ -70,7 +41,7 @@
>   struct mem_section *__sec = __pfn_to_section(__pfn);\
>   __section_mem_map_addr(__sec) + __pfn;  \
>  })
> -#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
> +#endif /* CONFIG_FLATMEM/SPARSEMEM */
>  
>  /*
>   * Convert a physical address to a Page Frame Number and back
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 0d53eba1c383..700032e99419 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -738,10 +738,12 @@ struct zonelist {
>   struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
>  };
>  
> -#ifndef CONFIG_DISCONTIGMEM
> -/* The array of struct pages - for discontigmem use pgdat->lmem_map */
> +/*
> + * The array of struct pages for flatmem.
> + * It must be declared for SPARSEMEM as well because there are configurations
> + * that rely on that.
> + */
>  extern struct page *mem_map;
> -#endif
>  
>  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>  struct deferred_split {
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 02d44e3420f5..218b96ccc84a 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -19,7 +19,7 @@ choice
>  
>  config FLATMEM_MANUAL
>   bool "Flat Memory"
> - depends on !(ARCH_DISCONTIGMEM_ENABLE || ARCH_SPARSEMEM_ENABLE) || 
> ARCH_FLATMEM_ENABLE
> + depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
>   help
> This option is best suited for non-NUMA systems with
> flat address space. The FLATMEM is the most efficient
> @@ -32,21 +32,6 @@ config FLATMEM_MANUAL
>  
> If unsure, choose this option (Flat Memory) over any other.
>  
> -config DISCONTIGMEM_MANUAL
> - bool "Discontiguous Memory"
> - depends on ARCH_DISCONTIGMEM_ENABLE
> - help
> -   This option provides enhanced support for discontiguous
> -   memory systems, over FLATMEM.  These systems have holes
> -   in their physical address spaces, and this option provides
> -   more efficient handling of these holes.
> -
> -   Although "Discontiguous Memory" is still used by several
> -   architectures, it is considered deprecated in favor of
> -   "Sparse Memory".
> -
> -   If unsure, choose "Sparse Memory" over this option.
> -
>  config SPARSEMEM_MANUAL
>   bool "Sparse Memory"
>   depends on ARCH_SPARSEMEM_ENABLE
> @@ -62,17 +47,13 @@ config SPARSEMEM_MANUAL
>  
>  endchoice
>  
> -config DISCONTIGMEM
> - def_bool y
> - depends on (!SELECT_MEMORY_MODEL && ARCH_DISCONTIGMEM_ENABLE) || 
> DISCONTIGMEM_MANUAL
> -
>  config SPARSEMEM
>   def_bool y
>   depends on (!SELECT_MEMOR

Re: [linux-yocto] [PATCH] ARC: Rename nSIM HS to HAPS HS

2021-06-11 Thread Alexey Brodkin
> > > The author as it comes in on your patches is rejected by the yocto git
> > > servers, so yes, it had to be fixed up.
> >
> > Do you know what needs to be done to get that fixed?
> > I hope to keep sending patches from time to time
> > (and was about to send yet another one just now),
> > so would be good to make things simpler and exclude
> > that manual fix-up step.
> 
> Did you send the patch via git-send email ? And what smtp relay did
> you use (if that's the case).

I did sent it with "git send-email" as I always do. That was exactly my command:
>8---
 git send-email --to linux-yo...@lists.yoctoproject.org --cc 
linux-snps-arc@lists.infradead.org HEAD~1
>8---

I used our corporate SMPT server, again as I always used to do.
 
> The patch had a "via lists.yoctoproject.org" in the author, and that
> is what caused the server's pre-commit hook to reject it.

I think what might be wrong - on my first attempt to send it, it was discarded
by the mailing list as I didn't have my email alias properly set in the mailing 
list
settings. The thing is my internal and SoB email is "abrod...@synopsys.com",
while our email servers nicely convert that "shorter and supposedly ugly form"
into more beautiful "alexey.brod...@synopsys.com" once email leaves company's
premises.

So I added the latter email as an alias and on the second attempt it was 
accepted
by the mailing list.

Let's see. I'm going to post another patch now and hopefully it will work as it 
should.
If of any interest, I may add you as a Cc for it (it's for OE/gcc).

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


[PATCH] gcc: Fixes for ARC

2021-06-11 Thread Alexey Brodkin
A couple of fixes to be a part of 11.2 whenever it happens

1. 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0061fabeb9393c362601486105202cfe837a5a68
   Fixes "harfbuzz" build, see 
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/382
   for all the gory details.

2. 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4186b7e93be73f8d68dc0fcc00a4cc8cc83e99a8
   Fixes ext4 run-time issue:
   ->8---
   Path: /bin/busybox
   CPU: 0 PID: 1 Comm: init Not tainted 5.13.0-rc2-dirty #23
   Invalid Read @ 0x41c9e600 by insn @ __bio_try_merge_page+0x4e/0xfc
   ECR: 0x00050100 EFA: 0x41c9e600 ERET: 0x80159656
   STAT: 0x80080202 [IE K ]   BTA: 0x80159648
SP: 0x80821b88  FP: 0x0008 BLK: bio_add_page+0x22/0x5c
   LPS: 0x801a6a94 LPE: 0x801a6a98 LPC: 0x
   r00: 0x80823300 r01: 0xbfb85e38 r02: 0x2000
   r03: 0x r04: 0x80821b9b r05: 0x80821bfc
   r06: 0x r07: 0x0700 r08: 0x
   r09: 0x r10: 0x r11: 0x
   r12: 0x8080b300
   Stack Trace:
 __bio_try_merge_page+0x4e/0xfc
 bio_add_page+0x22/0x5c
 do_mpage_readpage+0x534/0x65c
 mpage_readahead+0x30/0xdc
 read_pages+0x34/0x194
 page_cache_ra_unbounded+0x56/0x154
 filemap_fault+0x25a/0x5d8
 __do_fault+0x94/0xe8
 handle_mm_fault+0x4de/0xbd4
 do_page_fault+0x108/0x21c
 ret_from_exception+0x0/0x8
   ->8---

3. 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5a9b6a004f89fdd95b0470e1324dc4dee8c41d24
   Precautious fix for rare corner cases which we don't wnat to really end-up 
in.

Signed-off-by: Alexey Brodkin 
---
 meta/recipes-devtools/gcc/gcc-11.1.inc |   3 +
 ...0038-arc-Update-64bit-move-split-patterns.patch | 290 +
 .../gcc/gcc/0039-arc-Fix-u-maddhisi-patterns.patch | 127 +
 .../gcc/0040-arc-Update-doloop_end-patterns.patch  | 105 
 4 files changed, 525 insertions(+)
 create mode 100644 
meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch
 create mode 100644 
meta/recipes-devtools/gcc/gcc/0039-arc-Fix-u-maddhisi-patterns.patch
 create mode 100644 
meta/recipes-devtools/gcc/gcc/0040-arc-Update-doloop_end-patterns.patch

diff --git a/meta/recipes-devtools/gcc/gcc-11.1.inc 
b/meta/recipes-devtools/gcc/gcc-11.1.inc
index bf29879ded..69e4c8bacc 100644
--- a/meta/recipes-devtools/gcc/gcc-11.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-11.1.inc
@@ -69,6 +69,9 @@ SRC_URI = "\
file://0036-mingw32-Enable-operation_not_supported.patch \
file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \

file://0001-Revert-libstdc-Install-libstdc-gdb.py-more-robustly-.patch \
+   file://0038-arc-Update-64bit-move-split-patterns.patch \
+   file://0039-arc-Fix-u-maddhisi-patterns.patch \
+   file://0040-arc-Update-doloop_end-patterns.patch \
 "
 SRC_URI[sha256sum] = 
"4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf"
 SRC_URI[backports.sha256sum] = 
"69274bebd6c069a13443d4af61070e854740a639ec4d66eedf3e80070363587b"
diff --git 
a/meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch 
b/meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch
new file mode 100644
index 00..37fe95d711
--- /dev/null
+++ 
b/meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch
@@ -0,0 +1,290 @@
+From 0061fabeb9393c362601486105202cfe837a5a68 Mon Sep 17 00:00:00 2001
+From: Claudiu Zissulescu 
+Date: Wed, 9 Jun 2021 12:12:57 +0300
+Subject: [PATCH] arc: Update 64bit move split patterns.
+
+ARCv2HS can use a limited number of instructions to implement 64bit
+moves. The VADD2 is used as a 64bit move, the LDD/STD are 64 bit loads
+and stores. All those instructions are not baseline, hence we need to
+provide alternatives when they are not available or cannot be generate
+due to instruction restriction.
+
+This patch is cleaning up those move patterns, and updates splits
+instruction lengths.
+
+This is a backport from mainline gcc.
+
+gcc/
+2021-06-09  Claudiu Zissulescu  
+
+   * config/arc/arc-protos.h (arc_split_move_p): New prototype.
+   * config/arc/arc.c (arc_split_move_p): New function.
+   (arc_split_move): Clean up.
+   * config/arc/arc.md (movdi_insn): Clean up, use arc_split_move_p.
+   (movdf_insn): Likewise.
+   * config/arc/simdext.md (mov_insn): Likewise.
+
+Upstream-Status: Backport 
[https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0061fabeb9393c362601486105202cfe837a5a68]
+
+Signed-off-by: Claudiu Zissulescu 
+(cherry picked from commit c0ba7a8af5366c37241f20e8be41e362f7260389)
+Signed-off-by: Alexey Brodkin 
+---
+ gcc/config/arc/arc-protos.h |  1 +
+ gcc/config/arc/arc.c| 44 --
+ gcc/config/arc/arc.md   | 91 +
+ gcc/config/arc/simdext.md   | 38 

[PATCH] gcc: Fixes for ARC

2021-06-11 Thread Alexey Brodkin
A couple of fixes to be a part of 11.2 whenever it happens

1. 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0061fabeb9393c362601486105202cfe837a5a68
   Fixes "harfbuzz" build, see 
https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/382
   for all the gory details.

2. 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4186b7e93be73f8d68dc0fcc00a4cc8cc83e99a8
   Fixes ext4 run-time issue:
   ->8---
   Path: /bin/busybox
   CPU: 0 PID: 1 Comm: init Not tainted 5.13.0-rc2-dirty #23
   Invalid Read @ 0x41c9e600 by insn @ __bio_try_merge_page+0x4e/0xfc
   ECR: 0x00050100 EFA: 0x41c9e600 ERET: 0x80159656
   STAT: 0x80080202 [IE K ]   BTA: 0x80159648
SP: 0x80821b88  FP: 0x0008 BLK: bio_add_page+0x22/0x5c
   LPS: 0x801a6a94 LPE: 0x801a6a98 LPC: 0x
   r00: 0x80823300 r01: 0xbfb85e38 r02: 0x2000
   r03: 0x r04: 0x80821b9b r05: 0x80821bfc
   r06: 0x r07: 0x0700 r08: 0x
   r09: 0x r10: 0x r11: 0x
   r12: 0x8080b300
   Stack Trace:
 __bio_try_merge_page+0x4e/0xfc
 bio_add_page+0x22/0x5c
 do_mpage_readpage+0x534/0x65c
 mpage_readahead+0x30/0xdc
 read_pages+0x34/0x194
 page_cache_ra_unbounded+0x56/0x154
 filemap_fault+0x25a/0x5d8
 __do_fault+0x94/0xe8
 handle_mm_fault+0x4de/0xbd4
 do_page_fault+0x108/0x21c
 ret_from_exception+0x0/0x8
   ->8---

3. 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5a9b6a004f89fdd95b0470e1324dc4dee8c41d24
   Precautious fix for rare corner cases which we don't wnat to really end-up 
in.

Signed-off-by: Alexey Brodkin 
---
 meta/recipes-devtools/gcc/gcc-11.1.inc |   3 +
 ...0038-arc-Update-64bit-move-split-patterns.patch | 290 +
 .../gcc/gcc/0039-arc-Fix-u-maddhisi-patterns.patch | 127 +
 .../gcc/0040-arc-Update-doloop_end-patterns.patch  | 105 
 4 files changed, 525 insertions(+)
 create mode 100644 
meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch
 create mode 100644 
meta/recipes-devtools/gcc/gcc/0039-arc-Fix-u-maddhisi-patterns.patch
 create mode 100644 
meta/recipes-devtools/gcc/gcc/0040-arc-Update-doloop_end-patterns.patch

diff --git a/meta/recipes-devtools/gcc/gcc-11.1.inc 
b/meta/recipes-devtools/gcc/gcc-11.1.inc
index bf29879ded..69e4c8bacc 100644
--- a/meta/recipes-devtools/gcc/gcc-11.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-11.1.inc
@@ -69,6 +69,9 @@ SRC_URI = "\
file://0036-mingw32-Enable-operation_not_supported.patch \
file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \

file://0001-Revert-libstdc-Install-libstdc-gdb.py-more-robustly-.patch \
+   file://0038-arc-Update-64bit-move-split-patterns.patch \
+   file://0039-arc-Fix-u-maddhisi-patterns.patch \
+   file://0040-arc-Update-doloop_end-patterns.patch \
 "
 SRC_URI[sha256sum] = 
"4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf"
 SRC_URI[backports.sha256sum] = 
"69274bebd6c069a13443d4af61070e854740a639ec4d66eedf3e80070363587b"
diff --git 
a/meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch 
b/meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch
new file mode 100644
index 00..37fe95d711
--- /dev/null
+++ 
b/meta/recipes-devtools/gcc/gcc/0038-arc-Update-64bit-move-split-patterns.patch
@@ -0,0 +1,290 @@
+From 0061fabeb9393c362601486105202cfe837a5a68 Mon Sep 17 00:00:00 2001
+From: Claudiu Zissulescu 
+Date: Wed, 9 Jun 2021 12:12:57 +0300
+Subject: [PATCH] arc: Update 64bit move split patterns.
+
+ARCv2HS can use a limited number of instructions to implement 64bit
+moves. The VADD2 is used as a 64bit move, the LDD/STD are 64 bit loads
+and stores. All those instructions are not baseline, hence we need to
+provide alternatives when they are not available or cannot be generate
+due to instruction restriction.
+
+This patch is cleaning up those move patterns, and updates splits
+instruction lengths.
+
+This is a backport from mainline gcc.
+
+gcc/
+2021-06-09  Claudiu Zissulescu  
+
+   * config/arc/arc-protos.h (arc_split_move_p): New prototype.
+   * config/arc/arc.c (arc_split_move_p): New function.
+   (arc_split_move): Clean up.
+   * config/arc/arc.md (movdi_insn): Clean up, use arc_split_move_p.
+   (movdf_insn): Likewise.
+   * config/arc/simdext.md (mov_insn): Likewise.
+
+Upstream-Status: Backport 
[https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0061fabeb9393c362601486105202cfe837a5a68]
+
+Signed-off-by: Claudiu Zissulescu 
+(cherry picked from commit c0ba7a8af5366c37241f20e8be41e362f7260389)
+Signed-off-by: Alexey Brodkin 
+---
+ gcc/config/arc/arc-protos.h |  1 +
+ gcc/config/arc/arc.c| 44 --
+ gcc/config/arc/arc.md   | 91 +
+ gcc/config/arc/simdext.md   | 38 

Re: [PATCH v3 5/9] mm: remove CONFIG_DISCONTIGMEM

2021-06-11 Thread Mike Rapoport
On Fri, Jun 11, 2021 at 01:53:48PM -0700, Stephen Brennan wrote:
> Mike Rapoport  writes:
> > From: Mike Rapoport 
> >
> > There are no architectures that support DISCONTIGMEM left.
> >
> > Remove the configuration option and the dead code it was guarding in the
> > generic memory management code.
> >
> > Signed-off-by: Mike Rapoport 
> > ---
> >  include/asm-generic/memory_model.h | 37 --
> >  include/linux/mmzone.h |  8 ---
> >  mm/Kconfig | 25 +++-
> >  mm/page_alloc.c| 13 ---
> >  4 files changed, 12 insertions(+), 71 deletions(-)
> >
> > diff --git a/include/asm-generic/memory_model.h 
> > b/include/asm-generic/memory_model.h
> > index 7637fb46ba4f..a2c8ed60233a 100644
> > --- a/include/asm-generic/memory_model.h
> > +++ b/include/asm-generic/memory_model.h
> > @@ -6,47 +6,18 @@
> >  
> >  #ifndef __ASSEMBLY__
> >  
> > +/*
> > + * supports 3 memory models.
> > + */
> 
> This comment could either be updated to reflect 2 memory models, or
> removed entirely.

I counted SPARSE and SPARSE_VMEMMAP as 2.

The code below has three clauses: one for FLATMEM, one for SPARSE and one
for VMEMMAP.
 
> Thanks,
> Stephen
> 
> >  #if defined(CONFIG_FLATMEM)
> >  
> >  #ifndef ARCH_PFN_OFFSET
> >  #define ARCH_PFN_OFFSET(0UL)
> >  #endif
> >  
> > -#elif defined(CONFIG_DISCONTIGMEM)
> > -
> > -#ifndef arch_pfn_to_nid
> > -#define arch_pfn_to_nid(pfn)   pfn_to_nid(pfn)
> > -#endif
> > -
> > -#ifndef arch_local_page_offset
> > -#define arch_local_page_offset(pfn, nid)   \
> > -   ((pfn) - NODE_DATA(nid)->node_start_pfn)
> > -#endif
> > -
> > -#endif /* CONFIG_DISCONTIGMEM */
> > -
> > -/*
> > - * supports 3 memory models.
> > - */
> > -#if defined(CONFIG_FLATMEM)
> > -
> >  #define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
> >  #define __page_to_pfn(page)((unsigned long)((page) - mem_map) + \
> >  ARCH_PFN_OFFSET)
> > -#elif defined(CONFIG_DISCONTIGMEM)
> > -
> > -#define __pfn_to_page(pfn) \
> > -({ unsigned long __pfn = (pfn);\
> > -   unsigned long __nid = arch_pfn_to_nid(__pfn);  \
> > -   NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
> > -})
> > -
> > -#define __page_to_pfn(pg)  \
> > -({ const struct page *__pg = (pg); \
> > -   struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
> > -   (unsigned long)(__pg - __pgdat->node_mem_map) + \
> > -__pgdat->node_start_pfn;   \
> > -})
> >  
> >  #elif defined(CONFIG_SPARSEMEM_VMEMMAP)
> >  
> > @@ -70,7 +41,7 @@
> > struct mem_section *__sec = __pfn_to_section(__pfn);\
> > __section_mem_map_addr(__sec) + __pfn;  \
> >  })
> > -#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
> > +#endif /* CONFIG_FLATMEM/SPARSEMEM */
> >  
> >  /*
> >   * Convert a physical address to a Page Frame Number and back
> > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> > index 0d53eba1c383..700032e99419 100644
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -738,10 +738,12 @@ struct zonelist {
> > struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
> >  };
> >  
> > -#ifndef CONFIG_DISCONTIGMEM
> > -/* The array of struct pages - for discontigmem use pgdat->lmem_map */
> > +/*
> > + * The array of struct pages for flatmem.
> > + * It must be declared for SPARSEMEM as well because there are 
> > configurations
> > + * that rely on that.
> > + */
> >  extern struct page *mem_map;
> > -#endif
> >  
> >  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> >  struct deferred_split {
> > diff --git a/mm/Kconfig b/mm/Kconfig
> > index 02d44e3420f5..218b96ccc84a 100644
> > --- a/mm/Kconfig
> > +++ b/mm/Kconfig
> > @@ -19,7 +19,7 @@ choice
> >  
> >  config FLATMEM_MANUAL
> > bool "Flat Memory"
> > -   depends on !(ARCH_DISCONTIGMEM_ENABLE || ARCH_SPARSEMEM_ENABLE) || 
> > ARCH_FLATMEM_ENABLE
> > +   depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
> > help
> >   This option is best suited for non-NUMA systems with
> >   flat address space. The FLATMEM is the most efficient
> > @@ -32,21 +32,6 @@ config FLATMEM_MANUAL
> >  
> >   If unsure, choose this option (Flat Memory) over any other.
> >  
> > -config DISCONTIGMEM_MANUAL
> > -   bool "Discontiguous Memory"
> > -   depends on ARCH_DISCONTIGMEM_ENABLE
> > -   help
> > - This option provides enhanced support for discontiguous
> > - memory systems, over FLATMEM.  These systems have holes
> > - in their physical address spaces, and this option provides
> > - more efficient handling of these holes.
> > -
> > - Although "Discontiguous Memory" is still used by several
> > - architectures, it is considered deprecated in favor of
> > - "Sparse Memory".
> > -
> > - If unsure, c